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

Side by Side Diff: Source/bindings/v8/V8WindowShell.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: Rebase 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
« no previous file with comments | « no previous file | Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 static v8::Handle<v8::Value> getNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 437 static v8::Handle<v8::Value> getNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
438 { 438 {
439 if (!htmlDocument->hasNamedItem(key) && !htmlDocument->hasExtraNamedItem(key )) 439 if (!htmlDocument->hasNamedItem(key) && !htmlDocument->hasExtraNamedItem(key ))
440 return v8Undefined(); 440 return v8Undefined();
441 441
442 RefPtr<HTMLCollection> items = htmlDocument->documentNamedItems(key); 442 RefPtr<HTMLCollection> items = htmlDocument->documentNamedItems(key);
443 if (items->isEmpty()) 443 if (items->isEmpty())
444 return v8Undefined(); 444 return v8Undefined();
445 445
446 if (items->hasExactlyOneItem()) { 446 if (items->hasExactlyOneItem()) {
447 Node* node = items->item(0); 447 Element* element = items->item(0);
448 Frame* frame = 0; 448 Frame* frame = 0;
449 if (node->hasTagName(HTMLNames::iframeTag) && (frame = toHTMLIFrameEleme nt(node)->contentFrame())) 449 if (element->hasTagName(HTMLNames::iframeTag) && (frame = toHTMLIFrameEl ement(element)->contentFrame()))
450 return toV8(frame->domWindow(), creationContext, isolate); 450 return toV8(frame->domWindow(), creationContext, isolate);
451 return toV8(node, creationContext, isolate); 451 return toV8(element, creationContext, isolate);
452 } 452 }
453 return toV8(items.release(), creationContext, isolate); 453 return toV8(items.release(), creationContext, isolate);
454 } 454 }
455 455
456 static void getter(v8::Local<v8::String> property, const v8::PropertyCallbackInf o<v8::Value>& info) 456 static void getter(v8::Local<v8::String> property, const v8::PropertyCallbackInf o<v8::Value>& info)
457 { 457 {
458 // FIXME: Consider passing StringImpl directly. 458 // FIXME: Consider passing StringImpl directly.
459 AtomicString name = toCoreAtomicString(property); 459 AtomicString name = toCoreAtomicString(property);
460 HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder()); 460 HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder());
461 ASSERT(htmlDocument); 461 ASSERT(htmlDocument);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 { 519 {
520 ASSERT(isMainThread()); 520 ASSERT(isMainThread());
521 // We're initializing the context, so it is not yet in a status where we can 521 // We're initializing the context, so it is not yet in a status where we can
522 // validate the context. 522 // validate the context.
523 if (contextBeingInitialized) 523 if (contextBeingInitialized)
524 return true; 524 return true;
525 return !!toDOMWindow(context); 525 return !!toDOMWindow(context);
526 } 526 }
527 527
528 } // WebCore 528 } // WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698