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)
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

index b10ffa673c31c0e96f522cf2c50c096ea26ee9d2..e84a8302ef2f85e5fa012342cc374bfa4d982185 100644 (file)
@@ -1,3 +1,25 @@
+2015-10-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        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>
+
+        Reviewed by Darin Adler.
+
+        * 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.        
+
 2015-10-12  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Unreviewed gardening
index 5a58d93d16a3034f7cd6c99e2413c62fb629d2ae..6c5a91c390aa8f89479bba5bdc6d9f267a3d8131 100644 (file)
@@ -4,13 +4,19 @@
     .box {
       height: 100px;
       width: 100px;
-      margin: 10px;
       display: inline-block;
       background-color: red;
     }
-    .border {
+    .border-20 {
       border: 20px solid;
     }
+    .border-40 {
+      border: solid;
+      border-top: 0px;
+      border-right: 40px;
+      border-bottom: 40px;
+      border-left: 0px;      
+    }
     .no-border {
       border: 0px none;
     }
@@ -20,6 +26,9 @@
     .border-image-100-intrinsic-slice {
        border-image: url('resources/svg-border-100x100-intrinsic.svg') 20 fill;
     }
+    .border-image-140-intrinsic {
+       border-image: url('resources/svg-border-140x140-intrinsic.svg') 0 fill;
+    }
     .border-image-140-intrinsic-slice {
        border-image: url('resources/svg-border-140x140-intrinsic.svg') 20 fill;
     }
 </head>
 <body>
   <div class="box no-border border-image-100-intrinsic"></div>
-  <div class="box border    border-image-100-intrinsic"></div>
+  <div class="box border-20 border-image-100-intrinsic"></div>
+  <div class="box no-border border-image-100-intrinsic-slice"></div>
+  <div class="box border-20 border-image-100-intrinsic-slice"></div>
+  <br>
+  <div class="box no-border border-image-100-intrinsic"></div>
+  <div class="box border-20 border-image-100-intrinsic"></div>
   <div class="box no-border border-image-100-intrinsic-slice"></div>
-  <div class="box border    border-image-100-intrinsic-slice"></div>
+  <div class="box border-20 border-image-140-intrinsic-slice"></div>
   <br>
   <div class="box no-border border-image-100-intrinsic"></div>
-  <div class="box border    border-image-100-intrinsic"></div>
+  <div class="box border-20 border-image-100-intrinsic"></div>
+  <div class="box no-border border-image-100-intrinsic-slice"></div>
+  <div class="box border-20 border-image-140-intrinsic-slice"></div>
+  <br>
   <div class="box no-border border-image-100-intrinsic"></div>
-  <div class="box border    border-image-140-intrinsic-slice"></div>
+  <div class="box border-20"></div>
+  <div class="box no-border border-image-100-intrinsic-slice"></div>
+  <div class="box border-40 border-image-100-intrinsic"></div>
 </body>
index 8696b6f2867c83ac7a863b277bc98572c0efdeb2..f4991ebf8ec2721c3a8a6d966e428949d5fb1fbe 100644 (file)
@@ -4,11 +4,10 @@
     .box {
       height: 100px;
       width: 100px;
-      margin: 10px;
       display: inline-block;
       background-color: red;
     }
-    .border {
+    .border-20 {
       border: 20px solid;
     }
     .no-border {
     .border-image-100-intrinsic-slice {
        border-image: url('resources/svg-border-100x100-intrinsic.svg') 20 fill;
     }
+    .border-image-100-viewbox {
+       border-image: url('resources/svg-border-100x100-viewbox.svg') 0 fill;
+    }
+    .border-image-100-viewbox-slice {
+       border-image: url('resources/svg-border-100x100-viewbox.svg') 20 fill;
+    }
+    .border-image-100-relative {
+       border-image: url('resources/svg-border-100x100-relative.svg') 0 fill;
+    }
+    .border-image-100-relative-slice {
+       border-image: url('resources/svg-border-100x100-relative.svg') 20 fill;
+    }
     .border-image-no-intrinsic {
        border-image: url('resources/svg-border-no-intrinsic.svg') 0 fill;
     }
 </head>
 <body>
   <div class="box no-border border-image-100-intrinsic"></div>
-  <div class="box border    border-image-100-intrinsic"></div>
+  <div class="box border-20 border-image-100-intrinsic"></div>
   <div class="box no-border border-image-100-intrinsic-slice"></div>
-  <div class="box border    border-image-100-intrinsic-slice"></div>
+  <div class="box border-20 border-image-100-intrinsic-slice"></div>
+  <br>
+  <div class="box no-border border-image-100-viewbox"></div>
+  <div class="box border-20 border-image-100-viewbox"></div>
+  <div class="box no-border border-image-100-viewbox-slice"></div>
+  <div class="box border-20 border-image-100-viewbox-slice"></div>
+  <br>
+  <div class="box no-border border-image-100-relative"></div>
+  <div class="box border-20 border-image-100-relative"></div>
+  <div class="box no-border border-image-100-relative-slice"></div>
+  <div class="box border-20 border-image-100-relative-slice"></div>
   <br>
   <div class="box no-border border-image-no-intrinsic"></div>
-  <div class="box border    border-image-no-intrinsic"></div>
+  <div class="box border-20"></div>
   <div class="box no-border border-image-no-intrinsic-slice"></div>
-  <div class="box border    border-image-no-intrinsic-slice"></div>
+  <div class="box border-20 border-image-no-intrinsic-slice"></div>
 </body>
diff --git a/LayoutTests/fast/borders/resources/svg-border-100x100-relative.svg b/LayoutTests/fast/borders/resources/svg-border-100x100-relative.svg
new file mode 100644 (file)
index 0000000..4ed165e
--- /dev/null
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
+  <rect width="100%" height="100%" fill="lime"/>
+  <rect x="10%" y="10%" width="80%" height="80%" fill="none" stroke="black" stroke-width="4%"/>
+</svg>
\ No newline at end of file
diff --git a/LayoutTests/fast/borders/resources/svg-border-100x100-viewbox.svg b/LayoutTests/fast/borders/resources/svg-border-100x100-viewbox.svg
new file mode 100644 (file)
index 0000000..dde0300
--- /dev/null
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100">
+  <rect width="100" height="100" fill="lime"/>
+  <rect x="10" y="10" width="80" height="80" fill="none" stroke="black" stroke-width="4px"/>
+</svg>
\ No newline at end of file
index 9f9140416d6c74c486e2b9dffa5307135e13627c..c1f2e6fd21aaf3294abdd246b4d8f7edbf18f908 100644 (file)
@@ -1,52 +1,4 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="140" height="140">
-  <defs>
-    <g id="border-image">
-      <rect width="100" height="100" fill="lime"/>
-      <rect x="10" y="10" width="80" height="80" fill="none" stroke="black" stroke-width="4px"/>
-    </g>
-    <clipPath id="top-left">
-      <rect x="0" y="0" width="20" height="20"/>
-    </clipPath>
-    <clipPath id="left">
-      <rect x="0" y="0" width="20" height="100"/>
-    </clipPath>
-    <clipPath id="bottom-left">
-      <rect x="0" y="0" width="20" height="20"/>
-    </clipPath>
-    <clipPath id="top-right">
-      <rect x="0" y="0" width="20" height="20"/>
-    </clipPath>
-    <clipPath id="right">
-      <rect x="0" y="0" width="20" height="100"/>
-    </clipPath>
-    <clipPath id="bottom-right">
-      <rect x="0" y="0" width="20" height="20"/>
-    </clipPath>
-    <clipPath id="top">
-      <rect x="0" y="0" width="100" height="20"/>
-    </clipPath>
-    <clipPath id="bottom">
-      <rect x="0" y="0" width="100" height="20"/>
-    </clipPath>
-    <clipPath id="middle">
-      <rect x="0" y="0" width="100" height="100"/>
-    </clipPath>
-  </defs>
-  
-  <!-- draw left side -->
-  <use x="0" y="0" xlink:href="#border-image" clip-path="url(#top-left)"/>
-  <use x="0" y="20" xlink:href="#border-image" clip-path="url(#left)"/>
-  <use x="0" y="120" xlink:href="#border-image" clip-path="url(#bottom-left)"/>
-  
-  <!-- draw right side -->
-  <use x="120" y="0" xlink:href="#border-image" clip-path="url(#top-right)"/>
-  <use x="120" y="20" xlink:href="#border-image" clip-path="url(#right)"/>
-  <use x="120" y="120" xlink:href="#border-image" clip-path="url(#bottom-right)"/>
-  
-  <!-- draw top and bottom sides -->
-  <use x="20" y="0" xlink:href="#border-image" clip-path="url(#top)"/>
-  <use x="20" y="120" xlink:href="#border-image" clip-path="url(#bottom)"/>
-  
-  <!-- draw middle -->
-  <use x="20" y="20" xlink:href="#border-image" clip-path="url(#middle)"/>
-</svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="140" height="140">
+  <rect width="100%" height="100%" fill="lime"/>
+  <rect x="10%" y="10%" width="80%" height="80%" fill="none" stroke="black" stroke-width="4%"/>
+</svg>
index ad858bee98a8747277b5f9168643bdc67512b627..244249b93ed48dfb0f20b60907b651b69b9c0b5c 100644 (file)
@@ -1,3 +1,52 @@
+2015-10-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        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>
+
+        Reviewed by Darin Adler.
+
+        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.
+
 2015-10-12  Simon Fraser  <simon.fraser@apple.com>
 
         Clip-path transitions sometimes trigger endless animation timers
index 1dcbbcef099eca90327fd742d9c2df63be6f9d01..6529e2eb5d5566a3002a8aeb4bce99ea5df3c81e 100644 (file)
@@ -897,13 +897,11 @@ static inline LayoutSize resolveAgainstIntrinsicRatio(const LayoutSize& size, co
     return LayoutSize(size.width(), solutionHeight);
 }
 
-bool RenderBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* image, const LayoutSize& positioningAreaSize, ScaleByEffectiveZoomOrNot shouldScaleOrNot, LayoutSize& imageSize) const
+LayoutSize RenderBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* image, const LayoutSize& positioningAreaSize, ScaleByEffectiveZoomOrNot shouldScaleOrNot) const
 {
     // A generated image without a fixed size, will always return the container size as intrinsic size.
-    if (image->isGeneratedImage() && image->usesImageContainerSize()) {
-        imageSize = LayoutSize(positioningAreaSize.width(), positioningAreaSize.height());
-        return true;
-    }
+    if (image->isGeneratedImage() && image->usesImageContainerSize())
+        return LayoutSize(positioningAreaSize.width(), positioningAreaSize.height());
 
     Length intrinsicWidth;
     Length intrinsicHeight;
@@ -913,36 +911,29 @@ bool RenderBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* image,
     ASSERT(!intrinsicWidth.isPercentOrCalculated());
     ASSERT(!intrinsicHeight.isPercentOrCalculated());
 
-    imageSize = LayoutSize(intrinsicWidth.value(), intrinsicHeight.value());
-    LayoutSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0 ? 1 : 0);
-    if (shouldScaleOrNot == ScaleByEffectiveZoom)
-        imageSize.scale(style().effectiveZoom());
-    imageSize.clampToMinimumSize(minimumSize);
+    LayoutSize resolvedSize(intrinsicWidth.value(), intrinsicHeight.value());
+    LayoutSize minimumSize(resolvedSize.width() > 0 ? 1 : 0, resolvedSize.height() > 0 ? 1 : 0);
 
-    if (!imageSize.isEmpty())
-        return true;
+    if (shouldScaleOrNot == ScaleByEffectiveZoom)
+        resolvedSize.scale(style().effectiveZoom());
+    resolvedSize.clampToMinimumSize(minimumSize);
 
     // If the image has one of either an intrinsic width or an intrinsic height:
     // * and an intrinsic aspect ratio, then the missing dimension is calculated from the given dimension and the ratio.
     // * and no intrinsic aspect ratio, then the missing dimension is assumed to be the size of the rectangle that
     //   establishes the coordinate system for the 'background-position' property.
-    if (imageSize.width() > 0 || imageSize.height() > 0) {
-        imageSize = resolveAgainstIntrinsicWidthOrHeightAndRatio(positioningAreaSize, intrinsicRatio, imageSize.width(), imageSize.height());
-        return true;
-    }
+    if (resolvedSize.width() > 0 || resolvedSize.height() > 0)
+        return resolveAgainstIntrinsicWidthOrHeightAndRatio(positioningAreaSize, intrinsicRatio, resolvedSize.width(), resolvedSize.height());
 
     // If the image has no intrinsic dimensions and has an intrinsic ratio the dimensions must be assumed to be the
     // largest dimensions at that ratio such that neither dimension exceeds the dimensions of the rectangle that
     // establishes the coordinate system for the 'background-position' property.
-    if (!intrinsicRatio.isEmpty()) {
-        imageSize = resolveAgainstIntrinsicRatio(positioningAreaSize, intrinsicRatio);
-        return false;
-    }
+    if (!intrinsicRatio.isEmpty())
+        return resolveAgainstIntrinsicRatio(positioningAreaSize, intrinsicRatio);
 
     // If the image has no intrinsic ratio either, then the dimensions must be assumed to be the rectangle that
     // establishes the coordinate system for the 'background-position' property.
-    imageSize = positioningAreaSize;
-    return false;
+    return positioningAreaSize;
 }
 
 LayoutSize RenderBoxModelObject::calculateFillTileSize(const FillLayer& fillLayer, const LayoutSize& positioningAreaSize) const
@@ -952,7 +943,7 @@ LayoutSize RenderBoxModelObject::calculateFillTileSize(const FillLayer& fillLaye
 
     LayoutSize imageIntrinsicSize;
     if (image) {
-        calculateImageIntrinsicDimensions(image, positioningAreaSize, ScaleByEffectiveZoom, imageIntrinsicSize);
+        imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize, ScaleByEffectiveZoom);
         imageIntrinsicSize.scale(1 / image->imageScaleFactor(), 1 / image->imageScaleFactor());
     } else
         imageIntrinsicSize = positioningAreaSize;
@@ -1263,13 +1254,12 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext& graphicsContext,
     rectWithOutsets.expand(style.imageOutsets(ninePieceImage));
     LayoutRect destination = LayoutRect(snapRectToDevicePixels(rectWithOutsets, deviceScaleFactor));
 
-    LayoutSize source;
-    bool intrinsicSource = calculateImageIntrinsicDimensions(styleImage, destination.size(), DoNotScaleByEffectiveZoom, source);
+    LayoutSize source = calculateImageIntrinsicDimensions(styleImage, destination.size(), DoNotScaleByEffectiveZoom);
 
     // If both values are ‘auto’ then the intrinsic width and/or height of the image should be used, if any.
     styleImage->setContainerSizeForRenderer(this, source, style.effectiveZoom());
 
-    ninePieceImage.paint(graphicsContext, this, style, destination, source, intrinsicSource, deviceScaleFactor, op);
+    ninePieceImage.paint(graphicsContext, this, style, destination, source, deviceScaleFactor, op);
     return true;
 }
 
index c94205dcf59423681fa52e39bdbccdb937cbcfe6..5b1089ed60e43f2c64038ee9df673bc77a247b4c 100644 (file)
@@ -293,7 +293,7 @@ public:
     void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* startChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert = false);
 
     enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffectiveZoom };
-    bool calculateImageIntrinsicDimensions(StyleImage*, const LayoutSize& scaledPositioningAreaSize, ScaleByEffectiveZoomOrNot, LayoutSize& imageSize) const;
+    LayoutSize calculateImageIntrinsicDimensions(StyleImage*, const LayoutSize& scaledPositioningAreaSize, ScaleByEffectiveZoomOrNot) const;
 
 private:
     LayoutUnit computedCSSPadding(const Length&) const;
index b51ee0abbef85020783b00355854b798ff65170d..4007aa70dc184afe282395132fa8d2407250349c 100644 (file)
@@ -1426,8 +1426,7 @@ void RenderListMarker::updateContent()
         // until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box.
         LayoutUnit bulletWidth = style().fontMetrics().ascent() / LayoutUnit(2);
         LayoutSize defaultBulletSize(bulletWidth, bulletWidth);
-        LayoutSize imageSize;
-        calculateImageIntrinsicDimensions(m_image.get(), defaultBulletSize, DoNotScaleByEffectiveZoom, imageSize);
+        LayoutSize imageSize = calculateImageIntrinsicDimensions(m_image.get(), defaultBulletSize, DoNotScaleByEffectiveZoom);
         m_image->setContainerSizeForRenderer(this, imageSize, style().effectiveZoom());
         return;
     }
index f29c3a8c111e5a98f823cf8cde322a9dddb5ecf2..66d3183cf408d742db008773011f930d8af50dd5 100644 (file)
@@ -148,8 +148,7 @@ static LayoutRect getShapeImageMarginRect(const RenderBox& renderBox, const Layo
 
 std::unique_ptr<Shape> ShapeOutsideInfo::createShapeForImage(StyleImage* styleImage, float shapeImageThreshold, WritingMode writingMode, float margin) const
 {
-    LayoutSize imageSize;
-    m_renderer.calculateImageIntrinsicDimensions(styleImage, m_referenceBoxLogicalSize, RenderImage::ScaleByEffectiveZoom, imageSize);
+    LayoutSize imageSize = m_renderer.calculateImageIntrinsicDimensions(styleImage, m_referenceBoxLogicalSize, RenderImage::ScaleByEffectiveZoom);
     styleImage->setContainerSizeForRenderer(&m_renderer, imageSize, m_renderer.style().effectiveZoom());
 
     const LayoutRect& marginRect = getShapeImageMarginRect(m_renderer, m_referenceBoxLogicalSize);
index b1374e08b108434dade532d4df120df77341d6d4..1434bf7be435b3d4c6baabb2476f6991d8a58779 100644 (file)
@@ -113,7 +113,7 @@ bool NinePieceImage::isEmptyPieceRect(ImagePiece piece, const Vector<FloatRect>&
     return destinationRects[piece].isEmpty() || sourceRects[piece].isEmpty();
 }
 
-Vector<FloatRect> NinePieceImage::computeIntrinsicRects(const FloatRect& outer, const LayoutBoxExtent& slices, float deviceScaleFactor)
+Vector<FloatRect> NinePieceImage::computeNineRects(const FloatRect& outer, const LayoutBoxExtent& slices, float deviceScaleFactor)
 {
     FloatRect inner = outer;
     inner.move(slices.left(), slices.top());
@@ -137,20 +137,7 @@ Vector<FloatRect> NinePieceImage::computeIntrinsicRects(const FloatRect& outer,
     return rects;
 }
 
-Vector<FloatRect> NinePieceImage::computeNonIntrinsicRects(const Vector<FloatRect>& intrinsicRects, const LayoutBoxExtent& slices)
-{
-    Vector<FloatRect> rects(MaxPiece);
-
-    for (ImagePiece piece = MinPiece; piece < MaxPiece; ++piece) {
-        if (isEmptyPieceRect(piece, slices))
-            continue;
-        rects[piece] = FloatRect(FloatPoint(), intrinsicRects[piece].size());
-    }
-
-    return rects;
-}
-
-FloatSize NinePieceImage::computeIntrinsicSideTileScale(ImagePiece piece, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects)
+FloatSize NinePieceImage::computeSideTileScale(ImagePiece piece, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects)
 {
     ASSERT(!isCornerPiece(piece) && !isMiddlePiece(piece));
     if (isEmptyPieceRect(piece, destinationRects, sourceRects))
@@ -165,7 +152,7 @@ FloatSize NinePieceImage::computeIntrinsicSideTileScale(ImagePiece piece, const
     return FloatSize(scale, scale);
 }
 
-FloatSize NinePieceImage::computeIntrinsicMiddleTileScale(const Vector<FloatSize>& scales, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule)
+FloatSize NinePieceImage::computeMiddleTileScale(const Vector<FloatSize>& scales, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule)
 {
     FloatSize scale(1, 1);
     if (isEmptyPieceRect(MiddlePiece, destinationRects, sourceRects))
@@ -190,25 +177,20 @@ FloatSize NinePieceImage::computeIntrinsicMiddleTileScale(const Vector<FloatSize
     return scale;
 }
 
-Vector<FloatSize> NinePieceImage::computeIntrinsicTileScales(const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule)
+Vector<FloatSize> NinePieceImage::computeTileScales(const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule)
 {
     Vector<FloatSize> scales(MaxPiece, FloatSize(1, 1));
 
-    scales[TopPiece]    = computeIntrinsicSideTileScale(TopPiece,    destinationRects, sourceRects);
-    scales[RightPiece]  = computeIntrinsicSideTileScale(RightPiece,  destinationRects, sourceRects);
-    scales[BottomPiece] = computeIntrinsicSideTileScale(BottomPiece, destinationRects, sourceRects);
-    scales[LeftPiece]   = computeIntrinsicSideTileScale(LeftPiece,   destinationRects, sourceRects);
+    scales[TopPiece]    = computeSideTileScale(TopPiece,    destinationRects, sourceRects);
+    scales[RightPiece]  = computeSideTileScale(RightPiece,  destinationRects, sourceRects);
+    scales[BottomPiece] = computeSideTileScale(BottomPiece, destinationRects, sourceRects);
+    scales[LeftPiece]   = computeSideTileScale(LeftPiece,   destinationRects, sourceRects);
 
-    scales[MiddlePiece] = computeIntrinsicMiddleTileScale(scales, destinationRects, sourceRects, hRule, vRule);
+    scales[MiddlePiece] = computeMiddleTileScale(scales, destinationRects, sourceRects, hRule, vRule);
     return scales;
 }
 
-Vector<FloatSize> NinePieceImage::computeNonIntrinsicTileScales()
-{
-    return Vector<FloatSize>(MaxPiece, FloatSize(1, 1));
-}
-
-void NinePieceImage::paint(GraphicsContext& graphicsContext, RenderElement* renderer, const RenderStyle& style, const LayoutRect& destination, const LayoutSize& source,  bool intrinsicSource, float deviceScaleFactor, CompositeOperator op) const
+void NinePieceImage::paint(GraphicsContext& graphicsContext, RenderElement* renderer, const RenderStyle& style, const LayoutRect& destination, const LayoutSize& source, float deviceScaleFactor, CompositeOperator op) const
 {
     StyleImage* styleImage = image();
     ASSERT(styleImage && styleImage->isLoaded());
@@ -218,17 +200,9 @@ void NinePieceImage::paint(GraphicsContext& graphicsContext, RenderElement* rend
 
     scaleSlicesIfNeeded(destination.size(), destinationSlices, deviceScaleFactor);
 
-    Vector<FloatRect> destinationRects = computeIntrinsicRects(destination, destinationSlices, deviceScaleFactor);
-    Vector<FloatRect> sourceRects;
-    Vector<FloatSize> tileScales;
-
-    if (intrinsicSource) {
-        sourceRects = computeIntrinsicRects(FloatRect(FloatPoint(), source), sourceSlices, deviceScaleFactor);
-        tileScales = computeIntrinsicTileScales(destinationRects, sourceRects, horizontalRule(), verticalRule());
-    } else {
-        sourceRects = computeNonIntrinsicRects(destinationRects, sourceSlices);
-        tileScales = computeNonIntrinsicTileScales();
-    }
+    Vector<FloatRect> destinationRects = computeNineRects(destination, destinationSlices, deviceScaleFactor);
+    Vector<FloatRect> sourceRects = computeNineRects(FloatRect(FloatPoint(), source), sourceSlices, deviceScaleFactor);
+    Vector<FloatSize> tileScales = computeTileScales(destinationRects, sourceRects, horizontalRule(), verticalRule());
 
     RefPtr<Image> image = styleImage->image(renderer, source);
     ColorSpace colorSpace = style.colorSpace();
index 9c32e5caa421ec7fb2a499c36a7985246dceb5ec..c2ca861c31b7722dab8b7a6296b7135f96e3da20 100644 (file)
@@ -196,17 +196,15 @@ public:
     static bool isEmptyPieceRect(ImagePiece, const LayoutBoxExtent& slices);
     static bool isEmptyPieceRect(ImagePiece, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects);
 
-    static Vector<FloatRect> computeIntrinsicRects(const FloatRect& outer, const LayoutBoxExtent& slices, float deviceScaleFactor);
-    static Vector<FloatRect> computeNonIntrinsicRects(const Vector<FloatRect>& intrinsicRects, const LayoutBoxExtent& slices);
+    static Vector<FloatRect> computeNineRects(const FloatRect& outer, const LayoutBoxExtent& slices, float deviceScaleFactor);
 
     static void scaleSlicesIfNeeded(const LayoutSize&, LayoutBoxExtent& slices, float deviceScaleFactor);
 
-    static FloatSize computeIntrinsicSideTileScale(ImagePiece, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects);
-    static FloatSize computeIntrinsicMiddleTileScale(const Vector<FloatSize>& scales, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule);
-    static Vector<FloatSize> computeIntrinsicTileScales(const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule);
-    static Vector<FloatSize> computeNonIntrinsicTileScales();
+    static FloatSize computeSideTileScale(ImagePiece, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects);
+    static FloatSize computeMiddleTileScale(const Vector<FloatSize>& scales, const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule);
+    static Vector<FloatSize> computeTileScales(const Vector<FloatRect>& destinationRects, const Vector<FloatRect>& sourceRects, ENinePieceImageRule hRule, ENinePieceImageRule vRule);
 
-    void paint(GraphicsContext&, RenderElement*, const RenderStyle&, const LayoutRect& destination, const LayoutSize& source, bool intrinsicSource, float deviceScaleFactor, CompositeOperator) const;
+    void paint(GraphicsContext&, RenderElement*, const RenderStyle&, const LayoutRect& destination, const LayoutSize& source, float deviceScaleFactor, CompositeOperator) const;
 
 private:
     DataRef<NinePieceImageData> m_data;