зеркало из https://github.com/mozilla/gecko-dev.git
Bug 240276. Make nsHTMLScrollFrame be a regular HTML frame, not a box frame, so we don't have to go through box layout. It gets its own reflow implementation that handles min-max and lots of other good stuff. rs+sr=dbaron,a=asa
This commit is contained in:
Родитель
8dc021c1f1
Коммит
84b0577142
|
@ -1608,12 +1608,6 @@ nsDocShell::SetZoom(float zoom)
|
|||
nsIViewManager* vm = presShell->GetViewManager();
|
||||
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
|
||||
|
||||
// get the root scrollable view
|
||||
nsIScrollableView *scrollableView = nsnull;
|
||||
vm->GetRootScrollableView(&scrollableView);
|
||||
if (scrollableView)
|
||||
scrollableView->ComputeScrollOffsets();
|
||||
|
||||
// get the root view
|
||||
nsIView *rootView = nsnull; // views are not ref counted
|
||||
vm->GetRootView(rootView);
|
||||
|
|
|
@ -581,9 +581,6 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
|
|||
rect.x = rect.y = 0;
|
||||
viewManager->ResizeView(view, rect);
|
||||
nsIScrollableView* scrollingView = view->ToScrollableView();
|
||||
if (scrollingView) {
|
||||
scrollingView->ComputeScrollOffsets(PR_TRUE);
|
||||
}
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
} else {
|
||||
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
|
||||
|
|
|
@ -1266,25 +1266,16 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
|||
}
|
||||
|
||||
// Apply min/max values
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMaxWidth) {
|
||||
nscoord computedMaxWidth = aReflowState.mComputedMaxWidth +
|
||||
borderPadding.left + borderPadding.right;
|
||||
if (computedWidth > computedMaxWidth) {
|
||||
computedWidth = computedMaxWidth;
|
||||
}
|
||||
}
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMinWidth) {
|
||||
computedWidth -= borderPadding.left + borderPadding.right;
|
||||
aReflowState.ApplyMinMaxConstraints(&computedWidth, nsnull);
|
||||
computedWidth += borderPadding.left + borderPadding.right;
|
||||
if (aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH)) {
|
||||
nscoord computedMinWidth = aReflowState.mComputedMinWidth +
|
||||
borderPadding.left + borderPadding.right;
|
||||
if (computedWidth < computedMinWidth) {
|
||||
computedWidth = computedMinWidth;
|
||||
}
|
||||
if (aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH) &&
|
||||
maxElementWidth < computedMinWidth &&
|
||||
if (maxElementWidth < computedMinWidth &&
|
||||
GetStylePosition()->mMinWidth.GetUnit() != eStyleUnit_Percent) {
|
||||
maxElementWidth = computedMinWidth;
|
||||
maxElementWidth = computedMinWidth;
|
||||
}
|
||||
|
||||
}
|
||||
aMetrics.width = computedWidth;
|
||||
|
||||
|
@ -1414,25 +1405,12 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
|||
autoHeight < ymost)
|
||||
autoHeight = ymost;
|
||||
}
|
||||
autoHeight += borderPadding.bottom;
|
||||
|
||||
// Apply min/max values
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMaxHeight) {
|
||||
nscoord computedMaxHeight = aReflowState.mComputedMaxHeight +
|
||||
borderPadding.top + borderPadding.bottom;
|
||||
if (autoHeight > computedMaxHeight) {
|
||||
autoHeight = computedMaxHeight;
|
||||
}
|
||||
}
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMinHeight) {
|
||||
nscoord computedMinHeight = aReflowState.mComputedMinHeight +
|
||||
borderPadding.top + borderPadding.bottom;
|
||||
if (autoHeight < computedMinHeight) {
|
||||
autoHeight = computedMinHeight;
|
||||
}
|
||||
}
|
||||
autoHeight -= borderPadding.top;
|
||||
aReflowState.ApplyMinMaxConstraints(nsnull, &autoHeight);
|
||||
autoHeight += borderPadding.top + borderPadding.bottom;
|
||||
aMetrics.height = autoHeight;
|
||||
|
||||
}
|
||||
|
||||
aMetrics.ascent = mAscent;
|
||||
|
|
|
@ -850,7 +850,7 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame)
|
|||
*/
|
||||
nsresult
|
||||
nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
|
||||
nsPresContext* aPresContext,
|
||||
nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nscoord aX,
|
||||
|
@ -966,7 +966,7 @@ nsContainerFrame::PositionChildViews(nsIFrame* aFrame)
|
|||
*/
|
||||
nsresult
|
||||
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
|
||||
nsPresContext* aPresContext,
|
||||
nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState* aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
nscoord aX,
|
||||
|
|
|
@ -4793,24 +4793,6 @@ nsFrame::SetIncludeOverflow(PRBool aInclude)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
UseHTMLReflowConstraints(nsFrame* aFrame, nsBoxLayoutState& aState) {
|
||||
nsSize constrainedSize = aState.ScrolledBlockSizeConstraint();
|
||||
if (constrainedSize.width < 0 || constrainedSize.height < 0) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsIFrame* parentFrame = aFrame->GetParent();
|
||||
if (!parentFrame) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (parentFrame->GetType() != nsLayoutAtoms::scrollFrame) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
|
||||
{
|
||||
|
@ -4838,8 +4820,6 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
|
|||
nsHTMLReflowMetrics desiredSize(PR_FALSE);
|
||||
nsReflowReason reason;
|
||||
|
||||
PRBool useHTMLConstraints = UseHTMLReflowConstraints(this, aState);
|
||||
|
||||
// See if we an set the max element size and return the reflow states new reason. Sometimes reflow states need to
|
||||
// be changed. Incremental dirty reflows targeted at us can be converted to Resize if we are not dirty. So make sure
|
||||
// we look at the reason returned.
|
||||
|
@ -4852,9 +4832,8 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
|
|||
// If we don't have any HTML constraints and its a resize, then nothing in the block
|
||||
// could have changed, so no refresh is necessary.
|
||||
nsBoxLayoutMetrics* metrics = BoxMetrics();
|
||||
if (!DoesNeedRecalc(metrics->mBlockPrefSize) && reason == eReflowReason_Resize
|
||||
&& !useHTMLConstraints)
|
||||
return NS_OK;
|
||||
if (!DoesNeedRecalc(metrics->mBlockPrefSize) && reason == eReflowReason_Resize)
|
||||
return NS_OK;
|
||||
|
||||
// get the old rect.
|
||||
nsRect oldRect = GetRect();
|
||||
|
@ -4874,11 +4853,6 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
|
|||
rect.width = NS_UNCONSTRAINEDSIZE;
|
||||
rect.height = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
if (useHTMLConstraints) {
|
||||
nsSize constrained = aState.ScrolledBlockSizeConstraint();
|
||||
rect.width = constrained.width;
|
||||
rect.height = constrained.height;
|
||||
}
|
||||
|
||||
// Create a child reflow state, fix-up the reason and the
|
||||
// incremental reflow path.
|
||||
|
@ -4951,11 +4925,6 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
|
|||
metrics->mBlockMinSize.width = 0;
|
||||
metrics->mBlockMinSize.height = desiredSize.height;
|
||||
}
|
||||
if (useHTMLConstraints) {
|
||||
// set the preferred metrics to exactly what the block asked for
|
||||
metrics->mBlockPrefSize.width = desiredSize.width;
|
||||
metrics->mBlockPrefSize.height = desiredSize.height;
|
||||
}
|
||||
|
||||
metrics->mBlockAscent = desiredSize.ascent;
|
||||
|
||||
|
@ -4977,7 +4946,7 @@ nsFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
|||
// If the size is cached, and there are no HTML constraints that we might
|
||||
// be depending on, then we just return the cached size.
|
||||
nsBoxLayoutMetrics *metrics = BoxMetrics();
|
||||
if (!DoesNeedRecalc(metrics->mPrefSize) && !UseHTMLReflowConstraints(this, aState)) {
|
||||
if (!DoesNeedRecalc(metrics->mPrefSize)) {
|
||||
aSize = metrics->mPrefSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5016,7 +4985,7 @@ nsFrame::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
|||
{
|
||||
// Don't use the cache if we have HTMLReflowState constraints --- they might have changed
|
||||
nsBoxLayoutMetrics *metrics = BoxMetrics();
|
||||
if (!DoesNeedRecalc(metrics->mMinSize) && !UseHTMLReflowConstraints(this, aState)) {
|
||||
if (!DoesNeedRecalc(metrics->mMinSize)) {
|
||||
aSize = metrics->mMinSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5051,7 +5020,7 @@ nsFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
|||
{
|
||||
// Don't use the cache if we have HTMLReflowState constraints --- they might have changed
|
||||
nsBoxLayoutMetrics *metrics = BoxMetrics();
|
||||
if (!DoesNeedRecalc(metrics->mMaxSize) && !UseHTMLReflowConstraints(this, aState)) {
|
||||
if (!DoesNeedRecalc(metrics->mMaxSize)) {
|
||||
aSize = metrics->mMaxSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -54,6 +54,7 @@ class nsIAtom;
|
|||
class nsIDocument;
|
||||
class nsIScrollFrameInternal;
|
||||
class nsPresState;
|
||||
struct ScrollReflowState;
|
||||
|
||||
class nsGfxScrollFrameInner : public nsIScrollPositionListener {
|
||||
public:
|
||||
|
@ -61,7 +62,7 @@ public:
|
|||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
nsGfxScrollFrameInner(nsBoxFrame* aOuter, PRBool aIsRoot);
|
||||
nsGfxScrollFrameInner(nsContainerFrame* aOuter, PRBool aIsRoot);
|
||||
|
||||
typedef nsIScrollableFrame::ScrollbarStyles ScrollbarStyles;
|
||||
ScrollbarStyles GetScrollbarStylesFromFrame() const;
|
||||
|
@ -95,32 +96,15 @@ public:
|
|||
PRBool SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize, PRBool aReflow=PR_TRUE);
|
||||
PRInt32 GetIntegerAttribute(nsIBox* aFrame, nsIAtom* atom, PRInt32 defaultValue);
|
||||
|
||||
nsresult Layout(nsBoxLayoutState& aState);
|
||||
nsresult LayoutBox(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect& aRect);
|
||||
void LayoutScrollArea(nsBoxLayoutState& aState, const nsRect& aRect);
|
||||
|
||||
/**
|
||||
* If RTL, then this will scroll to the right during initial layout.
|
||||
*/
|
||||
void AdjustHorizontalScrollbar();
|
||||
|
||||
// Like ScrollPositionDidChange, but initiated by this frame rather than from the
|
||||
// scrolling view
|
||||
void InternalScrollPositionDidChange(nscoord aX, nscoord aY);
|
||||
|
||||
PRBool AddRemoveScrollbar(PRBool& aHasScrollbar,
|
||||
nscoord& aXY,
|
||||
nscoord& aSize,
|
||||
nscoord aSbSize,
|
||||
PRBool aOnRightOrBottom,
|
||||
PRBool aAdd);
|
||||
|
||||
PRBool AddRemoveScrollbar(nsBoxLayoutState& aState,
|
||||
nsRect& aScrollAreaSize,
|
||||
PRBool aOnTop,
|
||||
PRBool aHorizontal,
|
||||
PRBool aAdd);
|
||||
|
||||
PRBool AddHorizontalScrollbar (nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnBottom);
|
||||
PRBool AddVerticalScrollbar (nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnRight);
|
||||
void RemoveHorizontalScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnBottom);
|
||||
void RemoveVerticalScrollbar (nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnRight);
|
||||
|
||||
nsIScrollableView* GetScrollableView() const { return mScrollableView; }
|
||||
|
||||
nsIView* GetParentViewForChildFrame(nsIFrame* aFrame) const;
|
||||
|
@ -134,21 +118,24 @@ public:
|
|||
|
||||
void ScrollbarChanged(nsPresContext* aPresContext, nscoord aX, nscoord aY, PRUint32 aFlags);
|
||||
|
||||
void SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible);
|
||||
static void SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible);
|
||||
|
||||
nsSize GetScrolledSize() const;
|
||||
nsMargin GetActualScrollbarSizes() const;
|
||||
void AdjustReflowStateForPrintPreview(nsBoxLayoutState& aState, PRBool& aSetBack);
|
||||
void AdjustReflowStateBack(nsBoxLayoutState& aState, PRBool aSetBack);
|
||||
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
||||
PRBool IsScrollbarOnRight();
|
||||
void LayoutScrollbars(nsBoxLayoutState& aState,
|
||||
const nsRect& aContentArea,
|
||||
const nsRect& aOldScrollArea,
|
||||
const nsRect& aScrollArea);
|
||||
|
||||
nsIScrollableView* mScrollableView;
|
||||
nsIBox* mHScrollbarBox;
|
||||
nsIBox* mVScrollbarBox;
|
||||
nsIFrame* mScrolledFrame;
|
||||
nsIBox* mScrollCornerBox;
|
||||
nsContainerFrame* mOuter;
|
||||
nscoord mOnePixel;
|
||||
nsBoxFrame* mOuter;
|
||||
nscoord mMaxElementWidth;
|
||||
|
||||
nsRect mRestoreRect;
|
||||
nsPoint mLastPos;
|
||||
|
@ -165,8 +152,6 @@ public:
|
|||
PRPackedBool mViewInitiatedScroll:1;
|
||||
PRPackedBool mFrameInitiatedScroll:1;
|
||||
PRPackedBool mDidHistoryRestore:1;
|
||||
PRPackedBool mHorizontalOverflow:1;
|
||||
PRPackedBool mVerticalOverflow:1;
|
||||
// Is this the scrollframe for the document's viewport?
|
||||
PRPackedBool mIsRoot:1;
|
||||
};
|
||||
|
@ -180,7 +165,7 @@ public:
|
|||
* Scroll frames don't support incremental changes, i.e. you can't replace
|
||||
* or remove the scrolled frame
|
||||
*/
|
||||
class nsHTMLScrollFrame : public nsBoxFrame,
|
||||
class nsHTMLScrollFrame : public nsHTMLContainerFrame,
|
||||
public nsIScrollableFrame,
|
||||
public nsIAnonymousContentCreator,
|
||||
public nsIStatefulFrame {
|
||||
|
@ -188,13 +173,30 @@ public:
|
|||
friend nsresult NS_NewHTMLScrollFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame,
|
||||
PRBool aIsRoot);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// Called to set the child frames. We typically have three: the scroll area,
|
||||
// the vertical scrollbar, and the horizontal scrollbar.
|
||||
NS_IMETHOD SetInitialChildList(nsPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
PRBool TryLayout(ScrollReflowState* aState,
|
||||
const nsHTMLReflowMetrics& aKidMetrics,
|
||||
const nsMargin& aKidPadding,
|
||||
PRBool aAssumeVScroll, PRBool aAssumeHScroll,
|
||||
PRBool aForce);
|
||||
nsresult ReflowScrolledFrame(const ScrollReflowState& aState,
|
||||
PRBool aAssumeVScroll,
|
||||
nsHTMLReflowMetrics* aMetrics,
|
||||
nsMargin* aKidPadding,
|
||||
PRBool aFirstPass);
|
||||
nsresult ReflowContents(ScrollReflowState* aState,
|
||||
const nsHTMLReflowMetrics& aDesiredSize);
|
||||
PRBool IsRTLTextControl();
|
||||
void PlaceScrollArea(const ScrollReflowState& aState);
|
||||
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
@ -249,17 +251,6 @@ public:
|
|||
nsIContent * aContent,
|
||||
nsIFrame** aFrame) { if (aFrame) *aFrame = nsnull; return NS_ERROR_FAILURE; }
|
||||
|
||||
// nsIBox methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
||||
|
||||
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetPadding(nsMargin& aPadding);
|
||||
|
||||
// nsIScrollableFrame
|
||||
virtual nsIFrame* GetScrolledFrame() const;
|
||||
virtual nsIScrollableView* GetScrollableView();
|
||||
|
@ -412,6 +403,30 @@ public:
|
|||
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetPadding(nsMargin& aPadding);
|
||||
|
||||
nsresult Layout(nsBoxLayoutState& aState);
|
||||
void LayoutScrollArea(nsBoxLayoutState& aState, const nsRect& aRect);
|
||||
|
||||
static PRBool AddRemoveScrollbar(PRBool& aHasScrollbar,
|
||||
nscoord& aXY,
|
||||
nscoord& aSize,
|
||||
nscoord aSbSize,
|
||||
PRBool aOnRightOrBottom,
|
||||
PRBool aAdd);
|
||||
|
||||
PRBool AddRemoveScrollbar(nsBoxLayoutState& aState,
|
||||
nsRect& aScrollAreaSize,
|
||||
PRBool aOnTop,
|
||||
PRBool aHorizontal,
|
||||
PRBool aAdd);
|
||||
|
||||
PRBool AddHorizontalScrollbar (nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnBottom);
|
||||
PRBool AddVerticalScrollbar (nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnRight);
|
||||
void RemoveHorizontalScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnBottom);
|
||||
void RemoveVerticalScrollbar (nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnRight);
|
||||
|
||||
static void AdjustReflowStateForPrintPreview(nsBoxLayoutState& aState, PRBool& aSetBack);
|
||||
static void AdjustReflowStateBack(nsBoxLayoutState& aState, PRBool aSetBack);
|
||||
|
||||
// nsIScrollableFrame
|
||||
virtual nsIFrame* GetScrolledFrame() const;
|
||||
virtual nsIScrollableView* GetScrollableView();
|
||||
|
@ -467,6 +482,9 @@ protected:
|
|||
private:
|
||||
friend class nsGfxScrollFrameInner;
|
||||
nsGfxScrollFrameInner mInner;
|
||||
nscoord mMaxElementWidth;
|
||||
PRPackedBool mHorizontalOverflow;
|
||||
PRPackedBool mVerticalOverflow;
|
||||
};
|
||||
|
||||
#endif /* nsGfxScrollFrame_h___ */
|
||||
|
|
|
@ -554,7 +554,7 @@ CanvasFrame::Reflow(nsPresContext* aPresContext,
|
|||
kidReflowState.mComputedMargin.top +
|
||||
kidReflowState.mComputedMargin.bottom;
|
||||
}
|
||||
|
||||
aDesiredSize.mOverflowArea.SetRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
// XXX Don't completely ignore NS_FRAME_OUTSIDE_CHILDREN for child frames
|
||||
|
|
|
@ -1713,7 +1713,11 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
|
|||
mComputedPadding.left = aPadding->left;
|
||||
}
|
||||
else {
|
||||
ComputePadding(aContainingBlockWidth, cbrs);
|
||||
if (frame->GetType() == nsLayoutAtoms::scrollFrame) {
|
||||
mComputedPadding.SizeTo(0, 0, 0, 0);
|
||||
} else {
|
||||
ComputePadding(aContainingBlockWidth, cbrs);
|
||||
}
|
||||
}
|
||||
if (aBorder) { // border is an input arg
|
||||
mComputedBorderPadding.top = aBorder->top;
|
||||
|
@ -2445,6 +2449,25 @@ nsHTMLReflowState::ComputePadding(nscoord aContainingBlockWidth,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLReflowState::ApplyMinMaxConstraints(nscoord* aFrameWidth,
|
||||
nscoord* aFrameHeight) const
|
||||
{
|
||||
if (aFrameWidth) {
|
||||
if (NS_UNCONSTRAINEDSIZE != mComputedMaxWidth) {
|
||||
*aFrameWidth = PR_MIN(*aFrameWidth, mComputedMaxWidth);
|
||||
}
|
||||
*aFrameWidth = PR_MAX(*aFrameWidth, mComputedMinWidth);
|
||||
}
|
||||
|
||||
if (aFrameHeight) {
|
||||
if (NS_UNCONSTRAINEDSIZE != mComputedMaxHeight) {
|
||||
*aFrameHeight = PR_MIN(*aFrameHeight, mComputedMaxHeight);
|
||||
}
|
||||
*aFrameHeight = PR_MAX(*aFrameHeight, mComputedMinHeight);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight,
|
||||
|
@ -2569,6 +2592,7 @@ void nsHTMLReflowState::AdjustComputedWidth(PRBool aAdjustForBoxSizing)
|
|||
if(mComputedWidth < 0) mComputedWidth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IBMBIDI
|
||||
PRBool
|
||||
nsHTMLReflowState::IsBidiFormControl(nsPresContext* aPresContext)
|
||||
|
|
|
@ -386,6 +386,12 @@ struct nsHTMLReflowState {
|
|||
void CalculateBlockSideMargins(nscoord aAvailWidth,
|
||||
nscoord aComputedWidth);
|
||||
|
||||
/**
|
||||
* Apply the mComputed(Min/Max)(Width/Height) values to the content
|
||||
* size computed so far. If a passed-in pointer is null, we skip
|
||||
* adjusting that dimension.
|
||||
*/
|
||||
void ApplyMinMaxConstraints(nscoord* aContentWidth, nscoord* aContentHeight) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -1434,7 +1434,11 @@ nsObjectFrame::HandleChild(nsPresContext* aPresContext,
|
|||
// style context, so we simply want to reflow the child with pretty
|
||||
// much our own reflow state, in the case of a broken plugin, the
|
||||
// child has its own style context, so we create a new reflow
|
||||
// state.... XXXbz maybe we should always have a different style context?
|
||||
// state....
|
||||
// XXXbz maybe we should always have a different style context?
|
||||
// XXXroc no, that seems to break things. But as is, this causes
|
||||
// an assertion failure in nsContainerFrame because the reflow
|
||||
// state isn't built for the right frame.
|
||||
|
||||
nsReflowStatus status;
|
||||
|
||||
|
|
|
@ -1909,8 +1909,8 @@ NS_METHOD nsTableFrame::Reflow(nsPresContext* aPresContext,
|
|||
mTableLayoutStrategy->Initialize(aReflowState);
|
||||
}
|
||||
}
|
||||
SetHadInitialReflow(PR_TRUE);
|
||||
if (!mPrevInFlow) {
|
||||
SetHadInitialReflow(PR_TRUE);
|
||||
SetNeedStrategyBalance(PR_TRUE); // force a balance and then a pass2 reflow
|
||||
if ((nextReason != eReflowReason_StyleChange) || IsAutoLayout())
|
||||
nextReason = eReflowReason_Resize;
|
||||
|
|
|
@ -54,7 +54,6 @@ nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext):mPresContext(aPr
|
|||
mReflowState(nsnull),
|
||||
mType(Dirty),
|
||||
mMaxElementWidth(nsnull),
|
||||
mScrolledBlockSizeConstraint(-1,-1),
|
||||
mLayoutFlags(0),
|
||||
mPaintingDisabled(PR_FALSE)
|
||||
{
|
||||
|
@ -67,7 +66,6 @@ nsBoxLayoutState::nsBoxLayoutState(const nsBoxLayoutState& aState)
|
|||
mType = aState.mType;
|
||||
mReflowState = aState.mReflowState;
|
||||
mMaxElementWidth = aState.mMaxElementWidth;
|
||||
mScrolledBlockSizeConstraint = aState.mScrolledBlockSizeConstraint;
|
||||
mLayoutFlags = aState.mLayoutFlags;
|
||||
mPaintingDisabled = aState.mPaintingDisabled;
|
||||
|
||||
|
@ -77,7 +75,6 @@ nsBoxLayoutState::nsBoxLayoutState(const nsBoxLayoutState& aState)
|
|||
nsBoxLayoutState::nsBoxLayoutState(nsIPresShell* aShell):mReflowState(nsnull),
|
||||
mType(Dirty),
|
||||
mMaxElementWidth(nsnull),
|
||||
mScrolledBlockSizeConstraint(-1,-1),
|
||||
mLayoutFlags(0),
|
||||
mPaintingDisabled(PR_FALSE)
|
||||
{
|
||||
|
@ -91,7 +88,6 @@ nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext,
|
|||
mReflowState(&aReflowState),
|
||||
mType(Dirty),
|
||||
mMaxElementWidth(nsnull),
|
||||
mScrolledBlockSizeConstraint(-1,-1),
|
||||
mLayoutFlags(0),
|
||||
mPaintingDisabled(PR_FALSE)
|
||||
|
||||
|
|
|
@ -79,10 +79,6 @@ public:
|
|||
nsIPresShell* PresShell() { return mPresContext->PresShell(); }
|
||||
nscoord* GetMaxElementWidth() { return mReflowState ? mMaxElementWidth : nsnull; }
|
||||
|
||||
nsSize ScrolledBlockSizeConstraint() const
|
||||
{ return mScrolledBlockSizeConstraint; }
|
||||
void SetScrolledBlockSizeConstraint(const nsSize& aSize)
|
||||
{ mScrolledBlockSizeConstraint = aSize; }
|
||||
PRUint32 LayoutFlags() const { return mLayoutFlags; }
|
||||
void SetLayoutFlags(PRUint32 aFlags) { mLayoutFlags = aFlags; }
|
||||
|
||||
|
@ -111,9 +107,8 @@ private:
|
|||
|
||||
nsCOMPtr<nsPresContext> mPresContext;
|
||||
const nsHTMLReflowState* mReflowState;
|
||||
eBoxLayoutReason mType;
|
||||
nscoord* mMaxElementWidth;
|
||||
nsSize mScrolledBlockSizeConstraint;
|
||||
eBoxLayoutReason mType;
|
||||
PRUint32 mLayoutFlags;
|
||||
PRBool mPaintingDisabled;
|
||||
};
|
||||
|
|
|
@ -74,18 +74,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD CreateScrollControls(nsNativeWidget aNative = nsnull) = 0;
|
||||
|
||||
/**
|
||||
* Compute the values for the scroll bars and adjust the position
|
||||
* of the scrolled view as necessary.
|
||||
* @param aAdjustWidgets if any widgets that are children of the
|
||||
* scrolled view should be repositioned after rethinking
|
||||
* the scroll parameters, set this ot PR_TRUE. in general
|
||||
* this should be true unless you intended to vists the
|
||||
* child widgets manually.
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD ComputeScrollOffsets(PRBool aAdjustWidgets = PR_TRUE) = 0;
|
||||
|
||||
/**
|
||||
* Get the dimensions of the container
|
||||
* @param aWidth return value for width of container
|
||||
|
|
|
@ -166,11 +166,6 @@ NS_IMETHODIMP nsScrollPortView::SetWidget(nsIWidget *aWidget)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsScrollPortView::ComputeScrollOffsets(PRBool aAdjustWidgets)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsScrollPortView::GetContainerSize(nscoord *aWidth, nscoord *aHeight) const
|
||||
{
|
||||
if (!aWidth || !aHeight)
|
||||
|
|
|
@ -63,7 +63,6 @@ public:
|
|||
|
||||
//nsIScrollableView interface
|
||||
NS_IMETHOD CreateScrollControls(nsNativeWidget aNative = nsnull);
|
||||
NS_IMETHOD ComputeScrollOffsets(PRBool aAdjustWidgets = PR_TRUE);
|
||||
NS_IMETHOD GetContainerSize(nscoord *aWidth, nscoord *aHeight) const;
|
||||
NS_IMETHOD SetScrolledView(nsIView *aScrolledView);
|
||||
NS_IMETHOD GetScrolledView(nsIView *&aScrolledView) const;
|
||||
|
|
|
@ -700,14 +700,6 @@ NS_IMETHODIMP nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsViewManager::ResetScrolling(void)
|
||||
{
|
||||
if (nsnull != mRootScrollable)
|
||||
mRootScrollable->ComputeScrollOffsets(PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* Check the prefs to see whether we should do double buffering or not... */
|
||||
static
|
||||
PRBool DoDoubleBuffering(void)
|
||||
|
|
|
@ -168,8 +168,6 @@ public:
|
|||
NS_IMETHOD GetWindowDimensions(nscoord *width, nscoord *height);
|
||||
NS_IMETHOD SetWindowDimensions(nscoord width, nscoord height);
|
||||
|
||||
NS_IMETHOD ResetScrolling(void);
|
||||
|
||||
NS_IMETHOD Composite(void);
|
||||
|
||||
NS_IMETHOD UpdateView(nsIView *aView, PRUint32 aUpdateFlags);
|
||||
|
|
Загрузка…
Ссылка в новой задаче