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