Title: [232256] trunk
Revision
232256
Author
wenson_hs...@apple.com
Date
2018-05-29 08:00:09 -0700 (Tue, 29 May 2018)

Log Message

[Extra zoom mode] "Significant area painted" rendering progress event is rarely fired
https://bugs.webkit.org/show_bug.cgi?id=186042
<rdar://problem/40604182>

Reviewed by Tim Horton.

Source/WebCore:

Makes a minor tweak to the size of the relevant view rect in extra zoom mode, such that it's no wider than the
visible content rect. Previously, the width of this rect has hard-coded to a value optimized for macOS (980),
which makes it difficult for content laid out at device width in extra zoom mode to cover a significant portion
of the relevant view rect.

Test: RenderingProgressTests.FirstPaintWithSignificantArea

* page/Page.cpp:
(WebCore::relevantViewRect):

Tools:

Adds a new API test to check that the "significant area painting" rendering milestone is dispatched when a
significant portion of the page has been painted before document load is finished.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/paint-significant-area-milestone.html: Added.
* TestWebKitAPI/Tests/ios/RenderingProgressTests.mm: Added.
(-[MissingResourceSchemeHandler webView:stopURLSchemeTask:]):
(-[MissingResourceSchemeHandler webView:startURLSchemeTask:]):
(-[RenderingProgressHandler initWithHandler:]):
(-[RenderingProgressHandler _webView:renderingProgressDidChange:]):
(TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (232255 => 232256)


--- trunk/Source/WebCore/ChangeLog	2018-05-29 11:59:56 UTC (rev 232255)
+++ trunk/Source/WebCore/ChangeLog	2018-05-29 15:00:09 UTC (rev 232256)
@@ -1,3 +1,21 @@
+2018-05-29  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Extra zoom mode] "Significant area painted" rendering progress event is rarely fired
+        https://bugs.webkit.org/show_bug.cgi?id=186042
+        <rdar://problem/40604182>
+
+        Reviewed by Tim Horton.
+
+        Makes a minor tweak to the size of the relevant view rect in extra zoom mode, such that it's no wider than the
+        visible content rect. Previously, the width of this rect has hard-coded to a value optimized for macOS (980),
+        which makes it difficult for content laid out at device width in extra zoom mode to cover a significant portion
+        of the relevant view rect.
+
+        Test: RenderingProgressTests.FirstPaintWithSignificantArea
+
+        * page/Page.cpp:
+        (WebCore::relevantViewRect):
+
 2018-05-29  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] Handle relative length units

Modified: trunk/Source/WebCore/page/Page.cpp (232255 => 232256)


--- trunk/Source/WebCore/page/Page.cpp	2018-05-29 11:59:56 UTC (rev 232255)
+++ trunk/Source/WebCore/page/Page.cpp	2018-05-29 15:00:09 UTC (rev 232256)
@@ -1856,14 +1856,20 @@
 
 static LayoutRect relevantViewRect(RenderView* view)
 {
+    LayoutRect viewRect = view->viewRect();
+
+    float relevantViewRectWidth = 980;
+#if ENABLE(EXTRA_ZOOM_MODE)
+    // FIXME(186051): Consider limiting the relevant rect width to the view width everywhere.
+    relevantViewRectWidth = std::min<float>(viewRect.width().toFloat(), relevantViewRectWidth);
+#endif
+
     // DidHitRelevantRepaintedObjectsAreaThreshold is a LayoutMilestone intended to indicate that
     // a certain relevant amount of content has been drawn to the screen. This is the rect that
     // has been determined to be relevant in the context of this goal. We may choose to tweak
     // the rect over time, much like we may choose to tweak gMinimumPaintedAreaRatio and
     // gMaximumUnpaintedAreaRatio. But this seems to work well right now.
-    LayoutRect relevantViewRect = LayoutRect(0, 0, 980, 1300);
-
-    LayoutRect viewRect = view->viewRect();
+    LayoutRect relevantViewRect { 0, 0, relevantViewRectWidth, 1300 };
     // If the viewRect is wider than the relevantViewRect, center the relevantViewRect.
     if (viewRect.width() > relevantViewRect.width())
         relevantViewRect.setX((viewRect.width() - relevantViewRect.width()) / 2);

Modified: trunk/Tools/ChangeLog (232255 => 232256)


--- trunk/Tools/ChangeLog	2018-05-29 11:59:56 UTC (rev 232255)
+++ trunk/Tools/ChangeLog	2018-05-29 15:00:09 UTC (rev 232256)
@@ -1,3 +1,23 @@
+2018-05-29  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Extra zoom mode] "Significant area painted" rendering progress event is rarely fired
+        https://bugs.webkit.org/show_bug.cgi?id=186042
+        <rdar://problem/40604182>
+
+        Reviewed by Tim Horton.
+
+        Adds a new API test to check that the "significant area painting" rendering milestone is dispatched when a
+        significant portion of the page has been painted before document load is finished.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKitCocoa/paint-significant-area-milestone.html: Added.
+        * TestWebKitAPI/Tests/ios/RenderingProgressTests.mm: Added.
+        (-[MissingResourceSchemeHandler webView:stopURLSchemeTask:]):
+        (-[MissingResourceSchemeHandler webView:startURLSchemeTask:]):
+        (-[RenderingProgressHandler initWithHandler:]):
+        (-[RenderingProgressHandler _webView:renderingProgressDidChange:]):
+        (TEST):
+
 2018-05-29  Thibault Saunier  <tsaun...@igalia.com>
 
         [GStreamer] Update "qtdemux: Clarify field name about stream-encryption-system" patch

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (232255 => 232256)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2018-05-29 11:59:56 UTC (rev 232255)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2018-05-29 15:00:09 UTC (rev 232256)
@@ -780,6 +780,7 @@
 		F457A9D6202D68AF00F7E9D5 /* DataTransfer.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F457A9B3202D535300F7E9D5 /* DataTransfer.html */; };
 		F45B63FB1F197F4A009D38B9 /* image-map.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F45B63FA1F197F33009D38B9 /* image-map.html */; };
 		F45B63FE1F19D410009D38B9 /* ActionSheetTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F45B63FC1F19D410009D38B9 /* ActionSheetTests.mm */; };
+		F464AF9220BB66EA007F9B18 /* RenderingProgressTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F464AF9120BB66EA007F9B18 /* RenderingProgressTests.mm */; };
 		F46849BE1EEF58E400B937FE /* UIPasteboardTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */; };
 		F46849C01EEF5EF300B937FE /* rich-and-plain-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F46849BF1EEF5EDC00B937FE /* rich-and-plain-text.html */; };
 		F469FB241F01804B00401539 /* contenteditable-and-target.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F469FB231F01803500401539 /* contenteditable-and-target.html */; };
@@ -793,6 +794,7 @@
 		F4A9202F1FEE34E900F59590 /* apple-data-url.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4A9202E1FEE34C800F59590 /* apple-data-url.html */; };
 		F4AB578A1F65165400DB0DA1 /* custom-draggable-div.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4AB57891F65164B00DB0DA1 /* custom-draggable-div.html */; };
 		F4B825D81EF4DBFB006E417F /* compressed-files.zip in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4B825D61EF4DBD4006E417F /* compressed-files.zip */; };
+		F4B86D4F20BCD5B20099A7E6 /* paint-significant-area-milestone.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4B86D4E20BCD5970099A7E6 /* paint-significant-area-milestone.html */; };
 		F4BFA68E1E4AD08000154298 /* DragAndDropPasteboardTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4BFA68C1E4AD08000154298 /* DragAndDropPasteboardTests.mm */; };
 		F4C2AB221DD6D95E00E06D5B /* enormous-video-with-sound.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */; };
 		F4C8797F2059D8D3009CD00B /* ScrollViewInsetTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4C8797E2059D8D3009CD00B /* ScrollViewInsetTests.mm */; };
@@ -1075,6 +1077,7 @@
 				CEBCA13A1E3A807A00C73293 /* page-without-csp.html in Copy Resources */,
 				A1C4FB731BACD1CA003742D0 /* pages.pages in Copy Resources */,
 				A57A34F216AF6B2B00C2501F /* PageVisibilityStateWithWindowChanges.html in Copy Resources */,
+				F4B86D4F20BCD5B20099A7E6 /* paint-significant-area-milestone.html in Copy Resources */,
 				A1409AD91E7254D4004949D9 /* password-protected.pages in Copy Resources */,
 				9BD6D3A71F7B21DC00BD4962 /* paste-image.html in Copy Resources */,
 				9B7D740F1F8378770006C432 /* paste-rtfd.html in Copy Resources */,
@@ -1952,6 +1955,7 @@
 		F457A9B6202D5CDC00F7E9D5 /* PasteMixedContent.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PasteMixedContent.mm; sourceTree = "<group>"; };
 		F45B63FA1F197F33009D38B9 /* image-map.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "image-map.html"; sourceTree = "<group>"; };
 		F45B63FC1F19D410009D38B9 /* ActionSheetTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ActionSheetTests.mm; sourceTree = "<group>"; };
+		F464AF9120BB66EA007F9B18 /* RenderingProgressTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderingProgressTests.mm; sourceTree = "<group>"; };
 		F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UIPasteboardTests.mm; sourceTree = "<group>"; };
 		F46849BF1EEF5EDC00B937FE /* rich-and-plain-text.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "rich-and-plain-text.html"; sourceTree = "<group>"; };
 		F469FB231F01803500401539 /* contenteditable-and-target.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "contenteditable-and-target.html"; sourceTree = "<group>"; };
@@ -1966,6 +1970,7 @@
 		F4A9202E1FEE34C800F59590 /* apple-data-url.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "apple-data-url.html"; sourceTree = "<group>"; };
 		F4AB57891F65164B00DB0DA1 /* custom-draggable-div.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "custom-draggable-div.html"; sourceTree = "<group>"; };
 		F4B825D61EF4DBD4006E417F /* compressed-files.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "compressed-files.zip"; sourceTree = "<group>"; };
+		F4B86D4E20BCD5970099A7E6 /* paint-significant-area-milestone.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "paint-significant-area-milestone.html"; sourceTree = "<group>"; };
 		F4BFA68C1E4AD08000154298 /* DragAndDropPasteboardTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragAndDropPasteboardTests.mm; sourceTree = "<group>"; };
 		F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "enormous-video-with-sound.html"; sourceTree = "<group>"; };
 		F4C8797E2059D8D3009CD00B /* ScrollViewInsetTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollViewInsetTests.mm; sourceTree = "<group>"; };
@@ -2398,6 +2403,7 @@
 				F4D4F3B71E4E36E400BB2767 /* DataInteractionTests.mm */,
 				574F55CE204D3763002948C6 /* LocalAuthenticator.mm */,
 				7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */,
+				F464AF9120BB66EA007F9B18 /* RenderingProgressTests.mm */,
 				F4C8797E2059D8D3009CD00B /* ScrollViewInsetTests.mm */,
 				CE6E819F20A6935F00E2C80F /* SetTimeoutFunction.mm */,
 				4433A395208044130091ED57 /* SynchronousTimeoutTests.mm */,
@@ -2571,6 +2577,7 @@
 				CEBCA1351E3A803400C73293 /* page-with-csp.html */,
 				CEBCA1361E3A803400C73293 /* page-without-csp-iframe.html */,
 				CEBCA1371E3A803400C73293 /* page-without-csp.html */,
+				F4B86D4E20BCD5970099A7E6 /* paint-significant-area-milestone.html */,
 				A1409AD81E7254AC004949D9 /* password-protected.pages */,
 				9BD6D3A61F7B21CC00BD4962 /* paste-image.html */,
 				9B7D740E1F8377E60006C432 /* paste-rtfd.html */,
@@ -3724,6 +3731,7 @@
 				7CCE7EC91A411A7E00447C4C /* RenderedImageFromDOMNode.mm in Sources */,
 				7CCE7ECA1A411A7E00447C4C /* RenderedImageFromDOMRange.mm in Sources */,
 				A12DDBFB1E836F0700CF6CAE /* RenderedImageWithOptions.mm in Sources */,
+				F464AF9220BB66EA007F9B18 /* RenderingProgressTests.mm in Sources */,
 				7C83E0C41D0A654200FEBCF3 /* RequiresUserActionForPlayback.mm in Sources */,
 				7CCE7F0E1A411AE600447C4C /* ResizeReversePaginatedWebView.cpp in Sources */,
 				7CCE7F0F1A411AE600447C4C /* ResizeWindowAfterCrash.cpp in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/paint-significant-area-milestone.html (0 => 232256)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/paint-significant-area-milestone.html	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/paint-significant-area-milestone.html	2018-05-29 15:00:09 UTC (rev 232256)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+    <meta name="viewport" content="width=device-width">
+    <head>
+        <style>
+            body {
+                width: 100%;
+                height: 100%;
+                margin: 0;
+                line-height: 200%;
+                font-size: 16px;
+            }
+
+            svg {
+                width: 75px;
+                height: 75px;
+            }
+        </style>
+    </head>
+    <body>
+        <h2>This is some placeholder text</h2>
+        <br>
+        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
+            <path d="M30,1h40l29,29v40l-29,29h-40l-29-29v-40z" stroke="black" fill="none"/>
+            <path d="M31,3h38l28,28v38l-28,28h-38l-28-28v-38z" stroke="white" fill="black"/>
+        </svg>
+        <p>Lorem ipsum dolor sit amet, <a href="" adipiscing elit</a>.</p>
+        <p>Aenean laoreet nisi felis, <strong>eu scelerisque dolor imperdiet in.</strong> Sed at porttitor purus, in placerat justo.</p>
+        <h2>This is some placeholder text</h2>
+        <p>Phasellus nec mattis ipsum, <a href="" pellentesque est</a>. At vero eos et accusam et justo duo dolores et ea rebum.</p>
+        <p>Sed lacinia nisi quis velit aliquam, et placerat augue posuere. Nullam sed fermentum leo, a cursus tellus. <strong>Ut sed mattis erat,</strong> quis volutpat leo. Duis ac cursus metus. Nullam eu libero eget quam scelerisque dictum.</p>
+        <p>Duis ac cursus metus. Nullam eu libero eget quam scelerisque dictum.</p>
+        <script src=""
+    </body>
+</html>

Added: trunk/Tools/TestWebKitAPI/Tests/ios/RenderingProgressTests.mm (0 => 232256)


--- trunk/Tools/TestWebKitAPI/Tests/ios/RenderingProgressTests.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/RenderingProgressTests.mm	2018-05-29 15:00:09 UTC (rev 232256)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_API_ENABLED
+
+#include "PlatformUtilities.h"
+#include "TestNavigationDelegate.h"
+#include "TestWKWebView.h"
+#include <WebKit/WKNavigationDelegatePrivate.h>
+#include <wtf/BlockPtr.h>
+
+@interface MissingResourceSchemeHandler : NSObject<WKURLSchemeHandler>
+@end
+
+@implementation MissingResourceSchemeHandler
+
+- (void)webView:(WKWebView *)webView stopURLSchemeTask:(id<WKURLSchemeTask>)urlSchemeTask
+{
+}
+
+- (void)webView:(WKWebView *)webView startURLSchemeTask:(id<WKURLSchemeTask>)urlSchemeTask
+{
+}
+
+@end
+
+#if ENABLE(EXTRA_ZOOM_MODE)
+
+TEST(RenderingProgressTests, FirstPaintWithSignificantArea)
+{
+    auto schemeHandler = adoptNS([[MissingResourceSchemeHandler alloc] init]);
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"missing"];
+    // A full-height, but very narrow web view (for instance, a navigation sidebar embedded in an app).
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 160, 568) configuration:configuration.get()]);
+    [webView _setObservedRenderingProgressEvents:_WKRenderingProgressEventFirstPaintWithSignificantArea];
+
+    bool observedSignificantPaint = false;
+    auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]);
+    [navigationDelegate setRenderingProgressDidChange:[&] (WKWebView *, _WKRenderingProgressEvents events) {
+        if (events & _WKRenderingProgressEventFirstPaintWithSignificantArea)
+            observedSignificantPaint = true;
+    }];
+
+    [webView setNavigationDelegate:navigationDelegate.get()];
+    [webView loadTestPageNamed:@"paint-significant-area-milestone"];
+    TestWebKitAPI::Util::run(&observedSignificantPaint);
+}
+
+#endif // ENABLE(EXTRA_ZOOM_MODE)
+
+#endif // WK_API_ENABLED
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to