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, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #include "core/layout/LayoutListItem.h" | 24 #include "core/layout/LayoutListItem.h" |
25 | 25 |
26 #include "core/HTMLNames.h" | 26 #include "core/HTMLNames.h" |
27 #include "core/dom/shadow/ComposedTreeTraversal.h" | 27 #include "core/dom/shadow/FlatTreeTraversal.h" |
28 #include "core/html/HTMLOListElement.h" | 28 #include "core/html/HTMLOListElement.h" |
29 #include "core/layout/LayoutListMarker.h" | 29 #include "core/layout/LayoutListMarker.h" |
30 #include "core/layout/LayoutView.h" | 30 #include "core/layout/LayoutView.h" |
31 #include "core/paint/ListItemPainter.h" | 31 #include "core/paint/ListItemPainter.h" |
32 #include "wtf/StdLibExtras.h" | 32 #include "wtf/StdLibExtras.h" |
33 #include "wtf/text/StringBuilder.h" | 33 #include "wtf/text/StringBuilder.h" |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 | 36 |
37 using namespace HTMLNames; | 37 using namespace HTMLNames; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 | 122 |
123 // Returns the enclosing list with respect to the DOM order. | 123 // Returns the enclosing list with respect to the DOM order. |
124 static Node* enclosingList(const LayoutListItem* listItem) | 124 static Node* enclosingList(const LayoutListItem* listItem) |
125 { | 125 { |
126 Node* listItemNode = listItem->node(); | 126 Node* listItemNode = listItem->node(); |
127 if (!listItemNode) | 127 if (!listItemNode) |
128 return nullptr; | 128 return nullptr; |
129 Node* firstNode = nullptr; | 129 Node* firstNode = nullptr; |
130 // We use parentNode because the enclosing list could be a ShadowRoot that's
not Element. | 130 // We use parentNode because the enclosing list could be a ShadowRoot that's
not Element. |
131 for (Node* parent = ComposedTreeTraversal::parent(*listItemNode); parent; pa
rent = ComposedTreeTraversal::parent(*parent)) { | 131 for (Node* parent = FlatTreeTraversal::parent(*listItemNode); parent; parent
= FlatTreeTraversal::parent(*parent)) { |
132 if (isList(*parent)) | 132 if (isList(*parent)) |
133 return parent; | 133 return parent; |
134 if (!firstNode) | 134 if (!firstNode) |
135 firstNode = parent; | 135 firstNode = parent; |
136 } | 136 } |
137 | 137 |
138 // If there's no actual <ul> or <ol> list element, then the first found | 138 // If there's no actual <ul> or <ol> list element, then the first found |
139 // node acts as our list for purposes of determining what other list items | 139 // node acts as our list for purposes of determining what other list items |
140 // should be numbered as part of the same list. | 140 // should be numbered as part of the same list. |
141 return firstNode; | 141 return firstNode; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 // assume that all the following ones have too. | 510 // assume that all the following ones have too. |
511 // This gives us the opportunity to stop here and avoid | 511 // This gives us the opportunity to stop here and avoid |
512 // marking the same nodes again. | 512 // marking the same nodes again. |
513 break; | 513 break; |
514 } | 514 } |
515 item->updateValue(); | 515 item->updateValue(); |
516 } | 516 } |
517 } | 517 } |
518 | 518 |
519 } // namespace blink | 519 } // namespace blink |
OLD | NEW |