Modified: trunk/Source/WebCore/ChangeLog (181694 => 181695)
--- trunk/Source/WebCore/ChangeLog 2015-03-18 16:15:17 UTC (rev 181694)
+++ trunk/Source/WebCore/ChangeLog 2015-03-18 16:22:04 UTC (rev 181695)
@@ -1,3 +1,22 @@
+2015-03-17 Simon Fraser <[email protected]>
+
+ Skip trying to paint overlay scrollbars when there are none or they are clipped out
+ https://bugs.webkit.org/show_bug.cgi?id=142811
+ rdar://problem/20200725
+
+ Reviewed by Darin Adler.
+
+ In some content with lots of layers and overflow:scroll, we could spend 20% of
+ the time under paintOverflowControlsForFragments() setting up an (empty) clip,
+ and then trying to draw scrollbars that we don't have.
+
+ Avoid calling paintOverflowControlsForFragments() if there are no scrollbars,
+ and don't both setting up an empty clip just to paint nothing.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::paintLayerContents):
+ (WebCore::RenderLayer::paintOverflowControlsForFragments):
+
2015-03-18 Per Arne Vollan <[email protected]>
[WinCairo] Unreviewed build fix after r181665.
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (181694 => 181695)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2015-03-18 16:15:17 UTC (rev 181694)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2015-03-18 16:22:04 UTC (rev 181695)
@@ -4319,7 +4319,7 @@
paintFlowThreadIfRegionForFragments(layerFragments, context, localPaintingInfo, localPaintFlags);
}
- if (isPaintingOverlayScrollbars)
+ if (isPaintingOverlayScrollbars && hasScrollbars())
paintOverflowControlsForFragments(layerFragments, context, localPaintingInfo);
if (filterPainter) {
@@ -4615,8 +4615,7 @@
const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
RenderObject* subtreePaintRootForRenderer)
{
- for (size_t i = 0; i < layerFragments.size(); ++i) {
- const LayerFragment& fragment = layerFragments.at(i);
+ for (const auto& fragment : layerFragments) {
if (!fragment.shouldPaintContent)
continue;
@@ -4646,8 +4645,7 @@
{
// Begin transparency if we have something to paint.
if (haveTransparency) {
- for (size_t i = 0; i < layerFragments.size(); ++i) {
- const LayerFragment& fragment = layerFragments.at(i);
+ for (const auto& fragment : layerFragments) {
if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty()) {
beginTransparencyLayers(transparencyLayerContext, localPaintingInfo, transparencyPaintDirtyRect);
break;
@@ -4703,8 +4701,7 @@
{
bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1;
- for (size_t i = 0; i < layerFragments.size(); ++i) {
- const LayerFragment& fragment = layerFragments.at(i);
+ for (const auto& fragment : layerFragments) {
if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty())
continue;
@@ -4724,8 +4721,7 @@
void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
PaintBehavior paintBehavior, RenderObject* subtreePaintRootForRenderer)
{
- for (size_t i = 0; i < layerFragments.size(); ++i) {
- const LayerFragment& fragment = layerFragments.at(i);
+ for (const auto& fragment : layerFragments) {
if (fragment.outlineRect.isEmpty())
continue;
@@ -4740,8 +4736,7 @@
void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
RenderObject* subtreePaintRootForRenderer)
{
- for (size_t i = 0; i < layerFragments.size(); ++i) {
- const LayerFragment& fragment = layerFragments.at(i);
+ for (const auto& fragment : layerFragments) {
if (!fragment.shouldPaintContent)
continue;
@@ -4761,8 +4756,7 @@
void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
RenderObject* subtreePaintRootForRenderer)
{
- for (size_t i = 0; i < layerFragments.size(); ++i) {
- const LayerFragment& fragment = layerFragments.at(i);
+ for (const auto& fragment : layerFragments) {
if (!fragment.shouldPaintContent)
continue;
@@ -4780,8 +4774,9 @@
void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo)
{
- for (size_t i = 0; i < layerFragments.size(); ++i) {
- const LayerFragment& fragment = layerFragments.at(i);
+ for (const auto& fragment : layerFragments) {
+ if (fragment.backgroundRect.isEmpty())
+ continue;
clipToRect(localPaintingInfo, context, fragment.backgroundRect);
paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)),
snappedIntRect(fragment.backgroundRect.rect()), true);