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) 2006, 2007, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2006, 2007, 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 * |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } else { | 89 } else { |
90 HTMLElement::parseAttribute(name, oldValue, value); | 90 HTMLElement::parseAttribute(name, oldValue, value); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 void HTMLLIElement::attach(const AttachContext& context) | 94 void HTMLLIElement::attach(const AttachContext& context) |
95 { | 95 { |
96 HTMLElement::attach(context); | 96 HTMLElement::attach(context); |
97 | 97 |
98 if (layoutObject() && layoutObject()->isListItem()) { | 98 if (layoutObject() && layoutObject()->isListItem()) { |
99 LayoutLIItem liLayoutItem = LayoutLIItem(toLayoutListItem(layoutObject()
)); | |
100 | 99 |
101 ASSERT(!document().childNeedsDistributionRecalc()); | 100 ASSERT(!document().childNeedsDistributionRecalc()); |
102 | 101 |
103 // Find the enclosing list node. | 102 // Find the enclosing list node. |
104 Element* listNode = 0; | 103 Element* listNode = 0; |
105 Element* current = this; | 104 Element* current = this; |
106 while (!listNode) { | 105 while (!listNode) { |
107 current = LayoutTreeBuilderTraversal::parentElement(*current); | 106 current = LayoutTreeBuilderTraversal::parentElement(*current); |
108 if (!current) | 107 if (!current) |
109 break; | 108 break; |
110 if (isHTMLUListElement(*current) || isHTMLOListElement(*current)) | 109 if (isHTMLUListElement(*current) || isHTMLOListElement(*current)) |
111 listNode = current; | 110 listNode = current; |
112 } | 111 } |
113 | 112 |
114 // If we are not in a list, tell the layoutObject so it can position us
inside. | |
115 // We don't want to change our style to say "inside" since that would af
fect nested nodes. | |
116 if (!listNode) | |
117 liLayoutItem.setNotInList(true); | |
118 | |
119 parseValue(fastGetAttribute(valueAttr)); | 113 parseValue(fastGetAttribute(valueAttr)); |
120 } | 114 } |
121 } | 115 } |
122 | 116 |
123 inline void HTMLLIElement::parseValue(const AtomicString& value) | 117 inline void HTMLLIElement::parseValue(const AtomicString& value) |
124 { | 118 { |
125 ASSERT(layoutObject() && layoutObject()->isListItem()); | 119 ASSERT(layoutObject() && layoutObject()->isListItem()); |
126 | 120 |
127 bool valueOK; | 121 bool valueOK; |
128 int requestedValue = value.toInt(&valueOK); | 122 int requestedValue = value.toInt(&valueOK); |
129 if (valueOK) | 123 if (valueOK) |
130 toLayoutListItem(layoutObject())->setExplicitValue(requestedValue); | 124 toLayoutListItem(layoutObject())->setExplicitValue(requestedValue); |
131 else | 125 else |
132 toLayoutListItem(layoutObject())->clearExplicitValue(); | 126 toLayoutListItem(layoutObject())->clearExplicitValue(); |
133 } | 127 } |
134 | 128 |
135 } // namespace blink | 129 } // namespace blink |
OLD | NEW |