From c486e7014c2511e18843642826b58b43c9153d23 Mon Sep 17 00:00:00 2001 From: cku Date: Thu, 16 Mar 2017 15:18:10 +0800 Subject: [PATCH] Bug 1340044 - Part 2. Rename value in StyleGeometryBox. r=heycam This change is to use gecko_enum_prefix in helpers.mako.rs, so that we do not need to manually write code for nsStyleDisplay::mTransformBox. MozReview-Commit-ID: 7UAL0iUcSIO --HG-- extra : rebase_source : e99b7c163991df7ef3e7c0404fcef1832718a150 --- layout/base/nsLayoutUtils.cpp | 30 ++++++------ layout/generic/nsFloatManager.cpp | 8 ++-- layout/generic/nsFrame.cpp | 8 ++-- layout/painting/nsCSSRendering.cpp | 63 ++++++++++++------------ layout/painting/nsDisplayList.cpp | 6 +-- layout/style/Declaration.cpp | 4 +- layout/style/nsCSSParser.cpp | 6 +-- layout/style/nsCSSProps.cpp | 64 ++++++++++++------------- layout/style/nsComputedDOMStyle.cpp | 4 +- layout/style/nsRuleNode.cpp | 12 ++--- layout/style/nsStyleConsts.h | 20 ++++---- layout/style/nsStyleStruct.cpp | 8 ++-- layout/style/nsStyleTransformMatrix.cpp | 8 ++-- 13 files changed, 121 insertions(+), 120 deletions(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 845276543e13..0fc08ecb0226 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -6974,7 +6974,7 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame, const nsStyleBackground* bg = bgSC->StyleBackground(); if (NS_GET_A(bg->BackgroundColor(bgSC)) < 255 || // bottom layer's clip is used for the color - bg->BottomLayer().mClip != StyleGeometryBox::Border) + bg->BottomLayer().mClip != StyleGeometryBox::BorderBox) return eTransparencyTransparent; return eTransparencyOpaque; } @@ -9340,7 +9340,7 @@ ComputeSVGReferenceRect(nsIFrame* aFrame, // For SVG elements without associated CSS layout box, the used value for // content-box, padding-box, border-box and margin-box is fill-box. switch (aGeometryBox) { - case StyleGeometryBox::Stroke: { + case StyleGeometryBox::StrokeBox: { // XXX Bug 1299876 // The size of srtoke-box is not correct if this graphic element has // specific stroke-linejoin or stroke-linecap. @@ -9350,7 +9350,7 @@ ComputeSVGReferenceRect(nsIFrame* aFrame, nsPresContext::AppUnitsPerCSSPixel()); break; } - case StyleGeometryBox::View: { + case StyleGeometryBox::ViewBox: { nsIContent* content = aFrame->GetContent(); nsSVGElement* element = static_cast(content); SVGSVGElement* svgElement = element->GetCtx(); @@ -9381,11 +9381,11 @@ ComputeSVGReferenceRect(nsIFrame* aFrame, break; } case StyleGeometryBox::NoBox: - case StyleGeometryBox::Border: - case StyleGeometryBox::Content: - case StyleGeometryBox::Padding: - case StyleGeometryBox::Margin: - case StyleGeometryBox::Fill: { + case StyleGeometryBox::BorderBox: + case StyleGeometryBox::ContentBox: + case StyleGeometryBox::PaddingBox: + case StyleGeometryBox::MarginBox: + case StyleGeometryBox::FillBox: { gfxRect bbox = nsSVGUtils::GetBBox(aFrame, nsSVGUtils::eBBoxIncludeFill); r = nsLayoutUtils::RoundGfxRectToAppRect(bbox, @@ -9414,20 +9414,20 @@ ComputeHTMLReferenceRect(nsIFrame* aFrame, // For elements with associated CSS layout box, the used value for fill-box, // stroke-box and view-box is border-box. switch (aGeometryBox) { - case StyleGeometryBox::Content: + case StyleGeometryBox::ContentBox: r = aFrame->GetContentRectRelativeToSelf(); break; - case StyleGeometryBox::Padding: + case StyleGeometryBox::PaddingBox: r = aFrame->GetPaddingRectRelativeToSelf(); break; - case StyleGeometryBox::Margin: + case StyleGeometryBox::MarginBox: r = aFrame->GetMarginRectRelativeToSelf(); break; case StyleGeometryBox::NoBox: - case StyleGeometryBox::Border: - case StyleGeometryBox::Fill: - case StyleGeometryBox::Stroke: - case StyleGeometryBox::View: + case StyleGeometryBox::BorderBox: + case StyleGeometryBox::FillBox: + case StyleGeometryBox::StrokeBox: + case StyleGeometryBox::ViewBox: r = aFrame->GetRectRelativeToSelf(); break; default: diff --git a/layout/generic/nsFloatManager.cpp b/layout/generic/nsFloatManager.cpp index d4dc04ce8253..2831e33bb1f3 100644 --- a/layout/generic/nsFloatManager.cpp +++ b/layout/generic/nsFloatManager.cpp @@ -932,16 +932,16 @@ nsFloatManager::ShapeInfo::ComputeShapeBoxRect( LogicalRect rect = aMarginRect; switch (aShapeOutside.GetReferenceBox()) { - case StyleGeometryBox::Content: + case StyleGeometryBox::ContentBox: rect.Deflate(aWM, aFrame->GetLogicalUsedPadding(aWM)); MOZ_FALLTHROUGH; - case StyleGeometryBox::Padding: + case StyleGeometryBox::PaddingBox: rect.Deflate(aWM, aFrame->GetLogicalUsedBorder(aWM)); MOZ_FALLTHROUGH; - case StyleGeometryBox::Border: + case StyleGeometryBox::BorderBox: rect.Deflate(aWM, aFrame->GetLogicalUsedMargin(aWM)); break; - case StyleGeometryBox::Margin: + case StyleGeometryBox::MarginBox: // Do nothing. rect is already a margin rect. break; case StyleGeometryBox::NoBox: diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 81708412e0a7..94ff50a135a0 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1499,13 +1499,13 @@ nsIFrame::GetShapeBoxBorderRadii(nscoord aRadii[8]) const switch (StyleDisplay()->mShapeOutside.GetReferenceBox()) { case StyleGeometryBox::NoBox: return false; - case StyleGeometryBox::Content: + case StyleGeometryBox::ContentBox: return GetContentBoxBorderRadii(aRadii); - case StyleGeometryBox::Padding: + case StyleGeometryBox::PaddingBox: return GetPaddingBoxBorderRadii(aRadii); - case StyleGeometryBox::Border: + case StyleGeometryBox::BorderBox: return GetBorderRadii(aRadii); - case StyleGeometryBox::Margin: + case StyleGeometryBox::MarginBox: return GetMarginBoxBorderRadii(aRadii); default: MOZ_ASSERT_UNREACHABLE("Unexpected box value"); diff --git a/layout/painting/nsCSSRendering.cpp b/layout/painting/nsCSSRendering.cpp index 6daa02de7143..9502aa9d25e7 100644 --- a/layout/painting/nsCSSRendering.cpp +++ b/layout/painting/nsCSSRendering.cpp @@ -2018,17 +2018,18 @@ SetupDirtyRects(const nsRect& aBGClipArea, const nsRect& aCallerDirtyRect, static bool IsSVGStyleGeometryBox(StyleGeometryBox aBox) { - return (aBox == StyleGeometryBox::Fill || aBox == StyleGeometryBox::Stroke || - aBox == StyleGeometryBox::View); + return (aBox == StyleGeometryBox::FillBox || + aBox == StyleGeometryBox::StrokeBox || + aBox == StyleGeometryBox::ViewBox); } static bool IsHTMLStyleGeometryBox(StyleGeometryBox aBox) { - return (aBox == StyleGeometryBox::Content || - aBox == StyleGeometryBox::Padding || - aBox == StyleGeometryBox::Border || - aBox == StyleGeometryBox::Margin); + return (aBox == StyleGeometryBox::ContentBox || + aBox == StyleGeometryBox::PaddingBox || + aBox == StyleGeometryBox::BorderBox || + aBox == StyleGeometryBox::MarginBox); } static StyleGeometryBox @@ -2038,13 +2039,13 @@ ComputeBoxValue(nsIFrame* aForFrame, StyleGeometryBox aBox) // For elements with associated CSS layout box, the values fill-box, // stroke-box and view-box compute to the initial value of mask-clip. if (IsSVGStyleGeometryBox(aBox)) { - return StyleGeometryBox::Border; + return StyleGeometryBox::BorderBox; } } else { // For SVG elements without associated CSS layout box, the values // content-box, padding-box, border-box and margin-box compute to fill-box. if (IsHTMLStyleGeometryBox(aBox)) { - return StyleGeometryBox::Fill; + return StyleGeometryBox::FillBox; } } @@ -2088,9 +2089,9 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer, nsRect clipArea = nsLayoutUtils::ComputeGeometryBox(aForFrame, layerClip); - nsRect strokeBox = (layerClip == StyleGeometryBox::Stroke) + nsRect strokeBox = (layerClip == StyleGeometryBox::StrokeBox) ? clipArea - : nsLayoutUtils::ComputeGeometryBox(aForFrame, StyleGeometryBox::Stroke); + : nsLayoutUtils::ComputeGeometryBox(aForFrame, StyleGeometryBox::StrokeBox); nsRect clipAreaRelativeToStrokeBox = clipArea - strokeBox.TopLeft(); // aBorderArea is the stroke-box area in a coordinate space defined by @@ -2135,13 +2136,13 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer, bool isSolidBorder = aWillPaintBorder && IsOpaqueBorder(aBorder); - if (isSolidBorder && layerClip == StyleGeometryBox::Border) { + if (isSolidBorder && layerClip == StyleGeometryBox::BorderBox) { // If we have rounded corners, we need to inflate the background // drawing area a bit to avoid seams between the border and // background. layerClip = haveRoundedCorners ? StyleGeometryBox::MozAlmostPadding - : StyleGeometryBox::Padding; + : StyleGeometryBox::PaddingBox; } aClipState->mBGClipArea = clipBorderArea; @@ -2155,7 +2156,7 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer, // but the background is also clipped at a non-scrolling 'padding-box' // like the content. (See below.) // Therefore, only 'content-box' makes a difference here. - if (layerClip == StyleGeometryBox::Content) { + if (layerClip == StyleGeometryBox::ContentBox) { nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame); // Clip at a rectangle attached to the scrolled content. aClipState->mHasAdditionalBGClipArea = true; @@ -2175,7 +2176,7 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer, // Also clip at a non-scrolling, rounded-corner 'padding-box', // same as the scrolled content because of the 'overflow' property. - layerClip = StyleGeometryBox::Padding; + layerClip = StyleGeometryBox::PaddingBox; } // See the comment of StyleGeometryBox::Margin. @@ -2183,10 +2184,10 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer, // positioned mask from CSS parser and style system. In this case, you // should *inflate* mBGClipArea by the margin returning from // aForFrame->GetUsedMargin() in the code chunk bellow. - MOZ_ASSERT(layerClip != StyleGeometryBox::Margin, - "StyleGeometryBox::Margin rendering is not supported yet.\n"); + MOZ_ASSERT(layerClip != StyleGeometryBox::MarginBox, + "StyleGeometryBox::MarginBox rendering is not supported yet.\n"); - if (layerClip != StyleGeometryBox::Border && + if (layerClip != StyleGeometryBox::BorderBox && layerClip != StyleGeometryBox::Text) { nsMargin border = aForFrame->GetUsedBorder(); if (layerClip == StyleGeometryBox::MozAlmostPadding) { @@ -2197,8 +2198,8 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer, border.right = std::max(0, border.right - aAppUnitsPerPixel); border.bottom = std::max(0, border.bottom - aAppUnitsPerPixel); border.left = std::max(0, border.left - aAppUnitsPerPixel); - } else if (layerClip != StyleGeometryBox::Padding) { - NS_ASSERTION(layerClip == StyleGeometryBox::Content, + } else if (layerClip != StyleGeometryBox::PaddingBox) { + NS_ASSERTION(layerClip == StyleGeometryBox::ContentBox, "unexpected background-clip"); border += aForFrame->GetUsedPadding(); } @@ -3527,7 +3528,7 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams, skipSides, &aBorder); DrawResult result = DrawResult::SUCCESS; - StyleGeometryBox currentBackgroundClip = StyleGeometryBox::Border; + StyleGeometryBox currentBackgroundClip = StyleGeometryBox::BorderBox; uint32_t count = drawAllLayers ? layers.mImageCount // iterate all image layers. : layers.mImageCount - aParams.layer; // iterate from the bottom layer to @@ -3629,10 +3630,10 @@ nsCSSRendering::ComputeImageLayerPositioningArea(nsPresContext* aPresContext, nsLayoutUtils::ComputeGeometryBox(aForFrame, layerOrigin); nsPoint toStrokeBoxOffset = nsPoint(0, 0); - if (layerOrigin != StyleGeometryBox::Stroke) { + if (layerOrigin != StyleGeometryBox::StrokeBox) { nsRect strokeBox = nsLayoutUtils::ComputeGeometryBox(aForFrame, - StyleGeometryBox::Stroke); + StyleGeometryBox::StrokeBox); toStrokeBoxOffset = positionArea.TopLeft() - strokeBox.TopLeft(); } @@ -3656,16 +3657,16 @@ nsCSSRendering::ComputeImageLayerPositioningArea(nsPresContext* aPresContext, // The ScrolledRect’s size does not include the borders or scrollbars, // reverse the handling of background-origin // compared to the common case below. - if (layerOrigin == StyleGeometryBox::Border) { + if (layerOrigin == StyleGeometryBox::BorderBox) { nsMargin border = geometryFrame->GetUsedBorder(); border.ApplySkipSides(geometryFrame->GetSkipSides()); positionArea.Inflate(border); positionArea.Inflate(scrollableFrame->GetActualScrollbarSizes()); - } else if (layerOrigin != StyleGeometryBox::Padding) { + } else if (layerOrigin != StyleGeometryBox::PaddingBox) { nsMargin padding = geometryFrame->GetUsedPadding(); padding.ApplySkipSides(geometryFrame->GetSkipSides()); positionArea.Deflate(padding); - NS_ASSERTION(layerOrigin == StyleGeometryBox::Content, + NS_ASSERTION(layerOrigin == StyleGeometryBox::ContentBox, "unknown background-origin value"); } *aAttachedToFrame = aForFrame; @@ -3685,22 +3686,22 @@ nsCSSRendering::ComputeImageLayerPositioningArea(nsPresContext* aPresContext, positionArea = nsRect(nsPoint(0,0), aBorderArea.Size()); } - // See the comment of StyleGeometryBox::Margin. + // See the comment of StyleGeometryBox::MarginBox. // Hitting this assertion means we decide to turn on margin-box support for // positioned mask from CSS parser and style system. In this case, you // should *inflate* positionArea by the margin returning from // geometryFrame->GetUsedMargin() in the code chunk bellow. - MOZ_ASSERT(aLayer.mOrigin != StyleGeometryBox::Margin, - "StyleGeometryBox::Margin rendering is not supported yet.\n"); + MOZ_ASSERT(aLayer.mOrigin != StyleGeometryBox::MarginBox, + "StyleGeometryBox::MarginBox rendering is not supported yet.\n"); // {background|mask} images are tiled over the '{background|mask}-clip' area // but the origin of the tiling is based on the '{background|mask}-origin' // area. - if (layerOrigin != StyleGeometryBox::Border && geometryFrame) { + if (layerOrigin != StyleGeometryBox::BorderBox && geometryFrame) { nsMargin border = geometryFrame->GetUsedBorder(); - if (layerOrigin != StyleGeometryBox::Padding) { + if (layerOrigin != StyleGeometryBox::PaddingBox) { border += geometryFrame->GetUsedPadding(); - NS_ASSERTION(layerOrigin == StyleGeometryBox::Content, + NS_ASSERTION(layerOrigin == StyleGeometryBox::ContentBox, "unknown background-origin value"); } positionArea.Deflate(border); diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 2ddca741dc09..f181763065e7 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -3393,10 +3393,10 @@ nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem, if (frame->GetType() == nsGkAtoms::canvasFrame) { nsCanvasFrame* canvasFrame = static_cast(frame); clipRect = canvasFrame->CanvasArea() + aItem->ToReferenceFrame(); - } else if (aClip == StyleGeometryBox::Padding || - aClip == StyleGeometryBox::Content) { + } else if (aClip == StyleGeometryBox::PaddingBox || + aClip == StyleGeometryBox::ContentBox) { nsMargin border = frame->GetUsedBorder(); - if (aClip == StyleGeometryBox::Content) { + if (aClip == StyleGeometryBox::ContentBox) { border += frame->GetUsedPadding(); } border.ApplySkipSides(frame->GetSkipSides()); diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index a9e0187b62d0..bac5bec358a6 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -404,9 +404,9 @@ Declaration::GetImageLayerValue( StyleGeometryBox originDefaultValue = (aTable == nsStyleImageLayers::kBackgroundLayerTable) - ? StyleGeometryBox::Padding : StyleGeometryBox::Border; + ? StyleGeometryBox::PaddingBox : StyleGeometryBox::BorderBox; if (static_cast(clip->mValue.GetIntValue()) != - StyleGeometryBox::Border || + StyleGeometryBox::BorderBox || static_cast(origin->mValue.GetIntValue()) != originDefaultValue) { #ifdef DEBUG diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 6d9ed6a01bf9..9fce7d049cc7 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -12220,7 +12220,7 @@ CSSParserImpl::ParseImageLayersItem( aState.mImage->mValue.SetNoneValue(); aState.mAttachment->mValue.SetIntValue(NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL, eCSSUnit_Enumerated); - aState.mClip->mValue.SetEnumValue(StyleGeometryBox::Border); + aState.mClip->mValue.SetEnumValue(StyleGeometryBox::BorderBox); aState.mRepeat->mXValue.SetIntValue(NS_STYLE_IMAGELAYER_REPEAT_REPEAT, eCSSUnit_Enumerated); @@ -12232,9 +12232,9 @@ CSSParserImpl::ParseImageLayersItem( aState.mPositionY->mValue.SetArrayValue(positionYArr, eCSSUnit_Array); if (eCSSProperty_mask == aTable[nsStyleImageLayers::shorthand]) { - aState.mOrigin->mValue.SetEnumValue(StyleGeometryBox::Border); + aState.mOrigin->mValue.SetEnumValue(StyleGeometryBox::BorderBox); } else { - aState.mOrigin->mValue.SetEnumValue(StyleGeometryBox::Padding); + aState.mOrigin->mValue.SetEnumValue(StyleGeometryBox::PaddingBox); } positionXArr->Item(1).SetPercentValue(0.0f); positionYArr->Item(1).SetPercentValue(0.0f); diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 6dddf64d9a0c..97beafbbf45a 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -890,16 +890,16 @@ const KTableEntry nsCSSProps::kImageLayerAttachmentKTable[] = { }; const KTableEntry nsCSSProps::kBackgroundOriginKTable[] = { - { eCSSKeyword_border_box, StyleGeometryBox::Border }, - { eCSSKeyword_padding_box, StyleGeometryBox::Padding }, - { eCSSKeyword_content_box, StyleGeometryBox::Content }, + { eCSSKeyword_border_box, StyleGeometryBox::BorderBox }, + { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox }, + { eCSSKeyword_content_box, StyleGeometryBox::ContentBox }, { eCSSKeyword_UNKNOWN, -1 } }; KTableEntry nsCSSProps::kBackgroundClipKTable[] = { - { eCSSKeyword_border_box, StyleGeometryBox::Border }, - { eCSSKeyword_padding_box, StyleGeometryBox::Padding }, - { eCSSKeyword_content_box, StyleGeometryBox::Content }, + { eCSSKeyword_border_box, StyleGeometryBox::BorderBox }, + { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox }, + { eCSSKeyword_content_box, StyleGeometryBox::ContentBox }, // The next entry is controlled by the layout.css.background-clip-text.enabled // pref. { eCSSKeyword_text, StyleGeometryBox::Text }, @@ -907,22 +907,22 @@ KTableEntry nsCSSProps::kBackgroundClipKTable[] = { }; const KTableEntry nsCSSProps::kMaskOriginKTable[] = { - { eCSSKeyword_border_box, StyleGeometryBox::Border }, - { eCSSKeyword_padding_box, StyleGeometryBox::Padding }, - { eCSSKeyword_content_box, StyleGeometryBox::Content }, - { eCSSKeyword_fill_box, StyleGeometryBox::Fill }, - { eCSSKeyword_stroke_box, StyleGeometryBox::Stroke }, - { eCSSKeyword_view_box, StyleGeometryBox::View }, + { eCSSKeyword_border_box, StyleGeometryBox::BorderBox }, + { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox }, + { eCSSKeyword_content_box, StyleGeometryBox::ContentBox }, + { eCSSKeyword_fill_box, StyleGeometryBox::FillBox }, + { eCSSKeyword_stroke_box, StyleGeometryBox::StrokeBox }, + { eCSSKeyword_view_box, StyleGeometryBox::ViewBox }, { eCSSKeyword_UNKNOWN, -1 } }; const KTableEntry nsCSSProps::kMaskClipKTable[] = { - { eCSSKeyword_border_box, StyleGeometryBox::Border }, - { eCSSKeyword_padding_box, StyleGeometryBox::Padding }, - { eCSSKeyword_content_box, StyleGeometryBox::Content }, - { eCSSKeyword_fill_box, StyleGeometryBox::Fill }, - { eCSSKeyword_stroke_box, StyleGeometryBox::Stroke }, - { eCSSKeyword_view_box, StyleGeometryBox::View }, + { eCSSKeyword_border_box, StyleGeometryBox::BorderBox }, + { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox }, + { eCSSKeyword_content_box, StyleGeometryBox::ContentBox }, + { eCSSKeyword_fill_box, StyleGeometryBox::FillBox }, + { eCSSKeyword_stroke_box, StyleGeometryBox::StrokeBox }, + { eCSSKeyword_view_box, StyleGeometryBox::ViewBox }, { eCSSKeyword_no_clip, StyleGeometryBox::NoClip }, { eCSSKeyword_UNKNOWN, -1 } }; @@ -2106,9 +2106,9 @@ const KTableEntry nsCSSProps::kTopLayerKTable[] = { }; const KTableEntry nsCSSProps::kTransformBoxKTable[] = { - { eCSSKeyword_border_box, StyleGeometryBox::Border }, - { eCSSKeyword_fill_box, StyleGeometryBox::Fill }, - { eCSSKeyword_view_box, StyleGeometryBox::View }, + { eCSSKeyword_border_box, StyleGeometryBox::BorderBox }, + { eCSSKeyword_fill_box, StyleGeometryBox::FillBox }, + { eCSSKeyword_view_box, StyleGeometryBox::ViewBox }, { eCSSKeyword_UNKNOWN, -1 } }; @@ -2314,13 +2314,13 @@ const KTableEntry nsCSSProps::kFillRuleKTable[] = { }; const KTableEntry nsCSSProps::kClipPathGeometryBoxKTable[] = { - { eCSSKeyword_content_box, StyleGeometryBox::Content }, - { eCSSKeyword_padding_box, StyleGeometryBox::Padding }, - { eCSSKeyword_border_box, StyleGeometryBox::Border }, - { eCSSKeyword_margin_box, StyleGeometryBox::Margin }, - { eCSSKeyword_fill_box, StyleGeometryBox::Fill }, - { eCSSKeyword_stroke_box, StyleGeometryBox::Stroke }, - { eCSSKeyword_view_box, StyleGeometryBox::View }, + { eCSSKeyword_content_box, StyleGeometryBox::ContentBox }, + { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox }, + { eCSSKeyword_border_box, StyleGeometryBox::BorderBox }, + { eCSSKeyword_margin_box, StyleGeometryBox::MarginBox }, + { eCSSKeyword_fill_box, StyleGeometryBox::FillBox }, + { eCSSKeyword_stroke_box, StyleGeometryBox::StrokeBox }, + { eCSSKeyword_view_box, StyleGeometryBox::ViewBox }, { eCSSKeyword_UNKNOWN, -1 } }; @@ -2359,10 +2359,10 @@ const KTableEntry nsCSSProps::kMaskTypeKTable[] = { }; const KTableEntry nsCSSProps::kShapeOutsideShapeBoxKTable[] = { - { eCSSKeyword_content_box, StyleGeometryBox::Content }, - { eCSSKeyword_padding_box, StyleGeometryBox::Padding }, - { eCSSKeyword_border_box, StyleGeometryBox::Border }, - { eCSSKeyword_margin_box, StyleGeometryBox::Margin }, + { eCSSKeyword_content_box, StyleGeometryBox::ContentBox }, + { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox }, + { eCSSKeyword_border_box, StyleGeometryBox::BorderBox }, + { eCSSKeyword_margin_box, StyleGeometryBox::MarginBox }, { eCSSKeyword_UNKNOWN, -1 } }; diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 9dbe3064270c..d93947427474 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -6338,8 +6338,8 @@ nsComputedDOMStyle::DoGetMask() // need to support computed style for the cases where it used to be // a longhand. if (svg->mMask.mImageCount > 1 || - firstLayer.mClip != StyleGeometryBox::Border || - firstLayer.mOrigin != StyleGeometryBox::Border || + firstLayer.mClip != StyleGeometryBox::BorderBox || + firstLayer.mOrigin != StyleGeometryBox::BorderBox || firstLayer.mComposite != NS_STYLE_MASK_COMPOSITE_ADD || firstLayer.mMaskMode != NS_STYLE_MASK_MODE_MATCH_SOURCE || !nsStyleImageLayers::IsInitialPositionForLayerType( diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 3df8000d9057..6ccda305127e 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -1456,7 +1456,7 @@ struct SetEnumValueHelper DEFINE_ENUM_CLASS_SETTER(StyleUserModify, ReadOnly, WriteOnly) DEFINE_ENUM_CLASS_SETTER(StyleWindowDragging, Default, NoDrag) DEFINE_ENUM_CLASS_SETTER(StyleOrient, Inline, Vertical) - DEFINE_ENUM_CLASS_SETTER(StyleGeometryBox, Border, View) + DEFINE_ENUM_CLASS_SETTER(StyleGeometryBox, BorderBox, ViewBox) #ifdef MOZ_XUL DEFINE_ENUM_CLASS_SETTER(StyleDisplay, None, MozPopup) #else @@ -6615,7 +6615,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, display->mTransformBox, conditions, SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL, parentDisplay->mTransformBox, - StyleGeometryBox::Border); + StyleGeometryBox::BorderBox); // orient: enum, inherit, initial SetValue(*aRuleData->ValueForOrient(), @@ -7463,7 +7463,7 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct, bg->mImage.mLayers, parentBG->mImage.mLayers, &nsStyleImageLayers::Layer::mClip, - StyleGeometryBox::Border, + StyleGeometryBox::BorderBox, parentBG->mImage.mClipCount, bg->mImage.mClipCount, maxItemCount, rebuild, conditions); @@ -7482,7 +7482,7 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct, bg->mImage.mLayers, parentBG->mImage.mLayers, &nsStyleImageLayers::Layer::mOrigin, - StyleGeometryBox::Padding, + StyleGeometryBox::PaddingBox, parentBG->mImage.mOriginCount, bg->mImage.mOriginCount, maxItemCount, rebuild, conditions); @@ -10103,7 +10103,7 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct, svgReset->mMask.mLayers, parentSVGReset->mMask.mLayers, &nsStyleImageLayers::Layer::mClip, - StyleGeometryBox::Border, + StyleGeometryBox::BorderBox, parentSVGReset->mMask.mClipCount, svgReset->mMask.mClipCount, maxItemCount, rebuild, conditions); @@ -10113,7 +10113,7 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct, svgReset->mMask.mLayers, parentSVGReset->mMask.mLayers, &nsStyleImageLayers::Layer::mOrigin, - StyleGeometryBox::Border, + StyleGeometryBox::BorderBox, parentSVGReset->mMask.mOriginCount, svgReset->mMask.mOriginCount, maxItemCount, rebuild, conditions); diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index beeb09a8e8be..99541d7b5ad0 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -87,16 +87,16 @@ enum class StyleClear : uint8_t { // Define geometry box for clip-path's reference-box, background-clip, // background-origin, mask-clip, mask-origin, shape-box and transform-box. enum class StyleGeometryBox : uint8_t { - Content, // Used by everything, except transform-box. - Padding, // Used by everything, except transform-box. - Border, - Margin, // XXX Bug 1260094 comment 9. - // Although margin-box is required by mask-origin and mask-clip, we - // do not implement that due to lack of support in other browsers. - // clip-path reference-box only. - Fill, // Used by everything, except shape-box. - Stroke, // mask-clip, mask-origin and clip-path reference-box only. - View, // Used by everything, except shape-box. + ContentBox, // Used by everything, except transform-box. + PaddingBox, // Used by everything, except transform-box. + BorderBox, + MarginBox, // XXX Bug 1260094 comment 9. + // Although margin-box is required by mask-origin and mask-clip, + // we do not implement that due to lack of support in other + // browsers. clip-path reference-box only. + FillBox, // Used by everything, except shape-box. + StrokeBox, // mask-clip, mask-origin and clip-path reference-box only. + ViewBox, // Used by everything, except shape-box. NoClip, // mask-clip only. Text, // background-clip only. NoBox, // Depending on which kind of element this style value applied on, diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 5788dc5edb69..007df3cdfbbe 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -2901,7 +2901,7 @@ nsStyleImageLayers::Size::operator==(const Size& aOther) const } nsStyleImageLayers::Layer::Layer() - : mClip(StyleGeometryBox::Border) + : mClip(StyleGeometryBox::BorderBox) , mAttachment(NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL) , mBlendMode(NS_STYLE_BLEND_NORMAL) , mComposite(NS_STYLE_MASK_COMPOSITE_ADD) @@ -2923,10 +2923,10 @@ nsStyleImageLayers::Layer::Initialize(nsStyleImageLayers::LayerType aType) mPosition.SetInitialPercentValues(0.0f); if (aType == LayerType::Background) { - mOrigin = StyleGeometryBox::Padding; + mOrigin = StyleGeometryBox::PaddingBox; } else { MOZ_ASSERT(aType == LayerType::Mask, "unsupported layer type."); - mOrigin = StyleGeometryBox::Border; + mOrigin = StyleGeometryBox::BorderBox; } } @@ -3269,7 +3269,7 @@ nsStyleDisplay::nsStyleDisplay(const nsPresContext* aContext) , mScrollSnapPointsY(eStyleUnit_None) , mBackfaceVisibility(NS_STYLE_BACKFACE_VISIBILITY_VISIBLE) , mTransformStyle(NS_STYLE_TRANSFORM_STYLE_FLAT) - , mTransformBox(StyleGeometryBox::Border) + , mTransformBox(StyleGeometryBox::BorderBox) , mSpecifiedTransform(nullptr) , mTransformOrigin{ {0.5f, eStyleUnit_Percent}, // Transform is centered on origin {0.5f, eStyleUnit_Percent}, diff --git a/layout/style/nsStyleTransformMatrix.cpp b/layout/style/nsStyleTransformMatrix.cpp index 68102f600659..f9535d8f5b31 100644 --- a/layout/style/nsStyleTransformMatrix.cpp +++ b/layout/style/nsStyleTransformMatrix.cpp @@ -58,12 +58,12 @@ TransformReferenceBox::EnsureDimensionsAreCached() mWidth = nsPresContext::CSSPixelsToAppUnits(contextSize.width); mHeight = nsPresContext::CSSPixelsToAppUnits(contextSize.height); } else - if (mFrame->StyleDisplay()->mTransformBox == StyleGeometryBox::Fill) { + if (mFrame->StyleDisplay()->mTransformBox == StyleGeometryBox::FillBox) { // Percentages in transforms resolve against the SVG bbox, and the // transform is relative to the top-left of the SVG bbox. nsRect bboxInAppUnits = nsLayoutUtils::ComputeGeometryBox(const_cast(mFrame), - StyleGeometryBox::Fill); + StyleGeometryBox::FillBox); // The mRect of an SVG nsIFrame is its user space bounds *including* // stroke and markers, whereas bboxInAppUnits is its user space bounds // including fill only. We need to note the offset of the reference box @@ -75,9 +75,9 @@ TransformReferenceBox::EnsureDimensionsAreCached() } else { // The value 'border-box' is treated as 'view-box' for SVG content. MOZ_ASSERT(mFrame->StyleDisplay()->mTransformBox == - StyleGeometryBox::View || + StyleGeometryBox::ViewBox || mFrame->StyleDisplay()->mTransformBox == - StyleGeometryBox::Border, + StyleGeometryBox::BorderBox, "Unexpected value for 'transform-box'"); // Percentages in transforms resolve against the width/height of the // nearest viewport (or its viewBox if one is applied), and the