Title: [120770] trunk/Source/WebCore
- Revision
- 120770
- Author
- [email protected]
- Date
- 2012-06-19 16:39:16 -0700 (Tue, 19 Jun 2012)
Log Message
Align RenderLayer's descendant dependent flags semantics
https://bugs.webkit.org/show_bug.cgi?id=89241
Reviewed by Simon Fraser.
Refactoring only, covered by existing tests.
This change aligns the naming and implementation of the different descendant
dependent flags. While aligning, I found some bugs (inefficiencies) with how
the visible descendant flags was computed.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::setHasVisibleContent):
Changed this method to not take a boolean as every callers was passing 'true'.
Reworked the logic under this assumption.
(WebCore::RenderLayer::dirtyVisibleContentStatus):
Updated after the following renaming.
(WebCore::RenderLayer::dirtyAncestorChainVisibleDescendantStatus):
Renamed this function from dirtyVisibleDescendantStatus to match the hasSelfPaintingLayer
naming and implementation.
(WebCore::RenderLayer::setAncestorChainHasVisibleDescendant):
Added this function to factor the visible descendant setting out of defunct childVisibilityChanged.
Also improved the efficiency of the function by clearing the dirty flag as it goes up (an unnoticed bug).
(WebCore::RenderLayer::addChild):
(WebCore::RenderLayer::removeChild):
Updated to use the new functions lieu of childVisibilityChanged.
* rendering/RenderLayer.h:
(RenderLayer::childVisibilityChanged):
Removed this function as it wasn't adding much and it's a lot more clear to call
dirtyAncestorChainVisibleDescendantStatus / setAncestorChainHasVisibleDescendant.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::styleWillChange):
* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::appendChildNode):
(WebCore::RenderObjectChildList::insertChildNode):
Updated those callers after removing the boolean parameter from setHasVisibleContent.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (120769 => 120770)
--- trunk/Source/WebCore/ChangeLog 2012-06-19 23:21:03 UTC (rev 120769)
+++ trunk/Source/WebCore/ChangeLog 2012-06-19 23:39:16 UTC (rev 120770)
@@ -1,3 +1,47 @@
+2012-06-19 Julien Chaffraix <[email protected]>
+
+ Align RenderLayer's descendant dependent flags semantics
+ https://bugs.webkit.org/show_bug.cgi?id=89241
+
+ Reviewed by Simon Fraser.
+
+ Refactoring only, covered by existing tests.
+
+ This change aligns the naming and implementation of the different descendant
+ dependent flags. While aligning, I found some bugs (inefficiencies) with how
+ the visible descendant flags was computed.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::setHasVisibleContent):
+ Changed this method to not take a boolean as every callers was passing 'true'.
+ Reworked the logic under this assumption.
+
+ (WebCore::RenderLayer::dirtyVisibleContentStatus):
+ Updated after the following renaming.
+
+ (WebCore::RenderLayer::dirtyAncestorChainVisibleDescendantStatus):
+ Renamed this function from dirtyVisibleDescendantStatus to match the hasSelfPaintingLayer
+ naming and implementation.
+
+ (WebCore::RenderLayer::setAncestorChainHasVisibleDescendant):
+ Added this function to factor the visible descendant setting out of defunct childVisibilityChanged.
+ Also improved the efficiency of the function by clearing the dirty flag as it goes up (an unnoticed bug).
+
+ (WebCore::RenderLayer::addChild):
+ (WebCore::RenderLayer::removeChild):
+ Updated to use the new functions lieu of childVisibilityChanged.
+ * rendering/RenderLayer.h:
+ (RenderLayer::childVisibilityChanged):
+ Removed this function as it wasn't adding much and it's a lot more clear to call
+ dirtyAncestorChainVisibleDescendantStatus / setAncestorChainHasVisibleDescendant.
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::styleWillChange):
+ * rendering/RenderObjectChildList.cpp:
+ (WebCore::RenderObjectChildList::appendChildNode):
+ (WebCore::RenderObjectChildList::insertChildNode):
+ Updated those callers after removing the boolean parameter from setHasVisibleContent.
+
2012-06-19 Andrey Adaikin <[email protected]>
Web Inspector: Extract InjectedScriptBase class from the InjectedScript
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (120769 => 120770)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-06-19 23:21:03 UTC (rev 120769)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-06-19 23:39:16 UTC (rev 120770)
@@ -632,53 +632,56 @@
}
}
-void RenderLayer::setHasVisibleContent(bool b)
+void RenderLayer::setHasVisibleContent()
{
- if (m_hasVisibleContent == b && !m_visibleContentStatusDirty)
+ if (m_hasVisibleContent && !m_visibleContentStatusDirty) {
+ ASSERT(!parent() || parent()->hasVisibleDescendant());
return;
+ }
+
m_visibleContentStatusDirty = false;
- m_hasVisibleContent = b;
- if (m_hasVisibleContent) {
- computeRepaintRects();
- if (!isNormalFlowOnly()) {
- for (RenderLayer* sc = stackingContext(); sc; sc = sc->stackingContext()) {
- sc->dirtyZOrderLists();
- if (sc->hasVisibleContent())
- break;
- }
+ m_hasVisibleContent = true;
+ computeRepaintRects();
+ if (!isNormalFlowOnly()) {
+ // We don't collect invisible layers in z-order lists if we are not in compositing mode.
+ // As we became visible, we need to dirty our stacking contexts ancestors to be properly
+ // collected. FIXME: When compositing, we could skip this dirtying phase.
+ for (RenderLayer* sc = stackingContext(); sc; sc = sc->stackingContext()) {
+ sc->dirtyZOrderLists();
+ if (sc->hasVisibleContent())
+ break;
}
}
+
if (parent())
- parent()->childVisibilityChanged(m_hasVisibleContent);
+ parent()->setAncestorChainHasVisibleDescendant();
}
void RenderLayer::dirtyVisibleContentStatus()
{
m_visibleContentStatusDirty = true;
if (parent())
- parent()->dirtyVisibleDescendantStatus();
+ parent()->dirtyAncestorChainVisibleDescendantStatus();
}
-void RenderLayer::childVisibilityChanged(bool newVisibility)
-{
- if (m_hasVisibleDescendant == newVisibility || m_visibleDescendantStatusDirty)
- return;
- if (newVisibility) {
- RenderLayer* l = this;
- while (l && !l->m_visibleDescendantStatusDirty && !l->m_hasVisibleDescendant) {
- l->m_hasVisibleDescendant = true;
- l = l->parent();
- }
- } else
- dirtyVisibleDescendantStatus();
+void RenderLayer::dirtyAncestorChainVisibleDescendantStatus()
+{
+ for (RenderLayer* layer = this; layer; layer = layer->parent()) {
+ if (layer->m_visibleDescendantStatusDirty)
+ break;
+
+ layer->m_visibleDescendantStatusDirty = true;
+ }
}
-void RenderLayer::dirtyVisibleDescendantStatus()
+void RenderLayer::setAncestorChainHasVisibleDescendant()
{
- RenderLayer* l = this;
- while (l && !l->m_visibleDescendantStatusDirty) {
- l->m_visibleDescendantStatusDirty = true;
- l = l->parent();
+ for (RenderLayer* layer = this; layer; layer = layer->parent()) {
+ if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendant())
+ break;
+
+ layer->m_hasVisibleDescendant = true;
+ layer->m_visibleDescendantStatusDirty = false;
}
}
@@ -1277,7 +1280,7 @@
child->updateDescendantDependentFlags();
if (child->m_hasVisibleContent || child->m_hasVisibleDescendant)
- childVisibilityChanged(true);
+ setAncestorChainHasVisibleDescendant();
if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant())
setAncestorChainHasSelfPaintingLayerDescendant();
@@ -1320,7 +1323,7 @@
oldChild->updateDescendantDependentFlags();
if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)
- childVisibilityChanged(false);
+ dirtyAncestorChainVisibleDescendantStatus();
if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescendant())
dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (120769 => 120770)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2012-06-19 23:21:03 UTC (rev 120769)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2012-06-19 23:39:16 UTC (rev 120770)
@@ -441,7 +441,8 @@
// ditto for hasVisibleDescendant(), see https://bugs.webkit.org/show_bug.cgi?id=71277
bool hasVisibleContent() const { return m_hasVisibleContent; }
bool hasVisibleDescendant() const { return m_hasVisibleDescendant; }
- void setHasVisibleContent(bool);
+
+ void setHasVisibleContent();
void dirtyVisibleContentStatus();
// FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but we hit the same bugs as visible content above.
@@ -782,8 +783,8 @@
void updateScrollableAreaSet(bool hasOverflow);
- void childVisibilityChanged(bool newVisibility);
- void dirtyVisibleDescendantStatus();
+ void dirtyAncestorChainVisibleDescendantStatus();
+ void setAncestorChainHasVisibleDescendant();
void updateDescendantDependentFlags();
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (120769 => 120770)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2012-06-19 23:21:03 UTC (rev 120769)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2012-06-19 23:39:16 UTC (rev 120770)
@@ -1789,7 +1789,7 @@
if (m_style->visibility() != newStyle->visibility()) {
if (RenderLayer* l = enclosingLayer()) {
if (newStyle->visibility() == VISIBLE)
- l->setHasVisibleContent(true);
+ l->setHasVisibleContent();
else if (l->hasVisibleContent() && (this == l->renderer() || l->renderer()->style()->visibility() != VISIBLE)) {
l->dirtyVisibleContentStatus();
if (diff > StyleDifferenceRepaintLayer)
Modified: trunk/Source/WebCore/rendering/RenderObjectChildList.cpp (120769 => 120770)
--- trunk/Source/WebCore/rendering/RenderObjectChildList.cpp 2012-06-19 23:21:03 UTC (rev 120769)
+++ trunk/Source/WebCore/rendering/RenderObjectChildList.cpp 2012-06-19 23:39:16 UTC (rev 120770)
@@ -194,7 +194,7 @@
if (!layer)
layer = owner->enclosingLayer();
if (layer)
- layer->setHasVisibleContent(true);
+ layer->setHasVisibleContent();
}
if (newChild->isListItem())
@@ -261,7 +261,7 @@
if (!layer)
layer = owner->enclosingLayer();
if (layer)
- layer->setHasVisibleContent(true);
+ layer->setHasVisibleContent();
}
if (child->isListItem())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes