[CSS3 Backgrounds and Borders] Implement CSS3 background-position offsets rendering.
authoralexis@webkit.org <alexis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Dec 2012 11:55:28 +0000 (11:55 +0000)
committeralexis@webkit.org <alexis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Dec 2012 11:55:28 +0000 (11:55 +0000)
commit95ad8a6abd822368c4d49bd1e92d39203dbf0541
tree8c130636d77231ec7fed45c2c8fc58467d69b432
parent20095e95330777e9fa0fbfe202d5a4fb1dbdaa1e
[CSS3 Backgrounds and Borders] Implement CSS3 background-position offsets rendering.
https://bugs.webkit.org/show_bug.cgi?id=103440

Reviewed by Julien Chaffraix.

Source/WebCore:

Add the rendering bits of the new background-position offsets. It adds
new bits in FillLayer to store the edges used to position the
background. The old x and y members are used the same way as before, to
store the value of the offset.

Test: fast/backgrounds/background-position-rendering.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::createPositionListForLayer): Refactor into a function the
code duplicated in getPropertyCSSValue to avoid more code
duplication.
(WebCore):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore):
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
Add implicit conversion from the enums used in the rendering code to
CSS values.
(WebCore::CSSPrimitiveValue::operator BackgroundEdgeOrigin):
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapFillXPosition):
(WebCore::CSSToStyleMap::mapFillYPosition):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Add
support for the new positioning and refactor a little naming of the
variables for better readability.
* rendering/style/FillLayer.cpp:
(SameSizeAsFillLayer):
(WebCore::FillLayer::FillLayer):
(WebCore::FillLayer::operator=):
(WebCore::FillLayer::operator==):
(WebCore::FillLayer::fillUnsetProperties):
(WebCore::FillLayer::fillUnsetProperties): When filling the layer with
unset properties make sure we also set the x and y origins of the
background in case they were set.
* rendering/style/FillLayer.h:
(WebCore::FillLayer::backgroundXOrigin):
(WebCore::FillLayer::backgroundYOrigin):
(WebCore::FillLayer::isBackgroundOriginSet):
(FillLayer):
(WebCore::FillLayer::setBackgroundXOrigin):
(WebCore::FillLayer::setBackgroundYOrigin):
(WebCore::FillLayer::clearPositionX):
(WebCore::FillLayer::clearPositionY):
* rendering/style/RenderStyleConstants.h:

LayoutTests:

Uncomment the computed style tests from background-position-parsing-2
and add the expected output. Add a new
background-position-rendering test to verify that the background has a
correct position with the new <position> value. I also covered some old
CSS 2.1 values for verification.

* fast/backgrounds/background-position-parsing-2-expected.txt:
* fast/backgrounds/background-position-parsing-2.html:
* fast/backgrounds/background-position-rendering-expected.html: Added.
* fast/backgrounds/background-position-rendering.html: Added.
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/backgrounds/background-position-parsing-2-expected.txt
LayoutTests/fast/backgrounds/background-position-parsing-2.html
LayoutTests/fast/backgrounds/background-position-rendering-expected.html [new file with mode: 0644]
LayoutTests/fast/backgrounds/background-position-rendering.html [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wincairo/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSToStyleMap.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/style/FillLayer.cpp
Source/WebCore/rendering/style/FillLayer.h
Source/WebCore/rendering/style/RenderStyleConstants.h