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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 if (layerWidth.isFixed()) | 817 if (layerWidth.isFixed()) |
818 tileSize.setWidth(layerWidth.value()); | 818 tileSize.setWidth(layerWidth.value()); |
819 else if (layerWidth.isPercent()) | 819 else if (layerWidth.isPercent()) |
820 tileSize.setWidth(valueForLength(layerWidth, positioningAreaSize.wid th())); | 820 tileSize.setWidth(valueForLength(layerWidth, positioningAreaSize.wid th())); |
821 | 821 |
822 if (layerHeight.isFixed()) | 822 if (layerHeight.isFixed()) |
823 tileSize.setHeight(layerHeight.value()); | 823 tileSize.setHeight(layerHeight.value()); |
824 else if (layerHeight.isPercent()) | 824 else if (layerHeight.isPercent()) |
825 tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.h eight())); | 825 tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.h eight())); |
826 | 826 |
827 applySubPixelHeuristicForTileSize(tileSize, positioningAreaSize); | 827 applySubPixelHeuristicForTileSize(tileSize, positioningAreaSize); |
chrishtr
2014/10/17 19:02:17
How about moving applySubPixelHeuristicForTileSize
| |
828 | 828 |
829 // If one of the values is auto we have to use the appropriate | 829 // If one of the values is auto we have to use the appropriate |
830 // scale to maintain our aspect ratio. | 830 // scale to maintain our aspect ratio. |
831 if (layerWidth.isAuto() && !layerHeight.isAuto()) { | 831 if (layerWidth.isAuto() && !layerHeight.isAuto()) { |
832 if (imageIntrinsicSize.height()) | 832 if (imageIntrinsicSize.height()) |
833 tileSize.setWidth(imageIntrinsicSize.width() * tileSize.height() / imageIntrinsicSize.height()); | 833 tileSize.setWidth(imageIntrinsicSize.width() * tileSize.height() / imageIntrinsicSize.height()); |
834 } else if (!layerWidth.isAuto() && layerHeight.isAuto()) { | 834 } else if (!layerWidth.isAuto() && layerHeight.isAuto()) { |
835 if (imageIntrinsicSize.width()) | 835 if (imageIntrinsicSize.width()) |
836 tileSize.setHeight(imageIntrinsicSize.height() * tileSize.width( ) / imageIntrinsicSize.width()); | 836 tileSize.setHeight(imageIntrinsicSize.height() * tileSize.width( ) / imageIntrinsicSize.width()); |
837 } else if (layerWidth.isAuto() && layerHeight.isAuto()) { | 837 } else if (layerWidth.isAuto() && layerHeight.isAuto()) { |
838 // If both width and height are auto, use the image's intrinsic size . | 838 // If both width and height are auto, use the image's intrinsic size . |
839 tileSize = imageIntrinsicSize; | 839 tileSize = imageIntrinsicSize; |
840 } | 840 } |
841 | 841 |
842 tileSize.clampNegativeToZero(); | 842 tileSize.clampToMinimumSize(IntSize(1, 1)); |
843 return flooredIntSize(tileSize); | 843 return flooredIntSize(tileSize); |
844 } | 844 } |
845 case SizeNone: { | 845 case SizeNone: { |
846 // If both values are ‘auto’ then the intrinsic width and/or height of t he image should be used, if any. | 846 // If both values are ‘auto’ then the intrinsic width and/or height of t he image should be used, if any. |
847 if (!imageIntrinsicSize.isEmpty()) | 847 if (!imageIntrinsicSize.isEmpty()) |
848 return imageIntrinsicSize; | 848 return imageIntrinsicSize; |
849 | 849 |
850 // If the image has neither an intrinsic width nor an intrinsic height, its size is determined as for ‘contain’. | 850 // If the image has neither an intrinsic width nor an intrinsic height, its size is determined as for ‘contain’. |
851 type = Contain; | 851 type = Contain; |
852 } | 852 } |
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2146 | 2146 |
2147 FloatPoint secondQuad[4]; | 2147 FloatPoint secondQuad[4]; |
2148 secondQuad[0] = quad[0]; | 2148 secondQuad[0] = quad[0]; |
2149 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); | 2149 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); |
2150 secondQuad[2] = quad[2]; | 2150 secondQuad[2] = quad[2]; |
2151 secondQuad[3] = quad[3]; | 2151 secondQuad[3] = quad[3]; |
2152 graphicsContext->clipConvexPolygon(4, secondQuad, !secondEdgeMatches); | 2152 graphicsContext->clipConvexPolygon(4, secondQuad, !secondEdgeMatches); |
2153 } | 2153 } |
2154 | 2154 |
2155 } // namespace blink | 2155 } // namespace blink |
OLD | NEW |