[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

enrica at apple.com enrica at apple.com
Thu Apr 8 02:21:28 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 401b2ab7f9c9eb01ddd3cfaa0b2797d0d84a2805
Author: enrica at apple.com <enrica at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Mar 12 23:11:42 2010 +0000

    Content of 3D tests appears at the bottom right corner sometimes.
    <rdar://problem/7556244>
    <https://bugs.webkit.org/show_bug.cgi?id=36027>
    
    Reviewed by Simon Fraser.
    
    WebCore:
    
    There were two problems to solve here:
    - the incorrect anchoring of the rootChildLayer that was causing the composited
      content to be positioned incorrectly
    - the failure to paint the non composited content into the backing store when
      animating composited content.
    
    The first problem has been solved by leaving the original anchor point for the
    rootChildLayer and splitting the tasks of clipping and scrolling using two separate layers.
    The second problem has been solved leveraging the knowledge that WebView has of the dirty region
    of the backing store to pass this information to the layer renderer. This allows the renderer to force
    a paint into the backing store before moving to the compositing.
    
    Tests: compositing/geometry/horizontal-scroll-composited.html
           compositing/geometry/vertical-scroll-composited.html
    
    * manual-tests/win/horizontal-scroll-composited.html: Removed. This is now a layout test.
    * manual-tests/win/milliondollar.html: Added.
    * platform/graphics/win/WKCACFLayerRenderer.cpp:
    (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): Added initialization of dirty flag.
    (WebCore::WKCACFLayerRenderer::setScrollFrame):
    (WebCore::WKCACFLayerRenderer::updateScrollFrame): Updated to resize and position the clip and scroll layers.
    (WebCore::WKCACFLayerRenderer::setRootChildLayer):
    (WebCore::WKCACFLayerRenderer::createRenderer): Added new layer hierarchy.
    (WebCore::WKCACFLayerRenderer::destroyRenderer): Remove clip layer on destroy.
    (WebCore::WKCACFLayerRenderer::resize):
    (WebCore::WKCACFLayerRenderer::paint): Forcing paint massage to trigger paint into the backing store.
    * platform/graphics/win/WKCACFLayerRenderer.h:
    (WebCore::WKCACFLayerRenderer::setBackingStoreDirty): Added.
    
    WebKit/win:
    
    See detailed comments in WebCore/ChangeLog.
    
    * WebView.cpp:
    (WebView::deleteBackingStore): Reset the dirty flag when deleting the backing store.
    (WebView::addToDirtyRegion): Set the dirty flag when adding dirty rectangles to the
    backing store dirty region.
    (WebView::updateBackingStore): Reset the dirty flag after painting into the backing store.
    (WebView::setAcceleratedCompositing): Removed unnecessary call to updateRootLayerContents.
    (WebView::updateRootLayerContents): Changed the way we pass parameters to setScrollFrame.
    We are passing width and height of the view content together with the offset for the scrolling.
    It was confusing to pass it all as a rectangle, when it is not a rectangle.
    
    LayoutTests:
    
    * compositing/geometry/horizontal-scroll-composited.html: Added.
    * compositing/geometry/vertical-scroll-composited.html: Added.
    * compositing/resources/apple.jpg: Added.
    * platform/mac/compositing/geometry/horizontal-scroll-composited-expected.checksum: Added.
    * platform/mac/compositing/geometry/horizontal-scroll-composited-expected.png: Added.
    * platform/mac/compositing/geometry/horizontal-scroll-composited-expected.txt: Added.
    * platform/mac/compositing/geometry/vertical-scroll-composited-expected.checksum: Added.
    * platform/mac/compositing/geometry/vertical-scroll-composited-expected.png: Added.
    * platform/mac/compositing/geometry/vertical-scroll-composited-expected.txt: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55941 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 82a169c..1f0c3ea 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2010-03-12  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Content of 3D tests appears at the bottom right corner sometimes.
+        <rdar://problem/7556244>
+        <https://bugs.webkit.org/show_bug.cgi?id=36027>
+
+        * compositing/geometry/horizontal-scroll-composited.html: Added.
+        * compositing/geometry/vertical-scroll-composited.html: Added.
+        * compositing/resources/apple.jpg: Added.
+        * platform/mac/compositing/geometry/horizontal-scroll-composited-expected.checksum: Added.
+        * platform/mac/compositing/geometry/horizontal-scroll-composited-expected.png: Added.
+        * platform/mac/compositing/geometry/horizontal-scroll-composited-expected.txt: Added.
+        * platform/mac/compositing/geometry/vertical-scroll-composited-expected.checksum: Added.
+        * platform/mac/compositing/geometry/vertical-scroll-composited-expected.png: Added.
+        * platform/mac/compositing/geometry/vertical-scroll-composited-expected.txt: Added.
+
 2010-03-12  Dirk Schulze  <krit at webkit.org>
 
         Unreviewed LayoutTest update.
diff --git a/LayoutTests/compositing/geometry/horizontal-scroll-composited.html b/LayoutTests/compositing/geometry/horizontal-scroll-composited.html
new file mode 100644
index 0000000..801ae47
--- /dev/null
+++ b/LayoutTests/compositing/geometry/horizontal-scroll-composited.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+    <title>Horizontal scroll test for composited elements</title>
+    <script type="text/javascript" charset="utf-8">
+    if (window.layoutTestController)
+        layoutTestController.waitUntilDone();
+    </script>
+</head>
+<body style="width: 600px">
+<div style="-webkit-transform: translatez(0); width: 1000px; height: 800px; border-style: solid; border-color: Red; border-width: 3px; background-image: url(../resources/apple.jpg); background-repeat:repeat"></div>
+<script type="text/javascript" charset="utf-8">
+      window.scrollBy(300, 0);
+      if (window.layoutTestController)
+        layoutTestController.notifyDone();
+</script>
+</body>
+</html>
diff --git a/LayoutTests/compositing/geometry/vertical-scroll-composited.html b/LayoutTests/compositing/geometry/vertical-scroll-composited.html
new file mode 100644
index 0000000..6ea2f8f
--- /dev/null
+++ b/LayoutTests/compositing/geometry/vertical-scroll-composited.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+    <title>Vertical scroll test for composited elements</title>
+    <script type="text/javascript" charset="utf-8">
+    if (window.layoutTestController)
+        layoutTestController.waitUntilDone();
+    </script>
+</head>
+<body style="height: 600px">
+<div style="-webkit-transform: rotate3d(0,0,1,20deg); width: 800px; height: 1000px; border-style: solid; border-color: Red; border-width: 3px; background-image: url(../resources/apple.jpg); background-repeat:repeat"></div>
+<script type="text/javascript" charset="utf-8">
+      window.scrollBy(0, 200);
+      if (window.layoutTestController)
+        layoutTestController.notifyDone();
+</script>
+</body>
+</html>
diff --git a/LayoutTests/fast/repaint/resources/apple.jpg b/LayoutTests/compositing/resources/apple.jpg
similarity index 100%
copy from LayoutTests/fast/repaint/resources/apple.jpg
copy to LayoutTests/compositing/resources/apple.jpg
diff --git a/LayoutTests/platform/mac/compositing/geometry/horizontal-scroll-composited-expected.checksum b/LayoutTests/platform/mac/compositing/geometry/horizontal-scroll-composited-expected.checksum
new file mode 100644
index 0000000..a8028ab
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/geometry/horizontal-scroll-composited-expected.checksum
@@ -0,0 +1 @@
+a70811f22f7d006906da64cde40dd091
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/compositing/geometry/horizontal-scroll-composited-expected.png b/LayoutTests/platform/mac/compositing/geometry/horizontal-scroll-composited-expected.png
new file mode 100644
index 0000000..3766183
Binary files /dev/null and b/LayoutTests/platform/mac/compositing/geometry/horizontal-scroll-composited-expected.png differ
diff --git a/LayoutTests/platform/mac/compositing/geometry/horizontal-scroll-composited-expected.txt b/LayoutTests/platform/mac/compositing/geometry/horizontal-scroll-composited-expected.txt
new file mode 100644
index 0000000..a51d9cd
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/geometry/horizontal-scroll-composited-expected.txt
@@ -0,0 +1,8 @@
+layer at (0,0) size 1014x822
+  RenderView at (0,0) size 785x585
+layer at (0,0) size 785x822
+  RenderBlock {HTML} at (0,0) size 785x822
+    RenderBody {BODY} at (8,8) size 600x806
+layer at (8,8) size 1006x806
+  RenderBlock {DIV} at (0,0) size 1006x806 [border: (3px solid #FF0000)]
+scrolled to 229,0
diff --git a/LayoutTests/platform/mac/compositing/geometry/vertical-scroll-composited-expected.checksum b/LayoutTests/platform/mac/compositing/geometry/vertical-scroll-composited-expected.checksum
new file mode 100644
index 0000000..4a5e0e3
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/geometry/vertical-scroll-composited-expected.checksum
@@ -0,0 +1 @@
+f5a5faa98eb7dcc5130c91dd0cdfaaa1
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/compositing/geometry/vertical-scroll-composited-expected.png b/LayoutTests/platform/mac/compositing/geometry/vertical-scroll-composited-expected.png
new file mode 100644
index 0000000..3c6c406
Binary files /dev/null and b/LayoutTests/platform/mac/compositing/geometry/vertical-scroll-composited-expected.png differ
diff --git a/LayoutTests/platform/mac/compositing/geometry/vertical-scroll-composited-expected.txt b/LayoutTests/platform/mac/compositing/geometry/vertical-scroll-composited-expected.txt
new file mode 100644
index 0000000..72f65e1
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/geometry/vertical-scroll-composited-expected.txt
@@ -0,0 +1,8 @@
+layer at (0,0) size 814x1014
+  RenderView at (0,0) size 785x585
+layer at (0,0) size 785x616
+  RenderBlock {HTML} at (0,0) size 785x616
+    RenderBody {BODY} at (8,8) size 769x600
+layer at (8,8) size 806x1006
+  RenderBlock {DIV} at (0,0) size 806x1006 [border: (3px solid #FF0000)]
+scrolled to 0,200
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6041462..931cf1d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,40 @@
+2010-03-12  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Content of 3D tests appears at the bottom right corner sometimes.
+        <rdar://problem/7556244>
+        <https://bugs.webkit.org/show_bug.cgi?id=36027>
+
+        There were two problems to solve here:
+        - the incorrect anchoring of the rootChildLayer that was causing the composited
+          content to be positioned incorrectly
+        - the failure to paint the non composited content into the backing store when
+          animating composited content.
+          
+        The first problem has been solved by leaving the original anchor point for the
+        rootChildLayer and splitting the tasks of clipping and scrolling using two separate layers.
+        The second problem has been solved leveraging the knowledge that WebView has of the dirty region
+        of the backing store to pass this information to the layer renderer. This allows the renderer to force
+        a paint into the backing store before moving to the compositing.
+        
+        Tests: compositing/geometry/horizontal-scroll-composited.html
+               compositing/geometry/vertical-scroll-composited.html
+
+        * manual-tests/win/horizontal-scroll-composited.html: Removed. This is now a layout test.
+        * manual-tests/win/milliondollar.html: Added.
+        * platform/graphics/win/WKCACFLayerRenderer.cpp:
+        (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): Added initialization of dirty flag.
+        (WebCore::WKCACFLayerRenderer::setScrollFrame): 
+        (WebCore::WKCACFLayerRenderer::updateScrollFrame): Updated to resize and position the clip and scroll layers.
+        (WebCore::WKCACFLayerRenderer::setRootChildLayer):
+        (WebCore::WKCACFLayerRenderer::createRenderer): Added new layer hierarchy.
+        (WebCore::WKCACFLayerRenderer::destroyRenderer): Remove clip layer on destroy.
+        (WebCore::WKCACFLayerRenderer::resize):
+        (WebCore::WKCACFLayerRenderer::paint): Forcing paint massage to trigger paint into the backing store.
+        * platform/graphics/win/WKCACFLayerRenderer.h:
+        (WebCore::WKCACFLayerRenderer::setBackingStoreDirty): Added.
+
 2010-03-12  Robert Hogan  <robert at webkit.org>
 
         Not reviewed, build fix.
diff --git a/WebCore/manual-tests/win/horizontal-scroll-composited.html b/WebCore/manual-tests/win/horizontal-scroll-composited.html
deleted file mode 100644
index c977300..0000000
--- a/WebCore/manual-tests/win/horizontal-scroll-composited.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<div>
-<b>Scroll test for composited elements on Windows.</b>
-</div>
-<div>Make sure you browser window is smaller than 1000 pixels so that you see an horizontal scroll bar.
-<br />
-Try scolling right and left and verify that the content is displayed correctly. 
-</div>
-<div style="-webkit-transform: translatez(0); width: 1000px; height: 800px; border-style: solid; border-color: Red; border-width: 3px; background-image: url(../resources/apple.jpg); background-repeat:repeat"></div>
diff --git a/WebCore/manual-tests/win/milliondollar.html b/WebCore/manual-tests/win/milliondollar.html
new file mode 100644
index 0000000..e1d51ff
--- /dev/null
+++ b/WebCore/manual-tests/win/milliondollar.html
@@ -0,0 +1,137 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Million dollar test</title>
+<style type="text/css" media="screen">
+    body {
+        padding: 0px; margin: 0px; font-size: 12px; font-family:"Lucida Grande", Verdana, Arial, sans-serif;
+        background:#303030;
+    }
+    .ie {text-align: left; width:1000px;position:relative;visibility:hidden;z-index:1;}
+    .grid {height: 1000px; width:1000px; position:relative;z-index:153;xoverflow:hidden;}
+    .row {background:url(100grid_inv.png) #000;height: 100px; text-align: left; position:relative;width:1000px;z-index:10;}
+    #lq {width:1000px;position:relative;z-index:0;text-align:left;}
+    .bz {-webkit-perspective: 1500;-webkit-perspective-origin: 50% 325px;}
+    .fc {-webkit-transform-style: preserve-3d;-webkit-transform:  rotateY(0deg) ;opacity: 1.0;}
+    @-webkit-keyframes spin_3d {
+    0%    { -webkit-transform: rotateY(0)       rotateZ(0); }
+    33%   { -webkit-transform: rotateY(-20deg)  rotateZ(-20deg); }
+    65%   { -webkit-transform: rotateY(20deg) rotateZ(20deg); }
+    100%  { -webkit-transform: rotateY(0deg) rotateZ(0deg); }
+    }
+    .plane > a {display:block;height:100%;width:100%;}
+    .plane {
+        position: absolute;
+        opacity:0.5;
+        background-repeat:no-repeat;
+        -webkit-transition: -webkit-transform 0.3s, opacity 0s;-webkit-backface-visibility: visible;}
+</style>
+
+<script type="text/javascript">
+function loadBlocks() {
+    document.getElementById("ie").style.visibility = "visible";
+    document.getElementById("ie").className = document.getElementById("ie").className + " bz";
+    document.getElementById("grid").className = document.getElementById("grid").className + " fc";
+    document.getElementById("lq").style.display = "none";
+
+    var cubes;
+
+    cubify(200,0,250,50);
+    cubify(800,500,900,600);
+    cubify(250,350,300,400);
+    cubify(600,600,650,650);
+    cubify(850,0,900,50);
+    cubify(650,450,700,500);
+    cubify(100,500,250,650);
+    cubify(400,600,500,700);
+    cubify(700,600,800,700);
+    cubify(350,0,500,150);
+    cubify(450,200,500,250);
+    cubify(550,250,600,300);
+    cubify(0,400,100,450);
+    cubify(600,150,650,200);
+    cubify(600,700,650,750);
+    cubify(150,850,450,950);
+    cubify(200,100,300,200);
+    cubify(750,200,950,400);
+    cubify(250,700,350,800);
+    cubify(600,800,700,900);
+    cubify(100,300,150,350);
+    cubify(0,300,50,350);
+    cubify(850,650,950,700);
+    cubify(900,100,950,150);
+    cubify(200,400,250,450);
+    cubify(200,250,250,300);
+    cubify(300,600,350,650);
+    cubify(50,200,100,250);
+    cubify(100,100,150,150);
+    cubify(0,0,5,5);
+    cubify(470,430,475,435);
+    cubify(520,480,525,485);
+    cubify(570,380,575,385);
+    cubify(550,0,600,50);
+    cubify(650,0,700,50);
+    cubify(425,390,455,400);
+    cubify(435,400,445,430);
+    cubify(525,425,530,430);
+    cubify(450,500,465,515);
+    cubify(650,100,750,200);
+    cubify(0,0,50,50);
+    cubify(700,750,900,800);
+    cubify(495,390,510,405);
+    cubify(495,445,500,450);
+    cubify(560,450,565,455);
+    cubify(460,460,465,465);
+    cubify(525,370,530,375);
+    cubify(490,420,495,425);
+    cubify(520,440,525,445);
+    cubify(510,420,515,425);
+    cubify(495,465,500,470);
+    cubify(475,405,480,410);
+    cubify(545,400,550,405);
+    cubify(485,370,490,375);
+    cubify(430,365,435,370);
+
+    document.getElementById("grid").innerHTML = cubes + document.getElementById("grid").innerHTML;
+
+    function cubify(x1, y1, x2, y2)
+    {
+        var width, height,dw;
+        width = x2 - x1;
+        height = y2 - y1;
+        if (width < height) {
+            dw = width;
+        } else {
+            dw = height;
+        }
+        cubes += addBlock(x1,y1,width,height,dw);
+    }
+    
+    function addBlock(x1,y1,xf,qp,dw)
+    {
+       return "<div class='a_cube'><div class='plane one' style='background-color: red;height:"+dw+"px;width:"+dw+"px;top:"+y1+"px;left:"+x1+"px;-webkit-transform:rotateY(90deg) rotateZ(-90deg) translateX(0px) translateY(-"+(dw/2)+"px) translateZ("+(dw/2)+"px) translateY(0px);position:absolute;'></div><div class='plane two' style='background-color: blue;height:"+dw+"px;width:"+dw+"px;top:"+y1+"px;left:"+x1+"px;-webkit-transform:rotateY(90deg) rotateX(180deg) rotateZ(-90deg) translateX(0px) translateY(-"+(dw/2)+"px) translateZ("+(dw/2)+"px) translateY(0px);position:absolute;'></div><div class='plane three' style='background-color: green;height:"+dw+"px;width:"+dw+"px;top:"+y1+"px;left:"+x1+"px;-webkit-transform:rotateX(-90deg) translateX(0px) translateZ("+(dw/2)+"px) translateY(-"+(dw/2)+"px);position:absolute;'></div><div class='plane four' style='background-color: yellow;height:"+dw+"px;width:"+dw+"px;top:"+y1+"px;left:"+x1+"px;-webkit-transform:rotateY(90deg) rotateX(90deg) rotateZ(-90deg) translateY(-"+(dw/2)+"px) translateX(0px) translateZ("+(dw/2)+"px) translateY(0px);position:absolute;'></div><div class='plane five' style='background-color: gray;height:"+dw+"px;width:"+dw+"px;top:"+y1+"px;left:"+x1+"px;-webkit-transform:rotateY(0deg) translateX(0px) translateZ("+(dw)+"px) translateY(0px);position:absolute;'></div></div>";
+    }
+
+    document.getElementById("grid").style.webkitAnimation = "spin_3d 36s infinite linear";
+};
+
+</script>
+</head>
+<body onload="loadBlocks()">
+<center>
+    <div id="lq">
+        <div style="top: 252px; left: 203px; width: 196px; height: 196px; position: relative;
+            z-index: 0; text-align: left; border: 0px solid #999; padding: 0px; background: #333;
+            -moz-border-radius: 0px; -webkit-border-radius: 0px; text-align: center;">
+            $1 a pixel
+        </div>
+    </div>
+    <div class="ie" id="ie">
+        <div class="grid" id="grid">
+            <div class="row" id="row0"></div><div class="row" id="row1"></div><div class="row" id="row2"></div><div class="row" id="row3"></div><div class="row" id="row4"></div><div class="row" id="row5"></div><div class="row" id="row6"></div><div class="row" id="row7"></div><div class="row" id="row8"></div><div class="row" id="row9"></div>
+        </div>
+    </div>
+</center>
+</body>
+</html>
diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
index 6b54e24..abe0acc 100644
--- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
+++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp
@@ -225,7 +225,9 @@ WKCACFLayerRenderer::WKCACFLayerRenderer()
     , m_renderer(0)
     , m_hostWindow(0)
     , m_renderTimer(this, &WKCACFLayerRenderer::renderTimerFired)
-    , m_scrollFrame(0, 0, 1, 1) // Default to 1 to avoid 0 size frames
+    , m_scrollPosition(0, 0)
+    , m_scrollSize(1, 1)
+    , m_backingStoreDirty(false)
 {
 #ifndef NDEBUG
     char* printTreeFlag = getenv("CA_PRINT_TREE");
@@ -243,15 +245,24 @@ WKCACFLayer* WKCACFLayerRenderer::rootLayer() const
     return m_rootLayer.get();
 }
 
-void WKCACFLayerRenderer::setScrollFrame(const IntRect& scrollFrame)
+void WKCACFLayerRenderer::setScrollFrame(const IntPoint& position, const IntSize& size)
 {
-    m_scrollFrame = scrollFrame;
-    CGRect frameBounds = bounds();
-    m_scrollLayer->setBounds(CGRectMake(0, 0, m_scrollFrame.width(), m_scrollFrame.height()));
-    m_scrollLayer->setPosition(CGPointMake(0, frameBounds.size.height));
+    m_scrollSize = size;
+    m_scrollPosition = position;
 
-    if (m_rootChildLayer)
-        m_rootChildLayer->setPosition(CGPointMake(-m_scrollFrame.x(), m_scrollFrame.height() + m_scrollFrame.y()));
+    updateScrollFrame();
+}
+
+void WKCACFLayerRenderer::updateScrollFrame()
+{
+    CGRect frameBounds = bounds();
+    m_clipLayer->setBounds(CGRectMake(0, 0, m_scrollSize.width(), m_scrollSize.height()));
+    m_clipLayer->setPosition(CGPointMake(0, frameBounds.size.height));
+    if (m_rootChildLayer) {
+        CGRect rootBounds = m_rootChildLayer->bounds();
+        m_scrollLayer->setBounds(rootBounds);
+    }
+    m_scrollLayer->setPosition(CGPointMake(-m_scrollPosition.x(), m_scrollPosition.y() + m_scrollSize.height()));
 }
 
 void WKCACFLayerRenderer::setRootContents(CGImageRef image)
@@ -270,10 +281,8 @@ void WKCACFLayerRenderer::setRootChildLayer(WKCACFLayer* layer)
     m_rootChildLayer = layer;
     if (layer) {
         m_scrollLayer->addSublayer(layer);
-
-        // Set the frame
-        layer->setAnchorPoint(CGPointMake(0, 1));
-        setScrollFrame(m_scrollFrame);
+        // Adjust the scroll frame accordingly
+        updateScrollFrame();
     }
 }
    
@@ -335,15 +344,30 @@ bool WKCACFLayerRenderer::createRenderer()
     m_renderContext = static_cast<CARenderContext*>(CACFContextGetRenderContext(m_context.get()));
     m_renderer = CARenderOGLNew(wkqcCARenderOGLCallbacks(wkqckCARenderDX9Callbacks), m_d3dDevice.get(), 0);
 
-    // Create the root hierarchy
+    // Create the root hierarchy.
+    // Under the root layer, we have a clipping layer to clip the content,
+    // that contains a scroll layer that we use for scrolling the content.
+    // The root layer is the size of the client area of the window.
+    // The clipping layer is the size of the WebView client area (window less the scrollbars).
+    // The scroll layer is the size of the root child layer.
+    // Resizing the window will change the bounds of the rootLayer and the clip layer and will not
+    // cause any repositioning.
+    // Scrolling will affect only the position of the scroll layer without affecting the bounds.
+
     m_rootLayer = WKCACFRootLayer::create(this);
     m_rootLayer->setName("WKCACFLayerRenderer rootLayer");
+
+    m_clipLayer = WKCACFLayer::create(WKCACFLayer::Layer);
+    m_clipLayer->setName("WKCACFLayerRenderer clipLayer");
+    
     m_scrollLayer = WKCACFLayer::create(WKCACFLayer::Layer);
     m_scrollLayer->setName("WKCACFLayerRenderer scrollLayer");
 
-    m_rootLayer->addSublayer(m_scrollLayer);
-    m_scrollLayer->setMasksToBounds(true);
+    m_rootLayer->addSublayer(m_clipLayer);
+    m_clipLayer->addSublayer(m_scrollLayer);
+    m_clipLayer->setMasksToBounds(true);
     m_scrollLayer->setAnchorPoint(CGPointMake(0, 1));
+    m_clipLayer->setAnchorPoint(CGPointMake(0, 1));
 
 #ifndef NDEBUG
     CGColorRef debugColor = createCGColor(Color(255, 0, 0, 204));
@@ -376,6 +400,7 @@ void WKCACFLayerRenderer::destroyRenderer()
 
     s_d3d = 0;
     m_rootLayer = 0;
+    m_clipLayer = 0;
     m_scrollLayer = 0;
     m_rootChildLayer = 0;
 
@@ -392,7 +417,7 @@ void WKCACFLayerRenderer::resize()
     if (m_rootLayer) {
         m_rootLayer->setFrame(bounds());
         WKCACFContextFlusher::shared().flushAllContexts();
-        setScrollFrame(m_scrollFrame);
+        updateScrollFrame();
     }
 }
 
@@ -438,6 +463,15 @@ void WKCACFLayerRenderer::paint()
     if (!m_d3dDevice)
         return;
 
+    if (m_backingStoreDirty) {
+        // If the backing store is still dirty when we are about to draw the
+        // composited content, we need to force the window to paint into the
+        // backing store. The paint will only paint the dirty region that
+        // if being tracked in WebView.
+        UpdateWindow(m_hostWindow);
+        return;
+    }
+
     Vector<CGRect> dirtyRects;
     getDirtyRects(m_hostWindow, dirtyRects);
     render(dirtyRects);
diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
index f24f3e7..ea710b6 100644
--- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
+++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h
@@ -60,16 +60,17 @@ public:
     static bool acceleratedCompositingAvailable();
     static void didFlushContext(CACFContextRef);
 
-    void setScrollFrame(const IntRect&);
+    void setScrollFrame(const IntPoint&, const IntSize&);
     void setRootContents(CGImageRef);
     void setRootChildLayer(WKCACFLayer* layer);
     void setNeedsDisplay();
     void setHostWindow(HWND window) { m_hostWindow = window; }
-
+    void setBackingStoreDirty(bool dirty) { m_backingStoreDirty = dirty; }
     bool createRenderer();
     void destroyRenderer();
     void resize();
     void renderSoon();
+    void updateScrollFrame();
 
 protected:
     WKCACFLayer* rootLayer() const;
@@ -93,13 +94,15 @@ private:
     RefPtr<WKCACFLayer> m_viewLayer;
     RefPtr<WKCACFLayer> m_scrollLayer;
     RefPtr<WKCACFLayer> m_rootChildLayer;
+    RefPtr<WKCACFLayer> m_clipLayer;
     RetainPtr<CACFContextRef> m_context;
     CARenderContext* m_renderContext;
     CARenderOGLContext* m_renderer;
     HWND m_hostWindow;
     Timer<WKCACFLayerRenderer> m_renderTimer;
-    IntRect m_scrollFrame;
-
+    IntPoint m_scrollPosition;
+    IntSize m_scrollSize;
+    bool m_backingStoreDirty;
 #ifndef NDEBUG
     bool m_printTree;
 #endif
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index e09ead3..906ca0f 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,23 @@
+2010-03-12  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Content of 3D tests appears at the bottom right corner sometimes.
+        <rdar://problem/7556244>
+        <https://bugs.webkit.org/show_bug.cgi?id=36027>
+
+        See detailed comments in WebCore/ChangeLog.
+
+        * WebView.cpp:
+        (WebView::deleteBackingStore): Reset the dirty flag when deleting the backing store.
+        (WebView::addToDirtyRegion): Set the dirty flag when adding dirty rectangles to the
+        backing store dirty region.
+        (WebView::updateBackingStore): Reset the dirty flag after painting into the backing store.
+        (WebView::setAcceleratedCompositing): Removed unnecessary call to updateRootLayerContents.
+        (WebView::updateRootLayerContents): Changed the way we pass parameters to setScrollFrame.
+        We are passing width and height of the view content together with the offset for the scrolling.
+        It was confusing to pass it all as a rectangle, when it is not a rectangle.
+        
 2010-03-11  Aaron Boodman  <aa at chromium.org>
 
         Kill WebDocument::applicationID() (part 1).
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index 091bbe4..48d7d4e 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -736,6 +736,8 @@ void WebView::deleteBackingStore()
     }
     m_backingStoreBitmap.clear();
     m_backingStoreDirtyRegion.clear();
+    if (m_layerRenderer)
+        m_layerRenderer->setBackingStoreDirty(false);
 
     m_backingStoreSize.cx = m_backingStoreSize.cy = 0;
 }
@@ -784,6 +786,9 @@ void WebView::addToDirtyRegion(HRGN newRegion)
     } else
         m_backingStoreDirtyRegion.set(newRegion);
 
+    if (m_layerRenderer)
+        m_layerRenderer->setBackingStoreDirty(true);
+
     if (m_uiDelegatePrivate)
         m_uiDelegatePrivate->webViewDidInvalidate(this);
 }
@@ -910,6 +915,8 @@ void WebView::updateBackingStore(FrameView* frameView, HDC dc, bool backingStore
             m_uiDelegatePrivate->webViewPainted(this);
 
         m_backingStoreDirtyRegion.clear();
+        if (m_layerRenderer)
+            m_layerRenderer->setBackingStoreDirty(false);
     }
 
     if (!dc) {
@@ -6077,7 +6084,6 @@ void WebView::setAcceleratedCompositing(bool accelerated)
             ASSERT(m_viewWindow);
             m_layerRenderer->setHostWindow(m_viewWindow);
             m_layerRenderer->createRenderer();
-            updateRootLayerContents();
         }
     } else {
         m_layerRenderer = 0;
@@ -6116,7 +6122,7 @@ void WebView::updateRootLayerContents()
         return;
     FrameView* frameView = coreFrame->view();
 
-    m_layerRenderer->setScrollFrame(IntRect(frameView->scrollX(), frameView->scrollY(), frameView->layoutWidth(), frameView->layoutHeight()));
+    m_layerRenderer->setScrollFrame(IntPoint(frameView->scrollX(), frameView->scrollY()), IntSize(frameView->layoutWidth(), frameView->layoutHeight()));
 }
 #endif
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list