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

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

Issue 2499783002: Move SaturatedArithmetic from Blink to base (Closed)
Patch Set: Readd files oops Created 4 years, 1 month 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 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path; 2236 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path;
2237 } 2237 }
2238 2238
2239 int ComputedStyle::outlineOutsetExtent() const { 2239 int ComputedStyle::outlineOutsetExtent() const {
2240 if (!hasOutline()) 2240 if (!hasOutline())
2241 return 0; 2241 return 0;
2242 if (outlineStyleIsAuto()) { 2242 if (outlineStyleIsAuto()) {
2243 return GraphicsContext::focusRingOutsetExtent( 2243 return GraphicsContext::focusRingOutsetExtent(
2244 outlineOffset(), std::ceil(getOutlineStrokeWidthForFocusRing())); 2244 outlineOffset(), std::ceil(getOutlineStrokeWidthForFocusRing()));
2245 } 2245 }
2246 return std::max(0, saturatedAddition(outlineWidth(), outlineOffset())); 2246 return std::max(0, SaturatedAddition(outlineWidth(), outlineOffset()));
2247 } 2247 }
2248 2248
2249 float ComputedStyle::getOutlineStrokeWidthForFocusRing() const { 2249 float ComputedStyle::getOutlineStrokeWidthForFocusRing() const {
2250 #if OS(MACOSX) 2250 #if OS(MACOSX)
2251 return outlineWidth(); 2251 return outlineWidth();
2252 #else 2252 #else
2253 // Draw an outline with thickness in proportion to the zoom level, but never 2253 // Draw an outline with thickness in proportion to the zoom level, but never
2254 // less than 1 pixel so that it remains visible. 2254 // less than 1 pixel so that it remains visible.
2255 return std::max(effectiveZoom(), 1.f); 2255 return std::max(effectiveZoom(), 1.f);
2256 #endif 2256 #endif
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2416 if (value < 0) 2416 if (value < 0)
2417 fvalue -= 0.5f; 2417 fvalue -= 0.5f;
2418 else 2418 else
2419 fvalue += 0.5f; 2419 fvalue += 0.5f;
2420 } 2420 }
2421 2421
2422 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2422 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2423 } 2423 }
2424 2424
2425 } // namespace blink 2425 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698