Support CSS3 Images values for the image-rendering property
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jan 2016 23:31:38 +0000 (23:31 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jan 2016 23:31:38 +0000 (23:31 +0000)
commitb4d29916e27a3a5489256cc92cd5997ff8023b66
treed8a60d843688dc0ab89d0be7c09fc7806e0e2ba7
parentaf41ee43084986b3355ae2e70bda1b18e15a4ff6
Support CSS3 Images values for the image-rendering property
https://bugs.webkit.org/show_bug.cgi?id=153556

Reviewed by Dean Jackson.

Source/WebCore:

CSS3 Images has the following values for image-rendering:
    auto, crisp-edges, pixelated

The old code supported:
    optimizeSpeed, optimizeQuality, -webkit-crisp-edges, -webkit-optimize-contrast

Add support for the new values without prefixes. Map -webkit-crisp-edges to crisp-edges,
and -webkit-optimize-contrast to crisp-edges. Support pixelated which behaves like
crisp-edges (a low quality scale).

The spec says that optimizeQuality should behave like 'auto', but that would be
a behavior change since ImageQualityController::shouldPaintAtLowQuality() currently
uses it as a trigger to avoid low quality scaling, so don't change that for now.

No new tests, covered by fast/css/script-tests/image-rendering-parsing.js

* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator EImageRendering):
* css/CSSValueKeywords.in:
* rendering/ImageQualityController.cpp:
(WebCore::ImageQualityController::shouldPaintAtLowQuality):
* rendering/RenderHTMLCanvas.cpp:
(WebCore::RenderHTMLCanvas::paintReplaced):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareInheritedData.h: Need another bit.

Source/WebInspectorUI:

Add "crisp-edges", "pixelated" to the suggestions for image-rendering.

* UserInterface/Models/CSSKeywordCompletions.js:

LayoutTests:

Update for new values. Add a new SVG shape-rendering test which would have
detected a bug I caused with an earlier patch.

* fast/css/image-rendering-parsing-expected.txt:
* fast/css/script-tests/image-rendering-parsing.js:
* svg/css/script-tests/shape-rendering-parsing.js: Added.
* svg/css/shape-rendering-parsing.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/image-rendering-parsing-expected.txt
LayoutTests/fast/css/script-tests/image-rendering-parsing.js
LayoutTests/svg/css/script-tests/shape-rendering-parsing.js [new file with mode: 0644]
LayoutTests/svg/css/shape-rendering-parsing-expected.txt [new file with mode: 0644]
LayoutTests/svg/css/shape-rendering-parsing.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/rendering/ImageQualityController.cpp
Source/WebCore/rendering/RenderHTMLCanvas.cpp
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleRareInheritedData.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js