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

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

Issue 251783004: Don't paint below image's baseline unless it is selected. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 7 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 | « LayoutTests/virtual/deferred/fast/images/do-not-paint-below-image-baseline-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderReplaced.cpp
diff --git a/Source/core/rendering/RenderReplaced.cpp b/Source/core/rendering/RenderReplaced.cpp
index 353f974bcd0a68e8ae1361e7457ee17ef4d388dc..f9a9be749b507f318f4f996936083ecda0b1f839 100644
--- a/Source/core/rendering/RenderReplaced.cpp
+++ b/Source/core/rendering/RenderReplaced.cpp
@@ -575,7 +575,15 @@ void RenderReplaced::setSelectionState(SelectionState state)
// The selection state for our containing block hierarchy is updated by the base class call.
RenderBox::setSelectionState(state);
- if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes())
+ if (!inlineBoxWrapper())
+ return;
+
+ // We only include the space below the baseline in our layer's cached repaint rect if the
+ // image is selected. Since the selection state has changed update the rect.
+ if (hasLayer())
+ layer()->repainter().computeRepaintRects(containerForRepaint());
Julien - ping for review 2014/05/16 12:41:46 Whenever RenderLayer needs to recompute its repain
rhogan 2014/05/16 21:05:47 The RAL call to setPreviousRepaintRectangle happen
Julien - ping for review 2014/05/19 09:31:36 Good point, you don't need to call it twice indeed
+
+ if (canUpdateSelectionOnRootLineBoxes())
inlineBoxWrapper()->root().setHasSelectedChildren(isSelected());
}
@@ -601,7 +609,6 @@ bool RenderReplaced::isSelected() const
ASSERT(0);
return false;
}
-
LayoutRect RenderReplaced::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
{
if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent())
@@ -609,7 +616,7 @@ LayoutRect RenderReplaced::clippedOverflowRectForRepaint(const RenderLayerModelO
// The selectionRect can project outside of the overflowRect, so take their union
// for repainting to avoid selection painting glitches.
- LayoutRect r = unionRect(localSelectionRect(false), visualOverflowRect());
+ LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect();
RenderView* v = view();
if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && v) {
« no previous file with comments | « LayoutTests/virtual/deferred/fast/images/do-not-paint-below-image-baseline-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698