OLD | NEW |
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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 352 |
353 if (!value->isValueList()) { | 353 if (!value->isValueList()) { |
354 ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValue
ID() == CSSValueNone); | 354 ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValue
ID() == CSSValueNone); |
355 return; | 355 return; |
356 } | 356 } |
357 | 357 |
358 CSSValueList* list = toCSSValueList(value); | 358 CSSValueList* list = toCSSValueList(value); |
359 | 359 |
360 int length = list ? list->length() : 0; | 360 int length = list ? list->length() : 0; |
361 for (int i = 0; i < length; ++i) { | 361 for (int i = 0; i < length; ++i) { |
362 CSSValue* currValue = list->itemWithoutBoundsCheck(i); | 362 CSSValue* currValue = list->item(i); |
363 if (!currValue->isPrimitiveValue()) | 363 if (!currValue->isPrimitiveValue()) |
364 continue; | 364 continue; |
365 | 365 |
366 Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue(); | 366 Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue(); |
367 if (!pair || !pair->first() || !pair->second()) | 367 if (!pair || !pair->first() || !pair->second()) |
368 continue; | 368 continue; |
369 | 369 |
370 AtomicString identifier(pair->first()->getStringValue()); | 370 AtomicString identifier(pair->first()->getStringValue()); |
371 int value = pair->second()->getIntValue(); | 371 int value = pair->second()->getIntValue(); |
372 CounterDirectives& directives = map.add(identifier, CounterDirectives())
.storedValue->value; | 372 CounterDirectives& directives = map.add(identifier, CounterDirectives())
.storedValue->value; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 FillLayer* prevChild = 0; | 424 FillLayer* prevChild = 0; |
425 if (value->isValueList() && !value->isImageSetValue()) { | 425 if (value->isValueList() && !value->isImageSetValue()) { |
426 /* Walk each value and put it into a layer, creating new layers as neede
d. */ | 426 /* Walk each value and put it into a layer, creating new layers as neede
d. */ |
427 CSSValueList* valueList = toCSSValueList(value); | 427 CSSValueList* valueList = toCSSValueList(value); |
428 for (unsigned int i = 0; i < valueList->length(); i++) { | 428 for (unsigned int i = 0; i < valueList->length(); i++) { |
429 if (!currChild) { | 429 if (!currChild) { |
430 /* Need to make a new layer to hold this value */ | 430 /* Need to make a new layer to hold this value */ |
431 currChild = new FillLayer({{fill_layer_type}}); | 431 currChild = new FillLayer({{fill_layer_type}}); |
432 prevChild->setNext(currChild); | 432 prevChild->setNext(currChild); |
433 } | 433 } |
434 state.styleMap().{{map_fill}}({{property_id}}, currChild, valueList-
>itemWithoutBoundsCheck(i)); | 434 state.styleMap().{{map_fill}}({{property_id}}, currChild, valueList-
>item(i)); |
435 prevChild = currChild; | 435 prevChild = currChild; |
436 currChild = currChild->next(); | 436 currChild = currChild->next(); |
437 } | 437 } |
438 } else { | 438 } else { |
439 state.styleMap().{{map_fill}}({{property_id}}, currChild, value); | 439 state.styleMap().{{map_fill}}({{property_id}}, currChild, value); |
440 currChild = currChild->next(); | 440 currChild = currChild->next(); |
441 } | 441 } |
442 while (currChild) { | 442 while (currChild) { |
443 /* Reset all remaining layers to not have the property set. */ | 443 /* Reset all remaining layers to not have the property set. */ |
444 currChild->clear{{fill_type}}(); | 444 currChild->clear{{fill_type}}(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 525 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
526 if (primitiveValue->getValueID() == CSSValueNone) | 526 if (primitiveValue->getValueID() == CSSValueNone) |
527 {{set_value(property)}}(nullptr); | 527 {{set_value(property)}}(nullptr); |
528 } else if (value->isImageValue() || value->isImageGeneratorValue() || value-
>isImageSetValue()) { | 528 } else if (value->isImageValue() || value->isImageGeneratorValue() || value-
>isImageSetValue()) { |
529 {{set_value(property)}}(ShapeValue::createImageValue(state.styleImage({{
property_id}}, value))); | 529 {{set_value(property)}}(ShapeValue::createImageValue(state.styleImage({{
property_id}}, value))); |
530 } else if (value->isValueList()) { | 530 } else if (value->isValueList()) { |
531 RefPtr<BasicShape> shape; | 531 RefPtr<BasicShape> shape; |
532 CSSBoxType cssBox = BoxMissing; | 532 CSSBoxType cssBox = BoxMissing; |
533 CSSValueList* valueList = toCSSValueList(value); | 533 CSSValueList* valueList = toCSSValueList(value); |
534 for (unsigned i = 0; i < valueList->length(); ++i) { | 534 for (unsigned i = 0; i < valueList->length(); ++i) { |
535 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->i
temWithoutBoundsCheck(i)); | 535 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->i
tem(i)); |
536 if (primitiveValue->isShape()) | 536 if (primitiveValue->isShape()) |
537 shape = basicShapeForValue(state, primitiveValue->getShapeValue(
)); | 537 shape = basicShapeForValue(state, primitiveValue->getShapeValue(
)); |
538 else if (primitiveValue->getValueID() == CSSValueContentBox | 538 else if (primitiveValue->getValueID() == CSSValueContentBox |
539 || primitiveValue->getValueID() == CSSValueBorderBox | 539 || primitiveValue->getValueID() == CSSValueBorderBox |
540 || primitiveValue->getValueID() == CSSValuePaddingBox | 540 || primitiveValue->getValueID() == CSSValuePaddingBox |
541 || primitiveValue->getValueID() == CSSValueMarginBox) | 541 || primitiveValue->getValueID() == CSSValueMarginBox) |
542 cssBox = CSSBoxType(*primitiveValue); | 542 cssBox = CSSBoxType(*primitiveValue); |
543 else | 543 else |
544 return; | 544 return; |
545 } | 545 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 color, | 610 color, |
611 svgPaint->uri(), | 611 svgPaint->uri(), |
612 state.applyPropertyToRegularStyle(), | 612 state.applyPropertyToRegularStyle(), |
613 state.applyPropertyToVisitedLinkStyle()); | 613 state.applyPropertyToVisitedLinkStyle()); |
614 } | 614 } |
615 } | 615 } |
616 {% endmacro %} | 616 {% endmacro %} |
617 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 617 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
618 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 618 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
619 } // namespace WebCore | 619 } // namespace WebCore |
OLD | NEW |