[chromium] Support high DPI scroll bar on top level web frame.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2012 17:58:04 +0000 (17:58 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2012 17:58:04 +0000 (17:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95134

Patch by Robert Flack <flackr@chromium.org> on 2012-09-19
Reviewed by Adrienne Walker.

Calls setAppliesPageScale(true) on root scrollbar layers as these are not scaled.

* src/NonCompositedContentHost.cpp:
(WebKit::setScrollbarBoundsContainPageScale):
(WebKit):
(WebKit::NonCompositedContentHost::setViewport):

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

Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/NonCompositedContentHost.cpp

index 3395468..14c5fe6 100644 (file)
@@ -1,3 +1,17 @@
+2012-09-19  Robert Flack  <flackr@chromium.org>
+
+        [chromium] Support high DPI scroll bar on top level web frame.
+        https://bugs.webkit.org/show_bug.cgi?id=95134
+
+        Reviewed by Adrienne Walker.
+
+        Calls setAppliesPageScale(true) on root scrollbar layers as these are not scaled.
+
+        * src/NonCompositedContentHost.cpp:
+        (WebKit::setScrollbarBoundsContainPageScale):
+        (WebKit):
+        (WebKit::NonCompositedContentHost::setViewport):
+
 2012-09-19  Mark Pilgrim  <pilgrim@chromium.org>
 
         [Chromium] Move notifyJSOutOfMemory out of PlatformSupport
index ae99ba8..9729d05 100644 (file)
@@ -88,6 +88,20 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer)
     ASSERT(haveScrollLayer());
 }
 
+static void setScrollbarBoundsContainPageScale(WebCore::GraphicsLayer* layer, WebCore::GraphicsLayer* clipLayer)
+{
+    // Scrollbars are attached outside the root clip rect, so skip the
+    // clipLayer subtree.
+    if (layer == clipLayer)
+        return;
+
+    for (size_t i = 0; i < layer->children().size(); ++i)
+        setScrollbarBoundsContainPageScale(layer->children()[i], clipLayer);
+
+    if (layer->children().isEmpty())
+        layer->setAppliesPageScale(true);
+}
+
 void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin)
 {
     if (!haveScrollLayer())
@@ -119,6 +133,12 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize,
         m_graphicsLayer->setNeedsDisplay();
     } else if (visibleRectChanged)
         m_graphicsLayer->setNeedsDisplay();
+
+    WebCore::GraphicsLayer* clipLayer = m_graphicsLayer->parent()->parent();
+    WebCore::GraphicsLayer* rootLayer = clipLayer;
+    while (rootLayer->parent())
+        rootLayer = rootLayer->parent();
+    setScrollbarBoundsContainPageScale(rootLayer, clipLayer);
 }
 
 bool NonCompositedContentHost::haveScrollLayer()