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

Unified Diff: Source/core/paint/InlinePainter.cpp

Issue 1163913002: Improve outline bounds estimation in InlinePainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use linesVisualOverflowBoundingBox. Created 5 years, 6 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/paint/InlinePainter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/InlinePainter.cpp
diff --git a/Source/core/paint/InlinePainter.cpp b/Source/core/paint/InlinePainter.cpp
index bcbe040b8e0f38611a26d5f989ab4ad9305c5c99..56e79ff0d49092581a0bf0be2b6f7d1c55ffa8a0 100644
--- a/Source/core/paint/InlinePainter.cpp
+++ b/Source/core/paint/InlinePainter.cpp
@@ -29,6 +29,20 @@ void InlinePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(&m_layoutInline, paintInfo, paintOffset);
}
+LayoutRect InlinePainter::outlinePaintRect(const LayoutPoint& paintOffset) const
+{
+ const ComputedStyle& style = m_layoutInline.styleRef();
+ int outlineOutset;
chrishtr 2015/06/04 17:08:12 Why does linesVisualOverflowBoundingBox() not alre
fs 2015/06/05 10:19:52 Hmm, yes... the inflate(outlineSize) in LayoutInli
+ if (style.outlineStyleIsAuto())
+ outlineOutset = GraphicsContext::focusRingOutsetExtent(style.outlineOffset(), style.outlineWidth());
+ else
+ outlineOutset = style.outlineSize();
+ LayoutRect outlineRect = m_layoutInline.linesVisualOverflowBoundingBox();
+ outlineRect.inflate(outlineOutset);
+ outlineRect.moveBy(paintOffset);
+ return outlineRect;
+}
+
void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
const ComputedStyle& styleToUse = m_layoutInline.styleRef();
@@ -39,11 +53,8 @@ void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
if (LayoutTheme::theme().shouldDrawDefaultFocusRing(&m_layoutInline)) {
Vector<LayoutRect> focusRingRects;
m_layoutInline.addFocusRingRects(focusRingRects, paintOffset);
- LayoutRect focusRingBoundingRect;
- for (const auto& rect : focusRingRects)
- focusRingBoundingRect.unite(rect);
- LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutInline, paintInfo.phase, focusRingBoundingRect);
+ LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutInline, paintInfo.phase, outlinePaintRect(paintOffset));
if (recorder.canUseCachedDrawing())
return;
@@ -70,16 +81,7 @@ void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
Color outlineColor = m_layoutInline.resolveColor(styleToUse, CSSPropertyOutlineColor);
bool useTransparencyLayer = outlineColor.hasAlpha();
- int outlineWidth = styleToUse.outlineWidth();
- LayoutRect bounds;
- for (const auto& rect : rects) {
- LayoutRect rectCopy(rect);
- rectCopy.expand(LayoutSize(outlineWidth, outlineWidth));
- bounds.unite(rectCopy);
- }
- bounds.moveBy(paintOffset);
-
- LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutInline, paintInfo.phase, bounds);
+ LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutInline, paintInfo.phase, outlinePaintRect(paintOffset));
if (recorder.canUseCachedDrawing())
return;
« no previous file with comments | « Source/core/paint/InlinePainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698