Changeset 53868 in webkit
- Timestamp:
- Jan 26, 2010 2:48:56 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r53863 r53868 1 2010-01-26 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Beth Dakin. 4 5 <rdar://problem/7576663> Crash caused by anonymous list item 6 https://bugs.webkit.org/show_bug.cgi?id=34183 7 8 * fast/lists/anonymous-items.html: Added. 9 * platform/mac/fast/lists/anonymous-items-expected.checksum: Added. 10 * platform/mac/fast/lists/anonymous-items-expected.png: Added. 11 * platform/mac/fast/lists/anonymous-items-expected.txt: Added. 12 1 13 2010-01-26 Chris Fleizach <cfleizach@apple.com> 2 14 -
trunk/WebCore/ChangeLog
r53867 r53868 1 2010-01-26 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Beth Dakin. 4 5 <rdar://problem/7576663> Crash caused by anonymous list item 6 https://bugs.webkit.org/show_bug.cgi?id=34183 7 8 Test: fast/lists/anonymous-items.html 9 10 enclosingList() and previousListItem() were DOM-based, but in order to work with anonymous 11 list items, they need to work with rthe render tree. 12 13 * rendering/RenderListItem.cpp: 14 (WebCore::isList): Factored out. 15 (WebCore::enclosingList): Added this variant that takes a RenderObject. 16 (WebCore::previousListItem): Changed to travers the render tree. 17 (WebCore::RenderListItem::calcValue): Use the RenderObject version of enclosingList() 18 (WebCore::RenderListItem::setExplicitValue): Added an assertion. 19 (WebCore::RenderListItem::clearExplicitValue): Ditto. 20 1 21 2010-01-26 Brian Weinstein <bweinstein@apple.com> 2 22 -
trunk/WebCore/rendering/RenderListItem.cpp
r52521 r53868 2 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.4 * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 6 6 * … … 76 76 } 77 77 78 static bool isList(Node* node) 79 { 80 return (node->hasTagName(ulTag) || node->hasTagName(olTag)); 81 } 82 78 83 static Node* enclosingList(Node* node) 79 84 { 80 85 Node* parent = node->parentNode(); 81 86 for (Node* n = parent; n; n = n->parentNode()) 82 if ( n->hasTagName(ulTag) || n->hasTagName(olTag))87 if (isList(n)) 83 88 return n; 84 89 // If there's no actual <ul> or <ol> list element, then our parent acts as … … 88 93 } 89 94 95 static Node* enclosingList(const RenderObject* renderer) 96 { 97 Node* node = renderer->node(); 98 if (node) 99 return enclosingList(node); 100 101 renderer = renderer->parent(); 102 while (renderer && !renderer->node()) 103 renderer = renderer->parent(); 104 105 node = renderer->node(); 106 if (isList(node)) 107 return node; 108 109 return enclosingList(node); 110 } 111 90 112 static RenderListItem* previousListItem(Node* list, const RenderListItem* item) 91 113 { 92 for (Node* node = item->node()->traversePreviousNode(); node != list; node = node->traversePreviousNode()) { 93 RenderObject* renderer = node->renderer(); 94 if (!renderer || !renderer->isListItem()) 114 for (RenderObject* renderer = item->previousInPreOrder(); renderer != list->renderer(); renderer = renderer->previousInPreOrder()) { 115 if (!renderer->isListItem()) 95 116 continue; 96 Node* otherList = enclosingList( node);117 Node* otherList = enclosingList(renderer); 97 118 // This item is part of our current list, so it's what we're looking for. 98 119 if (list == otherList) 99 120 return toRenderListItem(renderer); 100 121 // We found ourself inside another list; lets skip the rest of it. 101 // Use traverseNextNode() here because the other list itself may actually122 // Use nextInPreOrder() here because the other list itself may actually 102 123 // be a list item itself. We need to examine it, so we do this to counteract 103 // the traversePreviousNode() that will be done by the loop.124 // the previousInPreOrder() that will be done by the loop. 104 125 if (otherList) 105 node = otherList->traverseNextNode();126 renderer = otherList->renderer()->nextInPreOrder(); 106 127 } 107 128 return 0; … … 112 133 if (m_hasExplicitValue) 113 134 return m_explicitValue; 114 Node* list = enclosingList( node());135 Node* list = enclosingList(this); 115 136 // FIXME: This recurses to a possible depth of the length of the list. 116 137 // That's not good -- we need to change this to an iterative algorithm. … … 323 344 void RenderListItem::setExplicitValue(int value) 324 345 { 346 ASSERT(node()); 347 325 348 if (m_hasExplicitValue && m_explicitValue == value) 326 349 return; … … 333 356 void RenderListItem::clearExplicitValue() 334 357 { 358 ASSERT(node()); 359 335 360 if (!m_hasExplicitValue) 336 361 return;
Note: See TracChangeset
for help on using the changeset viewer.