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

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

Issue 1321613002: Refactor ObjectPainter::paintOutline to take a paintOffset (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
Index: Source/core/paint/ObjectPainter.cpp
diff --git a/Source/core/paint/ObjectPainter.cpp b/Source/core/paint/ObjectPainter.cpp
index 2d43a1d15aa113439344e85312e0f0589606f9b2..8f7f42051639d0cccf2da6459c536dec9f932ae2 100644
--- a/Source/core/paint/ObjectPainter.cpp
+++ b/Source/core/paint/ObjectPainter.cpp
@@ -16,9 +16,10 @@
namespace blink {
-LayoutRect ObjectPainter::outlineBounds(const LayoutRect& objectBounds, const ComputedStyle& style)
+// TODO(pdr): This adjustment should be made to LayoutObject::paintInvalidationRectInLocalCoordinates.
+LayoutRect ObjectPainter::outlineRectForSVG(const LayoutSize& size, const ComputedStyle& style)
chrishtr 2015/08/27 04:20:41 This seems like an odd method to have, even tempor
pdr. 2015/08/27 05:00:17 SVG's paint invalidation rect concept needs a big
fs 2015/08/27 10:23:17 I can look into this if you like. I assume we want
{
- LayoutRect outlineBounds(objectBounds);
+ LayoutRect outlineBounds(LayoutPoint(), size);
outlineBounds.inflate(style.outlineOutsetExtent());
return outlineBounds;
}
@@ -32,7 +33,7 @@ void ObjectPainter::paintFocusRing(const PaintInfo& paintInfo, const ComputedSty
paintInfo.context->drawFocusRing(focusRingIntRects, style.outlineWidth(), style.outlineOffset(), m_layoutObject.resolveColor(style, CSSPropertyOutlineColor));
}
-void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutRect& objectBounds, const LayoutRect& visualOverflowBounds)
+void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutRect& visualOverflowRect, const LayoutSize& objectSize, const LayoutPoint& paintOffset)
{
const ComputedStyle& styleToUse = m_layoutObject.styleRef();
if (!styleToUse.hasOutline())
@@ -41,13 +42,15 @@ void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutRect& o
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutObject, paintInfo.phase))
return;
+ LayoutRect visualOverflowBounds(visualOverflowRect);
+ visualOverflowBounds.moveBy(paintOffset);
LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutObject, paintInfo.phase, visualOverflowBounds);
if (styleToUse.outlineStyleIsAuto()) {
if (LayoutTheme::theme().shouldDrawDefaultFocusRing(&m_layoutObject)) {
// Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
Vector<LayoutRect> focusRingRects;
- m_layoutObject.addOutlineRects(focusRingRects, objectBounds.location());
+ m_layoutObject.addOutlineRects(focusRingRects, paintOffset);
paintFocusRing(paintInfo, styleToUse, focusRingRects);
}
return;
@@ -56,7 +59,8 @@ void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutRect& o
if (styleToUse.outlineStyle() == BNONE)
return;
- LayoutRect inner(pixelSnappedIntRect(objectBounds));
+ LayoutRect inner(paintOffset, objectSize);
+ inner = LayoutRect(pixelSnappedIntRect(inner));
inner.inflate(styleToUse.outlineOffset());
LayoutRect outer(inner);

Powered by Google App Engine
This is Rietveld 408576698