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

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

Issue 1201753003: Apply outline-offset on all edges (not just top/left) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | « LayoutTests/paint/inline/outline-offset.html ('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 4e56587396dde67b336a8937d5a0d18943de3fb9..3fd2a23950103acd6e260ed7c168edd433971a16 100644
--- a/Source/core/paint/InlinePainter.cpp
+++ b/Source/core/paint/InlinePainter.cpp
@@ -99,6 +99,14 @@ void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
graphicsContext->endLayer();
}
+static IntRect pixelSnappedOutsetPaintRect(const LayoutRect& baseRect, const LayoutPoint& paintOffset, int outset)
+{
+ LayoutRect box(baseRect);
+ box.moveBy(paintOffset);
+ box.inflate(outset);
+ return pixelSnappedIntRect(box);
+}
+
void InlinePainter::paintOutlineForLine(GraphicsContext* graphicsContext, const LayoutPoint& paintOffset,
const LayoutRect& lastline, const LayoutRect& thisline, const LayoutRect& nextline, const Color outlineColor)
{
@@ -108,15 +116,12 @@ void InlinePainter::paintOutlineForLine(GraphicsContext* graphicsContext, const
int offset = m_layoutInline.style()->outlineOffset();
- LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOffset.y() + thisline.y() - offset),
- LayoutSize(thisline.width() + offset, thisline.height() + offset));
-
- IntRect pixelSnappedBox = pixelSnappedIntRect(box);
+ IntRect pixelSnappedBox = pixelSnappedOutsetPaintRect(thisline, paintOffset, offset);
if (pixelSnappedBox.width() < 0 || pixelSnappedBox.height() < 0)
return;
// Note that we use IntRect below for working with solely x/width values, simplifying logic at cost of a bit of memory.
- IntRect pixelSnappedLastLine = pixelSnappedIntRect(paintOffset.x() + lastline.x() - offset, 0, lastline.width() + offset, 0);
- IntRect pixelSnappedNextLine = pixelSnappedIntRect(paintOffset.x() + nextline.x() - offset, 0, nextline.width() + offset, 0);
+ IntRect pixelSnappedLastLine = pixelSnappedOutsetPaintRect(lastline, paintOffset, offset);
+ IntRect pixelSnappedNextLine = pixelSnappedOutsetPaintRect(nextline, paintOffset, offset);
const int fallbackMaxOutlineX = std::numeric_limits<int>::max();
const int fallbackMinOutlineX = std::numeric_limits<int>::min();
« no previous file with comments | « LayoutTests/paint/inline/outline-offset.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698