Title: [198574] trunk
- Revision
- 198574
- Author
- [email protected]
- Date
- 2016-03-22 20:28:09 -0700 (Tue, 22 Mar 2016)
Log Message
userSpaceOnUse patterns are not stroked for empty object bounding box elements
https://bugs.webkit.org/show_bug.cgi?id=109758
Patch by Said Abou-Hallawa <[email protected]> on 2016-03-22
Reviewed by Brent Fulgham.
Source/WebCore:
Checking whether the patternUnits is objectBoundingBox needs to be done
after calling collectPatternAttributes(). Otherwise the default value
will be always checked which is 'objectBoundingBox'.
Tests: svg/custom/pattern-units-fill-stroke.svg
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::buildPattern):
(WebCore::RenderSVGResourcePattern::applyResource):
LayoutTests:
Ensure the SVG pattern is drawn correctly if it is used as a stroke for
empty objectBoundingBox elements.
* svg/custom/pattern-units-fill-stroke-expected.svg: Added.
* svg/custom/pattern-units-fill-stroke.svg: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (198573 => 198574)
--- trunk/LayoutTests/ChangeLog 2016-03-23 02:30:57 UTC (rev 198573)
+++ trunk/LayoutTests/ChangeLog 2016-03-23 03:28:09 UTC (rev 198574)
@@ -1,3 +1,16 @@
+2016-03-22 Said Abou-Hallawa <[email protected]>
+
+ userSpaceOnUse patterns are not stroked for empty object bounding box elements
+ https://bugs.webkit.org/show_bug.cgi?id=109758
+
+ Reviewed by Brent Fulgham.
+
+ Ensure the SVG pattern is drawn correctly if it is used as a stroke for
+ empty objectBoundingBox elements.
+
+ * svg/custom/pattern-units-fill-stroke-expected.svg: Added.
+ * svg/custom/pattern-units-fill-stroke.svg: Added.
+
2016-03-22 Myles C. Maxfield <[email protected]>
Post-review test update after r198560
Added: trunk/LayoutTests/svg/custom/pattern-units-fill-stroke-expected.svg (0 => 198574)
--- trunk/LayoutTests/svg/custom/pattern-units-fill-stroke-expected.svg (rev 0)
+++ trunk/LayoutTests/svg/custom/pattern-units-fill-stroke-expected.svg 2016-03-23 03:28:09 UTC (rev 198574)
@@ -0,0 +1,18 @@
+<svg width='400' height='400' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' >
+ <g id='symbol-16'>
+ <g id='symbol-4'>
+ <g id='symbol-1'>
+ <rect width='50' height='50' fill='skyblue'/>
+ <rect x='5' y='5' width='40' height='40' fill='green'/>
+ </g>
+ <use xlink:href='' transform='translate(50, 0)'/>
+ <use xlink:href='' transform='translate(100, 0)'/>
+ <use xlink:href='' transform='translate(150, 0)'/>
+ </g>
+ <use xlink:href='' transform='translate(0, 50)'/>
+ <use xlink:href='' transform='translate(0, 100)'/>
+ <use xlink:href='' transform='translate(0, 150)'/>
+ </g>
+ <use xlink:href='' transform='translate(200, 0)'/>
+ <use xlink:href='' transform='translate(0, 200)'/>
+</svg>
Added: trunk/LayoutTests/svg/custom/pattern-units-fill-stroke.svg (0 => 198574)
--- trunk/LayoutTests/svg/custom/pattern-units-fill-stroke.svg (rev 0)
+++ trunk/LayoutTests/svg/custom/pattern-units-fill-stroke.svg 2016-03-23 03:28:09 UTC (rev 198574)
@@ -0,0 +1,19 @@
+<svg width='400' height='400' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' >
+ <defs>
+ <symbol id="symbol-1">
+ <rect width='50' height='50' fill='skyblue'/>
+ <rect x='5' y='5' width='40' height='40' fill='green'/>
+ </symbol>
+ <pattern id='pattern-1' width='50' height='50' patternUnits='userSpaceOnUse'>
+ <use width='50' height='50' xlink:href='' />
+ </pattern>
+ <pattern id='pattern-2' x='0' y='0' width='0.25' height='0.25' patternUnits='objectBoundingBox'>
+ <use width='50' height='50' xlink:href='' />
+ </pattern>
+ </defs>
+ <rect x='0' y='0' width='200' height='200' fill='url(#pattern-1)'/>
+ <line x1='200' y1='100' x2='400' y2='100' stroke-width='200' stroke='url(#pattern-1)'/>
+ <rect x='0' y='200' width='200' height='200' fill='url(#pattern-2)'/>
+ <!-- This line won't be drawn since pattern-2 has 'objectBoundingBox' and the line box is empty -->
+ <line x1='200' y1='300' x2='400' y2='300' stroke-width='200' stroke='url(#pattern-2)'/>
+</svg>
Modified: trunk/Source/WebCore/ChangeLog (198573 => 198574)
--- trunk/Source/WebCore/ChangeLog 2016-03-23 02:30:57 UTC (rev 198573)
+++ trunk/Source/WebCore/ChangeLog 2016-03-23 03:28:09 UTC (rev 198574)
@@ -1,3 +1,20 @@
+2016-03-22 Said Abou-Hallawa <[email protected]>
+
+ userSpaceOnUse patterns are not stroked for empty object bounding box elements
+ https://bugs.webkit.org/show_bug.cgi?id=109758
+
+ Reviewed by Brent Fulgham.
+
+ Checking whether the patternUnits is objectBoundingBox needs to be done
+ after calling collectPatternAttributes(). Otherwise the default value
+ will be always checked which is 'objectBoundingBox'.
+
+ Tests: svg/custom/pattern-units-fill-stroke.svg
+
+ * rendering/svg/RenderSVGResourcePattern.cpp:
+ (WebCore::RenderSVGResourcePattern::buildPattern):
+ (WebCore::RenderSVGResourcePattern::applyResource):
+
2016-03-22 Myles C. Maxfield <[email protected]>
Use references instead of pointers for absolute positioning code
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (198573 => 198574)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp 2016-03-23 02:30:57 UTC (rev 198573)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp 2016-03-23 03:28:09 UTC (rev 198574)
@@ -71,18 +71,12 @@
PatternData* RenderSVGResourcePattern::buildPattern(RenderElement& renderer, unsigned short resourceMode, GraphicsContext& context)
{
+ ASSERT(!m_shouldCollectPatternAttributes);
+
PatternData* currentData = m_patternMap.get(&renderer);
if (currentData && currentData->pattern)
return currentData;
- if (m_shouldCollectPatternAttributes) {
- patternElement().synchronizeAnimatedSVGAttribute(anyQName());
-
- m_attributes = PatternAttributes();
- collectPatternAttributes(m_attributes);
- m_shouldCollectPatternAttributes = false;
- }
-
// If we couldn't determine the pattern content element root, stop here.
if (!m_attributes.patternContentElement())
return nullptr;
@@ -151,6 +145,14 @@
ASSERT(context);
ASSERT(resourceMode != ApplyToDefaultMode);
+ if (m_shouldCollectPatternAttributes) {
+ patternElement().synchronizeAnimatedSVGAttribute(anyQName());
+
+ m_attributes = PatternAttributes();
+ collectPatternAttributes(m_attributes);
+ m_shouldCollectPatternAttributes = false;
+ }
+
// Spec: When the geometry of the applicable element has no width or height and objectBoundingBox is specified,
// then the given effect (e.g. a gradient or a filter) will be ignored.
FloatRect objectBoundingBox = renderer.objectBoundingBox();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes