Changeset 87281 in webkit
- Timestamp:
- May 25, 2011 2:35:43 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87280 r87281 1 2011-05-16 Alexander Pavlov <apavlov@chromium.org> 2 3 Reviewed by David Levin. 4 5 CSSParser: m_implicitShorthand should probably be RAII 6 https://bugs.webkit.org/show_bug.cgi?id=51586 7 8 It was impossible to entirely eliminate the m_implicitShorthand manual changes 9 due to the parseFill*() method stateful call chains. 10 11 No new tests, as this is a refactoring. 12 13 * css/CSSParser.cpp: 14 (ImplicitScope::ImplicitScope): 15 (ImplicitScope::~ImplicitScope): 16 (WebCore::CSSParser::parseShorthand): 17 (WebCore::CSSParser::parse4Values): 18 (WebCore::CSSParser::parseBorderRadius): 19 1 20 2011-05-24 Pavel Podivilov <podivilov@chromium.org> 2 21 -
trunk/Source/WebCore/css/CSSParser.cpp
r87121 r87281 93 93 using namespace WTF; 94 94 95 namespace { 96 97 enum PropertyType { 98 PropertyExplicit, 99 PropertyImplicit 100 }; 101 102 class ImplicitScope { 103 WTF_MAKE_NONCOPYABLE(ImplicitScope); 104 public: 105 ImplicitScope(WebCore::CSSParser* parser, PropertyType propertyType) 106 : m_parser(parser) 107 { 108 m_parser->m_implicitShorthand = propertyType == PropertyImplicit; 109 } 110 111 ~ImplicitScope() 112 { 113 m_parser->m_implicitShorthand = false; 114 } 115 116 private: 117 WebCore::CSSParser* m_parser; 118 }; 119 120 } // namespace 121 95 122 namespace WebCore { 96 123 … … 2383 2410 2384 2411 // Fill in any remaining properties with the initial value. 2385 m_implicitShorthand = true;2412 ImplicitScope implicitScope(this, PropertyImplicit); 2386 2413 for (int i = 0; i < numProperties; ++i) { 2387 2414 if (!fnd[i]) 2388 2415 addProperty(properties[i], CSSInitialValue::createImplicit(), important); 2389 2416 } 2390 m_implicitShorthand = false;2391 2417 2392 2418 return true; … … 2413 2439 return false; 2414 2440 CSSValue *value = m_parsedProperties[m_numParsedProperties-1]->value(); 2415 m_implicitShorthand = true;2441 ImplicitScope implicitScope(this, PropertyImplicit); 2416 2442 addProperty(properties[1], value, important); 2417 2443 addProperty(properties[2], value, important); 2418 2444 addProperty(properties[3], value, important); 2419 m_implicitShorthand = false;2420 2445 break; 2421 2446 } … … 2424 2449 return false; 2425 2450 CSSValue *value = m_parsedProperties[m_numParsedProperties-2]->value(); 2426 m_implicitShorthand = true;2451 ImplicitScope implicitScope(this, PropertyImplicit); 2427 2452 addProperty(properties[2], value, important); 2428 2453 value = m_parsedProperties[m_numParsedProperties-2]->value(); 2429 2454 addProperty(properties[3], value, important); 2430 m_implicitShorthand = false;2431 2455 break; 2432 2456 } … … 2435 2459 return false; 2436 2460 CSSValue *value = m_parsedProperties[m_numParsedProperties-2]->value(); 2437 m_implicitShorthand = true;2461 ImplicitScope implicitScope(this, PropertyImplicit); 2438 2462 addProperty(properties[3], value, important); 2439 m_implicitShorthand = false;2440 2463 break; 2441 2464 } … … 4996 5019 completeBorderRadii(radii[1]); 4997 5020 4998 m_implicitShorthand = true;5021 ImplicitScope implicitScope(this, PropertyImplicit); 4999 5022 addProperty(CSSPropertyBorderTopLeftRadius, primitiveValueCache()->createValue(Pair::create(radii[0][0].release(), radii[1][0].release())), important); 5000 5023 addProperty(CSSPropertyBorderTopRightRadius, primitiveValueCache()->createValue(Pair::create(radii[0][1].release(), radii[1][1].release())), important); 5001 5024 addProperty(CSSPropertyBorderBottomRightRadius, primitiveValueCache()->createValue(Pair::create(radii[0][2].release(), radii[1][2].release())), important); 5002 5025 addProperty(CSSPropertyBorderBottomLeftRadius, primitiveValueCache()->createValue(Pair::create(radii[0][3].release(), radii[1][3].release())), important); 5003 m_implicitShorthand = false;5004 5026 return true; 5005 5027 }
Note: See TracChangeset
for help on using the changeset viewer.