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

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

Issue 1455673002: Add UseCounter for border-image overriding border-widths (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix c&p error Created 5 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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 // 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
40 // none or hidden.
41 if ((style.borderLeftWidth() && (style.borderLeft().style() == BNONE || styl e.borderLeft().style() == BHIDDEN))
42 || (style.borderRightWidth() && (style.borderRight().style() == BNONE || style.borderRight().style() == BHIDDEN))
43 || (style.borderTopWidth() && (style.borderTop().style() == BNONE || sty le.borderTop().style() == BHIDDEN))
44 || (style.borderBottomWidth() && (style.borderBottom().style() == BNONE || style.borderBottom().style() == BHIDDEN)))
45 UseCounter::count(m_layoutObject.document(), UseCounter::BorderImageWith BorderStyleNone);
46
38 // FIXME: border-image is broken with full page zooming when tiling has to h appen, since the tiling function 47 // 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. 48 // doesn't have any understanding of the zoom that is in effect on the tile.
40 LayoutRect rectWithOutsets = rect; 49 LayoutRect rectWithOutsets = rect;
41 rectWithOutsets.expand(style.imageOutsets(ninePieceImage)); 50 rectWithOutsets.expand(style.imageOutsets(ninePieceImage));
42 IntRect borderImageRect = pixelSnappedIntRect(rectWithOutsets); 51 IntRect borderImageRect = pixelSnappedIntRect(rectWithOutsets);
43 52
44 IntSize imageSize = m_layoutObject.calculateImageIntrinsicDimensions(styleIm age, borderImageRect.size(), 53 IntSize imageSize = m_layoutObject.calculateImageIntrinsicDimensions(styleIm age, borderImageRect.size(),
45 LayoutBoxModelObject::DoNotScaleByEffectiveZoom); 54 LayoutBoxModelObject::DoNotScaleByEffectiveZoom);
46 55
47 // If both values are 'auto' then the intrinsic width and/or height of the i mage should be used, if any. 56 // 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
73 drawInfo.tileRule.vertical, op); 82 drawInfo.tileRule.vertical, op);
74 } 83 }
75 } 84 }
76 } 85 }
77 86
78 graphicsContext->setImageInterpolationQuality(previousInterpolationQuality); 87 graphicsContext->setImageInterpolationQuality(previousInterpolationQuality);
79 return true; 88 return true;
80 } 89 }
81 90
82 } // namespace blink 91 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698