Title: [135064] trunk/Source/WebCore
Revision 135064
Author simon.fra...@apple.com
Date 2012-11-17 23:09:58 -0800 (Sat, 17 Nov 2012)
Log Message
Don't say there are dirty overlay scrollbars when they are clipped out
https://bugs.webkit.org/show_bug.cgi?id=102609
Reviewed by Brady Eidson.
Painting overlay scrollbars involves a second painting pass over the entire
RenderLayer subtree for a compositing layer, which can be very expensive.
Avoid this when possible by detecting when overflow controls are not in
the damage rect.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::rectForHorizontalScrollbar): Compute a local rect
for the horizontal scrollbar.
(WebCore::RenderLayer::rectForVerticalScrollbar): Compute a local rect
for the vertical scrollbar.
(WebCore::RenderLayer::positionOverflowControls): Use rectForHorizontalScrollbar()
and rectForVerticalScrollbar().
(WebCore::RenderLayer::overflowControlsIntersectRect): Return true if any
of the present overflow controls intersect the given local rect.
(WebCore::RenderLayer::paintOverflowControls): Bail if the damage rect
doesn't intersect any of the overflow controls.
* rendering/RenderLayer.h:
(RenderLayer):
Modified Paths
trunk/Source/WebCore/ChangeLog
trunk/Source/WebCore/rendering/RenderLayer.cpp
trunk/Source/WebCore/rendering/RenderLayer.h
Diff
Modified: trunk/Source/WebCore/ChangeLog (135063 => 135064)
--- trunk/Source/WebCore/ChangeLog 2012-11-18 05:16:29 UTC (rev 135063)
+++ trunk/Source/WebCore/ChangeLog 2012-11-18 07:09:58 UTC (rev 135064)
@@ -1,3 +1,30 @@
+2012-11-17 Simon Fraser
+
+Don't say there are dirty overlay scrollbars when they are clipped out
+https://bugs.webkit.org/show_bug.cgi?id=102609
+
+Reviewed by Brady Eidson.
+
+Painting overlay scrollbars involves a second painting pass over the entire
+RenderLayer subtree for a compositing layer, which can be very expensive.
+
+Avoid this when possible by detecting when overflow controls are not in
+the damage rect.
+
+* rendering/RenderLayer.cpp:
+(WebCore::RenderLayer::rectForHorizontalScrollbar): Compute a local rect
+for the horizontal scrollbar.
+(WebCore::RenderLayer::rectForVerticalScrollbar): Compute a local rect
+for the vertical scrollbar.
+(WebCore::RenderLayer::positionOverflowControls): Use rectForHorizontalScrollbar()
+and rectForVerticalScrollbar().
+(WebCore::RenderLayer::overflowControlsIntersectRect): Return true if any
+of the present overflow controls intersect the given local rect.
+(WebCore::RenderLayer::paintOverflowControls): Bail if the damage rect
+doesn't intersect any of the overflow controls.
+* rendering/RenderLayer.h:
+(RenderLayer):
+
2012-11-17 Adam Barth
REGRESSION (r133633): ASSERTION FAILED: m_wrapper || !m_jsFunction
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (135063 => 135064)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-11-18 05:16:29 UTC (rev 135063)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-11-18 07:09:58 UTC (rev 135064)
@@ -2273,6 +2273,34 @@
return renderer()->frame() ? renderer()->frame()->eventHandler()->currentMousePosition() : IntPoint();
}
+IntRect RenderLayer::rectForHorizontalScrollbar(const IntRect& borderBoxRect) const
+{
+if (!m_hBar)
+return IntRect();
+
+const RenderBox* box = renderBox();
+const IntRect& scrollCorner = scrollCornerRect();
+
+return IntRect(horizontalScrollbarStart(borderBoxRect.x()),
+borderBoxRect.maxY() - box->borderBottom() - m_hBar->height(),
+borderBoxRect.width() - (box->borderLeft() + box->borderRight()) - scrollCorner.width(),
+m_hBar->height());
+}
+
+IntRect RenderLayer::rectForVerticalScrollbar(const IntRect& borderBoxRect) const
+{
+if (!m_vBar)
+return IntRect();
+
+const RenderBox* box = renderBox();
+const IntRect& scrollCorner = scrollCornerRect();
+
+return IntRect(verticalScrollbarStart(borderBoxRect.x(), borderBoxRect.maxX()),
+borderBoxRect.y() + box->borderTop(),
+m_vBar->width(),
+borderBoxRect.height() - (box->borderTop() + box->borderBottom()) - scrollCorner.height());
+}
+
LayoutUnit RenderLayer::verticalScrollbarStart(int minX, int maxX) const
{
const RenderBox* box = renderBox();
@@ -2495,18 +2523,18 @@
const IntRect borderBox = box->pixelSnappedBorderBoxRect();
const IntRect& scrollCorner = scrollCornerRect();
IntRect absBounds(borderBox.location() + offsetFromRoot, borderBox.size());
-if (m_vBar)
-m_vBar->setFrameRect(IntRect(verticalScrollbarStart(absBounds.x(), absBounds.maxX()),
- absBounds.y() + box->borderTop(),
- m_vBar->width(),
- absBounds.height() - (box->borderTop() + box->borderBottom()) - scrollC