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) 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2010 Apple Inc. All rights reserved. |
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 #include "core/html/HTMLOListElement.h" | 23 #include "core/html/HTMLOListElement.h" |
24 | 24 |
25 #include "core/CSSPropertyNames.h" | 25 #include "core/CSSPropertyNames.h" |
26 #include "core/CSSValueKeywords.h" | 26 #include "core/CSSValueKeywords.h" |
27 #include "core/HTMLNames.h" | 27 #include "core/HTMLNames.h" |
| 28 #include "core/html/parser/HTMLParserIdioms.h" |
28 #include "core/layout/LayoutListItem.h" | 29 #include "core/layout/LayoutListItem.h" |
29 | 30 |
30 namespace blink { | 31 namespace blink { |
31 | 32 |
32 using namespace HTMLNames; | 33 using namespace HTMLNames; |
33 | 34 |
34 inline HTMLOListElement::HTMLOListElement(Document& document) | 35 inline HTMLOListElement::HTMLOListElement(Document& document) |
35 : HTMLElement(olTag, document), | 36 : HTMLElement(olTag, document), |
36 m_start(0xBADBEEF), | 37 m_start(0xBADBEEF), |
37 m_itemCount(0), | 38 m_itemCount(0), |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } else { | 72 } else { |
72 HTMLElement::collectStyleForPresentationAttribute(name, value, style); | 73 HTMLElement::collectStyleForPresentationAttribute(name, value, style); |
73 } | 74 } |
74 } | 75 } |
75 | 76 |
76 void HTMLOListElement::parseAttribute(const QualifiedName& name, | 77 void HTMLOListElement::parseAttribute(const QualifiedName& name, |
77 const AtomicString& oldValue, | 78 const AtomicString& oldValue, |
78 const AtomicString& value) { | 79 const AtomicString& value) { |
79 if (name == startAttr) { | 80 if (name == startAttr) { |
80 int oldStart = start(); | 81 int oldStart = start(); |
81 bool canParse; | 82 int parsedStart = 0; |
82 int parsedStart = value.toInt(&canParse); | 83 bool canParse = parseHTMLInteger(value, parsedStart); |
83 m_hasExplicitStart = canParse; | 84 m_hasExplicitStart = canParse; |
84 m_start = canParse ? parsedStart : 0xBADBEEF; | 85 m_start = canParse ? parsedStart : 0xBADBEEF; |
85 if (oldStart == start()) | 86 if (oldStart == start()) |
86 return; | 87 return; |
87 updateItemValues(); | 88 updateItemValues(); |
88 } else if (name == reversedAttr) { | 89 } else if (name == reversedAttr) { |
89 bool reversed = !value.isNull(); | 90 bool reversed = !value.isNull(); |
90 if (reversed == m_isReversed) | 91 if (reversed == m_isReversed) |
91 return; | 92 return; |
92 m_isReversed = reversed; | 93 m_isReversed = reversed; |
(...skipping 13 matching lines...) Expand all Loading... |
106 updateDistribution(); | 107 updateDistribution(); |
107 LayoutListItem::updateItemValuesForOrderedList(this); | 108 LayoutListItem::updateItemValuesForOrderedList(this); |
108 } | 109 } |
109 | 110 |
110 void HTMLOListElement::recalculateItemCount() { | 111 void HTMLOListElement::recalculateItemCount() { |
111 m_itemCount = LayoutListItem::itemCountForOrderedList(this); | 112 m_itemCount = LayoutListItem::itemCountForOrderedList(this); |
112 m_shouldRecalculateItemCount = false; | 113 m_shouldRecalculateItemCount = false; |
113 } | 114 } |
114 | 115 |
115 } // namespace blink | 116 } // namespace blink |
OLD | NEW |