Add CSS -webkit-appearance property for Apple Pay buttons
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2016 17:45:56 +0000 (17:45 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2016 17:45:56 +0000 (17:45 +0000)
commitda47d9e4ae6994efb30546102e823b9d4daad755
tree83c2a865eee149f13a6d1f534f0c2dfd6a4382bc
parent7c99df1dbd4f2902cd774070828e25b132adad08
Add CSS -webkit-appearance property for Apple Pay buttons
https://bugs.webkit.org/show_bug.cgi?id=161986

Reviewed by Dean Jackson.

Add a new -webkit-appearance property, "-apple-pay-button".
Also, add two properties, "-apple-pay-button-type" and "-apple-pay-button-style".

* WebCore.xcodeproj/project.pbxproj:
Add RenderThemeCocoa.h and RenderThemeCocoa.mm.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ApplePayButtonStyle):
(WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
Add ApplePayButtonStyle and ApplePayButtonType conversion routines.

* css/CSSPropertyNames.in:
Add -apple-pay-button-style and -apple-pay-button-type.

* css/CSSValueKeywords.in:
Add CSS values.

* css/parser/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.

(WebCore::isAppleLegacyCSSPropertyKeyword):
New function that returns whether the CSS property should be rewritten to -webkit-.
We want to rewrite -apple- but not -apple-pay-.

(WebCore::cssPropertyID):
Use the newly added isAppleLegacyCSSPropertyKeyword.

(WebCore::isAppleLegacyCSSValueKeyword):
Check for "-apple-pay-" in addition to "-apple-system-".

* platform/ThemeTypes.h:
Add ApplePayButtonPart.

* platform/spi/cocoa/PassKitSPI.h:
Add PKDrawApplePayButton declaration.

* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
Handle ApplePayButtonPart.

(WebCore::RenderTheme::paint):
Handle ApplePayButtonPart.

* rendering/RenderTheme.h:
(WebCore::RenderTheme::adjustApplePayButtonStyle):
(WebCore::RenderTheme::paintApplePayButton):
Add new functions.

* rendering/RenderThemeCocoa.h: Added.
* rendering/RenderThemeCocoa.mm: Added.
(WebCore::RenderThemeCocoa::adjustApplePayButtonStyle):
Adjust the minimum width and minimum height accordingly.

(WebCore::toPKPaymentButtonStyle):
(WebCore::toPKPaymentButtonType):
Helper functions that convert our WebCore types to PK types.

(WebCore::RenderThemeCocoa::paintApplePayButton):
Call PKDrawApplePayButton.

* rendering/RenderThemeIOS.h:
* rendering/RenderThemeMac.h:
Inherit from RenderThemeCocoa.

* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::applePayButtonStyle):
(WebCore::RenderStyle::applePayButtonType):
(WebCore::RenderStyle::setApplePayButtonStyle):
(WebCore::RenderStyle::setApplePayButtonType):
(WebCore::RenderStyle::initialApplePayButtonStyle):
(WebCore::RenderStyle::initialApplePayButtonType):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):
* rendering/style/StyleRareInheritedData.h:
Add new style members for the button style and button type properties.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/parser/CSSParser.cpp
Source/WebCore/css/parser/CSSParserFastPaths.cpp
Source/WebCore/platform/ThemeTypes.h
Source/WebCore/platform/spi/cocoa/PassKitSPI.h
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeCocoa.h [new file with mode: 0644]
Source/WebCore/rendering/RenderThemeCocoa.mm [new file with mode: 0644]
Source/WebCore/rendering/RenderThemeIOS.h
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.h