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

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

Issue 405093002: Slightly simplify building FillLayer objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/css/resolver/AnimatedStyleBuilder.cpp » ('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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 for (currChild = currChild->next(); currChild; currChild = currChild->next() ) 393 for (currChild = currChild->next(); currChild; currChild = currChild->next() )
394 currChild->clear{{fill_type}}(); 394 currChild->clear{{fill_type}}();
395 } 395 }
396 396
397 {{declare_inherit_function(property_id)}} 397 {{declare_inherit_function(property_id)}}
398 { 398 {
399 FillLayer* currChild = &state.style()->{{access_layers}}(); 399 FillLayer* currChild = &state.style()->{{access_layers}}();
400 FillLayer* prevChild = 0; 400 FillLayer* prevChild = 0;
401 const FillLayer* currParent = &state.parentStyle()->{{layer_type|lower}}Laye rs(); 401 const FillLayer* currParent = &state.parentStyle()->{{layer_type|lower}}Laye rs();
402 while (currParent && currParent->is{{fill_type}}Set()) { 402 while (currParent && currParent->is{{fill_type}}Set()) {
403 if (!currChild) { 403 if (!currChild)
404 /* Need to make a new layer.*/ 404 currChild = prevChild->ensureNext();
405 currChild = new FillLayer({{fill_layer_type}});
406 prevChild->setNext(currChild);
407 }
408 currChild->set{{fill_type}}(currParent->{{fill_type|lower_first}}()); 405 currChild->set{{fill_type}}(currParent->{{fill_type|lower_first}}());
409 prevChild = currChild; 406 prevChild = currChild;
410 currChild = prevChild->next(); 407 currChild = prevChild->next();
411 currParent = currParent->next(); 408 currParent = currParent->next();
412 } 409 }
413 410
414 while (currChild) { 411 while (currChild) {
415 /* Reset any remaining layers to not have the property set. */ 412 /* Reset any remaining layers to not have the property set. */
416 currChild->clear{{fill_type}}(); 413 currChild->clear{{fill_type}}();
417 currChild = currChild->next(); 414 currChild = currChild->next();
418 } 415 }
419 } 416 }
420 417
421 {{declare_value_function(property_id)}} 418 {{declare_value_function(property_id)}}
422 { 419 {
423 FillLayer* currChild = &state.style()->{{access_layers}}(); 420 FillLayer* currChild = &state.style()->{{access_layers}}();
424 FillLayer* prevChild = 0; 421 FillLayer* prevChild = 0;
425 if (value->isValueList() && !value->isImageSetValue()) { 422 if (value->isValueList() && !value->isImageSetValue()) {
426 /* Walk each value and put it into a layer, creating new layers as neede d. */ 423 /* Walk each value and put it into a layer, creating new layers as neede d. */
427 CSSValueList* valueList = toCSSValueList(value); 424 CSSValueList* valueList = toCSSValueList(value);
428 for (unsigned int i = 0; i < valueList->length(); i++) { 425 for (unsigned int i = 0; i < valueList->length(); i++) {
429 if (!currChild) { 426 if (!currChild)
430 /* Need to make a new layer to hold this value */ 427 currChild = prevChild->ensureNext();
431 currChild = new FillLayer({{fill_layer_type}});
432 prevChild->setNext(currChild);
433 }
434 state.styleMap().{{map_fill}}({{property_id}}, currChild, valueList- >item(i)); 428 state.styleMap().{{map_fill}}({{property_id}}, currChild, valueList- >item(i));
435 prevChild = currChild; 429 prevChild = currChild;
436 currChild = currChild->next(); 430 currChild = currChild->next();
437 } 431 }
438 } else { 432 } else {
439 state.styleMap().{{map_fill}}({{property_id}}, currChild, value); 433 state.styleMap().{{map_fill}}({{property_id}}, currChild, value);
440 currChild = currChild->next(); 434 currChild = currChild->next();
441 } 435 }
442 while (currChild) { 436 while (currChild) {
443 /* Reset all remaining layers to not have the property set. */ 437 /* Reset all remaining layers to not have the property set. */
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 } 636 }
643 {{set_value(property)}}(ptype, c, url, 637 {{set_value(property)}}(ptype, c, url,
644 state.applyPropertyToRegularStyle(), 638 state.applyPropertyToRegularStyle(),
645 state.applyPropertyToVisitedLinkStyle()); 639 state.applyPropertyToVisitedLinkStyle());
646 } 640 }
647 } 641 }
648 {% endmacro %} 642 {% endmacro %}
649 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 643 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
650 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 644 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
651 } // namespace WebCore 645 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/resolver/AnimatedStyleBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698