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/BorderStyle.h" | |
29 #include "core/style/NinePieceImage.h" | 28 #include "core/style/NinePieceImage.h" |
30 #include "platform/LengthSize.h" | 29 #include "platform/LengthSize.h" |
31 #include "platform/geometry/IntRect.h" | 30 #include "platform/geometry/IntRect.h" |
32 #include "platform/wtf/Allocator.h" | 31 #include "platform/wtf/Allocator.h" |
33 | 32 |
34 namespace blink { | 33 namespace blink { |
35 | 34 |
36 class BorderData { | 35 class BorderData { |
37 DISALLOW_NEW(); | 36 DISALLOW_NEW(); |
38 friend class ComputedStyle; | 37 friend class ComputedStyle; |
39 | 38 |
40 public: | 39 public: |
41 BorderData() {} | 40 BorderData() {} |
42 | 41 |
43 bool HasBorder() const { | |
44 return left_.NonZero() || right_.NonZero() || top_.NonZero() || | |
45 bottom_.NonZero(); | |
46 } | |
47 | |
48 bool HasBorderFill() const { return image_.HasImage() && image_.Fill(); } | 42 bool HasBorderFill() const { return image_.HasImage() && image_.Fill(); } |
49 | 43 |
50 bool operator==(const BorderData& o) const { | 44 bool operator==(const BorderData& o) const { return image_ == o.image_; } |
51 return left_ == o.left_ && right_ == o.right_ && top_ == o.top_ && | |
52 bottom_ == o.bottom_ && image_ == o.image_; | |
53 } | |
54 | 45 |
55 bool VisuallyEqual(const BorderData& o) const { | 46 bool VisuallyEqual(const BorderData& o) const { return image_ == o.image_; } |
56 return left_.VisuallyEqual(o.left_) && right_.VisuallyEqual(o.right_) && | |
57 top_.VisuallyEqual(o.top_) && bottom_.VisuallyEqual(o.bottom_) && | |
58 image_ == o.image_; | |
59 } | |
60 | 47 |
61 bool VisualOverflowEqual(const BorderData& o) const { | 48 bool VisualOverflowEqual(const BorderData& o) const { |
62 return image_.Outset() == o.image_.Outset(); | 49 return image_.Outset() == o.image_.Outset(); |
63 } | 50 } |
64 | 51 |
65 bool operator!=(const BorderData& o) const { return !(*this == o); } | 52 bool operator!=(const BorderData& o) const { return !(*this == o); } |
66 | 53 |
67 const BorderStyle& Left() const { return left_; } | |
68 const BorderStyle& Right() const { return right_; } | |
69 const BorderStyle& Top() const { return top_; } | |
70 const BorderStyle& Bottom() const { return bottom_; } | |
71 | 54 |
72 const NinePieceImage& GetImage() const { return image_; } | 55 const NinePieceImage& GetImage() const { return image_; } |
73 | 56 |
74 private: | 57 private: |
75 BorderStyle left_; | |
76 BorderStyle right_; | |
77 BorderStyle top_; | |
78 BorderStyle bottom_; | |
79 | |
80 NinePieceImage image_; | 58 NinePieceImage image_; |
81 }; | 59 }; |
82 | 60 |
83 } // namespace blink | 61 } // namespace blink |
84 | 62 |
85 #endif // BorderData_h | 63 #endif // BorderData_h |
OLD | NEW |