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

Side by Side Diff: Source/core/layout/LayoutReplaced.cpp

Issue 1212213004: Simplify paint rect calculations in LayoutReplaced::shouldPaint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPha seMask && paintInfo.phase != PaintPhaseClippingMask) 117 && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPha seMask && paintInfo.phase != PaintPhaseClippingMask)
118 return false; 118 return false;
119 119
120 if (!paintInfo.shouldPaintWithinRoot(this)) 120 if (!paintInfo.shouldPaintWithinRoot(this))
121 return false; 121 return false;
122 122
123 // if we're invisible or haven't received a layout yet, then just bail. 123 // if we're invisible or haven't received a layout yet, then just bail.
124 if (style()->visibility() != VISIBLE) 124 if (style()->visibility() != VISIBLE)
125 return false; 125 return false;
126 126
127 LayoutPoint adjustedPaintOffset = paintOffset + location(); 127 LayoutRect paintRect(visualOverflowRect());
128 paintRect.moveBy(paintOffset + location());
128 129
129 // Early exit if the element touches the edges. 130 // Early exit if the element touches the edges.
130 LayoutUnit top = adjustedPaintOffset.y() + visualOverflowRect().y(); 131 LayoutUnit top = paintRect.y();
131 LayoutUnit bottom = adjustedPaintOffset.y() + visualOverflowRect().maxY(); 132 LayoutUnit bottom = paintRect.maxY();
132 if (isSelected() && inlineBoxWrapper()) { 133 if (isSelected() && inlineBoxWrapper()) {
133 LayoutUnit selTop = paintOffset.y() + inlineBoxWrapper()->root().selecti onTop(); 134 LayoutUnit selTop = paintOffset.y() + inlineBoxWrapper()->root().selecti onTop();
134 LayoutUnit selBottom = paintOffset.y() + selTop + inlineBoxWrapper()->ro ot().selectionHeight(); 135 LayoutUnit selBottom = paintOffset.y() + selTop + inlineBoxWrapper()->ro ot().selectionHeight();
135 top = std::min(selTop, top); 136 top = std::min(selTop, top);
136 bottom = std::max(selBottom, bottom); 137 bottom = std::max(selBottom, bottom);
137 } 138 }
138 139
139 if (adjustedPaintOffset.x() + visualOverflowRect().x() >= paintInfo.rect.max X() || adjustedPaintOffset.x() + visualOverflowRect().maxX() <= paintInfo.rect.x ()) 140 if (paintRect.x() >= paintInfo.rect.maxX() || paintRect.maxX() <= paintInfo. rect.x())
140 return false; 141 return false;
141 142
142 if (top >= paintInfo.rect.maxY() || bottom <= paintInfo.rect.y()) 143 if (top >= paintInfo.rect.maxY() || bottom <= paintInfo.rect.y())
143 return false; 144 return false;
144 145
145 return true; 146 return true;
146 } 147 }
147 148
148 bool LayoutReplaced::hasReplacedLogicalHeight() const 149 bool LayoutReplaced::hasReplacedLogicalHeight() const
149 { 150 {
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 return LayoutRect(); 511 return LayoutRect();
511 512
512 // The selectionRect can project outside of the overflowRect, so take their union 513 // The selectionRect can project outside of the overflowRect, so take their union
513 // for paint invalidation to avoid selection painting glitches. 514 // for paint invalidation to avoid selection painting glitches.
514 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); 515 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect();
515 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali dationState); 516 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali dationState);
516 return r; 517 return r;
517 } 518 }
518 519
519 } 520 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698