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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2386033002: Scale focus outline thickness with zoom level. (Closed)
Patch Set: merge conflicts 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 } 2177 }
2178 } 2178 }
2179 2179
2180 void ComputedStyle::setOffsetPath(PassRefPtr<StylePath> path) { 2180 void ComputedStyle::setOffsetPath(PassRefPtr<StylePath> path) {
2181 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path; 2181 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path;
2182 } 2182 }
2183 2183
2184 int ComputedStyle::outlineOutsetExtent() const { 2184 int ComputedStyle::outlineOutsetExtent() const {
2185 if (!hasOutline()) 2185 if (!hasOutline())
2186 return 0; 2186 return 0;
2187 if (outlineStyleIsAuto()) 2187 if (outlineStyleIsAuto()) {
2188 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), 2188 return GraphicsContext::focusRingOutsetExtent(
2189 outlineWidth()); 2189 outlineOffset(), getOutlineStrokeWidthForFocusRing());
2190 }
2190 return std::max(0, saturatedAddition(outlineWidth(), outlineOffset())); 2191 return std::max(0, saturatedAddition(outlineWidth(), outlineOffset()));
2191 } 2192 }
2192 2193
2194 float ComputedStyle::getOutlineStrokeWidthForFocusRing() const {
2195 #if OS(MACOSX)
2196 return outlineWidth();
2197 #else
2198 // Draw an outline with thickness in proportion to the zoom level, but never
2199 // less than 1 pixel so that it remains visible.
2200 return std::max(effectiveZoom(), 1.f);
2201 #endif
2202 }
2203
2193 bool ComputedStyle::columnRuleEquivalent( 2204 bool ComputedStyle::columnRuleEquivalent(
2194 const ComputedStyle* otherStyle) const { 2205 const ComputedStyle* otherStyle) const {
2195 return columnRuleStyle() == otherStyle->columnRuleStyle() && 2206 return columnRuleStyle() == otherStyle->columnRuleStyle() &&
2196 columnRuleWidth() == otherStyle->columnRuleWidth() && 2207 columnRuleWidth() == otherStyle->columnRuleWidth() &&
2197 visitedDependentColor(CSSPropertyColumnRuleColor) == 2208 visitedDependentColor(CSSPropertyColumnRuleColor) ==
2198 otherStyle->visitedDependentColor(CSSPropertyColumnRuleColor); 2209 otherStyle->visitedDependentColor(CSSPropertyColumnRuleColor);
2199 } 2210 }
2200 2211
2201 TextEmphasisMark ComputedStyle::getTextEmphasisMark() const { 2212 TextEmphasisMark ComputedStyle::getTextEmphasisMark() const {
2202 TextEmphasisMark mark = 2213 TextEmphasisMark mark =
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2350 if (value < 0) 2361 if (value < 0)
2351 fvalue -= 0.5f; 2362 fvalue -= 0.5f;
2352 else 2363 else
2353 fvalue += 0.5f; 2364 fvalue += 0.5f;
2354 } 2365 }
2355 2366
2356 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2367 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2357 } 2368 }
2358 2369
2359 } // namespace blink 2370 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/platform/graphics/GraphicsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698