| 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" | |
| 8 #include "core/layout/ImageQualityController.h" | 7 #include "core/layout/ImageQualityController.h" |
| 9 #include "core/layout/LayoutBoxModelObject.h" | 8 #include "core/layout/LayoutBoxModelObject.h" |
| 10 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
| 11 #include "core/paint/NinePieceImageGrid.h" | 10 #include "core/paint/NinePieceImageGrid.h" |
| 12 #include "core/style/ComputedStyle.h" | 11 #include "core/style/ComputedStyle.h" |
| 13 #include "core/style/NinePieceImage.h" | 12 #include "core/style/NinePieceImage.h" |
| 14 #include "platform/geometry/IntSize.h" | 13 #include "platform/geometry/IntSize.h" |
| 15 #include "platform/geometry/LayoutRect.h" | 14 #include "platform/geometry/LayoutRect.h" |
| 16 #include "platform/graphics/GraphicsContext.h" | 15 #include "platform/graphics/GraphicsContext.h" |
| 17 | 16 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 28 StyleImage* styleImage = ninePieceImage.image(); | 27 StyleImage* styleImage = ninePieceImage.image(); |
| 29 if (!styleImage) | 28 if (!styleImage) |
| 30 return false; | 29 return false; |
| 31 | 30 |
| 32 if (!styleImage->isLoaded()) | 31 if (!styleImage->isLoaded()) |
| 33 return true; // Never paint a nine-piece image incrementally, but don't
paint the fallback borders either. | 32 return true; // Never paint a nine-piece image incrementally, but don't
paint the fallback borders either. |
| 34 | 33 |
| 35 if (!styleImage->canRender()) | 34 if (!styleImage->canRender()) |
| 36 return false; | 35 return false; |
| 37 | 36 |
| 38 // Find out if the hasImage() check in ComputedStyle::border*Width had any a
ffect, i.e. if a border is non-zero while border-style is | |
| 39 // none or hidden. | |
| 40 if ((style.borderLeftWidth() && (style.borderLeft().style() == BorderStyleNo
ne || style.borderLeft().style() == BorderStyleHidden)) | |
| 41 || (style.borderRightWidth() && (style.borderRight().style() == BorderSt
yleNone || style.borderRight().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))) | |
| 44 Deprecation::countDeprecation(m_layoutObject.document(), UseCounter::Bor
derImageWithBorderStyleNone); | |
| 45 | |
| 46 // FIXME: border-image is broken with full page zooming when tiling has to h
appen, since the tiling function | 37 // 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. | 38 // doesn't have any understanding of the zoom that is in effect on the tile. |
| 48 LayoutRect rectWithOutsets = rect; | 39 LayoutRect rectWithOutsets = rect; |
| 49 rectWithOutsets.expand(style.imageOutsets(ninePieceImage)); | 40 rectWithOutsets.expand(style.imageOutsets(ninePieceImage)); |
| 50 LayoutRect borderImageRect = rectWithOutsets; | 41 LayoutRect borderImageRect = rectWithOutsets; |
| 51 | 42 |
| 52 // NinePieceImage returns the image slices without effective zoom applied an
d thus we compute | 43 // 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. | 44 // the nine piece grid on top of the image in unzoomed coordinates. |
| 54 LayoutSize defaultObjectSize = borderImageRect.size(); | 45 LayoutSize defaultObjectSize = borderImageRect.size(); |
| 55 defaultObjectSize.scale(1 / style.effectiveZoom()); | 46 defaultObjectSize.scale(1 / style.effectiveZoom()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 84 drawInfo.tileRule.vertical, op); | 75 drawInfo.tileRule.vertical, op); |
| 85 } | 76 } |
| 86 } | 77 } |
| 87 } | 78 } |
| 88 | 79 |
| 89 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); | 80 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); |
| 90 return true; | 81 return true; |
| 91 } | 82 } |
| 92 | 83 |
| 93 } // namespace blink | 84 } // namespace blink |
| OLD | NEW |