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

Side by Side Diff: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl

Issue 1249553002: CSSValue Immediates: Add move operators to CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_3_tagged_ptrs_with_copy_ops_mv_operators_ref_primvalue
Patch Set: Rebase Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/animation/ColorStyleInterpolation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% from 'macros.tmpl' import license %} 1 {% from 'macros.tmpl' import license %}
2 {# 2 {#
3 This file is for property handlers which use the templating engine to 3 This file is for property handlers which use the templating engine to
4 reduce (handwritten) code duplication. 4 reduce (handwritten) code duplication.
5 5
6 The `properties' dict can be used to access a property's parameters in 6 The `properties' dict can be used to access a property's parameters in
7 jinja2 templates (i.e. setter, getter, initial, type_name) 7 jinja2 templates (i.e. setter, getter, initial, type_name)
8 #} 8 #}
9 #include "config.h" 9 #include "config.h"
10 #include "StyleBuilderFunctions.h" 10 #include "StyleBuilderFunctions.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 state.style()->{{auto_setter}}(); 135 state.style()->{{auto_setter}}();
136 else 136 else
137 {{set_value(property)}}(state.parentStyle()->{{property.getter}}()); 137 {{set_value(property)}}(state.parentStyle()->{{property.getter}}());
138 } 138 }
139 139
140 {{declare_value_function(property_id)}} 140 {{declare_value_function(property_id)}}
141 { 141 {
142 if (!value.isPrimitiveValue()) 142 if (!value.isPrimitiveValue())
143 return; 143 return;
144 144
145 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 145 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
146 if (primitiveValue.getValueID() == {{auto_identity}}) 146 if (primitiveValue.getValueID() == {{auto_identity}})
147 state.style()->{{auto_setter}}(); 147 state.style()->{{auto_setter}}();
148 else 148 else
149 {{convert_and_set_value(property)}} 149 {{convert_and_set_value(property)}}
150 } 150 }
151 {% endmacro %} 151 {% endmacro %}
152 {{apply_auto('CSSPropertyClip')}} 152 {{apply_auto('CSSPropertyClip')}}
153 {{apply_auto('CSSPropertyOrphans')}} 153 {{apply_auto('CSSPropertyOrphans')}}
154 {{apply_auto('CSSPropertyWebkitColumnCount')}} 154 {{apply_auto('CSSPropertyWebkitColumnCount')}}
155 {{apply_auto('CSSPropertyWebkitColumnGap', auto_getter='hasNormalColumnGap', aut o_setter='setHasNormalColumnGap', auto_identity='CSSValueNormal')}} 155 {{apply_auto('CSSPropertyWebkitColumnGap', auto_getter='hasNormalColumnGap', aut o_setter='setHasNormalColumnGap', auto_identity='CSSValueNormal')}}
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID () == CSSValueNone); 343 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID () == CSSValueNone);
344 return; 344 return;
345 } 345 }
346 346
347 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); 347 CounterDirectiveMap& map = state.style()->accessCounterDirectives();
348 348
349 CSSValueList& list = toCSSValueList(value); 349 CSSValueList& list = toCSSValueList(value);
350 350
351 int length = list.length(); 351 int length = list.length();
352 for (int i = 0; i < length; ++i) { 352 for (int i = 0; i < length; ++i) {
353 CSSValue currValue = list.item(i); 353 const CSSValue& currValue = list.item(i);
354 if (!currValue.isPrimitiveValue()) 354 if (!currValue.isPrimitiveValue())
355 continue; 355 continue;
356 356
357 Pair* pair = toCSSPrimitiveValue(currValue).getPairValue(); 357 Pair* pair = toCSSPrimitiveValue(currValue).getPairValue();
358 if (!pair || !pair->first() || !pair->second()) 358 if (!pair)
359 continue; 359 continue;
360 360
361 AtomicString identifier(pair->first()->getStringValue()); 361 AtomicString identifier(pair->first().getStringValue());
362 int value = pair->second()->getIntValue(); 362 int value = pair->second().getIntValue();
363 CounterDirectives& directives = map.add(identifier, CounterDirectives()) .storedValue->value; 363 CounterDirectives& directives = map.add(identifier, CounterDirectives()) .storedValue->value;
364 {% if action == 'Reset' %} 364 {% if action == 'Reset' %}
365 directives.setResetValue(value); 365 directives.setResetValue(value);
366 {% else %} 366 {% else %}
367 directives.addIncrementValue(value); 367 directives.addIncrementValue(value);
368 {% endif %} 368 {% endif %}
369 } 369 }
370 ASSERT(!map.isEmpty()); 370 ASSERT(!map.isEmpty());
371 } 371 }
372 {% endmacro %} 372 {% endmacro %}
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 svgParentStyle.{{paint_type|lower_first}}Type(), 506 svgParentStyle.{{paint_type|lower_first}}Type(),
507 svgParentStyle.{{paint_type|lower_first}}Color(), 507 svgParentStyle.{{paint_type|lower_first}}Color(),
508 svgParentStyle.{{paint_type|lower_first}}Uri(), 508 svgParentStyle.{{paint_type|lower_first}}Uri(),
509 state.applyPropertyToRegularStyle(), 509 state.applyPropertyToRegularStyle(),
510 state.applyPropertyToVisitedLinkStyle()); 510 state.applyPropertyToVisitedLinkStyle());
511 } 511 }
512 512
513 {{declare_value_function(property_id)}} 513 {{declare_value_function(property_id)}}
514 { 514 {
515 String url; 515 String url;
516 CSSValue valueToUse = value; 516 CSSValue realValue = value;
517 if (valueToUse.isValueList()) { 517 if (realValue.isValueList()) {
518 CSSValueList& list = toCSSValueList(valueToUse); 518 const CSSValueList& list = toCSSValueList(realValue);
519 ASSERT(list.length() > 1); 519 ASSERT(list.length() > 1);
520 520
521 if (!list.item(0).isPrimitiveValue()) 521 if (!list.item(0).isPrimitiveValue())
522 return; 522 return;
523 523
524 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(list.item(0)); 524 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(list.item( 0));
525 if (!primitiveValue.isURI()) 525 if (!primitiveValue.isURI())
526 return; 526 return;
527 527
528 url = primitiveValue.getStringValue(); 528 url = primitiveValue.getStringValue();
529 valueToUse = list.item(1); 529 realValue = list.item(1);
530 } 530 }
531 if (valueToUse.isPrimitiveValue()) { 531 if (realValue.isPrimitiveValue()) {
532 CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(valueToUse); 532 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(realValue) ;
533 Color color; 533 Color color;
534 SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR; 534 SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR;
535 if (primitiveValue.getValueID() == CSSValueNone) { 535 if (primitiveValue.getValueID() == CSSValueNone) {
536 paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_N ONE; 536 paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_N ONE;
537 } else if (primitiveValue.isURI()) { 537 } else if (primitiveValue.isURI()) {
538 paintType = SVG_PAINTTYPE_URI; 538 paintType = SVG_PAINTTYPE_URI;
539 url = primitiveValue.getStringValue(); 539 url = primitiveValue.getStringValue();
540 } else if (primitiveValue.getValueID() == CSSValueCurrentcolor) { 540 } else if (primitiveValue.getValueID() == CSSValueCurrentcolor) {
541 color = state.style()->color(); 541 color = state.style()->color();
542 paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTY PE_URI_CURRENTCOLOR; 542 paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTY PE_URI_CURRENTCOLOR;
543 } else { 543 } else {
544 color = StyleBuilderConverter::convertColor(state, valueToUse); 544 color = StyleBuilderConverter::convertColor(state, realValue);
545 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_U RI_RGBCOLOR; 545 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_U RI_RGBCOLOR;
546 } 546 }
547 {{set_value(property)}}(paintType, color, url, 547 {{set_value(property)}}(paintType, color, url,
548 state.applyPropertyToRegularStyle(), 548 state.applyPropertyToRegularStyle(),
549 state.applyPropertyToVisitedLinkStyle()); 549 state.applyPropertyToVisitedLinkStyle());
550 } 550 }
551 } 551 }
552 {% endmacro %} 552 {% endmacro %}
553 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 553 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
554 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 554 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
555 } // namespace blink 555 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/animation/ColorStyleInterpolation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698