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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/css/resolver/AnimatedStyleBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7e5a92b6dacbdf13defc83172b6bca914fb53318..47e425cedd26a4c09b1f706e3793107bd2218ccf 100644
--- a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
+++ b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
@@ -400,11 +400,8 @@ static bool lengthTypeAndValueMatch(const BorderImageLengthBox& borderImageLengt
FillLayer* prevChild = 0;
const FillLayer* currParent = &state.parentStyle()->{{layer_type|lower}}Layers();
while (currParent && currParent->is{{fill_type}}Set()) {
- if (!currChild) {
- /* Need to make a new layer.*/
- currChild = new FillLayer({{fill_layer_type}});
- prevChild->setNext(currChild);
- }
+ if (!currChild)
+ currChild = prevChild->ensureNext();
currChild->set{{fill_type}}(currParent->{{fill_type|lower_first}}());
prevChild = currChild;
currChild = prevChild->next();
@@ -426,11 +423,8 @@ static bool lengthTypeAndValueMatch(const BorderImageLengthBox& borderImageLengt
/* 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++) {
- if (!currChild) {
- /* Need to make a new layer to hold this value */
- currChild = new FillLayer({{fill_layer_type}});
- prevChild->setNext(currChild);
- }
+ if (!currChild)
+ currChild = prevChild->ensureNext();
state.styleMap().{{map_fill}}({{property_id}}, currChild, valueList->item(i));
prevChild = currChild;
currChild = currChild->next();
« 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