Bug 1630704 - Merge overridding nsFrame methods to nsIFrame r=emilio

This follows D73070. Remainings are Init(), DestroyFrom(), and several functions that are not used by nsIFrame methods, which will be also merged in separate patch(s).

Differential Revision: https://phabricator.services.mozilla.com/D74041
This commit is contained in:
Kagami Sascha Rosylight 2020-05-06 15:52:35 +00:00
Родитель e74128e730
Коммит 3507cfe914
3 изменённых файлов: 199 добавлений и 219 удалений

Просмотреть файл

@ -585,7 +585,7 @@ static bool IsFontSizeInflationContainer(nsIFrame* aFrame,
return !isInline;
}
static void MaybeScheduleReflowSVGNonDisplayText(nsFrame* aFrame) {
static void MaybeScheduleReflowSVGNonDisplayText(nsIFrame* aFrame) {
if (!nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
return;
}
@ -957,7 +957,7 @@ static void CompareLayers(
}
static void AddAndRemoveImageAssociations(
ImageLoader& aImageLoader, nsFrame* aFrame,
ImageLoader& aImageLoader, nsIFrame* aFrame,
const nsStyleImageLayers* aOldLayers,
const nsStyleImageLayers* aNewLayers) {
// If the old context had a background-image image, or mask-image image,
@ -1181,7 +1181,7 @@ void nsIFrame::MarkNeedsDisplayItemRebuild() {
// Subclass hook for style post processing
/* virtual */
void nsFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
void nsIFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
MaybeScheduleReflowSVGNonDisplayText(this);
Document* doc = PresContext()->Document();
@ -2308,7 +2308,7 @@ static nsIFrame* GetActiveSelectionFrame(nsPresContext* aPresContext,
return aFrame;
}
int16_t nsFrame::DetermineDisplaySelection() {
int16_t nsIFrame::DetermineDisplaySelection() {
int16_t selType = nsISelectionController::SELECTION_OFF;
nsCOMPtr<nsISelectionController> selCon;
@ -4505,9 +4505,9 @@ void nsFrame::FireDOMEvent(const nsAString& aDOMEventName,
}
}
nsresult nsFrame::HandleEvent(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) {
nsresult nsIFrame::HandleEvent(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) {
if (aEvent->mMessage == eMouseMove) {
// XXX If the second argument of HandleDrag() is WidgetMouseEvent,
// the implementation becomes simpler.
@ -4526,7 +4526,7 @@ nsresult nsFrame::HandleEvent(nsPresContext* aPresContext,
return NS_OK;
}
nsresult nsFrame::GetDataForTableSelection(
nsresult nsIFrame::GetDataForTableSelection(
const nsFrameSelection* aFrameSelection, mozilla::PresShell* aPresShell,
WidgetMouseEvent* aMouseEvent, nsIContent** aParentContent,
int32_t* aContentOffset, TableSelectionMode* aTarget) {
@ -4704,8 +4704,8 @@ bool nsIFrame::ShouldHaveLineIfEmpty() const {
* Handles the Mouse Press Event for the frame
*/
NS_IMETHODIMP
nsFrame::HandlePress(nsPresContext* aPresContext, WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) {
nsIFrame::HandlePress(nsPresContext* aPresContext, WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) {
NS_ENSURE_ARG_POINTER(aEventStatus);
if (nsEventStatus_eConsumeNoDefault == *aEventStatus) {
return NS_OK;
@ -4919,11 +4919,11 @@ nsFrame::HandlePress(nsPresContext* aPresContext, WidgetGUIEvent* aEvent,
* @param aSelectFlags Selection flags defined in nsFame.h.
* @return success or failure at finding suitable content to select.
*/
nsresult nsFrame::SelectByTypeAtPoint(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsSelectionAmount aBeginAmountType,
nsSelectionAmount aEndAmountType,
uint32_t aSelectFlags) {
nsresult nsIFrame::SelectByTypeAtPoint(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsSelectionAmount aBeginAmountType,
nsSelectionAmount aEndAmountType,
uint32_t aSelectFlags) {
NS_ENSURE_ARG_POINTER(aPresContext);
// No point in selecting if selection is turned off
@ -4950,9 +4950,9 @@ nsresult nsFrame::SelectByTypeAtPoint(nsPresContext* aPresContext,
* Wouldn't it be nice if this didn't have to be hardwired into Frame code?
*/
NS_IMETHODIMP
nsFrame::HandleMultiplePress(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus, bool aControlHeld) {
nsIFrame::HandleMultiplePress(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus, bool aControlHeld) {
NS_ENSURE_ARG_POINTER(aEvent);
NS_ENSURE_ARG_POINTER(aEventStatus);
@ -5051,9 +5051,9 @@ nsresult nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack,
return frameSelection->MaintainSelection(aAmountBack);
}
NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) {
NS_IMETHODIMP nsIFrame::HandleDrag(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) {
MOZ_ASSERT(aEvent->mClass == eMouseEventClass,
"HandleDrag can only handle mouse event");
@ -5192,9 +5192,9 @@ static nsresult HandleFrameSelection(nsFrameSelection* aFrameSelection,
return NS_OK;
}
NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) {
NS_IMETHODIMP nsIFrame::HandleRelease(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) {
if (aEvent->mClass != eMouseEventClass) {
return NS_OK;
}
@ -5766,7 +5766,7 @@ Maybe<nsIFrame::Cursor> nsIFrame::GetCursor(const nsPoint&) {
// Resize and incremental reflow
/* virtual */
void nsFrame::MarkIntrinsicISizesDirty() {
void nsIFrame::MarkIntrinsicISizesDirty() {
// This version is meant only for what used to be box-to-block adaptors.
// It should not be called by other derived classes.
if (::IsXULBoxWrapped(this)) {
@ -6092,13 +6092,13 @@ IntrinsicSize nsIFrame::GetIntrinsicSize() {
AspectRatio nsIFrame::GetIntrinsicRatio() { return AspectRatio(); }
/* virtual */
LogicalSize nsFrame::ComputeSize(gfxContext* aRenderingContext, WritingMode aWM,
const LogicalSize& aCBSize,
nscoord aAvailableISize,
const LogicalSize& aMargin,
const LogicalSize& aBorder,
const LogicalSize& aPadding,
ComputeSizeFlags aFlags) {
LogicalSize nsIFrame::ComputeSize(gfxContext* aRenderingContext,
WritingMode aWM, const LogicalSize& aCBSize,
nscoord aAvailableISize,
const LogicalSize& aMargin,
const LogicalSize& aBorder,
const LogicalSize& aPadding,
ComputeSizeFlags aFlags) {
MOZ_ASSERT(!GetIntrinsicRatio(),
"Please override this method and call "
"nsFrame::ComputeSizeWithIntrinsicDimensions instead.");
@ -6788,7 +6788,7 @@ nsresult nsIFrame::GetPrefWidthTightBounds(gfxContext* aContext, nscoord* aX,
}
/* virtual */
LogicalSize nsFrame::ComputeAutoSize(
LogicalSize nsIFrame::ComputeAutoSize(
gfxContext* aRenderingContext, WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
@ -6805,8 +6805,9 @@ LogicalSize nsFrame::ComputeAutoSize(
return result;
}
nscoord nsFrame::ShrinkWidthToFit(gfxContext* aRenderingContext,
nscoord aISizeInCB, ComputeSizeFlags aFlags) {
nscoord nsIFrame::ShrinkWidthToFit(gfxContext* aRenderingContext,
nscoord aISizeInCB,
ComputeSizeFlags aFlags) {
// If we're a container for font size inflation, then shrink
// wrapping inside of us should not apply font size inflation.
AutoMaybeDisableFontInflation an(this);
@ -6983,8 +6984,9 @@ bool nsIFrame::CanContinueTextRun() const {
return false;
}
void nsFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput, nsReflowStatus& aStatus) {
void nsIFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsFrame");
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
@ -9224,7 +9226,7 @@ nsIFrame::FrameSearchResult nsIFrame::PeekOffsetCharacter(
return CONTINUE;
}
nsIFrame::FrameSearchResult nsFrame::PeekOffsetWord(
nsIFrame::FrameSearchResult nsIFrame::PeekOffsetWord(
bool aForward, bool aWordSelectEatSpace, bool aIsKeyboardSelect,
int32_t* aOffset, PeekWordState* aState, bool /*aTrimSpaces*/) {
NS_ASSERTION(aOffset && *aOffset <= 1, "aOffset out of range");
@ -9259,10 +9261,10 @@ nsIFrame::FrameSearchResult nsFrame::PeekOffsetWord(
}
// static
bool nsFrame::BreakWordBetweenPunctuation(const PeekWordState* aState,
bool aForward, bool aPunctAfter,
bool aWhitespaceAfter,
bool aIsKeyboardSelect) {
bool nsIFrame::BreakWordBetweenPunctuation(const PeekWordState* aState,
bool aForward, bool aPunctAfter,
bool aWhitespaceAfter,
bool aIsKeyboardSelect) {
NS_ASSERTION(aPunctAfter != aState->mLastCharWasPunctuation,
"Call this only at punctuation boundaries");
if (aState->mLastCharWasWhitespace) {
@ -10298,7 +10300,7 @@ nsIFrame* nsFrame::CorrectStyleParentFrame(nsIFrame* aProspectiveParent,
return nullptr;
}
ComputedStyle* nsFrame::DoGetParentComputedStyle(
ComputedStyle* nsIFrame::DoGetParentComputedStyle(
nsIFrame** aProviderFrame) const {
*aProviderFrame = nullptr;
@ -10592,9 +10594,6 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState) {
return NS_OK;
}
/* virtual */
nsILineIterator* nsFrame::GetLineIterator() { return nullptr; }
nsSize nsFrame::GetXULPrefSize(nsBoxLayoutState& aState) {
nsSize size(0, 0);
DISPLAY_PREF_SIZE(this, size);
@ -11021,7 +11020,7 @@ void nsFrame::BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
#endif
}
nsBoxLayoutMetrics* nsFrame::BoxMetrics() const {
nsBoxLayoutMetrics* nsIFrame::BoxMetrics() const {
nsBoxLayoutMetrics* metrics = GetProperty(BoxMetricsProperty());
NS_ASSERTION(
metrics,

Просмотреть файл

@ -156,62 +156,12 @@ class nsFrame : public nsIFrame {
void DestroyFrom(nsIFrame* aDestructRoot,
PostDestroyData& aPostDestroyData) override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
static nsresult GetNextPrevLineFromeBlockFrame(nsPresContext* aPresContext,
nsPeekOffsetStruct* aPos,
nsIFrame* aBlockFrame,
int32_t aLineStart,
int8_t aOutSideLimit);
FrameSearchResult PeekOffsetWord(bool aForward, bool aWordSelectEatSpace,
bool aIsKeyboardSelect, int32_t* aOffset,
PeekWordState* aState,
bool aTrimSpaces) override;
/**
* Check whether we should break at a boundary between punctuation and
* non-punctuation. Only call it at a punctuation boundary
* (i.e. exactly one of the previous and next characters are punctuation).
* @param aForward true if we're moving forward in content order
* @param aPunctAfter true if the next character is punctuation
* @param aWhitespaceAfter true if the next character is whitespace
*/
static bool BreakWordBetweenPunctuation(const PeekWordState* aState,
bool aForward, bool aPunctAfter,
bool aWhitespaceAfter,
bool aIsKeyboardSelect);
ComputedStyle* GetParentComputedStyle(
nsIFrame** aProviderFrame) const override {
return DoGetParentComputedStyle(aProviderFrame);
}
/**
* Do the work for getting the parent ComputedStyle frame so that
* other frame's |GetParentComputedStyle| methods can call this
* method on *another* frame. (This function handles out-of-flow
* frames by using the frame manager's placeholder map and it also
* handles block-within-inline and generated content wrappers.)
*
* @param aProviderFrame (out) the frame associated with the returned value
* or null if the ComputedStyle is for display:contents content.
* @return The ComputedStyle that should be the parent of this frame's
* ComputedStyle. Null is permitted, and means that this frame's
* ComputedStyle should be the root of the ComputedStyle tree.
*/
ComputedStyle* DoGetParentComputedStyle(nsIFrame** aProviderFrame) const;
void MarkIntrinsicISizesDirty() override;
mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;
/**
* Calculate the used values for 'width' and 'height' for a replaced element.
* http://www.w3.org/TR/CSS21/visudet.html#min-max-widths
@ -228,59 +178,6 @@ class nsFrame : public nsIFrame {
// and outline, its children's tight bounds, and nothing else.
nsRect ComputeSimpleTightBounds(mozilla::gfx::DrawTarget* aDrawTarget) const;
/**
* A helper, used by |nsFrame::ComputeSize| (for frames that need to
* override only this part of ComputeSize), that computes the size
* that should be returned when 'width', 'height', and
* min/max-width/height are all 'auto' or equivalent.
*
* In general, frames that can accept any computed width/height should
* override only ComputeAutoSize, and frames that cannot do so need to
* override ComputeSize to enforce their width/height invariants.
*
* Implementations may optimize by returning a garbage width if
* StylePosition()->mWidth.GetUnit() != eStyleUnit_Auto, and
* likewise for height, since in such cases the result is guaranteed
* to be unused.
*/
virtual mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags);
/**
* Utility function for ComputeAutoSize implementations. Return
* max(GetMinISize(), min(aISizeInCB, GetPrefISize()))
*/
nscoord ShrinkWidthToFit(gfxContext* aRenderingContext, nscoord aISizeInCB,
ComputeSizeFlags aFlags);
/**
* Calculates the size of this frame after reflowing (calling Reflow on, and
* updating the size and position of) its children, as necessary. The
* calculated size is returned to the caller via the ReflowOutput
* outparam. (The caller is responsible for setting the actual size and
* position of this frame.)
*
* A frame's children must _all_ be reflowed if the frame is dirty (the
* NS_FRAME_IS_DIRTY bit is set on it). Otherwise, individual children
* must be reflowed if they are dirty or have the NS_FRAME_HAS_DIRTY_CHILDREN
* bit set on them. Otherwise, whether children need to be reflowed depends
* on the frame's type (it's up to individual Reflow methods), and on what
* has changed. For example, a change in the width of the frame may require
* all of its children to be reflowed (even those without dirty bits set on
* them), whereas a change in its height might not.
* (ReflowInput::ShouldReflowAllKids may be helpful in deciding whether
* to reflow all the children, but for some frame types it might result in
* over-reflow.)
*
* Note: if it's only the overflow rect(s) of a frame that need to be
* updated, then UpdateOverflow should be called instead of Reflow.
*/
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
void DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowInput) override;
@ -313,39 +210,11 @@ class nsFrame : public nsIFrame {
*/
void PushDirtyBitToAbsoluteFrames();
// Selection Methods
NS_IMETHOD HandlePress(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus);
NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus,
bool aControlHeld);
MOZ_CAN_RUN_SCRIPT
NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus);
NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus);
enum { SELECT_ACCUMULATE = 0x01 };
nsresult PeekBackwardAndForward(nsSelectionAmount aAmountBack,
nsSelectionAmount aAmountForward,
int32_t aStartPos, bool aJumpLines,
uint32_t aSelectFlags);
nsresult SelectByTypeAtPoint(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsSelectionAmount aBeginAmountType,
nsSelectionAmount aEndAmountType,
uint32_t aSelectFlags);
// Helper for GetContentAndOffsetsFromPoint; calculation of content offsets
// in this function assumes there is no child frame that can be targeted.
virtual ContentOffsets CalcContentOffsetsFromFramePoint(
@ -358,10 +227,6 @@ class nsFrame : public nsIFrame {
nscoord GetXULFlex() override;
nscoord GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState) override;
// We compute and store the HTML content's overflow area. So don't
// try to compute it in the box code.
bool XULComputesOwnOverflowArea() override { return true; }
//--------------------------------------------------
// Additional methods
@ -509,14 +374,6 @@ class nsFrame : public nsIFrame {
nsDisplayListBuilder* aBuilder, nsDisplayList* aList,
uint16_t aContentType = nsISelectionDisplay::DISPLAY_FRAMES);
/**
* @return see nsISelectionController.idl's `getDisplaySelection`.
*/
int16_t DetermineDisplaySelection();
// Style post processing hook
void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
public:
/**
* Helper method to create a view for a frame. Only used by a few sub-classes
@ -592,28 +449,9 @@ class nsFrame : public nsIFrame {
aFrame->PresContext()->IsPaginated() && aFrame->IsBlockFrame();
}
nsILineIterator* GetLineIterator() override;
protected:
// Test if we are selecting a table object:
// Most table/cell selection requires that Ctrl (Cmd on Mac) key is down
// during a mouse click or drag. Exception is using Shift+click when
// already in "table/cell selection mode" to extend a block selection
// Get the parent content node and offset of the frame
// of the enclosing cell or table (if not inside a cell)
// aTarget tells us what table element to select (currently only cell and
// table supported) (enums for this are defined in nsIFrame.h)
nsresult GetDataForTableSelection(const nsFrameSelection* aFrameSelection,
mozilla::PresShell* aPresShell,
mozilla::WidgetMouseEvent* aMouseEvent,
nsIContent** aParentContent,
int32_t* aContentOffset,
mozilla::TableSelectionMode* aTarget);
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override;
nsBoxLayoutMetrics* BoxMetrics() const;
// Fire DOM event. If no aContent argument use frame's mContent.
void FireDOMEvent(const nsAString& aDOMEventName,
nsIContent* aContent = nullptr);

Просмотреть файл

@ -122,6 +122,7 @@ class nsPlaceholderFrame;
class nsStyleChangeList;
class nsWindowSizes;
struct nsBoxLayoutMetrics;
struct nsPeekOffsetStruct;
struct nsPoint;
struct nsRect;
@ -132,6 +133,7 @@ struct CharacterDataChangeInfo;
namespace mozilla {
enum class PseudoStyleType : uint8_t;
enum class TableSelectionMode : uint32_t;
class EventStates;
class PresShell;
struct ReflowInput;
@ -792,12 +794,14 @@ class nsIFrame : public nsQueryFrame {
}
}
protected:
// Style post processing hook
// Attention: the old style is the one we're forgetting,
// and hence possibly completely bogus for GetStyle* purposes.
// Use PeekStyleData instead.
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) = 0;
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle);
public:
/**
* Define typesafe getter functions for each style struct by
* preprocessing the list of style structs. These functions are the
@ -1985,10 +1989,61 @@ class nsIFrame : public nsQueryFrame {
* @see WidgetGUIEvent
* @see nsEventStatus
*/
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) = 0;
nsEventStatus* aEventStatus);
nsresult SelectByTypeAtPoint(nsPresContext* aPresContext,
const nsPoint& aPoint,
nsSelectionAmount aBeginAmountType,
nsSelectionAmount aEndAmountType,
uint32_t aSelectFlags);
enum { SELECT_ACCUMULATE = 0x01 };
protected:
// Selection Methods
NS_IMETHOD HandlePress(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus);
NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus,
bool aControlHeld);
MOZ_CAN_RUN_SCRIPT
NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus);
NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus);
// Test if we are selecting a table object:
// Most table/cell selection requires that Ctrl (Cmd on Mac) key is down
// during a mouse click or drag. Exception is using Shift+click when
// already in "table/cell selection mode" to extend a block selection
// Get the parent content node and offset of the frame
// of the enclosing cell or table (if not inside a cell)
// aTarget tells us what table element to select (currently only cell and
// table supported) (enums for this are defined in nsIFrame.h)
nsresult GetDataForTableSelection(const nsFrameSelection* aFrameSelection,
mozilla::PresShell* aPresShell,
mozilla::WidgetMouseEvent* aMouseEvent,
nsIContent** aParentContent,
int32_t* aContentOffset,
mozilla::TableSelectionMode* aTarget);
/**
* @return see nsISelectionController.idl's `getDisplaySelection`.
*/
int16_t DetermineDisplaySelection();
public:
virtual nsresult GetContentForEvent(mozilla::WidgetEvent* aEvent,
nsIContent** aContent);
@ -2230,8 +2285,12 @@ class nsIFrame : public nsQueryFrame {
* re-calculation). Note that this should generally not be called
* directly; PresShell::FrameNeedsReflow() will call it instead.
*/
virtual void MarkIntrinsicISizesDirty() = 0;
virtual void MarkIntrinsicISizesDirty();
private:
nsBoxLayoutMetrics* BoxMetrics() const;
public:
/**
* Make this frame and all descendants dirty (if not already).
* Exceptions: XULBoxFrame and TableColGroupFrame children.
@ -2546,8 +2605,38 @@ class nsIFrame : public nsQueryFrame {
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) = 0;
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags);
protected:
/**
* A helper, used by |nsFrame::ComputeSize| (for frames that need to
* override only this part of ComputeSize), that computes the size
* that should be returned when 'width', 'height', and
* min/max-width/height are all 'auto' or equivalent.
*
* In general, frames that can accept any computed width/height should
* override only ComputeAutoSize, and frames that cannot do so need to
* override ComputeSize to enforce their width/height invariants.
*
* Implementations may optimize by returning a garbage width if
* StylePosition()->mWidth.GetUnit() != eStyleUnit_Auto, and
* likewise for height, since in such cases the result is guaranteed
* to be unused.
*/
virtual mozilla::LogicalSize ComputeAutoSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags);
/**
* Utility function for ComputeAutoSize implementations. Return
* max(GetMinISize(), min(aISizeInCB, GetPrefISize()))
*/
nscoord ShrinkWidthToFit(gfxContext* aRenderingContext, nscoord aISizeInCB,
ComputeSizeFlags aFlags);
public:
/**
* Compute a tight bounding rectangle for the frame. This is a rectangle
* that encloses the pixels that are actually drawn. We're allowed to be
@ -2598,6 +2687,27 @@ class nsIFrame : public nsQueryFrame {
* If a difference in available size from the previous reflow causes
* the frame's size to change, it should reflow descendants as needed.
*
* Calculates the size of this frame after reflowing (calling Reflow on, and
* updating the size and position of) its children, as necessary. The
* calculated size is returned to the caller via the ReflowOutput
* outparam. (The caller is responsible for setting the actual size and
* position of this frame.)
*
* A frame's children must _all_ be reflowed if the frame is dirty (the
* NS_FRAME_IS_DIRTY bit is set on it). Otherwise, individual children
* must be reflowed if they are dirty or have the NS_FRAME_HAS_DIRTY_CHILDREN
* bit set on them. Otherwise, whether children need to be reflowed depends
* on the frame's type (it's up to individual Reflow methods), and on what
* has changed. For example, a change in the width of the frame may require
* all of its children to be reflowed (even those without dirty bits set on
* them), whereas a change in its height might not.
* (ReflowInput::ShouldReflowAllKids may be helpful in deciding whether
* to reflow all the children, but for some frame types it might result in
* over-reflow.)
*
* Note: if it's only the overflow rect(s) of a frame that need to be
* updated, then UpdateOverflow should be called instead of Reflow.
*
* @param aReflowOutput <i>out</i> parameter where you should return the
* desired size and ascent/descent info. You should include any
* space you want for border/padding in the desired size you return.
@ -2626,8 +2736,7 @@ class nsIFrame : public nsQueryFrame {
* and whether the next-in-flow is dirty and needs to be reflowed
*/
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aReflowOutput,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) = 0;
const ReflowInput& aReflowInput, nsReflowStatus& aStatus);
// Option flags for ReflowChild(), FinishReflowChild(), and
// SyncFrameViewAfterReflow().
@ -3550,7 +3659,24 @@ class nsIFrame : public nsQueryFrame {
* the style tree.
*/
virtual ComputedStyle* GetParentComputedStyle(
nsIFrame** aProviderFrame) const = 0;
nsIFrame** aProviderFrame) const {
return DoGetParentComputedStyle(aProviderFrame);
}
/**
* Do the work for getting the parent ComputedStyle frame so that
* other frame's |GetParentComputedStyle| methods can call this
* method on *another* frame. (This function handles out-of-flow
* frames by using the frame manager's placeholder map and it also
* handles block-within-inline and generated content wrappers.)
*
* @param aProviderFrame (out) the frame associated with the returned value
* or null if the ComputedStyle is for display:contents content.
* @return The ComputedStyle that should be the parent of this frame's
* ComputedStyle. Null is permitted, and means that this frame's
* ComputedStyle should be the root of the ComputedStyle tree.
*/
ComputedStyle* DoGetParentComputedStyle(nsIFrame** aProviderFrame) const;
/**
* Called by RestyleManager to update the style of anonymous boxes
@ -3914,7 +4040,10 @@ class nsIFrame : public nsQueryFrame {
* scrollbox.
*/
virtual bool DoesClipChildren();
virtual bool XULComputesOwnOverflowArea() = 0;
// We compute and store the HTML content's overflow area. So don't
// try to compute it in the box code.
virtual bool XULComputesOwnOverflowArea() { return true; }
nsresult SyncXULLayout(nsBoxLayoutState& aBoxLayoutState);
@ -3964,7 +4093,7 @@ class nsIFrame : public nsQueryFrame {
* @return nullptr if no line iterator is supported.
* @note dispose the line iterator using nsILineIterator::DisposeLineIterator
*/
virtual nsILineIterator* GetLineIterator() = 0;
virtual nsILineIterator* GetLineIterator() { return nullptr; }
/**
* If this frame is a next-in-flow, and its prev-in-flow has something on its
@ -4720,7 +4849,21 @@ class nsIFrame : public nsQueryFrame {
*/
virtual FrameSearchResult PeekOffsetWord(
bool aForward, bool aWordSelectEatSpace, bool aIsKeyboardSelect,
int32_t* aOffset, PeekWordState* aState, bool aTrimSpaces) = 0;
int32_t* aOffset, PeekWordState* aState, bool aTrimSpaces);
protected:
/**
* Check whether we should break at a boundary between punctuation and
* non-punctuation. Only call it at a punctuation boundary
* (i.e. exactly one of the previous and next characters are punctuation).
* @param aForward true if we're moving forward in content order
* @param aPunctAfter true if the next character is punctuation
* @param aWhitespaceAfter true if the next character is whitespace
*/
static bool BreakWordBetweenPunctuation(const PeekWordState* aState,
bool aForward, bool aPunctAfter,
bool aWhitespaceAfter,
bool aIsKeyboardSelect);
/**
* Search for the first paragraph boundary before or after the given position