| 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 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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 : top_left_(Length(0, kFixed), Length(0, kFixed)), | |
| 43 top_right_(Length(0, kFixed), Length(0, kFixed)), | |
| 44 bottom_left_(Length(0, kFixed), Length(0, kFixed)), | |
| 45 bottom_right_(Length(0, kFixed), Length(0, kFixed)) {} | |
| 46 | 42 |
| 47 bool HasBorder() const { | 43 bool HasBorder() const { |
| 48 return left_.NonZero() || right_.NonZero() || top_.NonZero() || | 44 return left_.NonZero() || right_.NonZero() || top_.NonZero() || |
| 49 bottom_.NonZero(); | 45 bottom_.NonZero(); |
| 50 } | 46 } |
| 51 | 47 |
| 52 bool HasBorderFill() const { return image_.HasImage() && image_.Fill(); } | 48 bool HasBorderFill() const { return image_.HasImage() && image_.Fill(); } |
| 53 | 49 |
| 54 bool HasBorderRadius() const { | |
| 55 if (!top_left_.Width().IsZero()) | |
| 56 return true; | |
| 57 if (!top_right_.Width().IsZero()) | |
| 58 return true; | |
| 59 if (!bottom_left_.Width().IsZero()) | |
| 60 return true; | |
| 61 if (!bottom_right_.Width().IsZero()) | |
| 62 return true; | |
| 63 return false; | |
| 64 } | |
| 65 | |
| 66 bool HasBorderColorReferencingCurrentColor() const { | 50 bool HasBorderColorReferencingCurrentColor() const { |
| 67 return (left_.NonZero() && left_.GetColor().IsCurrentColor()) || | 51 return (left_.NonZero() && left_.GetColor().IsCurrentColor()) || |
| 68 (right_.NonZero() && right_.GetColor().IsCurrentColor()) || | 52 (right_.NonZero() && right_.GetColor().IsCurrentColor()) || |
| 69 (top_.NonZero() && top_.GetColor().IsCurrentColor()) || | 53 (top_.NonZero() && top_.GetColor().IsCurrentColor()) || |
| 70 (bottom_.NonZero() && bottom_.GetColor().IsCurrentColor()); | 54 (bottom_.NonZero() && bottom_.GetColor().IsCurrentColor()); |
| 71 } | 55 } |
| 72 | 56 |
| 73 float BorderLeftWidth() const { | 57 float BorderLeftWidth() const { |
| 74 if (left_.Style() == kBorderStyleNone || | 58 if (left_.Style() == kBorderStyleNone || |
| 75 left_.Style() == kBorderStyleHidden) | 59 left_.Style() == kBorderStyleHidden) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 92 | 76 |
| 93 float BorderBottomWidth() const { | 77 float BorderBottomWidth() const { |
| 94 if (bottom_.Style() == kBorderStyleNone || | 78 if (bottom_.Style() == kBorderStyleNone || |
| 95 bottom_.Style() == kBorderStyleHidden) | 79 bottom_.Style() == kBorderStyleHidden) |
| 96 return 0; | 80 return 0; |
| 97 return bottom_.Width(); | 81 return bottom_.Width(); |
| 98 } | 82 } |
| 99 | 83 |
| 100 bool operator==(const BorderData& o) const { | 84 bool operator==(const BorderData& o) const { |
| 101 return left_ == o.left_ && right_ == o.right_ && top_ == o.top_ && | 85 return left_ == o.left_ && right_ == o.right_ && top_ == o.top_ && |
| 102 bottom_ == o.bottom_ && image_ == o.image_ && RadiiEqual(o); | 86 bottom_ == o.bottom_ && image_ == o.image_; |
| 103 } | 87 } |
| 104 | 88 |
| 105 bool VisuallyEqual(const BorderData& o) const { | 89 bool VisuallyEqual(const BorderData& o) const { |
| 106 return left_.VisuallyEqual(o.left_) && right_.VisuallyEqual(o.right_) && | 90 return left_.VisuallyEqual(o.left_) && right_.VisuallyEqual(o.right_) && |
| 107 top_.VisuallyEqual(o.top_) && bottom_.VisuallyEqual(o.bottom_) && | 91 top_.VisuallyEqual(o.top_) && bottom_.VisuallyEqual(o.bottom_) && |
| 108 image_ == o.image_ && RadiiEqual(o); | 92 image_ == o.image_; |
| 109 } | 93 } |
| 110 | 94 |
| 111 bool VisualOverflowEqual(const BorderData& o) const { | 95 bool VisualOverflowEqual(const BorderData& o) const { |
| 112 return image_.Outset() == o.image_.Outset(); | 96 return image_.Outset() == o.image_.Outset(); |
| 113 } | 97 } |
| 114 | 98 |
| 115 bool operator!=(const BorderData& o) const { return !(*this == o); } | 99 bool operator!=(const BorderData& o) const { return !(*this == o); } |
| 116 | 100 |
| 117 bool SizeEquals(const BorderData& o) const { | 101 bool SizeEquals(const BorderData& o) const { |
| 118 return BorderLeftWidth() == o.BorderLeftWidth() && | 102 return BorderLeftWidth() == o.BorderLeftWidth() && |
| 119 BorderTopWidth() == o.BorderTopWidth() && | 103 BorderTopWidth() == o.BorderTopWidth() && |
| 120 BorderRightWidth() == o.BorderRightWidth() && | 104 BorderRightWidth() == o.BorderRightWidth() && |
| 121 BorderBottomWidth() == o.BorderBottomWidth(); | 105 BorderBottomWidth() == o.BorderBottomWidth(); |
| 122 } | 106 } |
| 123 | 107 |
| 124 bool RadiiEqual(const BorderData& o) const { | |
| 125 return top_left_ == o.top_left_ && top_right_ == o.top_right_ && | |
| 126 bottom_left_ == o.bottom_left_ && bottom_right_ == o.bottom_right_; | |
| 127 } | |
| 128 | |
| 129 const BorderValue& Left() const { return left_; } | 108 const BorderValue& Left() const { return left_; } |
| 130 const BorderValue& Right() const { return right_; } | 109 const BorderValue& Right() const { return right_; } |
| 131 const BorderValue& Top() const { return top_; } | 110 const BorderValue& Top() const { return top_; } |
| 132 const BorderValue& Bottom() const { return bottom_; } | 111 const BorderValue& Bottom() const { return bottom_; } |
| 133 | 112 |
| 134 const NinePieceImage& GetImage() const { return image_; } | 113 const NinePieceImage& GetImage() const { return image_; } |
| 135 | 114 |
| 136 const LengthSize& TopLeft() const { return top_left_; } | |
| 137 const LengthSize& TopRight() const { return top_right_; } | |
| 138 const LengthSize& BottomLeft() const { return bottom_left_; } | |
| 139 const LengthSize& BottomRight() const { return bottom_right_; } | |
| 140 | |
| 141 private: | 115 private: |
| 142 BorderValue left_; | 116 BorderValue left_; |
| 143 BorderValue right_; | 117 BorderValue right_; |
| 144 BorderValue top_; | 118 BorderValue top_; |
| 145 BorderValue bottom_; | 119 BorderValue bottom_; |
| 146 | 120 |
| 147 NinePieceImage image_; | 121 NinePieceImage image_; |
| 148 | |
| 149 LengthSize top_left_; | |
| 150 LengthSize top_right_; | |
| 151 LengthSize bottom_left_; | |
| 152 LengthSize bottom_right_; | |
| 153 }; | 122 }; |
| 154 | 123 |
| 155 } // namespace blink | 124 } // namespace blink |
| 156 | 125 |
| 157 #endif // BorderData_h | 126 #endif // BorderData_h |
| OLD | NEW |