| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/BoxPainter.h" | 6 #include "core/paint/BoxPainter.h" |
| 7 | 7 |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/html/HTMLFrameOwnerElement.h" | 10 #include "core/html/HTMLFrameOwnerElement.h" |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 if (layerHeight.isFixed()) | 823 if (layerHeight.isFixed()) |
| 824 tileSize.setHeight(layerHeight.value()); | 824 tileSize.setHeight(layerHeight.value()); |
| 825 else if (layerHeight.isPercent()) | 825 else if (layerHeight.isPercent()) |
| 826 tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.h
eight())); | 826 tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.h
eight())); |
| 827 | 827 |
| 828 applySubPixelHeuristicForTileSize(tileSize, positioningAreaSize); | 828 applySubPixelHeuristicForTileSize(tileSize, positioningAreaSize); |
| 829 | 829 |
| 830 // If one of the values is auto we have to use the appropriate | 830 // If one of the values is auto we have to use the appropriate |
| 831 // scale to maintain our aspect ratio. | 831 // scale to maintain our aspect ratio. |
| 832 if (layerWidth.isAuto() && !layerHeight.isAuto()) { | 832 if (layerWidth.isAuto() && !layerHeight.isAuto()) { |
| 833 if (imageIntrinsicSize.height()) | 833 if (imageIntrinsicSize.height()) { |
| 834 tileSize.setWidth(imageIntrinsicSize.width() * tileSize.height()
/ imageIntrinsicSize.height()); | 834 LayoutUnit adjustedWidth = imageIntrinsicSize.width() * tileSize
.height() / imageIntrinsicSize.height(); |
| 835 if (imageIntrinsicSize.width() >= 1 && adjustedWidth < 1) |
| 836 adjustedWidth = 1; |
| 837 tileSize.setWidth(adjustedWidth); |
| 838 } |
| 835 } else if (!layerWidth.isAuto() && layerHeight.isAuto()) { | 839 } else if (!layerWidth.isAuto() && layerHeight.isAuto()) { |
| 836 if (imageIntrinsicSize.width()) | 840 if (imageIntrinsicSize.width()) { |
| 837 tileSize.setHeight(imageIntrinsicSize.height() * tileSize.width(
) / imageIntrinsicSize.width()); | 841 LayoutUnit adjustedHeight = imageIntrinsicSize.height() * tileSi
ze.width() / imageIntrinsicSize.width(); |
| 842 if (imageIntrinsicSize.height() >= 1 && adjustedHeight < 1) |
| 843 adjustedHeight = 1; |
| 844 tileSize.setHeight(adjustedHeight); |
| 845 } |
| 838 } else if (layerWidth.isAuto() && layerHeight.isAuto()) { | 846 } else if (layerWidth.isAuto() && layerHeight.isAuto()) { |
| 839 // If both width and height are auto, use the image's intrinsic size
. | 847 // If both width and height are auto, use the image's intrinsic size
. |
| 840 tileSize = imageIntrinsicSize; | 848 tileSize = imageIntrinsicSize; |
| 841 } | 849 } |
| 842 | 850 |
| 843 tileSize.clampNegativeToZero(); | 851 tileSize.clampNegativeToZero(); |
| 844 return flooredIntSize(tileSize); | 852 return flooredIntSize(tileSize); |
| 845 } | 853 } |
| 846 case SizeNone: { | 854 case SizeNone: { |
| 847 // If both values are ‘auto’ then the intrinsic width and/or height of t
he image should be used, if any. | 855 // If both values are ‘auto’ then the intrinsic width and/or height of t
he image should be used, if any. |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 | 2152 |
| 2145 FloatPoint secondQuad[4]; | 2153 FloatPoint secondQuad[4]; |
| 2146 secondQuad[0] = quad[0]; | 2154 secondQuad[0] = quad[0]; |
| 2147 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); | 2155 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); |
| 2148 secondQuad[2] = quad[2]; | 2156 secondQuad[2] = quad[2]; |
| 2149 secondQuad[3] = quad[3]; | 2157 secondQuad[3] = quad[3]; |
| 2150 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); | 2158 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); |
| 2151 } | 2159 } |
| 2152 | 2160 |
| 2153 } // namespace blink | 2161 } // namespace blink |
| OLD | NEW |