Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleBuilderCustom.cpp
diff --git a/Source/core/css/resolver/StyleBuilderCustom.cpp b/Source/core/css/resolver/StyleBuilderCustom.cpp
index eefd6cc6d4ca7854247e16577902c80b892926b9..45e3585ef0f3047c149125ab133e42373aed3349 100644
--- a/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -104,12 +104,12 @@ static inline bool isValidVisitedLinkProperty(CSSPropertyID id)
} // namespace
-void StyleBuilder::applyProperty(CSSPropertyID id, StyleResolverState& state, CSSValue* value)
+void StyleBuilder::applyProperty(CSSPropertyID id, StyleResolverState& state, CSSValue value)
{
ASSERT_WITH_MESSAGE(!isShorthandProperty(id), "Shorthand property id = %d wasn't expanded at parsing time", id);
- bool isInherit = state.parentNode() && value->isInheritedValue();
- bool isInitial = value->isInitialValue() || (!state.parentNode() && value->isInheritedValue());
+ bool isInherit = state.parentNode() && value.isInheritedValue();
+ bool isInitial = value.isInitialValue() || (!state.parentNode() && value.isInheritedValue());
ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial -> !isInherit
ASSERT(!isInherit || (state.parentNode() && state.parentStyle())); // isInherit -> (state.parentNode() && state.parentStyle())
@@ -121,7 +121,7 @@ void StyleBuilder::applyProperty(CSSPropertyID id, StyleResolverState& state, CS
if (isInherit && !state.parentStyle()->hasExplicitlyInheritedProperties() && !CSSPropertyMetadata::isInheritedProperty(id)) {
state.parentStyle()->setHasExplicitlyInheritedProperties();
- } else if (value->isUnsetValue()) {
+ } else if (value.isUnsetValue()) {
ASSERT(!isInherit && !isInitial);
if (CSSPropertyMetadata::isInheritedProperty(id))
isInherit = true;
@@ -150,11 +150,11 @@ void StyleBuilderFunctions::applyInheritCSSPropertyColor(StyleResolverState& sta
state.style()->setVisitedLinkColor(color);
}
-void StyleBuilderFunctions::applyValueCSSPropertyColor(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyColor(StyleResolverState& state, CSSValue value)
{
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
// As per the spec, 'color: currentColor' is treated as 'color: inherit'
- if (primitiveValue->getValueID() == CSSValueCurrentcolor) {
+ if (primitiveValue.getValueID() == CSSValueCurrentcolor) {
applyInheritCSSPropertyColor(state);
return;
}
@@ -177,37 +177,37 @@ void StyleBuilderFunctions::applyInheritCSSPropertyCursor(StyleResolverState& st
state.style()->setCursorList(state.parentStyle()->cursors());
}
-void StyleBuilderFunctions::applyValueCSSPropertyCursor(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyCursor(StyleResolverState& state, CSSValue value)
{
state.style()->clearCursorList();
- if (value->isValueList()) {
- CSSValueList* list = toCSSValueList(value);
- int len = list->length();
+ if (value.isValueList()) {
+ CSSValueList& list = toCSSValueList(value);
+ int len = list.length();
state.style()->setCursor(CURSOR_AUTO);
for (int i = 0; i < len; i++) {
- CSSValue* item = list->item(i);
- if (item->isCursorImageValue()) {
- CSSCursorImageValue* image = toCSSCursorImageValue(item);
- if (image->updateIfSVGCursorIsUsed(state.element())) // Elements with SVG cursors are not allowed to share style.
+ CSSValue item = list.item(i);
+ if (item.isCursorImageValue()) {
+ CSSCursorImageValue& image = toCSSCursorImageValue(item);
+ if (image.updateIfSVGCursorIsUsed(state.element())) // Elements with SVG cursors are not allowed to share style.
state.style()->setUnique();
- state.style()->addCursor(state.styleImage(CSSPropertyCursor, image), image->hotSpotSpecified(), image->hotSpot());
+ state.style()->addCursor(state.styleImage(CSSPropertyCursor, item), image.hotSpotSpecified(), image.hotSpot());
} else {
- state.style()->setCursor(*toCSSPrimitiveValue(item));
+ state.style()->setCursor(toCSSPrimitiveValue(item));
}
}
} else {
- state.style()->setCursor(*toCSSPrimitiveValue(value));
+ state.style()->setCursor(toCSSPrimitiveValue(value));
}
}
-void StyleBuilderFunctions::applyValueCSSPropertyDirection(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyDirection(StyleResolverState& state, CSSValue value)
{
- state.style()->setDirection(*toCSSPrimitiveValue(value));
+ state.style()->setDirection(toCSSPrimitiveValue(value));
}
-void StyleBuilderFunctions::applyValueCSSPropertyGlyphOrientationVertical(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyGlyphOrientationVertical(StyleResolverState& state, CSSValue value)
{
- if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueAuto)
+ if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueAuto)
state.style()->accessSVGStyle().setGlyphOrientationVertical(GO_AUTO);
else
state.style()->accessSVGStyle().setGlyphOrientationVertical(StyleBuilderConverter::convertGlyphOrientation(state, value));
@@ -227,16 +227,16 @@ void StyleBuilderFunctions::applyInheritCSSPropertyGridTemplateAreas(StyleResolv
state.style()->setNamedGridAreaColumnCount(state.parentStyle()->namedGridAreaColumnCount());
}
-void StyleBuilderFunctions::applyValueCSSPropertyGridTemplateAreas(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyGridTemplateAreas(StyleResolverState& state, CSSValue value)
{
- if (value->isPrimitiveValue()) {
+ if (value.isPrimitiveValue()) {
// FIXME: Shouldn't we clear the grid-area values
- ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
+ ASSERT(toCSSPrimitiveValue(value).getValueID() == CSSValueNone);
return;
}
- CSSGridTemplateAreasValue* gridTemplateAreasValue = toCSSGridTemplateAreasValue(value);
- const NamedGridAreaMap& newNamedGridAreas = gridTemplateAreasValue->gridAreaMap();
+ CSSGridTemplateAreasValue& gridTemplateAreasValue = toCSSGridTemplateAreasValue(value);
+ const NamedGridAreaMap& newNamedGridAreas = gridTemplateAreasValue.gridAreaMap();
NamedGridLinesMap namedGridColumnLines;
NamedGridLinesMap namedGridRowLines;
@@ -248,11 +248,11 @@ void StyleBuilderFunctions::applyValueCSSPropertyGridTemplateAreas(StyleResolver
state.style()->setNamedGridRowLines(namedGridRowLines);
state.style()->setNamedGridArea(newNamedGridAreas);
- state.style()->setNamedGridAreaRowCount(gridTemplateAreasValue->rowCount());
- state.style()->setNamedGridAreaColumnCount(gridTemplateAreasValue->columnCount());
+ state.style()->setNamedGridAreaRowCount(gridTemplateAreasValue.rowCount());
+ state.style()->setNamedGridAreaColumnCount(gridTemplateAreasValue.columnCount());
}
-void StyleBuilderFunctions::applyValueCSSPropertyListStyleImage(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyListStyleImage(StyleResolverState& state, CSSValue value)
{
state.style()->setListStyleImage(state.styleImage(CSSPropertyListStyleImage, value));
}
@@ -269,32 +269,32 @@ void StyleBuilderFunctions::applyInheritCSSPropertyOutlineStyle(StyleResolverSta
state.style()->setOutlineStyle(state.parentStyle()->outlineStyle());
}
-void StyleBuilderFunctions::applyValueCSSPropertyOutlineStyle(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyOutlineStyle(StyleResolverState& state, CSSValue value)
{
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- state.style()->setOutlineStyleIsAuto(*primitiveValue);
- state.style()->setOutlineStyle(*primitiveValue);
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
+ state.style()->setOutlineStyleIsAuto(primitiveValue);
+ state.style()->setOutlineStyle(primitiveValue);
}
-void StyleBuilderFunctions::applyValueCSSPropertyResize(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyResize(StyleResolverState& state, CSSValue value)
{
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
EResize r = RESIZE_NONE;
- if (primitiveValue->getValueID() == CSSValueAuto) {
+ if (primitiveValue.getValueID() == CSSValueAuto) {
if (Settings* settings = state.document().settings())
r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
} else {
- r = *primitiveValue;
+ r = primitiveValue;
}
state.style()->setResize(r);
}
static float mmToPx(float mm) { return mm * cssPixelsPerMillimeter; }
static float inchToPx(float inch) { return inch * cssPixelsPerInch; }
-static FloatSize getPageSizeFromName(CSSPrimitiveValue* pageSizeName)
+static FloatSize getPageSizeFromName(CSSPrimitiveValue& pageSizeName)
{
- switch (pageSizeName->getValueID()) {
+ switch (pageSizeName.getValueID()) {
case CSSValueA5:
return FloatSize(mmToPx(148), mmToPx(210));
case CSSValueA4:
@@ -319,40 +319,40 @@ static FloatSize getPageSizeFromName(CSSPrimitiveValue* pageSizeName)
void StyleBuilderFunctions::applyInitialCSSPropertySize(StyleResolverState&) { }
void StyleBuilderFunctions::applyInheritCSSPropertySize(StyleResolverState&) { }
-void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state, CSSValue value)
{
state.style()->resetPageSizeType();
FloatSize size;
PageSizeType pageSizeType = PAGE_SIZE_AUTO;
- CSSValueList* list = toCSSValueList(value);
- if (list->length() == 2) {
+ CSSValueList& list = toCSSValueList(value);
+ if (list.length() == 2) {
// <length>{2} | <page-size> <orientation>
- CSSPrimitiveValue* first = toCSSPrimitiveValue(list->item(0));
- CSSPrimitiveValue* second = toCSSPrimitiveValue(list->item(1));
- if (first->isLength()) {
+ CSSPrimitiveValue& first = toCSSPrimitiveValue(list.item(0));
+ CSSPrimitiveValue& second = toCSSPrimitiveValue(list.item(1));
+ if (first.isLength()) {
// <length>{2}
- size = FloatSize(first->computeLength<float>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0)),
- second->computeLength<float>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0)));
+ size = FloatSize(first.computeLength<float>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0)),
+ second.computeLength<float>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0)));
} else {
// <page-size> <orientation>
size = getPageSizeFromName(first);
- ASSERT(second->getValueID() == CSSValueLandscape || second->getValueID() == CSSValuePortrait);
- if (second->getValueID() == CSSValueLandscape)
+ ASSERT(second.getValueID() == CSSValueLandscape || second.getValueID() == CSSValuePortrait);
+ if (second.getValueID() == CSSValueLandscape)
size = size.transposedSize();
}
pageSizeType = PAGE_SIZE_RESOLVED;
} else {
- ASSERT(list->length() == 1);
+ ASSERT(list.length() == 1);
// <length> | auto | <page-size> | [ portrait | landscape]
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(list->item(0));
- if (primitiveValue->isLength()) {
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(list.item(0));
+ if (primitiveValue.isLength()) {
// <length>
pageSizeType = PAGE_SIZE_RESOLVED;
- float width = primitiveValue->computeLength<float>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0));
+ float width = primitiveValue.computeLength<float>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0));
size = FloatSize(width, width);
} else {
- switch (primitiveValue->getValueID()) {
+ switch (primitiveValue.getValueID()) {
case CSSValueAuto:
pageSizeType = PAGE_SIZE_AUTO;
break;
@@ -373,11 +373,11 @@ void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state,
state.style()->setPageSize(size);
}
-void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& state, CSSValue value)
{
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue->isValueID() && primitiveValue->getValueID() != CSSValueWebkitMatchParent)
- state.style()->setTextAlign(*primitiveValue);
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
+ if (primitiveValue.isValueID() && primitiveValue.getValueID() != CSSValueWebkitMatchParent)
+ state.style()->setTextAlign(primitiveValue);
else if (state.parentStyle()->textAlign() == TASTART)
state.style()->setTextAlign(state.parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT);
else if (state.parentStyle()->textAlign() == TAEND)
@@ -400,19 +400,19 @@ void StyleBuilderFunctions::applyInitialCSSPropertyTextIndent(StyleResolverState
state.style()->setTextIndentType(ComputedStyle::initialTextIndentType());
}
-void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState& state, CSSValue value)
{
Length lengthOrPercentageValue;
TextIndentLine textIndentLineValue = ComputedStyle::initialTextIndentLine();
TextIndentType textIndentTypeValue = ComputedStyle::initialTextIndentType();
- for (auto& listValue : toCSSValueList(*value)) {
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(listValue.get());
- if (!primitiveValue->getValueID())
- lengthOrPercentageValue = primitiveValue->convertToLength(state.cssToLengthConversionData());
- else if (primitiveValue->getValueID() == CSSValueEachLine)
+ for (auto& listValue : toCSSValueList(value)) {
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(listValue);
+ if (!primitiveValue.getValueID())
+ lengthOrPercentageValue = primitiveValue.convertToLength(state.cssToLengthConversionData());
+ else if (primitiveValue.getValueID() == CSSValueEachLine)
textIndentLineValue = TextIndentEachLine;
- else if (primitiveValue->getValueID() == CSSValueHanging)
+ else if (primitiveValue.getValueID() == CSSValueHanging)
textIndentTypeValue = TextIndentHanging;
else
ASSERT_NOT_REACHED();
@@ -423,11 +423,11 @@ void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState&
state.style()->setTextIndentType(textIndentTypeValue);
}
-void StyleBuilderFunctions::applyValueCSSPropertyTransform(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyTransform(StyleResolverState& state, CSSValue value)
{
// FIXME: We should just make this a converter
TransformOperations operations;
- TransformBuilder::createTransformOperations(*value, state.cssToLengthConversionData(), operations);
+ TransformBuilder::createTransformOperations(value, state.cssToLengthConversionData(), operations);
state.style()->setTransform(operations);
}
@@ -439,15 +439,15 @@ void StyleBuilderFunctions::applyInheritCSSPropertyMotionPath(StyleResolverState
state.style()->resetMotionPath();
}
-void StyleBuilderFunctions::applyValueCSSPropertyMotionPath(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyMotionPath(StyleResolverState& state, CSSValue value)
{
- if (value->isPathValue()) {
- const String& pathString = toCSSPathValue(value)->pathString();
+ if (value.isPathValue()) {
+ const String& pathString = toCSSPathValue(value).pathString();
state.style()->setMotionPath(PathStyleMotionPath::create(pathString));
return;
}
- ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
+ ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueNone);
state.style()->resetMotionPath();
}
@@ -468,25 +468,25 @@ void StyleBuilderFunctions::applyInitialCSSPropertyMotionRotation(StyleResolverS
state.style()->setMotionRotationType(ComputedStyle::initialMotionRotationType());
}
-void StyleBuilderFunctions::applyValueCSSPropertyMotionRotation(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyMotionRotation(StyleResolverState& state, CSSValue value)
{
float rotation = 0;
MotionRotationType rotationType = MotionRotationFixed;
- ASSERT(value->isValueList());
- CSSValueList* list = toCSSValueList(value);
- int len = list->length();
+ ASSERT(value.isValueList());
+ CSSValueList& list = toCSSValueList(value);
+ int len = list.length();
for (int i = 0; i < len; i++) {
- CSSValue* item = list->item(i);
- ASSERT(item->isPrimitiveValue());
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
- if (primitiveValue->getValueID() == CSSValueAuto) {
+ CSSValue item = list.item(i);
+ ASSERT(item.isPrimitiveValue());
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(item);
+ if (primitiveValue.getValueID() == CSSValueAuto) {
rotationType = MotionRotationAuto;
- } else if (primitiveValue->getValueID() == CSSValueReverse) {
+ } else if (primitiveValue.getValueID() == CSSValueReverse) {
rotationType = MotionRotationAuto;
rotation += 180;
} else {
- rotation += primitiveValue->computeDegrees();
+ rotation += primitiveValue.computeDegrees();
}
}
@@ -502,14 +502,14 @@ void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt
state.style()->setVerticalAlignLength(state.parentStyle()->verticalAlignLength());
}
-void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverState& state, CSSValue value)
{
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue->getValueID())
- state.style()->setVerticalAlign(*primitiveValue);
+ if (primitiveValue.getValueID())
+ state.style()->setVerticalAlign(primitiveValue);
else
- state.style()->setVerticalAlignLength(primitiveValue->convertToLength(state.cssToLengthConversionData()));
+ state.style()->setVerticalAlignLength(primitiveValue.convertToLength(state.cssToLengthConversionData()));
}
static void resetEffectiveZoom(StyleResolverState& state)
@@ -530,49 +530,49 @@ void StyleBuilderFunctions::applyInheritCSSPropertyZoom(StyleResolverState& stat
state.setZoom(state.parentStyle()->zoom());
}
-void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyZoom(StyleResolverState& state, CSSValue value)
{
- ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue());
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue->getValueID() == CSSValueNormal) {
+ if (primitiveValue.getValueID() == CSSValueNormal) {
resetEffectiveZoom(state);
state.setZoom(ComputedStyle::initialZoom());
- } else if (primitiveValue->getValueID() == CSSValueReset) {
+ } else if (primitiveValue.getValueID() == CSSValueReset) {
state.setEffectiveZoom(ComputedStyle::initialZoom());
state.setZoom(ComputedStyle::initialZoom());
- } else if (primitiveValue->getValueID() == CSSValueDocument) {
+ } else if (primitiveValue.getValueID() == CSSValueDocument) {
float docZoom = state.rootElementStyle() ? state.rootElementStyle()->zoom() : ComputedStyle::initialZoom();
state.setEffectiveZoom(docZoom);
state.setZoom(docZoom);
- } else if (primitiveValue->isPercentage()) {
+ } else if (primitiveValue.isPercentage()) {
resetEffectiveZoom(state);
- if (float percent = primitiveValue->getFloatValue())
+ if (float percent = primitiveValue.getFloatValue())
state.setZoom(percent / 100.0f);
- } else if (primitiveValue->isNumber()) {
+ } else if (primitiveValue.isNumber()) {
resetEffectiveZoom(state);
- if (float number = primitiveValue->getFloatValue())
+ if (float number = primitiveValue.getFloatValue())
state.setZoom(number);
}
}
-void StyleBuilderFunctions::applyValueCSSPropertyWebkitBorderImage(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitBorderImage(StyleResolverState& state, CSSValue value)
{
NinePieceImage image;
CSSToStyleMap::mapNinePieceImage(state, CSSPropertyWebkitBorderImage, value, image);
state.style()->setBorderImage(image);
}
-void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolverState& state, CSSValue value)
{
- if (value->isPrimitiveValue()) {
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue->getValueID() == CSSValueNone) {
+ if (value.isPrimitiveValue()) {
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
+ if (primitiveValue.getValueID() == CSSValueNone) {
state.style()->setClipPath(nullptr);
- } else if (primitiveValue->isShape()) {
- state.style()->setClipPath(ShapeClipPathOperation::create(basicShapeForValue(state, primitiveValue->getShapeValue())));
- } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_URI) {
- String cssURLValue = primitiveValue->getStringValue();
+ } else if (primitiveValue.isShape()) {
+ state.style()->setClipPath(ShapeClipPathOperation::create(basicShapeForValue(state, primitiveValue.getShapeValue())));
+ } else if (primitiveValue.primitiveType() == CSSPrimitiveValue::CSS_URI) {
+ String cssURLValue = primitiveValue.getStringValue();
KURL url = state.document().completeURL(cssURLValue);
// FIXME: It doesn't work with forward or external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=90405)
state.style()->setClipPath(ReferenceClipPathOperation::create(cssURLValue, AtomicString(url.fragmentIdentifier())));
@@ -580,7 +580,7 @@ void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolverSta
}
}
-void StyleBuilderFunctions::applyValueCSSPropertyWebkitFilter(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitFilter(StyleResolverState& state, CSSValue value)
{
FilterOperations operations;
if (FilterOperationResolver::createFilterOperations(value, state.cssToLengthConversionData(), operations, state))
@@ -601,39 +601,39 @@ void StyleBuilderFunctions::applyInheritCSSPropertyWebkitTextEmphasisStyle(Style
state.style()->setTextEmphasisCustomMark(state.parentStyle()->textEmphasisCustomMark());
}
-void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleResolverState& state, CSSValue value)
{
- if (value->isValueList()) {
- CSSValueList* list = toCSSValueList(value);
- ASSERT(list->length() == 2);
+ if (value.isValueList()) {
+ CSSValueList& list = toCSSValueList(value);
+ ASSERT(list.length() == 2);
for (unsigned i = 0; i < 2; ++i) {
- CSSPrimitiveValue* value = toCSSPrimitiveValue(list->item(i));
- if (value->getValueID() == CSSValueFilled || value->getValueID() == CSSValueOpen)
- state.style()->setTextEmphasisFill(*value);
+ CSSPrimitiveValue& value = toCSSPrimitiveValue(list.item(i));
+ if (value.getValueID() == CSSValueFilled || value.getValueID() == CSSValueOpen)
+ state.style()->setTextEmphasisFill(value);
else
- state.style()->setTextEmphasisMark(*value);
+ state.style()->setTextEmphasisMark(value);
}
state.style()->setTextEmphasisCustomMark(nullAtom);
return;
}
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue->isString()) {
+ if (primitiveValue.isString()) {
state.style()->setTextEmphasisFill(TextEmphasisFillFilled);
state.style()->setTextEmphasisMark(TextEmphasisMarkCustom);
- state.style()->setTextEmphasisCustomMark(AtomicString(primitiveValue->getStringValue()));
+ state.style()->setTextEmphasisCustomMark(AtomicString(primitiveValue.getStringValue()));
return;
}
state.style()->setTextEmphasisCustomMark(nullAtom);
- if (primitiveValue->getValueID() == CSSValueFilled || primitiveValue->getValueID() == CSSValueOpen) {
- state.style()->setTextEmphasisFill(*primitiveValue);
+ if (primitiveValue.getValueID() == CSSValueFilled || primitiveValue.getValueID() == CSSValueOpen) {
+ state.style()->setTextEmphasisFill(primitiveValue);
state.style()->setTextEmphasisMark(TextEmphasisMarkAuto);
} else {
state.style()->setTextEmphasisFill(TextEmphasisFillFilled);
- state.style()->setTextEmphasisMark(*primitiveValue);
+ state.style()->setTextEmphasisMark(primitiveValue);
}
}
@@ -653,20 +653,20 @@ void StyleBuilderFunctions::applyInheritCSSPropertyWillChange(StyleResolverState
state.style()->setSubtreeWillChangeContents(state.parentStyle()->subtreeWillChangeContents());
}
-void StyleBuilderFunctions::applyValueCSSPropertyWillChange(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyWillChange(StyleResolverState& state, CSSValue value)
{
- ASSERT(value->isValueList());
+ ASSERT(value.isValueList());
bool willChangeContents = false;
bool willChangeScrollPosition = false;
Vector<CSSPropertyID> willChangeProperties;
- for (auto& willChangeValue : toCSSValueList(*value)) {
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(willChangeValue.get());
- if (CSSPropertyID propertyID = primitiveValue->getPropertyID())
+ for (auto& willChangeValue : toCSSValueList(value)) {
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(willChangeValue);
+ if (CSSPropertyID propertyID = primitiveValue.getPropertyID())
willChangeProperties.append(propertyID);
- else if (primitiveValue->getValueID() == CSSValueContents)
+ else if (primitiveValue.getValueID() == CSSValueContents)
willChangeContents = true;
- else if (primitiveValue->getValueID() == CSSValueScrollPosition)
+ else if (primitiveValue.getValueID() == CSSValueScrollPosition)
willChangeScrollPosition = true;
else
ASSERT_NOT_REACHED();
@@ -688,46 +688,46 @@ void StyleBuilderFunctions::applyInheritCSSPropertyContent(StyleResolverState&)
// note is a reminder that eventually "inherit" needs to be supported.
}
-void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& state, CSSValue value)
{
// list of string, uri, counter, attr, i
bool didSet = false;
- for (auto& item : toCSSValueList(*value)) {
- if (item->isImageGeneratorValue()) {
- state.style()->setContent(StyleGeneratedImage::create(toCSSImageGeneratorValue(item.get())), didSet);
+ for (auto& item : toCSSValueList(value)) {
+ if (item.isImageGeneratorValue()) {
+ state.style()->setContent(StyleGeneratedImage::create(&toCSSImageGeneratorValue(item)), didSet);
didSet = true;
- } else if (item->isImageSetValue()) {
- state.style()->setContent(state.elementStyleResources().setOrPendingFromValue(CSSPropertyContent, toCSSImageSetValue(item.get())), didSet);
+ } else if (item.isImageSetValue()) {
+ state.style()->setContent(state.elementStyleResources().setOrPendingFromValue(CSSPropertyContent, toCSSImageSetValue(item)), didSet);
didSet = true;
}
- if (item->isImageValue()) {
- state.style()->setContent(state.elementStyleResources().cachedOrPendingFromValue(state.document(), CSSPropertyContent, toCSSImageValue(item.get())), didSet);
+ if (item.isImageValue()) {
+ state.style()->setContent(state.elementStyleResources().cachedOrPendingFromValue(state.document(), CSSPropertyContent, toCSSImageValue(item)), didSet);
didSet = true;
continue;
}
- if (!item->isPrimitiveValue())
+ if (!item.isPrimitiveValue())
continue;
- CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item.get());
+ CSSPrimitiveValue& contentValue = toCSSPrimitiveValue(item);
- if (contentValue->isString()) {
- state.style()->setContent(contentValue->getStringValue().impl(), didSet);
+ if (contentValue.isString()) {
+ state.style()->setContent(contentValue.getStringValue().impl(), didSet);
didSet = true;
- } else if (contentValue->isAttr()) {
+ } else if (contentValue.isAttr()) {
// FIXME: Can a namespace be specified for an attr(foo)?
if (state.style()->styleType() == NOPSEUDO)
state.style()->setUnique();
else
state.parentStyle()->setUnique();
- QualifiedName attr(nullAtom, AtomicString(contentValue->getStringValue()), nullAtom);
+ QualifiedName attr(nullAtom, AtomicString(contentValue.getStringValue()), nullAtom);
const AtomicString& value = state.element()->getAttribute(attr);
state.style()->setContent(value.isNull() ? emptyString() : value.string(), didSet);
didSet = true;
- } else if (contentValue->isCounter()) {
- Counter* counterValue = contentValue->getCounterValue();
+ } else if (contentValue.isCounter()) {
+ Counter* counterValue = contentValue.getCounterValue();
EListStyleType listStyleType = NoneListStyle;
CSSValueID listStyleIdent = counterValue->listStyleIdent();
if (listStyleIdent != CSSValueNone)
@@ -736,7 +736,7 @@ void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& sta
state.style()->setContent(counter.release(), didSet);
didSet = true;
} else {
- switch (contentValue->getValueID()) {
+ switch (contentValue.getValueID()) {
case CSSValueOpenQuote:
state.style()->setContent(OPEN_QUOTE, didSet);
didSet = true;
@@ -763,13 +763,13 @@ void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& sta
state.style()->clearContent();
}
-void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState& state, CSSValue value)
{
- const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue->getValueID() == CSSValueAuto)
+ const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
+ if (primitiveValue.getValueID() == CSSValueAuto)
state.style()->setLocale(nullAtom);
else
- state.style()->setLocale(AtomicString(primitiveValue->getStringValue()));
+ state.style()->setLocale(AtomicString(primitiveValue.getStringValue()));
state.fontBuilder().setScript(state.style()->locale());
}
@@ -781,21 +781,21 @@ void StyleBuilderFunctions::applyInheritCSSPropertyWebkitAppRegion(StyleResolver
{
}
-void StyleBuilderFunctions::applyValueCSSPropertyWebkitAppRegion(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitAppRegion(StyleResolverState& state, CSSValue value)
{
- const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- state.style()->setDraggableRegionMode(primitiveValue->getValueID() == CSSValueDrag ? DraggableRegionDrag : DraggableRegionNoDrag);
+ const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
+ state.style()->setDraggableRegionMode(primitiveValue.getValueID() == CSSValueDrag ? DraggableRegionDrag : DraggableRegionNoDrag);
state.document().setHasAnnotatedRegions(true);
}
-void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolverState& state, CSSValue value)
{
- state.setWritingMode(*toCSSPrimitiveValue(value));
+ state.setWritingMode(toCSSPrimitiveValue(value));
}
-void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleResolverState& state, CSSValue value)
{
- state.setTextOrientation(*toCSSPrimitiveValue(value));
+ state.setTextOrientation(toCSSPrimitiveValue(value));
}
void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift(StyleResolverState& state)
@@ -808,16 +808,16 @@ void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift(StyleResolverSt
svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue());
}
-void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverState& state, CSSValue value)
{
SVGComputedStyle& svgStyle = state.style()->accessSVGStyle();
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- if (!primitiveValue->isValueID()) {
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
+ if (!primitiveValue.isValueID()) {
svgStyle.setBaselineShift(BS_LENGTH);
- svgStyle.setBaselineShiftValue(StyleBuilderConverter::convertLength(state, primitiveValue));
+ svgStyle.setBaselineShiftValue(StyleBuilderConverter::convertLength(state, value));
return;
}
- switch (primitiveValue->getValueID()) {
+ switch (primitiveValue.getValueID()) {
case CSSValueBaseline:
svgStyle.setBaselineShift(BS_LENGTH);
svgStyle.setBaselineShiftValue(Length(Fixed));
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698