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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 2100013002: Implement the new text-size-adjust CSS property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update checks for multiplier < 1 Created 4 years, 5 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 27 matching lines...) Expand all
38 #include "core/css/CSSPathValue.h" 38 #include "core/css/CSSPathValue.h"
39 #include "core/css/CSSPrimitiveValueMappings.h" 39 #include "core/css/CSSPrimitiveValueMappings.h"
40 #include "core/css/CSSQuadValue.h" 40 #include "core/css/CSSQuadValue.h"
41 #include "core/css/CSSReflectValue.h" 41 #include "core/css/CSSReflectValue.h"
42 #include "core/css/CSSShadowValue.h" 42 #include "core/css/CSSShadowValue.h"
43 #include "core/css/CSSStringValue.h" 43 #include "core/css/CSSStringValue.h"
44 #include "core/css/CSSURIValue.h" 44 #include "core/css/CSSURIValue.h"
45 #include "core/css/CSSValuePair.h" 45 #include "core/css/CSSValuePair.h"
46 #include "core/css/resolver/FilterOperationResolver.h" 46 #include "core/css/resolver/FilterOperationResolver.h"
47 #include "core/frame/LocalFrame.h" 47 #include "core/frame/LocalFrame.h"
48 #include "core/style/TextSizeAdjust.h"
48 #include "core/svg/SVGURIReference.h" 49 #include "core/svg/SVGURIReference.h"
49 #include "platform/transforms/RotateTransformOperation.h" 50 #include "platform/transforms/RotateTransformOperation.h"
50 #include "platform/transforms/ScaleTransformOperation.h" 51 #include "platform/transforms/ScaleTransformOperation.h"
51 #include "platform/transforms/TranslateTransformOperation.h" 52 #include "platform/transforms/TranslateTransformOperation.h"
52 #include <algorithm> 53 #include <algorithm>
53 54
54 namespace blink { 55 namespace blink {
55 56
56 namespace { 57 namespace {
57 58
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 float StyleBuilderConverter::convertTextStrokeWidth(StyleResolverState& state, c onst CSSValue& value) 931 float StyleBuilderConverter::convertTextStrokeWidth(StyleResolverState& state, c onst CSSValue& value)
931 { 932 {
932 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 933 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
933 if (primitiveValue.getValueID()) { 934 if (primitiveValue.getValueID()) {
934 float multiplier = convertLineWidth<float>(state, value); 935 float multiplier = convertLineWidth<float>(state, value);
935 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::Uni tType::Ems)->computeLength<float>(state.cssToLengthConversionData()); 936 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::Uni tType::Ems)->computeLength<float>(state.cssToLengthConversionData());
936 } 937 }
937 return primitiveValue.computeLength<float>(state.cssToLengthConversionData() ); 938 return primitiveValue.computeLength<float>(state.cssToLengthConversionData() );
938 } 939 }
939 940
941 TextSizeAdjust StyleBuilderConverter::convertTextSizeAdjust(StyleResolverState& state, const CSSValue& value)
942 {
943 if (value.isPrimitiveValue()) {
Timothy Loh 2016/06/28 00:50:25 I'd probably write const CSSPrimitiveValue& primi
pdr. 2016/06/28 16:38:57 I wasn't sure this would work but it is better tha
944 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
945
946 if (primitiveValue.getValueID() == CSSValueNone)
947 return TextSizeAdjust::adjustNone();
948
949 if (primitiveValue.isPercentage())
950 return TextSizeAdjust(primitiveValue.getFloatValue() / 100.0f);
951 }
952
953 return TextSizeAdjust::adjustAuto();
954 }
955
940 TransformOrigin StyleBuilderConverter::convertTransformOrigin(StyleResolverState & state, const CSSValue& value) 956 TransformOrigin StyleBuilderConverter::convertTransformOrigin(StyleResolverState & state, const CSSValue& value)
941 { 957 {
942 const CSSValueList& list = toCSSValueList(value); 958 const CSSValueList& list = toCSSValueList(value);
943 ASSERT(list.length() == 3); 959 ASSERT(list.length() == 3);
944 960
945 const CSSPrimitiveValue& primitiveValueX = toCSSPrimitiveValue(list.item(0)) ; 961 const CSSPrimitiveValue& primitiveValueX = toCSSPrimitiveValue(list.item(0)) ;
946 const CSSPrimitiveValue& primitiveValueY = toCSSPrimitiveValue(list.item(1)) ; 962 const CSSPrimitiveValue& primitiveValueY = toCSSPrimitiveValue(list.item(1)) ;
947 const CSSPrimitiveValue& primitiveValueZ = toCSSPrimitiveValue(list.item(2)) ; 963 const CSSPrimitiveValue& primitiveValueZ = toCSSPrimitiveValue(list.item(2)) ;
948 964
949 return TransformOrigin( 965 return TransformOrigin(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 1062
1047 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) 1063 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value)
1048 { 1064 {
1049 if (value.isPathValue()) 1065 if (value.isPathValue())
1050 return toCSSPathValue(value).stylePath(); 1066 return toCSSPathValue(value).stylePath();
1051 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); 1067 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone);
1052 return nullptr; 1068 return nullptr;
1053 } 1069 }
1054 1070
1055 } // namespace blink 1071 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698