Add a settings to disallow initializing background-size if background shorthand doesn...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Mar 2013 00:25:18 +0000 (00:25 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Mar 2013 00:25:18 +0000 (00:25 +0000)
commitc4cc180e1c6227d7e48741b503e927a32f2d149b
tree0dda022b8c0c9f80c0962b7755dc021717d44a14
parent291ef4754df118bbe20b8a98e99acd0b0a4a5ad0
Add a settings to disallow initializing background-size if background shorthand doesn't include it.
https://bugs.webkit.org/show_bug.cgi?id=113363

Source/WebCore:

Patch by KyungTae Kim <ktf.kim@samsung.com> and Yongjun Zhang <yongjun_zhang@apple.com> on 2013-03-27
Reviewed by David Kilzer.

This is based on KyungTae Kim's patch in https://bugs.webkit.org/show_bug.cgi?id=97761.  Many legacy sites set
background-size first and then set background for setting background-image.  For backward-compatibility
in some WebKit based clients, if 'background' shorthand have no 'background-size' attribute, we could add
a settings to let the css parser not initialize 'background-size'.

Test: fast/backgrounds/background-shorthand-after-set-backgroundSize.html

* css/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext): initialize useLegacyBackgroundSizeShorthandBehavior.
(WebCore::operator==):
(WebCore::CSSParser::useLegacyBackgroundSizeShorthandBehavior): add a method to return if we want background-size
    to be initialized by background shorthand.
(WebCore):
(WebCore::CSSParser::parseFillShorthand): don't initialize background-size in background shorthand if we have
    useLegacyBackgroundSizeShorthandBehavior set to true.
* css/CSSParser.h:
(CSSParser):
* css/CSSParserMode.h: add member useLegacyBackgroundSizeShorthandBehavior to CSSParserContext.
(CSSParserContext):
* page/Settings.in: initialize useLegacyBackgroundSizeShorthandBehavior to false.
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup): add the new settings useLegacyBackgroundSizeShorthandBehavior to Backup.
(WebCore::InternalSettings::Backup::restoreTo): restore useLegacyBackgroundSizeShorthandBehavior from Backup.
(WebCore::InternalSettings::setUseLegacyBackgroundSizeShorthandBehavior):
(WebCore):
* testing/InternalSettings.h:
(Backup):
(InternalSettings):
* testing/InternalSettings.idl: add a JS testing API setUseLegacyBackgroundSizeShorthandBehavior to turn on/off
    the new settings.

LayoutTests:

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2013-03-27
Reviewed by David Kilzer.

Add test for the new settings useLegacyBackgroundSizeShorthandBehavior.

* fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt: Added.
* fast/backgrounds/background-shorthand-after-set-backgroundSize.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@147034 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/backgrounds/background-shorthand-after-set-backgroundSize-expected.txt [new file with mode: 0644]
LayoutTests/fast/backgrounds/background-shorthand-after-set-backgroundSize.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSParserMode.h
Source/WebCore/page/Settings.in
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl