Title: [170953] trunk/Source
Revision
170953
Author
[email protected]
Date
2014-07-09 22:06:30 -0700 (Wed, 09 Jul 2014)

Log Message

[iOS][WK2] Disable text quantization while actively changing the page's scale factor
https://bugs.webkit.org/show_bug.cgi?id=134781

Patch by Benjamin Poulain <[email protected]> on 2014-07-09
Reviewed by Tim Horton and Myles C. Maxfield.


Source/WebCore: 
Query the chrome client to setup quantization on each layers.

* page/ChromeClient.h:
(WebCore::ChromeClient::hasStablePageScaleFactor):
* platform/graphics/mac/FontMac.mm:
(WebCore::Font::drawGlyphs):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::setupFontSubpixelQuantization):

Source/WebKit2: 
While zooming a page, text quantization causes glyphs to "move" in order to get to the closest
boundary for the current scale factor.

We do not want this to happen while dynamically changing the scale factor because the effect
is visible. To avoid this, we disable text quantization if the page's scale factor changes
in response to a non-stable contentRect update.

* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::hasStablePageScaleFactor):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::hasStablePageScaleFactor):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (170952 => 170953)


--- trunk/Source/WebCore/ChangeLog	2014-07-10 04:38:13 UTC (rev 170952)
+++ trunk/Source/WebCore/ChangeLog	2014-07-10 05:06:30 UTC (rev 170953)
@@ -1,3 +1,19 @@
+2014-07-09  Benjamin Poulain  <[email protected]>
+
+        [iOS][WK2] Disable text quantization while actively changing the page's scale factor
+        https://bugs.webkit.org/show_bug.cgi?id=134781
+
+        Reviewed by Tim Horton and Myles C. Maxfield.
+
+        Query the chrome client to setup quantization on each layers.
+
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::hasStablePageScaleFactor):
+        * platform/graphics/mac/FontMac.mm:
+        (WebCore::Font::drawGlyphs):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::setupFontSubpixelQuantization):
+
 2014-07-09  [email protected]  <[email protected]>
 
         [Curl] Cache entry invalidated too early.

Modified: trunk/Source/WebCore/page/ChromeClient.h (170952 => 170953)


--- trunk/Source/WebCore/page/ChromeClient.h	2014-07-10 04:38:13 UTC (rev 170952)
+++ trunk/Source/WebCore/page/ChromeClient.h	2014-07-10 05:06:30 UTC (rev 170953)
@@ -287,6 +287,7 @@
     virtual void elementDidBlur(const Node*) { };
     
     virtual bool shouldPaintEntireContents() const { return false; }
+    virtual bool hasStablePageScaleFactor() const { return true; }
 
     // Allows ports to customize the type of graphics layers created by this page.
     virtual GraphicsLayerFactory* graphicsLayerFactory() const { return nullptr; }

Modified: trunk/Source/WebCore/platform/graphics/mac/FontMac.mm (170952 => 170953)


--- trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-07-10 04:38:13 UTC (rev 170952)
+++ trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-07-10 05:06:30 UTC (rev 170953)
@@ -303,6 +303,7 @@
 
 #if PLATFORM(IOS)
     CGContextSetFontSize(cgContext, 1);
+    CGContextSetShouldSubpixelQuantizeFonts(cgContext, context->shouldSubpixelQuantizeFonts());
 #else
     wkSetCGFontRenderingMode(cgContext, drawFont, context->shouldSubpixelQuantizeFonts());
     if (drawFont)

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (170952 => 170953)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-07-10 04:38:13 UTC (rev 170952)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-07-10 05:06:30 UTC (rev 170953)
@@ -3755,7 +3755,10 @@
     // FIXME: We shouldn't have to disable subpixel quantization for overflow clips or subframes once we scroll those
     // things on the scrolling thread.
     bool contentsScrollByPainting = (renderer().hasOverflowClip() && !usesCompositedScrolling()) || (renderer().frame().ownerElement());
-    if (scrollingOnMainThread || contentsScrollByPainting) {
+    bool isZooming = false;
+    if (Page* page = renderer().frame().page())
+        isZooming = !page->chrome().client().hasStablePageScaleFactor();
+    if (scrollingOnMainThread || contentsScrollByPainting || isZooming) {
         didQuantizeFonts = context->shouldSubpixelQuantizeFonts();
         context->setShouldSubpixelQuantizeFonts(false);
         return true;

Modified: trunk/Source/WebKit2/ChangeLog (170952 => 170953)


--- trunk/Source/WebKit2/ChangeLog	2014-07-10 04:38:13 UTC (rev 170952)
+++ trunk/Source/WebKit2/ChangeLog	2014-07-10 05:06:30 UTC (rev 170953)
@@ -1,3 +1,27 @@
+2014-07-09  Benjamin Poulain  <[email protected]>
+
+        [iOS][WK2] Disable text quantization while actively changing the page's scale factor
+        https://bugs.webkit.org/show_bug.cgi?id=134781
+
+        Reviewed by Tim Horton and Myles C. Maxfield.
+
+        While zooming a page, text quantization causes glyphs to "move" in order to get to the closest
+        boundary for the current scale factor.
+
+        We do not want this to happen while dynamically changing the scale factor because the effect
+        is visible. To avoid this, we disable text quantization if the page's scale factor changes
+        in response to a non-stable contentRect update.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
+        (WebKit::WebChromeClient::hasStablePageScaleFactor):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::hasStablePageScaleFactor):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateVisibleContentRects):
+
 2014-07-09  Joseph Pecoraro  <[email protected]>
 
         [iOS] Use UIAlertController API in WKFileUploadPanel instead of SPI

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (170952 => 170953)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-07-10 04:38:13 UTC (rev 170952)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-07-10 05:06:30 UTC (rev 170953)
@@ -170,6 +170,7 @@
     virtual void didLayout(LayoutType = NormalLayout) override;
     virtual void didStartOverflowScroll() override;
     virtual void didEndOverflowScroll() override;
+    virtual bool hasStablePageScaleFactor() const override;
 
     // FIXME: See <rdar://problem/5975559>
     virtual void suppressFormNotifications() override;

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm (170952 => 170953)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm	2014-07-10 04:38:13 UTC (rev 170952)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm	2014-07-10 05:06:30 UTC (rev 170953)
@@ -100,6 +100,11 @@
     notImplemented();
 }
 
+bool WebChromeClient::hasStablePageScaleFactor() const
+{
+    return m_page->hasStablePageScaleFactor();
+}
+
 void WebChromeClient::suppressFormNotifications()
 {
     notImplemented();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (170952 => 170953)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-07-10 04:38:13 UTC (rev 170952)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-07-10 05:06:30 UTC (rev 170953)
@@ -298,6 +298,7 @@
     , m_hasReceivedVisibleContentRectsAfterDidCommitLoad(false)
     , m_scaleWasSetByUIProcess(false)
     , m_userHasChangedPageScaleFactor(false)
+    , m_hasStablePageScaleFactor(true)
     , m_userIsInteracting(false)
     , m_hasPendingBlurNotification(false)
     , m_useTestingViewportConfiguration(false)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (170952 => 170953)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-07-10 04:38:13 UTC (rev 170952)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-07-10 05:06:30 UTC (rev 170953)
@@ -464,6 +464,7 @@
     double minimumPageScaleFactor() const;
     double maximumPageScaleFactor() const;
     bool allowsUserScaling() const;
+    bool hasStablePageScaleFactor() const { return m_hasStablePageScaleFactor; }
 
     void handleTap(const WebCore::IntPoint&);
     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
@@ -1226,6 +1227,7 @@
     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad;
     bool m_scaleWasSetByUIProcess;
     bool m_userHasChangedPageScaleFactor;
+    bool m_hasStablePageScaleFactor;
     bool m_userIsInteracting;
     bool m_hasPendingBlurNotification;
     bool m_useTestingViewportConfiguration;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (170952 => 170953)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-07-10 04:38:13 UTC (rev 170952)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-07-10 05:06:30 UTC (rev 170953)
@@ -2447,10 +2447,14 @@
 
     IntPoint scrollPosition = roundedIntPoint(visibleContentRectUpdateInfo.unobscuredRect().location());
 
+    if (!m_hasStablePageScaleFactor && visibleContentRectUpdateInfo.inStableState())
+        m_hasStablePageScaleFactor = true;
+
     float floatBoundedScale = boundedScale;
     bool hasSetPageScale = false;
     if (floatBoundedScale != currentScale) {
         m_scaleWasSetByUIProcess = true;
+        m_hasStablePageScaleFactor = visibleContentRectUpdateInfo.inStableState();
 
         m_dynamicSizeUpdateHistory.clear();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to