Title: [171567] trunk
Revision
171567
Author
simon.fra...@apple.com
Date
2014-07-24 18:05:14 -0700 (Thu, 24 Jul 2014)

Log Message

[iOS WK1] CSS viewport units use the wrong viewport size in WebKit1
https://bugs.webkit.org/show_bug.cgi?id=135254
<rdar://problem/17781423>

Reviewed by Tim Horton.

Source/WebCore:

Test: fast/css/viewport-units-dynamic.html

In WebKit1 on iOS, we want to resolve viewport units against the visible
viewport, not the legacy WK1 notion of the "viewport" which is the entire document.

Fixes rendering of medium.com articles in WK1 views on iPad.

* page/FrameView.cpp:
(WebCore::FrameView::viewportSizeForCSSViewportUnits):

LayoutTests:

New test that ensures that viewport units are resolved against the correct
viewport size after the first style recalc.

* fast/css/viewport-units-dynamic.html: Added.
* platform/mac/fast/css/viewport-units-dynamic-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (171566 => 171567)


--- trunk/LayoutTests/ChangeLog	2014-07-25 01:03:00 UTC (rev 171566)
+++ trunk/LayoutTests/ChangeLog	2014-07-25 01:05:14 UTC (rev 171567)
@@ -1,3 +1,17 @@
+2014-07-24  Simon Fraser  <simon.fra...@apple.com>
+
+        [iOS WK1] CSS viewport units use the wrong viewport size in WebKit1
+        https://bugs.webkit.org/show_bug.cgi?id=135254
+        <rdar://problem/17781423>
+
+        Reviewed by Tim Horton.
+        
+        New test that ensures that viewport units are resolved against the correct
+        viewport size after the first style recalc.
+
+        * fast/css/viewport-units-dynamic.html: Added.
+        * platform/mac/fast/css/viewport-units-dynamic-expected.txt: Added.
+
 2014-07-24  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Crash when measuring a glyphs from a fallback SVG font

Added: trunk/LayoutTests/fast/css/viewport-units-dynamic.html (0 => 171567)


--- trunk/LayoutTests/fast/css/viewport-units-dynamic.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/viewport-units-dynamic.html	2014-07-25 01:05:14 UTC (rev 171567)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 10000px;
+            width: 10000px;
+            margin: 0;
+        }
+        .box {
+            position: absolute;
+            background-color: rgba(0, 0, 0, 0.5);
+            border: 5px solid black;
+            box-sizing: border-box;
+        }
+        
+        .width {
+            width: 100px;
+            height: 100px;
+            padding-left: 100px;
+        }
+
+        .height {
+            height: 100px;
+            width: 100px;
+            padding-top: 100px;
+        }
+        
+        body.changed .height {
+            height: 100vh;
+        }
+
+        body.changed .width {
+            width: 100vw;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        function doTest()
+        {
+            window.setTimeout(function() {
+                document.body.classList.add('changed');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 0);
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+<div class="box width">
+    This should be as wide as the CSS viewport.
+</div>
+
+<div id="vertical" class="box height">
+    This should be as tall as the CSS viewport.
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac/fast/css/viewport-units-dynamic-expected.txt (0 => 171567)


--- trunk/LayoutTests/platform/mac/fast/css/viewport-units-dynamic-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css/viewport-units-dynamic-expected.txt	2014-07-25 01:05:14 UTC (rev 171567)
@@ -0,0 +1,16 @@
+layer at (0,0) size 10000x10000
+  RenderView at (0,0) size 785x585
+layer at (0,0) size 785x10000
+  RenderBlock {HTML} at (0,0) size 785x10000
+    RenderBody {BODY} at (0,0) size 10000x10000
+layer at (0,0) size 800x100
+  RenderBlock (positioned) {DIV} at (0,0) size 800x100 [bgcolor=#0000007F] [border: (5px solid #000000)]
+    RenderText {#text} at (105,5) size 282x18
+      text run at (105,5) width 282: "This should be as wide as the CSS viewport."
+layer at (0,0) size 100x600
+  RenderBlock (positioned) {DIV} at (0,0) size 100x600 [bgcolor=#0000007F] [border: (5px solid #000000)]
+    RenderText {#text} at (5,105) size 74x72
+      text run at (5,105) width 74: "This should"
+      text run at (5,123) width 72: "be as tall as"
+      text run at (5,141) width 52: "the CSS"
+      text run at (5,159) width 60: "viewport."

Modified: trunk/Source/WebCore/ChangeLog (171566 => 171567)


--- trunk/Source/WebCore/ChangeLog	2014-07-25 01:03:00 UTC (rev 171566)
+++ trunk/Source/WebCore/ChangeLog	2014-07-25 01:05:14 UTC (rev 171567)
@@ -1,3 +1,21 @@
+2014-07-24  Simon Fraser  <simon.fra...@apple.com>
+
+        [iOS WK1] CSS viewport units use the wrong viewport size in WebKit1
+        https://bugs.webkit.org/show_bug.cgi?id=135254
+        <rdar://problem/17781423>
+
+        Reviewed by Tim Horton.
+
+        Test: fast/css/viewport-units-dynamic.html
+        
+        In WebKit1 on iOS, we want to resolve viewport units against the visible
+        viewport, not the legacy WK1 notion of the "viewport" which is the entire document.
+        
+        Fixes rendering of medium.com articles in WK1 views on iPad.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::viewportSizeForCSSViewportUnits):
+
 2014-07-24  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Crash when measuring a glyphs from a fallback SVG font

Modified: trunk/Source/WebCore/page/FrameView.cpp (171566 => 171567)


--- trunk/Source/WebCore/page/FrameView.cpp	2014-07-25 01:03:00 UTC (rev 171566)
+++ trunk/Source/WebCore/page/FrameView.cpp	2014-07-25 01:05:14 UTC (rev 171567)
@@ -4522,7 +4522,7 @@
     if (m_hasOverrideViewportSize)
         return m_overrideViewportSize;
     
-    return visibleContentRectIncludingScrollbars(ScrollableArea::LegacyIOSDocumentVisibleRect).size();
+    return visibleContentRectIncludingScrollbars().size();
 }
     
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to