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 #ifndef CullRect_h | 5 #ifndef CullRect_h |
6 #define CullRect_h | 6 #define CullRect_h |
7 | 7 |
8 #include "platform/geometry/IntRect.h" | 8 #include "platform/geometry/IntRect.h" |
9 #include "platform/transforms/AffineTransform.h" | 9 #include "platform/transforms/AffineTransform.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
11 #include "wtf/HashMap.h" | 11 #include "wtf/HashMap.h" |
12 #include "wtf/ListHashSet.h" | 12 #include "wtf/ListHashSet.h" |
13 #include "wtf/text/WTFString.h" | |
14 | 13 |
15 #include <limits> | 14 #include <limits> |
16 | 15 |
17 namespace blink { | 16 namespace blink { |
18 | 17 |
19 class FloatRect; | 18 class FloatRect; |
20 class LayoutRect; | 19 class LayoutRect; |
21 class LayoutUnit; | 20 class LayoutUnit; |
22 | 21 |
23 class PLATFORM_EXPORT CullRect { | 22 class PLATFORM_EXPORT CullRect { |
24 DISALLOW_NEW(); | 23 DISALLOW_NEW(); |
25 | 24 |
26 public: | 25 public: |
26 CullRect() {} | |
27 explicit CullRect(const IntRect& rect) : m_rect(rect) {} | 27 explicit CullRect(const IntRect& rect) : m_rect(rect) {} |
28 CullRect(const CullRect&, const IntPoint& offset); | 28 CullRect(const CullRect&, const IntPoint& offset); |
29 CullRect(const CullRect&, const IntSize& offset); | 29 CullRect(const CullRect&, const IntSize& offset); |
30 | 30 |
31 bool intersectsCullRect(const AffineTransform&, | 31 bool intersectsCullRect(const AffineTransform&, |
32 const FloatRect& boundingBox) const; | 32 const FloatRect& boundingBox) const; |
33 void updateCullRect(const AffineTransform& localToParentTransform); | 33 void updateCullRect(const AffineTransform& localToParentTransform); |
34 bool intersectsCullRect(const IntRect&) const; | 34 bool intersectsCullRect(const IntRect&) const; |
35 bool intersectsCullRect(const LayoutRect&) const; | 35 bool intersectsCullRect(const LayoutRect&) const; |
36 bool intersectsHorizontalRange(LayoutUnit lo, LayoutUnit hi) const; | 36 bool intersectsHorizontalRange(LayoutUnit lo, LayoutUnit hi) const; |
37 bool intersectsVerticalRange(LayoutUnit lo, LayoutUnit hi) const; | 37 bool intersectsVerticalRange(LayoutUnit lo, LayoutUnit hi) const; |
38 | 38 |
39 String toString() const { return m_rect.toString(); } | |
chrishtr
2016/11/11 19:02:16
Why remove this?
Xianzhu
2016/11/11 19:13:25
Sorry, this is a mistake when cherry-picking this
| |
40 | |
41 private: | 39 private: |
42 IntRect m_rect; | 40 IntRect m_rect; |
43 | 41 |
42 friend bool operator==(const CullRect&, const CullRect&); | |
43 | |
44 // TODO(chrishtr): temporary while we implement CullRect everywhere. | 44 // TODO(chrishtr): temporary while we implement CullRect everywhere. |
45 friend class FramePainter; | 45 friend class FramePainter; |
46 friend class GridPainter; | 46 friend class GridPainter; |
47 friend class SVGInlineTextBoxPainter; | 47 friend class SVGInlineTextBoxPainter; |
48 friend class SVGPaintContext; | 48 friend class SVGPaintContext; |
49 friend class SVGRootInlineBoxPainter; | 49 friend class SVGRootInlineBoxPainter; |
50 friend class SVGShapePainter; | 50 friend class SVGShapePainter; |
51 friend class TableSectionPainter; | 51 friend class TableSectionPainter; |
52 friend class ThemePainterMac; | 52 friend class ThemePainterMac; |
53 friend class WebPluginContainerImpl; | 53 friend class WebPluginContainerImpl; |
54 }; | 54 }; |
55 | 55 |
56 inline bool operator==(const CullRect& a, const CullRect& b) { | |
57 return a.m_rect == b.m_rect; | |
58 } | |
59 inline bool operator!=(const CullRect& a, const CullRect& b) { | |
60 return !(a == b); | |
61 } | |
62 | |
56 } // namespace blink | 63 } // namespace blink |
57 | 64 |
58 #endif // CullRect_h | 65 #endif // CullRect_h |
OLD | NEW |