您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DO_GLOBAL_REFLOW_COUNT函数代码示例

51自学网 2021-06-01 20:23:17
  C++
这篇教程C++ DO_GLOBAL_REFLOW_COUNT函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DO_GLOBAL_REFLOW_COUNT函数的典型用法代码示例。如果您正苦于以下问题:C++ DO_GLOBAL_REFLOW_COUNT函数的具体用法?C++ DO_GLOBAL_REFLOW_COUNT怎么用?C++ DO_GLOBAL_REFLOW_COUNT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DO_GLOBAL_REFLOW_COUNT函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMP nsLegendFrame::Reflow(nsPresContext*          aPresContext,                     nsHTMLReflowMetrics&     aDesiredSize,                     const nsHTMLReflowState& aReflowState,                     nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsLegendFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  if (mState & NS_FRAME_FIRST_REFLOW) {    nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), PR_TRUE);  }  return nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:13,


示例2: DO_GLOBAL_REFLOW_COUNT

NS_METHODnsImageControlFrame::Reflow(nsPresContext*         aPresContext,                           nsHTMLReflowMetrics&     aDesiredSize,                           const nsHTMLReflowState& aReflowState,                           nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsImageControlFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  if (!GetPrevInFlow() && (mState & NS_FRAME_FIRST_REFLOW)) {    nsFormControlFrame::RegUnRegAccessKey(this, PR_TRUE);  }  return nsImageControlFrameSuper::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:13,


示例3: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMPnsRootBoxFrame::Reflow(nsPresContext*           aPresContext,                       nsHTMLReflowMetrics&     aDesiredSize,                       const nsHTMLReflowState& aReflowState,                       nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsRootBoxFrame");#ifdef DEBUG_REFLOW  gReflows++;  printf("----Reflow %d----/n", gReflows);#endif  return nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:14,


示例4: while

nsresultnsPlaceholderFrame::Reflow(nsPresContext*           aPresContext,                           nsHTMLReflowMetrics&     aDesiredSize,                           const nsHTMLReflowState& aReflowState,                           nsReflowStatus&          aStatus){#ifdef DEBUG  // We should be getting reflowed before our out-of-flow.  // If this is our first reflow, and our out-of-flow has already received its  // first reflow (before us), complain.  // XXXdholbert This "look for a previous continuation or IB-split sibling"  // code could use nsLayoutUtils::GetPrevContinuationOrIBSplitSibling(), if  // we ever add a function like that. (We currently have a "Next" version.)  if ((GetStateBits() & NS_FRAME_FIRST_REFLOW) &&      !(mOutOfFlowFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {    // Unfortunately, this can currently happen when the placeholder is in a    // later continuation or later IB-split sibling than its out-of-flow (as    // is the case in some of our existing unit tests). So for now, in that    // case, we'll warn instead of asserting.    bool isInContinuationOrIBSplit = false;    nsIFrame* ancestor = this;    while ((ancestor = ancestor->GetParent())) {      if (ancestor->GetPrevContinuation() ||          ancestor->Properties().Get(IBSplitPrevSibling())) {        isInContinuationOrIBSplit = true;        break;      }    }    if (isInContinuationOrIBSplit) {      NS_WARNING("Out-of-flow frame got reflowed before its placeholder");    } else {      NS_ERROR("Out-of-flow frame got reflowed before its placeholder");    }  }#endif  DO_GLOBAL_REFLOW_COUNT("nsPlaceholderFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  aDesiredSize.Width() = 0;  aDesiredSize.Height() = 0;  aStatus = NS_FRAME_COMPLETE;  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);  return NS_OK;}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:47,


示例5: DO_GLOBAL_REFLOW_COUNT

nsresultnsLeafFrame::Reflow(nsPresContext* aPresContext,                    nsHTMLReflowMetrics& aMetrics,                    const nsHTMLReflowState& aReflowState,                    nsReflowStatus& aStatus){  DO_GLOBAL_REFLOW_COUNT("nsLeafFrame");  NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,                 ("enter nsLeafFrame::Reflow: aMaxSize=%d,%d",                  aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));  NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");  DoReflow(aPresContext, aMetrics, aReflowState, aStatus);  FinishAndStoreOverflow(&aMetrics);  return NS_OK;}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:18,


示例6: DO_GLOBAL_REFLOW_COUNT

voidnsTableColFrame::Reflow(nsPresContext*          aPresContext,                                  nsHTMLReflowMetrics&     aDesiredSize,                                  const nsHTMLReflowState& aReflowState,                                  nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsTableColFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  aDesiredSize.ClearSize();  const nsStyleVisibility* colVis = StyleVisibility();  bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);  if (collapseCol) {    nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);    tableFrame->SetNeedToCollapse(true);  }  aStatus = NS_FRAME_COMPLETE;  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:18,


示例7: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMPnsPlaceholderFrame::Reflow(nsPresContext*          aPresContext,                           nsHTMLReflowMetrics&     aDesiredSize,                           const nsHTMLReflowState& aReflowState,                           nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsPlaceholderFrame", aReflowState.reason);  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  aDesiredSize.width = 0;  aDesiredSize.height = 0;  aDesiredSize.ascent = 0;  aDesiredSize.descent = 0;  if (aDesiredSize.mComputeMEW) {    aDesiredSize.mMaxElementWidth = 0;  }  aStatus = NS_FRAME_COMPLETE;  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);  return NS_OK;}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:20,


示例8: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMP nsProgressFrame::Reflow(nsPresContext*           aPresContext,                                      nsHTMLReflowMetrics&     aDesiredSize,                                      const nsHTMLReflowState& aReflowState,                                      nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsProgressFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  NS_ASSERTION(mBarDiv, "Progress bar div must exist!");  NS_ASSERTION(!GetPrevContinuation(),               "nsProgressFrame should not have continuations; if it does we "               "need to call RegUnregAccessKey only for the first.");  if (mState & NS_FRAME_FIRST_REFLOW) {    nsFormControlFrame::RegUnRegAccessKey(this, true);  }  nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();  NS_ASSERTION(barFrame, "The progress frame should have a child with a frame!");  ReflowBarFrame(barFrame, aPresContext, aReflowState, aStatus);  aDesiredSize.width = aReflowState.ComputedWidth() +                       aReflowState.mComputedBorderPadding.LeftRight();  aDesiredSize.height = aReflowState.ComputedHeight() +                        aReflowState.mComputedBorderPadding.TopBottom();  aDesiredSize.height = NS_CSS_MINMAX(aDesiredSize.height,                                      aReflowState.mComputedMinHeight,                                      aReflowState.mComputedMaxHeight);  aDesiredSize.SetOverflowAreasToDesiredBounds();  ConsiderChildOverflow(aDesiredSize.mOverflowAreas, barFrame);  FinishAndStoreOverflow(&aDesiredSize);  aStatus = NS_FRAME_COMPLETE;  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);  return NS_OK;}
开发者ID:lofter2011,项目名称:Icefox,代码行数:40,


示例9: DO_GLOBAL_REFLOW_COUNT

NS_METHOD nsTableColGroupFrame::Reflow(nsPresContext*          aPresContext,                                       nsHTMLReflowMetrics&     aDesiredSize,                                       const nsHTMLReflowState& aReflowState,                                       nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsTableColGroupFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  NS_ASSERTION(nsnull!=mContent, "bad state -- null content for frame");  nsresult rv=NS_OK;    const nsStyleVisibility* groupVis = GetStyleVisibility();  bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);  if (collapseGroup) {    nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);    tableFrame->SetNeedToCollapse(true);  }  // for every content child that (is a column thingy and does not already have a frame)  // create a frame and adjust it's style    for (nsIFrame *kidFrame = mFrames.FirstChild(); kidFrame;       kidFrame = kidFrame->GetNextSibling()) {    // Give the child frame a chance to reflow, even though we know it'll have 0 size    nsHTMLReflowMetrics kidSize;    nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,                                     nsSize(0,0));    nsReflowStatus status;    ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, 0, 0, 0, status);    FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, 0, 0, 0);  }  aDesiredSize.width=0;  aDesiredSize.height=0;  aStatus = NS_FRAME_COMPLETE;  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);  return rv;}
开发者ID:lofter2011,项目名称:Icefox,代码行数:37,


示例10: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMP nsFileControlFrame::Reflow(nsPresContext*          aPresContext,                                          nsHTMLReflowMetrics&     aDesiredSize,                                         const nsHTMLReflowState& aReflowState,                                          nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsFileControlFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  aStatus = NS_FRAME_COMPLETE;  if (mState & NS_FRAME_FIRST_REFLOW) {    mTextFrame = GetTextControlFrame(aPresContext, this);    NS_ENSURE_TRUE(mTextFrame, NS_ERROR_UNEXPECTED);    if (mCachedState) {      mTextFrame->SetFormProperty(nsGkAtoms::value, *mCachedState);      delete mCachedState;      mCachedState = nsnull;    }  }  // The Areaframe takes care of all our reflow  return nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState,                             aStatus);}
开发者ID:ahadzi,项目名称:celtx,代码行数:24,


示例11: DO_GLOBAL_REFLOW_COUNT

/* virtual */ voidnsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,                                 nsHTMLReflowMetrics& aDesiredSize,                                 const nsHTMLReflowState& aReflowState,                                 nsReflowStatus& aStatus){  DO_GLOBAL_REFLOW_COUNT("nsRubyTextContainerFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  // All rt children have already been reflowed. All we need to do is clean up  // the line layout.  aStatus = NS_FRAME_COMPLETE;  mozilla::WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();  mozilla::WritingMode frameWM = aReflowState.GetWritingMode();  mozilla::LogicalMargin borderPadding =    aReflowState.ComputedLogicalBorderPadding();  aDesiredSize.ISize(lineWM) = mISize;  nsLayoutUtils::SetBSizeFromFontMetrics(this, aDesiredSize, aReflowState,                                         borderPadding, lineWM, frameWM);  nscoord bsize = aDesiredSize.BSize(lineWM);  if (!mLines.empty()) {    // Okay to use BlockStartAscent because it has just been correctly set by    // nsLayoutUtils::SetBSizeFromFontMetrics.    mLines.begin()->SetLogicalAscent(aDesiredSize.BlockStartAscent());    mLines.begin()->SetBounds(aReflowState.GetWritingMode(), 0, 0, mISize,                              bsize, mISize);  }  if (mLineLayout) {    mLineLayout->EndLineReflow();    mLineLayout = nullptr;  }}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:36,


示例12: DO_GLOBAL_REFLOW_COUNT

nsresult nsPageBreakFrame::Reflow(nsPresContext*           aPresContext,                         nsHTMLReflowMetrics&     aDesiredSize,                         const nsHTMLReflowState& aReflowState,                         nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsPageBreakFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  // Override reflow, since we don't want to deal with what our  // computed values are.  aDesiredSize.width = GetIntrinsicWidth();  aDesiredSize.height = (aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE ?                         0 : aReflowState.availableHeight);  // round the height down to the nearest pixel  aDesiredSize.height -=    aDesiredSize.height % nsPresContext::CSSPixelsToAppUnits(1);  // Note: not using NS_FRAME_FIRST_REFLOW here, since it's not clear whether  // DidReflow will always get called before the next Reflow() call.  mHaveReflowed = PR_TRUE;  aStatus = NS_FRAME_COMPLETE;   return NS_OK;}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:24,


示例13: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMPSpacerFrame::Reflow(nsPresContext*          aPresContext,                    nsHTMLReflowMetrics&     aMetrics,                    const nsHTMLReflowState& aReflowState,                    nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("SpacerFrame", aReflowState.reason);  DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);  aStatus = NS_FRAME_COMPLETE;  // By default, we have no area  aMetrics.width = 0;  aMetrics.height = 0;  aMetrics.ascent = 0;  aMetrics.descent = 0;  const nsStylePosition* position = GetStylePosition();  PRUint8 type = GetType();  switch (type) {  case TYPE_WORD:    break;  case TYPE_LINE:    aStatus = NS_INLINE_LINE_BREAK_AFTER(NS_FRAME_COMPLETE);    if (eStyleUnit_Coord == position->mHeight.GetUnit()) {      aMetrics.width = position->mHeight.GetCoordValue();    }    aMetrics.ascent = aMetrics.height;    break;  case TYPE_IMAGE:    // width    nsStyleUnit unit = position->mWidth.GetUnit();    if (eStyleUnit_Coord == unit) {      aMetrics.width = position->mWidth.GetCoordValue();    }    else if (eStyleUnit_Percent == unit)     {      if (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth)      {        float factor = position->mWidth.GetPercentValue();        aMetrics.width = NSToCoordRound (factor * aReflowState.availableWidth);      }    }    // height    unit = position->mHeight.GetUnit();    if (eStyleUnit_Coord == unit) {      aMetrics.height = position->mHeight.GetCoordValue();    }    else if (eStyleUnit_Percent == unit)     {      if (NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight)      {        float factor = position->mHeight.GetPercentValue();        aMetrics.width = NSToCoordRound (factor * aReflowState.availableHeight);      }    }    // accent    aMetrics.ascent = aMetrics.height;    break;  }  if (aMetrics.width || aMetrics.height) {    // Make sure that the other dimension is non-zero    if (!aMetrics.width) aMetrics.width = 1;    if (!aMetrics.height) aMetrics.height = 1;  }  if (aMetrics.mComputeMEW) {    aMetrics.SetMEWToActualWidth(aReflowState.mStylePosition->mWidth.GetUnit());  }  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);  return NS_OK;}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:77,


示例14: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMPnsFirstLetterFrame::Reflow(nsPresContext*          aPresContext,                           nsHTMLReflowMetrics&     aMetrics,                           const nsHTMLReflowState& aReflowState,                           nsReflowStatus&          aReflowStatus){  DO_GLOBAL_REFLOW_COUNT("nsFirstLetterFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aReflowStatus);  nsresult rv = NS_OK;  // Grab overflow list  DrainOverflowFrames(aPresContext);  nsIFrame* kid = mFrames.FirstChild();  // Setup reflow state for our child  nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight);  const nsMargin& bp = aReflowState.mComputedBorderPadding;  nscoord lr = bp.left + bp.right;  nscoord tb = bp.top + bp.bottom;  NS_ASSERTION(availSize.width != NS_UNCONSTRAINEDSIZE,               "should no longer use unconstrained widths");  availSize.width -= lr;  if (NS_UNCONSTRAINEDSIZE != availSize.height) {    availSize.height -= tb;  }  // Reflow the child  if (!aReflowState.mLineLayout) {    // When there is no lineLayout provided, we provide our own. The    // only time that the first-letter-frame is not reflowing in a    // line context is when its floating.    nsHTMLReflowState rs(aPresContext, aReflowState, kid, availSize);    nsLineLayout ll(aPresContext, nsnull, &aReflowState, nsnull);    ll.BeginLineReflow(bp.left, bp.top, availSize.width, NS_UNCONSTRAINEDSIZE,                       PR_FALSE, PR_TRUE);    rs.mLineLayout = &ll;    ll.SetFirstLetterStyleOK(PR_TRUE);    kid->WillReflow(aPresContext);    kid->Reflow(aPresContext, aMetrics, rs, aReflowStatus);    ll.EndLineReflow();  }  else {    // Pretend we are a span and reflow the child frame    nsLineLayout* ll = aReflowState.mLineLayout;    PRBool        pushedFrame;    NS_ASSERTION(ll->GetFirstLetterStyleOK() || GetPrevInFlow(),                 "First-in-flow first-letter should have first-letter style enabled in nsLineLayout!");    ll->BeginSpan(this, &aReflowState, bp.left, availSize.width);    ll->ReflowFrame(kid, aReflowStatus, &aMetrics, pushedFrame);    ll->EndSpan(this);  }  // Place and size the child and update the output metrics  kid->SetRect(nsRect(bp.left, bp.top, aMetrics.width, aMetrics.height));  kid->FinishAndStoreOverflow(&aMetrics);  kid->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);  aMetrics.width += lr;  aMetrics.height += tb;  aMetrics.ascent += bp.top;  mBaseline = aMetrics.ascent;  // Ensure that the overflow rect contains the child textframe's overflow rect.  // Note that if this is floating, the overline/underline drawable area is in  // the overflow rect of the child textframe.  aMetrics.mOverflowArea.UnionRect(aMetrics.mOverflowArea,                           nsRect(0, 0, aMetrics.width, aMetrics.height));  ConsiderChildOverflow(aMetrics.mOverflowArea, kid);  // Create a continuation or remove existing continuations based on  // the reflow completion status.  if (NS_FRAME_IS_COMPLETE(aReflowStatus)) {    if (aReflowState.mLineLayout) {      aReflowState.mLineLayout->SetFirstLetterStyleOK(PR_FALSE);    }    nsIFrame* kidNextInFlow = kid->GetNextInFlow();    if (kidNextInFlow) {      // Remove all of the childs next-in-flows      static_cast<nsContainerFrame*>(kidNextInFlow->GetParent())        ->DeleteNextInFlowChild(aPresContext, kidNextInFlow);    }  }  else {    // Create a continuation for the child frame if it doesn't already    // have one.    nsIFrame* nextInFlow;    rv = CreateNextInFlow(aPresContext, this, kid, nextInFlow);    if (NS_FAILED(rv)) {      return rv;    }    // And then push it to our overflow list    if (nextInFlow) {      kid->SetNextSibling(nsnull);      SetOverflowFrames(aPresContext, nextInFlow);    }//.........这里部分代码省略.........
开发者ID:ahadzi,项目名称:celtx,代码行数:101,


示例15: DO_GLOBAL_REFLOW_COUNT

voidnsLeafBoxFrame::Reflow(nsPresContext*   aPresContext,                     nsHTMLReflowMetrics&     aDesiredSize,                     const nsHTMLReflowState& aReflowState,                     nsReflowStatus&          aStatus){  // This is mostly a copy of nsBoxFrame::Reflow().  // We aren't able to share an implementation because of the frame  // class hierarchy.  If you make changes here, please keep  // nsBoxFrame::Reflow in sync.  DO_GLOBAL_REFLOW_COUNT("nsLeafBoxFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  NS_ASSERTION(aReflowState.ComputedWidth() >=0 &&               aReflowState.ComputedHeight() >= 0, "Computed Size < 0");#ifdef DO_NOISY_REFLOW  printf("/n-------------Starting LeafBoxFrame Reflow ----------------------------/n");  printf("%p ** nsLBF::Reflow %d R: ", this, myCounter++);  switch (aReflowState.reason) {    case eReflowReason_Initial:      printf("Ini");break;    case eReflowReason_Incremental:      printf("Inc");break;    case eReflowReason_Resize:      printf("Rsz");break;    case eReflowReason_StyleChange:      printf("Sty");break;    case eReflowReason_Dirty:      printf("Drt ");      break;    default:printf("<unknown>%d", aReflowState.reason);break;  }    printSize("AW", aReflowState.AvailableWidth());  printSize("AH", aReflowState.AvailableHeight());  printSize("CW", aReflowState.ComputedWidth());  printSize("CH", aReflowState.ComputedHeight());  printf(" */n");#endif  aStatus = NS_FRAME_COMPLETE;  // create the layout state  nsBoxLayoutState state(aPresContext, aReflowState.rendContext);  nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.ComputedHeight());  nsMargin m;  m = aReflowState.ComputedPhysicalBorderPadding();  //GetBorderAndPadding(m);  // this happens sometimes. So lets handle it gracefully.  if (aReflowState.ComputedHeight() == 0) {    nsSize minSize = GetMinSize(state);    computedSize.height = minSize.height - m.top - m.bottom;  }  nsSize prefSize(0,0);  // if we are told to layout intrinic then get our preferred size.  if (computedSize.width == NS_INTRINSICSIZE || computedSize.height == NS_INTRINSICSIZE) {     prefSize = GetPrefSize(state);     nsSize minSize = GetMinSize(state);     nsSize maxSize = GetMaxSize(state);     prefSize = BoundsCheck(minSize, prefSize, maxSize);  }  // get our desiredSize  if (aReflowState.ComputedWidth() == NS_INTRINSICSIZE) {    computedSize.width = prefSize.width;  } else {    computedSize.width += m.left + m.right;  }  if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {    computedSize.height = prefSize.height;  } else {    computedSize.height += m.top + m.bottom;  }  // handle reflow state min and max sizes  // XXXbz the width handling here seems to be wrong, since  // mComputedMin/MaxWidth is a content-box size, whole  // computedSize.width is a border-box size...  if (computedSize.width > aReflowState.ComputedMaxWidth())    computedSize.width = aReflowState.ComputedMaxWidth();  if (computedSize.width < aReflowState.ComputedMinWidth())    computedSize.width = aReflowState.ComputedMinWidth();  // Now adjust computedSize.height for our min and max computed  // height.  The only problem is that those are content-box sizes,  // while computedSize.height is a border-box size.  So subtract off  // m.TopBottom() before adjusting, then readd it.  computedSize.height = std::max(0, computedSize.height - m.TopBottom());//.........这里部分代码省略.........
开发者ID:cbrem,项目名称:gecko-dev,代码行数:101,


示例16: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMPnsPageContentFrame::Reflow(nsPresContext*           aPresContext,                           nsHTMLReflowMetrics&     aDesiredSize,                           const nsHTMLReflowState& aReflowState,                           nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsPageContentFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  aStatus = NS_FRAME_COMPLETE;  // initialize out parameter  nsresult rv = NS_OK;  if (GetPrevInFlow() && (GetStateBits() & NS_FRAME_FIRST_REFLOW)) {    nsresult rv = aPresContext->PresShell()->FrameConstructor()                    ->ReplicateFixedFrames(this);    NS_ENSURE_SUCCESS(rv, rv);  }  // Set our size up front, since some parts of reflow depend on it  // being already set.  Note that the computed height may be  // unconstrained; that's ok.  Consumers should watch out for that.  SetSize(nsSize(aReflowState.availableWidth, aReflowState.availableHeight));   // A PageContentFrame must always have one child: the canvas frame.  // Resize our frame allowing it only to be as big as we are  // XXX Pay attention to the page's border and padding...  if (mFrames.NotEmpty()) {    nsIFrame* frame = mFrames.FirstChild();    nsSize  maxSize(aReflowState.availableWidth, aReflowState.availableHeight);    nsHTMLReflowState kidReflowState(aPresContext, aReflowState, frame, maxSize);    kidReflowState.SetComputedHeight(aReflowState.availableHeight);    mPD->mPageContentSize  = aReflowState.availableWidth;    // Reflow the page content area    rv = ReflowChild(frame, aPresContext, aDesiredSize, kidReflowState, 0, 0, 0, aStatus);    NS_ENSURE_SUCCESS(rv, rv);    // The document element's background should cover the entire canvas, so    // take into account the combined area and any space taken up by    // absolutely positioned elements    nsMargin padding(0,0,0,0);    // XXXbz this screws up percentage padding (sets padding to zero    // in the percentage padding case)    kidReflowState.mStylePadding->GetPadding(padding);    // This is for shrink-to-fit, and therefore we want to use the    // scrollable overflow, since the purpose of shrink to fit is to    // make the content that ought to be reachable (represented by the    // scrollable overflow) fit in the page.    if (frame->HasOverflowAreas()) {      // The background covers the content area and padding area, so check      // for children sticking outside the child frame's padding edge      nscoord xmost = aDesiredSize.ScrollableOverflow().XMost();      if (xmost > aDesiredSize.width) {        mPD->mPageContentXMost =          xmost +          kidReflowState.mStyleBorder->GetActualBorderWidth(NS_SIDE_RIGHT) +          padding.right;      }    }    // Place and size the child    FinishReflowChild(frame, aPresContext, &kidReflowState, aDesiredSize, 0, 0, 0);    NS_ASSERTION(aPresContext->IsDynamic() || !NS_FRAME_IS_FULLY_COMPLETE(aStatus) ||                  !frame->GetNextInFlow(), "bad child flow list");  }  // Reflow our fixed frames   nsReflowStatus fixedStatus = NS_FRAME_COMPLETE;  mFixedContainer.Reflow(this, aPresContext, aReflowState, fixedStatus,                         aReflowState.availableWidth,                         aReflowState.availableHeight,                         PR_FALSE, PR_TRUE, PR_TRUE, // XXX could be optimized                         nsnull /* ignore overflow */);  NS_ASSERTION(NS_FRAME_IS_COMPLETE(fixedStatus), "fixed frames can be truncated, but not incomplete");  // Return our desired size  aDesiredSize.width = aReflowState.availableWidth;  if (aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE) {    aDesiredSize.height = aReflowState.availableHeight;  }  FinishAndStoreOverflow(&aDesiredSize);  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);  return NS_OK;}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:88,


示例17: DO_GLOBAL_REFLOW_COUNT

NS_METHOD nsTableOuterFrame::Reflow(nsPresContext*           aPresContext,                                    nsHTMLReflowMetrics&     aDesiredSize,                                    const nsHTMLReflowState& aOuterRS,                                    nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsTableOuterFrame");  DISPLAY_REFLOW(aPresContext, this, aOuterRS, aDesiredSize, aStatus);  nsresult rv = NS_OK;  PRUint8 captionSide = GetCaptionSide();  // Initialize out parameters  aDesiredSize.width = aDesiredSize.height = 0;  aStatus = NS_FRAME_COMPLETE;  if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {    // Set up our kids.  They're already present, on an overflow list,     // or there are none so we'll create them now    MoveOverflowToChildList(aPresContext);  }  // Use longs to get more-aligned space.  #define LONGS_IN_HTMLRS /    ((sizeof(nsHTMLReflowState) + sizeof(long) - 1) / sizeof(long))  long captionRSSpace[LONGS_IN_HTMLRS];  nsHTMLReflowState *captionRS =    static_cast<nsHTMLReflowState*>((void*)captionRSSpace);  long innerRSSpace[LONGS_IN_HTMLRS];  nsHTMLReflowState *innerRS =    static_cast<nsHTMLReflowState*>((void*) innerRSSpace);  nsRect origInnerRect = InnerTableFrame()->GetRect();  nsRect origInnerVisualOverflow = InnerTableFrame()->GetVisualOverflowRect();  PRBool innerFirstReflow =    (InnerTableFrame()->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;  nsRect origCaptionRect;  nsRect origCaptionVisualOverflow;  PRBool captionFirstReflow;  if (mCaptionFrames.NotEmpty()) {    origCaptionRect = mCaptionFrames.FirstChild()->GetRect();    origCaptionVisualOverflow =      mCaptionFrames.FirstChild()->GetVisualOverflowRect();    captionFirstReflow =      (mCaptionFrames.FirstChild()->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;  }    // ComputeAutoSize has to match this logic.  if (captionSide == NO_SIDE) {    // We don't have a caption.    OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,                          innerRSSpace, aOuterRS.ComputedWidth());  } else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||             captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {    // nsTableCaptionFrame::ComputeAutoSize takes care of making side    // captions small.  Compute the caption's size first, and tell the    // table to fit in what's left.    OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,                          captionRSSpace, aOuterRS.ComputedWidth());    nscoord innerAvailWidth = aOuterRS.ComputedWidth() -      (captionRS->ComputedWidth() + captionRS->mComputedMargin.LeftRight() +       captionRS->mComputedBorderPadding.LeftRight());    OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,                          innerRSSpace, innerAvailWidth);  } else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||             captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {    // Compute the table's size first, and then prevent the caption from    // being wider unless it has to be.    //    // Note that CSS 2.1 (but not 2.0) says:    //   The width of the anonymous box is the border-edge width of the    //   table box inside it    // We don't actually make our anonymous box that width (if we did,    // it would break 'auto' margins), but this effectively does that.    OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,                          innerRSSpace, aOuterRS.ComputedWidth());    // It's good that CSS 2.1 says not to include margins, since we    // can't, since they already been converted so they exactly    // fill the available width (ignoring the margin on one side if    // neither are auto).  (We take advantage of that later when we call    // GetCaptionOrigin, though.)    nscoord innerBorderWidth = innerRS->ComputedWidth() +                               innerRS->mComputedBorderPadding.LeftRight();    OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,                          captionRSSpace, innerBorderWidth);  } else {    NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||                 captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,                 "unexpected caption-side");    // Size the table and the caption independently.    OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,                          captionRSSpace, aOuterRS.ComputedWidth());    OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,                          innerRSSpace, aOuterRS.ComputedWidth());  }  // First reflow the caption.  nsHTMLReflowMetrics captionMet;  nsSize captionSize;  nsMargin captionMargin;//.........这里部分代码省略.........
开发者ID:mbrubeck,项目名称:mozilla-central,代码行数:101,


示例18: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMPnsSubDocumentFrame::Reflow(nsPresContext*           aPresContext,                           nsHTMLReflowMetrics&     aDesiredSize,                           const nsHTMLReflowState& aReflowState,                           nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsSubDocumentFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  // printf("OuterFrame::Reflow %X (%d,%d) /n", this, aReflowState.availableWidth, aReflowState.availableHeight);  NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,     ("enter nsSubDocumentFrame::Reflow: maxSize=%d,%d",      aReflowState.availableWidth, aReflowState.availableHeight));  aStatus = NS_FRAME_COMPLETE;  NS_ASSERTION(aPresContext->GetPresShell()->GetPrimaryFrameFor(mContent) == this,               "Shouldn't happen");  // "offset" is the offset of our content area from our frame's  // top-left corner.  nsPoint offset(0, 0);    if (IsInline()) {    // XUL <iframe> or <browser>, or HTML <iframe>, <object> or <embed>    nsresult rv = nsLeafFrame::DoReflow(aPresContext, aDesiredSize, aReflowState,                                        aStatus);    NS_ENSURE_SUCCESS(rv, rv);    offset = nsPoint(aReflowState.mComputedBorderPadding.left,                     aReflowState.mComputedBorderPadding.top);  } else {    // HTML <frame>    SizeToAvailSize(aReflowState, aDesiredSize);  }  nsSize innerSize(aDesiredSize.width, aDesiredSize.height);  if (IsInline()) {    innerSize.width  -= aReflowState.mComputedBorderPadding.LeftRight();    innerSize.height -= aReflowState.mComputedBorderPadding.TopBottom();  }  if (mInnerView) {    nsIViewManager* vm = mInnerView->GetViewManager();    vm->MoveViewTo(mInnerView, offset.x, offset.y);    vm->ResizeView(mInnerView, nsRect(nsPoint(0, 0), innerSize), PR_TRUE);  }  // Determine if we need to repaint our border, background or outline  CheckInvalidateSizeChange(aDesiredSize);  FinishAndStoreOverflow(&aDesiredSize);  // Invalidate the frame contents  // XXX is this really needed?  nsRect rect(nsPoint(0, 0), GetSize());  Invalidate(rect);  if (!aPresContext->IsPaginated() && !mPostedReflowCallback) {    PresContext()->PresShell()->PostReflowCallback(this);    mPostedReflowCallback = PR_TRUE;  }  // printf("OuterFrame::Reflow DONE %X (%d,%d)/n", this,  //        aDesiredSize.width, aDesiredSize.height);  NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,     ("exit nsSubDocumentFrame::Reflow: size=%d,%d status=%x",      aDesiredSize.width, aDesiredSize.height, aStatus));  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);  return NS_OK;}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:72,


示例19: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMP nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,                               nsHTMLReflowMetrics& aDesiredSize,                               const nsHTMLReflowState& aReflowState,                               nsReflowStatus& aStatus){  DO_GLOBAL_REFLOW_COUNT("nsHTMLButtonControlFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  NS_PRECONDITION(aReflowState.ComputedWidth() != NS_INTRINSICSIZE,                  "Should have real computed width by now");  if (mState & NS_FRAME_FIRST_REFLOW) {    nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), PR_TRUE);  }  // Reflow the child  nsIFrame* firstKid = mFrames.FirstChild();  // XXXbz Eventually we may want to check-and-bail if  // !aReflowState.ShouldReflowAllKids() &&  // !NS_SUBTREE_DIRTY(firstKid).  // We'd need to cache our ascent for that, of course.    nsMargin focusPadding = mRenderer.GetAddedButtonBorderAndPadding();    // Reflow the contents of the button.  ReflowButtonContents(aPresContext, aDesiredSize, aReflowState, firstKid,                       focusPadding, aStatus);  aDesiredSize.width = aReflowState.ComputedWidth();  // If computed use the computed value.  if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE)     aDesiredSize.height = aReflowState.ComputedHeight();  else    aDesiredSize.height += focusPadding.TopBottom();    aDesiredSize.width += aReflowState.mComputedBorderPadding.LeftRight();  aDesiredSize.height += aReflowState.mComputedBorderPadding.TopBottom();  // Make sure we obey min/max-height.  Note that we do this after adjusting  // for borderpadding, since buttons have border-box sizing...  // XXXbz unless someone overrides that, of course!  We should really consider  // exposing nsHTMLReflowState::AdjustComputed* or something.  aDesiredSize.height = NS_CSS_MINMAX(aDesiredSize.height,                                      aReflowState.mComputedMinHeight,                                      aReflowState.mComputedMaxHeight);  aDesiredSize.ascent +=    aReflowState.mComputedBorderPadding.top + focusPadding.top;  aDesiredSize.mOverflowArea =    nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);  ConsiderChildOverflow(aDesiredSize.mOverflowArea, firstKid);  FinishAndStoreOverflow(&aDesiredSize);  aStatus = NS_FRAME_COMPLETE;  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);  return NS_OK;}
开发者ID:lofter2011,项目名称:Icefox,代码行数:63,


示例20: DO_GLOBAL_REFLOW_COUNT

NS_METHOD nsTableCellFrame::Reflow(nsPresContext*          aPresContext,                                   nsHTMLReflowMetrics&     aDesiredSize,                                   const nsHTMLReflowState& aReflowState,                                   nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsTableCellFrame", aReflowState.reason);  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);#if defined DEBUG_TABLE_REFLOW_TIMING  nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);#endif  float p2t = aPresContext->ScaledPixelsToTwips();  // work around pixel rounding errors, round down to ensure we don't exceed the avail height in  nscoord availHeight = aReflowState.availableHeight;  if (NS_UNCONSTRAINEDSIZE != availHeight) {    availHeight = nsTableFrame::RoundToPixel(availHeight, p2t, eAlwaysRoundDown);  }  nsresult rv = NS_OK;  // see if a special height reflow needs to occur due to having a pct height  if (!NeedSpecialReflow())     nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);  // this should probably be cached somewhere  nsCompatibility compatMode = aPresContext->CompatibilityMode();  // Initialize out parameter  if (aDesiredSize.mComputeMEW) {    aDesiredSize.mMaxElementWidth = 0;  }  aStatus = NS_FRAME_COMPLETE;  nsSize availSize(aReflowState.availableWidth, availHeight);  PRBool noBorderBeforeReflow = GetContentEmpty() &&    GetStyleTableBorder()->mEmptyCells != NS_STYLE_TABLE_EMPTY_CELLS_SHOW;  /* XXX: remove tableFrame when border-collapse inherits */  nsTableFrame* tableFrame = nsnull;  rv = nsTableFrame::GetTableFrame(this, tableFrame); if (!tableFrame) ABORT1(NS_ERROR_NULL_POINTER);  nsMargin borderPadding = aReflowState.mComputedPadding;  nsMargin border;  GetBorderWidth(p2t, border);  if ((NS_UNCONSTRAINEDSIZE == availSize.width) || !noBorderBeforeReflow) {    borderPadding += border;  }    nscoord topInset    = borderPadding.top;  nscoord rightInset  = borderPadding.right;  nscoord bottomInset = borderPadding.bottom;  nscoord leftInset   = borderPadding.left;  // reduce available space by insets, if we're in a constrained situation  if (NS_UNCONSTRAINEDSIZE!=availSize.width)    availSize.width -= leftInset+rightInset;  if (NS_UNCONSTRAINEDSIZE!=availSize.height)    availSize.height -= topInset+bottomInset;  PRBool  isStyleChanged = PR_FALSE;  if (eReflowReason_Incremental == aReflowState.reason) {    // if the path has a reflow command then the cell must be the target of a style change     nsHTMLReflowCommand* command = aReflowState.path->mReflowCommand;    if (command) {      // if there are other reflow commands targeted at the cell's block, these will      // be subsumed by the style change reflow      nsReflowType type;      command->GetType(type);      if (eReflowType_StyleChanged == type) {        isStyleChanged = PR_TRUE;      }      else NS_ASSERTION(PR_FALSE, "table cell target of illegal incremental reflow type");    }    // else the reflow command will be passed down to the child  }  // Try to reflow the child into the available space. It might not  // fit or might need continuing.  if (availSize.height < 0)    availSize.height = 1;  nsHTMLReflowMetrics kidSize(NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth ||                              aDesiredSize.mComputeMEW,                              aDesiredSize.mFlags);  kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;  SetPriorAvailWidth(aReflowState.availableWidth);  nsIFrame* firstKid = mFrames.FirstChild();  NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");  nscoord computedPaginatedHeight = 0;  if (aReflowState.mFlags.mSpecialHeightReflow ||       (HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason))) {    ((nsHTMLReflowState&)aReflowState).mComputedHeight = mRect.height - topInset - bottomInset;    DISPLAY_REFLOW_CHANGE();  }  else if (aPresContext->IsPaginated()) {    computedPaginatedHeight = CalcUnpaginagedHeight(aPresContext, (nsTableCellFrame&)*this, *tableFrame, topInset + bottomInset);    if (computedPaginatedHeight > 0) {      ((nsHTMLReflowState&)aReflowState).mComputedHeight = computedPaginatedHeight;//.........这里部分代码省略.........
开发者ID:rn10950,项目名称:RetroZilla,代码行数:101,


示例21: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMPnsCanvasFrame::Reflow(nsPresContext*           aPresContext,                      nsHTMLReflowMetrics&     aDesiredSize,                      const nsHTMLReflowState& aReflowState,                      nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsCanvasFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  NS_FRAME_TRACE_REFLOW_IN("nsCanvasFrame::Reflow");  // Initialize OUT parameter  aStatus = NS_FRAME_COMPLETE;  nsCanvasFrame* prevCanvasFrame = static_cast<nsCanvasFrame*>                                               (GetPrevInFlow());  if (prevCanvasFrame) {    nsAutoPtr<nsFrameList> overflow(prevCanvasFrame->StealOverflowFrames());    if (overflow) {      NS_ASSERTION(overflow->OnlyChild(),                   "must have doc root as canvas frame's only child");      nsContainerFrame::ReparentFrameViewList(aPresContext, *overflow,                                              prevCanvasFrame, this);      // Prepend overflow to the our child list. There may already be      // children placeholders for fixed-pos elements, which don't get      // reflowed but must not be lost until the canvas frame is destroyed.      mFrames.InsertFrames(this, nullptr, *overflow);    }  }  // Set our size up front, since some parts of reflow depend on it  // being already set.  Note that the computed height may be  // unconstrained; that's ok.  Consumers should watch out for that.  SetSize(nsSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight()));   // Reflow our one and only normal child frame. It's either the root  // element's frame or a placeholder for that frame, if the root element  // is abs-pos or fixed-pos. We may have additional children which  // are placeholders for continuations of fixed-pos content, but those  // don't need to be reflowed. The normal child is always comes before  // the fixed-pos placeholders, because we insert it at the start  // of the child list, above.  nsHTMLReflowMetrics kidDesiredSize;  if (mFrames.IsEmpty()) {    // We have no child frame, so return an empty size    aDesiredSize.width = aDesiredSize.height = 0;  } else {    nsIFrame* kidFrame = mFrames.FirstChild();    bool kidDirty = (kidFrame->GetStateBits() & NS_FRAME_IS_DIRTY) != 0;    nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,                                     nsSize(aReflowState.availableWidth,                                            aReflowState.availableHeight));    if (aReflowState.mFlags.mVResize &&        (kidFrame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT)) {      // Tell our kid it's being vertically resized too.  Bit of a      // hack for framesets.      kidReflowState.mFlags.mVResize = true;    }    nsPoint kidPt(kidReflowState.mComputedMargin.left,                  kidReflowState.mComputedMargin.top);    // Apply CSS relative positioning    const nsStyleDisplay* styleDisp = kidFrame->GetStyleDisplay();    if (NS_STYLE_POSITION_RELATIVE == styleDisp->mPosition) {      kidPt += nsPoint(kidReflowState.mComputedOffsets.left,                       kidReflowState.mComputedOffsets.top);    }    // Reflow the frame    ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,                kidPt.x, kidPt.y, 0, aStatus);    // Complete the reflow and position and size the child frame    FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize,                      kidPt.x, kidPt.y, 0);    if (!NS_FRAME_IS_FULLY_COMPLETE(aStatus)) {      nsIFrame* nextFrame = kidFrame->GetNextInFlow();      NS_ASSERTION(nextFrame || aStatus & NS_FRAME_REFLOW_NEXTINFLOW,        "If it's incomplete and has no nif yet, it must flag a nif reflow.");      if (!nextFrame) {        nsresult rv = aPresContext->PresShell()->FrameConstructor()->          CreateContinuingFrame(aPresContext, kidFrame, this, &nextFrame);        NS_ENSURE_SUCCESS(rv, rv);        SetOverflowFrames(aPresContext, nsFrameList(nextFrame, nextFrame));        // Root overflow containers will be normal children of        // the canvas frame, but that's ok because there        // aren't any other frames we need to isolate them from        // during reflow.      }      if (NS_FRAME_OVERFLOW_IS_INCOMPLETE(aStatus)) {        nextFrame->AddStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER);      }    }    // If the child frame was just inserted, then we're responsible for making sure    // it repaints    if (kidDirty) {      // But we have a new child, which will affect our background, so//.........这里部分代码省略.........
开发者ID:lofter2011,项目名称:Icefox,代码行数:101,


示例22: DO_GLOBAL_REFLOW_COUNT

NS_IMETHODIMPnsVideoFrame::Reflow(nsPresContext*           aPresContext,                     nsHTMLReflowMetrics&     aMetrics,                     const nsHTMLReflowState& aReflowState,                     nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsVideoFrame");  DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);  NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,                  ("enter nsVideoFrame::Reflow: availSize=%d,%d",                  aReflowState.availableWidth, aReflowState.availableHeight));  NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");  aStatus = NS_FRAME_COMPLETE;  aMetrics.width = aReflowState.ComputedWidth();  aMetrics.height = aReflowState.ComputedHeight();  // stash this away so we can compute our inner area later  mBorderPadding   = aReflowState.mComputedBorderPadding;  aMetrics.width += mBorderPadding.left + mBorderPadding.right;  aMetrics.height += mBorderPadding.top + mBorderPadding.bottom;  // Reflow the child frames. We may have up to two, an image frame  // which is the poster, and a box frame, which is the video controls.  for (nsIFrame *child = mFrames.FirstChild();       child;       child = child->GetNextSibling()) {    if (child->GetType() == nsGkAtoms::imageFrame) {      // Reflow the poster frame.      nsImageFrame* imageFrame = static_cast<nsImageFrame*>(child);      nsHTMLReflowMetrics kidDesiredSize;      nsSize availableSize = nsSize(aReflowState.availableWidth,                                    aReflowState.availableHeight);      nsHTMLReflowState kidReflowState(aPresContext,                                       aReflowState,                                       imageFrame,                                       availableSize,                                       aMetrics.width,                                       aMetrics.height);      if (ShouldDisplayPoster()) {        kidReflowState.SetComputedWidth(aReflowState.ComputedWidth());        kidReflowState.SetComputedHeight(aReflowState.ComputedHeight());      } else {        kidReflowState.SetComputedWidth(0);        kidReflowState.SetComputedHeight(0);            }      ReflowChild(imageFrame, aPresContext, kidDesiredSize, kidReflowState,                  mBorderPadding.left, mBorderPadding.top, 0, aStatus);      FinishReflowChild(imageFrame, aPresContext,                        &kidReflowState, kidDesiredSize,                        mBorderPadding.left, mBorderPadding.top, 0);    } else if (child->GetType() == nsGkAtoms::boxFrame) {      // Reflow the video controls frame.      nsBoxLayoutState boxState(PresContext(), aReflowState.rendContext);      nsBoxFrame::LayoutChildAt(boxState,                                child,                                nsRect(mBorderPadding.left,                                       mBorderPadding.top,                                       aReflowState.ComputedWidth(),                                       aReflowState.ComputedHeight()));    }  }  aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height);  FinishAndStoreOverflow(&aMetrics);  if (mRect.width != aMetrics.width || mRect.height != aMetrics.height) {    Invalidate(nsRect(0, 0, mRect.width, mRect.height));  }  NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,                  ("exit nsVideoFrame::Reflow: size=%d,%d",                  aMetrics.width, aMetrics.height));  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);  return NS_OK;}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:80,



注:本文中的DO_GLOBAL_REFLOW_COUNT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DO_OPS函数代码示例
C++ DO_ANI函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。