Skip to content

Commit

Permalink
Backed out 8 changesets (bug 1288626) for conflicting with bug 129128…
Browse files Browse the repository at this point in the history
…0, which merged to m-c first a=backout

Backed out changeset caee616ea09c (bug 1288626)
Backed out changeset eebda25d85cd (bug 1288626)
Backed out changeset 07e9cb8a46fd (bug 1288626)
Backed out changeset c5e4865819ff (bug 1288626)
Backed out changeset 74633b2735e0 (bug 1288626)
Backed out changeset 17f63bb7be11 (bug 1288626)
Backed out changeset 654556e45f5a (bug 1288626)
Backed out changeset be2c56decd65 (bug 1288626)
  • Loading branch information
KWierso committed Aug 8, 2016
1 parent 3af938d commit 07f2d53
Show file tree
Hide file tree
Showing 20 changed files with 641 additions and 780 deletions.
1 change: 0 additions & 1 deletion layout/inspector/inDOMUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,6 @@ PropertySupportsVariant(nsCSSProperty aPropertyID, uint32_t aVariant)
case eCSSProperty_content:
case eCSSProperty_cursor:
case eCSSProperty_clip_path:
case eCSSProperty_shape_outside:
supported = VARIANT_URL;
break;

Expand Down
28 changes: 14 additions & 14 deletions layout/style/StyleAnimationValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3493,18 +3493,18 @@ ExtractImageLayerSizePairList(const nsStyleImageLayers& aLayer,
}

static bool
StyleClipBasicShapeToCSSArray(const StyleClipPath& aClipPath,
StyleClipBasicShapeToCSSArray(const nsStyleClipPath& aClipPath,
nsCSSValue::Array* aResult)
{
MOZ_ASSERT(aResult->Count() == 2,
"Expected array to be presized for a function and the sizing-box");

const StyleBasicShape* shape = aClipPath.GetBasicShape();
const nsStyleBasicShape* shape = aClipPath.GetBasicShape();
nsCSSKeyword functionName = shape->GetShapeTypeName();
RefPtr<nsCSSValue::Array> functionArray;
switch (shape->GetShapeType()) {
case StyleBasicShapeType::Circle:
case StyleBasicShapeType::Ellipse: {
case nsStyleBasicShape::Type::eCircle:
case nsStyleBasicShape::Type::eEllipse: {
const nsTArray<nsStyleCoord>& coords = shape->Coordinates();
MOZ_ASSERT(coords.Length() == ShapeArgumentCount(functionName) - 1,
"Unexpected radii count");
Expand All @@ -3525,7 +3525,7 @@ StyleClipBasicShapeToCSSArray(const StyleClipPath& aClipPath,
functionArray->Item(functionArray->Count() - 1));
break;
}
case StyleBasicShapeType::Polygon: {
case nsStyleBasicShape::Type::ePolygon: {
functionArray =
aResult->Item(0).InitFunction(functionName,
ShapeArgumentCount(functionName));
Expand All @@ -3546,7 +3546,7 @@ StyleClipBasicShapeToCSSArray(const StyleClipPath& aClipPath,
}
break;
}
case StyleBasicShapeType::Inset: {
case nsStyleBasicShape::Type::eInset: {
const nsTArray<nsStyleCoord>& coords = shape->Coordinates();
MOZ_ASSERT(coords.Length() == ShapeArgumentCount(functionName) - 1,
"Unexpected offset count");
Expand Down Expand Up @@ -3578,7 +3578,7 @@ StyleClipBasicShapeToCSSArray(const StyleClipPath& aClipPath,
MOZ_ASSERT_UNREACHABLE("Unknown shape type");
return false;
}
aResult->Item(1).SetIntValue(aClipPath.GetReferenceBox(),
aResult->Item(1).SetIntValue(aClipPath.GetSizingBox(),
eCSSUnit_Enumerated);
return true;
}
Expand Down Expand Up @@ -3953,29 +3953,29 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty,
case eCSSProperty_clip_path: {
const nsStyleSVGReset* svgReset =
static_cast<const nsStyleSVGReset*>(styleStruct);
const StyleClipPath& clipPath = svgReset->mClipPath;
const StyleShapeSourceType type = clipPath.GetType();
const nsStyleClipPath& clipPath = svgReset->mClipPath;
const StyleClipPathType type = clipPath.GetType();

if (type == StyleShapeSourceType::URL) {
if (type == StyleClipPathType::URL) {
nsIDocument* doc = aStyleContext->PresContext()->Document();
RefPtr<mozilla::css::URLValue> url =
FragmentOrURLToURLValue(clipPath.GetURL(), doc);

auto result = MakeUnique<nsCSSValue>();
result->SetURLValue(url);
aComputedValue.SetAndAdoptCSSValueValue(result.release(), eUnit_URL);
} else if (type == StyleShapeSourceType::Box) {
aComputedValue.SetIntValue(clipPath.GetReferenceBox(),
} else if (type == StyleClipPathType::Box) {
aComputedValue.SetIntValue(clipPath.GetSizingBox(),
eUnit_Enumerated);
} else if (type == StyleShapeSourceType::Shape) {
} else if (type == StyleClipPathType::Shape) {
RefPtr<nsCSSValue::Array> result = nsCSSValue::Array::Create(2);
if (!StyleClipBasicShapeToCSSArray(clipPath, result)) {
return false;
}
aComputedValue.SetCSSValueArrayValue(result, eUnit_Shape);

} else {
MOZ_ASSERT(type == StyleShapeSourceType::None_, "unknown type");
MOZ_ASSERT(type == StyleClipPathType::None_, "unknown type");
aComputedValue.SetNoneValue();
}
break;
Expand Down
94 changes: 32 additions & 62 deletions layout/style/nsCSSParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,6 @@ class CSSParserImpl {

bool ParseShadowItem(nsCSSValue& aValue, bool aIsBoxShadow);
bool ParseShadowList(nsCSSProperty aProperty);
bool ParseShapeOutside(nsCSSValue& aValue);
bool ParseTransitionProperty();
bool ParseTransitionTimingFunctionValues(nsCSSValue& aValue);
bool ParseTransitionTimingFunctionValueComponent(float& aComponent,
Expand Down Expand Up @@ -1325,8 +1324,6 @@ class CSSParserImpl {
}

/* Functions for basic shapes */
bool ParseReferenceBoxAndBasicShape(nsCSSValue& aValue,
const KTableEntry aBoxKeywordTable[]);
bool ParseBasicShape(nsCSSValue& aValue, bool* aConsumedTokens);
bool ParsePolygonFunction(nsCSSValue& aValue);
bool ParseCircleOrEllipseFunction(nsCSSKeyword, nsCSSValue& aValue);
Expand Down Expand Up @@ -11762,8 +11759,6 @@ CSSParserImpl::ParseSingleValuePropertyByFunction(nsCSSValue& aValue,
return ParseScrollSnapDestination(aValue);
case eCSSProperty_scroll_snap_coordinate:
return ParseScrollSnapCoordinate(aValue);
case eCSSProperty_shape_outside:
return ParseShapeOutside(aValue);
case eCSSProperty_text_align:
return ParseTextAlign(aValue);
case eCSSProperty_text_align_last:
Expand Down Expand Up @@ -16170,48 +16165,6 @@ CSSParserImpl::ParseBasicShape(nsCSSValue& aValue, bool* aConsumedTokens)
}
}

bool
CSSParserImpl::ParseReferenceBoxAndBasicShape(
nsCSSValue& aValue,
const KTableEntry aBoxKeywordTable[])
{
nsCSSValue referenceBox;
bool hasBox = ParseEnum(referenceBox, aBoxKeywordTable);

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, aBoxKeywordTable);
}

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;
} else if (hasBox) {
fullValue->Item(0) = referenceBox;
} else {
MOZ_ASSERT(hasShape, "should've bailed if we got neither box nor shape");
fullValue->Item(0) = basicShape;
}

aValue.SetArrayValue(fullValue, eCSSUnit_Array);
return true;
}

/* Parse a clip-path url to a <clipPath> element or a basic shape. */
bool CSSParserImpl::ParseClipPath()
{
Expand All @@ -16224,27 +16177,44 @@ bool CSSParserImpl::ParseClipPath()
return false;
}

if (!ParseReferenceBoxAndBasicShape(
value, nsCSSProps::kClipPathGeometryBoxKTable)) {
nsCSSValue referenceBox;
bool hasBox = ParseEnum(referenceBox, nsCSSProps::kClipShapeSizingKTable);

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;
}
}

AppendValue(eCSSProperty_clip_path, value);
return true;
}
// Check if the second argument is a reference box if the first wasn't.
if (!hasBox) {
hasBox = ParseEnum(referenceBox, nsCSSProps::kClipShapeSizingKTable);
}

// none | [ <basic-shape> || <shape-box> ] | <image>
bool
CSSParserImpl::ParseShapeOutside(nsCSSValue& aValue)
{
if (ParseSingleTokenVariant(aValue, VARIANT_HUO, nullptr)) {
// 'inherit', 'initial', 'unset', 'none', and <image> url must be alone.
return true;
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;
} else if (hasBox) {
fullValue->Item(0) = referenceBox;
} else {
MOZ_ASSERT(hasShape, "should've bailed if we got neither box nor shape");
fullValue->Item(0) = basicShape;
}

value.SetArrayValue(fullValue, eCSSUnit_Array);
}

return ParseReferenceBoxAndBasicShape(
aValue, nsCSSProps::kShapeOutsideShapeBoxKTable);
AppendValue(eCSSProperty_clip_path, value);
return true;
}

bool CSSParserImpl::ParseTransformOrigin(bool aPerspective)
Expand Down
12 changes: 0 additions & 12 deletions layout/style/nsCSSPropList.h
Original file line number Diff line number Diff line change
Expand Up @@ -3708,18 +3708,6 @@ CSS_PROP_DISPLAY(
kScrollSnapTypeKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_DISPLAY(
shape-outside,
shape_outside,
ShapeOutside,
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_VALUE_PARSER_FUNCTION |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER,
"layout.css.shape-outside.enabled",
0,
nullptr,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None) // FIXME: Bug 1289049 for adding animation support
CSS_PROP_SVG(
shape-rendering,
shape_rendering,
Expand Down
26 changes: 9 additions & 17 deletions layout/style/nsCSSProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2296,15 +2296,15 @@ const KTableEntry nsCSSProps::kFillRuleKTable[] = {
{ 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::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::kShapeRadiusKTable[] = {
Expand Down Expand Up @@ -2341,14 +2341,6 @@ const KTableEntry nsCSSProps::kMaskTypeKTable[] = {
{ eCSSKeyword_UNKNOWN, -1 }
};

const KTableEntry nsCSSProps::kShapeOutsideShapeBoxKTable[] = {
{ eCSSKeyword_content_box, StyleShapeOutsideShapeBox::Content },
{ eCSSKeyword_padding_box, StyleShapeOutsideShapeBox::Padding },
{ eCSSKeyword_border_box, StyleShapeOutsideShapeBox::Border },
{ eCSSKeyword_margin_box, StyleShapeOutsideShapeBox::Margin },
{ eCSSKeyword_UNKNOWN, -1 }
};

const KTableEntry nsCSSProps::kShapeRenderingKTable[] = {
{ eCSSKeyword_auto, NS_STYLE_SHAPE_RENDERING_AUTO },
{ eCSSKeyword_optimizespeed, NS_STYLE_SHAPE_RENDERING_OPTIMIZESPEED },
Expand Down
3 changes: 1 addition & 2 deletions layout/style/nsCSSProps.h
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ class nsCSSProps {
static const KTableEntry kBoxDirectionKTable[];
static const KTableEntry kBoxOrientKTable[];
static const KTableEntry kBoxPackKTable[];
static const KTableEntry kClipPathGeometryBoxKTable[];
static const KTableEntry kClipShapeSizingKTable[];
static const KTableEntry kCounterRangeKTable[];
static const KTableEntry kCounterSpeakAsKTable[];
static const KTableEntry kCounterSymbolsSystemKTable[];
Expand All @@ -742,7 +742,6 @@ class nsCSSProps {
static const KTableEntry kFillRuleKTable[];
static const KTableEntry kFilterFunctionKTable[];
static const KTableEntry kImageRenderingKTable[];
static const KTableEntry kShapeOutsideShapeBoxKTable[];
static const KTableEntry kShapeRenderingKTable[];
static const KTableEntry kStrokeLinecapKTable[];
static const KTableEntry kStrokeLinejoinKTable[];
Expand Down
11 changes: 2 additions & 9 deletions layout/style/nsCSSValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,13 +1424,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult,

case eCSSProperty_clip_path:
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue,
nsCSSProps::kClipPathGeometryBoxKTable),
aResult);
break;

case eCSSProperty_shape_outside:
AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue,
nsCSSProps::kShapeOutsideShapeBoxKTable),
nsCSSProps::kClipShapeSizingKTable),
aResult);
break;

Expand Down Expand Up @@ -2528,8 +2522,7 @@ nsCSSValuePairList::AppendToString(nsCSSProperty aProperty,

if (nsCSSProps::PropHasFlags(aProperty,
CSS_PROPERTY_VALUE_LIST_USES_COMMAS) ||
aProperty == eCSSProperty_clip_path ||
aProperty == eCSSProperty_shape_outside)
aProperty == eCSSProperty_clip_path)
aResult.Append(char16_t(','));
aResult.Append(char16_t(' '));
}
Expand Down
Loading

0 comments on commit 07f2d53

Please sign in to comment.