From a9c935c3554c3f3f85e6befa94cc5100606cb7fd Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Wed, 5 Dec 2018 18:44:03 +0000 Subject: [PATCH] Bug 1511854 - Part 1: Fix some formatting oddities in layout/ after the clang-format. r=TYLin Differential Revision: https://phabricator.services.mozilla.com/D13686 --HG-- extra : moz-landing-system : lando --- layout/base/MobileViewportManager.h | 4 +- layout/base/ZoomConstraintsClient.h | 4 +- layout/base/nsBidiPresUtils.h | 4 +- layout/base/nsCSSFrameConstructor.h | 4 +- layout/base/nsFrameTraversal.h | 1 + layout/base/nsIDocumentViewerPrint.h | 1 + layout/base/nsIPresShell.h | 77 +++--- layout/base/nsLayoutUtils.h | 83 +++--- layout/base/nsPresContext.h | 9 +- layout/generic/ReflowInput.h | 115 ++++---- layout/generic/WritingModes.h | 83 +++--- layout/generic/nsBlockFrame.h | 23 +- layout/generic/nsFrameSelection.h | 358 +++++++++++++++---------- layout/generic/nsFrameSetFrame.h | 4 +- layout/generic/nsIFrame.h | 179 +++++++------ layout/mathml/nsIMathMLFrame.h | 12 +- layout/mathml/nsMathMLContainerFrame.h | 3 +- layout/printing/nsPrintData.h | 4 +- layout/style/StyleSheet.h | 6 +- layout/style/URLExtraData.h | 3 +- layout/style/nsCSSAnonBoxes.h | 7 +- layout/style/nsCSSProps.h | 17 +- layout/style/nsCSSValue.h | 75 +++--- layout/style/nsStyleConsts.h | 3 +- layout/style/nsStyleCoord.h | 4 +- layout/style/nsStyleStruct.h | 75 +++--- layout/svg/nsSVGDisplayableFrame.h | 19 +- layout/svg/nsSVGOuterSVGFrame.h | 2 +- layout/tables/celldata.h | 8 +- layout/tables/nsTableColFrame.h | 8 +- layout/tables/nsTableColGroupFrame.h | 4 +- layout/tables/nsTableFrame.h | 36 ++- layout/tables/nsTableRowFrame.h | 6 +- layout/tables/nsTableRowGroupFrame.h | 16 +- layout/xul/BoxObject.h | 3 +- layout/xul/nsMenuBarFrame.h | 3 +- layout/xul/nsMenuPopupFrame.h | 3 +- layout/xul/nsXULPopupManager.h | 4 +- layout/xul/tree/nsTreeBodyFrame.h | 2 +- 39 files changed, 712 insertions(+), 560 deletions(-) diff --git a/layout/base/MobileViewportManager.h b/layout/base/MobileViewportManager.h index 32bd668fa390..b7a32e197277 100644 --- a/layout/base/MobileViewportManager.h +++ b/layout/base/MobileViewportManager.h @@ -136,8 +136,8 @@ class MobileViewportManager final : public nsIDOMEventListener, const mozilla::ScreenIntSize& aDisplaySize); nsCOMPtr mDocument; - nsIPresShell* MOZ_NON_OWNING_REF - mPresShell; // raw ref since the presShell owns this + // raw ref since the presShell owns this + nsIPresShell* MOZ_NON_OWNING_REF mPresShell; nsCOMPtr mEventTarget; bool mIsFirstPaint; bool mPainted; diff --git a/layout/base/ZoomConstraintsClient.h b/layout/base/ZoomConstraintsClient.h index e77ad2d58518..4ef68872527a 100644 --- a/layout/base/ZoomConstraintsClient.h +++ b/layout/base/ZoomConstraintsClient.h @@ -43,8 +43,8 @@ class ZoomConstraintsClient final : public nsIDOMEventListener, void RefreshZoomConstraints(); nsCOMPtr mDocument; - nsIPresShell* MOZ_NON_OWNING_REF - mPresShell; // raw ref since the presShell owns this + // raw ref since the presShell owns this + nsIPresShell* MOZ_NON_OWNING_REF mPresShell; nsCOMPtr mEventTarget; mozilla::Maybe mGuid; }; diff --git a/layout/base/nsBidiPresUtils.h b/layout/base/nsBidiPresUtils.h index 846fd5b84df7..e9cf09fd6669 100644 --- a/layout/base/nsBidiPresUtils.h +++ b/layout/base/nsBidiPresUtils.h @@ -427,7 +427,7 @@ class nsBidiPresUtils { * direction, it's the distance to the end, * otherwise, it's the distance to the start. * @param aContinuationStates A map from nsIFrame* to - * nsFrameContinuationState + * nsFrameContinuationState * @return The isize aFrame takes, including margins. */ static nscoord RepositionFrame( @@ -443,7 +443,7 @@ class nsBidiPresUtils { * @param aFrame The frame which itself and its descendants will * be initialized * @param aContinuationStates A map from nsIFrame* to - * nsFrameContinuationState + * nsFrameContinuationState */ static void InitContinuationStates(nsIFrame* aFrame, nsContinuationStates* aContinuationStates); diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index 71f1583c3f1e..0be70e97070e 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -1206,8 +1206,7 @@ class nsCSSFrameConstructor final : public nsFrameManager { void operator delete(void*) = delete; #endif void operator delete[](void*) = delete; - FrameConstructionItem(const FrameConstructionItem& aOther) = - delete; /* not implemented */ + FrameConstructionItem(const FrameConstructionItem& aOther) = delete; // Not allocated from the stack! ~FrameConstructionItem() { MOZ_COUNT_DTOR(FrameConstructionItem); @@ -1982,7 +1981,6 @@ class nsCSSFrameConstructor final : public nsFrameManager { void RecoverLetterFrames(nsContainerFrame* aBlockFrame); - // void RemoveLetterFrames(nsIPresShell* aPresShell, nsContainerFrame* aBlockFrame); diff --git a/layout/base/nsFrameTraversal.h b/layout/base/nsFrameTraversal.h index 8bbc312a2007..7223fef605df 100644 --- a/layout/base/nsFrameTraversal.h +++ b/layout/base/nsFrameTraversal.h @@ -3,6 +3,7 @@ /* 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/. */ + #ifndef NSFRAMETRAVERSAL_H #define NSFRAMETRAVERSAL_H diff --git a/layout/base/nsIDocumentViewerPrint.h b/layout/base/nsIDocumentViewerPrint.h index dd3ad4a37f80..e15368d027d2 100644 --- a/layout/base/nsIDocumentViewerPrint.h +++ b/layout/base/nsIDocumentViewerPrint.h @@ -3,6 +3,7 @@ /* 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/. */ + #ifndef nsIDocumentViewerPrint_h___ #define nsIDocumentViewerPrint_h___ diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 02695a1a6819..054616ff6b1b 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -698,38 +698,37 @@ class nsIPresShell : public nsStubDocumentObserver { WhenToScroll mWhenToScroll : 8; bool mOnlyIfPerceivedScrollableDirection : 1; /** - * @param aWhere: Either a percentage or a special value. - * nsIPresShell defines: - * * (Default) SCROLL_MINIMUM = -1: The visible area is - * scrolled the minimum amount to show as much as possible of the frame. - * This won't hide any initially visible part of the frame. - * * SCROLL_TOP = 0: The frame's upper edge is aligned with - * the top edge of the visible area. - * * SCROLL_BOTTOM = 100: The frame's bottom edge is aligned - * with the bottom edge of the visible area. - * * SCROLL_LEFT = 0: The frame's left edge is aligned with - * the left edge of the visible area. - * * SCROLL_RIGHT = 100: The frame's right edge is aligned - * with the right edge of the visible area. - * * SCROLL_CENTER = 50: The frame is centered along the axis - * the ScrollAxis is used for. + * aWhere: + * Either a percentage or a special value. nsIPresShell defines: + * * (Default) SCROLL_MINIMUM = -1: The visible area is scrolled the + * minimum amount to show as much as possible of the frame. This won't + * hide any initially visible part of the frame. + * * SCROLL_TOP = 0: The frame's upper edge is aligned with the top edge + * of the visible area. + * * SCROLL_BOTTOM = 100: The frame's bottom edge is aligned with the + * bottom edge of the visible area. + * * SCROLL_LEFT = 0: The frame's left edge is aligned with the left edge + * of the visible area. + * * SCROLL_RIGHT = 100: The frame's right edge is aligned* with the right + * edge of the visible area. + * * SCROLL_CENTER = 50: The frame is centered along the axis the + * ScrollAxis is used for. * - * Other values are treated as a percentage, and the point - * "percent" down the frame is placed at the point "percent" - * down the visible area. - * @param aWhen: - * * (Default) SCROLL_IF_NOT_FULLY_VISIBLE: Move the frame - * only if it is not fully visible (including if it's not visible at all). - * Note that in this case if the frame is too large to fit in view, it will - * only be scrolled if more of it can fit than is already in view. - * * SCROLL_IF_NOT_VISIBLE: Move the frame only if none of it - * is visible. - * * SCROLL_ALWAYS: Move the frame regardless of its current - * visibility. - * @param aOnlyIfPerceivedScrollableDirection: - * If the direction is not a perceived scrollable direction - * (i.e. no scrollbar showing and less than one device pixel of scrollable - * distance), don't scroll. Defaults to false. + * Other values are treated as a percentage, and the point*"percent" + * down the frame is placed at the point "percent" down the visible area. + * + * aWhen: + * * (Default) SCROLL_IF_NOT_FULLY_VISIBLE: Move the frame only if it is + * not fully visible (including if it's not visible at all). Note that + * in this case if the frame is too large to fit in view, it will only + * be scrolled if more of it can fit than is already in view. + * * SCROLL_IF_NOT_VISIBLE: Move the frame only if none of it is visible. + * * SCROLL_ALWAYS: Move the frame regardless of its current visibility. + * + * aOnlyIfPerceivedScrollableDirection: + * If the direction is not a perceived scrollable direction (i.e. no + * scrollbar showing and less than one device pixel of scrollable + * distance), don't scroll. Defaults to false. */ explicit ScrollAxis(int16_t aWhere = SCROLL_MINIMUM, WhenToScroll aWhen = SCROLL_IF_NOT_FULLY_VISIBLE, @@ -1214,15 +1213,19 @@ class nsIPresShell : public nsStubDocumentObserver { * canvas frame (if the FORCE_DRAW flag is passed then this check is skipped). * aBackstopColor is composed behind the background color of the canvas, it is * transparent by default. + * * We attempt to make the background color part of the scrolled canvas (to * reduce transparent layers), and if async scrolling is enabled (and the * background is opaque) then we add a second, unscrolled item to handle the - * checkerboarding case. ADD_FOR_SUBDOC shoud be specified when calling this - * for a subdocument, and LayoutUseContainersForRootFrame might cause the - * whole list to be scrolled. In that case the second unscrolled item will be - * elided. APPEND_UNSCROLLED_ONLY only attempts to add the unscrolled item, so - * that we can add it manually after LayoutUseContainersForRootFrame has built - * the scrolling ContainerLayer. + * checkerboarding case. + * + * ADD_FOR_SUBDOC should be specified when calling this for a subdocument, and + * LayoutUseContainersForRootFrame might cause the whole list to be scrolled. + * In that case the second unscrolled item will be elided. + * + * APPEND_UNSCROLLED_ONLY only attempts to add the unscrolled item, so that + * we can add it manually after LayoutUseContainersForRootFrame has built the + * scrolling ContainerLayer. */ enum { FORCE_DRAW = 0x01, diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 1ad97ab98a40..d323f71695ac 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -853,13 +853,17 @@ class nsLayoutUtils { * * |aMatrixCache| allows for optimizations in recomputing the same matrix over * and over. The argument can be one of the following values: + * * nullptr (the default) - No optimization; the transform matrix is computed - * on every call to this function. non-null pointer to an empty - * Maybe - Upon return, the Maybe is filled with the transform - * matrix that was computed. This can then be passed in to subsequent calls - * with the same source and destination frames to avoid recomputing the - * matrix. non-null pointer to a non-empty Matrix4x4 - The provided matrix - * will be used as the transform matrix and applied to the rect. + * on every call to this function. + * + * non-null pointer to an empty Maybe - Upon return, the Maybe is + * filled with the transform matrix that was computed. This can then be passed + * in to subsequent calls with the same source and destination frames to avoid + * recomputing the matrix. + * + * non-null pointer to a non-empty Matrix4x4 - The provided matrix will be + * used as the transform matrix and applied to the rect. */ static nsRect TransformFrameRectToAncestor( const nsIFrame* aFrame, const nsRect& aRect, const nsIFrame* aAncestor, @@ -1743,30 +1747,35 @@ class nsLayoutUtils { * Draw a background image. The image's dimensions are as specified in aDest; * the image itself is not consulted to determine a size. * See https://wiki.mozilla.org/Gecko:Image_Snapping_and_Rendering - * @param aContext The context to draw to, already set up with an - * appropriate scale and transform for drawing in - * app units. - * @param aForFrame The nsIFrame that we're drawing this image for. - * @param aImage The image. - * @param aImageSize The unscaled size of the image being drawn. - * (This might be the image's size if no scaling - * occurs, or it might be the image's size if - * the image is a vector image being rendered at - * that size.) - * @param aDest The position and scaled area where one copy of - * the image should be drawn. This area represents - * the image itself in its correct position as - * defined with the background-position css property. - * @param aFill The area to be filled with copies of the image. - * @param aRepeatSize The distance between the positions of two - * subsequent repeats of the image. Sizes larger than aDest.Size() create gaps - * between the images. - * @param aAnchor A point in aFill which we will ensure is - * pixel-aligned in the output. - * @param aDirty Pixels outside this area may be skipped. - * @param aImageFlags Image flags of the imgIContainer::FLAG_* - * variety. - * @param aExtendMode How to extend the image over the dest rect. + * + * @param aContext + * The context to draw to, already set up with an appropriate scale and + * transform for drawing in app units. + * @param aForFrame + * The nsIFrame that we're drawing this image for. + * @param aImage + * The image. + * @param aImageSize + * The unscaled size of the image being drawn. (This might be the image's + * size if no scaling occurs, or it might be the image's size if the image is + * a vector image being rendered at that size.) + * @param aDest + * The position and scaled area where one copy of the image should be drawn. + * This area represents the image itself in its correct position as defined + * with the background-position css property. + * @param aFill + * The area to be filled with copies of the image. + * @param aRepeatSize + * The distance between the positions of two subsequent repeats of the image. + * Sizes larger than aDest.Size() create gaps between the images. + * @param aAnchor + * A point in aFill which we will ensure is pixel-aligned in the output. + * @param aDirty + * Pixels outside this area may be skipped. + * @param aImageFlags + * Image flags of the imgIContainer::FLAG_* variety. + * @param aExtendMode + * How to extend the image over the dest rect. */ static ImgDrawResult DrawBackgroundImage( gfxContext& aContext, nsIFrame* aForFrame, nsPresContext* aPresContext, @@ -2912,13 +2921,15 @@ class nsLayoutUtils { * If not, returns the first frame on the next line if such a next line * exists. * - * @return true if the node is an invisible break. - * aNextLineFrame is returned null in this case. - * false if the node causes a visible break or if the node is no - * break. + * @return + * true if the node is an invisible break. aNextLineFrame is returned null + * in this case. * - * @param aNextLineFrame assigned to first frame on the next line if such a - * next line exists, null otherwise. + * false if the node causes a visible break or if the node is no break. + * + * @param aNextLineFrame + * assigned to first frame on the next line if such a next line exists, null + * otherwise. */ static bool IsInvisibleBreak(nsINode* aNode, nsIFrame** aNextLineFrame = nullptr); diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 00d9cc7e5785..bea4b4adce3f 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -102,10 +102,11 @@ enum nsPresContext_CachedIntPrefType { // IDs for the default variable and fixed fonts (not to be changed, see // nsFont.h) To be used for Get/SetDefaultFont(). The other IDs in nsFont.h are // also supported. -const uint8_t kPresContext_DefaultVariableFont_ID = - 0x00; // kGenericFont_moz_variable -const uint8_t kPresContext_DefaultFixedFont_ID = - 0x01; // kGenericFont_moz_fixed +// +// kGenericFont_moz_variable +const uint8_t kPresContext_DefaultVariableFont_ID = 0x00; +// kGenericFont_moz_fixed +const uint8_t kPresContext_DefaultFixedFont_ID = 0x01; #ifdef DEBUG struct nsAutoLayoutPhase; diff --git a/layout/generic/ReflowInput.h b/layout/generic/ReflowInput.h index d02741e34325..bb6ec793d4d7 100644 --- a/layout/generic/ReflowInput.h +++ b/layout/generic/ReflowInput.h @@ -185,55 +185,74 @@ struct SizeComputationInput { struct ReflowInputFlags { ReflowInputFlags() { memset(this, 0, sizeof(*this)); } - bool mSpecialBSizeReflow : 1; // used by tables to communicate special - // reflow (in process) to handle percent - // bsize frames inside cells which may not - // have computed bsizes - bool mNextInFlowUntouched : 1; // nothing in the frame's next-in-flow (or - // its descendants) is changing - bool mIsTopOfPage : 1; // Is the current context at the top of a - // page? When true, we force something - // that's too tall for a page/column to - // fit anyway to avoid infinite loops. - bool mAssumingHScrollbar : 1; // parent frame is an nsIScrollableFrame and - // it is assuming a horizontal scrollbar - bool mAssumingVScrollbar : 1; // parent frame is an nsIScrollableFrame and - // it is assuming a vertical scrollbar - bool mIsIResize : 1; // Is frame (a) not dirty and (b) a - // different inline-size than before? + // used by tables to communicate special reflow (in process) to handle + // percent bsize frames inside cells which may not have computed bsizes + bool mSpecialBSizeReflow : 1; - bool mIsBResize : 1; // Is frame (a) not dirty and (b) a - // different block-size than before or - // (potentially) in a context where - // percent block-sizes have a different - // basis? - bool mTableIsSplittable : 1; // tables are splittable, this should happen - // only inside a page and never insider a - // column frame - bool mHeightDependsOnAncestorCell : 1; // Does frame height depend on - // an ancestor table-cell? - bool mIsColumnBalancing : 1; // nsColumnSetFrame is balancing columns - bool mIsFlexContainerMeasuringBSize : 1; // nsFlexContainerFrame is - // reflowing this child to - // measure its intrinsic BSize. - bool mDummyParentReflowInput : 1; // a "fake" reflow state made - // in order to be the parent - // of a real one - bool mMustReflowPlaceholders : 1; // Should this frame reflow its place- - // holder children? If the available - // height of this frame didn't change, - // but its in a paginated environment - // (e.g. columns), it should always - // reflow its placeholder children. - bool mShrinkWrap : 1; // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag - bool mUseAutoBSize : 1; // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag - bool mStaticPosIsCBOrigin : 1; // the STATIC_POS_IS_CB_ORIGIN ctor flag - bool mIClampMarginBoxMinSize : 1; // the I_CLAMP_MARGIN_BOX_MIN_SIZE ctor - // flag - bool mBClampMarginBoxMinSize : 1; // the B_CLAMP_MARGIN_BOX_MIN_SIZE ctor - // flag - bool mApplyAutoMinSize : 1; // the I_APPLY_AUTO_MIN_SIZE ctor flag + // nothing in the frame's next-in-flow (or its descendants) is changing + bool mNextInFlowUntouched : 1; + + // Is the current context at the top of a page? When true, we force + // something that's too tall for a page/column to fit anyway to avoid + // infinite loops. + bool mIsTopOfPage : 1; + + // parent frame is an nsIScrollableFrame and it is assuming a horizontal + // scrollbar + bool mAssumingHScrollbar : 1; + + // parent frame is an nsIScrollableFrame and it is assuming a vertical + // scrollbar + bool mAssumingVScrollbar : 1; + + // Is frame (a) not dirty and (b) a different inline-size than before? + bool mIsIResize : 1; + + // Is frame (a) not dirty and (b) a different block-size than before or + // (potentially) in a context where percent block-sizes have a different + // basis? + bool mIsBResize : 1; + + // tables are splittable, this should happen only inside a page and never + // insider a column frame + bool mTableIsSplittable : 1; + + // Does frame height depend on an ancestor table-cell? + bool mHeightDependsOnAncestorCell : 1; + + // nsColumnSetFrame is balancing columns + bool mIsColumnBalancing : 1; + + // nsFlexContainerFrame is reflowing this child to measure its intrinsic + // BSize. + bool mIsFlexContainerMeasuringBSize : 1; + + // a "fake" reflow state made in order to be the parent of a real one + bool mDummyParentReflowInput : 1; + + // Should this frame reflow its place-holder children? If the available + // height of this frame didn't change, but its in a paginated environment + // (e.g. columns), it should always reflow its placeholder children. + bool mMustReflowPlaceholders : 1; + + // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag + bool mShrinkWrap : 1; + + // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag + bool mUseAutoBSize : 1; + + // the STATIC_POS_IS_CB_ORIGIN ctor flag + bool mStaticPosIsCBOrigin : 1; + + // the I_CLAMP_MARGIN_BOX_MIN_SIZE ctor flag + bool mIClampMarginBoxMinSize : 1; + + // the B_CLAMP_MARGIN_BOX_MIN_SIZE ctor flag + bool mBClampMarginBoxMinSize : 1; + + // the I_APPLY_AUTO_MIN_SIZE ctor flag + bool mApplyAutoMinSize : 1; // If set, the following two flags indicate that: // (1) this frame is absolutely-positioned (or fixed-positioned). @@ -838,7 +857,7 @@ struct ReflowInput : public SizeComputationInput { * size computed so far. * * @param aBSize The block-size that we've computed an to which we want to - * apply min/max constraints. + * apply min/max constraints. * @param aConsumed The amount of the computed block-size that was consumed by * our prev-in-flows. */ diff --git a/layout/generic/WritingModes.h b/layout/generic/WritingModes.h index 223f202bdbd2..a77b4d474489 100644 --- a/layout/generic/WritingModes.h +++ b/layout/generic/WritingModes.h @@ -376,47 +376,49 @@ class WritingMode { * (This is the inverse of the PhysicalSide() method above.) */ LogicalSide LogicalSideForPhysicalSide(mozilla::Side aSide) const { + // clang-format off // indexes are four-bit values: // bit 0 = the eOrientationMask value // bit 1 = the eInlineFlowMask value // bit 2 = the eBlockFlowMask value // bit 3 = the eLineOrientMask value static const LogicalSide kPhysicalToLogicalSides[][4] = { - // top right - // bottom left - {eLogicalSideBStart, eLogicalSideIEnd, eLogicalSideBEnd, - eLogicalSideIStart}, // horizontal-tb ltr - {eLogicalSideIStart, eLogicalSideBStart, eLogicalSideIEnd, - eLogicalSideBEnd}, // vertical-rl ltr - {eLogicalSideBStart, eLogicalSideIStart, eLogicalSideBEnd, - eLogicalSideIEnd}, // horizontal-tb rtl - {eLogicalSideIEnd, eLogicalSideBStart, eLogicalSideIStart, - eLogicalSideBEnd}, // vertical-rl rtl - {eLogicalSideBEnd, eLogicalSideIStart, eLogicalSideBStart, - eLogicalSideIEnd}, // (horizontal-bt) (inv) ltr - {eLogicalSideIStart, eLogicalSideBEnd, eLogicalSideIEnd, - eLogicalSideBStart}, // vertical-lr sw-left rtl - {eLogicalSideBEnd, eLogicalSideIEnd, eLogicalSideBStart, - eLogicalSideIStart}, // (horizontal-bt) (inv) rtl - {eLogicalSideIEnd, eLogicalSideBEnd, eLogicalSideIStart, - eLogicalSideBStart}, // vertical-lr sw-left ltr - {eLogicalSideBStart, eLogicalSideIEnd, eLogicalSideBEnd, - eLogicalSideIStart}, // horizontal-tb (inv) rtl - {eLogicalSideIStart, eLogicalSideBStart, eLogicalSideIEnd, - eLogicalSideBEnd}, // vertical-rl sw-left rtl - {eLogicalSideBStart, eLogicalSideIStart, eLogicalSideBEnd, - eLogicalSideIEnd}, // horizontal-tb (inv) ltr - {eLogicalSideIEnd, eLogicalSideBStart, eLogicalSideIStart, - eLogicalSideBEnd}, // vertical-rl sw-left ltr - {eLogicalSideBEnd, eLogicalSideIEnd, eLogicalSideBStart, - eLogicalSideIStart}, // (horizontal-bt) ltr - {eLogicalSideIStart, eLogicalSideBEnd, eLogicalSideIEnd, - eLogicalSideBStart}, // vertical-lr ltr - {eLogicalSideBEnd, eLogicalSideIStart, eLogicalSideBStart, - eLogicalSideIEnd}, // (horizontal-bt) rtl - {eLogicalSideIEnd, eLogicalSideBEnd, eLogicalSideIStart, - eLogicalSideBStart}, // vertical-lr rtl + // top right + // bottom left + { eLogicalSideBStart, eLogicalSideIEnd, + eLogicalSideBEnd, eLogicalSideIStart }, // horizontal-tb ltr + { eLogicalSideIStart, eLogicalSideBStart, + eLogicalSideIEnd, eLogicalSideBEnd }, // vertical-rl ltr + { eLogicalSideBStart, eLogicalSideIStart, + eLogicalSideBEnd, eLogicalSideIEnd }, // horizontal-tb rtl + { eLogicalSideIEnd, eLogicalSideBStart, + eLogicalSideIStart, eLogicalSideBEnd }, // vertical-rl rtl + { eLogicalSideBEnd, eLogicalSideIStart, + eLogicalSideBStart, eLogicalSideIEnd }, // (horizontal-bt) (inv) ltr + { eLogicalSideIStart, eLogicalSideBEnd, + eLogicalSideIEnd, eLogicalSideBStart }, // vertical-lr sw-left rtl + { eLogicalSideBEnd, eLogicalSideIEnd, + eLogicalSideBStart, eLogicalSideIStart }, // (horizontal-bt) (inv) rtl + { eLogicalSideIEnd, eLogicalSideBEnd, + eLogicalSideIStart, eLogicalSideBStart }, // vertical-lr sw-left ltr + { eLogicalSideBStart, eLogicalSideIEnd, + eLogicalSideBEnd, eLogicalSideIStart }, // horizontal-tb (inv) rtl + { eLogicalSideIStart, eLogicalSideBStart, + eLogicalSideIEnd, eLogicalSideBEnd }, // vertical-rl sw-left rtl + { eLogicalSideBStart, eLogicalSideIStart, + eLogicalSideBEnd, eLogicalSideIEnd }, // horizontal-tb (inv) ltr + { eLogicalSideIEnd, eLogicalSideBStart, + eLogicalSideIStart, eLogicalSideBEnd }, // vertical-rl sw-left ltr + { eLogicalSideBEnd, eLogicalSideIEnd, + eLogicalSideBStart, eLogicalSideIStart }, // (horizontal-bt) ltr + { eLogicalSideIStart, eLogicalSideBEnd, + eLogicalSideIEnd, eLogicalSideBStart }, // vertical-lr ltr + { eLogicalSideBEnd, eLogicalSideIStart, + eLogicalSideBStart, eLogicalSideIEnd }, // (horizontal-bt) rtl + { eLogicalSideIEnd, eLogicalSideBEnd, + eLogicalSideIStart, eLogicalSideBStart }, // vertical-lr rtl }; + // clang-format on static_assert(eOrientationMask == 0x01 && eInlineFlowMask == 0x02 && eBlockFlowMask == 0x04 && eLineOrientMask == 0x08, @@ -614,12 +616,13 @@ class WritingMode { enum Masks { // Masks for our bits; true chosen as opposite of commonest case eOrientationMask = 0x01, // true means vertical text - eInlineFlowMask = - 0x02, // true means absolute RTL/BTT (against physical coords) - eBlockFlowMask = - 0x04, // true means vertical-LR (or horizontal-BT if added) - eLineOrientMask = 0x08, // true means over != block-start - eBidiMask = 0x10, // true means line-relative RTL (bidi RTL) + eInlineFlowMask = 0x02, // true means absolute RTL/BTT (against physical + // coords) + eBlockFlowMask = 0x04, // true means vertical-LR (or horizontal-BT if + // added) + eLineOrientMask = 0x08, // true means over != block-start + eBidiMask = 0x10, // true means line-relative RTL (bidi RTL) + // Note: We have one excess bit of info; WritingMode can pack into 4 bits. // But since we have space, we're caching interesting things for fast // access. diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index 2f3f90843659..6c73eddc111e 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -529,10 +529,12 @@ class nsBlockFrame : public nsContainerFrame { virtual void UnionChildOverflow(nsOverflowAreas& aOverflowAreas) override; - /** 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). + /** + * 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). */ static void RecoverFloatsFor(nsIFrame* aFrame, nsFloatManager& aFloatManager, mozilla::WritingMode aWM, @@ -673,11 +675,14 @@ class nsBlockFrame : public nsContainerFrame { // Methods for line reflow /** * Reflow a line. - * @param aState the current reflow state - * @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 + * + * @param aState + * the current reflow state + * @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 */ void ReflowLine(BlockReflowInput& aState, LineIterator aLine, bool* aKeepReflowGoing); diff --git a/layout/generic/nsFrameSelection.h b/layout/generic/nsFrameSelection.h index 2da5266d2c9d..f95a8ead2956 100644 --- a/layout/generic/nsFrameSelection.h +++ b/layout/generic/nsFrameSelection.h @@ -81,81 +81,85 @@ struct MOZ_STACK_CLASS nsPeekOffsetStruct { /*** Input arguments ***/ // Note: The value of some of the input arguments may be changed upon exit. - // mAmount: The type of movement requested (by character, word, line, etc.) + // The type of movement requested (by character, word, line, etc.) nsSelectionAmount mAmount; - // mDirection: eDirPrevious or eDirNext. - // * Note for visual bidi movement: - // eDirPrevious means 'left-then-up' if the containing block is - // LTR, 'right-then-up' if it is RTL. eDirNext means - // 'right-then-down' if the containing block is LTR, - // 'left-then-down' if it is RTL. - // Between paragraphs, eDirPrevious means "go to the visual end of - // the previous paragraph", and eDirNext means "go to the visual - // beginning of the next paragraph". Used with: eSelectCharacter, - // eSelectWord, eSelectLine, eSelectParagraph. + // eDirPrevious or eDirNext. + // + // Note for visual bidi movement: + // * eDirPrevious means 'left-then-up' if the containing block is LTR, + // 'right-then-up' if it is RTL. + // * eDirNext means 'right-then-down' if the containing block is LTR, + // 'left-then-down' if it is RTL. + // * Between paragraphs, eDirPrevious means "go to the visual end of + // the previous paragraph", and eDirNext means "go to the visual + // beginning of the next paragraph". + // + // Used with: eSelectCharacter, eSelectWord, eSelectLine, eSelectParagraph. nsDirection mDirection; - // mStartOffset: Offset into the content of the current frame where the peek - // starts. - // Used with: eSelectCharacter, eSelectWord + // Offset into the content of the current frame where the peek starts. + // + // Used with: eSelectCharacter, eSelectWord int32_t mStartOffset; - // mDesiredPos: The desired inline coordinate for the caret - // (one of .x or .y will be used, depending on line's writing - // mode) Used with: eSelectLine. + // The desired inline coordinate for the caret (one of .x or .y will be used, + // depending on line's writing mode) + // + // Used with: eSelectLine. nsPoint mDesiredPos; - // mWordMovementType: An enum that determines whether to prefer the start or - // end of a word - // or to use the default beahvior, which is a combination - // of direction and the platform-based pref - // "layout.word_select.eat_space_to_next_word" + // An enum that determines whether to prefer the start or end of a word or to + // use the default beahvior, which is a combination of direction and the + // platform-based pref "layout.word_select.eat_space_to_next_word" mozilla::EWordMovementType mWordMovementType; - // mJumpLines: Whether to allow jumping across line boundaries. - // Used with: eSelectCharacter, eSelectWord. + // Whether to allow jumping across line boundaries. + // + // Used with: eSelectCharacter, eSelectWord. bool mJumpLines; - // mScrollViewStop: Whether to stop when reaching a scroll view boundary. - // Used with: eSelectCharacter, eSelectWord, eSelectLine. + // Whether to stop when reaching a scroll view boundary. + // + // Used with: eSelectCharacter, eSelectWord, eSelectLine. bool mScrollViewStop; - // mIsKeyboardSelect: Whether the peeking is done in response to a keyboard - // action. - // Used with: eSelectWord. + // Whether the peeking is done in response to a keyboard action. + // + // Used with: eSelectWord. bool mIsKeyboardSelect; - // mVisual: Whether bidi caret behavior is visual (true) or logical (false). - // Used with: eSelectCharacter, eSelectWord, eSelectBeginLine, - // eSelectEndLine. + // Whether bidi caret behavior is visual (true) or logical (false). + // + // Used with: eSelectCharacter, eSelectWord, eSelectBeginLine, eSelectEndLine. bool mVisual; - // mExtend: Whether the selection is being extended or moved. + // Whether the selection is being extended or moved. bool mExtend; - // mForceEditableRegion: If true, the offset has to end up in an editable - // node, otherwise we'll keep searching. + // If true, the offset has to end up in an editable node, otherwise we'll keep + // searching. const bool mForceEditableRegion; /*** Output arguments ***/ - // mResultContent: Content reached as a result of the peek. + // Content reached as a result of the peek. nsCOMPtr mResultContent; - // mResultFrame: Frame reached as a result of the peek. - // Used with: eSelectCharacter, eSelectWord. + // Frame reached as a result of the peek. + // + // Used with: eSelectCharacter, eSelectWord. nsIFrame* mResultFrame; - // mContentOffset: Offset into content reached as a result of the peek. + // Offset into content reached as a result of the peek. int32_t mContentOffset; - // mAttachForward: When the result position is between two frames, - // indicates which of the two frames the caret should be - // painted in. false means "the end of the frame logically - // before the caret", true means "the beginning of the frame - // logically after the caret". Used with: eSelectLine, - // eSelectBeginLine, eSelectEndLine. + // When the result position is between two frames, indicates which of the two + // frames the caret should be painted in. false means "the end of the frame + // logically before the caret", true means "the beginning of the frame + // logically after the caret". + // + // Used with: eSelectLine, eSelectBeginLine, eSelectEndLine. mozilla::CaretAssociationHint mAttach; }; @@ -209,31 +213,42 @@ class nsFrameSelection final { NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsFrameSelection) NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsFrameSelection) - /** Init will initialize the frame selector with the necessary pres shell to - * be used by most of the methods - * @param aShell is the parameter to be used for most of the other calls for + /** + * Init will initialize the frame selector with the necessary pres shell to + * be used by most of the methods + * + * @param aShell is the parameter to be used for most of the other calls for * callbacks etc - * @param aLimiter limits the selection to nodes with aLimiter parents - * @param aAccessibleCaretEnabled true if we should enable the accessible + * + * @param aLimiter limits the selection to nodes with aLimiter parents + * + * @param aAccessibleCaretEnabled true if we should enable the accessible * caret. */ void Init(nsIPresShell* aShell, nsIContent* aLimiter, bool aAccessibleCaretEnabled); - /** HandleClick will take the focus to the new frame at the new offset and - * will either extend the selection from the old anchor, or replace the old + /** + * HandleClick will take the focus to the new frame at the new offset and + * will either extend the selection from the old anchor, or replace the old * anchor. the old anchor and focus position may also be used to deselect * things - * @param aNewfocus is the content that wants the focus - * @param aContentOffset is the content offset of the parent aNewFocus - * @param aContentOffsetEnd is the content offset of the parent aNewFocus and + * + * @param aNewfocus is the content that wants the focus + * + * @param aContentOffset is the content offset of the parent aNewFocus + * + * @param aContentOffsetEnd is the content offset of the parent aNewFocus and * is specified different when you need to select to and include both start * and end points - * @param aContinueSelection is the flag that tells the selection to keep the + * + * @param aContinueSelection is the flag that tells the selection to keep the * old anchor point or not. - * @param aMultipleSelection will tell the frame selector to replace /or not + * + * @param aMultipleSelection will tell the frame selector to replace /or not * the old selection. cannot coexist with aContinueSelection - * @param aHint will tell the selection which direction geometrically to + * + * @param aHint will tell the selection which direction geometrically to * actually show the caret on. 1 = end of this line 0 = beginning of this line */ MOZ_CAN_RUN_SCRIPT_BOUNDARY @@ -241,29 +256,42 @@ class nsFrameSelection final { uint32_t aContentEndOffset, bool aContinueSelection, bool aMultipleSelection, CaretAssociateHint aHint); - /** HandleDrag extends the selection to contain the frame closest to aPoint. - * @param aPresContext is the context to use when figuring out what frame + /** + * HandleDrag extends the selection to contain the frame closest to aPoint. + * + * @param aPresContext is the context to use when figuring out what frame * contains the point. - * @param aFrame is the parent of all frames to use when searching for the + * + * @param aFrame is the parent of all frames to use when searching for the * closest frame to the point. - * @param aPoint is relative to aFrame + * + * @param aPoint is relative to aFrame */ /*unsafe*/ void HandleDrag(nsIFrame* aFrame, const nsPoint& aPoint); - /** HandleTableSelection will set selection to a table, cell, etc - * depending on information contained in aFlags - * @param aParentContent is the paretent of either a table or cell that user + /** + * HandleTableSelection will set selection to a table, cell, etc + * depending on information contained in aFlags + * + * @param aParentContent is the paretent of either a table or cell that user * clicked or dragged the mouse in - * @param aContentOffset is the offset of the table or cell - * @param aTarget indicates what to select - * TableSelection::Cell We should select a cell (content points to the - * cell) TableSelection::Row We should select a row (content points to - * any cell in row) TableSelection::Column We should select a row (content - * points to any cell in column) TableSelection::Table We should select a - * table (content points to the table) TableSelection::AllCells We should - * select all cells (content points to any cell in table) - * @param aMouseEvent passed in so we can get where event occurred + * + * @param aContentOffset is the offset of the table or cell + * + * @param aTarget indicates what to select + * * TableSelection::Cell + * We should select a cell (content points to the cell) + * * TableSelection::Row + * We should select a row (content points to any cell in row) + * * TableSelection::Column + * We should select a row (content points to any cell in column) + * * TableSelection::Table + * We should select a table (content points to the table) + * * TableSelection::AllCells + * We should select all cells (content points to any cell in table) + * + * @param aMouseEvent passed in so we can get where event occurred * and what keys are pressed */ /*unsafe*/ @@ -319,27 +347,33 @@ class nsFrameSelection final { int32_t aEndRowIndex, int32_t aEndColumnIndex); - /** StartAutoScrollTimer is responsible for scrolling frames so that - * aPoint is always visible, and for selecting any frame that contains - * aPoint. The timer will also reset itself to fire again if we have - * not scrolled to the end of the document. - * @param aFrame is the outermost frame to use when searching for - * the closest frame for the point, i.e. the frame that is capturing - * the mouse - * @param aPoint is relative to aFrame. - * @param aDelay is the timer's interval. + /** + * StartAutoScrollTimer is responsible for scrolling frames so that + * aPoint is always visible, and for selecting any frame that contains + * aPoint. The timer will also reset itself to fire again if we have + * not scrolled to the end of the document. + * + * @param aFrame is the outermost frame to use when searching for + * the closest frame for the point, i.e. the frame that is capturing + * the mouse + * + * @param aPoint is relative to aFrame. + * + * @param aDelay is the timer's interval. */ /*unsafe*/ nsresult StartAutoScrollTimer(nsIFrame* aFrame, const nsPoint& aPoint, uint32_t aDelay); - /** StopAutoScrollTimer stops any active auto scroll timer. + /** + * Stops any active auto scroll timer. */ void StopAutoScrollTimer(); - /** Lookup Selection - * returns in frame coordinates the selection beginning and ending with the + /** + * Returns in frame coordinates the selection beginning and ending with the * type of selection given + * * @param aContent is the content asking * @param aContentOffset is the starting content boundary * @param aContentLength is the length of the content piece asking @@ -350,21 +384,23 @@ class nsFrameSelection final { int32_t aContentLength, bool aSlowCheck) const; - /** SetDragState(bool); - * sets the drag state to aState for resons of drag state. + /** + * Sets the drag state to aState for resons of drag state. + * * @param aState is the new state of drag */ MOZ_CAN_RUN_SCRIPT_BOUNDARY void SetDragState(bool aState); - /** GetDragState(bool *); - * gets the drag state to aState for resons of drag state. + /** + * Gets the drag state to aState for resons of drag state. + * * @param aState will hold the state of drag */ bool GetDragState() const { return mDragState; } /** - if we are in table cell selection mode. aka ctrl click in table cell + * If we are in table cell selection mode. aka ctrl click in table cell */ bool GetTableCellSelection() const { return mSelectingTableCellMode != mozilla::TableSelection::None; @@ -373,8 +409,9 @@ class nsFrameSelection final { mSelectingTableCellMode = mozilla::TableSelection::None; } - /** GetSelection - * no query interface for selection. must use this method now. + /** + * No query interface for selection. must use this method now. + * * @param aSelectionType The selection type what you want. */ mozilla::dom::Selection* GetSelection( @@ -385,28 +422,33 @@ class nsFrameSelection final { * so that it is visible in the scrolled view. * * @param aSelectionType the selection to scroll into view. - * @param aRegion the region inside the selection to scroll into view. - * @param aFlags the scroll flags. Valid bits include: - * SCROLL_SYNCHRONOUS: when set, scrolls the selection into view - * before returning. If not set, posts a request which is processed - * at some point after the method returns. - * SCROLL_FIRST_ANCESTOR_ONLY: if set, only the first ancestor will be - * scrolled into view. * + * @param aRegion the region inside the selection to scroll into view. + * + * @param aFlags the scroll flags. Valid bits include: + * * SCROLL_SYNCHRONOUS: when set, scrolls the selection into view + * before returning. If not set, posts a request which is processed + * at some point after the method returns. + * * SCROLL_FIRST_ANCESTOR_ONLY: if set, only the first ancestor will be + * scrolled into view. */ /*unsafe*/ nsresult ScrollSelectionIntoView(mozilla::SelectionType aSelectionType, SelectionRegion aRegion, int16_t aFlags) const; - /** RepaintSelection repaints the selected frames that are inside the + /** + * RepaintSelection repaints the selected frames that are inside the * selection specified by aSelectionType. + * * @param aSelectionType The selection type what you want to repaint. */ nsresult RepaintSelection(mozilla::SelectionType aSelectionType); - /** GetFrameForNodeOffset given a node and its child offset, return the - * nsIFrame and the offset into that frame. + /** + * Given a node and its child offset, return the nsIFrame and the offset into + * that frame. + * * @param aNode input parameter for the node to look at * @param aOffset offset into above node. * @param aReturnOffset will contain offset into frame. @@ -459,7 +501,8 @@ class nsFrameSelection final { */ void UndefineCaretBidiLevel(); - /** PhysicalMove will generally be called from the nsiselectioncontroller + /** + * PhysicalMove will generally be called from the nsiselectioncontroller * implementations. the effect being the selection will move one unit * 'aAmount' in the given aDirection. * @param aDirection the direction to move the selection @@ -469,7 +512,8 @@ class nsFrameSelection final { /*unsafe*/ nsresult PhysicalMove(int16_t aDirection, int16_t aAmount, bool aExtend); - /** CharacterMove will generally be called from the nsiselectioncontroller + /** + * CharacterMove will generally be called from the nsiselectioncontroller * implementations. the effect being the selection will move one character * left or right. * @param aForward move forward in document. @@ -478,19 +522,22 @@ class nsFrameSelection final { /*unsafe*/ nsresult CharacterMove(bool aForward, bool aExtend); - /** CharacterExtendForDelete extends the selection forward (logically) to + /** + * CharacterExtendForDelete extends the selection forward (logically) to * the next character cell, so that the selected cell can be deleted. */ /*unsafe*/ nsresult CharacterExtendForDelete(); - /** CharacterExtendForBackspace extends the selection backward (logically) to + /** + * CharacterExtendForBackspace extends the selection backward (logically) to * the previous character cell, so that the selected cell can be deleted. */ /*unsafe*/ nsresult CharacterExtendForBackspace(); - /** WordMove will generally be called from the nsiselectioncontroller + /** + * WordMove will generally be called from the nsiselectioncontroller * implementations. the effect being the selection will move one word left or * right. * @param aForward move forward in document. @@ -499,14 +546,16 @@ class nsFrameSelection final { /*unsafe*/ nsresult WordMove(bool aForward, bool aExtend); - /** WordExtendForDelete extends the selection backward or forward (logically) + /** + * WordExtendForDelete extends the selection backward or forward (logically) * to the next word boundary, so that the selected word can be deleted. * @param aForward select forward in document. */ /*unsafe*/ nsresult WordExtendForDelete(bool aForward); - /** LineMove will generally be called from the nsiselectioncontroller + /** + * LineMove will generally be called from the nsiselectioncontroller * implementations. the effect being the selection will move one line up or * down. * @param aForward move forward in document. @@ -515,7 +564,8 @@ class nsFrameSelection final { /*unsafe*/ nsresult LineMove(bool aForward, bool aExtend); - /** IntraLineMove will generally be called from the nsiselectioncontroller + /** + * IntraLineMove will generally be called from the nsiselectioncontroller * implementations. the effect being the selection will move to beginning or * end of line * @param aForward move forward in document. @@ -524,7 +574,8 @@ class nsFrameSelection final { /*unsafe*/ nsresult IntraLineMove(bool aForward, bool aExtend); - /** Select All will generally be called from the nsiselectioncontroller + /** + * Select All will generally be called from the nsiselectioncontroller * implementations. it will select the whole doc */ MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult SelectAll(); @@ -534,19 +585,23 @@ class nsFrameSelection final { void SetDisplaySelection(int16_t aState) { mDisplaySelection = aState; } int16_t GetDisplaySelection() const { return mDisplaySelection; } - /** This method can be used to store the data received during a MouseDown - * event so that we can place the caret during the MouseUp event. - * @aMouseEvent the event received by the selection MouseDown - * handling method. A nullptr value can be use to tell this method - * that any data is storing is no longer valid. + /** + * This method can be used to store the data received during a MouseDown + * event so that we can place the caret during the MouseUp event. + * + * @param aMouseEvent the event received by the selection MouseDown + * handling method. A nullptr value can be use to tell this method + * that any data is storing is no longer valid. */ void SetDelayedCaretData(mozilla::WidgetMouseEvent* aMouseEvent); - /** Get the delayed MouseDown event data necessary to place the - * caret during MouseUp processing. + /** + * Get the delayed MouseDown event data necessary to place the + * caret during MouseUp processing. + * * @return a pointer to the event received - * by the selection during MouseDown processing. It can be nullptr - * if the data is no longer valid. + * by the selection during MouseDown processing. It can be nullptr + * if the data is no longer valid. */ bool HasDelayedCaretData() { return mDelayedMouseEventValid; } bool IsShiftDownInDelayedCaretData() { @@ -563,58 +618,66 @@ class nsFrameSelection final { GetClickCountInDelayedCaretData() < 2; } - /** Get the content node that limits the selection - * When searching up a nodes for parents, as in a text edit field - * in an browser page, we must stop at this node else we reach into the - * parent page, which is very bad! + /** + * Get the content node that limits the selection + * + * When searching up a nodes for parents, as in a text edit field + * in an browser page, we must stop at this node else we reach into the + * parent page, which is very bad! */ nsIContent* GetLimiter() const { return mLimiter; } nsIContent* GetAncestorLimiter() const { return mAncestorLimiter; } MOZ_CAN_RUN_SCRIPT_BOUNDARY void SetAncestorLimiter(nsIContent* aLimiter); - /** This will tell the frame selection that a double click has been pressed - * so it can track abort future drags if inside the same selection - * @aDoubleDown has the double click down happened + /** + * This will tell the frame selection that a double click has been pressed + * so it can track abort future drags if inside the same selection + * @param aDoubleDown has the double click down happened */ void SetMouseDoubleDown(bool aDoubleDown) { mMouseDoubleDownState = aDoubleDown; } - /** This will return whether the double down flag was set. - * @return whether the double down flag was set + /** + * This will return whether the double down flag was set. + * @return whether the double down flag was set */ bool GetMouseDoubleDown() const { return mMouseDoubleDownState; } /** * GetPrevNextBidiLevels will return the frames and associated Bidi levels of * the characters logically before and after a (collapsed) selection. - * @param aNode is the node containing the selection - * @param aContentOffset is the offset of the selection in the node - * @param aJumpLines If true, look across line boundaries. - * If false, behave as if there were base-level frames at - * line edges. * - * @return A struct holding the before/after frame and the before/after + * @param aNode is the node containing the selection + * @param aContentOffset is the offset of the selection in the node + * @param aJumpLines + * If true, look across line boundaries. + * If false, behave as if there were base-level frames at line edges. + * + * @return A struct holding the before/after frame and the before/after * level. * - * At the beginning and end of each line there is assumed to be a frame with - * Bidi level equal to the paragraph embedding level. - * In these cases the before frame and after frame respectively will be - * nullptr. + * At the beginning and end of each line there is assumed to be a frame with + * Bidi level equal to the paragraph embedding level. + * + * In these cases the before frame and after frame respectively will be + * nullptr. */ nsPrevNextBidiLevels GetPrevNextBidiLevels(nsIContent* aNode, uint32_t aContentOffset, bool aJumpLines) const; - /** GetFrameFromLevel will scan in a given direction - * until it finds a frame with a Bidi level less than or equal to a given + /** + * GetFrameFromLevel will scan in a given direction + * until it finds a frame with a Bidi level less than or equal to a given * level. It will return the last frame before this. - * @param aPresContext is the context to use - * @param aFrameIn is the frame to start from - * @param aDirection is the direction to scan - * @param aBidiLevel is the level to search for - * @param aFrameOut will hold the frame returned + * + * @param aPresContext is the context to use + * @param aFrameIn is the frame to start from + * @param aDirection is the direction to scan + * @param aBidiLevel is the level to search for + * @param aFrameOut will hold the frame returned */ nsresult GetFrameFromLevel(nsIFrame* aFrameIn, nsDirection aDirection, nsBidiLevel aBidiLevel, @@ -625,6 +688,7 @@ class nsFrameSelection final { * Dragging or extending selection will never allow for a subset * (or the whole) of the maintained selection to become unselected. * Primary use: double click selecting then dragging on second click + * * @param aAmount the initial amount of text selected (word, line or * paragraph). For "line", use eSelectBeginLine. */ diff --git a/layout/generic/nsFrameSetFrame.h b/layout/generic/nsFrameSetFrame.h index 5951088f895b..e4bf2e0fff20 100644 --- a/layout/generic/nsFrameSetFrame.h +++ b/layout/generic/nsFrameSetFrame.h @@ -45,8 +45,8 @@ enum nsFrameborder { }; struct nsFramesetDrag { - nsHTMLFramesetFrame* - mSource; // frameset whose border was dragged to cause the resize + nsHTMLFramesetFrame* mSource; // frameset whose border was dragged to cause + // the resize int32_t mIndex; // index of left col or top row of effected area int32_t mChange; // pos for left to right or top to bottom, neg otherwise bool mVertical; // vertical if true, otherwise horizontal diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index a3e73b2b3326..497a761764e4 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -338,16 +338,15 @@ std::ostream& operator<<(std::ostream& aStream, const nsReflowStatus& aStatus); * If all four deltas are zero, this means that no overflow rect has * actually been set (this is the initial state of newly-created frames). */ -#define NS_FRAME_OVERFLOW_DELTA_MAX 0xfe // max delta we can store -#define NS_FRAME_OVERFLOW_NONE \ - 0x00000000 // there are no overflow rects; - // code relies on this being - // the all-zero value +// max delta we can store +#define NS_FRAME_OVERFLOW_DELTA_MAX 0xfe -#define NS_FRAME_OVERFLOW_LARGE \ - 0x000000ff // overflow is stored as a - // separate rect property +// there are no overflow rects; code relies on this being the all-zero value +#define NS_FRAME_OVERFLOW_NONE 0x00000000 + +// overflow is stored as a separate rect property +#define NS_FRAME_OVERFLOW_LARGE 0x000000ff /** * nsBidiLevel is the type of the level values in our Unicode Bidi @@ -381,14 +380,16 @@ std::ostream& operator<<(std::ostream& aStream, const nsReflowStatus& aStatus); */ typedef uint8_t nsBidiLevel; -/** Paragraph level setting. - * If there is no strong character, then set the paragraph level to 0 +/** + * Paragraph level setting. + * If there is no strong character, then set the paragraph level to 0 * (left-to-right). */ #define NSBIDI_DEFAULT_LTR 0xfe -/** Paragraph level setting. - * If there is no strong character, then set the paragraph level to 1 +/** + * Paragraph level setting. + * If there is no strong character, then set the paragraph level to 1 * (right-to-left). */ #define NSBIDI_DEFAULT_RTL 0xff @@ -397,7 +398,6 @@ typedef uint8_t nsBidiLevel; * Maximum explicit embedding level. * (The maximum resolved level can be up to * NSBIDI_MAX_EXPLICIT_LEVEL+1). - * */ #define NSBIDI_MAX_EXPLICIT_LEVEL 125 @@ -617,7 +617,8 @@ class nsIFrame : public nsQueryFrame { // Note that |this| is deleted at this point. } - /** Flags for PeekOffsetCharacter, PeekOffsetNoAmount, PeekOffsetWord return + /** + * Flags for PeekOffsetCharacter, PeekOffsetNoAmount, PeekOffsetWord return * values. */ enum FrameSearchResult { @@ -1147,13 +1148,13 @@ class nsIFrame : public nsQueryFrame { #define NS_DECLARE_FRAME_PROPERTY_RELEASABLE(prop, type) \ NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, ReleaseValue) -#define NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVER_CALLED(prop, type) \ - static void AssertOnDestroyingProperty##prop(type*) { \ - MOZ_ASSERT_UNREACHABLE("Frame property " #prop \ - " should never " \ - "be destroyed by the FrameProperties class"); \ - } \ - NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, \ +#define NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVER_CALLED(prop, type) \ + static void AssertOnDestroyingProperty##prop(type*) { \ + MOZ_ASSERT_UNREACHABLE( \ + "Frame property " #prop \ + " should never be destroyed by the FrameProperties class"); \ + } \ + NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, \ AssertOnDestroyingProperty##prop) #define NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(prop, type) \ @@ -1833,11 +1834,11 @@ class nsIFrame : public nsQueryFrame { /** * Event handling of GUI events. * - * @param aEvent event structure describing the type of event and rge widget - * where the event originated - * The |point| member of this is in the coordinate system of the - * view returned by GetOffsetFromView. - * @param aEventStatus a return value indicating whether the event was + * @param aEvent event structure describing the type of event and rge widget + * where the event originated. The |point| member of this is in the coordinate + * system of the view returned by GetOffsetFromView. + * + * @param aEventStatus a return value indicating whether the event was * handled and whether default processing should be done * * XXX From a frame's perspective it's unclear what the effect of the event @@ -2324,8 +2325,8 @@ class nsIFrame : public nsQueryFrame { * https://drafts.csswg.org/css-grid/#min-size-auto * https://drafts.csswg.org/css-align-3/#valdef-justify-self-stretch */ - eIApplyAutoMinSize = - 1 << 4, // only has an effect when eShrinkWrap is false + eIApplyAutoMinSize = 1 << 4, // only has an effect when eShrinkWrap is + // false }; /** @@ -3184,27 +3185,28 @@ class nsIFrame : public nsQueryFrame { } /** - * called to discover where this frame, or a parent frame has user-select + * Called to discover where this frame, or a parent frame has user-select * style applied, which affects that way that it is selected. * - * @param aSelectStyle out param. Returns the type of selection style found - * (using values defined in nsStyleConsts.h). + * @param aSelectStyle out param. Returns the type of selection style found + * (using values defined in nsStyleConsts.h). * - * @return Whether the frame can be selected (i.e. is not affected by - * user-select: none) + * @return Whether the frame can be selected (i.e. is not affected by + * user-select: none) */ bool IsSelectable(mozilla::StyleUserSelect* aSelectStyle) const; /** - * Called to retrieve the SelectionController associated with the frame. - * @param aSelCon will contain the selection controller associated with - * the frame. + * Called to retrieve the SelectionController associated with the frame. + * + * @param aSelCon will contain the selection controller associated with + * the frame. */ virtual nsresult GetSelectionController(nsPresContext* aPresContext, nsISelectionController** aSelCon) = 0; /** - * Call to get nsFrameSelection for this frame. + * Call to get nsFrameSelection for this frame. */ already_AddRefed GetFrameSelection(); @@ -3215,28 +3217,36 @@ class nsIFrame : public nsQueryFrame { const nsFrameSelection* GetConstFrameSelection() const; /** - * called to find the previous/next character, word, or line returns the - * actual nsIFrame and the frame offset. THIS DOES NOT CHANGE SELECTION STATE - * uses frame's begin selection state to start. if no selection on this frame - * will return NS_ERROR_FAILURE - * @param aPOS is defined in nsFrameSelection + * called to find the previous/next character, word, or line. Returns the + * actual nsIFrame and the frame offset. THIS DOES NOT CHANGE SELECTION STATE. + * Uses frame's begin selection state to start. If no selection on this frame + * will return NS_ERROR_FAILURE. + * + * @param aPOS is defined in nsFrameSelection */ virtual nsresult PeekOffset(nsPeekOffsetStruct* aPos); /** - * called to find the previous/next non-anonymous selectable leaf frame. - * @param aDirection [in] the direction to move in (eDirPrevious or eDirNext) - * @param aVisual [in] whether bidi caret behavior is visual (true) or + * Called to find the previous/next non-anonymous selectable leaf frame. + * + * @param aDirection [in] the direction to move in (eDirPrevious or eDirNext) + * + * @param aVisual [in] whether bidi caret behavior is visual (true) or * logical (false) - * @param aJumpLines [in] whether to allow jumping across line boundaries - * @param aScrollViewStop [in] whether to stop when reaching a scroll frame + * + * @param aJumpLines [in] whether to allow jumping across line boundaries + * @param aScrollViewStop [in] whether to stop when reaching a scroll frame * boundary - * @param aOutFrame [out] the previous/next selectable leaf frame - * @param aOutOffset [out] 0 indicates that we arrived at the beginning of + * + * @param aOutFrame [out] the previous/next selectable leaf frame + * + * @param aOutOffset [out] 0 indicates that we arrived at the beginning of * the output frame; -1 indicates that we arrived at its end. - * @param aOutJumpedLine [out] whether this frame and the returned frame are + * + * @param aOutJumpedLine [out] whether this frame and the returned frame are * on different lines - * @param aOutMovedOverNonSelectableText [out] whether we jumped over a + * + * @param aOutMovedOverNonSelectableText [out] whether we jumped over a * non-selectable frame during the search */ nsresult GetFrameFromDirection(nsDirection aDirection, bool aVisual, @@ -3247,17 +3257,22 @@ class nsIFrame : public nsQueryFrame { bool* aOutMovedOverNonSelectableText); /** - * called to see if the children of the frame are visible from indexstart to - * index end. this does not change any state. returns true only if the indexes - * are valid and any of the children are visible. for textframes this index - * is the character index. if aStart = aEnd result will be false - * @param aStart start index of first child from 0-N (number of children) - * @param aEnd end index of last child from 0-N - * @param aRecurse should this frame talk to siblings to get to the contents + * Called to see if the children of the frame are visible from indexstart to + * index end. This does not change any state. Returns true only if the indexes + * are valid and any of the children are visible. For textframes this index + * is the character index. If aStart = aEnd result will be false. + * + * @param aStart start index of first child from 0-N (number of children) + * + * @param aEnd end index of last child from 0-N + * + * @param aRecurse should this frame talk to siblings to get to the contents * other children? - * @param aFinished did this frame have the aEndIndex? or is there more work + * + * @param aFinished did this frame have the aEndIndex? or is there more work * to do - * @param _retval return value true or false. false = range is not rendered. + * + * @param _retval return value true or false. false = range is not rendered. */ virtual nsresult CheckVisibility(nsPresContext* aContext, int32_t aStartIndex, int32_t aEndIndex, bool aRecurse, @@ -4283,30 +4298,38 @@ class nsIFrame : public nsQueryFrame { // Helpers /** * Can we stop inside this frame when we're skipping non-rendered whitespace? - * @param aForward [in] Are we moving forward (or backward) in content order. - * @param aOffset [in/out] At what offset into the frame to start looking. - * on output - what offset was reached (whether or not we found a - * place to stop). - * @return STOP: An appropriate offset was found within this frame, - * and is given by aOffset. - * CONTINUE: Not found within this frame, need to try the next frame. - * see enum FrameSearchResult for more details. + * + * @param aForward [in] Are we moving forward (or backward) in content order. + * + * @param aOffset [in/out] At what offset into the frame to start looking. + * at offset was reached (whether or not we found a place to stop). + * + * @return + * * STOP: An appropriate offset was found within this frame, + * and is given by aOffset. + * * CONTINUE: Not found within this frame, need to try the next frame. + * See enum FrameSearchResult for more details. */ virtual FrameSearchResult PeekOffsetNoAmount(bool aForward, int32_t* aOffset) = 0; /** * Search the frame for the next character - * @param aForward [in] Are we moving forward (or backward) in content order. - * @param aOffset [in/out] At what offset into the frame to start looking. - * on output - what offset was reached (whether or not we found a - * place to stop). - * @param aOptions [in] Options, see the comment in - * PeekOffsetCharacterOptions for the detail. - * @return STOP: An appropriate offset was found within this frame, - * and is given by aOffset. - * CONTINUE: Not found within this frame, need to try the next frame. - * see enum FrameSearchResult for more details. + * + * @param aForward [in] Are we moving forward (or backward) in content order. + * + * @param aOffset [in/out] At what offset into the frame to start looking. + * on output - what offset was reached (whether or not we found a place to + * stop). + * + * @param aOptions [in] Options, see the comment in PeekOffsetCharacterOptions + * for the detail. + * + * @return + * * STOP: An appropriate offset was found within this frame, and is given + * by aOffset. + * * CONTINUE: Not found within this frame, need to try the next frame. See + * enum FrameSearchResult for more details. */ virtual FrameSearchResult PeekOffsetCharacter( bool aForward, int32_t* aOffset, diff --git a/layout/mathml/nsIMathMLFrame.h b/layout/mathml/nsIMathMLFrame.h index 8d2689915a54..837bd5a7b373 100644 --- a/layout/mathml/nsIMathMLFrame.h +++ b/layout/mathml/nsIMathMLFrame.h @@ -127,19 +127,19 @@ class nsIMathMLFrame { * to have already reached in their own InheritAutomaticData(). * - set properties that your descendants assume that you would have set in * your InheritAutomaticData() -- this way, they can safely query them - * and the process will feed upon itself. + * and the process will feed upon itself. * * 2. Use TransmitAutomaticData() to set properties related to your * descendants: * - set properties that depend on the state that you expect your - * descendants to have reached upon processing their own - * TransmitAutomaticData(). + * descendants to have reached upon processing their own + * TransmitAutomaticData(). * - transmit properties that your descendants expect that you will - * transmit to them in your TransmitAutomaticData() -- this way, they remain - * up-to-date. + * transmit to them in your TransmitAutomaticData() -- this way, they + * remain up-to-date. * - set properties that your ancestors expect that you would set in your * TransmitAutomaticData() -- this way, they can safely query them and - * the process will feed upon itself. + * the process will feed upon itself. */ NS_IMETHOD diff --git a/layout/mathml/nsMathMLContainerFrame.h b/layout/mathml/nsMathMLContainerFrame.h index 28409530a15c..784e4937d112 100644 --- a/layout/mathml/nsMathMLContainerFrame.h +++ b/layout/mathml/nsMathMLContainerFrame.h @@ -124,8 +124,7 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame { // we just re-layout them using ReLayoutChildren(this); // (e.g., this happens with ). // 2b. If the automatic data to update affects us in some way, we ask our - // parent - // to re-layout its children using ReLayoutChildren(mParent); + // parent to re-layout its children using ReLayoutChildren(mParent); // Therefore, there is an overhead here in that our siblings are // re-laid too (e.g., this happens with , , // ). diff --git a/layout/printing/nsPrintData.h b/layout/printing/nsPrintData.h index 100af2f83901..e8b2a5802440 100644 --- a/layout/printing/nsPrintData.h +++ b/layout/printing/nsPrintData.h @@ -61,8 +61,8 @@ class nsPrintData { nsCOMArray mPrintProgressListeners; nsCOMPtr mPrintProgressParams; - nsCOMPtr - mCurrentFocusWin; // cache a pointer to the currently focused window + nsCOMPtr mCurrentFocusWin; // cache a pointer to the + // currently focused window // Array of non-owning pointers to all the nsPrintObjects owned by this // nsPrintData. This includes this->mPrintObject, as well as all of its diff --git a/layout/style/StyleSheet.h b/layout/style/StyleSheet.h index 684a5a1e366a..930864c78cce 100644 --- a/layout/style/StyleSheet.h +++ b/layout/style/StyleSheet.h @@ -458,9 +458,9 @@ class StyleSheet final : public nsICSSLoaderObserver, public nsWrapperCache { StyleSheet* mParent; // weak ref nsString mTitle; - dom::DocumentOrShadowRoot* - mDocumentOrShadowRoot; // weak ref; parents maintain this for their - // children + + // weak ref; parents maintain this for their children + dom::DocumentOrShadowRoot* mDocumentOrShadowRoot; nsINode* mOwningNode; // weak ref dom::CSSImportRule* mOwnerRule; // weak ref diff --git a/layout/style/URLExtraData.h b/layout/style/URLExtraData.h index a27f975a1e1b..c41eb94b35f4 100644 --- a/layout/style/URLExtraData.h +++ b/layout/style/URLExtraData.h @@ -28,10 +28,9 @@ struct URLExtraData { : mBaseURI(std::move(aBaseURI)), mReferrer(std::move(aReferrer)), mReferrerPolicy(aReferrerPolicy), - mPrincipal(std::move(aPrincipal)) + mPrincipal(std::move(aPrincipal)), // When we hold the URI data of a style sheet, mReferrer is always // equal to the sheet URI. - , mIsChrome(mReferrer ? dom::IsChromeURI(mReferrer) : false) { MOZ_ASSERT(mBaseURI); MOZ_ASSERT(mPrincipal); diff --git a/layout/style/nsCSSAnonBoxes.h b/layout/style/nsCSSAnonBoxes.h index f9674fc9f096..adada70f28fc 100644 --- a/layout/style/nsCSSAnonBoxes.h +++ b/layout/style/nsCSSAnonBoxes.h @@ -71,7 +71,10 @@ class nsCSSAnonBoxes { static bool IsWrapperAnonBox(nsAtom* aPseudo) { // We commonly get null passed here, and want to quickly return false for // it. - return aPseudo && ( + if (!aPseudo) { + return false; + } + return #define CSS_ANON_BOX(_name, _value) /* nothing */ #define CSS_WRAPPER_ANON_BOX(_name, _value) \ nsGkAtoms::AnonBox_##_name == aPseudo || @@ -80,7 +83,7 @@ class nsCSSAnonBoxes { #undef CSS_NON_INHERITING_ANON_BOX #undef CSS_WRAPPER_ANON_BOX #undef CSS_ANON_BOX - false); + false; } // Get the NonInheriting type for a given pseudo tag. The pseudo tag must diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 260dceaed560..8377f283f08a 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -293,27 +293,24 @@ class nsCSSProps { // Not const because we modify its entries when various // "layout.css.*.enabled" prefs changes: static KTableEntry kDisplayKTable[]; - // -- tables for parsing the {align,justify}-{content,items,self} properties - // -- + // clang-format off + // -- tables for parsing the {align,justify}-{content,items,self} properties -- static const KTableEntry kAlignAllKeywords[]; static const KTableEntry kAlignOverflowPosition[]; // static const KTableEntry kAlignSelfPosition[]; // static const KTableEntry kAlignLegacy[]; // 'legacy' static const KTableEntry kAlignLegacyPosition[]; // 'left/right/center' - static const KTableEntry - kAlignAutoNormalStretchBaseline[]; // 'auto/normal/stretch/baseline' - static const KTableEntry - kAlignNormalStretchBaseline[]; // 'normal/stretch/baseline' + static const KTableEntry kAlignAutoNormalStretchBaseline[]; // 'auto/normal/stretch/baseline' + static const KTableEntry kAlignNormalStretchBaseline[]; // 'normal/stretch/baseline' static const KTableEntry kAlignNormalBaseline[]; // 'normal/baseline' - static const KTableEntry - kAlignContentDistribution[]; // + static const KTableEntry kAlignContentDistribution[]; // static const KTableEntry kAlignContentPosition[]; // - // -- tables for auto-completion of the {align,justify}-{content,items,self} - // properties -- + // -- tables for auto-completion of the {align,justify}-{content,items,self} properties -- static const KTableEntry kAutoCompletionAlignJustifySelf[]; static const KTableEntry kAutoCompletionAlignItems[]; static const KTableEntry kAutoCompletionAlignJustifyContent[]; // ------------------------------------------------------------------ + // clang-format on static const KTableEntry kFontSmoothingKTable[]; static const KTableEntry kGridAutoFlowKTable[]; static const KTableEntry kGridTrackBreadthKTable[]; diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h index 132d061d73b0..9feb7f93d3b2 100644 --- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -250,8 +250,8 @@ enum nsCSSUnit { eCSSUnit_Unset = 4, // (n/a) value equivalent to 'initial' if on a reset // property, 'inherit' otherwise eCSSUnit_None = 5, // (n/a) value is none - eCSSUnit_Normal = - 6, // (n/a) value is normal (algorithmic, different than auto) + eCSSUnit_Normal = 6, // (n/a) value is normal (algorithmic, different than + // auto) eCSSUnit_System_Font = 7, // (n/a) value is -moz-use-system-font eCSSUnit_All = 8, // (n/a) value is all eCSSUnit_Dummy = 9, // (n/a) a fake but specified value, used @@ -264,32 +264,28 @@ enum nsCSSUnit { eCSSUnit_Attr = 14, // (char16_t*) a attr(string) value eCSSUnit_Element = 15, // (char16_t*) an element id - eCSSUnit_Array = 20, // (nsCSSValue::Array*) a list of values - eCSSUnit_Counter = - 21, // (nsCSSValue::Array*) a counter(string,[string]) value - eCSSUnit_Counters = - 22, // (nsCSSValue::Array*) a counters(string,string[,string]) value - eCSSUnit_Cubic_Bezier = 23, // (nsCSSValue::Array*) a list of float values - eCSSUnit_Steps = 24, // (nsCSSValue::Array*) a list of (integer, enumerated) - eCSSUnit_Symbols = - 25, // (nsCSSValue::Array*) a symbols(enumerated, symbols) value - eCSSUnit_Function = 26, // (nsCSSValue::Array*) a function with - // parameters. First elem of array is name, - // an nsCSSKeyword as eCSSUnit_Enumerated, - // the rest of the values are arguments. + // nsCSSValue::Array* values + eCSSUnit_Array = 20, // (Array*) a list of values + eCSSUnit_Counter = 21, // (Array*) a counter(string,[string]) value + eCSSUnit_Counters = 22, // (Array*) a counters(string,string[,string]) value + eCSSUnit_Cubic_Bezier = 23, // (Array*) a list of float values + eCSSUnit_Steps = 24, // (Array*) a list of (integer, enumerated) + eCSSUnit_Symbols = 25, // (Array*) a symbols(enumerated, symbols) value + eCSSUnit_Function = 26, // (Array*) a function with parameters. First elem of + // array is name, an nsCSSKeyword as + // eCSSUnit_Enumerated, the rest of the values are + // arguments. // The top level of a calc() expression is eCSSUnit_Calc. All // remaining eCSSUnit_Calc_* units only occur inside these toplevel // calc values. - // eCSSUnit_Calc has an array with exactly 1 element. eCSSUnit_Calc - // exists so we can distinguish calc(2em) from 2em as specified values - // (but we drop this distinction for nsStyleCoord when we store + // eCSSUnit_Calc exists so we can distinguish calc(2em) from 2em as specified + // values (but we drop this distinction for nsStyleCoord when we store // computed values). - eCSSUnit_Calc = 30, // (nsCSSValue::Array*) calc() value - // Plus, Minus, Times_* and Divided have arrays with exactly 2 - // elements. a + b + c + d is grouped as ((a + b) + c) + d - eCSSUnit_Calc_Plus = 31, // (nsCSSValue::Array*) + node within calc() + eCSSUnit_Calc = 30, // (Array*) calc() value -- exactly 1 elt. + eCSSUnit_Calc_Plus = 31, // (Array*) + node within calc(); exactly 2 elts. + // a + b + c + d is grouped as ((a + b) + c) + d eCSSUnit_Pair = 50, // (nsCSSValuePair*) pair of values eCSSUnit_List = 53, // (nsCSSValueList*) list of values @@ -303,29 +299,28 @@ enum nsCSSUnit { eCSSUnit_Integer = 70, // (int) simple value eCSSUnit_Enumerated = 71, // (int) value has enumerated meaning - eCSSUnit_Percent = - 100, // (float) 1.0 == 100%) value is percentage of something - eCSSUnit_Number = 101, // (float) value is numeric (usually multiplier, - // different behavior than percent) + eCSSUnit_Percent = 100, // (float) (1.0 == 100%) value is percentage of + // something + eCSSUnit_Number = 101, // (float) value is numeric (usually multiplier, + // different behavior than percent) // Length units - relative // Viewport relative measure - eCSSUnit_ViewportWidth = - 700, // (float) 1% of the width of the initial containing block - eCSSUnit_ViewportHeight = - 701, // (float) 1% of the height of the initial containing block - eCSSUnit_ViewportMin = - 702, // (float) smaller of ViewportWidth and ViewportHeight - eCSSUnit_ViewportMax = - 703, // (float) larger of ViewportWidth and ViewportHeight + eCSSUnit_ViewportWidth = 700, // (float) 1% of the width of the initial + // containing block (ICB) + eCSSUnit_ViewportHeight = 701, // (float) 1% of the height of the ICB + eCSSUnit_ViewportMin = 702, // (float) smaller of ViewportWidth and + // ViewportHeight + eCSSUnit_ViewportMax = 703, // (float) larger of ViewportWidth and + // ViewportHeight // Font relative measure - eCSSUnit_EM = 800, // (float) == current font size - eCSSUnit_XHeight = - 801, // (float) distance from top of lower case x to baseline - eCSSUnit_Char = - 802, // (float) number of characters, used for width with monospace font - eCSSUnit_RootEM = 803, // (float) == root element font size + eCSSUnit_EM = 800, // (float) == current font size + eCSSUnit_XHeight = 801, // (float) distance from top of lower case x to + // baseline + eCSSUnit_Char = 802, // (float) number of characters, used for width with + // monospace font + eCSSUnit_RootEM = 803, // (float) == root element font size // Screen relative measure eCSSUnit_Point = 900, // (float) 4/3 of a CSS pixel diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index a921d0e3cf84..d212ad4756bb 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -753,8 +753,7 @@ enum class StyleWhiteSpace : uint8_t { // ruby-position, see nsStyleText #define NS_STYLE_RUBY_POSITION_OVER 0 #define NS_STYLE_RUBY_POSITION_UNDER 1 -#define NS_STYLE_RUBY_POSITION_INTER_CHARACTER \ - 2 /* placeholder, not yet parsed */ +#define NS_STYLE_RUBY_POSITION_INTER_CHARACTER 2 // placeholder, not yet parsed // See nsStyleText #define NS_STYLE_TEXT_SIZE_ADJUST_NONE 0 diff --git a/layout/style/nsStyleCoord.h b/layout/style/nsStyleCoord.h index e91b185d83ac..71d1a598932f 100644 --- a/layout/style/nsStyleCoord.h +++ b/layout/style/nsStyleCoord.h @@ -183,8 +183,8 @@ class nsStyleCoord { static nscoord ToLength(nsStyleUnit aUnit, nsStyleUnion aValue) { MOZ_ASSERT(ConvertsToLength(aUnit, aValue)); if (IsCalcUnit(aUnit)) { - return AsCalcValue(aValue) - ->ToLength(); // Note: This asserts !mHasPercent + // Note: ToLength asserts !mHasPercent + return AsCalcValue(aValue)->ToLength(); } MOZ_ASSERT(aUnit == eStyleUnit_Coord); return aValue.mInt; diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 0de5bbf82221..87677aead5b5 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -606,30 +606,27 @@ struct nsStyleImageLayers { Size mSize; StyleGeometryBox mClip; MOZ_INIT_OUTSIDE_CTOR StyleGeometryBox mOrigin; - StyleImageLayerAttachment mAttachment; - // background-only property - // This property is used for background layer - // only. For a mask layer, it should always - // be the initial value, which is + + // This property is used for background layer only. + // For a mask layer, it should always be the initial value, which is // StyleImageLayerAttachment::Scroll. + StyleImageLayerAttachment mAttachment; + + // This property is used for background layer only. + // For a mask layer, it should always be the initial value, which is + // NS_STYLE_BLEND_NORMAL. uint8_t mBlendMode; // NS_STYLE_BLEND_* - // background-only property - // This property is used for background layer - // only. For a mask layer, it should always - // be the initial value, which is - // NS_STYLE_BLEND_NORMAL. + + // This property is used for mask layer only. + // For a background layer, it should always be the initial value, which is + // NS_STYLE_COMPOSITE_MODE_ADD. uint8_t mComposite; // NS_STYLE_MASK_COMPOSITE_* - // mask-only property - // This property is used for mask layer only. - // For a background layer, it should always - // be the initial value, which is - // NS_STYLE_COMPOSITE_MODE_ADD. - uint8_t mMaskMode; // NS_STYLE_MASK_MODE_* - // mask-only property - // This property is used for mask layer only. - // For a background layer, it should always - // be the initial value, which is - // NS_STYLE_MASK_MODE_MATCH_SOURCE. + + // mask-only property. This property is used for mask layer only. For a + // background layer, it should always be the initial value, which is + // NS_STYLE_MASK_MODE_MATCH_SOURCE. + uint8_t mMaskMode; // NS_STYLE_MASK_MODE_* + Repeat mRepeat; // This constructor does not initialize mRepeat or mOrigin and Initialize() @@ -662,9 +659,17 @@ struct nsStyleImageLayers { // The (positive) number of computed values of each property, since // the lengths of the lists are independent. - uint32_t mAttachmentCount, mClipCount, mOriginCount, mRepeatCount, - mPositionXCount, mPositionYCount, mImageCount, mSizeCount, mMaskModeCount, - mBlendModeCount, mCompositeCount; + uint32_t mAttachmentCount; + uint32_t mClipCount; + uint32_t mOriginCount; + uint32_t mRepeatCount; + uint32_t mPositionXCount; + uint32_t mPositionYCount; + uint32_t mImageCount; + uint32_t mSizeCount; + uint32_t mMaskModeCount; + uint32_t mBlendModeCount; + uint32_t mCompositeCount; // Layers are stored in an array, matching the top-to-bottom order in // which they are specified in CSS. The number of layers to be used @@ -1945,15 +1950,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay { nsStyleCoord mChildPerspective; // none, coord nsStyleCoord mPerspectiveOrigin[2]; // percent, coord, calc - nsStyleCoord - mVerticalAlign; // coord, percent, calc, enum (NS_STYLE_VERTICAL_ALIGN_*) + nsStyleCoord mVerticalAlign; // coord, percent, calc, enum + // (NS_STYLE_VERTICAL_ALIGN_*) nsStyleAutoArray mTransitions; // The number of elements in mTransitions that are not from repeating // a list due to another property being longer. - uint32_t mTransitionTimingFunctionCount, mTransitionDurationCount, - mTransitionDelayCount, mTransitionPropertyCount; + uint32_t mTransitionTimingFunctionCount; + uint32_t mTransitionDurationCount; + uint32_t mTransitionDelayCount; + uint32_t mTransitionPropertyCount; nsCSSPropertyID GetTransitionProperty(uint32_t aIndex) const { return mTransitions[aIndex % mTransitionPropertyCount].GetProperty(); @@ -1980,10 +1987,14 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay { // The number of elements in mAnimations that are not from repeating // a list due to another property being longer. - uint32_t mAnimationTimingFunctionCount, mAnimationDurationCount, - mAnimationDelayCount, mAnimationNameCount, mAnimationDirectionCount, - mAnimationFillModeCount, mAnimationPlayStateCount, - mAnimationIterationCountCount; + uint32_t mAnimationTimingFunctionCount; + uint32_t mAnimationDurationCount; + uint32_t mAnimationDelayCount; + uint32_t mAnimationNameCount; + uint32_t mAnimationDirectionCount; + uint32_t mAnimationFillModeCount; + uint32_t mAnimationPlayStateCount; + uint32_t mAnimationIterationCountCount; nsAtom* GetAnimationName(uint32_t aIndex) const { return mAnimations[aIndex % mAnimationNameCount].GetName(); diff --git a/layout/svg/nsSVGDisplayableFrame.h b/layout/svg/nsSVGDisplayableFrame.h index 9142a02421bf..e0c0dc0308fc 100644 --- a/layout/svg/nsSVGDisplayableFrame.h +++ b/layout/svg/nsSVGDisplayableFrame.h @@ -104,15 +104,16 @@ class nsSVGDisplayableFrame : public nsQueryFrame { // Flags to pass to NotifySVGChange: // - // DO_NOT_NOTIFY_RENDERING_OBSERVERS - this should only be used when - // updating the descendant frames of a clipPath, - // mask, pattern or marker frame (or other similar - // NS_FRAME_IS_NONDISPLAY frame) immediately - // prior to painting that frame's descendants. - // TRANSFORM_CHANGED - the current transform matrix for this frame has - // changed COORD_CONTEXT_CHANGED - the dimensions of this frame's coordinate - // context has - // changed (percentage lengths must be reevaluated) + // DO_NOT_NOTIFY_RENDERING_OBSERVERS: + // this should only be used when updating the descendant frames of a + // clipPath, mask, pattern or marker frame (or other similar + // NS_FRAME_IS_NONDISPLAY frame) immediately prior to painting that frame's + // descendants. + // TRANSFORM_CHANGED: + // the current transform matrix for this frame has changed + // COORD_CONTEXT_CHANGED: + // the dimensions of this frame's coordinate context has changed (percentage + // lengths must be reevaluated) enum SVGChangedFlags { TRANSFORM_CHANGED = 0x01, COORD_CONTEXT_CHANGED = 0x02, diff --git a/layout/svg/nsSVGOuterSVGFrame.h b/layout/svg/nsSVGOuterSVGFrame.h index 0769eb98472a..3aed414523be 100644 --- a/layout/svg/nsSVGOuterSVGFrame.h +++ b/layout/svg/nsSVGOuterSVGFrame.h @@ -176,7 +176,7 @@ class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame, // A hash-set containing our nsSVGForeignObjectFrame descendants. Note we use // a hash-set to avoid the O(N^2) behavior we'd get tearing down an SVG frame // subtree if we were to use a list (see bug 381285 comment 20). - nsAutoPtr > > + nsAutoPtr>> mForeignObjectHash; nsRegion mInvalidRegion; diff --git a/layout/tables/celldata.h b/layout/tables/celldata.h index 7bba7c5d310a..461d0153a098 100644 --- a/layout/tables/celldata.h +++ b/layout/tables/celldata.h @@ -110,13 +110,13 @@ class CellData { friend class nsCellMap; friend class BCCellData; - /** constructor. + /** + * Implemented in nsCellMap.cpp + * * @param aOrigCell the table cell frame which will be stored in mOrigCell. */ - explicit CellData( - nsTableCellFrame* aOrigCell); // implemented in nsCellMap.cpp + explicit CellData(nsTableCellFrame* aOrigCell); - /** destructor */ ~CellData(); // implemented in nsCellMap.cpp protected: diff --git a/layout/tables/nsTableColFrame.h b/layout/tables/nsTableColFrame.h index a59e3e593832..8d6a45b06ada 100644 --- a/layout/tables/nsTableColFrame.h +++ b/layout/tables/nsTableColFrame.h @@ -20,14 +20,16 @@ class nsTableColFrame final : public nsSplittableFrame { enum { eWIDTH_SOURCE_NONE = 0, // no cell has contributed to the width style eWIDTH_SOURCE_CELL = 1, // a cell specified a width - eWIDTH_SOURCE_CELL_WITH_SPAN = - 2 // a cell implicitly specified a width via colspan + eWIDTH_SOURCE_CELL_WITH_SPAN = 2 // a cell implicitly specified a width via + // colspan }; nsTableColType GetColType() const; void SetColType(nsTableColType aType); - /** instantiate a new instance of nsTableRowFrame. + /** + * instantiate a new instance of nsTableRowFrame. + * * @param aPresShell the pres shell for this frame * * @return the frame that was created diff --git a/layout/tables/nsTableColGroupFrame.h b/layout/tables/nsTableColGroupFrame.h index 718cb03ef2b2..c4178708e107 100644 --- a/layout/tables/nsTableColGroupFrame.h +++ b/layout/tables/nsTableColGroupFrame.h @@ -21,7 +21,9 @@ class nsTableColGroupFrame final : public nsContainerFrame { public: NS_DECL_FRAMEARENA_HELPERS(nsTableColGroupFrame) - /** instantiate a new instance of nsTableRowFrame. + /** + * instantiate a new instance of nsTableRowFrame. + * * @param aPresShell the pres shell for this frame * * @return the frame that was created diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index fef45295838a..4530dcfe4cf0 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -98,8 +98,7 @@ class nsAutoPushCurrentTableItem { #endif }; -/* ============================================================================ - */ +/* ========================================================================== */ enum nsTableColType { eColContent = 0, // there is real col content associated @@ -131,7 +130,9 @@ class nsTableFrame : public nsContainerFrame { /** nsTableWrapperFrame has intimate knowledge of the inner table frame */ friend class nsTableWrapperFrame; - /** instantiate a new instance of nsTableRowFrame. + /** + * instantiate a new instance of nsTableRowFrame. + * * @param aPresShell the pres shell for this frame * * @return the frame that was created @@ -322,16 +323,23 @@ class nsTableFrame : public nsContainerFrame { nscoord aWidthInCB); // XXXldb REWRITE THIS COMMENT! - /** inner tables are reflowed in two steps. + // clang-format off + /** + * Inner tables are reflowed in two steps. *
-   * if mFirstPassValid is false, this is our first time through since content
-   * was last changed set pass to 1 do pass 1 get min/max info for all cells in
-   * an infinite space do column balancing set mFirstPassValid to true do pass 2
+   * if mFirstPassValid is false, this is our first time through since content was last changed
+   *   set pass to 1
+   *   do pass 1
+   *     get min/max info for all cells in an infinite space
+   *   do column balancing
+   *   set mFirstPassValid to true
+   *   do pass 2
    *     use column widths to Reflow cells
    * 
* * @see nsIFrame::Reflow */ + // clang-format on virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, const ReflowInput& aReflowInput, nsReflowStatus& aStatus) override; @@ -839,8 +847,8 @@ class nsTableFrame : public nsContainerFrame { uint32_t mHasPctCol : 1; // does any cell or col have a pct width uint32_t mCellSpansPctCol : 1; // does any cell span a col with a pct width // (or containing a cell with a pct width) - uint32_t - mIsBorderCollapse : 1; // border collapsing model vs. separate model + uint32_t mIsBorderCollapse : 1; // border collapsing model vs. separate + // model uint32_t mRowInserted : 1; uint32_t mNeedToCalcBCBorders : 1; uint32_t mGeometryDirty : 1; @@ -854,11 +862,11 @@ class nsTableFrame : public nsContainerFrame { std::map mDeletedRowIndexRanges; // maintains ranges of row // indices of deleted rows - nsTableCellMap* - mCellMap; // maintains the relationships between rows, cols, and cells - nsITableLayoutStrategy* - mTableLayoutStrategy; // the layout strategy for this frame - nsFrameList mColGroups; // the list of colgroup frames + nsTableCellMap* mCellMap; // maintains the relationships between rows, cols, + // and cells + nsITableLayoutStrategy* mTableLayoutStrategy; // the layout strategy for this + // frame + nsFrameList mColGroups; // the list of colgroup frames }; inline bool nsTableFrame::IsRowGroup(mozilla::StyleDisplay aDisplayType) const { diff --git a/layout/tables/nsTableRowFrame.h b/layout/tables/nsTableRowFrame.h index 4b482ddc19cc..e17916a0e412 100644 --- a/layout/tables/nsTableRowFrame.h +++ b/layout/tables/nsTableRowFrame.h @@ -80,8 +80,12 @@ class nsTableRowFrame : public nsContainerFrame { inline nsTableCellFrame* GetFirstCell() const; /** calls Reflow for all of its child cells. + * * Cells with rowspan=1 are all set to the same height and stacked - * horizontally.

Cells are not split unless absolutely necessary.

+ * horizontally. + * + * Cells are not split unless absolutely necessary. + * * Cells are resized in nsTableFrame::BalanceColumnWidths and * nsTableFrame::ShrinkWrapChildren * diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h index 25faa5b510e9..2a0e79bfc425 100644 --- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -75,9 +75,12 @@ class nsTableRowGroupFrame final : public nsContainerFrame, virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) override; - /** calls Reflow for all of its child rows. + /** + * Calls Reflow for all of its child rows. + * * Rows are all set to the same isize and stacked in the block direction. - *

rows are not split unless absolutely necessary. + * + * Rows are not split unless absolutely necessary. * * @param aDesiredSize isize set to isize of rows, bsize set to * sum of bsize of rows that fit in AvailableBSize. @@ -223,11 +226,10 @@ class nsTableRowGroupFrame final : public nsContainerFrame, /** Find the orginating cell frame on a row that is the nearest to the * inline-dir coordinate of aPos. - * @param aLineNumber - the index of the row relative to the row - * group - * @param aPos - coordinate in twips relative to the - * origin of the row group - * @param aFrameFound - pointer to the cellframe + * @param aLineNumber - the index of the row relative to the row group + * @param aPos - coordinate in twips relative to the + * origin of the row group + * @param aFrameFound - pointer to the cellframe * @param aPosIsBeforeFirstFrame - the point is before the first originating * cellframe * @param aPosIsAfterLastFrame - the point is after the last originating diff --git a/layout/xul/BoxObject.h b/layout/xul/BoxObject.h index 38918f8131d3..9e2c9c33448b 100644 --- a/layout/xul/BoxObject.h +++ b/layout/xul/BoxObject.h @@ -82,8 +82,7 @@ class BoxObject : public nsPIBoxObject, public nsWrapperCache { protected: virtual ~BoxObject(); - nsAutoPtr > - mPropertyTable; //[OWNER] + nsAutoPtr> mPropertyTable; Element* mContent; // [WEAK] }; diff --git a/layout/xul/nsMenuBarFrame.h b/layout/xul/nsMenuBarFrame.h index 5b050e7acf21..c7771322e363 100644 --- a/layout/xul/nsMenuBarFrame.h +++ b/layout/xul/nsMenuBarFrame.h @@ -51,8 +51,9 @@ class nsMenuBarFrame final : public nsBoxFrame, public nsMenuParent { virtual bool IsActive() override { return mIsActive; } virtual bool IsMenu() override { return false; } virtual bool IsOpen() override { + // menubars are considered always open return true; - } // menubars are considered always open + } bool IsMenuOpen() { return mCurrentMenu && mCurrentMenu->IsOpen(); } diff --git a/layout/xul/nsMenuPopupFrame.h b/layout/xul/nsMenuPopupFrame.h index 450c58a66f4f..746c353dcd8f 100644 --- a/layout/xul/nsMenuPopupFrame.h +++ b/layout/xul/nsMenuPopupFrame.h @@ -188,8 +188,9 @@ class nsMenuPopupFrame final : public nsBoxFrame, void SetPopupState(nsPopupState aPopupState) { mPopupState = aPopupState; } NS_IMETHOD SetActive(bool aActiveFlag) override { + // We don't care. return NS_OK; - } // We don't care. + } virtual bool IsActive() override { return false; } virtual bool IsMenuBar() override { return false; } diff --git a/layout/xul/nsXULPopupManager.h b/layout/xul/nsXULPopupManager.h index 0a32863cae3d..2d7e5790c280 100644 --- a/layout/xul/nsXULPopupManager.h +++ b/layout/xul/nsXULPopupManager.h @@ -477,8 +477,8 @@ class nsXULPopupManager final : public nsIDOMEventListener, * aHideChain - true if the entire chain of menus should be closed. If false, * only this popup is closed. * aDeselectMenu - true if the parent

of the popup should be - * deselected. This will be false when the menu is closed by pressing the - * Escape key. + * deselected. This will be false when the menu is closed by + * pressing the Escape key. * aAsynchronous - true if the first popuphiding event should be sent * asynchrously. This should be true if HidePopup is called * from a frame. diff --git a/layout/xul/tree/nsTreeBodyFrame.h b/layout/xul/tree/nsTreeBodyFrame.h index ced65af4d215..f5ff8f1636e5 100644 --- a/layout/xul/tree/nsTreeBodyFrame.h +++ b/layout/xul/tree/nsTreeBodyFrame.h @@ -473,7 +473,7 @@ class nsTreeBodyFrame final : public nsLeafBoxFrame, * @param aEndRow the end index of invalidated rows, -1 means that columns * have been invalidated only * @param aStartCol the start invalidated column, nullptr means that only - * rows have been invalidated + * rows have been invalidated * @param aEndCol the end invalidated column, nullptr means that rows have * been invalidated only */