Source/WebCore: Pixelated WebView when display is changed from hiDPI to regularDPI
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Apr 2014 22:44:58 +0000 (22:44 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Apr 2014 22:44:58 +0000 (22:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131185

Reviewed by Tim Horton.

r166309 added a short circuit in GraphicsLayerCA::updateContentsScale()
when the scale didn't change. This broke layers which expected to
unconditionally receive a setContentsScale(), namely the WebTiledBackingLayer
which owns the TileController. WebTiledBackingLayer overrode -setContentsScale:
to pass the scale down to the TileController; however, it didn't override
-contentsScale, and it mucked with the scale passed in.

Fix by having setting and fetching contentsScale on a WebTiledBackingLayer
work as expected. Also rename the TileController functions to mirror the
CALayer functions better.

* WebCore.exp.in:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateContentsScale):
* platform/graphics/ca/mac/TileController.h:
* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::TileController):
(WebCore::TileController::contentsScale):
(WebCore::TileController::setContentsScale):
(WebCore::TileController::scale): Deleted.
(WebCore::TileController::setScale): Deleted.
* platform/graphics/ca/mac/WebTiledBackingLayer.mm:
(-[WebTiledBackingLayer setContentsScale:]):
(-[WebTiledBackingLayer contentsScale]):

Source/WebKit2: Pixelated WebView when display is changed from hiDPI to regularDPI
https://bugs.webkit.org/show_bug.cgi?id=131185
<rdar://problem/16512184&16503714>

Reviewed by Tim Horton.

TileController function was renamed.

* WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
(WebKit::PlatformCALayerRemoteTiledBacking::setContentsScale):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166748 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/graphics/ca/mac/TileController.h
Source/WebCore/platform/graphics/ca/mac/TileController.mm
Source/WebCore/platform/graphics/ca/mac/WebTiledBackingLayer.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp

index 03893d5..c108b97 100644 (file)
@@ -1,3 +1,35 @@
+2014-04-03  Simon Fraser  <simon.fraser@apple.com>
+
+        Pixelated WebView when display is changed from hiDPI to regularDPI
+        https://bugs.webkit.org/show_bug.cgi?id=131185
+
+        Reviewed by Tim Horton.
+
+        r166309 added a short circuit in GraphicsLayerCA::updateContentsScale()
+        when the scale didn't change. This broke layers which expected to
+        unconditionally receive a setContentsScale(), namely the WebTiledBackingLayer
+        which owns the TileController. WebTiledBackingLayer overrode -setContentsScale:
+        to pass the scale down to the TileController; however, it didn't override
+        -contentsScale, and it mucked with the scale passed in.
+        
+        Fix by having setting and fetching contentsScale on a WebTiledBackingLayer
+        work as expected. Also rename the TileController functions to mirror the
+        CALayer functions better.
+
+        * WebCore.exp.in:
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::updateContentsScale):
+        * platform/graphics/ca/mac/TileController.h:
+        * platform/graphics/ca/mac/TileController.mm:
+        (WebCore::TileController::TileController):
+        (WebCore::TileController::contentsScale):
+        (WebCore::TileController::setContentsScale):
+        (WebCore::TileController::scale): Deleted.
+        (WebCore::TileController::setScale): Deleted.
+        * platform/graphics/ca/mac/WebTiledBackingLayer.mm:
+        (-[WebTiledBackingLayer setContentsScale:]):
+        (-[WebTiledBackingLayer contentsScale]):
+
 2014-04-03  Zoltan Horvath  <zoltan@webkit.org>
 
         [CSS Shapes] LineSegment logicalLeft and logicalRight members should be floats
index d3c1548..19b9478 100644 (file)
@@ -432,13 +432,13 @@ __ZN7WebCore14SubframeLoader12allowPluginsENS_28ReasonForCallingAllowPluginsE
 __ZN7WebCore14TileController14setTilesOpaqueEb
 __ZN7WebCore14TileController15containerLayersEv
 __ZN7WebCore14TileController15setNeedsDisplayEv
+__ZN7WebCore14TileController16setContentsScaleEf
 __ZN7WebCore14TileController21setAcceleratesDrawingEb
 __ZN7WebCore14TileController21setNeedsDisplayInRectERKNS_7IntRectE
 __ZN7WebCore14TileController23setTileDebugBorderColorENS_5ColorE
 __ZN7WebCore14TileController23setTileDebugBorderWidthEf
 __ZN7WebCore14TileController27tileCacheLayerBoundsChangedEv
 __ZN7WebCore14TileController6createEPNS_15PlatformCALayerE
-__ZN7WebCore14TileController8setScaleEf
 __ZN7WebCore14decodeHostNameEP8NSString
 __ZN7WebCore14encodeHostNameEP8NSString
 __ZN7WebCore14endOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
index f9d3184..79fc5cd 100644 (file)
@@ -59,8 +59,8 @@ public:
     void setNeedsDisplay();
     void setNeedsDisplayInRect(const IntRect&);
 
-    void setScale(float);
-    float scale() const;
+    void setContentsScale(float);
+    float contentsScale() const { return m_contentsScale; }
 
     bool acceleratesDrawing() const { return m_acceleratesDrawing; }
     void setAcceleratesDrawing(bool);
@@ -191,6 +191,7 @@ private:
 
     RepaintCountMap m_tileRepaintCounts;
 
+    float m_contentsScale;
     float m_deviceScaleFactor;
 
     TileCoverage m_tileCoverage;
index e9fb37a..48f9c49 100644 (file)
@@ -60,6 +60,7 @@ TileController::TileController(PlatformCALayer* rootPlatformLayer)
     , m_tileSize(defaultTileWidth, defaultTileHeight)
     , m_exposedRect(FloatRect::infiniteRect())
     , m_tileRevalidationTimer(this, &TileController::tileRevalidationTimerFired)
+    , m_contentsScale(1)
     , m_deviceScaleFactor(1)
     , m_tileCoverage(CoverageForVisibleArea)
     , m_marginTop(0)
@@ -156,13 +157,10 @@ bool TileController::platformCALayerShowRepaintCounter(PlatformCALayer*) const
     return owningGraphicsLayer()->platformCALayerShowRepaintCounter(0);
 }
 
-float TileController::scale() const
-{
-    return tileGrid().scale();
-}
-
-void TileController::setScale(float scale)
+void TileController::setContentsScale(float scale)
 {
+    m_contentsScale = scale;
+    
     ASSERT(owningGraphicsLayer()->isCommittingChanges());
 
     float deviceScaleFactor = platformCALayerDeviceScaleFactor();
index 7785282..d8e2b92 100644 (file)
@@ -115,7 +115,12 @@ using namespace WebCore;
 
 - (void)setContentsScale:(CGFloat)contentsScale
 {
-    _tileController->setScale(contentsScale);
+    _tileController->setContentsScale(contentsScale);
+}
+
+- (CGFloat)contentsScale
+{
+    return _tileController->contentsScale();
 }
 
 - (WebCore::TiledBacking*)tiledBacking
index bf0711b..542b671 100644 (file)
@@ -1,3 +1,16 @@
+2014-04-03  Simon Fraser  <simon.fraser@apple.com>
+
+        Pixelated WebView when display is changed from hiDPI to regularDPI
+        https://bugs.webkit.org/show_bug.cgi?id=131185
+        <rdar://problem/16512184&16503714>
+
+        Reviewed by Tim Horton.
+        
+        TileController function was renamed.
+
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
+        (WebKit::PlatformCALayerRemoteTiledBacking::setContentsScale):
+
 2014-04-03  Sam Weinig  <sam@webkit.org>
 
         [WebKit2] Promote user script SPI to API
index cb007b1..fcba0dc 100644 (file)
@@ -88,7 +88,7 @@ void PlatformCALayerRemoteTiledBacking::setAcceleratesDrawing(bool acceleratesDr
 
 void PlatformCALayerRemoteTiledBacking::setContentsScale(float scale)
 {
-    m_tileController->setScale(scale);
+    m_tileController->setContentsScale(scale);
 }
 
 void PlatformCALayerRemoteTiledBacking::setBorderWidth(float borderWidth)