Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp

Issue 1756763004: Merge image sizing algorithms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Extend test to cover svg and non-svg case Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 IntSize imageSize = roundedIntSize(styleImage->imageSize(&m_layoutObject, 1, borderImageRect.size()));
53 LayoutBoxModelObject::DoNotScaleByEffectiveZoom));
54 53
55 IntRectOutsets borderWidths(style.borderTopWidth(), style.borderRightWidth() , 54 IntRectOutsets borderWidths(style.borderTopWidth(), style.borderRightWidth() ,
56 style.borderBottomWidth(), style.borderLeftWidth()); 55 style.borderBottomWidth(), style.borderLeftWidth());
57 NinePieceImageGrid grid(ninePieceImage, imageSize, pixelSnappedIntRect(borde rImageRect), borderWidths); 56 NinePieceImageGrid grid(ninePieceImage, imageSize, pixelSnappedIntRect(borde rImageRect), borderWidths);
58 57
59 RefPtr<Image> image = styleImage->image(&m_layoutObject, imageSize, style.ef fectiveZoom()); 58 RefPtr<Image> image = styleImage->image(&m_layoutObject, imageSize, style.ef fectiveZoom());
60 59
61 InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQ uality(m_layoutObject, image.get(), 0, rectWithOutsets.size()); 60 InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQ uality(m_layoutObject, image.get(), 0, rectWithOutsets.size());
62 InterpolationQuality previousInterpolationQuality = graphicsContext.imageInt erpolationQuality(); 61 InterpolationQuality previousInterpolationQuality = graphicsContext.imageInt erpolationQuality();
63 graphicsContext.setImageInterpolationQuality(interpolationQuality); 62 graphicsContext.setImageInterpolationQuality(interpolationQuality);
(...skipping 13 matching lines...) Expand all
77 drawInfo.tileRule.vertical, op); 76 drawInfo.tileRule.vertical, op);
78 } 77 }
79 } 78 }
80 } 79 }
81 80
82 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); 81 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality);
83 return true; 82 return true;
84 } 83 }
85 84
86 } // namespace blink 85 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698