[SVG2] support paint-order presentation attribute
authorkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Mar 2014 02:25:41 +0000 (02:25 +0000)
committerkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Mar 2014 02:25:41 +0000 (02:25 +0000)
commiteadb493946b56cfb82948c79f584b1b5860af820
treea244dec4d670148a4a57b83c7956e60213c305ea
parentba6449068f84320c48792a10a09f0478c69967bf
[SVG2] support paint-order presentation attribute
https://bugs.webkit.org/show_bug.cgi?id=129373

Reviewed by Dean Jackson.

Source/WebCore:

Add support for the paint-order property from SVG2. The presentation
attribute/CSS property allows to paint fill, stroke and markers in any order
the author desires.

Firefox supports this but behind a runtime flag. It is just activated in
nightly builds by default.

Chromium supports it behind a runtime flag as well but is going to ship it
pretty soon.

Tests: svg/paint-order/paint-order-fill-expected.svg
       svg/paint-order/paint-order-fill-markers-expected.svg
       svg/paint-order/paint-order-fill-markers.svg
       svg/paint-order/paint-order-fill.svg
       svg/paint-order/paint-order-markers-expected.svg
       svg/paint-order/paint-order-markers-stroke-expected.svg
       svg/paint-order/paint-order-markers-stroke.svg
       svg/paint-order/paint-order-markers.svg
       svg/paint-order/paint-order-normal-expected.svg
       svg/paint-order/paint-order-normal.svg
       svg/paint-order/paint-order-stroke-expected.svg
       svg/paint-order/paint-order-stroke-marker-expected.svg
       svg/paint-order/paint-order-stroke-marker.svg
       svg/paint-order/paint-order-stroke.svg
       svg/paint-order/paint-order-text-markers-expected.svg
       svg/paint-order/paint-order-text-markers.svg
       svg/paint-order/paint-order-text-normal-expected.svg
       svg/paint-order/paint-order-text-normal.svg
       svg/paint-order/paint-order-text-stroke-expected.svg
       svg/paint-order/paint-order-text-stroke.svg
       svg/paint-order/paint-order-text-tspan-001-expected.svg
       svg/paint-order/paint-order-text-tspan-001.svg
       svg/paint-order/paint-order-text-tspan-002-expected.svg
       svg/paint-order/paint-order-text-tspan-002.svg
       svg/paint-order/parsing-paint-order.html

* css/CSSComputedStyleDeclaration.cpp: Computed style for paint-order.
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSParser.h:
* css/CSSPropertyNames.in:
* css/CSSValueKeywords.in:
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::paintOrder):
(WebCore::ComputedStyleExtractor::svgPropertyValue):
* css/SVGCSSParser.cpp: Parse paint-order. Take care of serialization
    at this point already to get element style correct.
(WebCore::CSSParser::parseSVGValue):
(WebCore::CSSParser::parsePaintOrder):
* css/SVGCSSStyleSelector.cpp:
(WebCore::StyleResolver::applySVGProperty):
* rendering/style/SVGRenderStyle.cpp:
(WebCore::SVGRenderStyle::paintTypesForPaintOrder):
(WebCore::SVGRenderStyle::diff): Repaint on change.
* rendering/style/SVGRenderStyle.h:
(WebCore::SVGRenderStyle::initialPaintOrder):
(WebCore::SVGRenderStyle::setPaintOrder):
(WebCore::SVGRenderStyle::paintOrder):
(WebCore::SVGRenderStyle::InheritedFlags::operator==):
(WebCore::SVGRenderStyle::setBitDefaults):
* rendering/style/SVGRenderStyleDefs.h:
* rendering/svg/RenderSVGShape.cpp: Change order of painting based on paint-order.
(WebCore::RenderSVGShape::strokeShape):
(WebCore::RenderSVGShape::fillStrokeMarkers):
(WebCore::RenderSVGShape::paint):
(WebCore::RenderSVGShape::addFocusRingRects):
* rendering/svg/RenderSVGShape.h:
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paint): Ditto.
* svg/SVGElement.cpp: Make property a presentation attribute.
(WebCore::populateAttributeNameToCSSPropertyIDMap):
(WebCore::populateAttributeNameToAnimatedPropertyTypeMap):
* svg/svgattrs.in: Add paint-order attribute.

LayoutTests:

Test parsing and bahvior of the paint-order property.

* svg/paint-order/paint-order-fill-expected.svg: Added.
* svg/paint-order/paint-order-fill-markers-expected.svg: Added.
* svg/paint-order/paint-order-fill-markers.svg: Added.
* svg/paint-order/paint-order-fill.svg: Added.
* svg/paint-order/paint-order-markers-expected.svg: Added.
* svg/paint-order/paint-order-markers-stroke-expected.svg: Added.
* svg/paint-order/paint-order-markers-stroke.svg: Added.
* svg/paint-order/paint-order-markers.svg: Added.
* svg/paint-order/paint-order-normal-expected.svg: Added.
* svg/paint-order/paint-order-normal.svg: Added.
* svg/paint-order/paint-order-stroke-expected.svg: Added.
* svg/paint-order/paint-order-stroke-marker-expected.svg: Added.
* svg/paint-order/paint-order-stroke-marker.svg: Added.
* svg/paint-order/paint-order-stroke.svg: Added.
* svg/paint-order/paint-order-text-markers-expected.svg: Added.
* svg/paint-order/paint-order-text-markers.svg: Added.
* svg/paint-order/paint-order-text-normal-expected.svg: Added.
* svg/paint-order/paint-order-text-normal.svg: Added.
* svg/paint-order/paint-order-text-stroke-expected.svg: Added.
* svg/paint-order/paint-order-text-stroke.svg: Added.
* svg/paint-order/paint-order-text-tspan-001-expected.svg: Added.
* svg/paint-order/paint-order-text-tspan-001.svg: Added.
* svg/paint-order/paint-order-text-tspan-002-expected.svg: Added.
* svg/paint-order/paint-order-text-tspan-002.svg: Added.
* svg/paint-order/parsing-paint-order-expected.txt: Added.
* svg/paint-order/parsing-paint-order.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165595 268f45cc-cd09-0410-ab3c-d52691b4dbfc
43 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/paint-order/paint-order-fill-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-fill-markers-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-fill-markers.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-fill.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-markers-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-markers-stroke-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-markers-stroke.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-markers.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-normal-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-normal.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-stroke-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-stroke-marker-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-stroke-marker.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-stroke.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-text-markers-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-text-markers.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-text-normal-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-text-normal.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-text-stroke-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-text-stroke.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-text-tspan-001-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-text-tspan-001.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-text-tspan-002-expected.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/paint-order-text-tspan-002.svg [new file with mode: 0644]
LayoutTests/svg/paint-order/parsing-paint-order-expected.txt [new file with mode: 0644]
LayoutTests/svg/paint-order/parsing-paint-order.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
Source/WebCore/css/SVGCSSParser.cpp
Source/WebCore/css/SVGCSSStyleSelector.cpp
Source/WebCore/rendering/style/SVGRenderStyle.cpp
Source/WebCore/rendering/style/SVGRenderStyle.h
Source/WebCore/rendering/style/SVGRenderStyleDefs.h
Source/WebCore/rendering/svg/RenderSVGShape.cpp
Source/WebCore/rendering/svg/RenderSVGShape.h
Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/svgattrs.in