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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 137433008: Have HTMLCollection::item() return an Element as per specification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update WebNodeCollection API Created 6 years, 10 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
OLDNEW
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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 4208 matching lines...) Expand 10 before | Expand all | Expand 10 after
4219 return KURL(); 4219 return KURL();
4220 4220
4221 // FIXME: Why do we need to wait for FrameStateComplete? 4221 // FIXME: Why do we need to wait for FrameStateComplete?
4222 if (frame()->loader().state() != FrameStateComplete) 4222 if (frame()->loader().state() != FrameStateComplete)
4223 return KURL(); 4223 return KURL();
4224 4224
4225 if (!head()) 4225 if (!head())
4226 return KURL(); 4226 return KURL();
4227 4227
4228 RefPtr<HTMLCollection> children = head()->children(); 4228 RefPtr<HTMLCollection> children = head()->children();
4229 for (unsigned i = 0; Node* child = children->item(i); i++) { 4229 for (unsigned i = 0; Element* child = children->item(i); i++) {
4230 if (!child->hasTagName(linkTag)) 4230 if (!child->hasTagName(linkTag))
4231 continue; 4231 continue;
4232 HTMLLinkElement* linkElement = toHTMLLinkElement(child); 4232 HTMLLinkElement* linkElement = toHTMLLinkElement(child);
4233 if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equa lIgnoringCase(linkElement->rel(), openSearchRelation)) 4233 if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equa lIgnoringCase(linkElement->rel(), openSearchRelation))
4234 continue; 4234 continue;
4235 if (linkElement->href().isEmpty()) 4235 if (linkElement->href().isEmpty())
4236 continue; 4236 continue;
4237 return linkElement->href(); 4237 return linkElement->href();
4238 } 4238 }
4239 4239
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
4477 { 4477 {
4478 IconURL firstFavicon; 4478 IconURL firstFavicon;
4479 IconURL firstTouchIcon; 4479 IconURL firstTouchIcon;
4480 IconURL firstTouchPrecomposedIcon; 4480 IconURL firstTouchPrecomposedIcon;
4481 Vector<IconURL> secondaryIcons; 4481 Vector<IconURL> secondaryIcons;
4482 4482
4483 // Start from the last child node so that icons seen later take precedence a s required by the spec. 4483 // Start from the last child node so that icons seen later take precedence a s required by the spec.
4484 RefPtr<HTMLCollection> children = head() ? head()->children() : 0; 4484 RefPtr<HTMLCollection> children = head() ? head()->children() : 0;
4485 unsigned length = children ? children->length() : 0; 4485 unsigned length = children ? children->length() : 0;
4486 for (unsigned i = 0; i < length; i++) { 4486 for (unsigned i = 0; i < length; i++) {
4487 Node* child = children->item(i); 4487 Element* child = children->item(i);
4488 if (!child->hasTagName(linkTag)) 4488 if (!child->hasTagName(linkTag))
4489 continue; 4489 continue;
4490 HTMLLinkElement* linkElement = toHTMLLinkElement(child); 4490 HTMLLinkElement* linkElement = toHTMLLinkElement(child);
4491 if (!(linkElement->iconType() & iconTypesMask)) 4491 if (!(linkElement->iconType() & iconTypesMask))
4492 continue; 4492 continue;
4493 if (linkElement->href().isEmpty()) 4493 if (linkElement->href().isEmpty())
4494 continue; 4494 continue;
4495 if (!RuntimeEnabledFeatures::touchIconLoadingEnabled() && linkElement->i conType() != Favicon) 4495 if (!RuntimeEnabledFeatures::touchIconLoadingEnabled() && linkElement->i conType() != Favicon)
4496 continue; 4496 continue;
4497 4497
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
5424 if (!page->focusController().isActive() || !page->focusController().isFocuse d()) 5424 if (!page->focusController().isActive() || !page->focusController().isFocuse d())
5425 return false; 5425 return false;
5426 if (Frame* focusedFrame = page->focusController().focusedFrame()) { 5426 if (Frame* focusedFrame = page->focusController().focusedFrame()) {
5427 if (focusedFrame->tree().isDescendantOf(frame())) 5427 if (focusedFrame->tree().isDescendantOf(frame()))
5428 return true; 5428 return true;
5429 } 5429 }
5430 return false; 5430 return false;
5431 } 5431 }
5432 5432
5433 } // namespace WebCore 5433 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698