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

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: per jchaffraix Created 7 years, 4 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
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index 7bcd38128ca91e905ead950db44efdeabdcb486b..273ebeb3a9aa795ea14b4a94db5de860336095ba 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -1714,8 +1714,7 @@ void RenderBlock::addOverflowFromChildren()
if (columnCount(colInfo)) {
LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);
addLayoutOverflow(lastRect);
- if (!hasOverflowClip())
- addVisualOverflow(lastRect);
+ addContentsVisualOverflow(lastRect);
}
}
}
@@ -1753,7 +1752,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);
+ addContentsVisualOverflow(rectToApply);
}
// Add visual overflow from box-shadow and border-image-outset.
@@ -2904,7 +2903,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 = ForceContentsClip;
+ if (hasOverflowClip() && !hasControlClip() && !(shouldPaintSelectionGaps() && phase == PaintPhaseForeground) && !hasCaret())
+ contentsClipBehavior = SkipContentsClipIfPossible;
+
+ bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsClipBehavior);
paintObject(paintInfo, adjustedPaintOffset);
if (pushedClip)
popContentsClip(paintInfo, phase, adjustedPaintOffset);
@@ -3097,8 +3102,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) const
{
// Paint the caret if the FrameSelection says so or if caret browsing is enabled
bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsingEnabled();
@@ -3111,13 +3115,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)
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | Source/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698