2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-03-29 18:29:03 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* rendering object that is the root of the frame tree, which contains
|
|
|
|
* the document's scrollbars and contains fixed-positioned elements
|
|
|
|
*/
|
|
|
|
|
1999-02-12 17:45:58 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2003-01-20 18:04:34 +00:00
|
|
|
#include "nsViewportFrame.h"
|
1999-01-28 17:14:13 +00:00
|
|
|
#include "nsHTMLParts.h"
|
2007-01-30 00:06:41 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2001-04-17 01:45:38 +00:00
|
|
|
#include "nsIScrollableFrame.h"
|
2006-04-27 02:45:03 +00:00
|
|
|
#include "nsDisplayList.h"
|
2010-08-08 18:49:06 +00:00
|
|
|
#include "FrameLayerBuilder.h"
|
2011-12-05 12:38:46 +00:00
|
|
|
#include "nsSubDocumentFrame.h"
|
2011-04-29 23:02:33 +00:00
|
|
|
#include "nsAbsoluteContainingBlock.h"
|
2012-04-16 18:37:59 +00:00
|
|
|
#include "sampler.h"
|
2010-08-08 18:49:06 +00:00
|
|
|
|
|
|
|
using namespace mozilla;
|
1999-01-26 00:05:21 +00:00
|
|
|
|
2005-11-04 02:38:33 +00:00
|
|
|
nsIFrame*
|
2006-03-26 21:30:36 +00:00
|
|
|
NS_NewViewportFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
1999-01-26 00:05:21 +00:00
|
|
|
{
|
2006-03-26 21:30:36 +00:00
|
|
|
return new (aPresShell) ViewportFrame(aContext);
|
1999-01-26 00:05:21 +00:00
|
|
|
}
|
|
|
|
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(ViewportFrame)
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
ViewportFrame::Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
Backout 61fd66629c4f, 7c8121f8d3af & 2a2e9cf8fd41 (bug 539356), e31a5e6545d3 (bug 761884), 85fa80bd9792, a284ccb25b83, 2865904db9fc, 34e07b09c426, e9b3d41e0360, cef00ebcd6c8, f943b729ac14 & 783f298401b6 (bug 539356), 330a086f1570 (bug 741682), d80219c8842c (bug 739671), e8c96b4fd4da, 313af486e68d, 0adc41ff56dc, 0cd288a38085, f1d43208825c, 4859876972f3, eec8ef3ebe48, f7f29fcd1845, 6079b229d306, f23c3a7e7ce0, 9824458a41e2 & 6748b5496059 (bug 539356) for mochitest-4 orange & talos regressions on multiple platforms
2012-06-11 09:08:32 +00:00
|
|
|
return Super::Init(aContent, aParent, aPrevInFlow);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
}
|
|
|
|
|
2006-04-10 00:16:29 +00:00
|
|
|
void
|
2009-12-24 05:21:15 +00:00
|
|
|
ViewportFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
1999-01-28 17:14:13 +00:00
|
|
|
{
|
2011-04-29 23:02:33 +00:00
|
|
|
DestroyAbsoluteFrames(aDestructRoot);
|
2009-12-24 05:21:15 +00:00
|
|
|
nsContainerFrame::DestroyFrom(aDestructRoot);
|
1999-01-28 17:14:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-24 20:54:30 +00:00
|
|
|
ViewportFrame::SetInitialChildList(ChildListID aListID,
|
2009-07-28 12:53:20 +00:00
|
|
|
nsFrameList& aChildList)
|
1999-01-28 17:14:13 +00:00
|
|
|
{
|
1999-07-24 03:59:47 +00:00
|
|
|
// See which child list to add the frames to
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
nsFrame::VerifyDirtyBitSet(aChildList);
|
|
|
|
#endif
|
2011-04-29 23:02:33 +00:00
|
|
|
return nsContainerFrame::SetInitialChildList(aListID, aChildList);
|
1999-01-28 17:14:13 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
ViewportFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
2000-03-22 02:43:08 +00:00
|
|
|
{
|
2012-04-16 18:37:59 +00:00
|
|
|
SAMPLE_LABEL("ViewportFrame", "BuildDisplayList");
|
2006-02-05 20:52:13 +00:00
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
2006-04-27 02:45:03 +00:00
|
|
|
if (!kid)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
// make the kid's BorderBackground our own. This ensures that the canvas
|
|
|
|
// frame's background becomes our own background and therefore appears
|
|
|
|
// below negative z-index elements.
|
|
|
|
return BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
|
2000-03-22 02:43:08 +00:00
|
|
|
}
|
|
|
|
|
1999-07-24 03:59:47 +00:00
|
|
|
NS_IMETHODIMP
|
2011-08-24 20:54:30 +00:00
|
|
|
ViewportFrame::AppendFrames(ChildListID aListID,
|
2009-07-30 17:23:32 +00:00
|
|
|
nsFrameList& aFrameList)
|
1999-07-24 03:59:47 +00:00
|
|
|
{
|
2011-04-29 23:02:33 +00:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList ||
|
|
|
|
aListID == GetAbsoluteListID(), "unexpected child list");
|
|
|
|
NS_ASSERTION(aListID != GetAbsoluteListID() ||
|
|
|
|
GetChildList(aListID).IsEmpty(), "Shouldn't have any kids!");
|
|
|
|
return nsContainerFrame::AppendFrames(aListID, aFrameList);
|
1999-07-24 03:59:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-24 20:54:30 +00:00
|
|
|
ViewportFrame::InsertFrames(ChildListID aListID,
|
2003-01-20 18:04:34 +00:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 17:23:32 +00:00
|
|
|
nsFrameList& aFrameList)
|
1999-07-24 03:59:47 +00:00
|
|
|
{
|
2011-04-29 23:02:33 +00:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList ||
|
|
|
|
aListID == GetAbsoluteListID(), "unexpected child list");
|
|
|
|
NS_ASSERTION(aListID != GetAbsoluteListID() ||
|
|
|
|
GetChildList(aListID).IsEmpty(), "Shouldn't have any kids!");
|
|
|
|
return nsContainerFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
|
1999-07-24 03:59:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-24 20:54:30 +00:00
|
|
|
ViewportFrame::RemoveFrame(ChildListID aListID,
|
2003-01-20 18:04:34 +00:00
|
|
|
nsIFrame* aOldFrame)
|
1999-07-24 03:59:47 +00:00
|
|
|
{
|
2011-04-29 23:02:33 +00:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList ||
|
|
|
|
aListID == GetAbsoluteListID(), "unexpected child list");
|
|
|
|
return nsContainerFrame::RemoveFrame(aListID, aOldFrame);
|
1999-01-28 17:14:13 +00:00
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
/* virtual */ nscoord
|
2011-04-08 01:04:40 +00:00
|
|
|
ViewportFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
{
|
|
|
|
nscoord result;
|
|
|
|
DISPLAY_MIN_WIDTH(this, result);
|
|
|
|
if (mFrames.IsEmpty())
|
|
|
|
result = 0;
|
|
|
|
else
|
|
|
|
result = mFrames.FirstChild()->GetMinWidth(aRenderingContext);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* virtual */ nscoord
|
2011-04-08 01:04:40 +00:00
|
|
|
ViewportFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
{
|
|
|
|
nscoord result;
|
|
|
|
DISPLAY_PREF_WIDTH(this, result);
|
|
|
|
if (mFrames.IsEmpty())
|
|
|
|
result = 0;
|
|
|
|
else
|
|
|
|
result = mFrames.FirstChild()->GetPrefWidth(aRenderingContext);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2004-01-09 19:21:20 +00:00
|
|
|
nsPoint
|
2008-10-30 00:41:56 +00:00
|
|
|
ViewportFrame::AdjustReflowStateForScrollbars(nsHTMLReflowState* aReflowState) const
|
1999-02-03 17:01:51 +00:00
|
|
|
{
|
2002-05-14 01:44:00 +00:00
|
|
|
// Calculate how much room is available for fixed frames. That means
|
|
|
|
// determining if the viewport is scrollable and whether the vertical and/or
|
|
|
|
// horizontal scrollbars are visible
|
1999-02-03 17:01:51 +00:00
|
|
|
|
|
|
|
// Get our prinicpal child frame and see if we're scrollable
|
|
|
|
nsIFrame* kidFrame = mFrames.FirstChild();
|
2009-01-12 19:20:59 +00:00
|
|
|
nsIScrollableFrame *scrollingFrame = do_QueryFrame(kidFrame);
|
2001-04-17 01:45:38 +00:00
|
|
|
|
|
|
|
if (scrollingFrame) {
|
2004-01-09 19:21:20 +00:00
|
|
|
nsMargin scrollbars = scrollingFrame->GetActualScrollbarSizes();
|
2007-01-26 00:05:12 +00:00
|
|
|
aReflowState->SetComputedWidth(aReflowState->ComputedWidth() -
|
2007-08-02 18:08:05 +00:00
|
|
|
scrollbars.LeftRight());
|
|
|
|
aReflowState->availableWidth -= scrollbars.LeftRight();
|
2009-01-29 20:39:22 +00:00
|
|
|
aReflowState->SetComputedHeightWithoutResettingResizeFlags(
|
|
|
|
aReflowState->ComputedHeight() - scrollbars.TopBottom());
|
2004-01-09 19:21:20 +00:00
|
|
|
return nsPoint(scrollbars.left, scrollbars.top);
|
1999-02-03 17:01:51 +00:00
|
|
|
}
|
2004-01-09 19:21:20 +00:00
|
|
|
return nsPoint(0, 0);
|
1999-02-03 17:01:51 +00:00
|
|
|
}
|
|
|
|
|
1999-01-26 00:05:21 +00:00
|
|
|
NS_IMETHODIMP
|
2008-10-30 00:41:56 +00:00
|
|
|
ViewportFrame::Reflow(nsPresContext* aPresContext,
|
1999-01-26 00:05:21 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("ViewportFrame");
|
2001-11-14 13:40:03 +00:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
1999-01-26 00:05:21 +00:00
|
|
|
NS_FRAME_TRACE_REFLOW_IN("ViewportFrame::Reflow");
|
|
|
|
|
2003-01-20 18:04:34 +00:00
|
|
|
// Initialize OUT parameters
|
1999-01-26 00:05:21 +00:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
// Because |Reflow| sets mComputedHeight on the child to
|
|
|
|
// availableHeight.
|
|
|
|
AddStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT);
|
2010-08-05 21:59:36 +00:00
|
|
|
|
|
|
|
// 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()));
|
|
|
|
|
2003-02-22 20:13:12 +00:00
|
|
|
// Reflow the main content first so that the placeholders of the
|
|
|
|
// fixed-position frames will be in the right places on an initial
|
|
|
|
// reflow.
|
2008-03-12 22:04:45 +00:00
|
|
|
nscoord kidHeight = 0;
|
1999-07-04 04:09:54 +00:00
|
|
|
|
2003-02-22 20:13:12 +00:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
2002-05-10 18:22:41 +00:00
|
|
|
if (mFrames.NotEmpty()) {
|
|
|
|
// Deal with a non-incremental reflow or an incremental reflow
|
|
|
|
// targeted at our one-and-only principal child frame.
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
if (aReflowState.ShouldReflowAllKids() ||
|
|
|
|
aReflowState.mFlags.mVResize ||
|
2007-05-06 19:16:51 +00:00
|
|
|
NS_SUBTREE_DIRTY(mFrames.FirstChild())) {
|
2002-05-10 18:22:41 +00:00
|
|
|
// Reflow our one-and-only principal child frame
|
|
|
|
nsIFrame* kidFrame = mFrames.FirstChild();
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
nsHTMLReflowMetrics kidDesiredSize;
|
2002-05-10 18:22:41 +00:00
|
|
|
nsSize availableSpace(aReflowState.availableWidth,
|
|
|
|
aReflowState.availableHeight);
|
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
|
|
|
|
kidFrame, availableSpace);
|
|
|
|
|
|
|
|
// Reflow the frame
|
2009-01-29 20:39:22 +00:00
|
|
|
kidReflowState.SetComputedHeight(aReflowState.ComputedHeight());
|
2003-01-20 18:04:34 +00:00
|
|
|
rv = ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
|
|
|
|
0, 0, 0, aStatus);
|
2008-03-12 22:04:45 +00:00
|
|
|
kidHeight = kidDesiredSize.height;
|
2002-05-10 18:22:41 +00:00
|
|
|
|
|
|
|
FinishReflowChild(kidFrame, aPresContext, nsnull, kidDesiredSize, 0, 0, 0);
|
2008-03-12 22:04:45 +00:00
|
|
|
} else {
|
|
|
|
kidHeight = mFrames.FirstChild()->GetSize().height;
|
2002-05-10 18:22:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
NS_ASSERTION(aReflowState.availableWidth != NS_UNCONSTRAINEDSIZE,
|
|
|
|
"shouldn't happen anymore");
|
|
|
|
|
|
|
|
// Return the max size as our desired size
|
|
|
|
aDesiredSize.width = aReflowState.availableWidth;
|
|
|
|
// Being flowed initially at an unconstrained height means we should
|
|
|
|
// return our child's intrinsic size.
|
2009-01-29 20:39:22 +00:00
|
|
|
aDesiredSize.height = aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE
|
|
|
|
? aReflowState.ComputedHeight()
|
2008-03-12 22:04:45 +00:00
|
|
|
: kidHeight;
|
2011-12-05 12:39:14 +00:00
|
|
|
aDesiredSize.SetOverflowAreasToDesiredBounds();
|
|
|
|
|
|
|
|
if (mFrames.NotEmpty()) {
|
|
|
|
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mFrames.FirstChild());
|
|
|
|
}
|
1999-01-26 00:05:21 +00:00
|
|
|
|
2003-02-22 20:13:12 +00:00
|
|
|
// Make a copy of the reflow state and change the computed width and height
|
|
|
|
// to reflect the available space for the fixed items
|
|
|
|
nsHTMLReflowState reflowState(aReflowState);
|
2004-01-09 19:21:20 +00:00
|
|
|
nsPoint offset = AdjustReflowStateForScrollbars(&reflowState);
|
2011-04-29 23:02:33 +00:00
|
|
|
|
|
|
|
if (IsAbsoluteContainer()) {
|
|
|
|
NS_ASSERTION(GetAbsoluteContainingBlock()->GetChildList().IsEmpty() ||
|
|
|
|
(offset.x == 0 && offset.y == 0),
|
|
|
|
"We don't handle correct positioning of fixed frames with "
|
|
|
|
"scrollbars in odd positions");
|
2004-01-09 19:21:20 +00:00
|
|
|
|
2011-04-29 23:02:33 +00:00
|
|
|
// Just reflow all the fixed-pos frames.
|
|
|
|
rv = GetAbsoluteContainingBlock()->Reflow(this, aPresContext, reflowState, aStatus,
|
|
|
|
reflowState.ComputedWidth(),
|
|
|
|
reflowState.ComputedHeight(),
|
|
|
|
false, true, true, // XXX could be optimized
|
2011-12-05 12:38:46 +00:00
|
|
|
&aDesiredSize.mOverflowAreas);
|
2011-04-29 23:02:33 +00:00
|
|
|
}
|
2003-02-22 20:13:12 +00:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
// If we were dirty then do a repaint
|
|
|
|
if (GetStateBits() & NS_FRAME_IS_DIRTY) {
|
Backout 61fd66629c4f, 7c8121f8d3af & 2a2e9cf8fd41 (bug 539356), e31a5e6545d3 (bug 761884), 85fa80bd9792, a284ccb25b83, 2865904db9fc, 34e07b09c426, e9b3d41e0360, cef00ebcd6c8, f943b729ac14 & 783f298401b6 (bug 539356), 330a086f1570 (bug 741682), d80219c8842c (bug 739671), e8c96b4fd4da, 313af486e68d, 0adc41ff56dc, 0cd288a38085, f1d43208825c, 4859876972f3, eec8ef3ebe48, f7f29fcd1845, 6079b229d306, f23c3a7e7ce0, 9824458a41e2 & 6748b5496059 (bug 539356) for mochitest-4 orange & talos regressions on multiple platforms
2012-06-11 09:08:32 +00:00
|
|
|
nsRect damageRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
|
|
|
Invalidate(damageRect);
|
1999-07-24 15:18:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-05 12:38:46 +00:00
|
|
|
// Clipping is handled by the document container (e.g., nsSubDocumentFrame),
|
|
|
|
// so we don't need to change our overflow areas.
|
|
|
|
bool overflowChanged = FinishAndStoreOverflow(&aDesiredSize);
|
|
|
|
if (overflowChanged) {
|
|
|
|
// We may need to alert our container to get it to pick up the
|
|
|
|
// overflow change.
|
|
|
|
nsSubDocumentFrame* container = static_cast<nsSubDocumentFrame*>
|
|
|
|
(nsLayoutUtils::GetCrossDocParentFrame(this));
|
|
|
|
if (container && !container->ShouldClipSubdocument()) {
|
|
|
|
container->PresContext()->PresShell()->
|
|
|
|
FrameNeedsReflow(container, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
|
|
|
|
}
|
|
|
|
}
|
2007-01-25 02:01:07 +00:00
|
|
|
|
1999-01-26 00:05:21 +00:00
|
|
|
NS_FRAME_TRACE_REFLOW_OUT("ViewportFrame::Reflow", aStatus);
|
2002-05-28 22:50:43 +00:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
2003-01-20 18:04:34 +00:00
|
|
|
return rv;
|
1999-01-26 00:05:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-31 20:19:18 +00:00
|
|
|
nsIAtom*
|
|
|
|
ViewportFrame::GetType() const
|
1999-02-14 03:47:33 +00:00
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
return nsGkAtoms::viewportFrame;
|
1999-02-14 03:47:33 +00:00
|
|
|
}
|
|
|
|
|
Backout 61fd66629c4f, 7c8121f8d3af & 2a2e9cf8fd41 (bug 539356), e31a5e6545d3 (bug 761884), 85fa80bd9792, a284ccb25b83, 2865904db9fc, 34e07b09c426, e9b3d41e0360, cef00ebcd6c8, f943b729ac14 & 783f298401b6 (bug 539356), 330a086f1570 (bug 741682), d80219c8842c (bug 739671), e8c96b4fd4da, 313af486e68d, 0adc41ff56dc, 0cd288a38085, f1d43208825c, 4859876972f3, eec8ef3ebe48, f7f29fcd1845, 6079b229d306, f23c3a7e7ce0, 9824458a41e2 & 6748b5496059 (bug 539356) for mochitest-4 orange & talos regressions on multiple platforms
2012-06-11 09:08:32 +00:00
|
|
|
void
|
|
|
|
ViewportFrame::InvalidateInternal(const nsRect& aDamageRect,
|
|
|
|
nscoord aX, nscoord aY, nsIFrame* aForChild,
|
|
|
|
PRUint32 aFlags)
|
|
|
|
{
|
|
|
|
nsRect r = aDamageRect + nsPoint(aX, aY);
|
|
|
|
nsPresContext* presContext = PresContext();
|
|
|
|
presContext->NotifyInvalidation(r, aFlags);
|
|
|
|
|
|
|
|
if ((mState & NS_FRAME_HAS_CONTAINER_LAYER) &&
|
|
|
|
!(aFlags & INVALIDATE_NO_THEBES_LAYERS)) {
|
|
|
|
FrameLayerBuilder::InvalidateThebesLayerContents(this, r);
|
|
|
|
// Don't need to invalidate any more Thebes layers
|
|
|
|
aFlags |= INVALIDATE_NO_THEBES_LAYERS;
|
|
|
|
if (aFlags & INVALIDATE_ONLY_THEBES_LAYERS) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIFrame* parent = nsLayoutUtils::GetCrossDocParentFrame(this);
|
|
|
|
if (parent) {
|
|
|
|
if (!presContext->PresShell()->IsActive())
|
|
|
|
return;
|
|
|
|
nsPoint pt = -parent->GetOffsetToCrossDoc(this);
|
|
|
|
PRInt32 ourAPD = presContext->AppUnitsPerDevPixel();
|
|
|
|
PRInt32 parentAPD = parent->PresContext()->AppUnitsPerDevPixel();
|
|
|
|
r = r.ConvertAppUnitsRoundOut(ourAPD, parentAPD);
|
|
|
|
parent->InvalidateInternal(r, pt.x, pt.y, this,
|
|
|
|
aFlags | INVALIDATE_CROSS_DOC);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
InvalidateRoot(r, aFlags);
|
|
|
|
}
|
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
1999-01-26 00:05:21 +00:00
|
|
|
NS_IMETHODIMP
|
2001-11-14 01:33:42 +00:00
|
|
|
ViewportFrame::GetFrameName(nsAString& aResult) const
|
1999-01-26 00:05:21 +00:00
|
|
|
{
|
2001-11-14 01:33:42 +00:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("Viewport"), aResult);
|
1999-01-26 00:05:21 +00:00
|
|
|
}
|
1999-09-01 01:02:16 +00:00
|
|
|
#endif
|