Title: [139754] branches/chromium/1364/Source/WebCore
Revision
139754
Author
[email protected]
Date
2013-01-15 10:26:16 -0800 (Tue, 15 Jan 2013)

Log Message

Merge 139691
> Sometimes RenderLayer::updateNeedsCompositedScrolling is not called
> https://bugs.webkit.org/show_bug.cgi?id=106271
> 
> Reviewed by Simon Fraser.
> 
> Source/WebCore:
> 
> 1. If a layer has no out-of-flow descendant, m_hasOutOfFlowPositionedDescendant won't change and won't trigger updateNeedsCompositedScrolling in updateDescendantDependentFlags. Set m_hasOutOfFlowPositionedDescendantDirty to true and call updateNeedsCompositedScrolling when the dirty flag becomes false from true.
> 2. When the content size changes causing change of scrollable status, updateNeedsCompositedScrolling should also be called.
> 
> Test: compositing/overflow/dynamic-composited-scrolling-status.html
> 
> * page/FrameView.cpp:
> (WebCore::FrameView::addScrollableArea): Returns whether the scrollable area has just been newly added.
> (WebCore::FrameView::removeScrollableArea): Returns whether the scrollable area has just been removed.
> * page/FrameView.h:
> (FrameView):
> * rendering/RenderLayer.cpp:
> (WebCore::RenderLayer::RenderLayer): Changed the initial value of m_hasOutOfFlowPositionedDescendantDirty to true to make sure m_hasOutOfFlowPositionedDescendant will be updated initially.
> (WebCore::RenderLayer::updateDescendantDependentFlags): Call updateNeedsCompositedScrolling when m_hasOutOfFlowPositionedDescendantDirty is true.
> (RenderLayer::updateScrollableAreaSet): Calls updateNeedsCompositedScrolling() when scrollable status changes.
> * rendering/RenderLayer.h:
> (RenderLayer):
> 
> LayoutTests:
> 
> * compositing/overflow/dynamic-composited-scrolling-status-expected.txt: Added.
> * compositing/overflow/dynamic-composited-scrolling-status.html: Added.
> 

[email protected]

Modified Paths

Diff

Modified: branches/chromium/1364/Source/WebCore/page/FrameView.cpp (139753 => 139754)


--- branches/chromium/1364/Source/WebCore/page/FrameView.cpp	2013-01-15 18:22:11 UTC (rev 139753)
+++ branches/chromium/1364/Source/WebCore/page/FrameView.cpp	2013-01-15 18:26:16 UTC (rev 139754)
@@ -3722,18 +3722,24 @@
     return ts.release();
 }
 
-void FrameView::addScrollableArea(ScrollableArea* scrollableArea)
+bool FrameView::addScrollableArea(ScrollableArea* scrollableArea)
 {
     if (!m_scrollableAreas)
         m_scrollableAreas = adoptPtr(new ScrollableAreaSet);
-    m_scrollableAreas->add(scrollableArea);
+    return m_scrollableAreas->add(scrollableArea).isNewEntry;
 }
 
-void FrameView::removeScrollableArea(ScrollableArea* scrollableArea)
+bool FrameView::removeScrollableArea(ScrollableArea* scrollableArea)
 {
     if (!m_scrollableAreas)
-        return;
-    m_scrollableAreas->remove(scrollableArea);
+        return false;
+
+    ScrollableAreaSet::iterator it = m_scrollableAreas->find(scrollableArea);
+    if (it == m_scrollableAreas->end())
+        return false;
+
+    m_scrollableAreas->remove(it);
+    return true;
 }
 
 bool FrameView::containsScrollableArea(ScrollableArea* scrollableArea) const

Modified: branches/chromium/1364/Source/WebCore/page/FrameView.h (139753 => 139754)


--- branches/chromium/1364/Source/WebCore/page/FrameView.h	2013-01-15 18:22:11 UTC (rev 139753)
+++ branches/chromium/1364/Source/WebCore/page/FrameView.h	2013-01-15 18:26:16 UTC (rev 139754)
@@ -344,8 +344,10 @@
     String trackedRepaintRectsAsText() const;
 
     typedef HashSet<ScrollableArea*> ScrollableAreaSet;
-    void addScrollableArea(ScrollableArea*);
-    void removeScrollableArea(ScrollableArea*);
+    // Returns whether the scrollable area has just been newly added.
+    bool addScrollableArea(ScrollableArea*);
+    // Returns whether the scrollable area has just been removed.
+    bool removeScrollableArea(ScrollableArea*);
     bool containsScrollableArea(ScrollableArea*) const;
     const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
 

Modified: branches/chromium/1364/Source/WebCore/rendering/RenderLayer.cpp (139753 => 139754)


--- branches/chromium/1364/Source/WebCore/rendering/RenderLayer.cpp	2013-01-15 18:22:11 UTC (rev 139753)
+++ branches/chromium/1364/Source/WebCore/rendering/RenderLayer.cpp	2013-01-15 18:26:16 UTC (rev 139754)
@@ -148,7 +148,7 @@
     , m_hasSelfPaintingLayerDescendant(false)
     , m_hasSelfPaintingLayerDescendantDirty(false)
     , m_hasOutOfFlowPositionedDescendant(false)
-    , m_hasOutOfFlowPositionedDescendantDirty(false)
+    , m_hasOutOfFlowPositionedDescendantDirty(true)
     , m_needsCompositedScrolling(false)
     , m_descendantsAreContiguousInStackingOrder(false)
     , m_isRootLayer(renderer->isRenderView())
@@ -956,9 +956,6 @@
 void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* outOfFlowDescendantContainingBlocks)
 {
     if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty) {
-#if USE(ACCELERATED_COMPOSITING)
-        bool oldHasOutOfFlowPositionedDescendant = m_hasOutOfFlowPositionedDescendant;
-#endif
         m_hasVisibleDescendant = false;
         m_hasSelfPaintingLayerDescendant = false;
         m_hasOutOfFlowPositionedDescendant = false;
@@ -995,12 +992,12 @@
 
         m_visibleDescendantStatusDirty = false;
         m_hasSelfPaintingLayerDescendantDirty = false;
-        m_hasOutOfFlowPositionedDescendantDirty = false;
 
 #if USE(ACCELERATED_COMPOSITING)
-        if (oldHasOutOfFlowPositionedDescendant != m_hasOutOfFlowPositionedDescendant)
+        if (m_hasOutOfFlowPositionedDescendantDirty)
             updateNeedsCompositedScrolling();
 #endif
+        m_hasOutOfFlowPositionedDescendantDirty = false;
     }
 
     if (m_visibleContentStatusDirty) {
@@ -5512,10 +5509,12 @@
     if (HTMLFrameOwnerElement* owner = frame->ownerElement())
         isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToHitTesting();
 
-    if (hasOverflow && isVisibleToHitTest)
-        frameView->addScrollableArea(this);
-    else
-        frameView->removeScrollableArea(this);
+    if (hasOverflow && isVisibleToHitTest ? frameView->addScrollableArea(this) : frameView->removeScrollableArea(this))
+#if USE(ACCELERATED_COMPOSITING)
+        updateNeedsCompositedScrolling();
+#else
+        return;
+#endif
 }
 
 void RenderLayer::updateScrollCornerStyle()

Modified: branches/chromium/1364/Source/WebCore/rendering/RenderLayer.h (139753 => 139754)


--- branches/chromium/1364/Source/WebCore/rendering/RenderLayer.h	2013-01-15 18:22:11 UTC (rev 139753)
+++ branches/chromium/1364/Source/WebCore/rendering/RenderLayer.h	2013-01-15 18:26:16 UTC (rev 139754)
@@ -473,6 +473,7 @@
     // automatically opt into composited scrolling since this out of flow
     // positioned descendant would become clipped by us, possibly altering the 
     // rendering of the page.
+    // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty); here but we may hit the same bugs as visible content above.
     bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositionedDescendant; }
 
     // Gets the nearest enclosing positioned ancestor layer (also includes
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to