OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #ifndef BorderData_h | 25 #ifndef BorderData_h |
26 #define BorderData_h | 26 #define BorderData_h |
27 | 27 |
28 #include "core/style/BorderColorAndStyle.h" | 28 #include "core/style/BorderStyle.h" |
29 #include "core/style/NinePieceImage.h" | 29 #include "core/style/NinePieceImage.h" |
30 #include "platform/LengthSize.h" | 30 #include "platform/LengthSize.h" |
31 #include "platform/geometry/IntRect.h" | 31 #include "platform/geometry/IntRect.h" |
32 #include "platform/wtf/Allocator.h" | 32 #include "platform/wtf/Allocator.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class BorderData { | 36 class BorderData { |
37 DISALLOW_NEW(); | 37 DISALLOW_NEW(); |
38 friend class ComputedStyle; | 38 friend class ComputedStyle; |
39 | 39 |
40 public: | 40 public: |
41 BorderData() {} | 41 BorderData() {} |
42 | 42 |
43 bool HasBorder() const { | 43 bool HasBorder() const { |
44 return left_.NonZero() || right_.NonZero() || top_.NonZero() || | 44 return left_.NonZero() || right_.NonZero() || top_.NonZero() || |
45 bottom_.NonZero(); | 45 bottom_.NonZero(); |
46 } | 46 } |
47 | 47 |
48 bool HasBorderFill() const { return image_.HasImage() && image_.Fill(); } | 48 bool HasBorderFill() const { return image_.HasImage() && image_.Fill(); } |
49 | 49 |
50 bool HasBorderColorReferencingCurrentColor() const { | |
51 return (left_.NonZero() && left_.GetColor().IsCurrentColor()) || | |
52 (right_.NonZero() && right_.GetColor().IsCurrentColor()) || | |
53 (top_.NonZero() && top_.GetColor().IsCurrentColor()) || | |
54 (bottom_.NonZero() && bottom_.GetColor().IsCurrentColor()); | |
55 } | |
56 | |
57 bool operator==(const BorderData& o) const { | 50 bool operator==(const BorderData& o) const { |
58 return left_ == o.left_ && right_ == o.right_ && top_ == o.top_ && | 51 return left_ == o.left_ && right_ == o.right_ && top_ == o.top_ && |
59 bottom_ == o.bottom_ && image_ == o.image_; | 52 bottom_ == o.bottom_ && image_ == o.image_; |
60 } | 53 } |
61 | 54 |
62 bool VisuallyEqual(const BorderData& o) const { | 55 bool VisuallyEqual(const BorderData& o) const { |
63 return left_.VisuallyEqual(o.left_) && right_.VisuallyEqual(o.right_) && | 56 return left_.VisuallyEqual(o.left_) && right_.VisuallyEqual(o.right_) && |
64 top_.VisuallyEqual(o.top_) && bottom_.VisuallyEqual(o.bottom_) && | 57 top_.VisuallyEqual(o.top_) && bottom_.VisuallyEqual(o.bottom_) && |
65 image_ == o.image_; | 58 image_ == o.image_; |
66 } | 59 } |
67 | 60 |
68 bool VisualOverflowEqual(const BorderData& o) const { | 61 bool VisualOverflowEqual(const BorderData& o) const { |
69 return image_.Outset() == o.image_.Outset(); | 62 return image_.Outset() == o.image_.Outset(); |
70 } | 63 } |
71 | 64 |
72 bool operator!=(const BorderData& o) const { return !(*this == o); } | 65 bool operator!=(const BorderData& o) const { return !(*this == o); } |
73 | 66 |
74 const BorderColorAndStyle& Left() const { return left_; } | 67 const BorderStyle& Left() const { return left_; } |
75 const BorderColorAndStyle& Right() const { return right_; } | 68 const BorderStyle& Right() const { return right_; } |
76 const BorderColorAndStyle& Top() const { return top_; } | 69 const BorderStyle& Top() const { return top_; } |
77 const BorderColorAndStyle& Bottom() const { return bottom_; } | 70 const BorderStyle& Bottom() const { return bottom_; } |
78 | 71 |
79 const NinePieceImage& GetImage() const { return image_; } | 72 const NinePieceImage& GetImage() const { return image_; } |
80 | 73 |
81 private: | 74 private: |
82 BorderColorAndStyle left_; | 75 BorderStyle left_; |
83 BorderColorAndStyle right_; | 76 BorderStyle right_; |
84 BorderColorAndStyle top_; | 77 BorderStyle top_; |
85 BorderColorAndStyle bottom_; | 78 BorderStyle bottom_; |
86 | 79 |
87 NinePieceImage image_; | 80 NinePieceImage image_; |
88 }; | 81 }; |
89 | 82 |
90 } // namespace blink | 83 } // namespace blink |
91 | 84 |
92 #endif // BorderData_h | 85 #endif // BorderData_h |
OLD | NEW |