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

Unified Diff: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl

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: Some small fixes to (hopefully) fix some broken tests Created 5 years, 7 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
Index: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
diff --git a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
index da95da69b3f99c926d7968be98e19f9dd816f8fe..334c87defe761cf8b34f14dda790e0f6b4f84a60 100644
--- a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
+++ b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
@@ -23,7 +23,7 @@ void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& stat
void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& state)
{%- endmacro %}
{% macro declare_value_function(property_id) %}
-void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state, CSSValue value)
{%- endmacro %}
{% macro set_value(property) %}
{% if property.svg %}
@@ -38,7 +38,7 @@ state.style()->{{property.setter}}
{% if property.converter %}
{{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state, value));
{%- else %}
-{{set_value(property)}}(static_cast<{{property.type_name}}>(*toCSSPrimitiveValue(value)));
+{{set_value(property)}}(static_cast<{{property.type_name}}>(toCSSPrimitiveValue(value)));
{%- endif %}
{% endmacro %}
@@ -103,8 +103,8 @@ namespace blink {
{
CSS{{animation}}Data& data = state.style()->access{{animation}}s();
data.{{vector}}.clear();
- for (auto& listValue : toCSSValueList(*value))
- data.{{vector}}.append(CSSToStyleMap::mapAnimation{{attribute}}(listValue.get()));
+ for (auto& listValue : toCSSValueList(value))
+ data.{{vector}}.append(CSSToStyleMap::mapAnimation{{attribute}}(listValue));
}
{% endmacro %}
{{apply_animation('CSSPropertyAnimationDelay', 'Delay', 'Animation')}}
@@ -139,11 +139,11 @@ namespace blink {
{{declare_value_function(property_id)}}
{
- if (!value->isPrimitiveValue())
+ if (!value.isPrimitiveValue())
return;
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue->getValueID() == {{auto_identity}})
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
+ if (primitiveValue.getValueID() == {{auto_identity}})
state.style()->{{auto_setter}}();
else
{{convert_and_set_value(property)}}
@@ -349,22 +349,22 @@ static bool lengthTypeAndValueMatch(const BorderImageLengthBox& borderImageLengt
{
state.style()->clear{{action}}Directives();
- if (!value->isValueList()) {
- ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
+ if (!value.isValueList()) {
+ ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == CSSValueNone);
return;
}
CounterDirectiveMap& map = state.style()->accessCounterDirectives();
- CSSValueList* list = toCSSValueList(value);
+ CSSValueList& list = toCSSValueList(value);
- int length = list ? list->length() : 0;
+ int length = list.length();
for (int i = 0; i < length; ++i) {
- CSSValue* currValue = list->item(i);
- if (!currValue->isPrimitiveValue())
+ CSSValue currValue = list.item(i);
+ if (!currValue.isPrimitiveValue())
continue;
- Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue();
+ Pair* pair = toCSSPrimitiveValue(currValue).getPairValue();
if (!pair || !pair->first() || !pair->second())
continue;
@@ -421,13 +421,13 @@ static bool lengthTypeAndValueMatch(const BorderImageLengthBox& borderImageLengt
{
FillLayer* currChild = &state.style()->{{access_layers}}();
FillLayer* prevChild = 0;
- if (value->isValueList() && !value->isImageSetValue()) {
+ if (value.isValueList() && !value.isImageSetValue()) {
/* Walk each value and put it into a layer, creating new layers as needed. */
- CSSValueList* valueList = toCSSValueList(value);
- for (unsigned int i = 0; i < valueList->length(); i++) {
+ CSSValueList& valueList = toCSSValueList(value);
+ for (unsigned int i = 0; i < valueList.length(); i++) {
if (!currChild)
currChild = prevChild->ensureNext();
- CSSToStyleMap::{{map_fill}}(state, currChild, valueList->item(i));
+ CSSToStyleMap::{{map_fill}}(state, currChild, valueList.item(i));
prevChild = currChild;
currChild = currChild->next();
}
@@ -523,35 +523,35 @@ static bool lengthTypeAndValueMatch(const BorderImageLengthBox& borderImageLengt
{{declare_value_function(property_id)}}
{
String url;
- if (value->isValueList()) {
- CSSValueList* list = toCSSValueList(value);
- ASSERT(list->length() > 1);
+ if (value.isValueList()) {
+ CSSValueList& list = toCSSValueList(value);
+ ASSERT(list.length() > 1);
- if (!list->item(0)->isPrimitiveValue())
+ if (!list.item(0).isPrimitiveValue())
return;
- CSSPrimitiveValue* pValue = toCSSPrimitiveValue(list->item(0));
- if (!pValue->isURI())
+ CSSPrimitiveValue& pValue = toCSSPrimitiveValue(list.item(0));
+ if (!pValue.isURI())
return;
- url = pValue->getStringValue();
- value = list->item(1);
+ url = pValue.getStringValue();
+ value = list.item(1);
}
- if (value->isPrimitiveValue()) {
- CSSPrimitiveValue* pValue = toCSSPrimitiveValue(value);
+ if (value.isPrimitiveValue()) {
+ CSSPrimitiveValue& pValue = toCSSPrimitiveValue(value);
Color c;
SVGPaintType ptype = SVG_PAINTTYPE_RGBCOLOR;
- if (pValue->isRGBColor()) {
- c = pValue->getRGBA32Value();
+ if (pValue.isRGBColor()) {
+ c = pValue.getRGBA32Value();
ptype = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_RGBCOLOR;
- } else if (pValue->getValueID() == CSSValueCurrentcolor) {
+ } else if (pValue.getValueID() == CSSValueCurrentcolor) {
c = state.style()->color();
ptype = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTYPE_URI_CURRENTCOLOR;
- } else if (pValue->getValueID() == CSSValueNone) {
+ } else if (pValue.getValueID() == CSSValueNone) {
ptype = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE;
- } else if (pValue->isURI()) {
+ } else if (pValue.isURI()) {
ptype = SVG_PAINTTYPE_URI;
- url = pValue->getStringValue();
+ url = pValue.getStringValue();
} else {
return;
}

Powered by Google App Engine
This is Rietveld 408576698