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

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

Issue 2386033002: Scale focus outline thickness with zoom level. (Closed)
Patch Set: return if outline width is 0 Created 4 years, 2 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: third_party/WebKit/Source/core/paint/ObjectPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/ObjectPainter.cpp b/third_party/WebKit/Source/core/paint/ObjectPainter.cpp
index 7de53eb78014465b96b3cf101223b4e8dad157e6..891c19cd8f325aa0fc1c364c2639b772898c69ff 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ObjectPainter.cpp
@@ -217,6 +217,16 @@ void fillQuad(GraphicsContext& context,
} // namespace
+float ObjectPainter::getOutlineStrokeWidth(const ComputedStyle& style) {
+#if OS(MACOSX)
+ return style.outlineWidth();
chrishtr 2016/10/07 21:14:21 Why this special case? Also, it apears there is t
Bret 2016/10/08 01:32:40 This is the same case, just moved around. See my o
+#else
+ // Draw an outline with thickness in proportion to the zoom level, but never
+ // less than 1 pixel so that it remains visible.
+ return std::max(style.effectiveZoom(), 1.f);
+#endif
+}
+
void ObjectPainter::paintOutline(const PaintInfo& paintInfo,
const LayoutPoint& paintOffset) {
ASSERT(shouldPaintSelfOutline(paintInfo.phase));
@@ -270,7 +280,7 @@ void ObjectPainter::paintOutline(const PaintInfo& paintInfo,
m_layoutObject.resolveColor(styleToUse, CSSPropertyOutlineColor);
if (styleToUse.outlineStyleIsAuto()) {
paintInfo.context.drawFocusRing(pixelSnappedOutlineRects,
- styleToUse.outlineWidth(),
+ getOutlineStrokeWidth(styleToUse),
styleToUse.outlineOffset(), color);
return;
}

Powered by Google App Engine
This is Rietveld 408576698