Skip to content
  • commit-queue@webkit.org's avatar
    Add a settings to disallow initializing background-size if background shorthand doesn't include it. · 27d6ce71
    commit-queue@webkit.org authored
    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: http://svn.webkit.org/repository/webkit/trunk@147034 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    27d6ce71