Chromium Code Reviews| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/NinePieceImagePainter.h" | 6 #include "core/paint/NinePieceImagePainter.h" |
| 7 | 7 |
| 8 #include "core/frame/UseCounter.h" | |
| 8 #include "core/layout/ImageQualityController.h" | 9 #include "core/layout/ImageQualityController.h" |
| 9 #include "core/layout/LayoutBoxModelObject.h" | 10 #include "core/layout/LayoutBoxModelObject.h" |
| 10 #include "core/paint/BoxPainter.h" | 11 #include "core/paint/BoxPainter.h" |
| 11 #include "core/paint/NinePieceImageGrid.h" | 12 #include "core/paint/NinePieceImageGrid.h" |
| 12 #include "core/style/ComputedStyle.h" | 13 #include "core/style/ComputedStyle.h" |
| 13 #include "core/style/NinePieceImage.h" | 14 #include "core/style/NinePieceImage.h" |
| 14 #include "platform/geometry/IntSize.h" | 15 #include "platform/geometry/IntSize.h" |
| 15 #include "platform/geometry/LayoutRect.h" | 16 #include "platform/geometry/LayoutRect.h" |
| 16 #include "platform/graphics/GraphicsContext.h" | 17 #include "platform/graphics/GraphicsContext.h" |
| 17 | 18 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 28 StyleImage* styleImage = ninePieceImage.image(); | 29 StyleImage* styleImage = ninePieceImage.image(); |
| 29 if (!styleImage) | 30 if (!styleImage) |
| 30 return false; | 31 return false; |
| 31 | 32 |
| 32 if (!styleImage->isLoaded()) | 33 if (!styleImage->isLoaded()) |
| 33 return true; // Never paint a nine-piece image incrementally, but don't paint the fallback borders either. | 34 return true; // Never paint a nine-piece image incrementally, but don't paint the fallback borders either. |
| 34 | 35 |
| 35 if (!styleImage->canRender(m_layoutObject, style.effectiveZoom())) | 36 if (!styleImage->canRender(m_layoutObject, style.effectiveZoom())) |
| 36 return false; | 37 return false; |
| 37 | 38 |
| 39 if ((style.borderLeftWidth() && style.borderLeft().style() == BNONE) | |
|
philipj_slow
2015/11/18 09:28:58
Comment that these conditions are meant to isolate
| |
| 40 || (style.borderRightWidth() && style.borderRight().style() == BNONE) | |
| 41 || (style.borderTopWidth() && style.borderTop().style() == BNONE) | |
| 42 || (style.borderBottomWidth() && style.borderBottom().style() == BNONE)) | |
| 43 UseCounter::count(m_layoutObject.document(), UseCounter::BorderImageWith BorderStyleNone); | |
| 44 | |
| 38 // FIXME: border-image is broken with full page zooming when tiling has to h appen, since the tiling function | 45 // FIXME: border-image is broken with full page zooming when tiling has to h appen, since the tiling function |
| 39 // doesn't have any understanding of the zoom that is in effect on the tile. | 46 // doesn't have any understanding of the zoom that is in effect on the tile. |
| 40 LayoutRect rectWithOutsets = rect; | 47 LayoutRect rectWithOutsets = rect; |
| 41 rectWithOutsets.expand(style.imageOutsets(ninePieceImage)); | 48 rectWithOutsets.expand(style.imageOutsets(ninePieceImage)); |
| 42 IntRect borderImageRect = pixelSnappedIntRect(rectWithOutsets); | 49 IntRect borderImageRect = pixelSnappedIntRect(rectWithOutsets); |
| 43 | 50 |
| 44 IntSize imageSize = m_layoutObject.calculateImageIntrinsicDimensions(styleIm age, borderImageRect.size(), | 51 IntSize imageSize = m_layoutObject.calculateImageIntrinsicDimensions(styleIm age, borderImageRect.size(), |
| 45 LayoutBoxModelObject::DoNotScaleByEffectiveZoom); | 52 LayoutBoxModelObject::DoNotScaleByEffectiveZoom); |
| 46 | 53 |
| 47 // If both values are 'auto' then the intrinsic width and/or height of the i mage should be used, if any. | 54 // If both values are 'auto' then the intrinsic width and/or height of the i mage should be used, if any. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 73 drawInfo.tileRule.vertical, op); | 80 drawInfo.tileRule.vertical, op); |
| 74 } | 81 } |
| 75 } | 82 } |
| 76 } | 83 } |
| 77 | 84 |
| 78 graphicsContext->setImageInterpolationQuality(previousInterpolationQuality); | 85 graphicsContext->setImageInterpolationQuality(previousInterpolationQuality); |
| 79 return true; | 86 return true; |
| 80 } | 87 } |
| 81 | 88 |
| 82 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |