Bug 1288626 Part 7 - Rename StyleClipShapeSizing to StyleClipPathGeometryBox. r=heycam
Change to geometry box to match the name in the spec.
https://drafts.fxtf.org/css-masking-1/#the-clip-path
MozReview-Commit-ID: 8jDTynCkJ4A
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -16173,33 +16173,33 @@ bool CSSParserImpl::ParseClipPath()
if (!nsLayoutUtils::CSSClipPathShapesEnabled()) {
// With CSS Clip Path Shapes disabled, we should only accept
// SVG clipPath reference and none.
REPORT_UNEXPECTED_TOKEN(PEExpectedNoneOrURL);
return false;
}
nsCSSValue referenceBox;
- bool hasBox = ParseEnum(referenceBox, nsCSSProps::kClipShapeSizingKTable);
+ bool hasBox = ParseEnum(referenceBox, nsCSSProps::kClipPathGeometryBoxKTable);
const bool boxCameFirst = hasBox;
nsCSSValue basicShape;
bool basicShapeConsumedTokens = false;
bool hasShape = ParseBasicShape(basicShape, &basicShapeConsumedTokens);
// Parsing wasn't successful if ParseBasicShape consumed tokens but failed
// or if the token was neither a reference box nor a basic shape.
if ((!hasShape && basicShapeConsumedTokens) || (!hasBox && !hasShape)) {
return false;
}
// Check if the second argument is a reference box if the first wasn't.
if (!hasBox) {
- hasBox = ParseEnum(referenceBox, nsCSSProps::kClipShapeSizingKTable);
+ hasBox = ParseEnum(referenceBox, nsCSSProps::kClipPathGeometryBoxKTable);
}
RefPtr<nsCSSValue::Array> fullValue =
nsCSSValue::Array::Create((hasBox && hasShape) ? 2 : 1);
if (hasBox && hasShape) {
fullValue->Item(boxCameFirst ? 0 : 1) = referenceBox;
fullValue->Item(boxCameFirst ? 1 : 0) = basicShape;
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -2291,25 +2291,25 @@ const KTableEntry nsCSSProps::kDominantB
};
const KTableEntry nsCSSProps::kFillRuleKTable[] = {
{ eCSSKeyword_nonzero, NS_STYLE_FILL_RULE_NONZERO },
{ eCSSKeyword_evenodd, NS_STYLE_FILL_RULE_EVENODD },
{ eCSSKeyword_UNKNOWN, -1 }
};
-const KTableEntry nsCSSProps::kClipShapeSizingKTable[] = {
- { eCSSKeyword_content_box, StyleClipShapeSizing::Content },
- { eCSSKeyword_padding_box, StyleClipShapeSizing::Padding },
- { eCSSKeyword_border_box, StyleClipShapeSizing::Border },
- { eCSSKeyword_margin_box, StyleClipShapeSizing::Margin },
- { eCSSKeyword_fill_box, StyleClipShapeSizing::Fill },
- { eCSSKeyword_stroke_box, StyleClipShapeSizing::Stroke },
- { eCSSKeyword_view_box, StyleClipShapeSizing::View },
- { eCSSKeyword_UNKNOWN, -1 }
+const KTableEntry nsCSSProps::kClipPathGeometryBoxKTable[] = {
+ { eCSSKeyword_content_box, StyleClipPathGeometryBox::Content },
+ { eCSSKeyword_padding_box, StyleClipPathGeometryBox::Padding },
+ { eCSSKeyword_border_box, StyleClipPathGeometryBox::Border },
+ { eCSSKeyword_margin_box, StyleClipPathGeometryBox::Margin },
+ { eCSSKeyword_fill_box, StyleClipPathGeometryBox::Fill },
+ { eCSSKeyword_stroke_box, StyleClipPathGeometryBox::Stroke },
+ { eCSSKeyword_view_box, StyleClipPathGeometryBox::View },
+ { eCSSKeyword_UNKNOWN, -1 }
};
const KTableEntry nsCSSProps::kShapeRadiusKTable[] = {
{ eCSSKeyword_closest_side, NS_RADIUS_CLOSEST_SIDE },
{ eCSSKeyword_farthest_side, NS_RADIUS_FARTHEST_SIDE },
{ eCSSKeyword_UNKNOWN, -1 }
};
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -727,17 +727,17 @@ public:
static const KTableEntry kBorderImageSliceKTable[];
static const KTableEntry kBorderStyleKTable[];
static const KTableEntry kBorderWidthKTable[];
static const KTableEntry kBoxAlignKTable[];
static const KTableEntry kBoxDecorationBreakKTable[];
static const KTableEntry kBoxDirectionKTable[];
static const KTableEntry kBoxOrientKTable[];
static const KTableEntry kBoxPackKTable[];
- static const KTableEntry kClipShapeSizingKTable[];
+ static const KTableEntry kClipPathGeometryBoxKTable[];
static const KTableEntry kCounterRangeKTable[];
static const KTableEntry kCounterSpeakAsKTable[];
static const KTableEntry kCounterSymbolsSystemKTable[];
static const KTableEntry kCounterSystemKTable[];
static const KTableEntry kDominantBaselineKTable[];
static const KTableEntry kShapeRadiusKTable[];
static const KTableEntry kFillRuleKTable[];
static const KTableEntry kFilterFunctionKTable[];
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -1419,17 +1419,17 @@ nsCSSValue::AppendToString(nsCSSProperty
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
NS_STYLE_TOUCH_ACTION_NONE,
NS_STYLE_TOUCH_ACTION_MANIPULATION,
aResult);
break;
case eCSSProperty_clip_path:
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue,
- nsCSSProps::kClipShapeSizingKTable),
+ nsCSSProps::kClipPathGeometryBoxKTable),
aResult);
break;
case eCSSProperty_contain:
if (intValue & NS_STYLE_CONTAIN_STRICT) {
NS_ASSERTION(intValue == (NS_STYLE_CONTAIN_STRICT | NS_STYLE_CONTAIN_ALL_BITS),
"contain: strict should imply contain: layout style paint");
// Only output strict.
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -5992,32 +5992,32 @@ nsComputedDOMStyle::CreatePrimitiveValue
RefPtr<nsROCSSPrimitiveValue> functionValue = new nsROCSSPrimitiveValue;
functionValue->SetString(shapeFunctionString);
return functionValue.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::CreatePrimitiveValueForClipPath(
const StyleBasicShape* aStyleBasicShape,
- StyleClipShapeSizing aSizingBox)
+ StyleClipPathGeometryBox aSizingBox)
{
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
if (aStyleBasicShape) {
valueList->AppendCSSValue(
CreatePrimitiveValueForBasicShape(aStyleBasicShape));
}
- if (aSizingBox == StyleClipShapeSizing::NoBox) {
+ if (aSizingBox == StyleClipPathGeometryBox::NoBox) {
return valueList.forget();
}
nsAutoString boxString;
AppendASCIItoUTF16(
nsCSSProps::ValueToKeyword(aSizingBox,
- nsCSSProps::kClipShapeSizingKTable),
+ nsCSSProps::kClipPathGeometryBoxKTable),
boxString);
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetString(boxString);
valueList->AppendCSSValue(val.forget());
return valueList.forget();
}
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -642,17 +642,17 @@ private:
/* Helper functions for computing the filter property style. */
void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord);
already_AddRefed<CSSValue> CreatePrimitiveValueForStyleFilter(
const nsStyleFilter& aStyleFilter);
already_AddRefed<CSSValue> CreatePrimitiveValueForClipPath(
const mozilla::StyleBasicShape* aStyleBasicShape,
- mozilla::StyleClipShapeSizing aSizingBox);
+ mozilla::StyleClipPathGeometryBox aSizingBox);
// Helper function for computing basic shape styles.
already_AddRefed<CSSValue> CreatePrimitiveValueForBasicShape(
const mozilla::StyleBasicShape* aStyleBasicShape);
void BoxValuesToString(nsAString& aString,
const nsTArray<nsStyleCoord>& aBoxValues);
void BasicShapeRadiiToString(nsAString& aCssText,
const nsStyleCorners& aCorners);
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -9739,27 +9739,27 @@ SetStyleClipPathToCSSValue(StyleClipPath
{
MOZ_ASSERT(aValue->GetUnit() == eCSSUnit_Array,
"expected a basic shape or reference box");
const nsCSSValue::Array* array = aValue->GetArrayValue();
MOZ_ASSERT(array->Count() == 1 || array->Count() == 2,
"Expect one or both of a shape function and geometry-box");
- StyleClipShapeSizing sizingBox = StyleClipShapeSizing::NoBox;
+ StyleClipPathGeometryBox sizingBox = StyleClipPathGeometryBox::NoBox;
RefPtr<StyleBasicShape> basicShape;
for (size_t i = 0; i < array->Count(); ++i) {
if (array->Item(i).GetUnit() == eCSSUnit_Enumerated) {
int32_t type = array->Item(i).GetIntValue();
- if (type > uint8_t(StyleClipShapeSizing::View) ||
- type < uint8_t(StyleClipShapeSizing::NoBox)) {
+ if (type > uint8_t(StyleClipPathGeometryBox::View) ||
+ type < uint8_t(StyleClipPathGeometryBox::NoBox)) {
NS_NOTREACHED("unexpected reference box");
return;
}
- sizingBox = static_cast<StyleClipShapeSizing>(type);
+ sizingBox = static_cast<StyleClipPathGeometryBox>(type);
} else if (array->Item(i).GetUnit() == eCSSUnit_Function) {
basicShape = GetStyleBasicShapeFromCSSValue(array->Item(i), aStyleContext,
aPresContext, aConditions);
} else {
NS_NOTREACHED("unexpected value");
return;
}
}
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -68,18 +68,18 @@ enum class StyleBoxSizing : uint8_t {
Border
};
// box-shadow
enum class StyleBoxShadowType : uint8_t {
Inset,
};
-// clip-path sizing
-enum class StyleClipShapeSizing : uint8_t {
+// clip-path geometry box
+enum class StyleClipPathGeometryBox : uint8_t {
NoBox,
Content,
Padding,
Border,
Margin,
Fill,
Stroke,
View,
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -3683,17 +3683,17 @@ private:
union {
StyleBasicShape* mBasicShape;
FragmentOrURL* mURL;
};
StyleShapeSourceType mType = StyleShapeSourceType::None_;
ReferenceBox mReferenceBox = ReferenceBox::NoBox;
};
-using StyleClipPath = StyleShapeSource<StyleClipShapeSizing>;
+using StyleClipPath = StyleShapeSource<StyleClipPathGeometryBox>;
} // namespace mozilla
struct nsStyleFilter
{
nsStyleFilter();
nsStyleFilter(const nsStyleFilter& aSource);
~nsStyleFilter();
--- a/layout/svg/nsCSSClipPathInstance.cpp
+++ b/layout/svg/nsCSSClipPathInstance.cpp
@@ -63,23 +63,23 @@ nsCSSClipPathInstance::HitTestBasicShape
}
already_AddRefed<Path>
nsCSSClipPathInstance::CreateClipPath(DrawTarget* aDrawTarget)
{
nsRect r;
// XXXkrit SVG needs to use different boxes.
switch (mClipPathStyle.GetReferenceBox()) {
- case StyleClipShapeSizing::Content:
+ case StyleClipPathGeometryBox::Content:
r = mTargetFrame->GetContentRectRelativeToSelf();
break;
- case StyleClipShapeSizing::Padding:
+ case StyleClipPathGeometryBox::Padding:
r = mTargetFrame->GetPaddingRectRelativeToSelf();
break;
- case StyleClipShapeSizing::Margin:
+ case StyleClipPathGeometryBox::Margin:
r = mTargetFrame->GetMarginRectRelativeToSelf();
break;
default: // Use the border box
r = mTargetFrame->GetRectRelativeToSelf();
}
if (mClipPathStyle.GetType() != StyleShapeSourceType::Shape) {
// TODO Clip to border-radius/reference box if no shape