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

Unified Diff: Source/platform/graphics/GraphicsContext.h

Issue 1269123002: Preparation for combining paths of focus rings and outlines (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove debug from fast/css/focus-ring-recursive-continuations.html 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/platform/graphics/GraphicsContext.h
diff --git a/Source/platform/graphics/GraphicsContext.h b/Source/platform/graphics/GraphicsContext.h
index dbdb02a5967bed35655899a16d8d54fd566eb7c5..e1db89e87ead65b0d8f8b8b5b68d7e915245ccad 100644
--- a/Source/platform/graphics/GraphicsContext.h
+++ b/Source/platform/graphics/GraphicsContext.h
@@ -271,9 +271,17 @@ public:
static int focusRingOutsetExtent(int offset, int width)
{
- return focusRingOutset(offset) + (focusRingWidth(width) + 1) / 2;
+ // 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 focusRingOffset(offset) + (focusRingWidth(width) + 1) / 2;
}
+#if OS(MACOSX)
+ static int focusRingWidth(int width) { return width; }
+#else
+ static int focusRingWidth(int width) { return 1; }
+#endif
+
// public decl needed for OwnPtr wrapper.
class RecordingState;
@@ -300,11 +308,9 @@ private:
static void setPathFromPoints(SkPath*, size_t, const FloatPoint*);
#if OS(MACOSX)
- static inline int focusRingOutset(int offset) { return offset + 2; }
- static inline int focusRingWidth(int width) { return width; }
+ static inline int focusRingOffset(int offset) { return offset + 2; }
#else
- static inline int focusRingOutset(int offset) { return 0; }
- static inline int focusRingWidth(int width) { return 1; }
+ static inline int focusRingOffset(int offset) { return 0; }
static SkPMColor lineColors(int);
static SkPMColor antiColors1(int);
static SkPMColor antiColors2(int);

Powered by Google App Engine
This is Rietveld 408576698