- Revision
- 139691
- Author
- wangxian...@chromium.org
- Date
- 2013-01-14 17:13:45 -0800 (Mon, 14 Jan 2013)
Log Message
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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (139690 => 139691)
--- trunk/LayoutTests/ChangeLog 2013-01-15 01:02:20 UTC (rev 139690)
+++ trunk/LayoutTests/ChangeLog 2013-01-15 01:13:45 UTC (rev 139691)
@@ -1,3 +1,13 @@
+2013-01-14 Xianzhu Wang <wangxian...@chromium.org>
+
+ Sometimes RenderLayer::updateNeedsCompositedScrolling is not called
+ https://bugs.webkit.org/show_bug.cgi?id=106271
+
+ Reviewed by Simon Fraser.
+
+ * compositing/overflow/dynamic-composited-scrolling-status-expected.txt: Added.
+ * compositing/overflow/dynamic-composited-scrolling-status.html: Added.
+
2013-01-11 Filip Pizlo <fpi...@apple.com>
Python implementation reports "MemoryError" instead of doing things
Added: trunk/LayoutTests/compositing/overflow/dynamic-composited-scrolling-status-expected.txt (0 => 139691)
--- trunk/LayoutTests/compositing/overflow/dynamic-composited-scrolling-status-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/overflow/dynamic-composited-scrolling-status-expected.txt 2013-01-15 01:13:45 UTC (rev 139691)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/compositing/overflow/dynamic-composited-scrolling-status.html (0 => 139691)
--- trunk/LayoutTests/compositing/overflow/dynamic-composited-scrolling-status.html (rev 0)
+++ trunk/LayoutTests/compositing/overflow/dynamic-composited-scrolling-status.html 2013-01-15 01:13:45 UTC (rev 139691)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ #container {
+ width: 200px;
+ height: 200px;
+ overflow: auto;
+ }
+
+ #content {
+ width: 100px;
+ height: 100px;
+ background-color: yellow;
+ }
+ </style>
+
+ <script type="text/_javascript_" charset="utf-8">
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ if (window.internals)
+ window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true);
+
+ function doTest()
+ {
+ document.body.offsetHeight;
+ document.getElementById('content').style.height = '1000px';
+ if (window.internals)
+ document.getElementById('result').innerText = window.internals.nonFastScrollableRects(document).length ? "FAIL" : "PASS";
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+
+<body>
+ <div id="container">
+ <div id="content"></div>
+ </div>
+ <pre id="result"></pre>
+</body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (139690 => 139691)
--- trunk/Source/WebCore/ChangeLog 2013-01-15 01:02:20 UTC (rev 139690)
+++ trunk/Source/WebCore/ChangeLog 2013-01-15 01:13:45 UTC (rev 139691)
@@ -1,3 +1,27 @@
+2013-01-14 Xianzhu Wang <wangxian...@chromium.org>
+
+ Sometimes RenderLayer::updateNeedsCompositedScrolling is not called
+ https://bugs.webkit.org/show_bug.cgi?id=106271
+
+ Reviewed by Simon Fraser.
+
+ 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):
+
2013-01-14 Ryosuke Niwa <rn...@webkit.org>
EFL build fix after r139681.
Modified: trunk/Source/WebCore/page/FrameView.cpp (139690 => 139691)
--- trunk/Source/WebCore/page/FrameView.cpp 2013-01-15 01:02:20 UTC (rev 139690)
+++ trunk/Source/WebCore/page/FrameView.cpp 2013-01-15 01:13:45 UTC (rev 139691)
@@ -3732,18 +3732,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: trunk/Source/WebCore/page/FrameView.h (139690 => 139691)
--- trunk/Source/WebCore/page/FrameView.h 2013-01-15 01:02:20 UTC (rev 139690)
+++ trunk/Source/WebCore/page/FrameView.h 2013-01-15 01:13:45 UTC (rev 139691)
@@ -346,8 +346,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: trunk/Source/WebCore/rendering/RenderLayer.cpp (139690 => 139691)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2013-01-15 01:02:20 UTC (rev 139690)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2013-01-15 01:13:45 UTC (rev 139691)
@@ -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())
@@ -990,9 +990,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;
@@ -1029,12 +1026,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) {
@@ -5546,10 +5543,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: trunk/Source/WebCore/rendering/RenderLayer.h (139690 => 139691)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2013-01-15 01:02:20 UTC (rev 139690)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2013-01-15 01:13:45 UTC (rev 139691)
@@ -474,6 +474,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