Changeset 140642 in webkit
- Timestamp:
- Jan 23, 2013 8:44:10 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r140631 r140642 1 2013-01-23 Luke Macpherson <macpherson@chromium.org> 2 3 Support variables inside -webkit-box-reflect CSS property. 4 https://bugs.webkit.org/show_bug.cgi?id=106856 5 6 Adds test for variables as -webkit-box-reflect parameters. 7 8 Reviewed by Tony Chang. 9 10 * fast/css/variables/var-inside-box-reflect-expected.html: Added. 11 * fast/css/variables/var-inside-box-reflect.html: Added. 12 1 13 2013-01-23 Rafael Weinstein <rafaelw@chromium.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r140640 r140642 1 2013-01-23 Luke Macpherson <macpherson@chromium.org> 2 3 Support variables inside -webkit-box-reflect CSS property. 4 https://bugs.webkit.org/show_bug.cgi?id=106856 5 6 Reviewed by Tony Chang. 7 8 The primary change is to make the direction parameter a CSSPrimitiveValue style ident, 9 so that it can also be a variable reference. 10 11 Covered by existing LayoutTests/compositing/reflections/ tests. 12 Added Test: fast/css/variables/var-inside-box-reflect.html 13 14 * css/CSSComputedStyleDeclaration.cpp: 15 (WebCore::valueForReflection): 16 * css/CSSParser.cpp: 17 (WebCore::CSSParser::parseReflect): 18 * css/CSSPrimitiveValueMappings.h: 19 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 20 (WebCore): 21 (WebCore::CSSPrimitiveValue::operator CSSReflectionDirection): 22 (WebCore::CSSPrimitiveValue::convertToLength): 23 * css/CSSReflectValue.cpp: 24 (WebCore::CSSReflectValue::customCssText): 25 Use String addition operator instead of StringBuilder. 26 (WebCore): 27 (WebCore::CSSReflectValue::customSerializeResolvingVariables): 28 Use String addition operator instead of StringBuilder. 29 * css/CSSReflectValue.h: 30 (WebCore::CSSReflectValue::create): 31 (WebCore::CSSReflectValue::direction): 32 (CSSReflectValue): 33 (WebCore::CSSReflectValue::CSSReflectValue): 34 * css/CSSValue.cpp: 35 (WebCore::CSSValue::serializeResolvingVariables): 36 * css/StyleResolver.cpp: 37 (WebCore::hasVariableReference): 38 (WebCore::StyleResolver::applyProperty): 39 1 40 2013-01-23 Abhishek Arya <inferno@chromium.org> 2 41 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r139321 r140642 595 595 offset = zoomAdjustedPixelValue(reflection->offset().value(), style); 596 596 597 return CSSReflectValue::create(reflection->direction(), offset.release(), valueForNinePieceImage(reflection->mask())); 597 RefPtr<CSSPrimitiveValue> direction; 598 switch (reflection->direction()) { 599 case ReflectionBelow: 600 direction = cssValuePool().createIdentifierValue(CSSValueBelow); 601 break; 602 case ReflectionAbove: 603 direction = cssValuePool().createIdentifierValue(CSSValueAbove); 604 break; 605 case ReflectionLeft: 606 direction = cssValuePool().createIdentifierValue(CSSValueLeft); 607 break; 608 case ReflectionRight: 609 direction = cssValuePool().createIdentifierValue(CSSValueRight); 610 break; 611 } 612 613 return CSSReflectValue::create(direction.release(), offset.release(), valueForNinePieceImage(reflection->mask())); 598 614 } 599 615 -
trunk/Source/WebCore/css/CSSParser.cpp
r140560 r140642 6215 6215 // Direction comes first. 6216 6216 CSSParserValue* val = m_valueList->current(); 6217 CSSReflectionDirection direction; 6217 RefPtr<CSSPrimitiveValue> direction; 6218 #if ENABLE(CSS_VARIABLES) 6219 if (val->unit == CSSPrimitiveValue::CSS_VARIABLE_NAME) 6220 direction = createPrimitiveVariableNameValue(val); 6221 else 6222 #endif 6218 6223 switch (val->id) { 6219 6224 case CSSValueAbove: 6220 direction = ReflectionAbove;6221 break;6222 6225 case CSSValueBelow: 6223 direction = ReflectionBelow;6224 break;6225 6226 case CSSValueLeft: 6226 direction = ReflectionLeft;6227 break;6228 6227 case CSSValueRight: 6229 direction = ReflectionRight;6228 direction = cssValuePool().createIdentifierValue(val->id); 6230 6229 break; 6231 6230 default: … … 6252 6251 } 6253 6252 6254 RefPtr<CSSReflectValue> reflectValue = CSSReflectValue::create(direction , offset.release(), mask.release());6253 RefPtr<CSSReflectValue> reflectValue = CSSReflectValue::create(direction.release(), offset.release(), mask.release()); 6255 6254 addProperty(propId, reflectValue.release(), important); 6256 6255 m_valueList->next(); -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r139734 r140642 33 33 #include "CSSCalculationValue.h" 34 34 #include "CSSPrimitiveValue.h" 35 #include "CSSReflectionDirection.h" 35 36 #include "ColorSpace.h" 36 37 #include "CSSValueKeywords.h" … … 140 141 ASSERT_NOT_REACHED(); 141 142 return LineClampValue(); 143 } 144 145 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CSSReflectionDirection e) 146 : CSSValue(PrimitiveClass) 147 { 148 m_primitiveUnitType = CSS_IDENT; 149 switch (e) { 150 case ReflectionAbove: 151 m_value.ident = CSSValueAbove; 152 break; 153 case ReflectionBelow: 154 m_value.ident = CSSValueBelow; 155 break; 156 case ReflectionLeft: 157 m_value.ident = CSSValueLeft; 158 break; 159 case ReflectionRight: 160 m_value.ident = CSSValueRight; 161 } 162 } 163 164 template<> inline CSSPrimitiveValue::operator CSSReflectionDirection() const 165 { 166 switch (m_value.ident) { 167 case CSSValueAbove: 168 return ReflectionAbove; 169 case CSSValueBelow: 170 return ReflectionBelow; 171 case CSSValueLeft: 172 return ReflectionLeft; 173 case CSSValueRight: 174 return ReflectionRight; 175 } 176 177 ASSERT_NOT_REACHED(); 178 return ReflectionBelow; 142 179 } 143 180 … … 4078 4115 template<int supported> Length CSSPrimitiveValue::convertToLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize) 4079 4116 { 4117 #if ENABLE(CSS_VARIABLES) 4118 ASSERT(!hasVariableReference()); 4119 #endif 4080 4120 if ((supported & (FixedIntegerConversion | FixedFloatConversion)) && isFontRelativeLength() && (!style || !rootStyle)) 4081 4121 return Length(Undefined); -
trunk/Source/WebCore/css/CSSReflectValue.cpp
r128762 r140642 37 37 String CSSReflectValue::customCssText() const 38 38 { 39 StringBuilder result; 40 switch (m_direction) { 41 case ReflectionBelow: 42 result.appendLiteral("below "); 43 break; 44 case ReflectionAbove: 45 result.appendLiteral("above "); 46 break; 47 case ReflectionLeft: 48 result.appendLiteral("left "); 49 break; 50 case ReflectionRight: 51 result.appendLiteral("right "); 52 break; 53 default: 54 break; 55 } 39 if (m_mask) 40 return m_direction->cssText() + ' ' + m_offset->cssText() + ' ' + m_mask->cssText(); 41 return m_direction->cssText() + ' ' + m_offset->cssText(); 42 } 56 43 57 result.append(m_offset->cssText()); 58 result.append(' '); 44 #if ENABLE(CSS_VARIABLES) 45 String CSSReflectValue::customSerializeResolvingVariables(const HashMap<AtomicString, String>& variables) const 46 { 59 47 if (m_mask) 60 re sult.append(m_mask->cssText());61 return result.toString();48 return m_direction->customSerializeResolvingVariables(variables) + ' ' + m_offset->customSerializeResolvingVariables(variables) + ' ' + m_mask->serializeResolvingVariables(variables); 49 return m_direction->customSerializeResolvingVariables(variables) + ' ' + m_offset->customSerializeResolvingVariables(variables); 62 50 } 51 #endif 63 52 64 53 void CSSReflectValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) const -
trunk/Source/WebCore/css/CSSReflectValue.h
r124768 r140642 38 38 class CSSReflectValue : public CSSValue { 39 39 public: 40 static PassRefPtr<CSSReflectValue> create( CSSReflectionDirectiondirection,40 static PassRefPtr<CSSReflectValue> create(PassRefPtr<CSSPrimitiveValue> direction, 41 41 PassRefPtr<CSSPrimitiveValue> offset, PassRefPtr<CSSValue> mask) 42 42 { … … 44 44 } 45 45 46 CSS ReflectionDirection direction() const { return m_direction; }46 CSSPrimitiveValue* direction() const { return m_direction.get(); } 47 47 CSSPrimitiveValue* offset() const { return m_offset.get(); } 48 48 CSSValue* mask() const { return m_mask.get(); } 49 49 50 50 String customCssText() const; 51 #if ENABLE(CSS_VARIABLES) 52 String customSerializeResolvingVariables(const HashMap<AtomicString, String>&) const; 53 #endif 51 54 52 55 void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*) const; … … 55 58 56 59 private: 57 CSSReflectValue( CSSReflectionDirectiondirection, PassRefPtr<CSSPrimitiveValue> offset, PassRefPtr<CSSValue> mask)60 CSSReflectValue(PassRefPtr<CSSPrimitiveValue> direction, PassRefPtr<CSSPrimitiveValue> offset, PassRefPtr<CSSValue> mask) 58 61 : CSSValue(ReflectClass) 59 62 , m_direction(direction) … … 63 66 } 64 67 65 CSSReflectionDirectionm_direction;68 RefPtr<CSSPrimitiveValue> m_direction; 66 69 RefPtr<CSSPrimitiveValue> m_offset; 67 70 RefPtr<CSSValue> m_mask; -
trunk/Source/WebCore/css/CSSValue.cpp
r128762 r140642 375 375 case PrimitiveClass: 376 376 return static_cast<const CSSPrimitiveValue*>(this)->customSerializeResolvingVariables(variables); 377 case ReflectClass: 378 return static_cast<const CSSReflectValue*>(this)->customSerializeResolvingVariables(variables); 377 379 case ValueListClass: 378 380 return static_cast<const CSSValueList*>(this)->customSerializeResolvingVariables(variables); -
trunk/Source/WebCore/css/StyleResolver.cpp
r140531 r140642 2958 2958 return static_cast<CSSCalcValue*>(value)->hasVariableReference(); 2959 2959 2960 if (value->isReflectValue()) { 2961 CSSReflectValue* reflectValue = static_cast<CSSReflectValue*>(value); 2962 CSSPrimitiveValue* direction = reflectValue->direction(); 2963 CSSPrimitiveValue* offset = reflectValue->offset(); 2964 CSSValue* mask = reflectValue->mask(); 2965 return (direction && hasVariableReference(direction)) || (offset && hasVariableReference(offset)) || (mask && hasVariableReference(mask)); 2966 } 2967 2960 2968 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { 2961 2969 if (hasVariableReference(i.value())) … … 3395 3403 CSSReflectValue* reflectValue = static_cast<CSSReflectValue*>(value); 3396 3404 RefPtr<StyleReflection> reflection = StyleReflection::create(); 3397 reflection->setDirection( reflectValue->direction());3405 reflection->setDirection(*reflectValue->direction()); 3398 3406 if (reflectValue->offset()) 3399 3407 reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(style(), m_rootElementStyle, zoomFactor));
Note: See TracChangeset
for help on using the changeset viewer.