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

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

Issue 2499783002: Move SaturatedArithmetic from Blink to base (Closed)
Patch Set: Revert flag addition 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 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path; 2237 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path;
2238 } 2238 }
2239 2239
2240 int ComputedStyle::outlineOutsetExtent() const { 2240 int ComputedStyle::outlineOutsetExtent() const {
2241 if (!hasOutline()) 2241 if (!hasOutline())
2242 return 0; 2242 return 0;
2243 if (outlineStyleIsAuto()) { 2243 if (outlineStyleIsAuto()) {
2244 return GraphicsContext::focusRingOutsetExtent( 2244 return GraphicsContext::focusRingOutsetExtent(
2245 outlineOffset(), std::ceil(getOutlineStrokeWidthForFocusRing())); 2245 outlineOffset(), std::ceil(getOutlineStrokeWidthForFocusRing()));
2246 } 2246 }
2247 return std::max(0, saturatedAddition(outlineWidth(), outlineOffset())); 2247 return std::max(0, SaturatedAddition(outlineWidth(), outlineOffset()));
2248 } 2248 }
2249 2249
2250 float ComputedStyle::getOutlineStrokeWidthForFocusRing() const { 2250 float ComputedStyle::getOutlineStrokeWidthForFocusRing() const {
2251 #if OS(MACOSX) 2251 #if OS(MACOSX)
2252 return outlineWidth(); 2252 return outlineWidth();
2253 #else 2253 #else
2254 // Draw an outline with thickness in proportion to the zoom level, but never 2254 // Draw an outline with thickness in proportion to the zoom level, but never
2255 // less than 1 pixel so that it remains visible. 2255 // less than 1 pixel so that it remains visible.
2256 return std::max(effectiveZoom(), 1.f); 2256 return std::max(effectiveZoom(), 1.f);
2257 #endif 2257 #endif
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 if (value < 0) 2417 if (value < 0)
2418 fvalue -= 0.5f; 2418 fvalue -= 0.5f;
2419 else 2419 else
2420 fvalue += 0.5f; 2420 fvalue += 0.5f;
2421 } 2421 }
2422 2422
2423 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2423 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2424 } 2424 }
2425 2425
2426 } // namespace blink 2426 } // namespace blink
OLDNEW
« no previous file with comments | « base/numerics/saturated_arithmetic_unittest.cc ('k') | third_party/WebKit/Source/platform/LayoutUnit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698