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

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

Issue 444413003: Make style building for font-weight less custom. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 AtomicString StyleBuilderConverter::convertFragmentIdentifier(StyleResolverState & state, CSSValue* value) 85 AtomicString StyleBuilderConverter::convertFragmentIdentifier(StyleResolverState & state, CSSValue* value)
86 { 86 {
87 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 87 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
88 if (primitiveValue->isURI()) 88 if (primitiveValue->isURI())
89 return SVGURIReference::fragmentIdentifierFromIRIString(primitiveValue-> getStringValue(), state.element()->treeScope()); 89 return SVGURIReference::fragmentIdentifierFromIRIString(primitiveValue-> getStringValue(), state.element()->treeScope());
90 return nullAtom; 90 return nullAtom;
91 } 91 }
92 92
93 FontWeight StyleBuilderConverter::convertFontWeight(StyleResolverState& state, C SSValue* value)
94 {
95 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
96 switch (primitiveValue->getValueID()) {
97 case CSSValueBolder:
98 return FontDescription::bolderWeight(state.parentStyle()->fontDescriptio n().weight());
99 case CSSValueLighter:
100 return FontDescription::lighterWeight(state.parentStyle()->fontDescripti on().weight());
101 default:
102 return *primitiveValue;
103 }
104 }
105
93 FontDescription::VariantLigatures StyleBuilderConverter::convertFontVariantLigat ures(StyleResolverState&, CSSValue* value) 106 FontDescription::VariantLigatures StyleBuilderConverter::convertFontVariantLigat ures(StyleResolverState&, CSSValue* value)
94 { 107 {
95 if (value->isValueList()) { 108 if (value->isValueList()) {
96 FontDescription::VariantLigatures ligatures; 109 FontDescription::VariantLigatures ligatures;
97 CSSValueList* valueList = toCSSValueList(value); 110 CSSValueList* valueList = toCSSValueList(value);
98 for (size_t i = 0; i < valueList->length(); ++i) { 111 for (size_t i = 0; i < valueList->length(); ++i) {
99 CSSValue* item = valueList->item(i); 112 CSSValue* item = valueList->item(i);
100 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item); 113 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item);
101 switch (primitiveValue->getValueID()) { 114 switch (primitiveValue->getValueID()) {
102 case CSSValueNoCommonLigatures: 115 case CSSValueNoCommonLigatures:
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 { 509 {
497 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 510 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
498 if (primitiveValue->getValueID()) { 511 if (primitiveValue->getValueID()) {
499 float multiplier = convertLineWidth<float>(state, value); 512 float multiplier = convertLineWidth<float>(state, value);
500 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS _EMS)->computeLength<float>(state.cssToLengthConversionData()); 513 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS _EMS)->computeLength<float>(state.cssToLengthConversionData());
501 } 514 }
502 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( )); 515 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( ));
503 } 516 }
504 517
505 } // namespace blink 518 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.h ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698