2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04: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 22:29:03 +04:00
|
|
|
|
|
|
|
/*
|
2007-12-13 00:49:14 +03:00
|
|
|
* rendering object for CSS display:block, inline-block, and list-item
|
|
|
|
* boxes, also used for various anonymous boxes
|
2006-03-29 22:29:03 +04:00
|
|
|
*/
|
|
|
|
|
1998-11-16 20:11:12 +03:00
|
|
|
#ifndef nsBlockFrame_h___
|
|
|
|
#define nsBlockFrame_h___
|
|
|
|
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
1999-11-03 03:42:12 +03:00
|
|
|
#include "nsHTMLParts.h"
|
2001-10-25 05:08:40 +04:00
|
|
|
#include "nsLineBox.h"
|
2003-04-12 20:06:54 +04:00
|
|
|
#include "nsCSSPseudoElements.h"
|
2009-05-20 15:21:34 +04:00
|
|
|
#include "nsFloatManager.h"
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2016-10-06 19:36:07 +03:00
|
|
|
enum class LineReflowStatus {
|
2006-06-29 05:19:48 +04:00
|
|
|
// The line was completely reflowed and fit in available width, and we should
|
|
|
|
// try to pull up content from the next line if possible.
|
2016-10-06 19:36:07 +03:00
|
|
|
OK,
|
2006-06-29 05:19:48 +04:00
|
|
|
// The line was completely reflowed and fit in available width, but we should
|
|
|
|
// not try to pull up content from the next line.
|
2016-10-06 19:36:07 +03:00
|
|
|
Stop,
|
2006-06-29 05:19:48 +04:00
|
|
|
// We need to reflow the line again at its current vertical position. The
|
|
|
|
// new reflow should not try to pull up any frames from the next line.
|
2016-10-06 19:36:07 +03:00
|
|
|
RedoNoPull,
|
2009-05-20 15:21:34 +04:00
|
|
|
// We need to reflow the line again using the floats from its height
|
|
|
|
// this reflow, since its height made it hit floats that were not
|
|
|
|
// adjacent to its top.
|
2016-10-06 19:36:07 +03:00
|
|
|
RedoMoreFloats,
|
2006-06-29 05:19:48 +04:00
|
|
|
// We need to reflow the line again at a lower vertical postion where there
|
|
|
|
// may be more horizontal space due to different float configuration.
|
2016-10-06 19:36:07 +03:00
|
|
|
RedoNextBand,
|
2006-06-29 05:19:48 +04:00
|
|
|
// The line did not fit in the available vertical space. Try pushing it to
|
|
|
|
// the next page or column if it's not the first line on the current
|
|
|
|
// page/column.
|
2016-10-06 19:36:07 +03:00
|
|
|
Truncated
|
2006-06-29 05:19:48 +04:00
|
|
|
};
|
|
|
|
|
2007-08-22 13:08:13 +04:00
|
|
|
class nsBlockInFlowLineIterator;
|
2016-07-21 13:36:36 +03:00
|
|
|
namespace mozilla {
|
2016-07-21 13:36:36 +03:00
|
|
|
class BlockReflowInput;
|
2019-04-16 10:24:49 +03:00
|
|
|
class PresShell;
|
2017-06-22 18:24:11 +03:00
|
|
|
class ServoRestyleState;
|
2018-03-29 14:15:46 +03:00
|
|
|
class ServoStyleSet;
|
2016-07-21 13:36:36 +03:00
|
|
|
} // namespace mozilla
|
1998-11-18 09:13:58 +03:00
|
|
|
|
2005-03-23 06:35:08 +03:00
|
|
|
/**
|
|
|
|
* Some invariants:
|
|
|
|
* -- The overflow out-of-flows list contains the out-of-
|
|
|
|
* flow frames whose placeholders are in the overflow list.
|
|
|
|
* -- A given piece of content has at most one placeholder
|
|
|
|
* frame in a block's normal child list.
|
2010-08-06 08:59:19 +04:00
|
|
|
* -- While a block is being reflowed, and from then until
|
|
|
|
* its next-in-flow is reflowed it may have a
|
2010-08-06 08:59:20 +04:00
|
|
|
* PushedFloatProperty frame property that points to
|
2010-08-06 08:59:19 +04:00
|
|
|
* an nsFrameList. This list contains continuations for
|
2009-08-31 22:25:36 +04:00
|
|
|
* floats whose prev-in-flow is in the block's regular float
|
2010-08-06 08:59:19 +04:00
|
|
|
* list and first-in-flows of floats that did not fit, but
|
|
|
|
* whose placeholders are in the block or one of its
|
|
|
|
* prev-in-flows.
|
2005-03-23 06:35:08 +03:00
|
|
|
* -- In all these frame lists, if there are two frames for
|
|
|
|
* the same content appearing in the list, then the frames
|
|
|
|
* appear with the prev-in-flow before the next-in-flow.
|
|
|
|
* -- While reflowing a block, its overflow line list
|
|
|
|
* will usually be empty but in some cases will have lines
|
|
|
|
* (while we reflow the block at its shrink-wrap width).
|
|
|
|
* In this case any new overflowing content must be
|
|
|
|
* prepended to the overflow lines.
|
|
|
|
*/
|
|
|
|
|
2000-05-09 09:11:12 +04:00
|
|
|
/*
|
|
|
|
* Base class for block and inline frames.
|
2011-08-25 00:54:30 +04:00
|
|
|
* The block frame has an additional child list, kAbsoluteList, which
|
|
|
|
* contains the absolutely positioned frames.
|
2016-03-28 09:39:42 +03:00
|
|
|
*/
|
|
|
|
class nsBlockFrame : public nsContainerFrame {
|
2016-07-21 13:36:36 +03:00
|
|
|
using BlockReflowInput = mozilla::BlockReflowInput;
|
2016-07-21 13:36:36 +03:00
|
|
|
|
2001-10-25 05:08:40 +04:00
|
|
|
public:
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsBlockFrame)
|
2009-01-12 22:20:59 +03:00
|
|
|
|
2016-10-22 14:41:04 +03:00
|
|
|
typedef nsLineList::iterator LineIterator;
|
|
|
|
typedef nsLineList::const_iterator ConstLineIterator;
|
|
|
|
typedef nsLineList::reverse_iterator ReverseLineIterator;
|
|
|
|
typedef nsLineList::const_reverse_iterator ConstReverseLineIterator;
|
|
|
|
|
2016-10-24 10:01:25 +03:00
|
|
|
LineIterator LinesBegin() { return mLines.begin(); }
|
|
|
|
LineIterator LinesEnd() { return mLines.end(); }
|
|
|
|
ConstLineIterator LinesBegin() const { return mLines.begin(); }
|
|
|
|
ConstLineIterator LinesEnd() const { return mLines.end(); }
|
|
|
|
ReverseLineIterator LinesRBegin() { return mLines.rbegin(); }
|
|
|
|
ReverseLineIterator LinesREnd() { return mLines.rend(); }
|
|
|
|
ConstReverseLineIterator LinesRBegin() const { return mLines.rbegin(); }
|
|
|
|
ConstReverseLineIterator LinesREnd() const { return mLines.rend(); }
|
|
|
|
LineIterator LinesBeginFrom(nsLineBox* aList) { return mLines.begin(aList); }
|
|
|
|
ReverseLineIterator LinesRBeginFrom(nsLineBox* aList) {
|
|
|
|
return mLines.rbegin(aList);
|
|
|
|
}
|
2001-10-25 05:08:40 +04:00
|
|
|
|
2019-04-16 10:24:49 +03:00
|
|
|
friend nsBlockFrame* NS_NewBlockFrame(mozilla::PresShell* aPresShell,
|
2018-03-22 21:20:41 +03:00
|
|
|
ComputedStyle* aStyle);
|
1999-02-09 20:31:33 +03:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
// nsQueryFrame
|
|
|
|
NS_DECL_QUERYFRAME
|
1998-11-16 20:11:12 +03:00
|
|
|
|
|
|
|
// nsIFrame
|
2017-01-18 03:27:03 +03:00
|
|
|
void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) override;
|
|
|
|
void SetInitialChildList(ChildListID aListID,
|
|
|
|
nsFrameList& aChildList) override;
|
|
|
|
void AppendFrames(ChildListID aListID, nsFrameList& aFrameList) override;
|
|
|
|
void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
|
|
|
|
nsFrameList& aFrameList) override;
|
|
|
|
void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override;
|
|
|
|
const nsFrameList& GetChildList(ChildListID aListID) const override;
|
|
|
|
void GetChildLists(nsTArray<ChildList>* aLists) const override;
|
|
|
|
nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
|
2016-12-21 01:56:35 +03:00
|
|
|
bool GetVerticalAlignBaseline(mozilla::WritingMode aWM,
|
|
|
|
nscoord* aBaseline) const override {
|
2019-02-05 22:45:46 +03:00
|
|
|
NS_ASSERTION(!aWM.IsOrthogonalTo(GetWritingMode()),
|
|
|
|
"You should only call this on frames with a WM that's "
|
|
|
|
"parallel to aWM");
|
2016-12-21 01:56:35 +03:00
|
|
|
nscoord lastBaseline;
|
2019-04-26 02:03:04 +03:00
|
|
|
if (GetNaturalBaselineBOffset(aWM, BaselineSharingGroup::Last,
|
2016-12-21 01:56:35 +03:00
|
|
|
&lastBaseline)) {
|
|
|
|
*aBaseline = BSize() - lastBaseline;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
|
|
|
|
BaselineSharingGroup aBaselineGroup,
|
|
|
|
nscoord* aBaseline) const override;
|
2017-01-18 03:27:03 +03:00
|
|
|
nscoord GetCaretBaseline() const override;
|
2017-11-07 03:20:33 +03:00
|
|
|
void DestroyFrom(nsIFrame* aDestructRoot,
|
|
|
|
PostDestroyData& aPostDestroyData) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
bool IsFloatContainingBlock() const override;
|
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists) override;
|
|
|
|
bool IsFrameOfType(uint32_t aFlags) const override {
|
2007-07-26 08:03:29 +04:00
|
|
|
return nsContainerFrame::IsFrameOfType(
|
2019-02-21 00:18:14 +03:00
|
|
|
aFlags & ~(nsIFrame::eCanContainOverflowContainers));
|
2007-07-26 08:03:29 +04:00
|
|
|
}
|
|
|
|
|
2018-04-04 07:15:49 +03:00
|
|
|
void InvalidateFrame(uint32_t aDisplayItemKey = 0,
|
|
|
|
bool aRebuildDisplayItems = true) override;
|
|
|
|
void InvalidateFrameWithRect(const nsRect& aRect,
|
|
|
|
uint32_t aDisplayItemKey = 0,
|
|
|
|
bool aRebuildDisplayItems = true) override;
|
2013-02-11 10:22:20 +04:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
void List(FILE* out = stderr, const char* aPrefix = "",
|
|
|
|
uint32_t aFlags = 0) const override;
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult GetFrameName(nsAString& aResult) const override;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
2004-03-07 21:04:24 +03:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG
|
2016-10-06 19:36:07 +03:00
|
|
|
const char* LineReflowStatusToString(
|
|
|
|
LineReflowStatus aLineReflowStatus) const;
|
2014-01-06 03:31:14 +04:00
|
|
|
#endif
|
|
|
|
|
2004-06-04 23:28:36 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2017-01-18 03:27:03 +03:00
|
|
|
mozilla::a11y::AccType AccessibleType() override;
|
2004-06-04 23:28:36 +04:00
|
|
|
#endif
|
|
|
|
|
2016-10-21 04:41:52 +03:00
|
|
|
// Line cursor methods to speed up line searching in which one query
|
|
|
|
// result is expected to be close to the next in general. This is
|
|
|
|
// mainly for searching line(s) containing a point. It is also used
|
|
|
|
// as a cache for local computation. Use AutoLineCursorSetup for the
|
|
|
|
// latter case so that it wouldn't interact unexpectedly with the
|
|
|
|
// former. The basic idea for the former is that we set the cursor
|
2010-10-07 08:25:45 +04:00
|
|
|
// property if the lines' overflowArea.VisualOverflow().ys and
|
|
|
|
// overflowArea.VisualOverflow().yMosts are non-decreasing
|
|
|
|
// (considering only non-empty overflowArea.VisualOverflow()s; empty
|
|
|
|
// overflowArea.VisualOverflow()s never participate in event handling
|
|
|
|
// or painting), and the block has sufficient number of lines. The
|
2004-03-07 21:04:24 +03:00
|
|
|
// cursor property points to a "recently used" line. If we get a
|
2006-01-26 05:29:17 +03:00
|
|
|
// series of requests that work on lines
|
2004-03-07 21:04:24 +03:00
|
|
|
// "near" the cursor, then we can find those nearby lines quickly by
|
|
|
|
// starting our search at the cursor.
|
|
|
|
|
|
|
|
// Clear out line cursor because we're disturbing the lines (i.e., Reflow)
|
|
|
|
void ClearLineCursor();
|
2012-07-30 18:20:58 +04:00
|
|
|
// Get the first line that might contain y-coord 'y', or nullptr if you must
|
2004-03-07 21:04:24 +03:00
|
|
|
// search all lines. If nonnull is returned then we guarantee that the lines'
|
|
|
|
// combinedArea.ys and combinedArea.yMosts are non-decreasing.
|
|
|
|
// The actual line returned might not contain 'y', but if not, it is
|
|
|
|
// guaranteed to be before any line which does contain 'y'.
|
|
|
|
nsLineBox* GetFirstLineContaining(nscoord y);
|
|
|
|
// Set the line cursor to our first line. Only call this if you
|
2016-04-13 06:42:28 +03:00
|
|
|
// guarantee that either the lines' combinedArea.ys and combinedArea.
|
|
|
|
// yMosts are non-decreasing, or the line cursor is cleared before
|
|
|
|
// building the display list of this frame.
|
2004-03-07 21:04:24 +03:00
|
|
|
void SetupLineCursor();
|
|
|
|
|
2016-10-21 04:41:52 +03:00
|
|
|
/**
|
|
|
|
* Helper RAII class for automatically set and clear line cursor for
|
|
|
|
* temporary use. If the frame already has line cursor, this would be
|
|
|
|
* a no-op.
|
|
|
|
*/
|
|
|
|
class MOZ_STACK_CLASS AutoLineCursorSetup {
|
|
|
|
public:
|
|
|
|
explicit AutoLineCursorSetup(nsBlockFrame* aFrame)
|
|
|
|
: mFrame(aFrame), mOrigCursor(aFrame->GetLineCursor()) {
|
|
|
|
if (!mOrigCursor) {
|
|
|
|
mFrame->SetupLineCursor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
~AutoLineCursorSetup() {
|
|
|
|
if (mOrigCursor) {
|
2017-05-27 14:36:00 +03:00
|
|
|
mFrame->SetProperty(LineCursorProperty(), mOrigCursor);
|
2016-10-21 04:41:52 +03:00
|
|
|
} else {
|
|
|
|
mFrame->ClearLineCursor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsBlockFrame* mFrame;
|
|
|
|
nsLineBox* mOrigCursor;
|
|
|
|
};
|
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
void ChildIsDirty(nsIFrame* aChild) override;
|
2001-03-08 05:46:44 +03:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
bool IsEmpty() override;
|
|
|
|
bool CachedIsEmpty() override;
|
|
|
|
bool IsSelfEmpty() override;
|
2001-10-25 05:08:40 +04:00
|
|
|
|
2019-03-25 01:13:53 +03:00
|
|
|
// Given that we have a ::marker frame, does it actually draw something, i.e.,
|
2009-09-11 14:46:36 +04:00
|
|
|
// do we have either a 'list-style-type' or 'list-style-image' that is
|
2019-03-25 01:13:53 +03:00
|
|
|
// not 'none', and no 'content'?
|
|
|
|
bool MarkerIsEmpty() const;
|
2011-03-28 17:59:54 +04:00
|
|
|
|
2019-04-08 22:49:20 +03:00
|
|
|
#ifdef ACCESSIBILITY
|
2011-03-28 17:59:54 +04:00
|
|
|
/**
|
2019-04-08 22:49:20 +03:00
|
|
|
* Return the ::marker text equivalent, without flushing.
|
2011-03-28 17:59:54 +04:00
|
|
|
*/
|
2019-03-25 01:13:53 +03:00
|
|
|
void GetSpokenMarkerText(nsAString& aText) const;
|
2019-04-08 22:49:20 +03:00
|
|
|
#endif
|
2009-09-11 14:46:36 +04:00
|
|
|
|
2011-03-28 17:59:54 +04:00
|
|
|
/**
|
2019-03-25 01:13:53 +03:00
|
|
|
* Return true if this frame has a ::marker frame.
|
2011-03-28 17:59:54 +04:00
|
|
|
*/
|
2019-03-25 01:13:53 +03:00
|
|
|
bool HasMarker() const { return HasOutsideMarker() || HasInsideMarker(); }
|
2011-03-28 17:59:54 +04:00
|
|
|
|
2012-05-14 08:51:45 +04:00
|
|
|
/**
|
2019-03-25 01:13:53 +03:00
|
|
|
* @return true if this frame has an inside ::marker frame.
|
2012-05-14 08:51:45 +04:00
|
|
|
*/
|
2019-03-25 01:13:53 +03:00
|
|
|
bool HasInsideMarker() const {
|
|
|
|
return 0 != (mState & NS_BLOCK_FRAME_HAS_INSIDE_MARKER);
|
2012-05-14 08:51:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-03-25 01:13:53 +03:00
|
|
|
* @return true if this frame has an outside ::marker frame.
|
2012-05-14 08:51:45 +04:00
|
|
|
*/
|
2019-03-25 01:13:53 +03:00
|
|
|
bool HasOutsideMarker() const {
|
|
|
|
return 0 != (mState & NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER);
|
2012-05-14 08:51:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-03-25 01:13:53 +03:00
|
|
|
* @return the ::marker frame or nullptr if we don't have one.
|
2012-05-14 08:51:45 +04:00
|
|
|
*/
|
2019-03-25 01:13:53 +03:00
|
|
|
nsIFrame* GetMarker() const {
|
|
|
|
nsIFrame* outside = GetOutsideMarker();
|
|
|
|
return outside ? outside : GetInsideMarker();
|
2012-05-14 08:51:45 +04:00
|
|
|
}
|
|
|
|
|
2017-06-27 09:35:07 +03:00
|
|
|
/**
|
|
|
|
* @return the first-letter frame or nullptr if we don't have one.
|
|
|
|
*/
|
|
|
|
nsIFrame* GetFirstLetter() const;
|
|
|
|
|
2017-07-29 04:20:46 +03:00
|
|
|
/**
|
|
|
|
* @return the ::first-line frame or nullptr if we don't have one.
|
|
|
|
*/
|
|
|
|
nsIFrame* GetFirstLineFrame() const;
|
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
void MarkIntrinsicISizesDirty() override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-06-06 06:13:41 +04:00
|
|
|
private:
|
|
|
|
void CheckIntrinsicCacheAgainstShrinkWrapState();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-06-06 06:13:41 +04:00
|
|
|
public:
|
2017-06-09 22:14:53 +03:00
|
|
|
nscoord GetMinISize(gfxContext* aRenderingContext) override;
|
|
|
|
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
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
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsRect ComputeTightBounds(DrawTarget* aDrawTarget) const override;
|
2014-06-20 13:55:35 +04:00
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
nsresult GetPrefWidthTightBounds(gfxContext* aContext, nscoord* aX,
|
2017-01-18 03:27:03 +03:00
|
|
|
nscoord* aXMost) override;
|
2013-11-25 18:20:20 +04:00
|
|
|
|
2013-07-25 19:34:22 +04:00
|
|
|
/**
|
2014-06-20 13:55:35 +04:00
|
|
|
* Compute the final block size of this frame.
|
2013-07-25 19:34:22 +04:00
|
|
|
*
|
2016-07-21 13:36:39 +03:00
|
|
|
* @param aReflowInput Data structure passed from parent during reflow.
|
2014-06-20 13:55:35 +04:00
|
|
|
* @param aReflowStatus A pointer to the reflow status for when we're finished
|
|
|
|
* doing reflow. this will get set appropriately if the block-size
|
|
|
|
* causes us to exceed the current available (page) block-size.
|
|
|
|
* @param aContentBSize The block-size of content, precomputed outside of this
|
|
|
|
* function. The final block-size that is used in aMetrics will be set
|
|
|
|
* to either this or the available block-size, whichever is larger, in
|
|
|
|
* the case where our available block-size is constrained, and we
|
|
|
|
* overflow that available block-size.
|
2013-07-25 19:34:22 +04:00
|
|
|
* @param aBorderPadding The margins representing the border padding for block
|
|
|
|
* frames. Can be 0.
|
2014-06-20 13:55:35 +04:00
|
|
|
* @param aFinalSize Out parameter for final block-size.
|
|
|
|
* @param aConsumed The block-size already consumed by our previous-in-flows.
|
2013-07-25 19:34:22 +04:00
|
|
|
*/
|
2016-10-22 14:41:03 +03:00
|
|
|
void ComputeFinalBSize(const ReflowInput& aReflowInput,
|
|
|
|
nsReflowStatus* aStatus, nscoord aContentBSize,
|
2014-06-20 13:55:35 +04:00
|
|
|
const mozilla::LogicalMargin& aBorderPadding,
|
2016-10-22 14:41:03 +03:00
|
|
|
mozilla::LogicalSize& aFinalSize, nscoord aConsumed);
|
2013-07-25 19:34:22 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
|
|
|
const ReflowInput& aReflowInput,
|
|
|
|
nsReflowStatus& aStatus) override;
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2012-09-18 03:05:05 +04:00
|
|
|
/**
|
|
|
|
* Move any frames on our overflow list to the end of our principal list.
|
|
|
|
* @return true if there were any overflow frames
|
|
|
|
*/
|
2017-01-18 03:27:03 +03:00
|
|
|
bool DrainSelfOverflowList() override;
|
2012-09-18 03:05:05 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult StealFrame(nsIFrame* aChild) override;
|
2007-07-26 08:03:29 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
void DeleteNextInFlowChild(nsIFrame* aNextInFlow,
|
|
|
|
bool aDeletingEmptyFrames) override;
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2013-12-13 21:42:43 +04:00
|
|
|
/**
|
|
|
|
* This is a special method that allows a child class of nsBlockFrame to
|
|
|
|
* return a special, customized nsStyleText object to the nsLineLayout
|
|
|
|
* constructor. It is used when the nsBlockFrame child needs to specify its
|
|
|
|
* custom rendering style.
|
|
|
|
*/
|
|
|
|
virtual const nsStyleText* StyleTextForLineLayout();
|
|
|
|
|
2005-03-23 06:35:08 +03:00
|
|
|
/**
|
|
|
|
* Determines whether the collapsed margin carried out of the last
|
|
|
|
* line includes the margin-top of a line with clearance (in which
|
|
|
|
* case we must avoid collapsing that margin with our bottom margin)
|
|
|
|
*/
|
2014-06-20 13:55:35 +04:00
|
|
|
bool CheckForCollapsedBEndMarginFromClearanceLine();
|
2004-11-25 17:51:00 +03:00
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
static nsresult GetCurrentLine(BlockReflowInput* aState,
|
|
|
|
nsLineBox** aOutCurrentLine);
|
2000-08-24 08:26:43 +04:00
|
|
|
|
2012-07-20 22:27:04 +04:00
|
|
|
/**
|
|
|
|
* Determine if this block is a margin root at the top/bottom edges.
|
|
|
|
*/
|
2014-06-20 13:55:35 +04:00
|
|
|
void IsMarginRoot(bool* aBStartMarginRoot, bool* aBEndMarginRoot);
|
2012-07-20 22:27:04 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool BlockNeedsFloatManager(nsIFrame* aBlock);
|
2008-01-29 10:40:05 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether aFrame is a block frame that will wrap its contents
|
|
|
|
* around floats intruding on it from the outside. (aFrame need not
|
|
|
|
* be a block frame, but if it's not, the result will be false.)
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool BlockCanIntersectFloats(nsIFrame* aFrame);
|
2008-01-29 10:40:05 +03:00
|
|
|
|
|
|
|
/**
|
2014-10-22 02:16:13 +04:00
|
|
|
* Returns the inline size that needs to be cleared past floats for
|
|
|
|
* blocks that cannot intersect floats. aState must already have
|
2019-05-11 00:06:48 +03:00
|
|
|
* GetFloatAvailableSpace called on it for the block-dir position that we
|
2014-10-22 02:16:13 +04:00
|
|
|
* care about (which need not be its current mBCoord)
|
|
|
|
*/
|
|
|
|
struct ReplacedElementISizeToClear {
|
2015-09-27 12:19:14 +03:00
|
|
|
// Note that we care about the inline-start margin but can ignore
|
|
|
|
// the inline-end margin.
|
|
|
|
nscoord marginIStart, borderBoxISize;
|
2008-04-15 05:05:17 +04:00
|
|
|
};
|
2014-10-22 02:16:13 +04:00
|
|
|
static ReplacedElementISizeToClear ISizeToClearPastFloats(
|
2016-07-21 13:36:36 +03:00
|
|
|
const BlockReflowInput& aState,
|
2014-10-22 02:16:13 +04:00
|
|
|
const mozilla::LogicalRect& aFloatAvailableSpace, nsIFrame* aFrame);
|
2008-01-29 10:40:05 +03:00
|
|
|
|
2009-08-31 22:25:36 +04:00
|
|
|
/**
|
|
|
|
* Creates a contination for aFloat and adds it to the list of overflow
|
|
|
|
* floats. Also updates aState.mReflowStatus to include the float's
|
|
|
|
* incompleteness. Must only be called while this block frame is in reflow.
|
|
|
|
* aFloatStatus must be the float's true, unmodified reflow status.
|
|
|
|
*/
|
2017-09-13 10:47:51 +03:00
|
|
|
void SplitFloat(BlockReflowInput& aState, nsIFrame* aFloat,
|
|
|
|
const nsReflowStatus& aFloatStatus);
|
2009-08-31 22:25:36 +04:00
|
|
|
|
2007-10-19 21:41:29 +04:00
|
|
|
/**
|
|
|
|
* Walks up the frame tree, starting with aCandidate, and returns the first
|
|
|
|
* block frame that it encounters.
|
|
|
|
*/
|
|
|
|
static nsBlockFrame* GetNearestAncestorBlock(nsIFrame* aCandidate);
|
2016-10-22 14:41:03 +03:00
|
|
|
|
2012-03-08 05:57:37 +04:00
|
|
|
struct FrameLines {
|
|
|
|
nsLineList mLines;
|
|
|
|
nsFrameList mFrames;
|
|
|
|
};
|
|
|
|
|
2017-06-22 18:24:11 +03:00
|
|
|
/**
|
2019-03-25 01:13:53 +03:00
|
|
|
* Update the styles of our various pseudo-elements (marker, first-line,
|
2017-06-29 08:19:35 +03:00
|
|
|
* etc, but _not_ first-letter).
|
2017-06-22 18:24:11 +03:00
|
|
|
*/
|
|
|
|
void UpdatePseudoElementStyles(mozilla::ServoRestyleState& aRestyleState);
|
|
|
|
|
2017-06-29 08:19:35 +03:00
|
|
|
// Update our first-letter styles during stylo post-traversal. This needs to
|
|
|
|
// be done at a slightly different time than our other pseudo-elements.
|
|
|
|
void UpdateFirstLetterStyle(mozilla::ServoRestyleState& aRestyleState);
|
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
protected:
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit nsBlockFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
|
|
|
|
ClassID aID = kClassID)
|
2019-05-03 20:34:55 +03:00
|
|
|
: nsContainerFrame(aStyle, aPresContext, aID) {
|
2006-03-27 01:30:36 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
InitDebugFlags();
|
|
|
|
#endif
|
|
|
|
}
|
2017-04-30 18:30:08 +03:00
|
|
|
|
1999-02-09 20:31:33 +03:00
|
|
|
virtual ~nsBlockFrame();
|
2006-02-27 07:13:51 +03:00
|
|
|
|
2007-04-16 04:42:54 +04:00
|
|
|
#ifdef DEBUG
|
2018-03-22 21:20:41 +03:00
|
|
|
already_AddRefed<ComputedStyle> GetFirstLetterStyle(
|
|
|
|
nsPresContext* aPresContext);
|
2007-04-16 04:42:54 +04:00
|
|
|
#endif
|
1999-04-28 02:11:05 +04:00
|
|
|
|
2016-01-28 06:23:59 +03:00
|
|
|
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(LineCursorProperty, nsLineBox)
|
2016-10-21 04:41:52 +03:00
|
|
|
bool HasLineCursor() { return GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR; }
|
2012-05-04 04:14:01 +04:00
|
|
|
nsLineBox* GetLineCursor() {
|
2017-05-27 14:36:00 +03:00
|
|
|
return HasLineCursor() ? GetProperty(LineCursorProperty()) : nullptr;
|
2012-05-04 04:14:01 +04:00
|
|
|
}
|
|
|
|
|
2012-03-11 06:32:27 +04:00
|
|
|
nsLineBox* NewLineBox(nsIFrame* aFrame, bool aIsBlock) {
|
2017-11-09 05:00:48 +03:00
|
|
|
return NS_NewLineBox(PresShell(), aFrame, aIsBlock);
|
2012-03-11 06:32:27 +04:00
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
nsLineBox* NewLineBox(nsLineBox* aFromLine, nsIFrame* aFrame,
|
|
|
|
int32_t aCount) {
|
2017-11-09 05:00:48 +03:00
|
|
|
return NS_NewLineBox(PresShell(), aFromLine, aFrame, aCount);
|
2012-03-11 06:32:27 +04:00
|
|
|
}
|
|
|
|
void FreeLineBox(nsLineBox* aLine) {
|
2012-05-04 04:14:01 +04:00
|
|
|
if (aLine == GetLineCursor()) {
|
|
|
|
ClearLineCursor();
|
|
|
|
}
|
2017-11-09 05:00:48 +03:00
|
|
|
aLine->Destroy(PresShell());
|
2012-03-11 06:32:27 +04:00
|
|
|
}
|
2013-03-24 00:49:45 +04:00
|
|
|
/**
|
|
|
|
* Helper method for StealFrame.
|
|
|
|
*/
|
|
|
|
void RemoveFrameFromLine(nsIFrame* aChild, nsLineList::iterator aLine,
|
|
|
|
nsFrameList& aFrameList, nsLineList& aLineList);
|
2012-03-11 06:32:27 +04:00
|
|
|
|
2004-10-08 16:17:10 +04:00
|
|
|
void TryAllLines(nsLineList::iterator* aIterator,
|
2007-10-07 21:32:07 +04:00
|
|
|
nsLineList::iterator* aStartIterator,
|
2004-10-08 16:17:10 +04:00
|
|
|
nsLineList::iterator* aEndIterator, bool* aInOverflowLines,
|
2012-03-08 05:57:37 +04:00
|
|
|
FrameLines** aOverflowLines);
|
2004-08-26 16:38:50 +04:00
|
|
|
|
2014-11-13 11:58:02 +03:00
|
|
|
/** move the frames contained by aLine by aDeltaBCoord
|
2005-11-21 01:05:24 +03:00
|
|
|
* if aLine is a block, its child floats are added to the state manager
|
2000-03-23 02:19:10 +03:00
|
|
|
*/
|
2016-07-21 13:36:36 +03:00
|
|
|
void SlideLine(BlockReflowInput& aState, nsLineBox* aLine,
|
2014-11-13 11:58:02 +03:00
|
|
|
nscoord aDeltaBCoord);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2015-07-16 12:07:57 +03:00
|
|
|
void UpdateLineContainerSize(nsLineBox* aLine,
|
|
|
|
const nsSize& aNewContainerSize);
|
2014-12-16 12:45:41 +03:00
|
|
|
|
2015-07-16 12:07:57 +03:00
|
|
|
// helper for SlideLine and UpdateLineContainerSize
|
2014-12-16 12:45:41 +03:00
|
|
|
void MoveChildFramesOfLine(nsLineBox* aLine, nscoord aDeltaBCoord);
|
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
void ComputeFinalSize(const ReflowInput& aReflowInput,
|
2016-10-22 14:41:03 +03:00
|
|
|
BlockReflowInput& aState, ReflowOutput& aMetrics,
|
|
|
|
nscoord* aBottomEdgeOfChildren);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2016-10-22 14:41:03 +03:00
|
|
|
void ComputeOverflowAreas(const nsRect& aBounds,
|
2011-06-16 01:03:49 +04:00
|
|
|
const nsStyleDisplay* aDisplay,
|
2016-10-22 14:41:03 +03:00
|
|
|
nscoord aBottomEdgeOfChildren,
|
|
|
|
nsOverflowAreas& aOverflowAreas);
|
2002-09-24 15:43:48 +04:00
|
|
|
|
2013-03-24 00:10:34 +04:00
|
|
|
/**
|
|
|
|
* Add the frames in aFrameList to this block after aPrevSibling.
|
|
|
|
* This block thinks in terms of lines, but the frame construction code
|
|
|
|
* knows nothing about lines at all so we need to find the line that
|
|
|
|
* contains aPrevSibling and add aFrameList after aPrevSibling on that line.
|
|
|
|
* New lines are created as necessary to handle block data in aFrameList.
|
|
|
|
* This function will clear aFrameList.
|
|
|
|
*/
|
|
|
|
void AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling);
|
1999-04-20 04:27:43 +04:00
|
|
|
|
2007-05-28 18:40:56 +04:00
|
|
|
/**
|
|
|
|
* Perform Bidi resolution on this frame
|
|
|
|
*/
|
|
|
|
nsresult ResolveBidi();
|
|
|
|
|
2007-02-11 10:19:09 +03:00
|
|
|
/**
|
|
|
|
* Test whether the frame is a form control in a visual Bidi page.
|
|
|
|
* This is necessary for backwards-compatibility, because most visual
|
|
|
|
* pages use logical order for form controls so that they will
|
|
|
|
* display correctly on native widgets in OSs with Bidi support
|
|
|
|
* @param aPresContext the pres context
|
|
|
|
* @return whether the frame is a BIDI form control
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsVisualFormControl(nsPresContext* aPresContext);
|
2007-02-11 10:19:09 +03:00
|
|
|
|
2018-09-26 23:55:26 +03:00
|
|
|
public:
|
2016-02-02 12:39:49 +03:00
|
|
|
/**
|
2019-03-25 01:13:53 +03:00
|
|
|
* Helper function for the frame ctor to register a ::marker frame.
|
2016-02-02 12:39:49 +03:00
|
|
|
*/
|
2019-03-25 01:13:53 +03:00
|
|
|
void SetMarkerFrameForListItem(nsIFrame* aMarkerFrame);
|
2016-02-02 12:39:49 +03:00
|
|
|
|
2008-12-03 04:27:19 +03:00
|
|
|
/**
|
|
|
|
* Does all the real work for removing aDeletedFrame
|
|
|
|
* -- finds the line containing aDeletedFrame
|
|
|
|
* -- removes all aDeletedFrame next-in-flows (or all continuations,
|
|
|
|
* if REMOVE_FIXED_CONTINUATIONS is given)
|
|
|
|
* -- marks lines dirty as needed
|
|
|
|
* -- marks textruns dirty (unless FRAMES_ARE_EMPTY is given, in which
|
|
|
|
* case textruns do not need to be dirtied)
|
2009-08-31 22:25:35 +04:00
|
|
|
* -- destroys all removed frames
|
2008-12-03 04:27:19 +03:00
|
|
|
*/
|
|
|
|
enum { REMOVE_FIXED_CONTINUATIONS = 0x02, FRAMES_ARE_EMPTY = 0x04 };
|
2017-11-10 21:28:05 +03:00
|
|
|
void DoRemoveFrame(nsIFrame* aDeletedFrame, uint32_t aFlags) {
|
|
|
|
AutoPostDestroyData data(PresContext());
|
|
|
|
DoRemoveFrameInternal(aDeletedFrame, aFlags, data.mData);
|
|
|
|
}
|
2007-04-21 04:42:58 +04:00
|
|
|
|
2013-02-28 03:05:45 +04:00
|
|
|
void ReparentFloats(nsIFrame* aFirstFrame, nsBlockFrame* aOldParent,
|
2018-07-10 04:36:33 +03:00
|
|
|
bool aReparentSiblings, ReparentingDirection aDirection);
|
2007-04-21 04:42:58 +04:00
|
|
|
|
2016-05-04 03:27:43 +03:00
|
|
|
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
|
|
|
|
|
|
|
|
virtual void UnionChildOverflow(nsOverflowAreas& aOverflowAreas) override;
|
2011-06-16 01:03:49 +04:00
|
|
|
|
2018-12-05 21:44:03 +03:00
|
|
|
/**
|
|
|
|
* Load all of aFrame's floats into the float manager iff aFrame is not a
|
|
|
|
* block formatting context. Handles all necessary float manager translations;
|
|
|
|
* assumes float manager is in aFrame's parent's coord system.
|
|
|
|
*
|
|
|
|
* Safe to call on non-blocks (does nothing).
|
2009-08-31 22:25:36 +04:00
|
|
|
*/
|
2016-10-22 14:41:03 +03:00
|
|
|
static void RecoverFloatsFor(nsIFrame* aFrame, nsFloatManager& aFloatManager,
|
2014-10-22 02:16:12 +04:00
|
|
|
mozilla::WritingMode aWM,
|
2016-10-22 14:41:03 +03:00
|
|
|
const nsSize& aContainerSize);
|
2009-08-31 22:25:36 +04:00
|
|
|
|
2013-03-19 18:05:05 +04:00
|
|
|
/**
|
|
|
|
* Determine if we have any pushed floats from a previous continuation.
|
|
|
|
*
|
|
|
|
* @returns true, if any of the floats at the beginning of our mFloats list
|
|
|
|
* have the NS_FRAME_IS_PUSHED_FLOAT bit set; false otherwise.
|
|
|
|
*/
|
|
|
|
bool HasPushedFloatsFromPrevContinuation() const {
|
|
|
|
if (!mFloats.IsEmpty()) {
|
|
|
|
// If we have pushed floats, then they should be at the beginning of our
|
|
|
|
// float list.
|
2013-03-19 21:36:05 +04:00
|
|
|
if (mFloats.FirstChild()->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT) {
|
2013-03-19 18:05:05 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
// Double-check the above assertion that pushed floats should be at the
|
|
|
|
// beginning of our floats list.
|
2013-03-19 21:36:05 +04:00
|
|
|
for (nsFrameList::Enumerator e(mFloats); !e.AtEnd(); e.Next()) {
|
|
|
|
nsIFrame* f = e.get();
|
|
|
|
NS_ASSERTION(!(f->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT),
|
2013-03-19 18:05:05 +04:00
|
|
|
"pushed floats must be at the beginning of the float list");
|
|
|
|
}
|
|
|
|
#endif
|
2017-11-16 20:58:29 +03:00
|
|
|
|
|
|
|
// We may have a pending push of pushed floats too:
|
|
|
|
if (HasPushedFloats()) {
|
|
|
|
// XXX we can return 'true' here once we make HasPushedFloats
|
|
|
|
// not lie. (see nsBlockFrame::RemoveFloat)
|
|
|
|
auto* pushedFloats = GetPushedFloats();
|
|
|
|
return pushedFloats && !pushedFloats->IsEmpty();
|
|
|
|
}
|
2013-03-19 18:05:05 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-09-19 06:27:18 +03:00
|
|
|
// @see nsIFrame::AddSizeOfExcludingThisForTree
|
|
|
|
void AddSizeOfExcludingThisForTree(nsWindowSizes&) const override;
|
|
|
|
|
2019-05-09 05:32:30 +03:00
|
|
|
/**
|
|
|
|
* Clears any -webkit-line-clamp ellipsis on a line in this block or one
|
|
|
|
* of its descendants.
|
|
|
|
*/
|
|
|
|
void ClearLineClampEllipsis();
|
|
|
|
|
2005-03-23 06:35:08 +03:00
|
|
|
protected:
|
2017-11-10 21:28:05 +03:00
|
|
|
/** @see DoRemoveFrame */
|
|
|
|
void DoRemoveFrameInternal(nsIFrame* aDeletedFrame, uint32_t aFlags,
|
|
|
|
PostDestroyData& data);
|
1999-08-31 07:09:40 +04:00
|
|
|
|
2004-10-08 16:17:10 +04:00
|
|
|
/** grab overflow lines from this block's prevInFlow, and make them
|
|
|
|
* part of this block's mLines list.
|
2011-10-17 18:59:28 +04:00
|
|
|
* @return true if any lines were drained.
|
2004-10-08 16:17:10 +04:00
|
|
|
*/
|
2012-01-31 03:35:03 +04:00
|
|
|
bool DrainOverflowLines();
|
2004-10-08 16:17:10 +04:00
|
|
|
|
2013-02-28 03:05:45 +04:00
|
|
|
/**
|
|
|
|
* @return false iff this block does not have a float on any child list.
|
|
|
|
* This function is O(1).
|
|
|
|
*/
|
|
|
|
bool MaybeHasFloats() const {
|
|
|
|
if (!mFloats.IsEmpty()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// XXX this could be replaced with HasPushedFloats() if we enforced
|
|
|
|
// removing the property when the frame list becomes empty.
|
|
|
|
nsFrameList* list = GetPushedFloats();
|
|
|
|
if (list && !list->IsEmpty()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// For the OverflowOutOfFlowsProperty I think we do enforce that, but it's
|
|
|
|
// a mix of out-of-flow frames, so that's why the method name has "Maybe".
|
|
|
|
return GetStateBits() & NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS;
|
|
|
|
}
|
|
|
|
|
2015-04-11 03:21:06 +03:00
|
|
|
/**
|
|
|
|
* Moves frames from our PushedFloats list back into our mFloats list.
|
|
|
|
*/
|
|
|
|
void DrainSelfPushedFloats();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* First calls DrainSelfPushedFloats() then grabs pushed floats from this
|
|
|
|
* block's prev-in-flow, and splice them into this block's mFloats list too.
|
|
|
|
*/
|
|
|
|
void DrainPushedFloats();
|
2009-08-31 22:25:36 +04:00
|
|
|
|
|
|
|
/** Load all our floats into the float manager (without reflowing them).
|
|
|
|
* Assumes float manager is in our own coordinate system.
|
|
|
|
*/
|
2016-10-22 14:41:03 +03:00
|
|
|
void RecoverFloats(nsFloatManager& aFloatManager, mozilla::WritingMode aWM,
|
|
|
|
const nsSize& aContainerSize);
|
2009-08-31 22:25:36 +04:00
|
|
|
|
2010-08-06 08:59:20 +04:00
|
|
|
/** Reflow pushed floats
|
2009-08-31 22:25:36 +04:00
|
|
|
*/
|
2016-07-21 13:36:36 +03:00
|
|
|
void ReflowPushedFloats(BlockReflowInput& aState,
|
2016-10-22 14:41:03 +03:00
|
|
|
nsOverflowAreas& aOverflowAreas,
|
|
|
|
nsReflowStatus& aStatus);
|
2009-08-31 22:25:36 +04:00
|
|
|
|
2009-08-31 22:25:36 +04:00
|
|
|
/** Find any trailing BR clear from the last line of the block (or its PIFs)
|
|
|
|
*/
|
2016-09-07 05:20:17 +03:00
|
|
|
mozilla::StyleClear FindTrailingClear();
|
2009-08-31 22:25:36 +04:00
|
|
|
|
2004-10-08 16:17:10 +04:00
|
|
|
/**
|
2013-03-16 02:32:35 +04:00
|
|
|
* Remove a float from our float list.
|
|
|
|
*/
|
2013-02-28 03:05:45 +04:00
|
|
|
void RemoveFloat(nsIFrame* aFloat);
|
2013-03-16 02:32:35 +04:00
|
|
|
/**
|
|
|
|
* Remove a float from the float cache for the line its placeholder is on.
|
|
|
|
*/
|
|
|
|
void RemoveFloatFromFloatCache(nsIFrame* aFloat);
|
2004-10-08 16:17:10 +04:00
|
|
|
|
2009-09-18 15:09:36 +04:00
|
|
|
void CollectFloats(nsIFrame* aFrame, nsFrameList& aList,
|
2013-02-28 03:05:45 +04:00
|
|
|
bool aCollectFromSiblings) {
|
|
|
|
if (MaybeHasFloats()) {
|
|
|
|
DoCollectFloats(aFrame, aList, aCollectFromSiblings);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void DoCollectFloats(nsIFrame* aFrame, nsFrameList& aList,
|
|
|
|
bool aCollectFromSiblings);
|
|
|
|
|
2003-10-14 01:51:02 +04:00
|
|
|
// Remove a float, abs, rel positioned frame from the appropriate block's list
|
2005-02-07 04:58:25 +03:00
|
|
|
static void DoRemoveOutOfFlowFrame(nsIFrame* aFrame);
|
1999-04-20 04:27:43 +04:00
|
|
|
|
2000-03-23 02:19:10 +03:00
|
|
|
/** set up the conditions necessary for an resize reflow
|
2016-10-22 14:41:05 +03:00
|
|
|
* the primary task is to mark the minimumly sufficient lines dirty.
|
2000-03-23 02:19:10 +03:00
|
|
|
*/
|
2016-07-21 13:36:36 +03:00
|
|
|
void PrepareResizeReflow(BlockReflowInput& aState);
|
1998-11-16 20:11: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
|
|
|
/** reflow all lines that have been marked dirty */
|
2016-07-21 13:36:36 +03:00
|
|
|
void ReflowDirtyLines(BlockReflowInput& aState);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2009-04-22 03:53:52 +04:00
|
|
|
/** Mark a given line dirty due to reflow being interrupted on or before it */
|
|
|
|
void MarkLineDirtyForInterrupt(nsLineBox* aLine);
|
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
//----------------------------------------
|
|
|
|
// Methods for line reflow
|
2000-03-23 02:19:10 +03:00
|
|
|
/**
|
2016-10-22 14:41:05 +03:00
|
|
|
* Reflow a line.
|
2018-12-05 21:44:03 +03:00
|
|
|
*
|
|
|
|
* @param aState
|
2019-04-11 23:27:37 +03:00
|
|
|
* the current reflow input
|
2018-12-05 21:44:03 +03:00
|
|
|
* @param aLine
|
|
|
|
* the line to reflow. can contain a single block frame or contain 1 or
|
|
|
|
* more inline frames.
|
|
|
|
* @param aKeepReflowGoing [OUT]
|
|
|
|
* indicates whether the caller should continue to reflow more lines
|
2000-03-23 02:19:10 +03:00
|
|
|
*/
|
2016-07-21 13:36:36 +03:00
|
|
|
void ReflowLine(BlockReflowInput& aState, LineIterator aLine,
|
2014-05-13 04:47:52 +04:00
|
|
|
bool* aKeepReflowGoing);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2009-05-20 15:21:34 +04:00
|
|
|
// Return false if it needs another reflow because of reduced space
|
|
|
|
// between floats that are next to it (but not next to its top), and
|
|
|
|
// return true otherwise.
|
2016-10-22 14:41:03 +03:00
|
|
|
bool PlaceLine(BlockReflowInput& aState, nsLineLayout& aLineLayout,
|
2016-10-22 14:41:04 +03:00
|
|
|
LineIterator aLine,
|
2016-10-22 14:41:03 +03:00
|
|
|
nsFloatManager::SavedState* aFloatStateBeforeLine,
|
2018-06-06 22:02:36 +03:00
|
|
|
nsFlowAreaRect& aFlowArea, // in-out
|
2016-11-08 08:42:14 +03:00
|
|
|
nscoord& aAvailableSpaceBSize, // in-out
|
2016-10-22 14:41:03 +03:00
|
|
|
bool* aKeepReflowGoing);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2013-05-14 02:37:00 +04:00
|
|
|
/**
|
|
|
|
* If NS_BLOCK_LOOK_FOR_DIRTY_FRAMES is set, call MarkLineDirty
|
|
|
|
* on any line with a child frame that is dirty.
|
|
|
|
*/
|
|
|
|
void LazyMarkLinesDirty();
|
|
|
|
|
2001-10-25 05:08:40 +04:00
|
|
|
/**
|
|
|
|
* Mark |aLine| dirty, and, if necessary because of possible
|
2007-11-09 09:55:32 +03:00
|
|
|
* pull-up, mark the previous line dirty as well. Also invalidates textruns
|
|
|
|
* on those lines because the text in the lines might have changed due to
|
|
|
|
* addition/removal of frames.
|
2008-10-12 23:26:06 +04:00
|
|
|
* @param aLine the line to mark dirty
|
2012-07-20 22:27:03 +04:00
|
|
|
* @param aLineList the line list containing that line
|
2001-10-25 05:08:40 +04:00
|
|
|
*/
|
2016-10-22 14:41:04 +03:00
|
|
|
void MarkLineDirty(LineIterator aLine, const nsLineList* aLineList);
|
2000-01-12 11:28:24 +03:00
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
// XXX where to go
|
2016-07-21 13:36:36 +03:00
|
|
|
bool IsLastLine(BlockReflowInput& aState, LineIterator aLine);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
void DeleteLine(BlockReflowInput& aState, nsLineList::iterator aLine,
|
2001-10-25 05:08:40 +04:00
|
|
|
nsLineList::iterator aLineEnd);
|
1998-12-08 01:28:23 +03:00
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
//----------------------------------------
|
|
|
|
// Methods for individual frame reflow
|
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
bool ShouldApplyBStartMargin(BlockReflowInput& aState, nsLineBox* aLine,
|
2014-06-24 21:52:19 +04:00
|
|
|
nsIFrame* aChildFrame);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
void ReflowBlockFrame(BlockReflowInput& aState, LineIterator aLine,
|
2014-05-13 04:47:52 +04:00
|
|
|
bool* aKeepGoing);
|
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
void ReflowInlineFrames(BlockReflowInput& aState, LineIterator aLine,
|
2014-05-13 04:47:52 +04:00
|
|
|
bool* aKeepLineGoing);
|
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
void DoReflowInlineFrames(
|
2014-05-13 04:47:52 +04:00
|
|
|
BlockReflowInput& aState, nsLineLayout& aLineLayout, LineIterator aLine,
|
|
|
|
nsFlowAreaRect& aFloatAvailableSpace, nscoord& aAvailableSpaceBSize,
|
2016-11-08 08:42:14 +03:00
|
|
|
nsFloatManager::SavedState* aFloatStateBeforeLine, bool* aKeepReflowGoing,
|
2014-05-13 04:47:52 +04:00
|
|
|
LineReflowStatus* aLineReflowStatus, bool aAllowPullUp);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
void ReflowInlineFrame(BlockReflowInput& aState, nsLineLayout& aLineLayout,
|
2016-10-22 14:41:04 +03:00
|
|
|
LineIterator aLine, nsIFrame* aFrame,
|
2014-05-13 04:47:52 +04:00
|
|
|
LineReflowStatus* aLineReflowStatus);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2014-10-22 02:16:13 +04:00
|
|
|
// Compute the available inline size for a float.
|
|
|
|
mozilla::LogicalRect AdjustFloatAvailableSpace(
|
2016-10-22 14:41:03 +03:00
|
|
|
BlockReflowInput& aState,
|
2014-10-22 02:16:13 +04:00
|
|
|
const mozilla::LogicalRect& aFloatAvailableSpace, nsIFrame* aFloatFrame);
|
|
|
|
// Computes the border-box inline size of the float
|
2016-10-22 14:41:03 +03:00
|
|
|
nscoord ComputeFloatISize(BlockReflowInput& aState,
|
2014-10-22 02:16:13 +04:00
|
|
|
const mozilla::LogicalRect& aFloatAvailableSpace,
|
2016-10-22 14:41:03 +03:00
|
|
|
nsIFrame* aFloat);
|
2003-10-14 01:51:02 +04:00
|
|
|
// An incomplete aReflowStatus indicates the float should be split
|
2002-06-14 18:30:33 +04:00
|
|
|
// but only if the available height is constrained.
|
2010-08-06 08:59:18 +04:00
|
|
|
// aAdjustedAvailableSpace is the result of calling
|
|
|
|
// nsBlockFrame::AdjustFloatAvailableSpace.
|
2016-10-22 14:41:03 +03:00
|
|
|
void ReflowFloat(BlockReflowInput& aState,
|
2014-10-22 02:16:13 +04:00
|
|
|
const mozilla::LogicalRect& aAdjustedAvailableSpace,
|
2016-10-22 14:41:03 +03:00
|
|
|
nsIFrame* aFloat, mozilla::LogicalMargin& aFloatMargin,
|
|
|
|
mozilla::LogicalMargin& aFloatOffsets,
|
2014-05-13 04:47:52 +04:00
|
|
|
// Whether the float's position
|
|
|
|
// (aAdjustedAvailableSpace) has been pushed down
|
|
|
|
// due to the presence of other floats.
|
2016-10-22 14:41:03 +03:00
|
|
|
bool aFloatPushedDown, nsReflowStatus& aReflowStatus);
|
1998-11-16 20:11:12 +03:00
|
|
|
|
1998-12-05 19:02:08 +03:00
|
|
|
//----------------------------------------
|
|
|
|
// Methods for pushing/pulling lines/frames
|
|
|
|
|
2009-09-18 15:09:35 +04:00
|
|
|
/**
|
|
|
|
* Create a next-in-flow, if necessary, for aFrame. If a new frame is
|
|
|
|
* created, place it in aLine if aLine is not null.
|
2019-04-11 23:27:37 +03:00
|
|
|
* @param aState the block reflow input
|
2009-09-18 15:09:35 +04:00
|
|
|
* @param aLine where to put a new frame
|
|
|
|
* @param aFrame the frame
|
2013-06-19 10:09:20 +04:00
|
|
|
* @return true if a new frame was created, false if not
|
2009-09-18 15:09:35 +04:00
|
|
|
*/
|
2016-07-21 13:36:36 +03:00
|
|
|
bool CreateContinuationFor(BlockReflowInput& aState, nsLineBox* aLine,
|
2016-10-22 14:41:03 +03:00
|
|
|
nsIFrame* aFrame);
|
2002-05-29 02:50:43 +04:00
|
|
|
|
2012-11-08 20:09:38 +04:00
|
|
|
/**
|
|
|
|
* Push aLine (and any after it), since it cannot be placed on this
|
|
|
|
* page/column. Set aKeepReflowGoing to false and set
|
|
|
|
* flag aState.mReflowStatus as incomplete.
|
|
|
|
*/
|
2016-07-21 13:36:36 +03:00
|
|
|
void PushTruncatedLine(BlockReflowInput& aState, LineIterator aLine,
|
2016-10-22 14:41:03 +03:00
|
|
|
bool* aKeepReflowGoing);
|
2002-05-29 02:50:43 +04:00
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
void SplitLine(BlockReflowInput& aState, nsLineLayout& aLineLayout,
|
2016-10-22 14:41:04 +03:00
|
|
|
LineIterator aLine, nsIFrame* aFrame,
|
2013-06-19 10:09:22 +04:00
|
|
|
LineReflowStatus* aLineReflowStatus);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
2010-01-11 17:08:23 +03:00
|
|
|
/**
|
|
|
|
* Pull a frame from the next available location (one of our lines or
|
|
|
|
* one of our next-in-flows lines).
|
2012-07-30 18:20:58 +04:00
|
|
|
* @return the pulled frame or nullptr
|
2010-01-11 17:08:23 +03:00
|
|
|
*/
|
2016-07-21 13:36:36 +03:00
|
|
|
nsIFrame* PullFrame(BlockReflowInput& aState, LineIterator aLine);
|
2010-01-11 17:08:23 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Try to pull a frame out of a line pointed at by aFromLine.
|
|
|
|
*
|
|
|
|
* Note: pulling a frame from a line that is a place-holder frame
|
|
|
|
* doesn't automatically remove the corresponding float from the
|
|
|
|
* line's float array. This happens indirectly: either the line gets
|
|
|
|
* emptied (and destroyed) or the line gets reflowed (because we mark
|
|
|
|
* it dirty) and the code at the top of ReflowLine empties the
|
|
|
|
* array. So eventually, it will be removed, just not right away.
|
|
|
|
*
|
2012-07-30 18:20:58 +04:00
|
|
|
* @return the pulled frame or nullptr
|
2010-01-11 17:08:23 +03:00
|
|
|
*/
|
2016-10-22 14:41:03 +03:00
|
|
|
nsIFrame* PullFrameFrom(nsLineBox* aLine, nsBlockFrame* aFromContainer,
|
2010-01-11 17:08:23 +03:00
|
|
|
nsLineList::iterator aFromLine);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
2012-03-08 05:57:37 +04:00
|
|
|
/**
|
|
|
|
* Push the line after aLineBefore to the overflow line list.
|
2016-10-24 10:01:25 +03:00
|
|
|
* @param aLineBefore a line in 'mLines' (or LinesBegin() when
|
2012-03-08 05:57:37 +04:00
|
|
|
* pushing the first line)
|
|
|
|
*/
|
2016-07-21 13:36:36 +03:00
|
|
|
void PushLines(BlockReflowInput& aState, nsLineList::iterator aLineBefore);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
void PropagateFloatDamage(BlockReflowInput& aState, nsLineBox* aLine,
|
2014-10-22 02:16:13 +04:00
|
|
|
nscoord aDeltaBCoord);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
void CheckFloats(BlockReflowInput& aState);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
1999-07-14 21:26:20 +04:00
|
|
|
//----------------------------------------
|
|
|
|
// List handling kludge
|
|
|
|
|
2019-03-25 01:13:53 +03:00
|
|
|
void ReflowOutsideMarker(nsIFrame* aMarkerFrame, BlockReflowInput& aState,
|
|
|
|
ReflowOutput& aMetrics, nscoord aLineTop);
|
1998-12-05 19:02:08 +03:00
|
|
|
|
1999-07-14 21:26:20 +04:00
|
|
|
//----------------------------------------
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsILineIterator* GetLineIterator() override;
|
2008-10-30 22:17:59 +03:00
|
|
|
|
2005-03-23 06:35:08 +03:00
|
|
|
public:
|
2012-03-08 05:57:37 +04:00
|
|
|
bool HasOverflowLines() const {
|
|
|
|
return 0 != (GetStateBits() & NS_BLOCK_HAS_OVERFLOW_LINES);
|
|
|
|
}
|
|
|
|
FrameLines* GetOverflowLines() const;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2005-03-23 06:35:08 +03:00
|
|
|
protected:
|
2012-03-08 05:57:37 +04:00
|
|
|
FrameLines* RemoveOverflowLines();
|
|
|
|
void SetOverflowLines(FrameLines* aOverflowLines);
|
|
|
|
void DestroyOverflowLines();
|
1999-11-03 02:42:52 +03:00
|
|
|
|
2005-03-23 06:35:08 +03:00
|
|
|
/**
|
|
|
|
* This class is useful for efficiently modifying the out of flow
|
|
|
|
* overflow list. It gives the client direct writable access to
|
|
|
|
* the frame list temporarily but ensures that property is only
|
|
|
|
* written back if absolutely necessary.
|
|
|
|
*/
|
|
|
|
struct nsAutoOOFFrameList {
|
|
|
|
nsFrameList mList;
|
|
|
|
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsAutoOOFFrameList(nsBlockFrame* aBlock)
|
2009-09-24 06:39:21 +04:00
|
|
|
: mPropValue(aBlock->GetOverflowOutOfFlows()), mBlock(aBlock) {
|
|
|
|
if (mPropValue) {
|
|
|
|
mList = *mPropValue;
|
2005-03-23 06:35:08 +03:00
|
|
|
}
|
|
|
|
}
|
2009-09-24 06:39:21 +04:00
|
|
|
~nsAutoOOFFrameList() { mBlock->SetOverflowOutOfFlows(mList, mPropValue); }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2005-03-23 06:35:08 +03:00
|
|
|
protected:
|
2009-09-24 06:39:21 +04:00
|
|
|
nsFrameList* const mPropValue;
|
2009-09-18 15:09:36 +04:00
|
|
|
nsBlockFrame* const mBlock;
|
2005-03-23 06:35:08 +03:00
|
|
|
};
|
2005-06-01 20:28:06 +04:00
|
|
|
friend struct nsAutoOOFFrameList;
|
2005-03-23 06:35:08 +03:00
|
|
|
|
2009-09-24 06:39:21 +04:00
|
|
|
nsFrameList* GetOverflowOutOfFlows() const;
|
|
|
|
void SetOverflowOutOfFlows(const nsFrameList& aList, nsFrameList* aPropValue);
|
2004-05-05 06:30:33 +04:00
|
|
|
|
2012-03-08 05:57:37 +04:00
|
|
|
/**
|
2019-03-25 01:13:53 +03:00
|
|
|
* @return the inside ::marker frame or nullptr if we don't have one.
|
2012-03-08 05:57:37 +04:00
|
|
|
*/
|
2019-03-25 01:13:53 +03:00
|
|
|
nsIFrame* GetInsideMarker() const;
|
2012-03-08 05:57:37 +04:00
|
|
|
|
|
|
|
/**
|
2019-03-25 01:13:53 +03:00
|
|
|
* @return the outside ::marker frame or nullptr if we don't have one.
|
2012-03-08 05:57:37 +04:00
|
|
|
*/
|
2019-03-25 01:13:53 +03:00
|
|
|
nsIFrame* GetOutsideMarker() const;
|
2012-03-08 05:57:37 +04:00
|
|
|
|
|
|
|
/**
|
2019-03-25 01:13:53 +03:00
|
|
|
* @return the outside ::marker frame list frame property.
|
2012-03-08 05:57:37 +04:00
|
|
|
*/
|
2019-03-25 01:13:53 +03:00
|
|
|
nsFrameList* GetOutsideMarkerList() const;
|
2012-03-08 05:57:37 +04:00
|
|
|
|
2012-03-08 05:57:37 +04:00
|
|
|
/**
|
|
|
|
* @return true if this frame has pushed floats.
|
|
|
|
*/
|
|
|
|
bool HasPushedFloats() const {
|
|
|
|
return 0 != (GetStateBits() & NS_BLOCK_HAS_PUSHED_FLOATS);
|
|
|
|
}
|
|
|
|
|
2013-01-12 02:51:21 +04:00
|
|
|
// Get the pushed floats list, which is used for *temporary* storage
|
|
|
|
// of floats during reflow, between when we decide they don't fit in
|
|
|
|
// this block until our next continuation takes them.
|
2010-08-06 08:59:20 +04:00
|
|
|
nsFrameList* GetPushedFloats() const;
|
|
|
|
// Get the pushed floats list, or if there is not currently one,
|
2010-08-06 08:59:19 +04:00
|
|
|
// make a new empty one.
|
2010-08-06 08:59:20 +04:00
|
|
|
nsFrameList* EnsurePushedFloats();
|
|
|
|
// Remove and return the pushed floats list.
|
|
|
|
nsFrameList* RemovePushedFloats();
|
2010-08-06 08:59:19 +04:00
|
|
|
|
2012-06-25 23:59:42 +04:00
|
|
|
#ifdef DEBUG
|
2011-09-29 10:19:26 +04:00
|
|
|
void VerifyLines(bool aFinalCheckOK);
|
2004-06-01 10:20:16 +04:00
|
|
|
void VerifyOverflowSituation();
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetDepth() const;
|
1999-02-09 20:31:33 +03:00
|
|
|
#endif
|
|
|
|
|
2019-05-03 20:34:46 +03:00
|
|
|
nscoord mCachedMinISize = NS_INTRINSIC_ISIZE_UNKNOWN;
|
2019-05-03 20:34:55 +03:00
|
|
|
nscoord mCachedPrefISize = NS_INTRINSIC_ISIZE_UNKNOWN;
|
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
|
|
|
|
2001-10-25 05:08:40 +04:00
|
|
|
nsLineList mLines;
|
1999-02-09 20:31:33 +03:00
|
|
|
|
2003-10-14 01:51:02 +04:00
|
|
|
// List of all floats in this block
|
2012-03-08 05:57:37 +04:00
|
|
|
// XXXmats blocks rarely have floats, make it a frame property
|
2003-10-14 01:51:02 +04:00
|
|
|
nsFrameList mFloats;
|
1998-11-16 20:11:12 +03:00
|
|
|
|
2016-07-21 13:36:36 +03:00
|
|
|
friend class mozilla::BlockReflowInput;
|
2007-08-22 13:08:13 +04:00
|
|
|
friend class nsBlockInFlowLineIterator;
|
2000-05-09 09:11:12 +04:00
|
|
|
|
2001-05-01 08:22:57 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
public:
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool gLamePaintMetrics;
|
|
|
|
static bool gLameReflowMetrics;
|
|
|
|
static bool gNoisy;
|
|
|
|
static bool gNoisyDamageRepair;
|
|
|
|
static bool gNoisyIntrinsic;
|
|
|
|
static bool gNoisyReflow;
|
|
|
|
static bool gReallyNoisyReflow;
|
|
|
|
static bool gNoisyFloatManager;
|
|
|
|
static bool gVerifyLines;
|
|
|
|
static bool gDisableResizeOpt;
|
2001-05-01 08:22:57 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t gNoiseIndent;
|
2001-05-01 08:22:57 +04:00
|
|
|
|
2001-12-18 01:39:59 +03:00
|
|
|
static const char* kReflowCommandType[];
|
|
|
|
|
2001-05-01 08:22:57 +04:00
|
|
|
protected:
|
|
|
|
static void InitDebugFlags();
|
|
|
|
#endif
|
1998-11-16 20:11:12 +03:00
|
|
|
};
|
|
|
|
|
2005-03-23 06:35:08 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
class AutoNoisyIndenter {
|
|
|
|
public:
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit AutoNoisyIndenter(bool aDoIndent) : mIndented(aDoIndent) {
|
2005-03-23 06:35:08 +03:00
|
|
|
if (mIndented) {
|
|
|
|
nsBlockFrame::gNoiseIndent++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
~AutoNoisyIndenter() {
|
|
|
|
if (mIndented) {
|
|
|
|
nsBlockFrame::gNoiseIndent--;
|
|
|
|
}
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2005-03-23 06:35:08 +03:00
|
|
|
private:
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIndented;
|
2005-03-23 06:35:08 +03:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2007-08-22 13:08:13 +04:00
|
|
|
/**
|
|
|
|
* Iterates over all lines in the prev-in-flows/next-in-flows of this block.
|
|
|
|
*/
|
|
|
|
class nsBlockInFlowLineIterator {
|
|
|
|
public:
|
2016-10-22 14:41:04 +03:00
|
|
|
typedef nsBlockFrame::LineIterator LineIterator;
|
2012-03-08 05:57:37 +04:00
|
|
|
/**
|
|
|
|
* Set up the iterator to point to aLine which must be a normal line
|
|
|
|
* in aFrame (not an overflow line).
|
|
|
|
*/
|
2016-10-22 14:41:04 +03:00
|
|
|
nsBlockInFlowLineIterator(nsBlockFrame* aFrame, LineIterator aLine);
|
2008-02-27 12:53:48 +03:00
|
|
|
/**
|
|
|
|
* Set up the iterator to point to the first line found starting from
|
|
|
|
* aFrame. Sets aFoundValidLine to false if there is no such line.
|
2010-09-17 23:09:08 +04:00
|
|
|
* After aFoundValidLine has returned false, don't call any methods on this
|
|
|
|
* object again.
|
2008-02-27 12:53:48 +03:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
nsBlockInFlowLineIterator(nsBlockFrame* aFrame, bool* aFoundValidLine);
|
2008-02-27 12:53:48 +03:00
|
|
|
/**
|
|
|
|
* Set up the iterator to point to the line that contains aFindFrame (either
|
|
|
|
* directly or indirectly). If aFrame is out of flow, or contained in an
|
|
|
|
* out-of-flow, finds the line containing the out-of-flow's placeholder. If
|
2010-09-17 23:09:08 +04:00
|
|
|
* the frame is not found, sets aFoundValidLine to false. After
|
|
|
|
* aFoundValidLine has returned false, don't call any methods on this
|
|
|
|
* object again.
|
2008-02-27 12:53:48 +03:00
|
|
|
*/
|
|
|
|
nsBlockInFlowLineIterator(nsBlockFrame* aFrame, nsIFrame* aFindFrame,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool* aFoundValidLine);
|
2008-02-27 12:53:48 +03:00
|
|
|
|
2016-10-22 14:41:04 +03:00
|
|
|
LineIterator GetLine() { return mLine; }
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsLastLineInList();
|
2007-08-22 13:08:13 +04:00
|
|
|
nsBlockFrame* GetContainer() { return mFrame; }
|
2012-07-20 22:27:03 +04:00
|
|
|
bool GetInOverflow() { return mLineList != &mFrame->mLines; }
|
2008-04-12 09:32:49 +04:00
|
|
|
|
2008-10-12 23:26:06 +04:00
|
|
|
/**
|
|
|
|
* Returns the current line list we're iterating, null means
|
|
|
|
* we're iterating |mLines| of the container.
|
|
|
|
*/
|
2012-07-20 22:27:03 +04:00
|
|
|
nsLineList* GetLineList() { return mLineList; }
|
2008-04-12 09:32:49 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the end-iterator of whatever line list we're in.
|
|
|
|
*/
|
2016-10-22 14:41:04 +03:00
|
|
|
LineIterator End();
|
2008-04-12 09:32:49 +04:00
|
|
|
|
2007-08-22 13:08:13 +04:00
|
|
|
/**
|
|
|
|
* Returns false if there are no more lines. After this has returned false,
|
|
|
|
* don't call any methods on this object again.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Next();
|
2007-08-22 13:08:13 +04:00
|
|
|
/**
|
|
|
|
* Returns false if there are no more lines. After this has returned false,
|
|
|
|
* don't call any methods on this object again.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Prev();
|
2007-08-22 13:08:13 +04:00
|
|
|
|
|
|
|
private:
|
2012-03-08 05:57:37 +04:00
|
|
|
friend class nsBlockFrame;
|
2017-02-20 19:43:08 +03:00
|
|
|
friend class nsBidiPresUtils;
|
2012-03-08 05:57:37 +04:00
|
|
|
// XXX nsBlockFrame uses this internally in one place. Try to remove it.
|
2017-02-20 19:43:08 +03:00
|
|
|
// XXX uhm, and nsBidiPresUtils::Resolve too.
|
2016-10-22 14:41:04 +03:00
|
|
|
nsBlockInFlowLineIterator(nsBlockFrame* aFrame, LineIterator aLine,
|
|
|
|
bool aInOverflow);
|
2012-03-08 05:57:37 +04:00
|
|
|
|
2007-08-22 13:08:13 +04:00
|
|
|
nsBlockFrame* mFrame;
|
2016-10-22 14:41:04 +03:00
|
|
|
LineIterator mLine;
|
2016-10-22 14:41:03 +03:00
|
|
|
nsLineList* mLineList; // the line list mLine is in
|
2008-02-24 10:31:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Moves iterator to next valid line reachable from the current block.
|
|
|
|
* Returns false if there are no valid lines.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool FindValidLine();
|
2007-08-22 13:08:13 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsBlockFrame_h___ */
|