Changeset 112254 in webkit
- Timestamp:
- Mar 27, 2012 5:00:52 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r112247 r112254 1 2012-03-27 Alexis Menard <alexis.menard@openbossa.org> 2 3 Increase code sharing between CSSComputedStyleDeclaration and CSSPropertyLonghand. 4 https://bugs.webkit.org/show_bug.cgi?id=82261 5 6 Reviewed by Ryosuke Niwa. 7 8 Update expectation as it was relying on inaccurate order. All other outline related tests 9 are expecting the same order (e.g. fast/getComputedStyle/getComputedStyle-outline-shorthand) as well 10 as Opera. 11 12 * fast/css/cssText-shorthand-expected.txt: 13 * fast/css/cssText-shorthand.html: 14 1 15 2012-03-27 Nikolas Zimmermann <nzimmermann@rim.com> 2 16 -
trunk/LayoutTests/fast/css/cssText-shorthand-expected.txt
r112177 r112254 18 18 PASS normalizeCssText(element.style.cssText) is "list-style: circle inside" 19 19 PASS normalizeCssText(element.style.cssText) is "margin: 1px 2px 3px 4px" 20 PASS normalizeCssText(element.style.cssText) is "outline: 2px dotted blue"20 PASS normalizeCssText(element.style.cssText) is "outline: blue dotted 2px" 21 21 FAIL normalizeCssText(element.style.cssText) should be overflow: scroll hidden. Was overflow-x: scroll; overflow-y: hidden. 22 22 PASS normalizeCssText(element.style.cssText) is "padding: 1px 2px 3px 4px" -
trunk/LayoutTests/fast/css/cssText-shorthand.html
r112177 r112254 32 32 ['list-style-type: circle; list-style-position: inside;', 'list-style: circle inside;'], 33 33 ['margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;', 'margin: 1px 2px 3px 4px;'], 34 ['outline-width: 2px; outline-style: dotted; outline-color: blue;', 'outline: 2px dotted blue;'],34 ['outline-width: 2px; outline-style: dotted; outline-color: blue;', 'outline: blue dotted 2px;'], 35 35 ['overflow-x: scroll; overflow-y: hidden;', 'overflow: scroll hidden;'], 36 36 ['padding-top: 1px; padding-right: 2px; padding-bottom: 3px; padding-left: 4px;', 'padding: 1px 2px 3px 4px;'], -
trunk/Source/WebCore/ChangeLog
r112251 r112254 1 2012-03-27 Alexis Menard <alexis.menard@openbossa.org> 2 3 Increase code sharing between CSSComputedStyleDeclaration and CSSPropertyLonghand. 4 https://bugs.webkit.org/show_bug.cgi?id=82261 5 6 Reviewed by Ryosuke Niwa. 7 8 Use longhands declaration from CSSPropertyLonghand in CSSComputedStyleDeclaration to avoid 9 code duplication. 10 11 No new tests : refactoring only, we shouldn't have any behavior difference. 12 13 * css/CSSComputedStyleDeclaration.cpp: 14 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 15 (WebCore::CSSComputedStyleDeclaration::getCSSPropertyValuesForShorthandProperties): 16 (WebCore::CSSComputedStyleDeclaration::getCSSPropertyValuesForSidesShorthand): 17 * css/CSSComputedStyleDeclaration.h: 18 (WebCore): 19 (CSSComputedStyleDeclaration): 20 * css/CSSPropertyLonghand.cpp: 21 (WebCore::outlineLonghand): 22 Re-order to match the spec default order and also remove outline-offset as it is not part 23 of the shorthand (http://www.w3.org/TR/css3-ui/#outline). Luckily this was cover by a layout test. 24 1 25 2012-03-27 Vsevolod Vlasov <vsevik@chromium.org> 2 26 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r112198 r112254 33 33 #include "CSSPrimitiveValueMappings.h" 34 34 #include "CSSProperty.h" 35 #include "CSSPropertyLonghand.h" 35 36 #include "CSSPropertyNames.h" 36 37 #include "CSSReflectValue.h" … … 2335 2336 CSSPropertyBackgroundRepeat, CSSPropertyBackgroundAttachment, 2336 2337 CSSPropertyBackgroundPosition }; 2337 return getCSSPropertyValuesForShorthandProperties( properties, WTF_ARRAY_LENGTH(properties));2338 return getCSSPropertyValuesForShorthandProperties(CSSPropertyLonghand(properties, WTF_ARRAY_LENGTH(properties))); 2338 2339 } 2339 2340 case CSSPropertyBorder: { … … 2347 2348 return value.release(); 2348 2349 } 2349 case CSSPropertyBorderBottom: { 2350 const int properties[3] = { CSSPropertyBorderBottomWidth, CSSPropertyBorderBottomStyle, 2351 CSSPropertyBorderBottomColor }; 2352 return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties)); 2353 } 2354 case CSSPropertyBorderColor: { 2355 const int properties[4] = { CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, 2356 CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor }; 2357 return getCSSPropertyValuesForSidesShorthand(properties); 2358 } 2359 case CSSPropertyBorderLeft: { 2360 const int properties[3] = { CSSPropertyBorderLeftWidth, CSSPropertyBorderLeftStyle, 2361 CSSPropertyBorderLeftColor }; 2362 return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties)); 2363 } 2350 case CSSPropertyBorderBottom: 2351 return getCSSPropertyValuesForShorthandProperties(borderBottomLonghand()); 2352 case CSSPropertyBorderColor: 2353 return getCSSPropertyValuesForSidesShorthand(borderColorLonghand()); 2354 case CSSPropertyBorderLeft: 2355 return getCSSPropertyValuesForShorthandProperties(borderLeftLonghand()); 2364 2356 case CSSPropertyBorderImage: 2365 2357 return valueForNinePieceImage(style->borderImage(), cssValuePool); 2366 2358 case CSSPropertyBorderRadius: 2367 2359 return getBorderRadiusShorthandValue(style.get(), cssValuePool); 2368 case CSSPropertyBorderRight: { 2369 const int properties[3] = { CSSPropertyBorderRightWidth, CSSPropertyBorderRightStyle, 2370 CSSPropertyBorderRightColor }; 2371 return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties)); 2372 } 2373 case CSSPropertyBorderStyle: { 2374 const int properties[4] = { CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, 2375 CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle }; 2376 return getCSSPropertyValuesForSidesShorthand(properties); 2377 } 2378 case CSSPropertyBorderTop: { 2379 const int properties[3] = { CSSPropertyBorderTopWidth, CSSPropertyBorderTopStyle, 2380 CSSPropertyBorderTopColor }; 2381 return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties)); 2382 } 2383 case CSSPropertyBorderWidth: { 2384 const int properties[4] = { CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth, 2385 CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth }; 2386 return getCSSPropertyValuesForSidesShorthand(properties); 2387 } 2388 case CSSPropertyListStyle: { 2389 const int properties[3] = { CSSPropertyListStyleType, CSSPropertyListStylePosition, 2390 CSSPropertyListStyleImage }; 2391 return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties)); 2392 } 2393 case CSSPropertyMargin: { 2394 const int properties[4] = { CSSPropertyMarginTop, CSSPropertyMarginRight, 2395 CSSPropertyMarginBottom, CSSPropertyMarginLeft }; 2396 return getCSSPropertyValuesForSidesShorthand(properties); 2397 } 2398 case CSSPropertyOutline: { 2399 const int properties[3] = { CSSPropertyOutlineColor, CSSPropertyOutlineStyle, 2400 CSSPropertyOutlineWidth }; 2401 return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties)); 2402 } 2403 case CSSPropertyPadding: { 2404 const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight, 2405 CSSPropertyPaddingBottom, CSSPropertyPaddingLeft }; 2406 return getCSSPropertyValuesForSidesShorthand(properties); 2407 } 2360 case CSSPropertyBorderRight: 2361 return getCSSPropertyValuesForShorthandProperties(borderRightLonghand()); 2362 case CSSPropertyBorderStyle: 2363 return getCSSPropertyValuesForSidesShorthand(borderStyleLonghand()); 2364 case CSSPropertyBorderTop: 2365 return getCSSPropertyValuesForShorthandProperties(borderTopLonghand()); 2366 case CSSPropertyBorderWidth: 2367 return getCSSPropertyValuesForSidesShorthand(borderWidthLonghand()); 2368 case CSSPropertyListStyle: 2369 return getCSSPropertyValuesForShorthandProperties(listStyleLonghand()); 2370 case CSSPropertyMargin: 2371 return getCSSPropertyValuesForSidesShorthand(marginLonghand()); 2372 case CSSPropertyOutline: 2373 return getCSSPropertyValuesForShorthandProperties(outlineLonghand()); 2374 case CSSPropertyPadding: 2375 return getCSSPropertyValuesForSidesShorthand(paddingLonghand()); 2408 2376 /* Individual properties not part of the spec */ 2409 2377 case CSSPropertyBackgroundRepeatX: … … 2602 2570 } 2603 2571 2604 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForShorthandProperties(const int* properties, size_t size) const2572 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForShorthandProperties(const CSSPropertyLonghand& longhand) const 2605 2573 { 2606 2574 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 2607 for (size_t i = 0; i < size; ++i) {2608 RefPtr<CSSValue> value = getPropertyCSSValue( properties[i], DoNotUpdateLayout);2575 for (size_t i = 0; i < longhand.length(); ++i) { 2576 RefPtr<CSSValue> value = getPropertyCSSValue(longhand.properties()[i], DoNotUpdateLayout); 2609 2577 list->append(value); 2610 2578 } … … 2612 2580 } 2613 2581 2614 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForSidesShorthand(const int* properties) const2582 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForSidesShorthand(const CSSPropertyLonghand& longhand) const 2615 2583 { 2616 2584 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 2617 2585 // Assume the properties are in the usual order top, right, bottom, left. 2618 RefPtr<CSSValue> topValue = getPropertyCSSValue( properties[0], DoNotUpdateLayout);2619 RefPtr<CSSValue> rightValue = getPropertyCSSValue( properties[1], DoNotUpdateLayout);2620 RefPtr<CSSValue> bottomValue = getPropertyCSSValue( properties[2], DoNotUpdateLayout);2621 RefPtr<CSSValue> leftValue = getPropertyCSSValue( properties[3], DoNotUpdateLayout);2586 RefPtr<CSSValue> topValue = getPropertyCSSValue(longhand.properties()[0], DoNotUpdateLayout); 2587 RefPtr<CSSValue> rightValue = getPropertyCSSValue(longhand.properties()[1], DoNotUpdateLayout); 2588 RefPtr<CSSValue> bottomValue = getPropertyCSSValue(longhand.properties()[2], DoNotUpdateLayout); 2589 RefPtr<CSSValue> leftValue = getPropertyCSSValue(longhand.properties()[3], DoNotUpdateLayout); 2622 2590 2623 2591 // All 4 properties must be specified. -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h
r107407 r112254 30 30 31 31 class CSSPrimitiveValue; 32 class CSSPropertyLonghand; 32 33 class CSSValueList; 33 34 class CSSValuePool; … … 110 111 #endif 111 112 112 PassRefPtr<CSSValueList> getCSSPropertyValuesForShorthandProperties(const int* properties, size_t) const;113 PassRefPtr<CSSValueList> getCSSPropertyValuesForSidesShorthand(const int* properties) const;113 PassRefPtr<CSSValueList> getCSSPropertyValuesForShorthandProperties(const CSSPropertyLonghand&) const; 114 PassRefPtr<CSSValueList> getCSSPropertyValuesForSidesShorthand(const CSSPropertyLonghand&) const; 114 115 115 116 RefPtr<Node> m_node; -
trunk/Source/WebCore/css/CSSPropertyLonghand.cpp
r112078 r112254 221 221 { 222 222 static const int outlineProperties[] = { 223 CSSPropertyOutline Width,223 CSSPropertyOutlineColor, 224 224 CSSPropertyOutlineStyle, 225 CSSPropertyOutlineColor, 226 CSSPropertyOutlineOffset 225 CSSPropertyOutlineWidth 227 226 }; 228 227 DEFINE_STATIC_LOCAL(CSSPropertyLonghand, outlineLonghand, (outlineProperties, WTF_ARRAY_LENGTH(outlineProperties)));
Note: See TracChangeset
for help on using the changeset viewer.