Title: [249309] trunk/Source/WebCore
- Revision
- 249309
- Author
- simon.fra...@apple.com
- Date
- 2019-08-29 19:35:34 -0700 (Thu, 29 Aug 2019)
Log Message
Avoid running the outline painting phase if no renderers have outlines
https://bugs.webkit.org/show_bug.cgi?id=201284
Reviewed by Said Abou-Hallawa.
The outline painting phase (paintOutlineForFragments()) can take up to 20% of the painting time
even when there are no outlines. Keep track of which renderers have outlines, and only run the phase
when printing (for hasOutlineAnnotation()) or if there are any renderers with outlines.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::styleWillChange):
(WebCore::RenderElement::styleDidChange):
(WebCore::RenderElement::willBeDestroyed):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayerContents):
* rendering/RenderView.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (249308 => 249309)
--- trunk/Source/WebCore/ChangeLog 2019-08-30 01:57:01 UTC (rev 249308)
+++ trunk/Source/WebCore/ChangeLog 2019-08-30 02:35:34 UTC (rev 249309)
@@ -208,6 +208,25 @@
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::outputInlineRuns):
+2019-08-29 Simon Fraser <simon.fra...@apple.com>
+
+ Avoid running the outline painting phase if no renderers have outlines
+ https://bugs.webkit.org/show_bug.cgi?id=201284
+
+ Reviewed by Said Abou-Hallawa.
+
+ The outline painting phase (paintOutlineForFragments()) can take up to 20% of the painting time
+ even when there are no outlines. Keep track of which renderers have outlines, and only run the phase
+ when printing (for hasOutlineAnnotation()) or if there are any renderers with outlines.
+
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::styleWillChange):
+ (WebCore::RenderElement::styleDidChange):
+ (WebCore::RenderElement::willBeDestroyed):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::paintLayerContents):
+ * rendering/RenderView.h:
+
2019-08-29 Zalan Bujtas <za...@apple.com>
[LFC][TFC] Use the "complicated-cases" category for computing the TFC root's height
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (249308 => 249309)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2019-08-30 01:57:01 UTC (rev 249308)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2019-08-30 02:35:34 UTC (rev 249309)
@@ -769,6 +769,7 @@
setFloating(false);
clearPositionedState();
}
+
if (newStyle.hasPseudoStyle(PseudoId::FirstLine) || oldStyle->hasPseudoStyle(PseudoId::FirstLine))
invalidateCachedFirstLineStyle();
@@ -779,6 +780,15 @@
setHasReflection(false);
}
+ bool hadOutline = oldStyle && oldStyle->hasOutline();
+ bool hasOutline = newStyle.hasOutline();
+ if (hadOutline != hasOutline) {
+ if (hasOutline)
+ view().incrementRendersWithOutline();
+ else
+ view().decrementRendersWithOutline();
+ }
+
bool newStyleSlowScroll = false;
if (newStyle.hasFixedBackgroundImage() && !settings().fixedBackgroundsPaintRelativeToDocument()) {
newStyleSlowScroll = true;
@@ -851,6 +861,7 @@
if (oldStyle && !areCursorsEqual(oldStyle, &style()))
frame().eventHandler().scheduleCursorUpdate();
#endif
+
bool hadOutlineAuto = oldStyle && oldStyle->outlineStyleIsAuto() == OutlineIsAuto::On;
bool hasOutlineAuto = outlineStyleForRepaint().outlineStyleIsAuto() == OutlineIsAuto::On;
if (hasOutlineAuto != hadOutlineAuto) {
@@ -934,6 +945,9 @@
if (hasCounterNodeMap())
RenderCounter::destroyCounterNodes(*this);
+ if (style().hasOutline())
+ view().decrementRendersWithOutline();
+
RenderObject::willBeDestroyed();
clearSubtreeLayoutRootIfNeeded();
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (249308 => 249309)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-08-30 01:57:01 UTC (rev 249308)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-08-30 02:35:34 UTC (rev 249309)
@@ -4454,6 +4454,7 @@
// foreground phase. Since scrolled contents are moved by repainting in this
// case, the outline won't get 'dragged along'.
bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbars && !isCollectingEventRegion
+ && (renderer().view().printing() || renderer().view().hasRenderersWithOutline())
&& ((isPaintingScrollingContent && isPaintingCompositedBackground)
|| (!isPaintingScrollingContent && isPaintingCompositedForeground));
bool shouldPaintContent = m_hasVisibleContent && isSelfPaintingLayer && !isPaintingOverlayScrollbars && !isCollectingEventRegion;
Modified: trunk/Source/WebCore/rendering/RenderView.h (249308 => 249309)
--- trunk/Source/WebCore/rendering/RenderView.h 2019-08-30 01:57:01 UTC (rev 249308)
+++ trunk/Source/WebCore/rendering/RenderView.h 2019-08-30 02:35:34 UTC (rev 249309)
@@ -146,10 +146,14 @@
// requires walking the entire tree repeatedly and most pages don't actually use either
// feature so we shouldn't take the performance hit when not needed. Long term we should
// rewrite the counter code.
- void addRenderCounter() { m_renderCounterCount++; }
- void removeRenderCounter() { ASSERT(m_renderCounterCount > 0); m_renderCounterCount--; }
- bool hasRenderCounters() { return m_renderCounterCount; }
-
+ void addRenderCounter() { ++m_renderCounterCount; }
+ void removeRenderCounter() { ASSERT(m_renderCounterCount > 0); --m_renderCounterCount; }
+ bool hasRenderCounters() const { return m_renderCounterCount; }
+
+ void incrementRendersWithOutline() { ++m_renderersWithOutlineCount; }
+ void decrementRendersWithOutline() { ASSERT(m_renderersWithOutlineCount > 0); --m_renderersWithOutlineCount; }
+ bool hasRenderersWithOutline() const { return m_renderersWithOutlineCount; }
+
ImageQualityController& imageQualityController();
void setHasSoftwareFilters(bool hasSoftwareFilters) { m_hasSoftwareFilters = hasSoftwareFilters; }
@@ -241,6 +245,7 @@
bool m_hasQuotesNeedingUpdate { false };
unsigned m_renderCounterCount { 0 };
+ unsigned m_renderersWithOutlineCount { 0 };
bool m_hasSoftwareFilters { false };
bool m_usesFirstLineRules { false };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes