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

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

Issue 2611823003: ABANDONED CL: Changes to compile and pass tests after Big Blink Rename (excluding functions). (Closed)
Patch Set: Inducing merge conflicts to force human review and changes after rename. Created 3 years, 11 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
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 "StyleBuilderFunctions.h" 9 #include "StyleBuilderFunctions.h"
10 10
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 {% macro apply_border_image_modifier(property_id, modifier_type) %} 179 {% macro apply_border_image_modifier(property_id, modifier_type) %}
180 {% set is_mask_box = 'MaskBox' in property_id %} 180 {% set is_mask_box = 'MaskBox' in property_id %}
181 {% set getter = 'maskBoxImage' if is_mask_box else 'borderImage' %} 181 {% set getter = 'maskBoxImage' if is_mask_box else 'borderImage' %}
182 {% set setter = 'setMaskBoxImage' if is_mask_box else 'setBorderImage' %} 182 {% set setter = 'setMaskBoxImage' if is_mask_box else 'setBorderImage' %}
183 {{ declare_initial_function(property_id) }} { 183 {{ declare_initial_function(property_id) }} {
184 const NinePieceImage& currentImage = state.style()->{{getter}}(); 184 const NinePieceImage& currentImage = state.style()->{{getter}}();
185 {# Check for equality in case we can bail out before creating a new NinePieceI mage. #} 185 {# Check for equality in case we can bail out before creating a new NinePieceI mage. #}
186 {% if modifier_type == 'Outset' %} 186 {% if modifier_type == 'Outset' %}
187 if (borderImageLengthMatchesAllSides(currentImage.outset(), 187 if (borderImageLengthMatchesAllSides(currentImage.outset(),
188 BorderImageLength(Length(0, Fixed)))) 188 BorderImageLength(Length(0, kFixed))))
189 return; 189 return;
190 {% elif modifier_type == 'Repeat' %} 190 {% elif modifier_type == 'Repeat' %}
191 if (currentImage.horizontalRule() == StretchImageRule && 191 if (currentImage.horizontalRule() == kStretchImageRule &&
192 currentImage.verticalRule() == StretchImageRule) 192 currentImage.verticalRule() == kStretchImageRule)
193 return; 193 return;
194 {% elif modifier_type == 'Slice' and is_mask_box %} 194 {% elif modifier_type == 'Slice' and is_mask_box %}
195 // Masks have a different initial value for slices. Preserve the value of 0 195 // Masks have a different initial value for slices. Preserve the value of 0
196 // for backwards compatibility. 196 // for backwards compatibility.
197 if (currentImage.fill() == true && 197 if (currentImage.fill() == true &&
198 lengthMatchesAllSides(currentImage.imageSlices(), Length(0, Fixed))) 198 lengthMatchesAllSides(currentImage.imageSlices(), Length(0, kFixed)))
199 return; 199 return;
200 {% elif modifier_type == 'Slice' and not is_mask_box %} 200 {% elif modifier_type == 'Slice' and not is_mask_box %}
201 if (currentImage.fill() == false && 201 if (currentImage.fill() == false &&
202 lengthMatchesAllSides(currentImage.imageSlices(), Length(100, Percent))) 202 lengthMatchesAllSides(currentImage.imageSlices(), Length(100, kPercent)))
203 return; 203 return;
204 {% elif modifier_type == 'Width' and is_mask_box %} 204 {% elif modifier_type == 'Width' and is_mask_box %}
205 // Masks have a different initial value for widths. Preserve the value of 205 // Masks have a different initial value for widths. Preserve the value of
206 // 'auto' for backwards compatibility. 206 // 'auto' for backwards compatibility.
207 if (borderImageLengthMatchesAllSides(currentImage.borderSlices(), 207 if (borderImageLengthMatchesAllSides(currentImage.borderSlices(),
208 BorderImageLength(Length(Auto)))) 208 BorderImageLength(Length(kAuto))))
209 return; 209 return;
210 {% elif modifier_type == 'Width' and not is_mask_box %} 210 {% elif modifier_type == 'Width' and not is_mask_box %}
211 if (borderImageLengthMatchesAllSides(currentImage.borderSlices(), 211 if (borderImageLengthMatchesAllSides(currentImage.borderSlices(),
212 BorderImageLength(1.0))) 212 BorderImageLength(1.0)))
213 return; 213 return;
214 {% endif %} 214 {% endif %}
215 215
216 NinePieceImage image(currentImage); 216 NinePieceImage image(currentImage);
217 {% if modifier_type == 'Outset' %} 217 {% if modifier_type == 'Outset' %}
218 image.setOutset(Length(0, Fixed)); 218 image.setOutset(Length(0, kFixed));
219 {% elif modifier_type == 'Repeat' %} 219 {% elif modifier_type == 'Repeat' %}
220 image.setHorizontalRule(StretchImageRule); 220 image.setHorizontalRule(kStretchImageRule);
221 image.setVerticalRule(StretchImageRule); 221 image.setVerticalRule(kStretchImageRule);
222 {% elif modifier_type == 'Slice' and is_mask_box %} 222 {% elif modifier_type == 'Slice' and is_mask_box %}
223 image.setImageSlices(LengthBox({{ (['Length(0, Fixed)']*4) | join(', ') }})); 223 image.setImageSlices(LengthBox({{ (['Length(0, kFixed)']*4) | join(', ') }}));
224 image.setFill(true); 224 image.setFill(true);
225 {% elif modifier_type == 'Slice' and not is_mask_box %} 225 {% elif modifier_type == 'Slice' and not is_mask_box %}
226 image.setImageSlices(LengthBox({{ (['Length(100, Percent)']*4) | join(', ') }} )); 226 image.setImageSlices(LengthBox({{ (['Length(100, kPercent)']*4) | join(', ') } }));
227 image.setFill(false); 227 image.setFill(false);
228 {% elif modifier_type == 'Width' %} 228 {% elif modifier_type == 'Width' %}
229 image.setBorderSlices({{ 'Length(Auto)' if is_mask_box else '1.0' }}); 229 image.setBorderSlices({{ 'Length(kAuto)' if is_mask_box else '1.0' }});
230 {% endif %} 230 {% endif %}
231 state.style()->{{setter}}(image); 231 state.style()->{{setter}}(image);
232 } 232 }
233 233
234 {{declare_inherit_function(property_id)}} { 234 {{declare_inherit_function(property_id)}} {
235 NinePieceImage image(state.style()->{{getter}}()); 235 NinePieceImage image(state.style()->{{getter}}());
236 {% if modifier_type == 'Outset' %} 236 {% if modifier_type == 'Outset' %}
237 image.copyOutsetFrom(state.parentStyle()->{{getter}}()); 237 image.copyOutsetFrom(state.parentStyle()->{{getter}}());
238 {% elif modifier_type == 'Repeat' %} 238 {% elif modifier_type == 'Repeat' %}
239 image.copyRepeatFrom(state.parentStyle()->{{getter}}()); 239 image.copyRepeatFrom(state.parentStyle()->{{getter}}());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 const CounterDirectiveMap* parentMap = state.parentStyle()->counterDirectives( ); 330 const CounterDirectiveMap* parentMap = state.parentStyle()->counterDirectives( );
331 if (!parentMap) 331 if (!parentMap)
332 return; 332 return;
333 333
334 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); 334 CounterDirectiveMap& map = state.style()->accessCounterDirectives();
335 DCHECK(!parentMap->isEmpty()); 335 DCHECK(!parentMap->isEmpty());
336 336
337 typedef CounterDirectiveMap::const_iterator Iterator; 337 typedef CounterDirectiveMap::const_iterator Iterator;
338 Iterator end = parentMap->end(); 338 Iterator end = parentMap->end();
339 for (Iterator it = parentMap->begin(); it != end; ++it) { 339 for (Iterator it = parentMap->begin(); it != end; ++it) {
340 CounterDirectives& directives = map.add(it->key, CounterDirectives()).stored Value->value; 340 CounterDirectives& directives = map.add(it->key, CounterDirectives()).stored _value->value;
341 directives.inherit{{action}}(it->value); 341 directives.inherit{{action}}(it->value);
342 } 342 }
343 } 343 }
344 344
345 {{declare_value_function(property_id)}} { 345 {{declare_value_function(property_id)}} {
346 state.style()->clear{{action}}Directives(); 346 state.style()->clear{{action}}Directives();
347 347
348 if (!value.isValueList()) { 348 if (!value.isValueList()) {
349 DCHECK(value.isIdentifierValue()); 349 DCHECK(value.isIdentifierValue());
350 DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone); 350 DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), CSSValueNone);
351 return; 351 return;
352 } 352 }
353 353
354 CounterDirectiveMap& map = state.style()->accessCounterDirectives(); 354 CounterDirectiveMap& map = state.style()->accessCounterDirectives();
355 355
356 const CSSValueList& list = toCSSValueList(value); 356 const CSSValueList& list = toCSSValueList(value);
357 357
358 for (size_t i = 0; i < list.length(); ++i) { 358 for (size_t i = 0; i < list.length(); ++i) {
359 const CSSValuePair& pair = toCSSValuePair(list.item(i)); 359 const CSSValuePair& pair = toCSSValuePair(list.item(i));
360 AtomicString identifier(toCSSCustomIdentValue(pair.first()).value()); 360 AtomicString identifier(toCSSCustomIdentValue(pair.first()).value());
361 int value = toCSSPrimitiveValue(pair.second()).getIntValue(); 361 int value = toCSSPrimitiveValue(pair.second()).getIntValue();
362 CounterDirectives& directives = 362 CounterDirectives& directives =
363 map.add(identifier, CounterDirectives()).storedValue->value; 363 map.add(identifier, CounterDirectives()).stored_value->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 DCHECK(!map.isEmpty()); 370 DCHECK(!map.isEmpty());
371 } 371 }
372 {% endmacro %} 372 {% endmacro %}
373 {{apply_counter('CSSPropertyCounterIncrement', 'Increment')}} 373 {{apply_counter('CSSPropertyCounterIncrement', 'Increment')}}
374 {{apply_counter('CSSPropertyCounterReset', 'Reset')}} 374 {{apply_counter('CSSPropertyCounterReset', 'Reset')}}
375 375
376 {% macro apply_fill_layer(property_id, fill_type) %} 376 {% macro apply_fill_layer(property_id, fill_type) %}
377 {% set layer_type = 'Background' if 'Background' in property_id else 'Mask' %} 377 {% set layer_type = 'Background' if 'Background' in property_id else 'Mask' %}
378 {% set fill_layer_type = layer_type + 'FillLayer' %} 378 {% set fill_layer_type = 'k' + layer_type + 'FillLayer' %}
379 {% set access_layers = 'access' + layer_type + 'Layers' %} 379 {% set access_layers = 'access' + layer_type + 'Layers' %}
380 {% set map_fill = 'mapFill' + fill_type %} 380 {% set map_fill = 'mapFill' + fill_type %}
381 {{declare_initial_function(property_id)}} { 381 {{declare_initial_function(property_id)}} {
382 FillLayer* currChild = &state.style()->{{access_layers}}(); 382 FillLayer* currChild = &state.style()->{{access_layers}}();
383 currChild->set{{fill_type}}(FillLayer::initialFill{{fill_type}}({{fill_layer_t ype}})); 383 currChild->set{{fill_type}}(FillLayer::initialFill{{fill_type}}({{fill_layer_t ype}}));
384 for (currChild = currChild->next(); currChild; currChild = currChild->next()) 384 for (currChild = currChild->next(); currChild; currChild = currChild->next())
385 currChild->clear{{fill_type}}(); 385 currChild->clear{{fill_type}}();
386 } 386 }
387 387
388 {{declare_inherit_function(property_id)}} { 388 {{declare_inherit_function(property_id)}} {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 size_t autoRepeatInsertionPoint = 474 size_t autoRepeatInsertionPoint =
475 ComputedStyle::initialGridAutoRepeatInsertionPoint(); 475 ComputedStyle::initialGridAutoRepeatInsertionPoint();
476 StyleBuilderConverter::convertGridTrackList( 476 StyleBuilderConverter::convertGridTrackList(
477 value, trackSizes, namedGridLines, orderedNamedGridLines, 477 value, trackSizes, namedGridLines, orderedNamedGridLines,
478 autoRepeatTrackSizes, autoRepeatNamedGridLines, 478 autoRepeatTrackSizes, autoRepeatNamedGridLines,
479 autoRepeatOrderedNamedGridLines, autoRepeatInsertionPoint, 479 autoRepeatOrderedNamedGridLines, autoRepeatInsertionPoint,
480 autoRepeatType, state); 480 autoRepeatType, state);
481 const NamedGridAreaMap& namedGridAreas = state.style()->namedGridArea(); 481 const NamedGridAreaMap& namedGridAreas = state.style()->namedGridArea();
482 if (!namedGridAreas.isEmpty()) { 482 if (!namedGridAreas.isEmpty()) {
483 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea( 483 StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea(
484 namedGridAreas, namedGridLines, For{{type}}s); 484 namedGridAreas, namedGridLines, kFor{{type}}s);
485 } 485 }
486 state.style()->setGridTemplate{{type}}s(trackSizes); 486 state.style()->setGridTemplate{{type}}s(trackSizes);
487 state.style()->setNamedGrid{{type}}Lines(namedGridLines); 487 state.style()->setNamedGrid{{type}}Lines(namedGridLines);
488 state.style()->setOrderedNamedGrid{{type}}Lines(orderedNamedGridLines); 488 state.style()->setOrderedNamedGrid{{type}}Lines(orderedNamedGridLines);
489 state.style()->setGridAutoRepeat{{type}}s(autoRepeatTrackSizes); 489 state.style()->setGridAutoRepeat{{type}}s(autoRepeatTrackSizes);
490 state.style()->setGridAutoRepeat{{type}}sInsertionPoint( 490 state.style()->setGridAutoRepeat{{type}}sInsertionPoint(
491 autoRepeatInsertionPoint); 491 autoRepeatInsertionPoint);
492 state.style()->setAutoRepeatNamedGrid{{type}}Lines(autoRepeatNamedGridLines); 492 state.style()->setAutoRepeatNamedGrid{{type}}Lines(autoRepeatNamedGridLines);
493 state.style()->setAutoRepeatOrderedNamedGrid{{type}}Lines( 493 state.style()->setAutoRepeatOrderedNamedGrid{{type}}Lines(
494 autoRepeatOrderedNamedGridLines); 494 autoRepeatOrderedNamedGridLines);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 : SVG_PAINTTYPE_URI_RGBCOLOR; 548 : SVG_PAINTTYPE_URI_RGBCOLOR;
549 } 549 }
550 {{set_value(property)}}(paintType, color, url, 550 {{set_value(property)}}(paintType, color, url,
551 state.applyPropertyToRegularStyle(), 551 state.applyPropertyToRegularStyle(),
552 state.applyPropertyToVisitedLinkStyle()); 552 state.applyPropertyToVisitedLinkStyle());
553 } 553 }
554 {% endmacro %} 554 {% endmacro %}
555 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 555 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
556 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 556 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
557 } // namespace blink 557 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698