Title: [171692] trunk
Revision
171692
Author
[email protected]
Date
2014-07-28 13:44:50 -0700 (Mon, 28 Jul 2014)

Log Message

REGRESSION (r160806): CSS zoom property doesn't work on anything inside anchors.
<https://webkit.org/b/135344>
<rdar://problem/17759577>

Source/WebCore:
When DeprecatedStyleBuilder applies the CSS zoom property (ApplyPropertyZoom)
it first resets the "effective zoom" by calling RenderStyle::setEffectiveZoom().

This mechanism was not resistent to being called multiple times, due to the
optimization in RenderStyle::setZoom() to avoid copy-on-writing the shared data
when setting some property to the already-set value.

The bug would happen in this sequence:

ApplyPropertyZoom:
    - setEffectiveZoom(1);
    - setZoom(2); // this updates the effective zoom
ApplyPropertyZoom:
    - setEffectiveZoom(1);
    - setZoom(2); // this doesn't update the effective zoom

When we run the second setZoom(2); call, the RenderStyle's zoom value is 2
already and we'll early return without updating the effective zoom.

This change moves the updating of the effective zoom in setZoom() to take place
before the early return due to overwriting with the same value.

Note: the fact that we're apply the zoom property twice is an inefficiency that
we should figure out a way to avoid in the future.

Reviewed by Simon Fraser.

Test: fast/css/zoom-inside-link.html

* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setZoom):

LayoutTests:
Reviewed by Simon Fraser.

* fast/css/zoom-inside-link-expected.html: Added.
* fast/css/zoom-inside-link.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (171691 => 171692)


--- trunk/LayoutTests/ChangeLog	2014-07-28 20:43:57 UTC (rev 171691)
+++ trunk/LayoutTests/ChangeLog	2014-07-28 20:44:50 UTC (rev 171692)
@@ -1,3 +1,14 @@
+2014-07-28  Andreas Kling  <[email protected]>
+
+        REGRESSION (r160806): CSS zoom property doesn't work on anything inside anchors.
+        <https://webkit.org/b/135344>
+        <rdar://problem/17759577>
+
+        Reviewed by Simon Fraser.
+
+        * fast/css/zoom-inside-link-expected.html: Added.
+        * fast/css/zoom-inside-link.html: Added.
+
 2014-07-28  Zoltan Horvath  <[email protected]>
 
         [CSS3-Text] Update text-expectations after r171677

Added: trunk/LayoutTests/fast/css/zoom-inside-link-expected.html (0 => 171692)


--- trunk/LayoutTests/fast/css/zoom-inside-link-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/zoom-inside-link-expected.html	2014-07-28 20:44:50 UTC (rev 171692)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+a, p { color: black; text-decoration: none; }
+</style>
+</head>
+<body>
+<p>This is unzoomed.</p>
+<p style="zoom: 2">This is zoomed.</p>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/zoom-inside-link.html (0 => 171692)


--- trunk/LayoutTests/fast/css/zoom-inside-link.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/zoom-inside-link.html	2014-07-28 20:44:50 UTC (rev 171692)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+a, p { color: black; text-decoration: none; }
+</style>
+</head>
+<body>
+<a href=""
+<p>This is unzoomed.</p>
+<p style="zoom: 2">This is zoomed.</p>
+</a>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (171691 => 171692)


--- trunk/Source/WebCore/ChangeLog	2014-07-28 20:43:57 UTC (rev 171691)
+++ trunk/Source/WebCore/ChangeLog	2014-07-28 20:44:50 UTC (rev 171692)
@@ -1,3 +1,41 @@
+2014-07-28  Andreas Kling  <[email protected]>
+
+        REGRESSION (r160806): CSS zoom property doesn't work on anything inside anchors.
+        <https://webkit.org/b/135344>
+        <rdar://problem/17759577>
+
+        When DeprecatedStyleBuilder applies the CSS zoom property (ApplyPropertyZoom)
+        it first resets the "effective zoom" by calling RenderStyle::setEffectiveZoom().
+
+        This mechanism was not resistent to being called multiple times, due to the
+        optimization in RenderStyle::setZoom() to avoid copy-on-writing the shared data
+        when setting some property to the already-set value.
+
+        The bug would happen in this sequence:
+
+        ApplyPropertyZoom:
+            - setEffectiveZoom(1);
+            - setZoom(2); // this updates the effective zoom
+        ApplyPropertyZoom:
+            - setEffectiveZoom(1);
+            - setZoom(2); // this doesn't update the effective zoom
+
+        When we run the second setZoom(2); call, the RenderStyle's zoom value is 2
+        already and we'll early return without updating the effective zoom.
+
+        This change moves the updating of the effective zoom in setZoom() to take place
+        before the early return due to overwriting with the same value.
+
+        Note: the fact that we're apply the zoom property twice is an inefficiency that
+        we should figure out a way to avoid in the future.
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/css/zoom-inside-link.html
+
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::setZoom):
+
 2014-07-28  Bear Travis  <[email protected]>
 
         [CSS Font Loading] Update Font Loading Code

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (171691 => 171692)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2014-07-28 20:43:57 UTC (rev 171691)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2014-07-28 20:44:50 UTC (rev 171692)
@@ -2080,10 +2080,10 @@
 
 inline bool RenderStyle::setZoom(float f)
 {
+    setEffectiveZoom(effectiveZoom() * f);
     if (compareEqual(visual->m_zoom, f))
         return false;
     visual.access()->m_zoom = f;
-    setEffectiveZoom(effectiveZoom() * zoom());
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to