OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserv
ed. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #ifndef RenderListItem_h | 23 #ifndef LayoutListItem_h |
24 #define RenderListItem_h | 24 #define LayoutListItem_h |
25 | 25 |
26 #include "core/rendering/RenderBlockFlow.h" | 26 #include "core/rendering/RenderBlockFlow.h" |
27 | 27 |
28 namespace blink { | 28 namespace blink { |
29 | 29 |
30 class HTMLOListElement; | 30 class HTMLOListElement; |
31 class RenderListMarker; | 31 class LayoutListMarker; |
32 | 32 |
33 class RenderListItem final : public RenderBlockFlow { | 33 class LayoutListItem final : public RenderBlockFlow { |
34 public: | 34 public: |
35 explicit RenderListItem(Element*); | 35 explicit LayoutListItem(Element*); |
36 | 36 |
37 int value() const { if (!m_isValueUpToDate) updateValueNow(); return m_value
; } | 37 int value() const |
| 38 { |
| 39 if (!m_isValueUpToDate) { |
| 40 updateValueNow(); |
| 41 } |
| 42 return m_value; |
| 43 } |
38 void updateValue(); | 44 void updateValue(); |
39 | 45 |
40 bool hasExplicitValue() const { return m_hasExplicitValue; } | 46 bool hasExplicitValue() const { return m_hasExplicitValue; } |
41 int explicitValue() const { return m_explicitValue; } | 47 int explicitValue() const { return m_explicitValue; } |
42 void setExplicitValue(int value); | 48 void setExplicitValue(int); |
43 void clearExplicitValue(); | 49 void clearExplicitValue(); |
44 | 50 |
45 void setNotInList(bool); | 51 void setNotInList(bool); |
46 bool notInList() const { return m_notInList; } | 52 bool notInList() const { return m_notInList; } |
47 | 53 |
48 const String& markerText() const; | 54 const String& markerText() const; |
49 | 55 |
50 void updateListMarkerNumbers(); | 56 void updateListMarkerNumbers(); |
51 | 57 |
52 static void updateItemValuesForOrderedList(const HTMLOListElement*); | 58 static void updateItemValuesForOrderedList(const HTMLOListElement*); |
53 static unsigned itemCountForOrderedList(const HTMLOListElement*); | 59 static unsigned itemCountForOrderedList(const HTMLOListElement*); |
54 | 60 |
55 bool isEmpty() const; | 61 bool isEmpty() const; |
56 | 62 |
57 private: | 63 private: |
58 virtual const char* renderName() const override { return "RenderListItem"; } | 64 virtual const char* renderName() const override { return "LayoutListItem"; } |
59 | 65 |
60 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectListItem || RenderBlockFlow::isOfType(type); } | 66 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectListItem || RenderBlockFlow::isOfType(type); } |
61 | 67 |
62 virtual void willBeDestroyed() override; | 68 virtual void willBeDestroyed() override; |
63 | 69 |
64 virtual void insertedIntoTree() override; | 70 virtual void insertedIntoTree() override; |
65 virtual void willBeRemovedFromTree() override; | 71 virtual void willBeRemovedFromTree() override; |
66 | 72 |
67 virtual void paint(const PaintInfo&, const LayoutPoint&) override; | 73 virtual void paint(const PaintInfo&, const LayoutPoint&) override; |
68 | 74 |
69 virtual void layout() override; | 75 virtual void layout() override; |
70 | 76 |
71 // Returns true if we re-attached and updated the location of the marker. | 77 // Returns true if we re-attached and updated the location of the marker. |
72 bool updateMarkerLocation(); | 78 bool updateMarkerLocation(); |
73 void updateMarkerLocationAndInvalidateWidth(); | 79 void updateMarkerLocationAndInvalidateWidth(); |
74 | 80 |
75 void positionListMarker(); | 81 void positionListMarker(); |
76 | 82 |
77 virtual void styleDidChange(StyleDifference, const LayoutStyle* oldStyle) ov
erride; | 83 virtual void styleDidChange(StyleDifference, const LayoutStyle* oldStyle) ov
erride; |
78 | 84 |
79 virtual void addOverflowFromChildren() override; | 85 virtual void addOverflowFromChildren() override; |
80 | 86 |
81 inline int calcValue() const; | 87 inline int calcValue() const; |
82 void updateValueNow() const; | 88 void updateValueNow() const; |
83 void explicitValueChanged(); | 89 void explicitValueChanged(); |
84 | 90 |
85 int m_explicitValue; | 91 int m_explicitValue; |
86 RenderListMarker* m_marker; | 92 LayoutListMarker* m_marker; |
87 mutable int m_value; | 93 mutable int m_value; |
88 | 94 |
89 bool m_hasExplicitValue : 1; | 95 bool m_hasExplicitValue : 1; |
90 mutable bool m_isValueUpToDate : 1; | 96 mutable bool m_isValueUpToDate : 1; |
91 bool m_notInList : 1; | 97 bool m_notInList : 1; |
92 }; | 98 }; |
93 | 99 |
94 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderListItem, isListItem()); | 100 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutListItem, isListItem()); |
95 | 101 |
96 } // namespace blink | 102 } // namespace blink |
97 | 103 |
98 #endif // RenderListItem_h | 104 #endif // LayoutListItem_h |
OLD | NEW |