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

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: 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
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 9e8d9ad1d90e463d49061a0c9aee00a7e6c10d1f..c25ed31b0e276f1850137f0f6c38d5962f17f3ba 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)}}
@@ -339,22 +339,22 @@ static bool borderImageLengthMatchesAllSides(const BorderImageLengthBox& borderI
{
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;
@@ -411,13 +411,13 @@ static bool borderImageLengthMatchesAllSides(const BorderImageLengthBox& borderI
{
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();
}
@@ -513,34 +513,34 @@ static bool borderImageLengthMatchesAllSides(const BorderImageLengthBox& borderI
{{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* primitiveValue = toCSSPrimitiveValue(list->item(0));
- if (!primitiveValue->isURI())
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(list.item(0));
+ if (!primitiveValue.isURI())
return;
- url = primitiveValue->getStringValue();
- value = list->item(1);
+ url = primitiveValue.getStringValue();
+ value = list.item(1);
}
- if (value->isPrimitiveValue()) {
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ if (value.isPrimitiveValue()) {
+ CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
Color color;
SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR;
- if (primitiveValue->getValueID() == CSSValueNone) {
+ if (primitiveValue.getValueID() == CSSValueNone) {
paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE;
- } else if (primitiveValue->isURI()) {
+ } else if (primitiveValue.isURI()) {
paintType = SVG_PAINTTYPE_URI;
- url = primitiveValue->getStringValue();
- } else if (primitiveValue->getValueID() == CSSValueCurrentcolor) {
+ url = primitiveValue.getStringValue();
+ } else if (primitiveValue.getValueID() == CSSValueCurrentcolor) {
color = state.style()->color();
paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTYPE_URI_CURRENTCOLOR;
} else {
- color = StyleBuilderConverter::convertColor(state, primitiveValue);
+ color = StyleBuilderConverter::convertColor(state, value);
paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_RGBCOLOR;
}
{{set_value(property)}}(paintType, color, url,
« no previous file with comments | « Source/build/scripts/templates/StyleBuilder.cpp.tmpl ('k') | Source/build/scripts/templates/StyleBuilderFunctions.h.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698