Title: [93058] trunk/Source
Revision
93058
Author
[email protected]
Date
2011-08-15 14:06:53 -0700 (Mon, 15 Aug 2011)

Log Message

Update pages' style and content scale when the window's backing scale factor changes

Unfortunately, I couldn't think of a way to test this in an automated fashion.

Fixes <http://webkit.org/b/66229> <rdar://problem/9906269> WebKit doesn't react to device
scale factor changes

Reviewed by Simon Fraser.

Source/WebCore:

* WebCore.exp.in: Export Frame::deviceOrScaleFactorChanged.

* page/Frame.cpp:
(WebCore::Frame::deviceScaleFactorChanged):
* page/Frame.h:
Added this new function. We recalc style so that, e.g., device-scale-factor-dependent media
queries will be reevaluated, and we tell compositing layers about the new scale factor so
they can rerender at the new resolution.

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView addWindowObserversForWindow:]):
(-[WebView removeWindowObservers]):
Listen for the notification that tells us the window's backing scale has changed.

(-[WebView _windowDidChangeResolution:]): Tell the page about the change to the device scale
factor so that, e.g., scale-factor-dependent media queries will be reevaluated.

Source/WebKit2:

* UIProcess/API/mac/WKView.mm:
(-[WKView addWindowObserversForWindow:]):
(-[WKView removeWindowObservers]):
Listen for the notification that tells us the window's backing scale has changed.

(-[WKView _windowDidChangeResolution:]): Tell the WebPageProxy about the change.

* UIProcess/DrawingAreaProxy.h:
* UIProcess/DrawingAreaProxyImpl.h:
Added deviceScaleFactorDidChange.

* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::deviceScaleFactorDidChange): Request a new backing store
since the current one is using an old device scale factor.
(WebKit::DrawingAreaProxyImpl::sendUpdateBackingStoreState): Send the device scale factor
along to the web process so it can render accordingly. This is how we tell the web process
about device scale factor changes.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::viewStateDidChange): Tell the DrawingAreaProxy when the device scale
factor changes.
(WebKit::WebPageProxy::deviceScaleFactor): Added this simple getter that calls through to
the PageClient. DrawingAreaProxy uses this function.

* UIProcess/WebPageProxy.h: Added new members.

* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::updateBackingStoreState):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/DrawingAreaImpl.h:
Send the device scale factor in the UpdateBackingStoreState message.

* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::updateBackingStoreState): Tell the WebPage and LayerTreeHost about
the new device scale factor.

* WebProcess/WebPage/LayerTreeHost.h:
* WebProcess/WebPage/ca/LayerTreeHostCA.h:
Added deviceScaleFactorDidChange.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setDeviceScaleFactor): Store the new scale factor and tell the page about
it so that, e.g., scale-factor-dependent media queries will be reevaluated.

* WebProcess/WebPage/WebPage.h: Added setDeviceScaleFactor.

* WebProcess/WebPage/ca/LayerTreeHostCA.cpp:
(WebKit::LayerTreeHostCA::deviceScaleFactorDidChange): Tell the layer for non-composited
content about the new scale factor.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93057 => 93058)


--- trunk/Source/WebCore/ChangeLog	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebCore/ChangeLog	2011-08-15 21:06:53 UTC (rev 93058)
@@ -1,3 +1,23 @@
+2011-08-15  Adam Roben  <[email protected]>
+
+        Update pages' style and content scale when the window's backing scale factor changes
+
+        Unfortunately, I couldn't think of a way to test this in an automated fashion.
+
+        Fixes <http://webkit.org/b/66229> <rdar://problem/9906269> WebKit doesn't react to device
+        scale factor changes
+
+        Reviewed by Simon Fraser.
+
+        * WebCore.exp.in: Export Frame::deviceOrScaleFactorChanged.
+
+        * page/Frame.cpp:
+        (WebCore::Frame::deviceScaleFactorChanged):
+        * page/Frame.h:
+        Added this new function. We recalc style so that, e.g., device-scale-factor-dependent media
+        queries will be reevaluated, and we tell compositing layers about the new scale factor so
+        they can rerender at the new resolution.
+
 2011-08-15  Cary Clark  <[email protected]>
 
         Revise Skia on Chrome Mac to return fallback fonts.

Modified: trunk/Source/WebCore/WebCore.exp.in (93057 => 93058)


--- trunk/Source/WebCore/WebCore.exp.in	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-08-15 21:06:53 UTC (rev 93058)
@@ -736,6 +736,7 @@
 __ZN7WebCore5Frame17setPageZoomFactorEf
 __ZN7WebCore5Frame17setTextZoomFactorEf
 __ZN7WebCore5Frame23visiblePositionForPointERKNS_8IntPointE
+__ZN7WebCore5Frame24deviceScaleFactorChangedEv
 __ZN7WebCore5Frame25matchLabelsAgainstElementEP7NSArrayPNS_7ElementE
 __ZN7WebCore5Frame25setPageAndTextZoomFactorsEff
 __ZN7WebCore5Frame27resizePageRectsKeepingRatioERKNS_9FloatSizeES3_

Modified: trunk/Source/WebCore/page/Frame.cpp (93057 => 93058)


--- trunk/Source/WebCore/page/Frame.cpp	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebCore/page/Frame.cpp	2011-08-15 21:06:53 UTC (rev 93058)
@@ -1101,6 +1101,17 @@
     }
 }
 
+void Frame::deviceScaleFactorChanged()
+{
+    if (!m_page)
+        return;
+    m_page->setNeedsRecalcStyleInAllFrames();
+
+#if USE(ACCELERATED_COMPOSITING)
+    deviceOrPageScaleFactorChanged();
+#endif
+}
+
 void Frame::notifyChromeClientWheelEventHandlerCountChanged() const
 {
     // Ensure that this method is being called on the main frame of the page.

Modified: trunk/Source/WebCore/page/Frame.h (93057 => 93058)


--- trunk/Source/WebCore/page/Frame.h	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebCore/page/Frame.h	2011-08-15 21:06:53 UTC (rev 93058)
@@ -164,8 +164,10 @@
         float textZoomFactor() const { return m_textZoomFactor; }
         void setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor);
 
+        // FIXME: These functions should move to Page.
         void scalePage(float scale, const IntPoint& origin);
         float pageScaleFactor() const { return m_pageScaleFactor; }
+        void deviceScaleFactorChanged();
 
 #if ENABLE(ORIENTATION_EVENTS)
         // Orientation is the interface orientation in degrees. Some examples are:

Modified: trunk/Source/WebKit/mac/ChangeLog (93057 => 93058)


--- trunk/Source/WebKit/mac/ChangeLog	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-08-15 21:06:53 UTC (rev 93058)
@@ -1,3 +1,22 @@
+2011-08-15  Adam Roben  <[email protected]>
+
+        Update pages' style and content scale when the window's backing scale factor changes
+
+        Unfortunately, I couldn't think of a way to test this in an automated fashion.
+
+        Fixes <http://webkit.org/b/66229> <rdar://problem/9906269> WebKit doesn't react to device
+        scale factor changes
+
+        Reviewed by Simon Fraser.
+
+        * WebView/WebView.mm:
+        (-[WebView addWindowObserversForWindow:]):
+        (-[WebView removeWindowObservers]):
+        Listen for the notification that tells us the window's backing scale has changed.
+
+        (-[WebView _windowDidChangeResolution:]): Tell the page about the change to the device scale
+        factor so that, e.g., scale-factor-dependent media queries will be reevaluated.
+
 2011-08-10  Adam Roben  <[email protected]>
 
         Clear up scale factor terminology

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (93057 => 93058)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2011-08-15 21:06:53 UTC (rev 93058)
@@ -3283,6 +3283,9 @@
     return _private->shouldCloseWithWindow;
 }
 
+// FIXME: Use an AppKit constant for this once one is available.
+static NSString * const windowDidChangeResolutionNotification = @"NSWindowDidChangeResolutionNotification";
+
 - (void)addWindowObserversForWindow:(NSWindow *)window
 {
     if (window) {
@@ -3292,6 +3295,8 @@
             name:NSWindowDidResignKeyNotification object:nil];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillOrderOnScreen:)
             name:WKWindowWillOrderOnScreenNotification() object:window];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeResolution:)
+            name:windowDidChangeResolutionNotification object:window];
     }
 }
 
@@ -3305,6 +3310,8 @@
             name:NSWindowDidResignKeyNotification object:nil];
         [[NSNotificationCenter defaultCenter] removeObserver:self
             name:WKWindowWillOrderOnScreenNotification() object:window];
+        [[NSNotificationCenter defaultCenter] removeObserver:self
+            name:windowDidChangeResolutionNotification object:window];
     }
 }
 
@@ -3381,6 +3388,11 @@
         [self close];
 }
 
+- (void)_windowDidChangeResolution:(NSNotification *)notification
+{
+    _private->page->mainFrame()->deviceScaleFactorChanged();
+}
+
 - (void)setPreferences:(WebPreferences *)prefs
 {
     if (!prefs)

Modified: trunk/Source/WebKit2/ChangeLog (93057 => 93058)


--- trunk/Source/WebKit2/ChangeLog	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/ChangeLog	2011-08-15 21:06:53 UTC (rev 93058)
@@ -1,3 +1,64 @@
+2011-08-15  Adam Roben  <[email protected]>
+
+        Update pages' style and content scale when the window's backing scale factor changes
+
+        Unfortunately, I couldn't think of a way to test this in an automated fashion.
+
+        Fixes <http://webkit.org/b/66229> <rdar://problem/9906269> WebKit doesn't react to device
+        scale factor changes
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView addWindowObserversForWindow:]):
+        (-[WKView removeWindowObservers]):
+        Listen for the notification that tells us the window's backing scale has changed.
+
+        (-[WKView _windowDidChangeResolution:]): Tell the WebPageProxy about the change.
+
+        * UIProcess/DrawingAreaProxy.h:
+        * UIProcess/DrawingAreaProxyImpl.h:
+        Added deviceScaleFactorDidChange.
+
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        (WebKit::DrawingAreaProxyImpl::deviceScaleFactorDidChange): Request a new backing store
+        since the current one is using an old device scale factor.
+        (WebKit::DrawingAreaProxyImpl::sendUpdateBackingStoreState): Send the device scale factor
+        along to the web process so it can render accordingly. This is how we tell the web process
+        about device scale factor changes.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::viewStateDidChange): Tell the DrawingAreaProxy when the device scale
+        factor changes.
+        (WebKit::WebPageProxy::deviceScaleFactor): Added this simple getter that calls through to
+        the PageClient. DrawingAreaProxy uses this function.
+
+        * UIProcess/WebPageProxy.h: Added new members.
+
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::updateBackingStoreState):
+        * WebProcess/WebPage/DrawingArea.messages.in:
+        * WebProcess/WebPage/DrawingAreaImpl.h:
+        Send the device scale factor in the UpdateBackingStoreState message.
+
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::updateBackingStoreState): Tell the WebPage and LayerTreeHost about
+        the new device scale factor.
+
+        * WebProcess/WebPage/LayerTreeHost.h:
+        * WebProcess/WebPage/ca/LayerTreeHostCA.h:
+        Added deviceScaleFactorDidChange.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setDeviceScaleFactor): Store the new scale factor and tell the page about
+        it so that, e.g., scale-factor-dependent media queries will be reevaluated.
+
+        * WebProcess/WebPage/WebPage.h: Added setDeviceScaleFactor.
+
+        * WebProcess/WebPage/ca/LayerTreeHostCA.cpp:
+        (WebKit::LayerTreeHostCA::deviceScaleFactorDidChange): Tell the layer for non-composited
+        content about the new scale factor.
+
 2011-08-15  Benjamin Poulain  <[email protected]>
 
         [Qt][WK2] Get rid of QTouchWebPagePrivate::getPageViewPrivate()

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (93057 => 93058)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-08-15 21:06:53 UTC (rev 93058)
@@ -1700,6 +1700,9 @@
     return ownsGrowBox;
 }
 
+// FIXME: Use an AppKit constant for this once one is available.
+static NSString * const windowDidChangeResolutionNotification = @"NSWindowDidChangeResolutionNotification";
+
 - (void)addWindowObserversForWindow:(NSWindow *)window
 {
     if (window) {
@@ -1719,6 +1722,9 @@
                                                      name:@"NSWindowDidOrderOffScreenNotification" object:window];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOnScreen:) 
                                                      name:@"_NSWindowDidBecomeVisible" object:window];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeResolution:)
+                                                     name:windowDidChangeResolutionNotification object:window];
+
     }
 }
 
@@ -1736,6 +1742,8 @@
     [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:window];
     [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window];
     [[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window];
+    [[NSNotificationCenter defaultCenter] removeObserver:self name:windowDidChangeResolutionNotification object:window];
+
 }
 
 - (void)viewWillMoveToWindow:(NSWindow *)window
@@ -1828,6 +1836,11 @@
     _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
 }
 
+- (void)_windowDidChangeResolution:(NSNotification *)notification
+{
+    _data->_page->viewStateDidChange(WebPageProxy::DeviceScaleFactor);
+}
+
 static void drawPageBackground(CGContextRef context, WebPageProxy* page, const IntRect& rect)
 {
     if (!page->drawsBackground())

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h (93057 => 93058)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2011-08-15 21:06:53 UTC (rev 93058)
@@ -78,6 +78,7 @@
     virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext) = 0;
 
     virtual void sizeDidChange() = 0;
+    virtual void deviceScaleFactorDidChange() = 0;
 
     // FIXME: These should be pure virtual.
     virtual void visibilityDidChange() { }

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp (93057 => 93058)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2011-08-15 21:06:53 UTC (rev 93058)
@@ -117,6 +117,11 @@
     backingStoreStateDidChange(RespondImmediately);
 }
 
+void DrawingAreaProxyImpl::deviceScaleFactorDidChange()
+{
+    backingStoreStateDidChange(RespondImmediately);
+}
+
 void DrawingAreaProxyImpl::visibilityDidChange()
 {
     if (!m_webPageProxy->isViewVisible()) {
@@ -282,7 +287,7 @@
 
     m_isWaitingForDidUpdateBackingStoreState = respondImmediatelyOrNot == RespondImmediately;
 
-    m_webPageProxy->process()->send(Messages::DrawingArea::UpdateBackingStoreState(m_nextBackingStoreStateID, respondImmediatelyOrNot == RespondImmediately, m_size, m_scrollOffset), m_webPageProxy->pageID());
+    m_webPageProxy->process()->send(Messages::DrawingArea::UpdateBackingStoreState(m_nextBackingStoreStateID, respondImmediatelyOrNot == RespondImmediately, m_webPageProxy->deviceScaleFactor(), m_size, m_scrollOffset), m_webPageProxy->pageID());
     m_scrollOffset = IntSize();
 
     if (m_isWaitingForDidUpdateBackingStoreState) {

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h (93057 => 93058)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2011-08-15 21:06:53 UTC (rev 93058)
@@ -52,6 +52,7 @@
     // DrawingAreaProxy
     virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext);
     virtual void sizeDidChange();
+    virtual void deviceScaleFactorDidChange();
     virtual void visibilityDidChange();
     virtual void setPageIsVisible(bool);
     virtual void setBackingStoreIsDiscardable(bool);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (93057 => 93058)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-08-15 21:06:53 UTC (rev 93058)
@@ -682,6 +682,9 @@
         }
     }
 
+    if (flags & DeviceScaleFactor)
+        m_drawingArea->deviceScaleFactorDidChange();
+
     updateBackingStoreDiscardableState();
 }
 
@@ -1214,6 +1217,11 @@
     process()->send(Messages::WebPage::ScalePage(scale, origin), m_pageID);
 }
 
+float WebPageProxy::deviceScaleFactor() const
+{
+    return m_pageClient->deviceScaleFactor();
+}
+
 void WebPageProxy::setUseFixedLayout(bool fixed)
 {
     if (!isValid())

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (93057 => 93058)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2011-08-15 21:06:53 UTC (rev 93058)
@@ -273,7 +273,8 @@
         ViewWindowIsActive = 1 << 0,
         ViewIsFocused = 1 << 1,
         ViewIsVisible = 1 << 2,
-        ViewIsInWindow = 1 << 3
+        ViewIsInWindow = 1 << 3,
+        DeviceScaleFactor = 1 << 4,
     };
     typedef unsigned ViewStateFlags;
     void viewStateDidChange(ViewStateFlags flags);
@@ -386,6 +387,8 @@
     void scalePage(double scale, const WebCore::IntPoint& origin);
     double pageScaleFactor() const { return m_pageScaleFactor; }
 
+    float deviceScaleFactor() const;
+
     void setUseFixedLayout(bool);
     void setFixedLayoutSize(const WebCore::IntSize&);
     bool useFixedLayout() const { return m_useFixedLayout; };

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (93057 => 93058)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2011-08-15 21:06:53 UTC (rev 93058)
@@ -92,7 +92,7 @@
 private:
     // CoreIPC message handlers.
     // FIXME: These should be pure virtual.
-    virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { }
+    virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { }
     virtual void didUpdate() { }
     virtual void suspendPainting() { }
     virtual void resumePainting() { }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in (93057 => 93058)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2011-08-15 21:06:53 UTC (rev 93058)
@@ -21,7 +21,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 messages -> DrawingArea {
-    UpdateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, WebCore::IntSize size, WebCore::IntSize scrollOffset)
+    UpdateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, WebCore::IntSize size, WebCore::IntSize scrollOffset)
     DidUpdate()
     SuspendPainting()
     ResumePainting()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (93057 => 93058)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2011-08-15 21:06:53 UTC (rev 93058)
@@ -301,7 +301,7 @@
 {
 }
 
-void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, bool respondImmediately, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset)
+void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset)
 {
     ASSERT(!m_inUpdateBackingStoreState);
     m_inUpdateBackingStoreState = true;
@@ -311,13 +311,15 @@
         m_backingStoreStateID = stateID;
         m_shouldSendDidUpdateBackingStoreState = true;
 
+        m_webPage->setDeviceScaleFactor(deviceScaleFactor);
         m_webPage->setSize(size);
         m_webPage->layoutIfNeeded();
         m_webPage->scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
 
-        if (m_layerTreeHost)
+        if (m_layerTreeHost) {
+            m_layerTreeHost->deviceScaleFactorDidChange();
             m_layerTreeHost->sizeDidChange(size);
-        else
+        } else
             m_dirtyRegion = m_webPage->bounds();
     } else {
         ASSERT(size == m_webPage->size());

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h (93057 => 93058)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h	2011-08-15 21:06:53 UTC (rev 93058)
@@ -72,7 +72,7 @@
 #endif
 
     // CoreIPC message handlers.
-    virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
+    virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
     virtual void didUpdate();
     virtual void suspendPainting();
     virtual void resumePainting();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h (93057 => 93058)


--- trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h	2011-08-15 21:06:53 UTC (rev 93058)
@@ -63,6 +63,7 @@
     virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
     virtual void forceRepaint() = 0;
     virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
+    virtual void deviceScaleFactorDidChange() = 0;
 
     virtual void didInstallPageOverlay() = 0;
     virtual void didUninstallPageOverlay() = 0;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (93057 => 93058)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-08-15 21:06:53 UTC (rev 93058)
@@ -787,6 +787,15 @@
     return frame->pageScaleFactor();
 }
 
+void WebPage::setDeviceScaleFactor(float scaleFactor)
+{
+    if (m_deviceScaleFactor == scaleFactor)
+        return;
+
+    m_deviceScaleFactor = scaleFactor;
+    m_page->mainFrame()->deviceScaleFactorChanged();
+}
+
 void WebPage::setUseFixedLayout(bool fixed)
 {
     Frame* frame = m_mainFrame->coreFrame();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (93057 => 93058)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2011-08-15 21:06:53 UTC (rev 93058)
@@ -409,6 +409,7 @@
 
     void runModal();
 
+    void setDeviceScaleFactor(float);
     float deviceScaleFactor() const { return m_deviceScaleFactor; }
 
     void setMemoryCacheMessagesEnabled(bool);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp (93057 => 93058)


--- trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp	2011-08-15 21:06:53 UTC (rev 93058)
@@ -150,6 +150,12 @@
     flushPendingLayerChanges();
 }
 
+void LayerTreeHostCA::deviceScaleFactorDidChange()
+{
+    // Other layers learn of the scale factor change via WebPage::setDeviceScaleFactor.
+    m_nonCompositedContentLayer->deviceOrPageScaleFactorChanged();
+}
+
 void LayerTreeHostCA::forceRepaint()
 {
     scheduleLayerFlush();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h (93057 => 93058)


--- trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h	2011-08-15 19:59:54 UTC (rev 93057)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h	2011-08-15 21:06:53 UTC (rev 93058)
@@ -48,6 +48,7 @@
     // LayerTreeHost.
     virtual void invalidate();
     virtual void sizeDidChange(const WebCore::IntSize& newSize);
+    virtual void deviceScaleFactorDidChange();
     virtual void forceRepaint();
     virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to