OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/css/resolver/StyleBuilderConverter.h" | 28 #include "core/css/resolver/StyleBuilderConverter.h" |
29 | 29 |
30 #include "core/css/CSSFontFeatureValue.h" | 30 #include "core/css/CSSFontFeatureValue.h" |
31 #include "core/css/CSSFunctionValue.h" | 31 #include "core/css/CSSFunctionValue.h" |
32 #include "core/css/CSSGridLineNamesValue.h" | 32 #include "core/css/CSSGridLineNamesValue.h" |
33 #include "core/css/CSSPrimitiveValueMappings.h" | 33 #include "core/css/CSSPrimitiveValueMappings.h" |
34 #include "core/css/CSSReflectValue.h" | 34 #include "core/css/CSSReflectValue.h" |
35 #include "core/css/CSSShadowValue.h" | 35 #include "core/css/CSSShadowValue.h" |
36 #include "core/css/Pair.h" | 36 #include "core/css/Pair.h" |
| 37 #include "core/css/Rect.h" |
37 #include "core/svg/SVGURIReference.h" | 38 #include "core/svg/SVGURIReference.h" |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
41 namespace { | 42 namespace { |
42 | 43 |
43 static GridLength convertGridTrackBreadth(const StyleResolverState& state, CSSPr
imitiveValue* primitiveValue) | 44 static GridLength convertGridTrackBreadth(const StyleResolverState& state, CSSPr
imitiveValue* primitiveValue) |
44 { | 45 { |
45 if (primitiveValue->getValueID() == CSSValueMinContent) | 46 if (primitiveValue->getValueID() == CSSValueMinContent) |
46 return Length(MinContent); | 47 return Length(MinContent); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 85 } |
85 | 86 |
86 AtomicString StyleBuilderConverter::convertFragmentIdentifier(StyleResolverState
& state, CSSValue* value) | 87 AtomicString StyleBuilderConverter::convertFragmentIdentifier(StyleResolverState
& state, CSSValue* value) |
87 { | 88 { |
88 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 89 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
89 if (primitiveValue->isURI()) | 90 if (primitiveValue->isURI()) |
90 return SVGURIReference::fragmentIdentifierFromIRIString(primitiveValue->
getStringValue(), state.element()->treeScope()); | 91 return SVGURIReference::fragmentIdentifierFromIRIString(primitiveValue->
getStringValue(), state.element()->treeScope()); |
91 return nullAtom; | 92 return nullAtom; |
92 } | 93 } |
93 | 94 |
| 95 LengthBox StyleBuilderConverter::convertClip(StyleResolverState& state, CSSValue
* value) |
| 96 { |
| 97 Rect* rect = toCSSPrimitiveValue(value)->getRectValue(); |
| 98 |
| 99 return LengthBox(convertLengthOrAuto(state, rect->top()), |
| 100 convertLengthOrAuto(state, rect->right()), |
| 101 convertLengthOrAuto(state, rect->bottom()), |
| 102 convertLengthOrAuto(state, rect->left())); |
| 103 } |
| 104 |
94 PassRefPtr<FontFeatureSettings> StyleBuilderConverter::convertFontFeatureSetting
s(StyleResolverState& state, CSSValue* value) | 105 PassRefPtr<FontFeatureSettings> StyleBuilderConverter::convertFontFeatureSetting
s(StyleResolverState& state, CSSValue* value) |
95 { | 106 { |
96 if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() ==
CSSValueNormal) | 107 if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() ==
CSSValueNormal) |
97 return FontBuilder::initialFeatureSettings(); | 108 return FontBuilder::initialFeatureSettings(); |
98 | 109 |
99 CSSValueList* list = toCSSValueList(value); | 110 CSSValueList* list = toCSSValueList(value); |
100 RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create(); | 111 RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create(); |
101 int len = list->length(); | 112 int len = list->length(); |
102 for (int i = 0; i < len; ++i) { | 113 for (int i = 0; i < len; ++i) { |
103 CSSFontFeatureValue* feature = toCSSFontFeatureValue(list->item(i)); | 114 CSSFontFeatureValue* feature = toCSSFontFeatureValue(list->item(i)); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 { | 536 { |
526 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 537 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
527 if (primitiveValue->getValueID()) { | 538 if (primitiveValue->getValueID()) { |
528 float multiplier = convertLineWidth<float>(state, value); | 539 float multiplier = convertLineWidth<float>(state, value); |
529 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS
_EMS)->computeLength<float>(state.cssToLengthConversionData()); | 540 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS
_EMS)->computeLength<float>(state.cssToLengthConversionData()); |
530 } | 541 } |
531 return primitiveValue->computeLength<float>(state.cssToLengthConversionData(
)); | 542 return primitiveValue->computeLength<float>(state.cssToLengthConversionData(
)); |
532 } | 543 } |
533 | 544 |
534 } // namespace blink | 545 } // namespace blink |
OLD | NEW |