Changeset 196991 in webkit
- Timestamp:
- Feb 23, 2016, 1:18:05 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
-
ChangeLog (modified) (1 diff)
-
css/CSSBorderImageSliceValue.h (modified) (1 diff)
-
css/CSSPrimitiveValue.h (modified) (1 diff)
-
css/FontVariantBuilder.cpp (modified) (3 diffs)
-
css/FontVariantBuilder.h (modified) (1 diff)
-
css/StyleBuilderConverter.h (modified) (2 diffs)
-
css/StyleBuilderCustom.h (modified) (3 diffs)
-
css/StyleResolver.cpp (modified) (7 diffs)
-
css/StyleResolver.h (modified) (2 diffs)
-
css/TransformFunctions.cpp (modified) (8 diffs)
-
css/TransformFunctions.h (modified) (1 diff)
-
rendering/style/StylePendingImage.h (modified) (1 diff)
-
svg/SVGLength.cpp (modified) (1 diff)
-
svg/SVGLength.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r196983 r196991 1 2016-02-23 Simon Fraser <simon.fraser@apple.com> 2 3 Lay the groundwork for more constness in StyleResolver-related code 4 https://bugs.webkit.org/show_bug.cgi?id=154598 5 6 Reviewed by Antti Koivisto. 7 8 Make some of the leaf functions that are used by the style resolver take 9 const CSSValues, and use 'auto' more to automatically get const stack variables 10 when appropriate. 11 12 * css/CSSBorderImageSliceValue.h: 13 (WebCore::CSSBorderImageSliceValue::slices): 14 * css/CSSPrimitiveValue.h: 15 (WebCore::CSSPrimitiveValue::isQuirkValue): 16 * css/FontVariantBuilder.cpp: 17 (WebCore::extractFontVariantLigatures): 18 (WebCore::extractFontVariantNumeric): 19 (WebCore::extractFontVariantEastAsian): 20 * css/FontVariantBuilder.h: 21 * css/StyleBuilderConverter.h: 22 (WebCore::StyleBuilderConverter::convertReflection): 23 (WebCore::StyleBuilderConverter::convertGridAutoFlow): 24 * css/StyleBuilderCustom.h: 25 (WebCore::StyleBuilderCustom::applyValueSize): 26 (WebCore::StyleBuilderCustom::applyValueStroke): 27 * css/StyleResolver.cpp: 28 (WebCore::StyleResolver::colorFromPrimitiveValueIsDerivedFromElement): 29 (WebCore::StyleResolver::colorFromPrimitiveValue): 30 (WebCore::StyleResolver::createFilterOperations): 31 * css/StyleResolver.h: 32 * css/TransformFunctions.cpp: 33 (WebCore::transformsForValue): 34 * css/TransformFunctions.h: 35 * rendering/style/StylePendingImage.h: 36 * svg/SVGLength.cpp: 37 (WebCore::SVGLength::fromCSSPrimitiveValue): 38 * svg/SVGLength.h: 39 1 40 2016-02-23 Manuel Rego Casasnovas <rego@igalia.com> 2 41 -
trunk/Source/WebCore/css/CSSBorderImageSliceValue.h
r177259 r196991 44 44 String customCSSText() const; 45 45 46 Quad* slices() { return m_slices ? m_slices->getQuadValue() : 0; }46 Quad* slices() const { return m_slices ? m_slices->getQuadValue() : nullptr; } 47 47 48 48 bool equals(const CSSBorderImageSliceValue&) const; -
trunk/Source/WebCore/css/CSSPrimitiveValue.h
r194851 r196991 370 370 String customCSSText() const; 371 371 372 bool isQuirkValue() { return m_isQuirkValue; }372 bool isQuirkValue() const { return m_isQuirkValue; } 373 373 374 374 void addSubresourceStyleURLs(ListHashSet<URL>&, const StyleSheetContents*) const; -
trunk/Source/WebCore/css/FontVariantBuilder.cpp
r196510 r196991 34 34 namespace WebCore { 35 35 36 FontVariantLigaturesValues extractFontVariantLigatures( CSSValue& value)36 FontVariantLigaturesValues extractFontVariantLigatures(const CSSValue& value) 37 37 { 38 38 FontVariantLigatures common = FontVariantLigatures::Normal; … … 92 92 } 93 93 94 FontVariantNumericValues extractFontVariantNumeric( CSSValue& value)94 FontVariantNumericValues extractFontVariantNumeric(const CSSValue& value) 95 95 { 96 96 FontVariantNumericFigure figure = FontVariantNumericFigure::Normal; … … 138 138 } 139 139 140 FontVariantEastAsianValues extractFontVariantEastAsian( CSSValue& value)140 FontVariantEastAsianValues extractFontVariantEastAsian(const CSSValue& value) 141 141 { 142 142 FontVariantEastAsianVariant variant = FontVariantEastAsianVariant::Normal; -
trunk/Source/WebCore/css/FontVariantBuilder.h
r196510 r196991 37 37 struct FontVariantEastAsianValues; 38 38 39 FontVariantLigaturesValues extractFontVariantLigatures( CSSValue&);40 FontVariantNumericValues extractFontVariantNumeric( CSSValue&);41 FontVariantEastAsianValues extractFontVariantEastAsian( CSSValue&);39 FontVariantLigaturesValues extractFontVariantLigatures(const CSSValue&); 40 FontVariantNumericValues extractFontVariantNumeric(const CSSValue&); 41 FontVariantEastAsianValues extractFontVariantEastAsian(const CSSValue&); 42 42 43 43 Ref<CSSValue> computeFontVariant(const FontVariantSettings&); -
trunk/Source/WebCore/css/StyleBuilderConverter.h
r196740 r196991 568 568 } 569 569 570 CSSReflectValue& reflectValue = downcast<CSSReflectValue>(value);570 auto& reflectValue = downcast<CSSReflectValue>(value); 571 571 572 572 RefPtr<StyleReflection> reflection = StyleReflection::create(); … … 917 917 return RenderStyle::initialGridAutoFlow(); 918 918 919 CSSPrimitiveValue& first = downcast<CSSPrimitiveValue>(*list.item(0));920 CSSPrimitiveValue* second = downcast<CSSPrimitiveValue>(list.item(1));919 auto& first = downcast<CSSPrimitiveValue>(*list.item(0)); 920 auto* second = downcast<CSSPrimitiveValue>(list.item(1)); 921 921 922 922 GridAutoFlow autoFlow = RenderStyle::initialGridAutoFlow(); -
trunk/Source/WebCore/css/StyleBuilderCustom.h
r196510 r196991 397 397 switch (valueList.length()) { 398 398 case 2: { 399 CSSValue*firstValue = valueList.itemWithoutBoundsCheck(0);400 CSSValue*secondValue = valueList.itemWithoutBoundsCheck(1);399 auto firstValue = valueList.itemWithoutBoundsCheck(0); 400 auto secondValue = valueList.itemWithoutBoundsCheck(1); 401 401 // <length>{2} | <page-size> <orientation> 402 402 if (!is<CSSPrimitiveValue>(*firstValue) || !is<CSSPrimitiveValue>(*secondValue)) … … 421 421 } 422 422 case 1: { 423 CSSValue*value = valueList.itemWithoutBoundsCheck(0);423 auto value = valueList.itemWithoutBoundsCheck(0); 424 424 // <length> | auto | <page-size> | [ portrait | landscape] 425 425 if (!is<CSSPrimitiveValue>(*value)) … … 1196 1196 { 1197 1197 SVGRenderStyle& svgStyle = styleResolver.style()->accessSVGStyle(); 1198 SVGPaint& svgPaint = downcast<SVGPaint>(value);1198 auto& svgPaint = downcast<SVGPaint>(value); 1199 1199 svgStyle.setStrokePaint(svgPaint.paintType(), StyleBuilderConverter::convertSVGColor(styleResolver, svgPaint), svgPaint.uri(), styleResolver.applyPropertyToRegularStyle(), styleResolver.applyPropertyToVisitedLinkStyle()); 1200 1200 } -
trunk/Source/WebCore/css/StyleResolver.cpp
r196555 r196991 1791 1791 } 1792 1792 1793 bool StyleResolver::colorFromPrimitiveValueIsDerivedFromElement( CSSPrimitiveValue& value)1793 bool StyleResolver::colorFromPrimitiveValueIsDerivedFromElement(const CSSPrimitiveValue& value) 1794 1794 { 1795 1795 int ident = value.getValueID(); … … 1805 1805 } 1806 1806 1807 Color StyleResolver::colorFromPrimitiveValue( CSSPrimitiveValue& value, bool forVisitedLink) const1807 Color StyleResolver::colorFromPrimitiveValue(const CSSPrimitiveValue& value, bool forVisitedLink) const 1808 1808 { 1809 1809 if (value.isRGBColor()) … … 1898 1898 } 1899 1899 1900 bool StyleResolver::createFilterOperations( CSSValue& inValue, FilterOperations& outOperations)1900 bool StyleResolver::createFilterOperations(const CSSValue& inValue, FilterOperations& outOperations) 1901 1901 { 1902 1902 State& state = m_state; … … 1904 1904 1905 1905 if (is<CSSPrimitiveValue>(inValue)) { 1906 CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(inValue);1906 auto& primitiveValue = downcast<CSSPrimitiveValue>(inValue); 1907 1907 if (primitiveValue.getValueID() == CSSValueNone) 1908 1908 return true; … … 1923 1923 if (filterValue.length() != 1) 1924 1924 continue; 1925 CSSValue& argument = *filterValue.itemWithoutBoundsCheck(0);1925 auto& argument = *filterValue.itemWithoutBoundsCheck(0); 1926 1926 1927 1927 if (!is<CSSPrimitiveValue>(argument)) 1928 1928 continue; 1929 1929 1930 CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(argument);1930 auto& primitiveValue = downcast<CSSPrimitiveValue>(argument); 1931 1931 String cssUrl = primitiveValue.getStringValue(); 1932 1932 URL url = m_state.document().completeURL(cssUrl); … … 1942 1942 // Check that all parameters are primitive values, with the 1943 1943 // exception of drop shadow which has a CSSShadowValue parameter. 1944 CSSPrimitiveValue* firstValue = nullptr;1944 const CSSPrimitiveValue* firstValue = nullptr; 1945 1945 if (operationType != FilterOperation::DROP_SHADOW) { 1946 1946 bool haveNonPrimitiveValue = false; … … 2007 2007 return false; 2008 2008 2009 CSSValue& cssValue = *filterValue.itemWithoutBoundsCheck(0);2009 auto& cssValue = *filterValue.itemWithoutBoundsCheck(0); 2010 2010 if (!is<CSSShadowValue>(cssValue)) 2011 2011 continue; 2012 2012 2013 CSSShadowValue& item = downcast<CSSShadowValue>(cssValue);2013 auto& item = downcast<CSSShadowValue>(cssValue); 2014 2014 int x = item.x->computeLength<int>(state.cssToLengthConversionData()); 2015 2015 int y = item.y->computeLength<int>(state.cssToLengthConversionData()); -
trunk/Source/WebCore/css/StyleResolver.h
r196031 r196991 186 186 bool useSVGZoomRulesForLength(); 187 187 188 static bool colorFromPrimitiveValueIsDerivedFromElement( CSSPrimitiveValue&);189 Color colorFromPrimitiveValue( CSSPrimitiveValue&, bool forVisitedLink = false) const;188 static bool colorFromPrimitiveValueIsDerivedFromElement(const CSSPrimitiveValue&); 189 Color colorFromPrimitiveValue(const CSSPrimitiveValue&, bool forVisitedLink = false) const; 190 190 191 191 bool hasSelectorForId(const AtomicString&) const; … … 212 212 void clearCachedPropertiesAffectedByViewportUnits(); 213 213 214 bool createFilterOperations( CSSValue& inValue, FilterOperations& outOperations);214 bool createFilterOperations(const CSSValue& inValue, FilterOperations& outOperations); 215 215 void loadPendingSVGDocuments(); 216 216 -
trunk/Source/WebCore/css/TransformFunctions.cpp
r196740 r196991 82 82 } 83 83 84 bool transformsForValue( CSSValue& value, const CSSToLengthConversionData& conversionData, TransformOperations& outOperations)84 bool transformsForValue(const CSSValue& value, const CSSToLengthConversionData& conversionData, TransformOperations& outOperations) 85 85 { 86 86 if (!is<CSSValueList>(value)) { … … 108 108 continue; 109 109 110 CSSPrimitiveValue& firstValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(0));110 auto& firstValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(0)); 111 111 112 112 switch (transformValue.operationType()) { … … 122 122 if (transformValue.operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) { 123 123 if (transformValue.length() > 1) { 124 CSSPrimitiveValue& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1));124 auto& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1)); 125 125 sy = secondValue.getDoubleValue(); 126 126 } else … … 144 144 if (transformValue.operationType() != WebKitCSSTransformValue::ScaleXTransformOperation) { 145 145 if (transformValue.length() > 2) { 146 CSSPrimitiveValue& thirdValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(2));146 auto& thirdValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(2)); 147 147 sz = thirdValue.getDoubleValue(); 148 148 } 149 149 if (transformValue.length() > 1) { 150 CSSPrimitiveValue& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1));150 auto& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1)); 151 151 sy = secondValue.getDoubleValue(); 152 152 } else … … 168 168 if (transformValue.operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) { 169 169 if (transformValue.length() > 1) { 170 CSSPrimitiveValue& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1));170 auto& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1)); 171 171 ty = convertToFloatLength(&secondValue, conversionData); 172 172 } … … 193 193 if (transformValue.operationType() != WebKitCSSTransformValue::TranslateXTransformOperation) { 194 194 if (transformValue.length() > 2) { 195 CSSPrimitiveValue& thirdValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(2));195 auto& thirdValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(2)); 196 196 tz = convertToFloatLength(&thirdValue, conversionData); 197 197 } 198 198 if (transformValue.length() > 1) { 199 CSSPrimitiveValue& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1));199 auto& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1)); 200 200 ty = convertToFloatLength(&secondValue, conversionData); 201 201 } … … 234 234 if (transformValue.length() < 4) 235 235 break; 236 CSSPrimitiveValue& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1));237 CSSPrimitiveValue& thirdValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(2));238 CSSPrimitiveValue& fourthValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(3));236 auto& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1)); 237 auto& thirdValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(2)); 238 auto& fourthValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(3)); 239 239 double x = firstValue.getDoubleValue(); 240 240 double y = secondValue.getDoubleValue(); … … 256 256 if (transformValue.operationType() == WebKitCSSTransformValue::SkewTransformOperation) { 257 257 if (transformValue.length() > 1) { 258 CSSPrimitiveValue& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1));258 auto& secondValue = downcast<CSSPrimitiveValue>(*transformValue.itemWithoutBoundsCheck(1)); 259 259 angleY = secondValue.computeDegrees(); 260 260 } -
trunk/Source/WebCore/css/TransformFunctions.h
r196740 r196991 43 43 struct Length; 44 44 45 bool transformsForValue( CSSValue&, const CSSToLengthConversionData&, TransformOperations&);45 bool transformsForValue(const CSSValue&, const CSSToLengthConversionData&, TransformOperations&); 46 46 Length convertToFloatLength(const CSSPrimitiveValue*, const CSSToLengthConversionData&); 47 47 -
trunk/Source/WebCore/rendering/style/StylePendingImage.h
r191083 r196991 47 47 48 48 CSSImageValue* cssImageValue() const { return is<CSSImageValue>(m_value) ? downcast<CSSImageValue>(m_value) : nullptr; } 49 CSSImageGeneratorValue* cssImageGeneratorValue() const { return m_value && m_value->isImageGeneratorValue() ? static_cast<CSSImageGeneratorValue*>(m_value) : nullptr; }49 CSSImageGeneratorValue* cssImageGeneratorValue() const { return is<CSSImageGeneratorValue>(m_value) ? static_cast<CSSImageGeneratorValue*>(m_value) : nullptr; } 50 50 CSSCursorImageValue* cssCursorImageValue() const { return is<CSSCursorImageValue>(m_value) ? downcast<CSSCursorImageValue>(m_value) : nullptr; } 51 51 -
trunk/Source/WebCore/svg/SVGLength.cpp
r178237 r196991 282 282 } 283 283 284 SVGLength SVGLength::fromCSSPrimitiveValue( CSSPrimitiveValue& value)284 SVGLength SVGLength::fromCSSPrimitiveValue(const CSSPrimitiveValue& value) 285 285 { 286 286 SVGLengthType svgType; -
trunk/Source/WebCore/svg/SVGLength.h
r184852 r196991 99 99 } 100 100 101 static SVGLength fromCSSPrimitiveValue( CSSPrimitiveValue&);101 static SVGLength fromCSSPrimitiveValue(const CSSPrimitiveValue&); 102 102 static Ref<CSSPrimitiveValue> toCSSPrimitiveValue(const SVGLength&); 103 103 static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedName&);
Note:
See TracChangeset
for help on using the changeset viewer.