REGRESSION(r184895): border-image should always slice the SVG image to nine pieces...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Oct 2015 19:51:11 +0000 (19:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Oct 2015 19:51:11 +0000 (19:51 +0000)
commit1d0eaf2d78df40d479d04e5f9b29bcdc52244383
tree2ba08c41010b59a44e13adb72dc730018e955f26
parentf1548080ffaccb0e17d45864c4e313fba5197e0d
REGRESSION(r184895): border-image should always slice the SVG image to nine pieces when drawing it in the container element
https://bugs.webkit.org/show_bug.cgi?id=149901
<rdar://problem/21995596>

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2015-10-12
Reviewed by Darin Adler.

Source/WebCore:

The nine-pieces algorithm should be applied to the border-image regardless
whether the image has an intrinsic size or not. It is not guaranteed to have
a meaningful border-image in all the cases of non-intrinsic size images. But
it should work as expected in most of the cases.

* rendering/RenderBoxModelObject.cpp:
* rendering/RenderBoxModelObject.h:
(WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions):
Revert the changes which were added to return whether the image has
intrinsic size or not.

(WebCore::RenderBoxModelObject::calculateFillTileSize):
(WebCore::RenderBoxModelObject::paintNinePieceImage):
Size of the image is now the return value of calculateImageIntrinsicDimensions().

* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::updateContent):
* rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::ShapeOutsideInfo::createShapeForImage):
Size of the image is now the return value of calculateImageIntrinsicDimensions().

* rendering/style/NinePieceImage.cpp:
* rendering/style/NinePieceImage.h:
(WebCore::NinePieceImage::paint):
Delete the logic for the non-intrinsic case. Both intrinsic and non-intrinsic
cases will be treated the same.

(WebCore::NinePieceImage::computeNineRects):
(WebCore::NinePieceImage::computeSideTileScale):
(WebCore::NinePieceImage::computeMiddleTileScale):
(WebCore::NinePieceImage::computeTileScales):
(WebCore::NinePieceImage::computeIntrinsicRects): Deleted.
(WebCore::NinePieceImage::computeIntrinsicSideTileScale): Deleted.
(WebCore::NinePieceImage::computeIntrinsicMiddleTileScale): Deleted.
(WebCore::NinePieceImage::computeIntrinsicTileScales): Deleted.
Remove *Intrinsic* from the name of the functions.

(WebCore::NinePieceImage::computeNonIntrinsicRects): Deleted.
(WebCore::NinePieceImage::computeNonIntrinsicTileScales): Deleted.
Delete the *NonIntrinsic* functions.

LayoutTests:

* fast/borders/border-image-fill-no-intrinsic-size-expected.html:
* fast/borders/border-image-fill-no-intrinsic-size.html:
* fast/borders/resources/svg-border-100x100-relative.svg: Added.
* fast/borders/resources/svg-border-100x100-viewbox.svg: Added.
* fast/borders/resources/svg-border-140x140-intrinsic.svg:
New test cases for relative lengths border images were added. The relative
lengths can be specified by using percentage lengths or adding viewBox to
the root element.

One of the non-intrinsic image-borders must be removed from this test.
The SVG image in the expected file has to be scaled by (100 / 140), which
can be done. But run-webkit-tests found a very slight difference between
the actual and the result files.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/borders/border-image-fill-no-intrinsic-size-expected.html
LayoutTests/fast/borders/border-image-fill-no-intrinsic-size.html
LayoutTests/fast/borders/resources/svg-border-100x100-relative.svg [new file with mode: 0644]
LayoutTests/fast/borders/resources/svg-border-100x100-viewbox.svg [new file with mode: 0644]
LayoutTests/fast/borders/resources/svg-border-140x140-intrinsic.svg
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderListMarker.cpp
Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp
Source/WebCore/rendering/style/NinePieceImage.cpp
Source/WebCore/rendering/style/NinePieceImage.h