зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1336905 - Part 1. Remove StyleShapeSource's template argument. r=heycam,TYLin
MozReview-Commit-ID: FHTwGyXHsce --HG-- extra : rebase_source : e1346a2ec89d023b2aa0c2cd5ced94529b7f9067
This commit is contained in:
Родитель
7e1b75391d
Коммит
80f22f74f4
|
@ -657,7 +657,7 @@ nsFloatManager::FloatInfo::FloatInfo(nsIFrame* aFrame,
|
|||
{
|
||||
MOZ_COUNT_CTOR(nsFloatManager::FloatInfo);
|
||||
|
||||
const StyleShapeOutside& shapeOutside = mFrame->StyleDisplay()->mShapeOutside;
|
||||
const StyleShapeSource& shapeOutside = mFrame->StyleDisplay()->mShapeOutside;
|
||||
|
||||
if (shapeOutside.GetType() == StyleShapeSourceType::None) {
|
||||
return;
|
||||
|
@ -674,22 +674,25 @@ nsFloatManager::FloatInfo::FloatInfo(nsIFrame* aFrame,
|
|||
LogicalRect rect = aMarginRect;
|
||||
|
||||
switch (shapeOutside.GetReferenceBox()) {
|
||||
case StyleShapeOutsideShapeBox::Content:
|
||||
case StyleGeometryBox::Content:
|
||||
rect.Deflate(aWM, mFrame->GetLogicalUsedPadding(aWM));
|
||||
MOZ_FALLTHROUGH;
|
||||
case StyleShapeOutsideShapeBox::Padding:
|
||||
case StyleGeometryBox::Padding:
|
||||
rect.Deflate(aWM, mFrame->GetLogicalUsedBorder(aWM));
|
||||
MOZ_FALLTHROUGH;
|
||||
case StyleShapeOutsideShapeBox::Border:
|
||||
case StyleGeometryBox::Border:
|
||||
rect.Deflate(aWM, mFrame->GetLogicalUsedMargin(aWM));
|
||||
break;
|
||||
case StyleShapeOutsideShapeBox::Margin:
|
||||
case StyleGeometryBox::Margin:
|
||||
// Do nothing. rect is already a margin rect.
|
||||
break;
|
||||
case StyleShapeOutsideShapeBox::NoBox:
|
||||
case StyleGeometryBox::NoBox:
|
||||
MOZ_ASSERT(shapeOutside.GetType() != StyleShapeSourceType::Box,
|
||||
"Box source type must have <shape-box> specified!");
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected box value");
|
||||
break;
|
||||
}
|
||||
|
||||
if (shapeOutside.GetType() == StyleShapeSourceType::Box) {
|
||||
|
|
|
@ -1437,16 +1437,19 @@ bool
|
|||
nsIFrame::GetShapeBoxBorderRadii(nscoord aRadii[8]) const
|
||||
{
|
||||
switch (StyleDisplay()->mShapeOutside.GetReferenceBox()) {
|
||||
case StyleShapeOutsideShapeBox::NoBox:
|
||||
case StyleGeometryBox::NoBox:
|
||||
return false;
|
||||
case StyleShapeOutsideShapeBox::Content:
|
||||
case StyleGeometryBox::Content:
|
||||
return GetContentBoxBorderRadii(aRadii);
|
||||
case StyleShapeOutsideShapeBox::Padding:
|
||||
case StyleGeometryBox::Padding:
|
||||
return GetPaddingBoxBorderRadii(aRadii);
|
||||
case StyleShapeOutsideShapeBox::Border:
|
||||
case StyleGeometryBox::Border:
|
||||
return GetBorderRadii(aRadii);
|
||||
case StyleShapeOutsideShapeBox::Margin:
|
||||
case StyleGeometryBox::Margin:
|
||||
return GetMarginBoxBorderRadii(aRadii);
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected box value");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1027,7 +1027,7 @@ Gecko_SetStyleCoordCalcValue(nsStyleUnit* aUnit, nsStyleUnion* aValue, nsStyleCo
|
|||
}
|
||||
|
||||
void
|
||||
Gecko_CopyClipPathValueFrom(mozilla::StyleClipPath* aDst, const mozilla::StyleClipPath* aSrc)
|
||||
Gecko_CopyClipPathValueFrom(mozilla::StyleShapeSource* aDst, const mozilla::StyleShapeSource* aSrc)
|
||||
{
|
||||
MOZ_ASSERT(aDst);
|
||||
MOZ_ASSERT(aSrc);
|
||||
|
@ -1036,9 +1036,9 @@ Gecko_CopyClipPathValueFrom(mozilla::StyleClipPath* aDst, const mozilla::StyleCl
|
|||
}
|
||||
|
||||
void
|
||||
Gecko_DestroyClipPath(mozilla::StyleClipPath* aClip)
|
||||
Gecko_DestroyClipPath(mozilla::StyleShapeSource* aClip)
|
||||
{
|
||||
aClip->~StyleClipPath();
|
||||
aClip->~StyleShapeSource();
|
||||
}
|
||||
|
||||
mozilla::StyleBasicShape*
|
||||
|
|
|
@ -281,9 +281,9 @@ void Gecko_ResetStyleCoord(nsStyleUnit* unit, nsStyleUnion* value);
|
|||
// Set an nsStyleCoord to a computed `calc()` value
|
||||
void Gecko_SetStyleCoordCalcValue(nsStyleUnit* unit, nsStyleUnion* value, nsStyleCoord::CalcValue calc);
|
||||
|
||||
void Gecko_CopyClipPathValueFrom(mozilla::StyleClipPath* dst, const mozilla::StyleClipPath* src);
|
||||
void Gecko_CopyClipPathValueFrom(mozilla::StyleShapeSource* dst, const mozilla::StyleShapeSource* src);
|
||||
|
||||
void Gecko_DestroyClipPath(mozilla::StyleClipPath* clip);
|
||||
void Gecko_DestroyClipPath(mozilla::StyleShapeSource* clip);
|
||||
mozilla::StyleBasicShape* Gecko_NewBasicShape(mozilla::StyleBasicShapeType type);
|
||||
|
||||
void Gecko_ResetFilters(nsStyleEffects* effects, size_t new_len);
|
||||
|
|
|
@ -4141,7 +4141,7 @@ ExtractImageLayerSizePairList(const nsStyleImageLayers& aLayer,
|
|||
}
|
||||
|
||||
static bool
|
||||
StyleClipBasicShapeToCSSArray(const StyleClipPath& aClipPath,
|
||||
StyleClipBasicShapeToCSSArray(const StyleShapeSource& aClipPath,
|
||||
nsCSSValue::Array* aResult)
|
||||
{
|
||||
MOZ_ASSERT(aResult->Count() == 2,
|
||||
|
@ -4513,7 +4513,7 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
|
|||
case eCSSProperty_clip_path: {
|
||||
const nsStyleSVGReset* svgReset =
|
||||
static_cast<const nsStyleSVGReset*>(styleStruct);
|
||||
const StyleClipPath& clipPath = svgReset->mClipPath;
|
||||
const StyleShapeSource& clipPath = svgReset->mClipPath;
|
||||
const StyleShapeSourceType type = clipPath.GetType();
|
||||
|
||||
if (type == StyleShapeSourceType::URL) {
|
||||
|
|
|
@ -6221,10 +6221,9 @@ nsComputedDOMStyle::CreatePrimitiveValueForShapeSource(
|
|||
return valueList.forget();
|
||||
}
|
||||
|
||||
template<typename ReferenceBox>
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::GetShapeSource(
|
||||
const StyleShapeSource<ReferenceBox>& aShapeSource,
|
||||
const StyleShapeSource& aShapeSource,
|
||||
const KTableEntry aBoxKeywordTable[])
|
||||
{
|
||||
switch (aShapeSource.GetType()) {
|
||||
|
|
|
@ -661,9 +661,8 @@ private:
|
|||
already_AddRefed<CSSValue> CreatePrimitiveValueForStyleFilter(
|
||||
const nsStyleFilter& aStyleFilter);
|
||||
|
||||
template<typename ReferenceBox>
|
||||
already_AddRefed<CSSValue>
|
||||
GetShapeSource(const mozilla::StyleShapeSource<ReferenceBox>& aShapeSource,
|
||||
GetShapeSource(const mozilla::StyleShapeSource& aShapeSource,
|
||||
const KTableEntry aBoxKeywordTable[]);
|
||||
|
||||
template<typename ReferenceBox>
|
||||
|
|
|
@ -140,9 +140,8 @@ CreateStyleImageRequest(nsPresContext* aPresContext, const nsCSSValue& aValue,
|
|||
return request.forget();
|
||||
}
|
||||
|
||||
template<typename ReferenceBox>
|
||||
static void
|
||||
SetStyleShapeSourceToCSSValue(StyleShapeSource<ReferenceBox>* aShapeSource,
|
||||
SetStyleShapeSourceToCSSValue(StyleShapeSource* aShapeSource,
|
||||
const nsCSSValue* aValue,
|
||||
nsStyleContext* aStyleContext,
|
||||
nsPresContext* aPresContext,
|
||||
|
@ -6614,19 +6613,19 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
|
|||
case eCSSUnit_None:
|
||||
case eCSSUnit_Initial:
|
||||
case eCSSUnit_Unset:
|
||||
display->mShapeOutside = StyleShapeOutside();
|
||||
display->mShapeOutside = StyleShapeSource();
|
||||
break;
|
||||
case eCSSUnit_Inherit:
|
||||
conditions.SetUncacheable();
|
||||
display->mShapeOutside = parentDisplay->mShapeOutside;
|
||||
break;
|
||||
case eCSSUnit_URL: {
|
||||
display->mShapeOutside = StyleShapeOutside();
|
||||
display->mShapeOutside = StyleShapeSource();
|
||||
display->mShapeOutside.SetURL(shapeOutsideValue->GetURLStructValue());
|
||||
break;
|
||||
}
|
||||
case eCSSUnit_Array: {
|
||||
display->mShapeOutside = StyleShapeOutside();
|
||||
display->mShapeOutside = StyleShapeSource();
|
||||
SetStyleShapeSourceToCSSValue(&display->mShapeOutside, shapeOutsideValue,
|
||||
aContext, mPresContext, conditions);
|
||||
break;
|
||||
|
@ -9837,10 +9836,9 @@ GetStyleBasicShapeFromCSSValue(const nsCSSValue& aValue,
|
|||
return basicShape.forget();
|
||||
}
|
||||
|
||||
template<typename ReferenceBox>
|
||||
static void
|
||||
SetStyleShapeSourceToCSSValue(
|
||||
StyleShapeSource<ReferenceBox>* aShapeSource,
|
||||
StyleShapeSource* aShapeSource,
|
||||
const nsCSSValue* aValue,
|
||||
nsStyleContext* aStyleContext,
|
||||
nsPresContext* aPresContext,
|
||||
|
@ -9853,13 +9851,13 @@ SetStyleShapeSourceToCSSValue(
|
|||
MOZ_ASSERT(array->Count() == 1 || array->Count() == 2,
|
||||
"Expect one or both of a shape function and a reference box");
|
||||
|
||||
ReferenceBox referenceBox = ReferenceBox::NoBox;
|
||||
StyleGeometryBox referenceBox = StyleGeometryBox::NoBox;
|
||||
RefPtr<StyleBasicShape> basicShape;
|
||||
|
||||
for (size_t i = 0; i < array->Count(); ++i) {
|
||||
const nsCSSValue& item = array->Item(i);
|
||||
if (item.GetUnit() == eCSSUnit_Enumerated) {
|
||||
referenceBox = static_cast<ReferenceBox>(item.GetIntValue());
|
||||
referenceBox = static_cast<StyleGeometryBox>(item.GetIntValue());
|
||||
} else if (item.GetUnit() == eCSSUnit_Function) {
|
||||
basicShape = GetStyleBasicShapeFromCSSValue(item, aStyleContext,
|
||||
aPresContext, aConditions);
|
||||
|
@ -9984,19 +9982,19 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
|
|||
case eCSSUnit_None:
|
||||
case eCSSUnit_Initial:
|
||||
case eCSSUnit_Unset:
|
||||
svgReset->mClipPath = StyleClipPath();
|
||||
svgReset->mClipPath = StyleShapeSource();
|
||||
break;
|
||||
case eCSSUnit_Inherit:
|
||||
conditions.SetUncacheable();
|
||||
svgReset->mClipPath = parentSVGReset->mClipPath;
|
||||
break;
|
||||
case eCSSUnit_URL: {
|
||||
svgReset->mClipPath = StyleClipPath();
|
||||
svgReset->mClipPath = StyleShapeSource();
|
||||
svgReset->mClipPath.SetURL(clipPathValue->GetURLStructValue());
|
||||
break;
|
||||
}
|
||||
case eCSSUnit_Array: {
|
||||
svgReset->mClipPath = StyleClipPath();
|
||||
svgReset->mClipPath = StyleShapeSource();
|
||||
SetStyleShapeSourceToCSSValue(&svgReset->mClipPath, clipPathValue, aContext,
|
||||
mPresContext, conditions);
|
||||
break;
|
||||
|
|
|
@ -84,8 +84,8 @@ enum class StyleClear : uint8_t {
|
|||
Max = 13 // Max = (Both | Line)
|
||||
};
|
||||
|
||||
// Define geometry box for clip-path's reference-box, background-clip,
|
||||
// background-origin, mask-clip and mask-origin.
|
||||
// Define geometry box for clip-path's reference-box, shape-outside's shape
|
||||
// box, background-clip, background-origin, mask-clip and mask-origin.
|
||||
enum class StyleGeometryBox : uint8_t {
|
||||
Content,
|
||||
Padding,
|
||||
|
|
|
@ -2640,7 +2640,6 @@ private:
|
|||
nsStyleCorners mRadius;
|
||||
};
|
||||
|
||||
template<typename ReferenceBox>
|
||||
struct StyleShapeSource
|
||||
{
|
||||
StyleShapeSource()
|
||||
|
@ -2678,7 +2677,7 @@ struct StyleShapeSource
|
|||
SetReferenceBox(aOther.mReferenceBox);
|
||||
} else {
|
||||
ReleaseRef();
|
||||
mReferenceBox = ReferenceBox::NoBox;
|
||||
mReferenceBox = StyleGeometryBox::NoBox;
|
||||
mType = StyleShapeSourceType::None;
|
||||
}
|
||||
return *this;
|
||||
|
@ -2735,7 +2734,7 @@ struct StyleShapeSource
|
|||
}
|
||||
|
||||
void SetBasicShape(StyleBasicShape* aBasicShape,
|
||||
ReferenceBox aReferenceBox)
|
||||
StyleGeometryBox aReferenceBox)
|
||||
{
|
||||
NS_ASSERTION(aBasicShape, "expected pointer");
|
||||
ReleaseRef();
|
||||
|
@ -2745,7 +2744,7 @@ struct StyleShapeSource
|
|||
mType = StyleShapeSourceType::Shape;
|
||||
}
|
||||
|
||||
ReferenceBox GetReferenceBox() const
|
||||
StyleGeometryBox GetReferenceBox() const
|
||||
{
|
||||
MOZ_ASSERT(mType == StyleShapeSourceType::Box ||
|
||||
mType == StyleShapeSourceType::Shape,
|
||||
|
@ -2753,7 +2752,7 @@ struct StyleShapeSource
|
|||
return mReferenceBox;
|
||||
}
|
||||
|
||||
void SetReferenceBox(ReferenceBox aReferenceBox)
|
||||
void SetReferenceBox(StyleGeometryBox aReferenceBox)
|
||||
{
|
||||
ReleaseRef();
|
||||
mReferenceBox = aReferenceBox;
|
||||
|
@ -2782,12 +2781,9 @@ private:
|
|||
css::URLValue* mURL;
|
||||
};
|
||||
StyleShapeSourceType mType = StyleShapeSourceType::None;
|
||||
ReferenceBox mReferenceBox = ReferenceBox::NoBox;
|
||||
StyleGeometryBox mReferenceBox = StyleGeometryBox::NoBox;
|
||||
};
|
||||
|
||||
using StyleClipPath = StyleShapeSource<StyleGeometryBox>;
|
||||
using StyleShapeOutside = StyleShapeSource<StyleShapeOutsideShapeBox>;
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
|
||||
|
@ -2910,7 +2906,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
|
|||
mAnimationPlayStateCount,
|
||||
mAnimationIterationCountCount;
|
||||
|
||||
mozilla::StyleShapeOutside mShapeOutside; // [reset]
|
||||
mozilla::StyleShapeSource mShapeOutside; // [reset]
|
||||
|
||||
bool IsBlockInsideStyle() const {
|
||||
return mozilla::StyleDisplay::Block == mDisplay ||
|
||||
|
@ -3890,7 +3886,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset
|
|||
}
|
||||
|
||||
nsStyleImageLayers mMask;
|
||||
mozilla::StyleClipPath mClipPath; // [reset]
|
||||
mozilla::StyleShapeSource mClipPath;// [reset]
|
||||
nscolor mStopColor; // [reset]
|
||||
nscolor mFloodColor; // [reset]
|
||||
nscolor mLightingColor; // [reset]
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
const gfxPoint& aPoint);
|
||||
private:
|
||||
explicit nsCSSClipPathInstance(nsIFrame* aFrame,
|
||||
const StyleClipPath aClipPathStyle)
|
||||
const StyleShapeSource aClipPathStyle)
|
||||
: mTargetFrame(aFrame)
|
||||
, mClipPathStyle(aClipPathStyle)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ private:
|
|||
* The frame for the element that is currently being clipped.
|
||||
*/
|
||||
nsIFrame* mTargetFrame;
|
||||
StyleClipPath mClipPathStyle;
|
||||
StyleShapeSource mClipPathStyle;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
Загрузка…
Ссылка в новой задаче