OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "core/paint/NinePieceImagePainter.h" | 5 #include "core/paint/NinePieceImagePainter.h" |
6 | 6 |
7 #include "core/frame/Deprecation.h" | 7 #include "core/frame/Deprecation.h" |
8 #include "core/layout/ImageQualityController.h" | 8 #include "core/layout/ImageQualityController.h" |
9 #include "core/layout/LayoutBoxModelObject.h" | 9 #include "core/layout/LayoutBoxModelObject.h" |
10 #include "core/paint/BoxPainter.h" | 10 #include "core/paint/BoxPainter.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 || (style.borderTopWidth() && (style.borderTop().style() == BorderStyleN
one || style.borderTop().style() == BorderStyleHidden)) | 42 || (style.borderTopWidth() && (style.borderTop().style() == BorderStyleN
one || style.borderTop().style() == BorderStyleHidden)) |
43 || (style.borderBottomWidth() && (style.borderBottom().style() == Border
StyleNone || style.borderBottom().style() == BorderStyleHidden))) | 43 || (style.borderBottomWidth() && (style.borderBottom().style() == Border
StyleNone || style.borderBottom().style() == BorderStyleHidden))) |
44 Deprecation::countDeprecation(m_layoutObject.document(), UseCounter::Bor
derImageWithBorderStyleNone); | 44 Deprecation::countDeprecation(m_layoutObject.document(), UseCounter::Bor
derImageWithBorderStyleNone); |
45 | 45 |
46 // FIXME: border-image is broken with full page zooming when tiling has to h
appen, since the tiling function | 46 // FIXME: border-image is broken with full page zooming when tiling has to h
appen, since the tiling function |
47 // doesn't have any understanding of the zoom that is in effect on the tile. | 47 // doesn't have any understanding of the zoom that is in effect on the tile. |
48 LayoutRect rectWithOutsets = rect; | 48 LayoutRect rectWithOutsets = rect; |
49 rectWithOutsets.expand(style.imageOutsets(ninePieceImage)); | 49 rectWithOutsets.expand(style.imageOutsets(ninePieceImage)); |
50 LayoutRect borderImageRect = rectWithOutsets; | 50 LayoutRect borderImageRect = rectWithOutsets; |
51 | 51 |
| 52 // NinePieceImage returns the image slices without effective zoom applied an
d thus we compute |
| 53 // the nine piece grid on top of the image in unzoomed coordinates. |
52 LayoutSize defaultObjectSize = borderImageRect.size(); | 54 LayoutSize defaultObjectSize = borderImageRect.size(); |
53 defaultObjectSize.scale(1 / style.effectiveZoom()); | 55 defaultObjectSize.scale(1 / style.effectiveZoom()); |
54 IntSize imageSize = roundedIntSize(styleImage->imageSize(m_layoutObject, 1,
defaultObjectSize)); | 56 IntSize imageSize = roundedIntSize(styleImage->imageSize(m_layoutObject, 1,
defaultObjectSize)); |
55 | 57 |
56 IntRectOutsets borderWidths(style.borderTopWidth(), style.borderRightWidth()
, | 58 IntRectOutsets borderWidths(style.borderTopWidth(), style.borderRightWidth()
, |
57 style.borderBottomWidth(), style.borderLeftWidth()); | 59 style.borderBottomWidth(), style.borderLeftWidth()); |
58 NinePieceImageGrid grid(ninePieceImage, imageSize, pixelSnappedIntRect(borde
rImageRect), borderWidths); | 60 NinePieceImageGrid grid(ninePieceImage, imageSize, pixelSnappedIntRect(borde
rImageRect), borderWidths); |
59 | 61 |
60 RefPtr<Image> image = styleImage->image(m_layoutObject, imageSize, 1); | 62 RefPtr<Image> image = styleImage->image(m_layoutObject, imageSize, 1); |
61 | 63 |
(...skipping 20 matching lines...) Expand all Loading... |
82 drawInfo.tileRule.vertical, op); | 84 drawInfo.tileRule.vertical, op); |
83 } | 85 } |
84 } | 86 } |
85 } | 87 } |
86 | 88 |
87 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); | 89 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); |
88 return true; | 90 return true; |
89 } | 91 } |
90 | 92 |
91 } // namespace blink | 93 } // namespace blink |
OLD | NEW |