Implement parsing for CSS scroll snap points
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Aug 2014 00:19:40 +0000 (00:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Aug 2014 00:19:40 +0000 (00:19 +0000)
commit2b3a41ea2d8fcc4bf28f11954dc6e17db49ee4c2
tree158ff532462ebdc641fc07da83fd2b96e29c3f2c
parent409b93e112b037cbf75194854f5cd77f9fd3d3a2
Implement parsing for CSS scroll snap points
https://bugs.webkit.org/show_bug.cgi?id=134301

Source/JavaScriptCore:

Patch by Wenson Hsieh <wenson_hsieh@apple.com> on 2014-08-06
Reviewed by Dean Jackson.

* Configurations/FeatureDefines.xcconfig: Added ENABLE_CSS_SCROLL_SNAP

Source/WebCore:

Provided support for parsing -webkit-scroll-snap-* properties, i.e.  type, points-x, points-y, destination, and coordinates.
The exact syntax of the scroll snap CSS properties follow the W3C spec at http://dev.w3.org/csswg/css-snappoints/

Patch by Wenson Hsieh <wenson_hsieh@apple.com> on 2014-08-06
Reviewed by Dean Jackson.

Tests: css3/scroll-snap/scroll-snap-property-parsing.html,
    css3/scroll-snap/scroll-snap-property-computed-style.html

* CMakeLists.txt: Added StyleScrollSnapPoints.h, StyleScrollSnapPoints.cpp
* Configurations/FeatureDefines.xcconfig: Added ENABLE_CSS_SCROLL_SNAP
* WebCore.vcxproj/WebCore.vcxproj: Added StyleScrollSnapPoints.h, StyleScrollSnapPoints.cpp
* WebCore.vcxproj/WebCore.vcxproj.filters: Added StyleScrollSnapPoints.h, StyleScrollSnapPoints.cpp
* WebCore.xcodeproj/project.pbxproj: Added StyleScrollSnapPoints.h, StyleScrollSnapPoints.cpp, LengthRepeat.h
* css/CSSCalculationValue.cpp: Support for LengthRepeat
(WebCore::hasDoubleValue):
* css/CSSComputedStyleDeclaration.cpp: Support for showing computed style for snap point properties.
(WebCore::scrollSnapDestination):
(WebCore::scrollSnapPoints):
(WebCore::scrollSnapCoordinates):
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSParser.cpp: Support for parsing snap point properties.
(WebCore::isValidKeywordPropertyAndValue): handle snap point type
(WebCore::isKeywordPropertyID):
(WebCore::CSSParser::parseValue): Added support for parsing snap points.
(WebCore::CSSParser::parseNonElementSnapPoints): Helper for parsing snap points-x/y.
(WebCore::CSSParser::parseScrollSnapDestination): Helper for parsing snap point destinations.
(WebCore::CSSParser::parseScrollSnapCoordinate): Helper for parsing snap point coordinates.
* css/CSSParser.h: Support for parsing snap point properties.
* css/CSSParserValues.cpp:
(WebCore::CSSParserValue::createCSSValue):
* css/CSSPrimitiveValue.cpp:
(WebCore::isValidCSSUnitTypeForDoubleConversion):
(WebCore::CSSPrimitiveValue::init):
(WebCore::CSSPrimitiveValue::cleanup):
(WebCore::CSSPrimitiveValue::getLengthRepeatValue):
(WebCore::CSSPrimitiveValue::formatNumberForcustomCSSText):
(WebCore::CSSPrimitiveValue::cloneForCSSOM):
(WebCore::CSSPrimitiveValue::equals):
* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::isLengthRepeat):
(WebCore::CSSPrimitiveValue::getLengthRepeatValue):
* css/CSSPrimitiveValueMappings.h: Added converters for snap point type properties.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ScrollSnapType):
* css/CSSPropertyNames.in: Added relevant snap point property names.
* css/CSSValueKeywords.in: Added "proximity", "mandatory" and "elements".
* css/LengthRepeat.h: Added to represent values of repeat(<length>)
(WebCore::LengthRepeat::create):
(WebCore::LengthRepeat::cloneForCSSOM):
(WebCore::LengthRepeat::interval):
(WebCore::LengthRepeat::setInterval):
(WebCore::LengthRepeat::equals):
(WebCore::LengthRepeat::cssText):
(WebCore::LengthRepeat::LengthRepeat):
* css/StyleResolver.cpp: Support for handling snap point properties
(WebCore::StyleResolver::applyProperty):Updated switch case to build snap-point-related style data
* rendering/style/RenderStyle.h: Added methods to access and modify snap point data
* rendering/style/RenderStyleConstants.h: Added scroll snap type flags.
* rendering/style/StyleAllInOne.cpp: Added StyleScrollSnapPoints.cpp
* rendering/style/StyleRareNonInheritedData.cpp: Added initiazing for m_scrollSnapPoints, updated equality check
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h: Added field for StyleScrollSnapPoints
* rendering/style/StyleScrollSnapPoints.cpp: Added. Wrapper for basic snap point data structures.
(WebCore::StyleScrollSnapPoints::StyleScrollSnapPoints):
(WebCore::StyleScrollSnapPoints::copy):
(WebCore::StyleScrollSnapPoints::operator==):
* rendering/style/StyleScrollSnapPoints.h: Added.
(WebCore::StyleScrollSnapPoints::create):
(WebCore::StyleScrollSnapPoints::defaultRepeatOffset): Creates a new Length representing the default repeat value of repeat(100%)
(WebCore::StyleScrollSnapPoints::defaultDestinationOffset): Creates a new Length representing a default destination value (0px)
(WebCore::StyleScrollSnapPoints::operator!=):

Source/WebInspectorUI:

Patch by Wenson Hsieh <wenson_hsieh@apple.com> on 2014-08-06
Reviewed by Dean Jackson.

* UserInterface/Models/CSSKeywordCompletions.js: Added snap point property keywords, such as mandatory, proximity, elements, and repeat.

Source/WebKit/mac:

Patch by Wenson Hsieh <wenson_hsieh@apple.com> on 2014-08-06
Reviewed by Dean Jackson.

* Configurations/FeatureDefines.xcconfig: Added ENABLE_CSS_SCROLL_SNAP

Source/WebKit2:

Patch by Wenson Hsieh <wenson_hsieh@apple.com> on 2014-08-06
Reviewed by Dean Jackson.

* Configurations/FeatureDefines.xcconfig: Added ENABLE_CSS_SCROLL_SNAP

LayoutTests:

Patch by Wenson Hsieh <wenson_hsieh@apple.com> on 2014-08-06
Reviewed by Dean Jackson.

Tests that parsing -webkit-scroll-snap-* properties behaves as expected.

* css3/scroll-snap/scroll-snap-property-computed-style-expected.txt: Expected text output of below test.
* css3/scroll-snap/scroll-snap-property-computed-style.html: Tests that scroll snap properties are correctly displayed via getComputedStyle.
* css3/scroll-snap/scroll-snap-property-computed-style.js: Script for above test.
(testComputedScrollSnapRule):
* css3/scroll-snap/scroll-snap-property-parsing-expected.txt: Expected text output of below test.
* css3/scroll-snap/scroll-snap-property-parsing.html: Tests that scroll snap properties are correctly parsed.
* css3/scroll-snap/scroll-snap-property-parsing.js: Script for above test.
(testScrollSnapRule):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
43 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style-expected.txt [new file with mode: 0644]
LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style.html [new file with mode: 0644]
LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style.js [new file with mode: 0644]
LayoutTests/css3/scroll-snap/scroll-snap-property-parsing-expected.txt [new file with mode: 0644]
LayoutTests/css3/scroll-snap/scroll-snap-property-parsing.html [new file with mode: 0644]
LayoutTests/css3/scroll-snap/scroll-snap-property-parsing.js [new file with mode: 0644]
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSParserValues.cpp
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSPrimitiveValue.h
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/LengthRepeat.h [new file with mode: 0644]
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleAllInOne.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.h
Source/WebCore/rendering/style/StyleScrollSnapPoints.cpp [new file with mode: 0644]
Source/WebCore/rendering/style/StyleScrollSnapPoints.h [new file with mode: 0644]
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
Source/WebKit2/ChangeLog
Source/WebKit2/Configurations/FeatureDefines.xcconfig