Made root compositing layer scroll rather than scroll parent.
authorcmarrin@apple.com <cmarrin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jan 2010 18:48:34 +0000 (18:48 +0000)
committercmarrin@apple.com <cmarrin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jan 2010 18:48:34 +0000 (18:48 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=32279

        There's some general cleanup here so the frames, bounds and
        positions of all the associated layers are correct.
        I also changed API of setScrollFrame to use an IntRect.

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

WebCore/ChangeLog
WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
WebCore/platform/graphics/win/WKCACFLayerRenderer.h
WebKit/win/ChangeLog
WebKit/win/WebView.cpp

index 605ed1f..3278424 100644 (file)
@@ -1,3 +1,22 @@
+2010-01-18  Chris Marrin  <cmarrin@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Made root compositing layer scroll rather than scroll parent.
+        https://bugs.webkit.org/show_bug.cgi?id=32279
+        
+        There's some general cleanup here so the frames, bounds and
+        positions of all the associated layers are correct.
+        I also changed API of setScrollFrame to use an IntRect.
+
+        * platform/graphics/win/WKCACFLayerRenderer.cpp:
+        (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer):
+        (WebCore::WKCACFLayerRenderer::setScrollFrame):
+        (WebCore::WKCACFLayerRenderer::setRootChildLayer):
+        (WebCore::WKCACFLayerRenderer::createRenderer):
+        (WebCore::WKCACFLayerRenderer::resize):
+        * platform/graphics/win/WKCACFLayerRenderer.h:
+
 2010-01-18  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Reviewed by Pavel Feldman.
index 6f45ebd..68f9c9e 100644 (file)
@@ -136,8 +136,7 @@ WKCACFLayerRenderer::WKCACFLayerRenderer()
     , m_renderer(0)
     , m_hostWindow(0)
     , m_renderTimer(this, &WKCACFLayerRenderer::renderTimerFired)
-    , m_scrollFrameWidth(1) // Default to 1 to avoid 0 size frames
-    , m_scrollFrameHeight(1) // Default to 1 to avoid 0 size frames
+    , m_scrollFrame(0, 0, 1, 1) // Default to 1 to avoid 0 size frames
 {
 }
 
@@ -146,19 +145,15 @@ WKCACFLayerRenderer::~WKCACFLayerRenderer()
     destroyRenderer();
 }
 
-void WKCACFLayerRenderer::setScrollFrame(int width, int height, int scrollX, int scrollY)
+void WKCACFLayerRenderer::setScrollFrame(const IntRect& scrollFrame)
 {
-    m_scrollFrameWidth = width;
-    m_scrollFrameHeight = height;
+    m_scrollFrame = scrollFrame;
 
-    CGRect contentsRect = CGRectMake(scrollX, scrollY, width, height);
-    m_scrollLayer->setFrame(contentsRect);
+    m_scrollLayer->setBounds(CGRectMake(0, 0, m_scrollFrame.width(), m_scrollFrame.height()));
+    m_scrollLayer->setPosition(CGPointMake(0, m_scrollFrame.height()));
 
-    if (m_rootChildLayer) {
-        contentsRect.origin.x = 0;
-        contentsRect.origin.y = 0;
-        m_rootChildLayer->setFrame(contentsRect);
-    }
+    if (m_rootChildLayer)
+        m_rootChildLayer->setPosition(CGPointMake(m_scrollFrame.x(), m_scrollFrame.height() + m_scrollFrame.y()));
 }
 
 void WKCACFLayerRenderer::setRootContents(CGImageRef image)
@@ -178,7 +173,8 @@ void WKCACFLayerRenderer::setRootChildLayer(WebCore::PlatformLayer* layer)
         m_scrollLayer->addSublayer(layer);
 
         // Set the frame
-        layer->setFrame(CGRectMake(0, 0, m_scrollFrameWidth, m_scrollFrameHeight));
+        layer->setAnchorPoint(CGPointMake(0, 1));
+        setScrollFrame(m_scrollFrame);
     }
 
     m_rootChildLayer = layer;
@@ -234,6 +230,7 @@ void WKCACFLayerRenderer::createRenderer()
 
     m_rootLayer->addSublayer(m_scrollLayer);
     m_scrollLayer->setMasksToBounds(true);
+    m_scrollLayer->setAnchorPoint(CGPointMake(0, 1));
 
 #ifndef NDEBUG
     CGColorRef debugColor = createCGColor(Color(255, 0, 0, 204));
@@ -285,6 +282,7 @@ void WKCACFLayerRenderer::resize()
     if (m_rootLayer) {
         m_rootLayer->setFrame(bounds());
         WKCACFContextFlusher::shared().flushAllContexts();
+        setScrollFrame(m_scrollFrame);
     }
 }
 
index 12cde48..cb9f04f 100644 (file)
@@ -58,7 +58,7 @@ public:
     static bool acceleratedCompositingAvailable();
     static void didFlushContext(CACFContextRef);
 
-    void setScrollFrame(int width, int height, int scrollX, int scrollY);
+    void setScrollFrame(const IntRect&);
     void setRootContents(CGImageRef);
     void setRootChildLayer(WebCore::PlatformLayer* layer);
     void setNeedsDisplay();
@@ -96,7 +96,7 @@ private:
     CARenderOGLContext* m_renderer;
     HWND m_hostWindow;
     Timer<WKCACFLayerRenderer> m_renderTimer;
-    int m_scrollFrameWidth, m_scrollFrameHeight;
+    IntRect m_scrollFrame;
 };
 
 }
index 7dbf3d2..05c9132 100644 (file)
@@ -1,3 +1,13 @@
+2010-01-18  Chris Marrin  <cmarrin@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Use new setScrollFrame API
+        https://bugs.webkit.org/show_bug.cgi?id=32279
+
+        * WebView.cpp:
+        (WebView::updateRootLayerContents):
+
 2010-01-15  Jon Honeycutt  <jhoneycutt@apple.com>
 
         MSAA: Screen rect for <option> elements is always the zero rect
index 0cb0cd7..4095b88 100644 (file)
@@ -5989,8 +5989,7 @@ void WebView::updateRootLayerContents()
         return;
     FrameView* frameView = coreFrame->view();
 
-    m_layerRenderer->setScrollFrame(frameView->layoutWidth(), frameView->layoutHeight(), 
-                                 frameView->scrollX(), frameView->scrollY());
+    m_layerRenderer->setScrollFrame(IntRect(frameView->scrollX(), frameView->scrollY(), frameView->layoutWidth(), frameView->layoutHeight()));
 }
 #endif