Changeset 133458 in webkit
- Timestamp:
- Nov 5, 2012 4:47:46 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r133456 r133458 1 2012-11-05 Thiago Marcos P. Santos <thiago.santos@intel.com> 2 3 Validate CSS Device Adaptation properties and resolve shorthands 4 https://bugs.webkit.org/show_bug.cgi?id=95962 5 6 Reviewed by Alexis Menard. 7 8 Added a test for CSS Device Adaptation property parsing validation. 9 10 * css3/device-adapt/viewport-properties-validation-expected.txt: Added. 11 * css3/device-adapt/viewport-properties-validation.html: Added. 12 1 13 2012-11-05 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r133451 r133458 1 2012-11-05 Thiago Marcos P. Santos <thiago.santos@intel.com> 2 3 Validate CSS Device Adaptation properties and resolve shorthands 4 https://bugs.webkit.org/show_bug.cgi?id=95962 5 6 Reviewed by Alexis Menard. 7 8 Add the missing keywords and properties for the viewport at-rule. 9 Note that we have to mark that we are inside a viewport scope because 10 some properties are not validated as they would be inside a style 11 rule. As an example, the semantics of CSSPropertyWidth are completely 12 different: on a viewport rule, it stands for a shorthand for the 13 minimum and maximum width. 14 15 Test: css3/device-adapt/viewport-properties-validation.html 16 17 * css/CSSComputedStyleDeclaration.cpp: 18 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 19 * css/CSSParser.cpp: 20 (WebCore::CSSParser::parseValue): 21 (WebCore): 22 (WebCore::CSSParser::parseViewportProperty): 23 (WebCore::CSSParser::parseViewportShorthand): 24 * css/CSSParser.h: 25 * css/CSSProperty.cpp: 26 (WebCore::CSSProperty::isInheritedProperty): 27 * css/CSSPropertyNames.in: 28 * css/CSSValueKeywords.in: 29 1 30 2012-11-05 Sheriff Bot <webkit.review.bot@gmail.com> 2 31 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r132960 r133458 2650 2650 break; 2651 2651 2652 #if ENABLE(CSS_DEVICE_ADAPTATION) 2653 case CSSPropertyMaxZoom: 2654 case CSSPropertyMinZoom: 2655 case CSSPropertyOrientation: 2656 case CSSPropertyUserZoom: 2657 break; 2658 #endif 2659 2652 2660 #if ENABLE(SVG) 2653 2661 case CSSPropertyClipPath: -
trunk/Source/WebCore/css/CSSParser.cpp
r133387 r133458 7 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 8 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 10 * 10 11 * This library is free software; you can redistribute it and/or … … 1730 1731 } 1731 1732 1733 #if ENABLE(CSS_DEVICE_ADAPTATION) 1734 if (inViewport()) 1735 return parseViewportProperty(propId, important); 1736 #endif 1737 1732 1738 bool validPrimitive = false; 1733 1739 RefPtr<CSSValue> parsedValue; … … 2857 2863 ASSERT_NOT_REACHED(); 2858 2864 return false; 2865 #if ENABLE(CSS_DEVICE_ADAPTATION) 2866 // Properties bellow are validated inside parseViewportProperty, because we 2867 // check for parser state inViewportScope. We need to invalidate if someone 2868 // adds them outside a @viewport rule. 2869 case CSSPropertyMaxZoom: 2870 case CSSPropertyMinZoom: 2871 case CSSPropertyOrientation: 2872 case CSSPropertyUserZoom: 2873 validPrimitive = false; 2874 break; 2875 #endif 2859 2876 #if ENABLE(SVG) 2860 2877 default: … … 10418 10435 return result; 10419 10436 } 10437 10438 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) 10439 { 10440 CSSParserValue* value = m_valueList->current(); 10441 if (!value) 10442 return false; 10443 10444 int id = value->id; 10445 bool validPrimitive = false; 10446 10447 switch (propId) { 10448 case CSSPropertyMinWidth: // auto | device-width | device-height | <length> | <percentage> 10449 case CSSPropertyMaxWidth: 10450 case CSSPropertyMinHeight: 10451 case CSSPropertyMaxHeight: 10452 if (id == CSSValueAuto || id == CSSValueDeviceWidth || id == CSSValueDeviceHeight) 10453 validPrimitive = true; 10454 else 10455 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg)); 10456 break; 10457 case CSSPropertyWidth: // shorthand 10458 return parseViewportShorthand(propId, CSSPropertyMinWidth, CSSPropertyMaxWidth, important); 10459 case CSSPropertyHeight: 10460 return parseViewportShorthand(propId, CSSPropertyMinHeight, CSSPropertyMaxHeight, important); 10461 case CSSPropertyMinZoom: // auto | <number> | <percentage> 10462 case CSSPropertyMaxZoom: 10463 case CSSPropertyZoom: 10464 if (id == CSSValueAuto) 10465 validPrimitive = true; 10466 else 10467 validPrimitive = (!id && validUnit(value, FNumber | FPercent | FNonNeg)); 10468 break; 10469 case CSSPropertyUserZoom: // zoom | fixed 10470 if (id == CSSValueZoom || id == CSSValueFixed) 10471 validPrimitive = true; 10472 break; 10473 case CSSPropertyOrientation: // auto | portrait | landscape 10474 if (id == CSSValueAuto || id == CSSValuePortrait || id == CSSValueLandscape) 10475 validPrimitive = true; 10476 default: 10477 break; 10478 } 10479 10480 RefPtr<CSSValue> parsedValue; 10481 if (validPrimitive) { 10482 parsedValue = parseValidPrimitive(id, value); 10483 m_valueList->next(); 10484 } 10485 10486 if (parsedValue) { 10487 if (!m_valueList->current() || inShorthand()) { 10488 addProperty(propId, parsedValue.release(), important); 10489 return true; 10490 } 10491 } 10492 10493 return false; 10494 } 10495 10496 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first, CSSPropertyID second, bool important) 10497 { 10498 unsigned numValues = m_valueList->size(); 10499 10500 if (numValues > 2) 10501 return false; 10502 10503 ShorthandScope scope(this, propId); 10504 10505 if (!parseViewportProperty(first, important)) 10506 return false; 10507 10508 // If just one value is supplied, the second value 10509 // is implicitly initialized with the first value. 10510 if (numValues == 1) 10511 m_valueList->previous(); 10512 10513 return parseViewportProperty(second, important); 10514 } 10420 10515 #endif 10421 10516 -
trunk/Source/WebCore/css/CSSParser.h
r133387 r133458 525 525 526 526 #if ENABLE(CSS_DEVICE_ADAPTATION) 527 bool parseViewportProperty(CSSPropertyID propId, bool important); 528 bool parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first, CSSPropertyID second, bool important); 529 527 530 bool inViewport() const { return m_inViewport; } 528 531 bool m_inViewport; -
trunk/Source/WebCore/css/CSSProperty.cpp
r133138 r133458 682 682 case CSSPropertyWebkitAppRegion: 683 683 #endif 684 #if ENABLE(CSS_DEVICE_ADAPTATION) 685 case CSSPropertyMaxZoom: 686 case CSSPropertyMinZoom: 687 case CSSPropertyOrientation: 688 case CSSPropertyUserZoom: 689 #endif 684 690 return false; 685 691 case CSSPropertyInvalid: -
trunk/Source/WebCore/css/CSSPropertyNames.in
r131925 r133458 403 403 -webkit-wrap 404 404 #endif 405 #if defined(ENABLE_CSS_DEVICE_ADAPTATION) && ENABLE_CSS_DEVICE_ADAPTATION 406 max-zoom 407 min-zoom 408 orientation 409 user-zoom 410 #endif 405 411 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS 406 412 -webkit-tap-highlight-color -
trunk/Source/WebCore/css/CSSValueKeywords.in
r132942 r133458 776 776 reset 777 777 778 #if defined(ENABLE_CSS_DEVICE_ADAPTATION) && ENABLE_CSS_DEVICE_ADAPTATION 779 // 780 // CSS_PROP_USER_ZOOM 781 // 782 // fixed 783 zoom 784 785 // 786 // CSS_PROP_MIN_WIDTH 787 // CSS_PROP_MAX_WIDTH 788 // CSS_PROP_MIN_HEIGHT 789 // CSS_PROP_MAX_HEIGHT 790 // 791 // auto 792 device-width 793 device-height 794 #endif 795 778 796 // 779 797 // CSS_PROP_POINTER_EVENTS
Note: See TracChangeset
for help on using the changeset viewer.