Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1032)

Side by Side Diff: Source/core/html/parser/HTMLFormattingElementList.cpp

Issue 23464095: WTF::notFound looks too much like a local variable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 bool HTMLFormattingElementList::contains(Element* element) 60 bool HTMLFormattingElementList::contains(Element* element)
61 { 61 {
62 return !!find(element); 62 return !!find(element);
63 } 63 }
64 64
65 HTMLFormattingElementList::Entry* HTMLFormattingElementList::find(Element* eleme nt) 65 HTMLFormattingElementList::Entry* HTMLFormattingElementList::find(Element* eleme nt)
66 { 66 {
67 size_t index = m_entries.reverseFind(element); 67 size_t index = m_entries.reverseFind(element);
68 if (index != notFound) { 68 if (index != kNotFound) {
69 // This is somewhat of a hack, and is why this method can't be const. 69 // This is somewhat of a hack, and is why this method can't be const.
70 return &m_entries[index]; 70 return &m_entries[index];
71 } 71 }
72 return 0; 72 return 0;
73 } 73 }
74 74
75 HTMLFormattingElementList::Bookmark HTMLFormattingElementList::bookmarkFor(Eleme nt* element) 75 HTMLFormattingElementList::Bookmark HTMLFormattingElementList::bookmarkFor(Eleme nt* element)
76 { 76 {
77 size_t index = m_entries.reverseFind(element); 77 size_t index = m_entries.reverseFind(element);
78 ASSERT(index != notFound); 78 ASSERT(index != kNotFound);
79 return Bookmark(&at(index)); 79 return Bookmark(&at(index));
80 } 80 }
81 81
82 void HTMLFormattingElementList::swapTo(Element* oldElement, PassRefPtr<HTMLStack Item> newItem, const Bookmark& bookmark) 82 void HTMLFormattingElementList::swapTo(Element* oldElement, PassRefPtr<HTMLStack Item> newItem, const Bookmark& bookmark)
83 { 83 {
84 ASSERT(contains(oldElement)); 84 ASSERT(contains(oldElement));
85 ASSERT(!contains(newItem->element())); 85 ASSERT(!contains(newItem->element()));
86 if (!bookmark.hasBeenMoved()) { 86 if (!bookmark.hasBeenMoved()) {
87 ASSERT(bookmark.mark()->element() == oldElement); 87 ASSERT(bookmark.mark()->element() == oldElement);
88 bookmark.mark()->replaceElement(newItem); 88 bookmark.mark()->replaceElement(newItem);
89 return; 89 return;
90 } 90 }
91 size_t index = bookmark.mark() - first(); 91 size_t index = bookmark.mark() - first();
92 ASSERT_WITH_SECURITY_IMPLICATION(index < size()); 92 ASSERT_WITH_SECURITY_IMPLICATION(index < size());
93 m_entries.insert(index + 1, newItem); 93 m_entries.insert(index + 1, newItem);
94 remove(oldElement); 94 remove(oldElement);
95 } 95 }
96 96
97 void HTMLFormattingElementList::append(PassRefPtr<HTMLStackItem> item) 97 void HTMLFormattingElementList::append(PassRefPtr<HTMLStackItem> item)
98 { 98 {
99 ensureNoahsArkCondition(item.get()); 99 ensureNoahsArkCondition(item.get());
100 m_entries.append(item); 100 m_entries.append(item);
101 } 101 }
102 102
103 void HTMLFormattingElementList::remove(Element* element) 103 void HTMLFormattingElementList::remove(Element* element)
104 { 104 {
105 size_t index = m_entries.reverseFind(element); 105 size_t index = m_entries.reverseFind(element);
106 if (index != notFound) 106 if (index != kNotFound)
107 m_entries.remove(index); 107 m_entries.remove(index);
108 } 108 }
109 109
110 void HTMLFormattingElementList::appendMarker() 110 void HTMLFormattingElementList::appendMarker()
111 { 111 {
112 m_entries.append(Entry::MarkerEntry); 112 m_entries.append(Entry::MarkerEntry);
113 } 113 }
114 114
115 void HTMLFormattingElementList::clearToLastMarker() 115 void HTMLFormattingElementList::clearToLastMarker()
116 { 116 {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 if (entry.isMarker()) 209 if (entry.isMarker())
210 fprintf(stderr, "marker\n"); 210 fprintf(stderr, "marker\n");
211 else 211 else
212 entry.element()->showNode(); 212 entry.element()->showNode();
213 } 213 }
214 } 214 }
215 215
216 #endif 216 #endif
217 217
218 } 218 }
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.cpp ('k') | Source/core/html/parser/HTMLMetaCharsetParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698