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

Unified Diff: third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp

Issue 2683973003: Remove GraphicsContext::focusRingOffset() (Closed)
Patch Set: Created 3 years, 10 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 | « third_party/WebKit/Source/platform/graphics/GraphicsContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp
index 49ebb7d73a25700614b7fe7f6e3f5b5805f058f3..172b402ba4606ff48e278205fe947285d5e63bdf 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp
@@ -333,6 +333,25 @@ void GraphicsContext::compositePicture(sk_sp<PaintRecord> picture,
m_canvas->restore();
}
+namespace {
+
+int adjustedFocusRingOffset(int offset) {
+#if OS(MACOSX)
+ return offset + 2;
+#else
+ return 0;
+#endif
+}
+
+} // anonymous ns
+
+int GraphicsContext::focusRingOutsetExtent(int offset, int width) {
+ // Unlike normal outlines (whole width is outside of the offset), focus
+ // rings are drawn with the center of the path aligned with the offset, so
+ // only half of the width is outside of the offset.
+ return adjustedFocusRingOffset(offset) + (width + 1) / 2;
+}
+
void GraphicsContext::drawFocusRingPath(const SkPath& path,
const Color& color,
float width) {
@@ -368,12 +387,12 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects,
return;
SkRegion focusRingRegion;
- offset = focusRingOffset(offset);
+ offset = adjustedFocusRingOffset(offset);
for (unsigned i = 0; i < rectCount; i++) {
SkIRect r = rects[i];
if (r.isEmpty())
continue;
- r.inset(-offset, -offset);
+ r.outset(offset, offset);
focusRingRegion.op(r, SkRegion::kUnion_Op);
}
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/GraphicsContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698