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() == BNONE || sty
le.borderTop().style() == BHIDDEN)) | 42 || (style.borderTopWidth() && (style.borderTop().style() == BNONE || sty
le.borderTop().style() == BHIDDEN)) |
43 || (style.borderBottomWidth() && (style.borderBottom().style() == BNONE
|| style.borderBottom().style() == BHIDDEN))) | 43 || (style.borderBottomWidth() && (style.borderBottom().style() == BNONE
|| style.borderBottom().style() == BHIDDEN))) |
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 IntSize imageSize = roundedIntSize(m_layoutObject.calculateImageIntrinsicDim
ensions(styleImage, borderImageRect.size(), | 52 LayoutSize defaultObjectSize = borderImageRect.size(); |
53 LayoutBoxModelObject::DoNotScaleByEffectiveZoom)); | 53 defaultObjectSize.scale(1 / style.effectiveZoom()); |
| 54 styleImage->updateConcreteObjectSize(defaultObjectSize); |
54 | 55 |
| 56 IntSize imageSize = roundedIntSize(styleImage->imageSize(&m_layoutObject, st
yle.effectiveZoom())); |
55 IntRectOutsets borderWidths(style.borderTopWidth(), style.borderRightWidth()
, | 57 IntRectOutsets borderWidths(style.borderTopWidth(), style.borderRightWidth()
, |
56 style.borderBottomWidth(), style.borderLeftWidth()); | 58 style.borderBottomWidth(), style.borderLeftWidth()); |
57 NinePieceImageGrid grid(ninePieceImage, imageSize, pixelSnappedIntRect(borde
rImageRect), borderWidths); | 59 NinePieceImageGrid grid(ninePieceImage, imageSize, pixelSnappedIntRect(borde
rImageRect), borderWidths); |
58 | 60 |
59 RefPtr<Image> image = styleImage->image(&m_layoutObject, imageSize, style.ef
fectiveZoom()); | 61 RefPtr<Image> image = styleImage->image(&m_layoutObject, imageSize, style.ef
fectiveZoom()); |
60 | 62 |
61 InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQ
uality(m_layoutObject, image.get(), 0, rectWithOutsets.size()); | 63 InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQ
uality(m_layoutObject, image.get(), 0, rectWithOutsets.size()); |
62 InterpolationQuality previousInterpolationQuality = graphicsContext.imageInt
erpolationQuality(); | 64 InterpolationQuality previousInterpolationQuality = graphicsContext.imageInt
erpolationQuality(); |
63 graphicsContext.setImageInterpolationQuality(interpolationQuality); | 65 graphicsContext.setImageInterpolationQuality(interpolationQuality); |
64 | 66 |
(...skipping 12 matching lines...) Expand all Loading... |
77 drawInfo.tileRule.vertical, op); | 79 drawInfo.tileRule.vertical, op); |
78 } | 80 } |
79 } | 81 } |
80 } | 82 } |
81 | 83 |
82 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); | 84 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); |
83 return true; | 85 return true; |
84 } | 86 } |
85 | 87 |
86 } // namespace blink | 88 } // namespace blink |
OLD | NEW |