~jconti/ubuntu/oneiric/webkit/fix_doc_path

« back to all changes in this revision

Viewing changes to WebCore/html/HTMLCollection.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mike Hommey
  • Date: 2008-09-27 08:57:48 UTC
  • mfrom: (3.1.6 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080927085748-yhzld00w0rekp961
Tags: 1.0.1-4
WebCore/dom/Document.*, WebCore/loader/DocLoader.*: Avoid DoS via
crafted CSS import statements. Fixes: CVE-2008-3632. Closes: #499771.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * This file is part of the DOM implementation for KDE.
3
 
 *
 
1
/*
4
2
 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5
3
 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
6
 
 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
 
4
 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7
5
 *
8
6
 * This library is free software; you can redistribute it and/or
9
7
 * modify it under the terms of the GNU Library General Public
17
15
 *
18
16
 * You should have received a copy of the GNU Library General Public License
19
17
 * along with this library; see the file COPYING.LIB.  If not, write to
20
 
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
 
 * Boston, MA 02111-1307, USA.
 
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
19
 * Boston, MA 02110-1301, USA.
22
20
 *
23
21
 */
24
22
 
37
35
 
38
36
using namespace HTMLNames;
39
37
 
40
 
HTMLCollection::HTMLCollection(Node *_base, HTMLCollection::Type _type)
41
 
    : m_base(_base),
42
 
      type(_type),
43
 
      info(0),
44
 
      idsDone(false),
45
 
      m_ownsInfo(false)
46
 
{
47
 
    if (_base->isDocumentNode())
48
 
        info = _base->document()->collectionInfo(type);
 
38
HTMLCollection::HTMLCollection(PassRefPtr<Node> base, Type type)
 
39
    : m_idsDone(false)
 
40
    , m_base(base)
 
41
    , m_type(type)
 
42
    , m_info(m_base->isDocumentNode() ? static_cast<Document*>(m_base.get())->collectionInfo(type) : 0)
 
43
    , m_ownsInfo(false)
 
44
{
 
45
}
 
46
 
 
47
HTMLCollection::HTMLCollection(PassRefPtr<Node> base, Type type, CollectionInfo* info)
 
48
    : m_idsDone(false)
 
49
    , m_base(base)
 
50
    , m_type(type)
 
51
    , m_info(info)
 
52
    , m_ownsInfo(false)
 
53
{
 
54
}
 
55
 
 
56
PassRefPtr<HTMLCollection> HTMLCollection::create(PassRefPtr<Node> base, Type type)
 
57
{
 
58
    return adoptRef(new HTMLCollection(base, type));
49
59
}
50
60
 
51
61
HTMLCollection::~HTMLCollection()
52
62
{
53
63
    if (m_ownsInfo)
54
 
        delete info;
 
64
        delete m_info;
55
65
}
56
66
 
57
 
HTMLCollection::CollectionInfo::CollectionInfo() :
58
 
    version(0)
 
67
HTMLCollection::CollectionInfo::CollectionInfo()
 
68
    : version(0)
59
69
{
60
70
    reset();
61
71
}
62
72
 
 
73
inline void HTMLCollection::CollectionInfo::copyCacheMap(NodeCacheMap& dest, const NodeCacheMap& src)
 
74
{
 
75
    ASSERT(dest.isEmpty());
 
76
    NodeCacheMap::const_iterator end = src.end();
 
77
    for (NodeCacheMap::const_iterator it = src.begin(); it != end; ++it)
 
78
        dest.add(it->first, new Vector<Element*>(*it->second));
 
79
}
 
80
 
63
81
HTMLCollection::CollectionInfo::CollectionInfo(const CollectionInfo& other)
 
82
    : version(other.version)
 
83
    , current(other.current)
 
84
    , position(other.position)
 
85
    , length(other.length)
 
86
    , elementsArrayPosition(other.elementsArrayPosition)
 
87
    , hasLength(other.hasLength)
 
88
    , hasNameCache(other.hasNameCache)
64
89
{
65
 
    version = other.version;
66
 
    current = other.current;
67
 
    position = other.position;
68
 
    length = other.length;
69
 
    elementsArrayPosition = other.elementsArrayPosition;
70
 
    
71
90
    copyCacheMap(idCache, other.idCache);
72
91
    copyCacheMap(nameCache, other.nameCache);
73
 
    
74
 
    haslength = other.haslength;
75
 
    hasNameCache = other.hasNameCache;
76
92
}
77
93
 
78
94
void HTMLCollection::CollectionInfo::swap(CollectionInfo& other)
86
102
    idCache.swap(other.idCache);
87
103
    nameCache.swap(other.nameCache);
88
104
    
89
 
    std::swap(haslength, other.haslength);
 
105
    std::swap(hasLength, other.hasLength);
90
106
    std::swap(hasNameCache, other.hasNameCache);
91
107
}
92
108
 
101
117
    current = 0;
102
118
    position = 0;
103
119
    length = 0;
104
 
    haslength = false;
 
120
    hasLength = false;
105
121
    elementsArrayPosition = 0;
106
122
    deleteAllValues(idCache);
107
123
    idCache.clear();
112
128
 
113
129
void HTMLCollection::resetCollectionInfo() const
114
130
{
115
 
    unsigned int docversion = static_cast<HTMLDocument*>(m_base->document())->domTreeVersion();
 
131
    unsigned docversion = static_cast<HTMLDocument*>(m_base->document())->domTreeVersion();
116
132
 
117
 
    if (!info) {
118
 
        info = new CollectionInfo;
 
133
    if (!m_info) {
 
134
        m_info = new CollectionInfo;
119
135
        m_ownsInfo = true;
120
 
        info->version = docversion;
 
136
        m_info->version = docversion;
121
137
        return;
122
138
    }
123
139
 
124
 
    if (info->version != docversion) {
125
 
        info->reset();
126
 
        info->version = docversion;
127
 
    }
128
 
}
129
 
 
130
 
 
131
 
Node *HTMLCollection::traverseNextItem(Node *current) const
132
 
{
133
 
    ASSERT(current);
134
 
 
135
 
    if (type == NodeChildren && m_base.get() != current)
136
 
        current = current->nextSibling();
 
140
    if (m_info->version != docversion) {
 
141
        m_info->reset();
 
142
        m_info->version = docversion;
 
143
    }
 
144
}
 
145
 
 
146
static Node* nextNodeOrSibling(Node* base, Node* node, bool includeChildren)
 
147
{
 
148
    return includeChildren ? node->traverseNextNode(base) : node->traverseNextSibling(base);
 
149
}
 
150
 
 
151
Element* HTMLCollection::itemAfter(Element* previous) const
 
152
{
 
153
    bool deep = true;
 
154
 
 
155
    switch (m_type) {
 
156
        case DocAll:
 
157
        case DocAnchors:
 
158
        case DocApplets:
 
159
        case DocEmbeds:
 
160
        case DocForms:
 
161
        case DocImages:
 
162
        case DocLinks:
 
163
        case DocObjects:
 
164
        case DocScripts:
 
165
        case DocumentNamedItems:
 
166
        case MapAreas:
 
167
        case Other:
 
168
        case SelectOptions:
 
169
        case WindowNamedItems:
 
170
            break;
 
171
        case NodeChildren:
 
172
        case TRCells:
 
173
        case TSectionRows:
 
174
        case TableTBodies:
 
175
            deep = false;
 
176
            break;
 
177
    }
 
178
 
 
179
    Node* current;
 
180
    if (!previous)
 
181
        current = m_base->firstChild();
137
182
    else
138
 
        current = current->traverseNextNode(m_base.get());
 
183
        current = nextNodeOrSibling(m_base.get(), previous, deep);
139
184
 
140
 
    while (current) {
141
 
        if (current->isElementNode()) {
142
 
            bool found = false;
143
 
            bool deep = true;
144
 
            HTMLElement *e = static_cast<HTMLElement *>(current);
145
 
            switch(type) {
 
185
    for (; current; current = nextNodeOrSibling(m_base.get(), current, deep)) {
 
186
        if (!current->isElementNode())
 
187
            continue;
 
188
        Element* e = static_cast<Element*>(current);
 
189
        switch (m_type) {
146
190
            case DocImages:
147
191
                if (e->hasLocalName(imgTag))
148
 
                    found = true;
 
192
                    return e;
149
193
                break;
150
194
            case DocScripts:
151
195
                if (e->hasLocalName(scriptTag))
152
 
                    found = true;
 
196
                    return e;
153
197
                break;
154
198
            case DocForms:
155
 
                if(e->hasLocalName(formTag))
156
 
                    found = true;
 
199
                if (e->hasLocalName(formTag))
 
200
                    return e;
157
201
                break;
158
202
            case TableTBodies:
159
203
                if (e->hasLocalName(tbodyTag))
160
 
                    found = true;
161
 
                else if (e->hasLocalName(tableTag))
162
 
                    deep = false;
 
204
                    return e;
163
205
                break;
164
206
            case TRCells:
165
207
                if (e->hasLocalName(tdTag) || e->hasLocalName(thTag))
166
 
                    found = true;
167
 
                else if (e->hasLocalName(tableTag))
168
 
                    deep = false;
 
208
                    return e;
169
209
                break;
170
 
            case TableRows:
171
210
            case TSectionRows:
172
211
                if (e->hasLocalName(trTag))
173
 
                    found = true;
174
 
                else if (e->hasLocalName(tableTag))
175
 
                    deep = false;
 
212
                    return e;
176
213
                break;
177
214
            case SelectOptions:
178
215
                if (e->hasLocalName(optionTag))
179
 
                    found = true;
 
216
                    return e;
180
217
                break;
181
218
            case MapAreas:
182
219
                if (e->hasLocalName(areaTag))
183
 
                    found = true;
184
 
                break;
185
 
            case DocApplets:   // all APPLET elements and OBJECT elements that contain Java Applets
186
 
                if (e->hasLocalName(appletTag) || 
187
 
                    (e->hasLocalName(objectTag) && static_cast<HTMLObjectElement*>(e)->containsJavaApplet()))
188
 
                    found = true;
189
 
                break;
190
 
            case DocEmbeds:   // all EMBED elements
 
220
                    return e;
 
221
                break;
 
222
            case DocApplets: // all <applet> elements and <object> elements that contain Java Applets
 
223
                if (e->hasLocalName(appletTag))
 
224
                    return e;
 
225
                if (e->hasLocalName(objectTag) && static_cast<HTMLObjectElement*>(e)->containsJavaApplet())
 
226
                    return e;
 
227
                break;
 
228
            case DocEmbeds:
191
229
                if (e->hasLocalName(embedTag))
192
 
                    found = true;
 
230
                    return e;
193
231
                break;
194
 
            case DocObjects:   // all OBJECT elements
 
232
            case DocObjects:
195
233
                if (e->hasLocalName(objectTag))
196
 
                    found = true;
197
 
                break;
198
 
            case DocLinks:     // all A _and_ AREA elements with a value for href
199
 
                if (e->hasLocalName(aTag) || e->hasLocalName(areaTag))
200
 
                    if (!e->getAttribute(hrefAttr).isNull())
201
 
                        found = true;
202
 
                break;
203
 
            case DocAnchors:      // all A elements with a value for name or an id attribute
204
 
                if (e->hasLocalName(aTag))
205
 
                    if (!e->getAttribute(nameAttr).isNull())
206
 
                        found = true;
 
234
                    return e;
 
235
                break;
 
236
            case DocLinks: // all <a> and <area> elements with a value for href
 
237
                if ((e->hasLocalName(aTag) || e->hasLocalName(areaTag)) && (!e->getAttribute(hrefAttr).isNull()))
 
238
                    return e;
 
239
                break;
 
240
            case DocAnchors: // all <a> elements with a value for name
 
241
                if (e->hasLocalName(aTag) && !e->getAttribute(nameAttr).isNull())
 
242
                    return e;
207
243
                break;
208
244
            case DocAll:
209
 
                found = true;
210
 
                break;
211
245
            case NodeChildren:
212
 
                found = true;
213
 
                deep = false;
214
 
                break;
215
 
            default:
216
 
                break;
217
 
            }
218
 
 
219
 
            if (found)
220
 
                return current;
221
 
            if (deep) {
222
 
                current = current->traverseNextNode(m_base.get());
223
 
                continue;
224
 
            } 
 
246
                return e;
 
247
            case DocumentNamedItems:
 
248
            case Other:
 
249
            case WindowNamedItems:
 
250
                ASSERT_NOT_REACHED();
 
251
                break;
225
252
        }
226
 
        current = current->traverseNextSibling(m_base.get());
227
253
    }
 
254
 
228
255
    return 0;
229
256
}
230
257
 
231
 
 
232
258
unsigned HTMLCollection::calcLength() const
233
259
{
234
260
    unsigned len = 0;
235
 
 
236
 
    for (Node *current = traverseNextItem(m_base.get()); current; current = traverseNextItem(current)) {
237
 
        len++;
238
 
    }
239
 
 
 
261
    for (Element* current = itemAfter(0); current; current = itemAfter(current))
 
262
        ++len;
240
263
    return len;
241
264
}
242
265
 
245
268
unsigned HTMLCollection::length() const
246
269
{
247
270
    resetCollectionInfo();
248
 
    if (!info->haslength) {
249
 
        info->length = calcLength();
250
 
        info->haslength = true;
 
271
    if (!m_info->hasLength) {
 
272
        m_info->length = calcLength();
 
273
        m_info->hasLength = true;
251
274
    }
252
 
    return info->length;
 
275
    return m_info->length;
253
276
}
254
277
 
255
 
Node *HTMLCollection::item( unsigned index ) const
 
278
Node* HTMLCollection::item(unsigned index) const
256
279
{
257
280
     resetCollectionInfo();
258
 
     if (info->current && info->position == index) {
259
 
         return info->current;
260
 
     }
261
 
     if (info->haslength && info->length <= index) {
 
281
     if (m_info->current && m_info->position == index)
 
282
         return m_info->current;
 
283
     if (m_info->hasLength && m_info->length <= index)
262
284
         return 0;
263
 
     }
264
 
     if (!info->current || info->position > index) {
265
 
         info->current = traverseNextItem(m_base.get());
266
 
         info->position = 0;
267
 
         if (!info->current)
 
285
     if (!m_info->current || m_info->position > index) {
 
286
         m_info->current = itemAfter(0);
 
287
         m_info->position = 0;
 
288
         if (!m_info->current)
268
289
             return 0;
269
290
     }
270
 
     Node *node = info->current;
271
 
     for (unsigned pos = info->position; node && pos < index; pos++) {
272
 
         node = traverseNextItem(node);
273
 
     }     
274
 
     info->current = node;
275
 
     info->position = index;
276
 
     return info->current;
 
291
     Element* e = m_info->current;
 
292
     for (unsigned pos = m_info->position; e && pos < index; pos++)
 
293
         e = itemAfter(e);
 
294
     m_info->current = e;
 
295
     m_info->position = index;
 
296
     return m_info->current;
277
297
}
278
298
 
279
 
Node *HTMLCollection::firstItem() const
 
299
Node* HTMLCollection::firstItem() const
280
300
{
281
301
     return item(0);
282
302
}
283
303
 
284
 
Node *HTMLCollection::nextItem() const
 
304
Node* HTMLCollection::nextItem() const
285
305
{
286
306
     resetCollectionInfo();
287
307
 
288
308
     // Look for the 'second' item. The first one is currentItem, already given back.
289
 
     Node *retval = traverseNextItem(info->current);
290
 
     info->current = retval;
291
 
     info->position++;
 
309
     Element* retval = itemAfter(m_info->current);
 
310
     m_info->current = retval;
 
311
     m_info->position++;
292
312
     return retval;
293
313
}
294
314
 
295
 
bool HTMLCollection::checkForNameMatch(Node *node, bool checkName, const String &name, bool caseSensitive) const
 
315
bool HTMLCollection::checkForNameMatch(Element* element, bool checkName, const String& name, bool caseSensitive) const
296
316
{
297
 
    if (!node->isHTMLElement())
 
317
    if (!element->isHTMLElement())
298
318
        return false;
299
319
    
300
 
    HTMLElement *e = static_cast<HTMLElement*>(node);
 
320
    HTMLElement* e = static_cast<HTMLElement*>(element);
301
321
    if (caseSensitive) {
302
322
        if (checkName) {
303
323
            // document.all returns only images, forms, applets, objects and embeds
304
324
            // by name (though everything by id)
305
 
            if (type == DocAll && 
 
325
            if (m_type == DocAll && 
306
326
                !(e->hasLocalName(imgTag) || e->hasLocalName(formTag) ||
307
327
                  e->hasLocalName(appletTag) || e->hasLocalName(objectTag) ||
308
328
                  e->hasLocalName(embedTag) || e->hasLocalName(inputTag) ||
316
336
        if (checkName) {
317
337
            // document.all returns only images, forms, applets, objects and embeds
318
338
            // by name (though everything by id)
319
 
            if (type == DocAll && 
 
339
            if (m_type == DocAll && 
320
340
                !(e->hasLocalName(imgTag) || e->hasLocalName(formTag) ||
321
341
                  e->hasLocalName(appletTag) || e->hasLocalName(objectTag) ||
322
342
                  e->hasLocalName(embedTag) || e->hasLocalName(inputTag) ||
323
343
                  e->hasLocalName(selectTag)))
324
344
                return false;
325
345
 
326
 
            return e->getAttribute(nameAttr).domString().lower() == name.lower() &&
327
 
                e->getAttribute(idAttr).domString().lower() != name.lower();
 
346
            return e->getAttribute(nameAttr).string().lower() == name.lower() &&
 
347
                e->getAttribute(idAttr).string().lower() != name.lower();
328
348
        } else {
329
 
            return e->getAttribute(idAttr).domString().lower() == name.lower();
 
349
            return e->getAttribute(idAttr).string().lower() == name.lower();
330
350
        }
331
351
    }
332
352
}
340
360
    // object with a matching name attribute, but only on those elements
341
361
    // that are allowed a name attribute.
342
362
    resetCollectionInfo();
343
 
    idsDone = false;
 
363
    m_idsDone = false;
344
364
 
345
 
    Node *n;
346
 
    for (n = traverseNextItem(m_base.get()); n; n = traverseNextItem(n)) {
347
 
        if (checkForNameMatch(n, idsDone, name, caseSensitive))
348
 
            break;
 
365
    for (Element* e = itemAfter(0); e; e = itemAfter(e)) {
 
366
        if (checkForNameMatch(e, m_idsDone, name, caseSensitive)) {
 
367
            m_info->current = e;
 
368
            return e;
 
369
        }
349
370
    }
350
371
        
351
 
    info->current = n;
352
 
    if(info->current)
353
 
        return info->current;
354
 
    idsDone = true;
 
372
    m_idsDone = true;
355
373
 
356
 
    for (n = traverseNextItem(m_base.get()); n; n = traverseNextItem(n)) {
357
 
        if (checkForNameMatch(n, idsDone, name, caseSensitive))
358
 
            break;
 
374
    for (Element* e = itemAfter(0); e; e = itemAfter(e)) {
 
375
        if (checkForNameMatch(e, m_idsDone, name, caseSensitive)) {
 
376
            m_info->current = e;
 
377
            return e;
 
378
        }
359
379
    }
360
380
 
361
 
    info->current = n;
362
 
    return info->current;
 
381
    m_info->current = 0;
 
382
    return 0;
363
383
}
364
384
 
365
385
void HTMLCollection::updateNameCache() const
366
386
{
367
 
    if (info->hasNameCache)
 
387
    if (m_info->hasNameCache)
368
388
        return;
369
389
    
370
 
    for (Node *n = traverseNextItem(m_base.get()); n; n = traverseNextItem(n)) {
371
 
        if (!n->isHTMLElement())
 
390
    for (Element* element = itemAfter(0); element; element = itemAfter(element)) {
 
391
        if (!element->isHTMLElement())
372
392
            continue;
373
 
        HTMLElement* e = static_cast<HTMLElement*>(n);
 
393
        HTMLElement* e = static_cast<HTMLElement*>(element);
374
394
        const AtomicString& idAttrVal = e->getAttribute(idAttr);
375
395
        const AtomicString& nameAttrVal = e->getAttribute(nameAttr);
376
396
        if (!idAttrVal.isEmpty()) {
377
397
            // add to id cache
378
 
            Vector<Node*>* idVector = info->idCache.get(idAttrVal.impl());
 
398
            Vector<Element*>* idVector = m_info->idCache.get(idAttrVal.impl());
379
399
            if (!idVector) {
380
 
                idVector = new Vector<Node*>;
381
 
                info->idCache.add(idAttrVal.impl(), idVector);
 
400
                idVector = new Vector<Element*>;
 
401
                m_info->idCache.add(idAttrVal.impl(), idVector);
382
402
            }
383
 
            idVector->append(n);
 
403
            idVector->append(e);
384
404
        }
385
405
        if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal
386
 
            && (type != DocAll || 
 
406
            && (m_type != DocAll || 
387
407
                (e->hasLocalName(imgTag) || e->hasLocalName(formTag) ||
388
408
                 e->hasLocalName(appletTag) || e->hasLocalName(objectTag) ||
389
409
                 e->hasLocalName(embedTag) || e->hasLocalName(inputTag) ||
390
410
                 e->hasLocalName(selectTag)))) {
391
411
            // add to name cache
392
 
            Vector<Node*>* nameVector = info->nameCache.get(nameAttrVal.impl());
 
412
            Vector<Element*>* nameVector = m_info->nameCache.get(nameAttrVal.impl());
393
413
            if (!nameVector) {
394
 
                nameVector = new Vector<Node*>;
395
 
                info->nameCache.add(nameAttrVal.impl(), nameVector);
 
414
                nameVector = new Vector<Element*>;
 
415
                m_info->nameCache.add(nameAttrVal.impl(), nameVector);
396
416
            }
397
 
            nameVector->append(n);
 
417
            nameVector->append(e);
398
418
        }
399
419
    }
400
420
 
401
 
    info->hasNameCache = true;
 
421
    m_info->hasNameCache = true;
402
422
}
403
423
 
404
 
void HTMLCollection::namedItems(const AtomicString &name, Vector<RefPtr<Node> >& result) const
 
424
void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >& result) const
405
425
{
406
426
    ASSERT(result.isEmpty());
407
427
    
411
431
    resetCollectionInfo();
412
432
    updateNameCache();
413
433
    
414
 
    Vector<Node*>* idResults = info->idCache.get(name.impl());
415
 
    Vector<Node*>* nameResults = info->nameCache.get(name.impl());
 
434
    Vector<Element*>* idResults = m_info->idCache.get(name.impl());
 
435
    Vector<Element*>* nameResults = m_info->nameCache.get(name.impl());
416
436
    
417
437
    for (unsigned i = 0; idResults && i < idResults->size(); ++i)
418
438
        result.append(idResults->at(i));
422
442
}
423
443
 
424
444
 
425
 
Node *HTMLCollection::nextNamedItem(const String &name) const
 
445
Node* HTMLCollection::nextNamedItem(const String& name) const
426
446
{
427
447
    resetCollectionInfo();
428
448
 
429
 
    for (Node *n = traverseNextItem(info->current ? info->current : m_base.get()); n; n = traverseNextItem(n)) {
430
 
        if (checkForNameMatch(n, idsDone, name, true)) {
431
 
            info->current = n;
432
 
            return n;
 
449
    for (Element* e = itemAfter(m_info->current); e; e = itemAfter(e)) {
 
450
        if (checkForNameMatch(e, m_idsDone, name, true)) {
 
451
            m_info->current = e;
 
452
            return e;
433
453
        }
434
454
    }
435
455
    
436
 
    if (idsDone) {
437
 
        info->current = 0; 
 
456
    if (m_idsDone) {
 
457
        m_info->current = 0; 
438
458
        return 0;
439
459
    }
440
 
    idsDone = true;
 
460
    m_idsDone = true;
441
461
 
442
 
    for (Node *n = traverseNextItem(info->current ? info->current : m_base.get()); n; n = traverseNextItem(n)) {
443
 
        if (checkForNameMatch(n, idsDone, name, true)) {
444
 
            info->current = n;
445
 
            return n;
 
462
    for (Element* e = itemAfter(m_info->current); e; e = itemAfter(e)) {
 
463
        if (checkForNameMatch(e, m_idsDone, name, true)) {
 
464
            m_info->current = e;
 
465
            return e;
446
466
        }
447
467
    }
448
468
 
451
471
 
452
472
PassRefPtr<NodeList> HTMLCollection::tags(const String& name)
453
473
{
454
 
    return base()->getElementsByTagName(name);
 
474
    return m_base->getElementsByTagName(name);
455
475
}
456
476
 
457
477
} // namespace WebCore