зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1287755 - Replace NS_STYLE_CLIP_SHAPE_SIZING_* with an enum class; r=heycam
MozReview-Commit-ID: KutLb8H9JOk --HG-- extra : rebase_source : ae38fcb7ebc8c6d5a8c77c773c8706580e41040c
This commit is contained in:
Родитель
5f7ab9c8f9
Коммит
8add405354
|
@ -3573,7 +3573,8 @@ StyleClipBasicShapeToCSSArray(const nsStyleClipPath& aClipPath,
|
||||||
MOZ_ASSERT_UNREACHABLE("Unknown shape type");
|
MOZ_ASSERT_UNREACHABLE("Unknown shape type");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
aResult->Item(1).SetIntValue(aClipPath.GetSizingBox(), eCSSUnit_Enumerated);
|
aResult->Item(1).SetIntValue(uint8_t(aClipPath.GetSizingBox()),
|
||||||
|
eCSSUnit_Enumerated);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3963,7 +3964,8 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty,
|
||||||
result->SetURLValue(url);
|
result->SetURLValue(url);
|
||||||
aComputedValue.SetAndAdoptCSSValueValue(result.release(), eUnit_URL);
|
aComputedValue.SetAndAdoptCSSValueValue(result.release(), eUnit_URL);
|
||||||
} else if (type == NS_STYLE_CLIP_PATH_BOX) {
|
} else if (type == NS_STYLE_CLIP_PATH_BOX) {
|
||||||
aComputedValue.SetIntValue(clipPath.GetSizingBox(), eUnit_Enumerated);
|
aComputedValue.SetIntValue(uint8_t(clipPath.GetSizingBox()),
|
||||||
|
eUnit_Enumerated);
|
||||||
} else if (type == NS_STYLE_CLIP_PATH_SHAPE) {
|
} else if (type == NS_STYLE_CLIP_PATH_SHAPE) {
|
||||||
RefPtr<nsCSSValue::Array> result = nsCSSValue::Array::Create(2);
|
RefPtr<nsCSSValue::Array> result = nsCSSValue::Array::Create(2);
|
||||||
if (!StyleClipBasicShapeToCSSArray(clipPath, result)) {
|
if (!StyleClipBasicShapeToCSSArray(clipPath, result)) {
|
||||||
|
|
|
@ -2300,13 +2300,13 @@ const KTableEntry nsCSSProps::kFillRuleKTable[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const KTableEntry nsCSSProps::kClipShapeSizingKTable[] = {
|
const KTableEntry nsCSSProps::kClipShapeSizingKTable[] = {
|
||||||
{ eCSSKeyword_content_box, NS_STYLE_CLIP_SHAPE_SIZING_CONTENT },
|
{ eCSSKeyword_content_box, uint8_t(StyleClipShapeSizing::Content) },
|
||||||
{ eCSSKeyword_padding_box, NS_STYLE_CLIP_SHAPE_SIZING_PADDING },
|
{ eCSSKeyword_padding_box, uint8_t(StyleClipShapeSizing::Padding) },
|
||||||
{ eCSSKeyword_border_box, NS_STYLE_CLIP_SHAPE_SIZING_BORDER },
|
{ eCSSKeyword_border_box, uint8_t(StyleClipShapeSizing::Border) },
|
||||||
{ eCSSKeyword_margin_box, NS_STYLE_CLIP_SHAPE_SIZING_MARGIN },
|
{ eCSSKeyword_margin_box, uint8_t(StyleClipShapeSizing::Margin) },
|
||||||
{ eCSSKeyword_fill_box, NS_STYLE_CLIP_SHAPE_SIZING_FILL },
|
{ eCSSKeyword_fill_box, uint8_t(StyleClipShapeSizing::Fill) },
|
||||||
{ eCSSKeyword_stroke_box, NS_STYLE_CLIP_SHAPE_SIZING_STROKE },
|
{ eCSSKeyword_stroke_box, uint8_t(StyleClipShapeSizing::Stroke) },
|
||||||
{ eCSSKeyword_view_box, NS_STYLE_CLIP_SHAPE_SIZING_VIEW },
|
{ eCSSKeyword_view_box, uint8_t(StyleClipShapeSizing::View) },
|
||||||
{ eCSSKeyword_UNKNOWN, -1 }
|
{ eCSSKeyword_UNKNOWN, -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5975,7 +5975,8 @@ nsComputedDOMStyle::CreatePrimitiveValueForBasicShape(
|
||||||
|
|
||||||
already_AddRefed<CSSValue>
|
already_AddRefed<CSSValue>
|
||||||
nsComputedDOMStyle::CreatePrimitiveValueForClipPath(
|
nsComputedDOMStyle::CreatePrimitiveValueForClipPath(
|
||||||
const nsStyleBasicShape* aStyleBasicShape, uint8_t aSizingBox)
|
const nsStyleBasicShape* aStyleBasicShape,
|
||||||
|
mozilla::StyleClipShapeSizing aSizingBox)
|
||||||
{
|
{
|
||||||
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
|
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
|
||||||
if (aStyleBasicShape) {
|
if (aStyleBasicShape) {
|
||||||
|
@ -5983,13 +5984,13 @@ nsComputedDOMStyle::CreatePrimitiveValueForClipPath(
|
||||||
CreatePrimitiveValueForBasicShape(aStyleBasicShape));
|
CreatePrimitiveValueForBasicShape(aStyleBasicShape));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSizingBox == NS_STYLE_CLIP_SHAPE_SIZING_NOBOX) {
|
if (aSizingBox == StyleClipShapeSizing::NoBox) {
|
||||||
return valueList.forget();
|
return valueList.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString boxString;
|
nsAutoString boxString;
|
||||||
AppendASCIItoUTF16(
|
AppendASCIItoUTF16(
|
||||||
nsCSSProps::ValueToKeyword(aSizingBox,
|
nsCSSProps::ValueToKeyword(uint8_t(aSizingBox),
|
||||||
nsCSSProps::kClipShapeSizingKTable),
|
nsCSSProps::kClipShapeSizingKTable),
|
||||||
boxString);
|
boxString);
|
||||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||||
|
|
|
@ -643,7 +643,8 @@ private:
|
||||||
const nsStyleFilter& aStyleFilter);
|
const nsStyleFilter& aStyleFilter);
|
||||||
|
|
||||||
already_AddRefed<CSSValue> CreatePrimitiveValueForClipPath(
|
already_AddRefed<CSSValue> CreatePrimitiveValueForClipPath(
|
||||||
const nsStyleBasicShape* aStyleBasicShape, uint8_t aSizingBox);
|
const nsStyleBasicShape* aStyleBasicShape,
|
||||||
|
mozilla::StyleClipShapeSizing aSizingBox);
|
||||||
|
|
||||||
// Helper function for computing basic shape styles.
|
// Helper function for computing basic shape styles.
|
||||||
already_AddRefed<CSSValue> CreatePrimitiveValueForBasicShape(
|
already_AddRefed<CSSValue> CreatePrimitiveValueForBasicShape(
|
||||||
|
|
|
@ -9701,17 +9701,17 @@ nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath,
|
||||||
MOZ_ASSERT(array->Count() == 1 || array->Count() == 2,
|
MOZ_ASSERT(array->Count() == 1 || array->Count() == 2,
|
||||||
"Expect one or both of a shape function and geometry-box");
|
"Expect one or both of a shape function and geometry-box");
|
||||||
|
|
||||||
uint8_t sizingBox = NS_STYLE_CLIP_SHAPE_SIZING_NOBOX;
|
StyleClipShapeSizing sizingBox = StyleClipShapeSizing::NoBox;
|
||||||
RefPtr<nsStyleBasicShape> basicShape;
|
RefPtr<nsStyleBasicShape> basicShape;
|
||||||
for (size_t i = 0; i < array->Count(); ++i) {
|
for (size_t i = 0; i < array->Count(); ++i) {
|
||||||
if (array->Item(i).GetUnit() == eCSSUnit_Enumerated) {
|
if (array->Item(i).GetUnit() == eCSSUnit_Enumerated) {
|
||||||
int32_t type = array->Item(i).GetIntValue();
|
int32_t type = array->Item(i).GetIntValue();
|
||||||
if (type > NS_STYLE_CLIP_SHAPE_SIZING_VIEW ||
|
if (type > uint8_t(StyleClipShapeSizing::View) ||
|
||||||
type < NS_STYLE_CLIP_SHAPE_SIZING_NOBOX) {
|
type < uint8_t(StyleClipShapeSizing::NoBox)) {
|
||||||
NS_NOTREACHED("unexpected reference box");
|
NS_NOTREACHED("unexpected reference box");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sizingBox = (uint8_t)type;
|
sizingBox = static_cast<StyleClipShapeSizing>(type);
|
||||||
} else if (array->Item(i).GetUnit() == eCSSUnit_Function) {
|
} else if (array->Item(i).GetUnit() == eCSSUnit_Function) {
|
||||||
basicShape = GetStyleBasicShapeFromCSSValue(array->Item(i), aStyleContext,
|
basicShape = GetStyleBasicShapeFromCSSValue(array->Item(i), aStyleContext,
|
||||||
aPresContext, aConditions);
|
aPresContext, aConditions);
|
||||||
|
|
|
@ -61,14 +61,16 @@ enum class StyleBoxSizing : uint8_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
// clip-path sizing
|
// clip-path sizing
|
||||||
#define NS_STYLE_CLIP_SHAPE_SIZING_NOBOX 0
|
enum class StyleClipShapeSizing : uint8_t {
|
||||||
#define NS_STYLE_CLIP_SHAPE_SIZING_CONTENT 1
|
NoBox,
|
||||||
#define NS_STYLE_CLIP_SHAPE_SIZING_PADDING 2
|
Content,
|
||||||
#define NS_STYLE_CLIP_SHAPE_SIZING_BORDER 3
|
Padding,
|
||||||
#define NS_STYLE_CLIP_SHAPE_SIZING_MARGIN 4
|
Border,
|
||||||
#define NS_STYLE_CLIP_SHAPE_SIZING_FILL 5
|
Margin,
|
||||||
#define NS_STYLE_CLIP_SHAPE_SIZING_STROKE 6
|
Fill,
|
||||||
#define NS_STYLE_CLIP_SHAPE_SIZING_VIEW 7
|
Stroke,
|
||||||
|
View,
|
||||||
|
};
|
||||||
|
|
||||||
// Basic Shapes
|
// Basic Shapes
|
||||||
#define NS_STYLE_BASIC_SHAPE_POLYGON 0
|
#define NS_STYLE_BASIC_SHAPE_POLYGON 0
|
||||||
|
|
|
@ -1007,14 +1007,14 @@ nsStyleBasicShape::GetShapeTypeName() const
|
||||||
nsStyleClipPath::nsStyleClipPath()
|
nsStyleClipPath::nsStyleClipPath()
|
||||||
: mType(NS_STYLE_CLIP_PATH_NONE)
|
: mType(NS_STYLE_CLIP_PATH_NONE)
|
||||||
, mURL(nullptr)
|
, mURL(nullptr)
|
||||||
, mSizingBox(NS_STYLE_CLIP_SHAPE_SIZING_NOBOX)
|
, mSizingBox(mozilla::StyleClipShapeSizing::NoBox)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsStyleClipPath::nsStyleClipPath(const nsStyleClipPath& aSource)
|
nsStyleClipPath::nsStyleClipPath(const nsStyleClipPath& aSource)
|
||||||
: mType(NS_STYLE_CLIP_PATH_NONE)
|
: mType(NS_STYLE_CLIP_PATH_NONE)
|
||||||
, mURL(nullptr)
|
, mURL(nullptr)
|
||||||
, mSizingBox(NS_STYLE_CLIP_SHAPE_SIZING_NOBOX)
|
, mSizingBox(mozilla::StyleClipShapeSizing::NoBox)
|
||||||
{
|
{
|
||||||
if (aSource.mType == NS_STYLE_CLIP_PATH_URL) {
|
if (aSource.mType == NS_STYLE_CLIP_PATH_URL) {
|
||||||
SetURL(aSource.mURL);
|
SetURL(aSource.mURL);
|
||||||
|
@ -1045,7 +1045,7 @@ nsStyleClipPath::operator=(const nsStyleClipPath& aOther)
|
||||||
SetSizingBox(aOther.mSizingBox);
|
SetSizingBox(aOther.mSizingBox);
|
||||||
} else {
|
} else {
|
||||||
ReleaseRef();
|
ReleaseRef();
|
||||||
mSizingBox = NS_STYLE_CLIP_SHAPE_SIZING_NOBOX;
|
mSizingBox = mozilla::StyleClipShapeSizing::NoBox;
|
||||||
mType = NS_STYLE_CLIP_PATH_NONE;
|
mType = NS_STYLE_CLIP_PATH_NONE;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -1096,7 +1096,8 @@ nsStyleClipPath::SetURL(nsIURI* aURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsStyleClipPath::SetBasicShape(nsStyleBasicShape* aBasicShape, uint8_t aSizingBox)
|
nsStyleClipPath::SetBasicShape(nsStyleBasicShape* aBasicShape,
|
||||||
|
mozilla::StyleClipShapeSizing aSizingBox)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aBasicShape, "expected pointer");
|
NS_ASSERTION(aBasicShape, "expected pointer");
|
||||||
ReleaseRef();
|
ReleaseRef();
|
||||||
|
@ -1107,7 +1108,7 @@ nsStyleClipPath::SetBasicShape(nsStyleBasicShape* aBasicShape, uint8_t aSizingBo
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsStyleClipPath::SetSizingBox(uint8_t aSizingBox)
|
nsStyleClipPath::SetSizingBox(mozilla::StyleClipShapeSizing aSizingBox)
|
||||||
{
|
{
|
||||||
ReleaseRef();
|
ReleaseRef();
|
||||||
mSizingBox = aSizingBox;
|
mSizingBox = aSizingBox;
|
||||||
|
|
|
@ -3522,10 +3522,11 @@ struct nsStyleClipPath
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBasicShape(nsStyleBasicShape* mBasicShape,
|
void SetBasicShape(nsStyleBasicShape* mBasicShape,
|
||||||
uint8_t aSizingBox = NS_STYLE_CLIP_SHAPE_SIZING_NOBOX);
|
mozilla::StyleClipShapeSizing aSizingBox =
|
||||||
|
mozilla::StyleClipShapeSizing::NoBox);
|
||||||
|
|
||||||
uint8_t GetSizingBox() const { return mSizingBox; }
|
mozilla::StyleClipShapeSizing GetSizingBox() const { return mSizingBox; }
|
||||||
void SetSizingBox(uint8_t aSizingBox);
|
void SetSizingBox(mozilla::StyleClipShapeSizing aSizingBox);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ReleaseRef();
|
void ReleaseRef();
|
||||||
|
@ -3536,7 +3537,7 @@ private:
|
||||||
nsStyleBasicShape* mBasicShape;
|
nsStyleBasicShape* mBasicShape;
|
||||||
nsIURI* mURL;
|
nsIURI* mURL;
|
||||||
};
|
};
|
||||||
uint8_t mSizingBox; // see NS_STYLE_CLIP_SHAPE_SIZING_* constants in nsStyleConsts.h
|
mozilla::StyleClipShapeSizing mSizingBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nsStyleFilter
|
struct nsStyleFilter
|
||||||
|
|
|
@ -68,13 +68,13 @@ nsCSSClipPathInstance::CreateClipPath(DrawTarget* aDrawTarget)
|
||||||
nsRect r;
|
nsRect r;
|
||||||
// XXXkrit SVG needs to use different boxes.
|
// XXXkrit SVG needs to use different boxes.
|
||||||
switch (mClipPathStyle.GetSizingBox()) {
|
switch (mClipPathStyle.GetSizingBox()) {
|
||||||
case NS_STYLE_CLIP_SHAPE_SIZING_CONTENT:
|
case StyleClipShapeSizing::Content:
|
||||||
r = mTargetFrame->GetContentRectRelativeToSelf();
|
r = mTargetFrame->GetContentRectRelativeToSelf();
|
||||||
break;
|
break;
|
||||||
case NS_STYLE_CLIP_SHAPE_SIZING_PADDING:
|
case StyleClipShapeSizing::Padding:
|
||||||
r = mTargetFrame->GetPaddingRectRelativeToSelf();
|
r = mTargetFrame->GetPaddingRectRelativeToSelf();
|
||||||
break;
|
break;
|
||||||
case NS_STYLE_CLIP_SHAPE_SIZING_MARGIN:
|
case StyleClipShapeSizing::Margin:
|
||||||
r = mTargetFrame->GetMarginRectRelativeToSelf();
|
r = mTargetFrame->GetMarginRectRelativeToSelf();
|
||||||
break;
|
break;
|
||||||
default: // Use the border box
|
default: // Use the border box
|
||||||
|
|
Загрузка…
Ссылка в новой задаче