2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-01-26 03:05:21 +03:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-01-26 03:05:21 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-01-26 03:05:21 +03:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:30:37 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2006-03-29 22:29:03 +04: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 20:45:58 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2003-01-20 21:04:34 +03:00
|
|
|
#include "nsViewportFrame.h"
|
1999-01-28 20:14:13 +03:00
|
|
|
#include "nsHTMLParts.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2001-04-17 05:45:38 +04:00
|
|
|
#include "nsIScrollableFrame.h"
|
2006-04-27 06:45:03 +04:00
|
|
|
#include "nsDisplayList.h"
|
2010-08-08 22:49:06 +04:00
|
|
|
#include "FrameLayerBuilder.h"
|
2011-04-30 03:02:33 +04:00
|
|
|
#include "nsAbsoluteContainingBlock.h"
|
2010-08-08 22:49:06 +04:00
|
|
|
|
|
|
|
using namespace mozilla;
|
1999-01-26 03:05:21 +03:00
|
|
|
|
2005-11-04 05:38:33 +03:00
|
|
|
nsIFrame*
|
2006-03-27 01:30:36 +04:00
|
|
|
NS_NewViewportFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
1999-01-26 03:05:21 +03:00
|
|
|
{
|
2006-03-27 01:30:36 +04:00
|
|
|
return new (aPresShell) ViewportFrame(aContext);
|
1999-01-26 03:05:21 +03:00
|
|
|
}
|
|
|
|
|
2009-09-12 20:49:24 +04: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 08:38:33 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
ViewportFrame::Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
return Super::Init(aContent, aParent, aPrevInFlow);
|
|
|
|
}
|
|
|
|
|
2006-04-10 04:16:29 +04:00
|
|
|
void
|
2009-12-24 08:21:15 +03:00
|
|
|
ViewportFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
1999-01-28 20:14:13 +03:00
|
|
|
{
|
2011-04-30 03:02:33 +04:00
|
|
|
DestroyAbsoluteFrames(aDestructRoot);
|
2009-12-24 08:21:15 +03:00
|
|
|
nsContainerFrame::DestroyFrom(aDestructRoot);
|
1999-01-28 20:14:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-25 00:54:30 +04:00
|
|
|
ViewportFrame::SetInitialChildList(ChildListID aListID,
|
2009-07-28 16:53:20 +04:00
|
|
|
nsFrameList& aChildList)
|
1999-01-28 20:14:13 +03:00
|
|
|
{
|
1999-07-24 07:59:47 +04:00
|
|
|
// See which child list to add the frames to
|
|
|
|
#ifdef NS_DEBUG
|
|
|
|
nsFrame::VerifyDirtyBitSet(aChildList);
|
|
|
|
#endif
|
2011-04-30 03:02:33 +04:00
|
|
|
return nsContainerFrame::SetInitialChildList(aListID, aChildList);
|
1999-01-28 20:14:13 +03:00
|
|
|
}
|
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
ViewportFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
2000-03-22 05:43:08 +03:00
|
|
|
{
|
2006-02-05 23:52:13 +03:00
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
2006-04-27 06:45:03 +04: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 05:43:08 +03:00
|
|
|
}
|
|
|
|
|
1999-07-24 07:59:47 +04:00
|
|
|
NS_IMETHODIMP
|
2011-08-25 00:54:30 +04:00
|
|
|
ViewportFrame::AppendFrames(ChildListID aListID,
|
2009-07-30 21:23:32 +04:00
|
|
|
nsFrameList& aFrameList)
|
1999-07-24 07:59:47 +04:00
|
|
|
{
|
2011-04-30 03:02:33 +04: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 07:59:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-25 00:54:30 +04:00
|
|
|
ViewportFrame::InsertFrames(ChildListID aListID,
|
2003-01-20 21:04:34 +03:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 21:23:32 +04:00
|
|
|
nsFrameList& aFrameList)
|
1999-07-24 07:59:47 +04:00
|
|
|
{
|
2011-04-30 03:02:33 +04: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 07:59:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-08-25 00:54:30 +04:00
|
|
|
ViewportFrame::RemoveFrame(ChildListID aListID,
|
2003-01-20 21:04:34 +03:00
|
|
|
nsIFrame* aOldFrame)
|
1999-07-24 07:59:47 +04:00
|
|
|
{
|
2011-04-30 03:02:33 +04:00
|
|
|
NS_ASSERTION(aListID == kPrincipalList ||
|
|
|
|
aListID == GetAbsoluteListID(), "unexpected child list");
|
|
|
|
return nsContainerFrame::RemoveFrame(aListID, aOldFrame);
|
1999-01-28 20:14:13 +03: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 08:38:33 +03:00
|
|
|
/* virtual */ nscoord
|
2011-04-08 05:04:40 +04: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 08:38:33 +03: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 05:04:40 +04: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 08:38:33 +03:00
|
|
|
{
|
|
|
|
nscoord result;
|
|
|
|
DISPLAY_PREF_WIDTH(this, result);
|
|
|
|
if (mFrames.IsEmpty())
|
|
|
|
result = 0;
|
|
|
|
else
|
|
|
|
result = mFrames.FirstChild()->GetPrefWidth(aRenderingContext);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2004-01-09 22:21:20 +03:00
|
|
|
nsPoint
|
2008-10-30 03:41:56 +03:00
|
|
|
ViewportFrame::AdjustReflowStateForScrollbars(nsHTMLReflowState* aReflowState) const
|
1999-02-03 20:01:51 +03:00
|
|
|
{
|
2002-05-14 05:44:00 +04: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 20:01:51 +03:00
|
|
|
|
|
|
|
// Get our prinicpal child frame and see if we're scrollable
|
|
|
|
nsIFrame* kidFrame = mFrames.FirstChild();
|
2009-01-12 22:20:59 +03:00
|
|
|
nsIScrollableFrame *scrollingFrame = do_QueryFrame(kidFrame);
|
2001-04-17 05:45:38 +04:00
|
|
|
|
|
|
|
if (scrollingFrame) {
|
2004-01-09 22:21:20 +03:00
|
|
|
nsMargin scrollbars = scrollingFrame->GetActualScrollbarSizes();
|
2007-01-26 03:05:12 +03:00
|
|
|
aReflowState->SetComputedWidth(aReflowState->ComputedWidth() -
|
2007-08-02 22:08:05 +04:00
|
|
|
scrollbars.LeftRight());
|
|
|
|
aReflowState->availableWidth -= scrollbars.LeftRight();
|
2009-01-29 23:39:22 +03:00
|
|
|
aReflowState->SetComputedHeightWithoutResettingResizeFlags(
|
|
|
|
aReflowState->ComputedHeight() - scrollbars.TopBottom());
|
2004-01-09 22:21:20 +03:00
|
|
|
return nsPoint(scrollbars.left, scrollbars.top);
|
1999-02-03 20:01:51 +03:00
|
|
|
}
|
2004-01-09 22:21:20 +03:00
|
|
|
return nsPoint(0, 0);
|
1999-02-03 20:01:51 +03:00
|
|
|
}
|
|
|
|
|
1999-01-26 03:05:21 +03:00
|
|
|
NS_IMETHODIMP
|
2008-10-30 03:41:56 +03:00
|
|
|
ViewportFrame::Reflow(nsPresContext* aPresContext,
|
1999-01-26 03:05:21 +03: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 08:38:33 +03:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("ViewportFrame");
|
2001-11-14 16:40:03 +03:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
1999-01-26 03:05:21 +03:00
|
|
|
NS_FRAME_TRACE_REFLOW_IN("ViewportFrame::Reflow");
|
|
|
|
|
2003-01-20 21:04:34 +03:00
|
|
|
// Initialize OUT parameters
|
1999-01-26 03:05:21 +03: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 08:38:33 +03:00
|
|
|
// Because |Reflow| sets mComputedHeight on the child to
|
|
|
|
// availableHeight.
|
|
|
|
AddStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT);
|
2010-08-06 01:59:36 +04: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 23:13:12 +03: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-13 01:04:45 +03:00
|
|
|
nscoord kidHeight = 0;
|
1999-07-04 08:09:54 +04:00
|
|
|
|
2003-02-22 23:13:12 +03:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
2002-05-10 22:22:41 +04: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 08:38:33 +03:00
|
|
|
if (aReflowState.ShouldReflowAllKids() ||
|
|
|
|
aReflowState.mFlags.mVResize ||
|
2007-05-06 23:16:51 +04:00
|
|
|
NS_SUBTREE_DIRTY(mFrames.FirstChild())) {
|
2002-05-10 22:22:41 +04: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 08:38:33 +03:00
|
|
|
nsHTMLReflowMetrics kidDesiredSize;
|
2002-05-10 22:22:41 +04:00
|
|
|
nsSize availableSpace(aReflowState.availableWidth,
|
|
|
|
aReflowState.availableHeight);
|
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
|
|
|
|
kidFrame, availableSpace);
|
|
|
|
|
|
|
|
// Reflow the frame
|
2009-01-29 23:39:22 +03:00
|
|
|
kidReflowState.SetComputedHeight(aReflowState.ComputedHeight());
|
2003-01-20 21:04:34 +03:00
|
|
|
rv = ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
|
|
|
|
0, 0, 0, aStatus);
|
2008-03-13 01:04:45 +03:00
|
|
|
kidHeight = kidDesiredSize.height;
|
2002-05-10 22:22:41 +04:00
|
|
|
|
|
|
|
FinishReflowChild(kidFrame, aPresContext, nsnull, kidDesiredSize, 0, 0, 0);
|
2008-03-13 01:04:45 +03:00
|
|
|
} else {
|
|
|
|
kidHeight = mFrames.FirstChild()->GetSize().height;
|
2002-05-10 22:22:41 +04: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 08:38:33 +03: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 23:39:22 +03:00
|
|
|
aDesiredSize.height = aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE
|
|
|
|
? aReflowState.ComputedHeight()
|
2008-03-13 01:04:45 +03:00
|
|
|
: kidHeight;
|
1999-01-26 03:05:21 +03:00
|
|
|
|
2003-02-22 23:13:12 +03: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 22:21:20 +03:00
|
|
|
nsPoint offset = AdjustReflowStateForScrollbars(&reflowState);
|
2011-04-30 03:02:33 +04:00
|
|
|
|
2004-01-09 22:21:20 +03:00
|
|
|
#ifdef DEBUG
|
2011-04-30 03:02:33 +04: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 22:21:20 +03:00
|
|
|
#endif
|
|
|
|
|
2011-04-30 03:02:33 +04:00
|
|
|
if (IsAbsoluteContainer()) {
|
|
|
|
// 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
|
|
|
|
nsnull /* ignore overflow */);
|
|
|
|
}
|
2003-02-22 23:13:12 +03: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 08:38:33 +03:00
|
|
|
// If we were dirty then do a repaint
|
|
|
|
if (GetStateBits() & NS_FRAME_IS_DIRTY) {
|
2003-01-20 21:04:34 +03:00
|
|
|
nsRect damageRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
2008-09-18 13:47:21 +04:00
|
|
|
Invalidate(damageRect);
|
1999-07-24 19:18:24 +04:00
|
|
|
}
|
|
|
|
|
2007-01-25 05:01:07 +03:00
|
|
|
// XXX Should we do something to clip our children to this?
|
2010-10-07 08:25:46 +04:00
|
|
|
aDesiredSize.SetOverflowAreasToDesiredBounds();
|
2007-01-25 05:01:07 +03:00
|
|
|
|
1999-01-26 03:05:21 +03:00
|
|
|
NS_FRAME_TRACE_REFLOW_OUT("ViewportFrame::Reflow", aStatus);
|
2002-05-29 02:50:43 +04:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
2003-01-20 21:04:34 +03:00
|
|
|
return rv;
|
1999-01-26 03:05:21 +03:00
|
|
|
}
|
|
|
|
|
2003-10-31 23:19:18 +03:00
|
|
|
nsIAtom*
|
|
|
|
ViewportFrame::GetType() const
|
1999-02-14 06:47:33 +03:00
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
return nsGkAtoms::viewportFrame;
|
1999-02-14 06:47:33 +03:00
|
|
|
}
|
|
|
|
|
2006-06-08 05:11:43 +04:00
|
|
|
void
|
|
|
|
ViewportFrame::InvalidateInternal(const nsRect& aDamageRect,
|
|
|
|
nscoord aX, nscoord aY, nsIFrame* aForChild,
|
2008-09-18 13:47:21 +04:00
|
|
|
PRUint32 aFlags)
|
2006-06-08 05:11:43 +04:00
|
|
|
{
|
2008-09-18 13:47:21 +04:00
|
|
|
nsRect r = aDamageRect + nsPoint(aX, aY);
|
2010-08-31 09:02:08 +04:00
|
|
|
nsPresContext* presContext = PresContext();
|
|
|
|
presContext->NotifyInvalidation(r, aFlags);
|
2008-09-18 13:47:21 +04:00
|
|
|
|
2010-08-08 22:49:06 +04:00
|
|
|
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;
|
2010-10-15 05:03:46 +04:00
|
|
|
if (aFlags & INVALIDATE_ONLY_THEBES_LAYERS) {
|
|
|
|
return;
|
|
|
|
}
|
2010-08-08 22:49:06 +04:00
|
|
|
}
|
|
|
|
|
2006-06-08 05:11:43 +04:00
|
|
|
nsIFrame* parent = nsLayoutUtils::GetCrossDocParentFrame(this);
|
|
|
|
if (parent) {
|
2010-08-31 09:02:08 +04:00
|
|
|
if (!presContext->PresShell()->IsActive())
|
|
|
|
return;
|
2010-07-19 06:23:48 +04:00
|
|
|
nsPoint pt = -parent->GetOffsetToCrossDoc(this);
|
2010-08-31 09:02:08 +04:00
|
|
|
PRInt32 ourAPD = presContext->AppUnitsPerDevPixel();
|
2010-07-19 06:23:48 +04:00
|
|
|
PRInt32 parentAPD = parent->PresContext()->AppUnitsPerDevPixel();
|
|
|
|
r = r.ConvertAppUnitsRoundOut(ourAPD, parentAPD);
|
2008-09-18 13:47:21 +04:00
|
|
|
parent->InvalidateInternal(r, pt.x, pt.y, this,
|
|
|
|
aFlags | INVALIDATE_CROSS_DOC);
|
2006-06-08 05:11:43 +04:00
|
|
|
return;
|
|
|
|
}
|
2008-09-18 13:47:21 +04:00
|
|
|
InvalidateRoot(r, aFlags);
|
2006-06-08 05:11:43 +04:00
|
|
|
}
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1999-01-26 03:05:21 +03:00
|
|
|
NS_IMETHODIMP
|
2001-11-14 04:33:42 +03:00
|
|
|
ViewportFrame::GetFrameName(nsAString& aResult) const
|
1999-01-26 03:05:21 +03:00
|
|
|
{
|
2001-11-14 04:33:42 +03:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("Viewport"), aResult);
|
1999-01-26 03:05:21 +03:00
|
|
|
}
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|