Title: [201604] trunk
Revision
201604
Author
[email protected]
Date
2016-06-02 11:40:02 -0700 (Thu, 02 Jun 2016)

Log Message

SVG content renders in incorrect vertical position when padding-left is not specified
https://bugs.webkit.org/show_bug.cgi?id=158234

Patch by Said Abou-Hallawa <[email protected]> on 2016-06-02
Reviewed by Darin Adler.

Source/WebCore:

Fix the optimization in RenderSVGRoot::buildLocalToBorderBoxTransform().
Use LayoutSize::isZero() instead of LayoutSize::isEmpty() to decide whether
there is borderAndPadding applied or not.

Test: svg/custom/svg-root-padding-individual.html

* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform):

LayoutTests:

Make sure the SVG root element is positioned correctly when either the sum
of its (leftPadding + rightPadding) or the sum of its (topPadding + bottomPadding)
is equal to zero.

* svg/custom/svg-root-padding-individual-expected.html: Added.
* svg/custom/svg-root-padding-individual.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (201603 => 201604)


--- trunk/LayoutTests/ChangeLog	2016-06-02 18:17:47 UTC (rev 201603)
+++ trunk/LayoutTests/ChangeLog	2016-06-02 18:40:02 UTC (rev 201604)
@@ -1,3 +1,17 @@
+2016-06-02  Said Abou-Hallawa  <[email protected]>
+
+        SVG content renders in incorrect vertical position when padding-left is not specified
+        https://bugs.webkit.org/show_bug.cgi?id=158234
+
+        Reviewed by Darin Adler.
+
+        Make sure the SVG root element is positioned correctly when either the sum
+        of its (leftPadding + rightPadding) or the sum of its (topPadding + bottomPadding)
+        is equal to zero.
+
+        * svg/custom/svg-root-padding-individual-expected.html: Added.
+        * svg/custom/svg-root-padding-individual.html: Added.
+
 2016-06-02  Adam Bergkvist  <[email protected]>
 
         WebRTC: Update RTCPeerConnection.addTrack() to create (or reuse) an RTCRtpTransceiver

Added: trunk/LayoutTests/svg/custom/svg-root-padding-individual-expected.html (0 => 201604)


--- trunk/LayoutTests/svg/custom/svg-root-padding-individual-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/svg-root-padding-individual-expected.html	2016-06-02 18:40:02 UTC (rev 201604)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<style>
+   .inner-box {
+       width: 100px;
+       height: 100px;
+       background-color: green;
+       position: relative;
+   }
+   .position-left-100 {
+       left: 100px;
+   }
+   .position-top-100 {
+       top: 100px;
+   }
+   .container-box {
+       width: 200px;
+       height: 200px;
+   }
+</style>
+<div class="container-box">
+    <div class="inner-box position-top-100"></div>
+</div>
+<div class="container-box">
+    <div class="inner-box position-left-100"></div>
+</div>

Added: trunk/LayoutTests/svg/custom/svg-root-padding-individual.html (0 => 201604)


--- trunk/LayoutTests/svg/custom/svg-root-padding-individual.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/svg-root-padding-individual.html	2016-06-02 18:40:02 UTC (rev 201604)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<style>
+   .inner-box {
+       width: 100px;
+       height: 100px;
+   }
+   .padding-left-100 {
+       padding: 100px 0 0 0;
+   }
+   .padding-top-100 {
+       padding: 0 0 0 100px;
+   }
+   .container-box {
+       width: 200px;
+       height: 200px;
+   }
+</style>
+<div class="container-box">
+    <svg class="inner-box padding-left-100">
+        <rect width="100%" height="100%" fill="green"/>
+    </svg>
+</div>
+<div class="container-box">
+    <svg class="inner-box padding-top-100">
+        <rect width="100%" height="100%" fill="green"/>
+    </svg>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (201603 => 201604)


--- trunk/Source/WebCore/ChangeLog	2016-06-02 18:17:47 UTC (rev 201603)
+++ trunk/Source/WebCore/ChangeLog	2016-06-02 18:40:02 UTC (rev 201604)
@@ -1,3 +1,19 @@
+2016-06-02  Said Abou-Hallawa  <[email protected]>
+
+        SVG content renders in incorrect vertical position when padding-left is not specified
+        https://bugs.webkit.org/show_bug.cgi?id=158234
+
+        Reviewed by Darin Adler.
+
+        Fix the optimization in RenderSVGRoot::buildLocalToBorderBoxTransform().
+        Use LayoutSize::isZero() instead of LayoutSize::isEmpty() to decide whether
+        there is borderAndPadding applied or not.
+
+        Test: svg/custom/svg-root-padding-individual.html
+
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform):
+
 2016-06-02  Brady Eidson  <[email protected]>
 
         Overhaul cross-thread use of ResourceRequest, ResourceResponse, and ResourceError.

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (201603 => 201604)


--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2016-06-02 18:17:47 UTC (rev 201603)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp	2016-06-02 18:40:02 UTC (rev 201604)
@@ -331,7 +331,7 @@
     SVGPoint translate = svgSVGElement().currentTranslate();
     LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop());
     m_localToBorderBoxTransform = svgSVGElement().viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale);
-    if (borderAndPadding.isEmpty() && scale == 1 && translate == SVGPoint::zero())
+    if (borderAndPadding.isZero() && scale == 1 && translate == SVGPoint::zero())
         return;
     m_localToBorderBoxTransform = AffineTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()) * m_localToBorderBoxTransform;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to