From 25049642b42a7a28bb4cb9542612c0d7a9cdc1b8 Mon Sep 17 00:00:00 2001 From: "simon.fraser@apple.com" Date: Thu, 3 Apr 2014 22:44:58 +0000 Subject: [PATCH] Source/WebCore: 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]): Source/WebKit2: Pixelated WebView when display is changed from hiDPI to regularDPI https://bugs.webkit.org/show_bug.cgi?id=131185 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 | 32 ++++++++++++++++++++++ Source/WebCore/WebCore.exp.in | 2 +- .../platform/graphics/ca/mac/TileController.h | 5 ++-- .../platform/graphics/ca/mac/TileController.mm | 10 +++---- .../graphics/ca/mac/WebTiledBackingLayer.mm | 7 ++++- Source/WebKit2/ChangeLog | 13 +++++++++ .../mac/PlatformCALayerRemoteTiledBacking.cpp | 2 +- 7 files changed, 60 insertions(+), 11 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 03893d5..c108b97 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,35 @@ +2014-04-03 Simon Fraser + + 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 [CSS Shapes] LineSegment logicalLeft and logicalRight members should be floats diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index d3c1548..19b9478 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -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 diff --git a/Source/WebCore/platform/graphics/ca/mac/TileController.h b/Source/WebCore/platform/graphics/ca/mac/TileController.h index f9d3184..79fc5cd 100644 --- a/Source/WebCore/platform/graphics/ca/mac/TileController.h +++ b/Source/WebCore/platform/graphics/ca/mac/TileController.h @@ -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; diff --git a/Source/WebCore/platform/graphics/ca/mac/TileController.mm b/Source/WebCore/platform/graphics/ca/mac/TileController.mm index e9fb37a..48f9c49 100644 --- a/Source/WebCore/platform/graphics/ca/mac/TileController.mm +++ b/Source/WebCore/platform/graphics/ca/mac/TileController.mm @@ -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(); diff --git a/Source/WebCore/platform/graphics/ca/mac/WebTiledBackingLayer.mm b/Source/WebCore/platform/graphics/ca/mac/WebTiledBackingLayer.mm index 7785282..d8e2b92 100644 --- a/Source/WebCore/platform/graphics/ca/mac/WebTiledBackingLayer.mm +++ b/Source/WebCore/platform/graphics/ca/mac/WebTiledBackingLayer.mm @@ -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 diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index bf0711b..542b671 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,16 @@ +2014-04-03 Simon Fraser + + Pixelated WebView when display is changed from hiDPI to regularDPI + https://bugs.webkit.org/show_bug.cgi?id=131185 + + + Reviewed by Tim Horton. + + TileController function was renamed. + + * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp: + (WebKit::PlatformCALayerRemoteTiledBacking::setContentsScale): + 2014-04-03 Sam Weinig [WebKit2] Promote user script SPI to API diff --git a/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp b/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp index cb007b1..fcba0dc 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp +++ b/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp @@ -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) -- 1.8.3.1