Title: [168645] trunk
Revision
168645
Author
k...@webkit.org
Date
2014-05-12 14:18:24 -0700 (Mon, 12 May 2014)

Log Message

SVG outline property is broken and inefficient
https://bugs.webkit.org/show_bug.cgi?id=113666

Reviewed by Dean Jackson.


Source/WebCore:
"[SVG2] css 'outline' property should apply to svg elements

The 'outline' property was only partially working in SVG before
this patch, this makes it work on text and text content child
elements too.

This makes SVG render the outlines as part of the foreground paint
phase.

Partly based on Florin Malita's webkit patch https://bugs.webkit.org/show_bug.cgi?id=113666#c12."

Tests: svg/custom/outline-stacking-expected.svg
       svg/custom/outline-stacking.svg
       svg/custom/rgba-color-outline.svg
       svg/text/text-outline-expected.svg
       svg/text/text-outline-rgba.html
       svg/text/text-outline.html
       svg/text/textpath-outline-expected.svg
       svg/text/textpath-outline.svg
       svg/text/tspan-multiple-outline.svg
       svg/text/tspan-outline-2-expected.svg
       svg/text/tspan-outline-2.svg
       svg/text/tspan-outline-expected.svg
       svg/text/tspan-outline.html

* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::paint): Draw outline in forground
    paint phase.
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::paint): Draw outline in forground
    paint phase.
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::paintReplaced): Pass paint offset.
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::paint): Draw outline in forground
    paint phase.
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::paint): Draw outline in forground
    paint phase.
* rendering/svg/SVGInlineFlowBox.cpp:
(WebCore::SVGInlineFlowBox::paint): Pass paint offset.
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paint): Draw outline in forground
    paint phase.
* rendering/svg/SVGRootInlineBox.cpp:
(WebCore::SVGRootInlineBox::paint): Pass paint offset.

LayoutTests:
Test stacking for outline properties. 'outline' should
not draw above overlapping content anymore.
Test outline drawing for text elements.

* svg/custom/outline-stacking-expected.svg: Added.
* svg/custom/outline-stacking.svg: Added.
* svg/custom/rgba-color-outline-expected.html: Added.
* svg/custom/rgba-color-outline.svg: Added.
* svg/text/text-outline-expected.svg: Added.
* svg/text/text-outline-rgba-expected.html: Added.
* svg/text/text-outline-rgba.html: Added.
* svg/text/text-outline.html: Added.
* svg/text/textpath-outline-expected.svg: Added.
* svg/text/textpath-outline.svg: Added.
* svg/text/tspan-multiple-outline-expected.html: Added.
* svg/text/tspan-multiple-outline.svg: Added.
* svg/text/tspan-outline-2-expected.svg: Added.
* svg/text/tspan-outline-2.svg: Added.
* svg/text/tspan-outline-expected.svg: Added.
* svg/text/tspan-outline.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (168644 => 168645)


--- trunk/LayoutTests/ChangeLog	2014-05-12 21:07:57 UTC (rev 168644)
+++ trunk/LayoutTests/ChangeLog	2014-05-12 21:18:24 UTC (rev 168645)
@@ -1,3 +1,33 @@
+2014-05-12  Dirk Schulze  <k...@webkit.org>
+
+        SVG outline property is broken and inefficient
+        https://bugs.webkit.org/show_bug.cgi?id=113666
+
+        Reviewed by Dean Jackson.
+
+        Patch by Erik Dahlström backported from Blink.
+
+        Test stacking for outline properties. 'outline' should
+        not draw above overlapping content anymore.
+        Test outline drawing for text elements.
+
+        * svg/custom/outline-stacking-expected.svg: Added.
+        * svg/custom/outline-stacking.svg: Added.
+        * svg/custom/rgba-color-outline-expected.html: Added.
+        * svg/custom/rgba-color-outline.svg: Added.
+        * svg/text/text-outline-expected.svg: Added.
+        * svg/text/text-outline-rgba-expected.html: Added.
+        * svg/text/text-outline-rgba.html: Added.
+        * svg/text/text-outline.html: Added.
+        * svg/text/textpath-outline-expected.svg: Added.
+        * svg/text/textpath-outline.svg: Added.
+        * svg/text/tspan-multiple-outline-expected.html: Added.
+        * svg/text/tspan-multiple-outline.svg: Added.
+        * svg/text/tspan-outline-2-expected.svg: Added.
+        * svg/text/tspan-outline-2.svg: Added.
+        * svg/text/tspan-outline-expected.svg: Added.
+        * svg/text/tspan-outline.html: Added.
+
 2014-05-09  Jon Honeycutt  <jhoneyc...@apple.com>
 
         REGRESSION (r167818): editing/inserting/typing-space-to-trigger-smart-link.html fails on WebKit1 bots

Added: trunk/LayoutTests/svg/custom/outline-stacking-expected.svg (0 => 168645)


--- trunk/LayoutTests/svg/custom/outline-stacking-expected.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/outline-stacking-expected.svg	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
+<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg">
+  <rect x="0" y="0" width="100" height="100" fill="green"/>
+</svg>

Added: trunk/LayoutTests/svg/custom/outline-stacking.svg (0 => 168645)


--- trunk/LayoutTests/svg/custom/outline-stacking.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/outline-stacking.svg	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
+<!-- Test for https://bugs.webkit.org/show_bug.cgi?id=113666
+     The element foreground and outline should be drawn atomically. -->
+<svg width="800" height="600" xmlns="http://www.w3.org/2000/svg">
+  <rect x="50" y="50" width="1" height="1" style="outline: 40px solid red;"/>
+  <rect x="0" y="0" width="100" height="100" fill="green"/>
+</svg>

Added: trunk/LayoutTests/svg/custom/rgba-color-outline-expected.html (0 => 168645)


--- trunk/LayoutTests/svg/custom/rgba-color-outline-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/rgba-color-outline-expected.html	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,13 @@
+<!doctype html>
+<style>
+* { padding: 0; margin: 0; }
+div { position: absolute; 
+	top: 50px; 
+	left: 50px; 
+	width:1px; 
+	height:1px; 
+	background: rgba(0,0,255,0.5);
+	outline: 50px solid rgba(0,0,255,0.5); }
+ }
+</style>
+<div></div>

Added: trunk/LayoutTests/svg/custom/rgba-color-outline.svg (0 => 168645)


--- trunk/LayoutTests/svg/custom/rgba-color-outline.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/rgba-color-outline.svg	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+<style>
+rect { outline: 50px solid rgba(0,0,255,0.5); }
+</style>
+<rect x="50" y="50" width="1" height="1" fill="rgba(0,0,255,0.5)"/>
+</svg>

Added: trunk/LayoutTests/svg/text/text-outline-expected.svg (0 => 168645)


--- trunk/LayoutTests/svg/text/text-outline-expected.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/text/text-outline-expected.svg	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,10 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="100">
+	<style>
+	text { font: 32px sans-serif; }
+	</style>
+	
+	<text y="40" tabindex="2" fill="green">[object SVGTextElement]</text>
+	<script>
+		document.querySelector("text").focus();
+	</script>
+</svg>

Added: trunk/LayoutTests/svg/text/text-outline-rgba-expected.html (0 => 168645)


--- trunk/LayoutTests/svg/text/text-outline-rgba-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/text/text-outline-rgba-expected.html	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,14 @@
+<!doctype html>
+<style>
+* { margin: 8; padding: 0; }
+div {
+	position: absolute;
+	top: 50px;
+	left: 50px;
+	outline: 50px solid rgba(0,0,255,0.5);
+	background: rgba(0,0,255,0.5);
+	width: 1px;
+	height: 1px;
+}
+</style>
+<div></div>

Added: trunk/LayoutTests/svg/text/text-outline-rgba.html (0 => 168645)


--- trunk/LayoutTests/svg/text/text-outline-rgba.html	                        (rev 0)
+++ trunk/LayoutTests/svg/text/text-outline-rgba.html	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,10 @@
+<!doctype html>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="200">
+	<style>
+	* { margin: 0; padding: 0; }
+	rect {
+		outline: 50px solid rgba(0,0,255,0.5);
+	}
+	</style>
+	<rect x="50" y="50" width="1" height="1" fill="rgba(0,0,255,0.5)"/>
+</svg>

Added: trunk/LayoutTests/svg/text/text-outline.html (0 => 168645)


--- trunk/LayoutTests/svg/text/text-outline.html	                        (rev 0)
+++ trunk/LayoutTests/svg/text/text-outline.html	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,16 @@
+<!doctype html>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="100">
+	<desc>Test that the outline is painted, and that :active stylerules apply correctly on the 'text' element.</desc>
+	<style>
+	* { margin: 0; padding: 0; }
+	*:focus { fill: green }
+	text { font: 32px sans-serif; }
+	</style>
+	
+	<text y="40" tabindex="2">Test didn't run</text>
+	<script>
+		var t = document.querySelector("text");
+		t.focus();
+		t.textContent = document.activeElement;
+	</script>
+</svg>

Added: trunk/LayoutTests/svg/text/textpath-outline-expected.svg (0 => 168645)


--- trunk/LayoutTests/svg/text/textpath-outline-expected.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/text/textpath-outline-expected.svg	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,9 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  id="svg-root" width="800" height="600">
+	<defs>
+		<style>
+		text { font: 24px sans-serif; outline: 1px solid black }
+		</style>
+	</defs>
+	<text x="8" y="30">Outlined text</text>
+</svg>
+

Added: trunk/LayoutTests/svg/text/textpath-outline.svg (0 => 168645)


--- trunk/LayoutTests/svg/text/textpath-outline.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/text/textpath-outline.svg	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,10 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  id="svg-root" width="800" height="600">
+	<defs>
+		<path id="tp" d="M8,30h400"/>
+		<style>
+		textPath { font: 24px sans-serif; outline: 1px solid black }
+		</style>
+	</defs>
+	<text><textPath xlink:href="" text</textPath></text>
+</svg>
+

Added: trunk/LayoutTests/svg/text/tspan-multiple-outline-expected.html (0 => 168645)


--- trunk/LayoutTests/svg/text/tspan-multiple-outline-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/text/tspan-multiple-outline-expected.html	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,11 @@
+<!doctype html>
+<head>
+<style>
+html,body { margin-top: 10.5px; padding-top: 0px }
+span:first-of-type { position: relative;  }
+span { font: 32px sans-serif; outline: 1px solid black; line-height: 1.5em; }
+</style>
+</head>
+<span>tspan 1</span><br/>
+<span>tspan 2</span><br/>
+<span>tspan 3</span>

Added: trunk/LayoutTests/svg/text/tspan-multiple-outline.svg (0 => 168645)


--- trunk/LayoutTests/svg/text/tspan-multiple-outline.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/text/tspan-multiple-outline.svg	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,10 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="300">
+	<style>
+	text { font: 32px sans-serif; }
+	tspan { outline: 1px solid black; }
+	</style>
+	
+	<text x="8" y="8"><tspan dy="1.5em">tspan 1</tspan>
+	<tspan x="8" dy="1.5em">tspan 2</tspan>
+	<tspan x="8" dy="1.5em">tspan 3</tspan></text>
+</svg>

Added: trunk/LayoutTests/svg/text/tspan-outline-2-expected.svg (0 => 168645)


--- trunk/LayoutTests/svg/text/tspan-outline-2-expected.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/text/tspan-outline-2-expected.svg	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,9 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="100">
+	<style>
+	text { font: 32px sans-serif; }
+	tspan { fill: green; outline: 2px solid black; }
+ }
+	</style>
+	
+	<text y="40" tabindex="2">>>> <tspan>[object SVGTSpanElement]</tspan> &lt;&lt;&lt;</text>
+</svg>

Added: trunk/LayoutTests/svg/text/tspan-outline-2.svg (0 => 168645)


--- trunk/LayoutTests/svg/text/tspan-outline-2.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/text/tspan-outline-2.svg	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,14 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="100">
+	<desc>Test that the outline is painted, and that :active stylerules apply correctly on the 'tspan' element.</desc>
+	<style>
+	*:focus { fill: green; outline: 2px solid black; }
+	text { font: 32px sans-serif; }
+	</style>
+	
+	<text y="40">>>> <tspan tabindex="2">Test didn't run</tspan> &lt;&lt;&lt;</text>
+	<script>
+		var t = document.querySelector("tspan");
+		t.focus();
+		t.textContent = document.activeElement;
+	</script>
+</svg>

Added: trunk/LayoutTests/svg/text/tspan-outline-expected.svg (0 => 168645)


--- trunk/LayoutTests/svg/text/tspan-outline-expected.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/text/tspan-outline-expected.svg	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,10 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="100">
+	<style>
+	text { font: 32px sans-serif; }
+	</style>
+	
+	<text y="40" tabindex="2" fill="green">[object SVGTSpanElement]</text>
+	<script>
+		document.querySelector("text").focus();
+	</script>
+</svg>

Added: trunk/LayoutTests/svg/text/tspan-outline.html (0 => 168645)


--- trunk/LayoutTests/svg/text/tspan-outline.html	                        (rev 0)
+++ trunk/LayoutTests/svg/text/tspan-outline.html	2014-05-12 21:18:24 UTC (rev 168645)
@@ -0,0 +1,16 @@
+<!doctype html>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="100">
+	<desc>Test that the outline is painted, and that :active stylerules apply correctly on the 'tspan' element.</desc>
+	<style>
+	* { margin: 0; padding: 0; }
+	*:focus { fill: green }
+	text { font: 32px sans-serif; }
+	</style>
+	
+	<text y="40"><tspan tabindex="2">Test didn't run</tspan></text>
+	<script>
+		var t = document.querySelector("tspan");
+		t.focus();
+		t.textContent = document.activeElement;
+	</script>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (168644 => 168645)


--- trunk/Source/WebCore/ChangeLog	2014-05-12 21:07:57 UTC (rev 168644)
+++ trunk/Source/WebCore/ChangeLog	2014-05-12 21:18:24 UTC (rev 168645)
@@ -1,3 +1,59 @@
+2014-05-12  Dirk Schulze  <k...@webkit.org>
+
+        SVG outline property is broken and inefficient
+        https://bugs.webkit.org/show_bug.cgi?id=113666
+
+        Reviewed by Dean Jackson.
+
+        Patch by Erik Dahlström backported from Blink.
+
+        "[SVG2] css 'outline' property should apply to svg elements 
+
+        The 'outline' property was only partially working in SVG before
+        this patch, this makes it work on text and text content child
+        elements too. 
+
+        This makes SVG render the outlines as part of the foreground paint
+        phase. 
+
+        Partly based on Florin Malita's webkit patch https://bugs.webkit.org/show_bug.cgi?id=113666#c12."
+
+        Tests: svg/custom/outline-stacking-expected.svg
+               svg/custom/outline-stacking.svg
+               svg/custom/rgba-color-outline.svg
+               svg/text/text-outline-expected.svg
+               svg/text/text-outline-rgba.html
+               svg/text/text-outline.html
+               svg/text/textpath-outline-expected.svg
+               svg/text/textpath-outline.svg
+               svg/text/tspan-multiple-outline.svg
+               svg/text/tspan-outline-2-expected.svg
+               svg/text/tspan-outline-2.svg
+               svg/text/tspan-outline-expected.svg
+               svg/text/tspan-outline.html
+
+        * rendering/svg/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::paint): Draw outline in forground
+            paint phase.
+        * rendering/svg/RenderSVGImage.cpp:
+        (WebCore::RenderSVGImage::paint): Draw outline in forground
+            paint phase.
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::paintReplaced): Pass paint offset.
+        * rendering/svg/RenderSVGShape.cpp:
+        (WebCore::RenderSVGShape::paint): Draw outline in forground
+            paint phase.
+        * rendering/svg/RenderSVGText.cpp:
+        (WebCore::RenderSVGText::paint): Draw outline in forground
+            paint phase.
+        * rendering/svg/SVGInlineFlowBox.cpp:
+        (WebCore::SVGInlineFlowBox::paint): Pass paint offset.
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::paint): Draw outline in forground
+            paint phase.
+        * rendering/svg/SVGRootInlineBox.cpp:
+        (WebCore::SVGRootInlineBox::paint): Pass paint offset.
+
 2014-05-12  Beth Dakin  <bda...@apple.com>
 
         Layer for bottom overhang area needs to be offset by the topContentInset

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp (168644 => 168645)


--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2014-05-12 21:07:57 UTC (rev 168644)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2014-05-12 21:18:24 UTC (rev 168645)
@@ -143,11 +143,11 @@
     }
     
     // FIXME: This really should be drawn from local coordinates, but currently we hack it
-    // to avoid our clip killing our outline rect.  Thus we translate our
+    // to avoid our clip killing our outline rect. Thus we translate our
     // outline rect into parent coords before drawing.
     // FIXME: This means our focus ring won't share our rotation like it should.
     // We should instead disable our clip during PaintPhaseOutline
-    if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style().outlineWidth() && style().visibility() == VISIBLE) {
+    if (paintInfo.phase == PaintPhaseSelfOutline && style().outlineWidth() && style().visibility() == VISIBLE) {
         IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRect(repaintRect));
         paintOutline(paintInfo, paintRectInParent);
     }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp (168644 => 168645)


--- trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp	2014-05-12 21:07:57 UTC (rev 168644)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp	2014-05-12 21:18:24 UTC (rev 168645)
@@ -132,7 +132,8 @@
 
 void RenderSVGImage::paint(PaintInfo& paintInfo, const LayoutPoint&)
 {
-    if (paintInfo.context->paintingDisabled() || style().visibility() == HIDDEN || !imageResource().hasImage())
+    if (paintInfo.context->paintingDisabled() || paintInfo.phase != PaintPhaseForeground
+        || style().visibility() == HIDDEN || !imageResource().hasImage())
         return;
 
     FloatRect boundingBox = repaintRectInLocalCoordinates();
@@ -140,25 +141,22 @@
         return;
 
     PaintInfo childPaintInfo(paintInfo);
-    bool drawsOutline = style().outlineWidth() && (childPaintInfo.phase == PaintPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline);
-    if (drawsOutline || childPaintInfo.phase == PaintPhaseForeground) {
-        GraphicsContextStateSaver stateSaver(*childPaintInfo.context);
-        childPaintInfo.applyTransform(m_localTransform);
+    GraphicsContextStateSaver stateSaver(*childPaintInfo.context);
+    childPaintInfo.applyTransform(m_localTransform);
 
-        if (childPaintInfo.phase == PaintPhaseForeground) {
-            SVGRenderingContext renderingContext(*this, childPaintInfo);
+    if (childPaintInfo.phase == PaintPhaseForeground) {
+        SVGRenderingContext renderingContext(*this, childPaintInfo);
 
-            if (renderingContext.isRenderingPrepared()) {
-                if (style().svgStyle().bufferedRendering() == BR_STATIC  && renderingContext.bufferForeground(m_bufferedForeground))
-                    return;
+        if (renderingContext.isRenderingPrepared()) {
+            if (style().svgStyle().bufferedRendering() == BR_STATIC  && renderingContext.bufferForeground(m_bufferedForeground))
+                return;
 
-                paintForeground(childPaintInfo);
-            }
+            paintForeground(childPaintInfo);
         }
-
-        if (drawsOutline)
-            paintOutline(childPaintInfo, IntRect(boundingBox));
     }
+
+    if (style().outlineWidth())
+        paintOutline(childPaintInfo, IntRect(boundingBox));
 }
 
 void RenderSVGImage::paintForeground(PaintInfo& paintInfo)

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (168644 => 168645)


--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2014-05-12 21:07:57 UTC (rev 168644)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2014-05-12 21:18:24 UTC (rev 168645)
@@ -230,6 +230,10 @@
     if (paintInfo.context->paintingDisabled())
         return;
 
+    // SVG outlines are painted during PaintPhaseForeground.
+    if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline)
+        return;
+
     // An empty viewBox also disables rendering.
     // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute)
     if (svgSVGElement().hasEmptyViewBox())

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (168644 => 168645)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2014-05-12 21:07:57 UTC (rev 168644)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2014-05-12 21:18:24 UTC (rev 168645)
@@ -290,33 +290,31 @@
 
 void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&)
 {
-    if (paintInfo.context->paintingDisabled() || style().visibility() == HIDDEN || isEmpty())
+    if (paintInfo.context->paintingDisabled() || paintInfo.phase != PaintPhaseForeground
+        || style().visibility() == HIDDEN || isEmpty())
         return;
     FloatRect boundingBox = repaintRectInLocalCoordinates();
     if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(boundingBox, m_localTransform, paintInfo))
         return;
 
     PaintInfo childPaintInfo(paintInfo);
-    bool drawsOutline = style().outlineWidth() && (childPaintInfo.phase == PaintPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline);
-    if (drawsOutline || childPaintInfo.phase == PaintPhaseForeground) {
-        GraphicsContextStateSaver stateSaver(*childPaintInfo.context);
-        childPaintInfo.applyTransform(m_localTransform);
+    GraphicsContextStateSaver stateSaver(*childPaintInfo.context);
+    childPaintInfo.applyTransform(m_localTransform);
 
-        if (childPaintInfo.phase == PaintPhaseForeground) {
-            SVGRenderingContext renderingContext(*this, childPaintInfo);
+    if (childPaintInfo.phase == PaintPhaseForeground) {
+        SVGRenderingContext renderingContext(*this, childPaintInfo);
 
-            if (renderingContext.isRenderingPrepared()) {
-                const SVGRenderStyle& svgStyle = style().svgStyle();
-                if (svgStyle.shapeRendering() == SR_CRISPEDGES)
-                    childPaintInfo.context->setShouldAntialias(false);
+        if (renderingContext.isRenderingPrepared()) {
+            const SVGRenderStyle& svgStyle = style().svgStyle();
+            if (svgStyle.shapeRendering() == SR_CRISPEDGES)
+                childPaintInfo.context->setShouldAntialias(false);
 
-                fillStrokeMarkers(childPaintInfo);
-            }
+            fillStrokeMarkers(childPaintInfo);
         }
-
-        if (drawsOutline)
-            paintOutline(childPaintInfo, IntRect(boundingBox));
     }
+
+    if (style().outlineWidth())
+        paintOutline(childPaintInfo, IntRect(boundingBox));
 }
 
 // This method is called from inside paintOutline() since we call paintOutline()

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp (168644 => 168645)


--- trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp	2014-05-12 21:07:57 UTC (rev 168644)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp	2014-05-12 21:18:24 UTC (rev 168645)
@@ -493,7 +493,6 @@
         return;
 
     if (paintInfo.phase != PaintPhaseForeground
-     && paintInfo.phase != PaintPhaseSelfOutline
      && paintInfo.phase != PaintPhaseSelection)
          return;
 
@@ -501,6 +500,12 @@
     GraphicsContextStateSaver stateSaver(*blockInfo.context);
     blockInfo.applyTransform(localToParentTransform());
     RenderBlock::paint(blockInfo, LayoutPoint());
+
+    // Paint the outlines, if any
+    if (paintInfo.phase == PaintPhaseForeground) {
+        blockInfo.phase = PaintPhaseSelfOutline;
+        RenderBlock::paint(blockInfo, LayoutPoint());
+    }
 }
 
 FloatRect RenderSVGText::strokeBoundingBox() const

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp (168644 => 168645)


--- trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp	2014-05-12 21:07:57 UTC (rev 168644)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp	2014-05-12 21:18:24 UTC (rev 168645)
@@ -45,7 +45,7 @@
     }
 }
 
-void SVGInlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUnit, LayoutUnit)
+void SVGInlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit, LayoutUnit)
 {
     ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
     ASSERT(!paintInfo.context->paintingDisabled());
@@ -56,7 +56,7 @@
             if (child->isSVGInlineTextBox())
                 computeTextMatchMarkerRectForRenderer(&(toSVGInlineTextBox(child)->renderer()));
 
-            child->paint(paintInfo, LayoutPoint(), 0, 0);
+            child->paint(paintInfo, paintOffset, 0, 0);
         }
     }
 }

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (168644 => 168645)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2014-05-12 21:07:57 UTC (rev 168644)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2014-05-12 21:18:24 UTC (rev 168645)
@@ -30,6 +30,7 @@
 #include "InlineFlowBox.h"
 #include "PointerEventsHitRules.h"
 #include "RenderBlock.h"
+#include "RenderInline.h"
 #include "RenderSVGResourceSolidColor.h"
 #include "RenderView.h"
 #include "SVGRenderingContext.h"
@@ -242,7 +243,7 @@
     ASSERT(!m_paintingResource);
 }
 
-void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUnit, LayoutUnit)
+void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit, LayoutUnit)
 {
     ASSERT(paintInfo.shouldPaintWithinRoot(renderer()));
     ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
@@ -335,6 +336,10 @@
         m_paintingResourceMode = ApplyToDefaultMode;
     }
 
+    // Finally, paint the outline if any.
+    if (renderer().style().hasOutline() && parentRenderer.isRenderInline())
+        toRenderInline(parentRenderer).paintOutline(paintInfo, paintOffset);
+
     ASSERT(!m_paintingResource);
 }
 

Modified: trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp (168644 => 168645)


--- trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp	2014-05-12 21:07:57 UTC (rev 168644)
+++ trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp	2014-05-12 21:18:24 UTC (rev 168645)
@@ -45,7 +45,7 @@
     return toRenderSVGText(blockFlow());
 }
 
-void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUnit, LayoutUnit)
+void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit, LayoutUnit)
 {
     ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
     ASSERT(!paintInfo.context->paintingDisabled());
@@ -69,7 +69,7 @@
             if (child->isSVGInlineTextBox())
                 SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(&toSVGInlineTextBox(child)->renderer());
 
-            child->paint(paintInfo, LayoutPoint(), 0, 0);
+            child->paint(paintInfo, paintOffset, 0, 0);
         }
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to