Changeset 170953 in webkit


Ignore:
Timestamp:
Jul 9, 2014, 10:06:30 PM (11 years ago)
Author:
benjamin@webkit.org
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 <bpoulain@apple.com> 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):

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r170949 r170953  
     12014-07-09  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [iOS][WK2] Disable text quantization while actively changing the page's scale factor
     4        https://bugs.webkit.org/show_bug.cgi?id=134781
     5
     6        Reviewed by Tim Horton and Myles C. Maxfield.
     7
     8        Query the chrome client to setup quantization on each layers.
     9
     10        * page/ChromeClient.h:
     11        (WebCore::ChromeClient::hasStablePageScaleFactor):
     12        * platform/graphics/mac/FontMac.mm:
     13        (WebCore::Font::drawGlyphs):
     14        * rendering/RenderLayer.cpp:
     15        (WebCore::RenderLayer::setupFontSubpixelQuantization):
     16
    1172014-07-09  peavo@outlook.com  <peavo@outlook.com>
    218
  • trunk/Source/WebCore/page/ChromeClient.h

    r170557 r170953  
    288288   
    289289    virtual bool shouldPaintEntireContents() const { return false; }
     290    virtual bool hasStablePageScaleFactor() const { return true; }
    290291
    291292    // Allows ports to customize the type of graphics layers created by this page.
  • trunk/Source/WebCore/platform/graphics/mac/FontMac.mm

    r170947 r170953  
    304304#if PLATFORM(IOS)
    305305    CGContextSetFontSize(cgContext, 1);
     306    CGContextSetShouldSubpixelQuantizeFonts(cgContext, context->shouldSubpixelQuantizeFonts());
    306307#else
    307308    wkSetCGFontRenderingMode(cgContext, drawFont, context->shouldSubpixelQuantizeFonts());
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r170944 r170953  
    37563756    // things on the scrolling thread.
    37573757    bool contentsScrollByPainting = (renderer().hasOverflowClip() && !usesCompositedScrolling()) || (renderer().frame().ownerElement());
    3758     if (scrollingOnMainThread || contentsScrollByPainting) {
     3758    bool isZooming = false;
     3759    if (Page* page = renderer().frame().page())
     3760        isZooming = !page->chrome().client().hasStablePageScaleFactor();
     3761    if (scrollingOnMainThread || contentsScrollByPainting || isZooming) {
    37593762        didQuantizeFonts = context->shouldSubpixelQuantizeFonts();
    37603763        context->setShouldSubpixelQuantizeFonts(false);
  • trunk/Source/WebKit2/ChangeLog

    r170952 r170953  
     12014-07-09  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [iOS][WK2] Disable text quantization while actively changing the page's scale factor
     4        https://bugs.webkit.org/show_bug.cgi?id=134781
     5
     6        Reviewed by Tim Horton and Myles C. Maxfield.
     7
     8        While zooming a page, text quantization causes glyphs to "move" in order to get to the closest
     9        boundary for the current scale factor.
     10
     11        We do not want this to happen while dynamically changing the scale factor because the effect
     12        is visible. To avoid this, we disable text quantization if the page's scale factor changes
     13        in response to a non-stable contentRect update.
     14
     15        * WebProcess/WebCoreSupport/WebChromeClient.h:
     16        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
     17        (WebKit::WebChromeClient::hasStablePageScaleFactor):
     18        * WebProcess/WebPage/WebPage.cpp:
     19        (WebKit::WebPage::WebPage):
     20        * WebProcess/WebPage/WebPage.h:
     21        (WebKit::WebPage::hasStablePageScaleFactor):
     22        * WebProcess/WebPage/ios/WebPageIOS.mm:
     23        (WebKit::WebPage::updateVisibleContentRects):
     24
    1252014-07-09  Joseph Pecoraro  <pecoraro@apple.com>
    226
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r170557 r170953  
    171171    virtual void didStartOverflowScroll() override;
    172172    virtual void didEndOverflowScroll() override;
     173    virtual bool hasStablePageScaleFactor() const override;
    173174
    174175    // FIXME: See <rdar://problem/5975559>
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm

    r170557 r170953  
    101101}
    102102
     103bool WebChromeClient::hasStablePageScaleFactor() const
     104{
     105    return m_page->hasStablePageScaleFactor();
     106}
     107
    103108void WebChromeClient::suppressFormNotifications()
    104109{
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r170902 r170953  
    299299    , m_scaleWasSetByUIProcess(false)
    300300    , m_userHasChangedPageScaleFactor(false)
     301    , m_hasStablePageScaleFactor(true)
    301302    , m_userIsInteracting(false)
    302303    , m_hasPendingBlurNotification(false)
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r170782 r170953  
    465465    double maximumPageScaleFactor() const;
    466466    bool allowsUserScaling() const;
     467    bool hasStablePageScaleFactor() const { return m_hasStablePageScaleFactor; }
    467468
    468469    void handleTap(const WebCore::IntPoint&);
     
    12271228    bool m_scaleWasSetByUIProcess;
    12281229    bool m_userHasChangedPageScaleFactor;
     1230    bool m_hasStablePageScaleFactor;
    12291231    bool m_userIsInteracting;
    12301232    bool m_hasPendingBlurNotification;
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r170774 r170953  
    24482448    IntPoint scrollPosition = roundedIntPoint(visibleContentRectUpdateInfo.unobscuredRect().location());
    24492449
     2450    if (!m_hasStablePageScaleFactor && visibleContentRectUpdateInfo.inStableState())
     2451        m_hasStablePageScaleFactor = true;
     2452
    24502453    float floatBoundedScale = boundedScale;
    24512454    bool hasSetPageScale = false;
    24522455    if (floatBoundedScale != currentScale) {
    24532456        m_scaleWasSetByUIProcess = true;
     2457        m_hasStablePageScaleFactor = visibleContentRectUpdateInfo.inStableState();
    24542458
    24552459        m_dynamicSizeUpdateHistory.clear();
Note: See TracChangeset for help on using the changeset viewer.