[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

simon.fraser at apple.com simon.fraser at apple.com
Thu Feb 4 21:31:14 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 1b3809775426a1d192e113b9cc77781136ceaf97
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 28 18:07:14 2010 +0000

    2010-01-28  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Video can overlap position:fixed element when scrolling
            https://bugs.webkit.org/show_bug.cgi?id=32180
    
            When the scroll position changes, and we're using overlap to decide what gets composited,
            then we need to re-evaluate what gets compositing when scrolling in case fixed postion elements
            overlap composited elements (e.g. video).
    
            Test: compositing/geometry/video-fixed-scrolling.html
    
            * page/FrameView.cpp:
            (WebCore::FrameView::updateCompositingLayers):
            (WebCore::FrameView::scrollPositionChanged): Annotate the calls to updateCompositingLayers()
            with the type of change that occurred.
    
            * rendering/RenderLayer.cpp:
            (WebCore::RenderLayer::updateCompositingAndLayerListsIfNeeded): Ditto.
    
            * rendering/RenderLayerCompositor.h:
            * rendering/RenderLayerCompositor.cpp:
            (WebCore::RenderLayerCompositor::updateCompositingLayers): For scroll changes, check
            for hierarchy update if m_compositingConsultsOverlap is true, and do
            a geometry update. For other changes, always check for hierarchy updates.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54006 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ae0a3ca..47f4dae 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-28  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Video can overlap position:fixed element when scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=32180
+        
+        Testcase for video overlapping a fixed position element on scroll.
+
+        * compositing/geometry/video-fixed-scrolling.html: Added.
+        * platform/mac/compositing/geometry/video-fixed-scrolling-expected.checksum: Added.
+        * platform/mac/compositing/geometry/video-fixed-scrolling-expected.png: Added.
+        * platform/mac/compositing/geometry/video-fixed-scrolling-expected.txt: Added.
+
 2010-01-28  Anton Muhin  <antonm at google.com>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/LayoutTests/compositing/geometry/video-fixed-scrolling.html b/LayoutTests/compositing/geometry/video-fixed-scrolling.html
new file mode 100644
index 0000000..6cd5e0a
--- /dev/null
+++ b/LayoutTests/compositing/geometry/video-fixed-scrolling.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+  "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Video overlay</title>
+  <style type="text/css" media="screen">
+    body {
+      height: 1000px;
+    }
+    
+    video {
+      margin-top: 80px;
+      width: 400px;
+      height: 300px;
+    }
+    
+    #fixed-bar {
+      position: fixed;
+      left: 0;
+      top: 0;
+      width: 500px;
+      height: 60px;
+      background-color: rgba(0, 0, 255, 0.8);
+    }
+  </style>
+  <script type="text/javascript" charset="utf-8">
+    if (window.layoutTestController)
+      layoutTestController.waitUntilDone();
+  </script>
+</head>
+<body>
+    <video src="../resources/video.mp4"></video>
+
+    <p>The blue bar should be in front of the video, and at the top of the page.</p>
+    <div id="fixed-bar"></div>
+
+  <script type="text/javascript" charset="utf-8">
+    var video = document.getElementsByTagName('video')[0];
+    video.addEventListener('canplaythrough', function() {
+      window.scrollBy(50, 50);
+      if (window.layoutTestController)
+        layoutTestController.notifyDone();
+    }, false);
+  </script>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/compositing/geometry/video-fixed-scrolling-expected.checksum b/LayoutTests/platform/mac/compositing/geometry/video-fixed-scrolling-expected.checksum
new file mode 100644
index 0000000..5997b9f
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/geometry/video-fixed-scrolling-expected.checksum
@@ -0,0 +1 @@
+9914131779e3ed84bc1e07b1c3137501
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/compositing/geometry/video-fixed-scrolling-expected.png b/LayoutTests/platform/mac/compositing/geometry/video-fixed-scrolling-expected.png
new file mode 100644
index 0000000..53f960a
Binary files /dev/null and b/LayoutTests/platform/mac/compositing/geometry/video-fixed-scrolling-expected.png differ
diff --git a/LayoutTests/platform/mac/compositing/geometry/video-fixed-scrolling-expected.txt b/LayoutTests/platform/mac/compositing/geometry/video-fixed-scrolling-expected.txt
new file mode 100644
index 0000000..2304d9c
--- /dev/null
+++ b/LayoutTests/platform/mac/compositing/geometry/video-fixed-scrolling-expected.txt
@@ -0,0 +1,15 @@
+layer at (0,0) size 785x1016
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x1016
+  RenderBlock {HTML} at (0,0) size 785x1016
+    RenderBody {BODY} at (8,8) size 769x1000
+      RenderBlock (anonymous) at (0,0) size 769x384
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {P} at (0,400) size 769x18
+        RenderText {#text} at (0,0) size 445x18
+          text run at (0,0) width 445: "The blue bar should be in front of the video, and at the top of the page."
+layer at (8,88) size 400x300
+  RenderVideo {VIDEO} at (0,80) size 400x300
+layer at (0,50) size 500x60
+  RenderBlock (positioned) {DIV} at (0,0) size 500x60 [bgcolor=#0000FFCC]
+scrolled to 0,50
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index cf2dbbd..565e189 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-01-28  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Video can overlap position:fixed element when scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=32180
+        
+        When the scroll position changes, and we're using overlap to decide what gets composited,
+        then we need to re-evaluate what gets compositing when scrolling in case fixed postion elements
+        overlap composited elements (e.g. video).
+
+        Test: compositing/geometry/video-fixed-scrolling.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::updateCompositingLayers):
+        (WebCore::FrameView::scrollPositionChanged): Annotate the calls to updateCompositingLayers()
+        with the type of change that occurred.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateCompositingAndLayerListsIfNeeded): Ditto.
+        
+        * rendering/RenderLayerCompositor.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateCompositingLayers): For scroll changes, check
+        for hierarchy update if m_compositingConsultsOverlap is true, and do
+        a geometry update. For other changes, always check for hierarchy updates.
+
 2010-01-27  Dave Hyatt  <hyatt at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 21666ae..d839e26 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -444,7 +444,7 @@ void FrameView::updateCompositingLayers()
     if (!view->usesCompositing())
         return;
 
-    view->compositor()->updateCompositingLayers();
+    view->compositor()->updateCompositingLayers(CompositingUpdateAfterLayoutOrStyleChange);
 }
 
 void FrameView::setNeedsOneShotDrawingSynchronization()
@@ -940,22 +940,17 @@ void FrameView::scrollPositionChanged()
 {
     frame()->eventHandler()->sendScrollEvent();
 
-#if USE(ACCELERATED_COMPOSITING)
-    // We need to update layer positions after scrolling to account for position:fixed layers.
-    Document* document = m_frame->document();
-    if (!document)
-        return;
-
-    RenderLayer* layer = document->renderer() ? document->renderer()->enclosingLayer() : 0;
-    if (layer)
-        layer->updateLayerPositions(RenderLayer::UpdateCompositingLayers);
-#endif
-
-    // Update widget positions to take care of widgets inside fixed position elements,
+    // For fixed position elements, update widget positions and compositing layers after scrolling,
     // but only if we're not inside of layout.
+    // FIXME: we could skip this if we knew the page had no fixed position elements.
     if (!m_nestedLayoutCount) {
-        if (RenderView* root = m_frame->contentRenderer())
+        if (RenderView* root = m_frame->contentRenderer()) {
             root->updateWidgetPositions();
+#if USE(ACCELERATED_COMPOSITING)
+            if (root->usesCompositing())
+                root->compositor()->updateCompositingLayers(CompositingUpdateOnScroll);
+#endif
+        }
     }
 }
 
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index baf0f52..97e071e 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -3282,7 +3282,7 @@ void RenderLayer::updateCompositingAndLayerListsIfNeeded()
 #if USE(ACCELERATED_COMPOSITING)
     if (compositor()->inCompositingMode()) {
         if ((isStackingContext() && m_zOrderListsDirty) || m_normalFlowListDirty)
-            compositor()->updateCompositingLayers(this);
+            compositor()->updateCompositingLayers(CompositingUpdateOnPaitingOrHitTest, this);
         return;
     }
 #endif
diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp
index 4a0b40d..8f7b9d6 100644
--- a/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/WebCore/rendering/RenderLayerCompositor.cpp
@@ -152,16 +152,30 @@ void RenderLayerCompositor::scheduleSync()
     page->chrome()->client()->scheduleCompositingLayerSync();
 }
 
-void RenderLayerCompositor::updateCompositingLayers(RenderLayer* updateRoot)
+void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType updateType, RenderLayer* updateRoot)
 {
-    // When m_compositingConsultsOverlap is true, then layer positions affect compositing,
-    // so we can only bail here when we're not looking at overlap.
-    if (!m_compositingLayersNeedRebuild && !m_compositingConsultsOverlap)
+    bool checkForHierarchyUpdate = false;
+    bool needGeometryUpdate = false;
+    
+    switch (updateType) {
+    case CompositingUpdateAfterLayoutOrStyleChange:
+    case CompositingUpdateOnPaitingOrHitTest:
+        checkForHierarchyUpdate = true;
+        break;
+    case CompositingUpdateOnScroll:
+        if (m_compositingConsultsOverlap)
+            checkForHierarchyUpdate = true; // Overlap can change with scrolling, so need to check for hierarchy updates.
+
+        needGeometryUpdate = true;
+        break;
+    }
+
+    if (!checkForHierarchyUpdate && !needGeometryUpdate)
         return;
 
     ASSERT(inCompositingMode());
 
-    bool needLayerRebuild = m_compositingLayersNeedRebuild;
+    bool needHierarchyUpdate = m_compositingLayersNeedRebuild;
     if (!updateRoot) {
         // Only clear the flag if we're updating the entire hierarchy.
         m_compositingLayersNeedRebuild = false;
@@ -174,24 +188,22 @@ void RenderLayerCompositor::updateCompositingLayers(RenderLayer* updateRoot)
     double startTime = WTF::currentTime();
 #endif        
 
-    // Go through the layers in presentation order, so that we can compute which
-    // RLs need compositing layers.
-    // FIXME: we could maybe do this in one pass, but the parenting logic would be more
-    // complex.
-    {
+    if (checkForHierarchyUpdate) {
+        // Go through the layers in presentation order, so that we can compute which RenderLayers need compositing layers.
+        // FIXME: we could maybe do this and the hierarchy udpate in one pass, but the parenting logic would be more complex.
         CompositingState compState(updateRoot);
-        bool layersChanged;
+        bool layersChanged = false;
         if (m_compositingConsultsOverlap) {
             OverlapMap overlapTestRequestMap;
             computeCompositingRequirements(updateRoot, &overlapTestRequestMap, compState, layersChanged);
         } else
             computeCompositingRequirements(updateRoot, 0, compState, layersChanged);
         
-        needLayerRebuild |= layersChanged;
+        needHierarchyUpdate |= layersChanged;
     }
 
-    if (needLayerRebuild) {
-        // Now updated and parent the compositing layers.
+    if (needHierarchyUpdate) {
+        // Update the hierarchy of the compositing layers.
         CompositingState compState(updateRoot);
         Vector<GraphicsLayer*> childList;
         rebuildCompositingLayerTree(updateRoot, compState, childList);
@@ -199,8 +211,9 @@ void RenderLayerCompositor::updateCompositingLayers(RenderLayer* updateRoot)
         // Host the document layer in the RenderView's root layer.
         if (updateRoot == rootRenderLayer() && !childList.isEmpty())
             m_rootPlatformLayer->setChildren(childList);
-    } else {
-        // We just need to do a geometry update.
+    } else if (needGeometryUpdate) {
+        // We just need to do a geometry update. This is only used for position:fixed scrolling;
+        // most of the time, geometry is updated via RenderLayer::styleChanged().
         updateLayerTreeGeometry(updateRoot);
     }
     
diff --git a/WebCore/rendering/RenderLayerCompositor.h b/WebCore/rendering/RenderLayerCompositor.h
index a9c7ea0..5f1a178 100644
--- a/WebCore/rendering/RenderLayerCompositor.h
+++ b/WebCore/rendering/RenderLayerCompositor.h
@@ -38,6 +38,12 @@ class GraphicsLayer;
 class RenderVideo;
 #endif
 
+enum CompositingUpdateType {
+    CompositingUpdateAfterLayoutOrStyleChange,
+    CompositingUpdateOnPaitingOrHitTest,
+    CompositingUpdateOnScroll
+};
+
 // RenderLayerCompositor manages the hierarchy of
 // composited RenderLayers. It determines which RenderLayers
 // become compositing, and creates and maintains a hierarchy of
@@ -47,7 +53,6 @@ class RenderVideo;
 
 class RenderLayerCompositor {
 public:
-
     RenderLayerCompositor(RenderView*);
     ~RenderLayerCompositor();
     
@@ -80,7 +85,7 @@ public:
     void scheduleSync();
     
     // Rebuild the tree of compositing layers
-    void updateCompositingLayers(RenderLayer* updateRoot = 0);
+    void updateCompositingLayers(CompositingUpdateType = CompositingUpdateAfterLayoutOrStyleChange, RenderLayer* updateRoot = 0);
 
     // Update the compositing state of the given layer. Returns true if that state changed.
     enum CompositingChangeRepaint { CompositingChangeRepaintNow, CompositingChangeWillRepaintLater };

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list