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

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

Issue 2032243003: Make CSSValueList store const CSSValues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_make_computedstyledeclaration_return_const
Patch Set: Small fix n CSSOM Created 4 years, 6 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return FontDescription::FantasyFamily; 136 return FontDescription::FantasyFamily;
137 case CSSValueMonospace: 137 case CSSValueMonospace:
138 return FontDescription::MonospaceFamily; 138 return FontDescription::MonospaceFamily;
139 case CSSValueWebkitPictograph: 139 case CSSValueWebkitPictograph:
140 return FontDescription::PictographFamily; 140 return FontDescription::PictographFamily;
141 default: 141 default:
142 return FontDescription::NoFamily; 142 return FontDescription::NoFamily;
143 } 143 }
144 } 144 }
145 145
146 static bool convertFontFamilyName(StyleResolverState& state, CSSValue& value, 146 static bool convertFontFamilyName(StyleResolverState& state, const CSSValue& val ue,
147 FontDescription::GenericFamilyType& genericFamily, AtomicString& familyName) 147 FontDescription::GenericFamilyType& genericFamily, AtomicString& familyName)
148 { 148 {
149 if (value.isFontFamilyValue()) { 149 if (value.isFontFamilyValue()) {
150 genericFamily = FontDescription::NoFamily; 150 genericFamily = FontDescription::NoFamily;
151 familyName = AtomicString(toCSSFontFamilyValue(value).value()); 151 familyName = AtomicString(toCSSFontFamilyValue(value).value());
152 } else if (state.document().settings()) { 152 } else if (state.document().settings()) {
153 genericFamily = convertGenericFamily(toCSSPrimitiveValue(value).getValue ID()); 153 genericFamily = convertGenericFamily(toCSSPrimitiveValue(value).getValue ID());
154 familyName = state.fontBuilder().genericFontFamilyName(genericFamily); 154 familyName = state.fontBuilder().genericFontFamilyName(genericFamily);
155 } 155 }
156 156
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 480
481 const CSSValueList& values = toCSSValueList(value); 481 const CSSValueList& values = toCSSValueList(value);
482 ASSERT(values.length()); 482 ASSERT(values.length());
483 483
484 bool isSpanPosition = false; 484 bool isSpanPosition = false;
485 // The specification makes the <integer> optional, in which case it default to '1'. 485 // The specification makes the <integer> optional, in which case it default to '1'.
486 int gridLineNumber = 1; 486 int gridLineNumber = 1;
487 String gridLineName; 487 String gridLineName;
488 488
489 auto it = values.begin(); 489 auto it = values.begin();
490 CSSValue* currentValue = it->get(); 490 const CSSValue* currentValue = it->get();
491 if (currentValue->isPrimitiveValue() && toCSSPrimitiveValue(currentValue)->g etValueID() == CSSValueSpan) { 491 if (currentValue->isPrimitiveValue() && toCSSPrimitiveValue(currentValue)->g etValueID() == CSSValueSpan) {
492 isSpanPosition = true; 492 isSpanPosition = true;
493 ++it; 493 ++it;
494 currentValue = it != values.end() ? it->get() : nullptr; 494 currentValue = it != values.end() ? it->get() : nullptr;
495 } 495 }
496 496
497 if (currentValue && currentValue->isPrimitiveValue() && toCSSPrimitiveValue( currentValue)->isNumber()) { 497 if (currentValue && currentValue->isPrimitiveValue() && toCSSPrimitiveValue( currentValue)->isNumber()) {
498 gridLineNumber = toCSSPrimitiveValue(currentValue)->getIntValue(); 498 gridLineNumber = toCSSPrimitiveValue(currentValue)->getIntValue();
499 ++it; 499 ++it;
500 currentValue = it != values.end() ? it->get() : nullptr; 500 currentValue = it != values.end() ? it->get() : nullptr;
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 1046
1047 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) 1047 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value)
1048 { 1048 {
1049 if (value.isPathValue()) 1049 if (value.isPathValue())
1050 return toCSSPathValue(value).stylePath(); 1050 return toCSSPathValue(value).stylePath();
1051 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); 1051 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone);
1052 return nullptr; 1052 return nullptr;
1053 } 1053 }
1054 1054
1055 } // namespace blink 1055 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698