Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1192)

Unified Diff: Source/core/rendering/RenderBlock.cpp

Issue 16402019: Remove clips where we can show that they are unnecessary. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: NeedsRebaseline for Mac Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index e45654332c8c1a54d3280d5390b011419c0901f5..b5fa26bba1e7e65404fccdd4ea168870d84adde2 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -1739,8 +1739,7 @@ void RenderBlock::addOverflowFromChildren()
if (columnCount(colInfo)) {
LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);
addLayoutOverflow(lastRect);
- if (!hasOverflowClip())
- addVisualOverflow(lastRect);
+ addVisualOverflow(lastRect, VisualOverflowClippedByContentsClip);
}
}
}
@@ -1778,7 +1777,7 @@ void RenderBlock::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeF
if (textIndent < 0) {
LayoutRect clientRect(noOverflowRect());
LayoutRect rectToApply = LayoutRect(clientRect.x() + min<LayoutUnit>(0, textIndent), clientRect.y(), clientRect.width() - min<LayoutUnit>(0, textIndent), clientRect.height());
- addVisualOverflow(rectToApply);
+ addVisualOverflow(rectToApply, VisualOverflowClippedByContentsClip);
}
// Add visual overflow from box-shadow and border-image-outset.
@@ -1842,7 +1841,7 @@ void RenderBlock::addVisualOverflowFromTheme()
IntRect inflatedRect = pixelSnappedBorderBoxRect();
theme()->adjustRepaintRect(this, inflatedRect);
- addVisualOverflow(inflatedRect);
+ addVisualOverflow(inflatedRect, VisualOverflowNotClipped);
}
bool RenderBlock::expandsToEncloseOverhangingFloats() const
@@ -2930,7 +2929,13 @@ void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
return;
}
- bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset);
+ // There are some cases where not all clipped visual overflow is accounted for.
+ // FIXME: reduce the number of such cases.
+ ContentsClipBehavior contentsClipBehavior = ContentsClipRequired;
+ if (hasOverflowClip() && !hasControlClip() && !(shouldPaintSelectionGaps() && phase == PaintPhaseForeground) && !hasCaret())
+ contentsClipBehavior = ContentsClipAutomatic;
+
+ bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsClipBehavior);
paintObject(paintInfo, adjustedPaintOffset);
if (pushedClip)
popContentsClip(paintInfo, phase, adjustedPaintOffset);
@@ -3123,8 +3128,7 @@ void RenderBlock::paintChild(RenderBox* child, PaintInfo& paintInfo, const Layou
child->paint(paintInfo, childPoint);
}
-
-void RenderBlock::paintCaret(PaintInfo& paintInfo, const LayoutPoint& paintOffset, CaretType type)
+bool RenderBlock::hasCaret(CaretType type)
{
// Paint the caret if the FrameSelection says so or if caret browsing is enabled
bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsingEnabled();
@@ -3137,13 +3141,18 @@ void RenderBlock::paintCaret(PaintInfo& paintInfo, const LayoutPoint& paintOffse
caretPainter = frame()->page()->dragCaretController()->caretRenderer();
isContentEditable = frame()->page()->dragCaretController()->isContentEditable();
}
+ return caretPainter == this && (isContentEditable || caretBrowsing);
+}
- if (caretPainter == this && (isContentEditable || caretBrowsing)) {
- if (type == CursorCaret)
- frame()->selection()->paintCaret(paintInfo.context, paintOffset, paintInfo.rect);
- else
- frame()->page()->dragCaretController()->paintDragCaret(frame(), paintInfo.context, paintOffset, paintInfo.rect);
- }
+void RenderBlock::paintCaret(PaintInfo& paintInfo, const LayoutPoint& paintOffset, CaretType type)
+{
+ if (!hasCaret(type))
+ return;
+
+ if (type == CursorCaret)
+ frame()->selection()->paintCaret(paintInfo.context, paintOffset, paintInfo.rect);
+ else
+ frame()->page()->dragCaretController()->paintDragCaret(frame(), paintInfo.context, paintOffset, paintInfo.rect);
}
void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)

Powered by Google App Engine
This is Rietveld 408576698