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

Unified Diff: third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp

Issue 2794013002: Fewer reused duplicate symbol names in animation. (Closed)
Patch Set: Addressed review comments. Created 3 years, 8 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/animation/CSSFontWeightInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp
index f8c475a4b26214326fec5681897534288647e8f5..c2337e612b91381590dcaa58668dd65834000e6d 100644
--- a/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp
+++ b/third_party/WebKit/Source/core/animation/CSSFontWeightInterpolationType.cpp
@@ -4,50 +4,14 @@
#include "core/animation/CSSFontWeightInterpolationType.h"
+#include <memory>
+#include "core/animation/FontWeightConversion.h"
#include "core/css/CSSPrimitiveValueMappings.h"
#include "core/css/resolver/StyleResolverState.h"
#include "wtf/PtrUtil.h"
-#include <memory>
namespace blink {
-static double fontWeightToDouble(FontWeight fontWeight) {
- switch (fontWeight) {
- case FontWeight100:
- return 100;
- case FontWeight200:
- return 200;
- case FontWeight300:
- return 300;
- case FontWeight400:
- return 400;
- case FontWeight500:
- return 500;
- case FontWeight600:
- return 600;
- case FontWeight700:
- return 700;
- case FontWeight800:
- return 800;
- case FontWeight900:
- return 900;
- default:
- NOTREACHED();
- return 400;
- }
-}
-
-static FontWeight doubleToFontWeight(double value) {
- static const FontWeight fontWeights[] = {
- FontWeight100, FontWeight200, FontWeight300, FontWeight400, FontWeight500,
- FontWeight600, FontWeight700, FontWeight800, FontWeight900,
- };
-
- int index = round(value / 100 - 1);
- int clampedIndex = clampTo<int>(index, 0, WTF_ARRAY_LENGTH(fontWeights) - 1);
- return fontWeights[clampedIndex];
-}
-
class InheritedFontWeightChecker : public InterpolationType::ConversionChecker {
public:
static std::unique_ptr<InheritedFontWeightChecker> create(

Powered by Google App Engine
This is Rietveld 408576698