Chromium Code Reviews| Index: Source/core/html/MediaDocument.cpp |
| diff --git a/Source/core/html/MediaDocument.cpp b/Source/core/html/MediaDocument.cpp |
| index 22dc2f6d7cd12b32c150bd522c46cd3dbfff24d7..be210076f1edb5d66f8601418e2c4446d5c08778 100644 |
| --- a/Source/core/html/MediaDocument.cpp |
| +++ b/Source/core/html/MediaDocument.cpp |
| @@ -29,7 +29,7 @@ |
| #include "HTMLNames.h" |
| #include "bindings/v8/ExceptionStatePlaceholder.h" |
| -#include "core/dom/NodeTraversal.h" |
| +#include "core/dom/ElementTraversal.h" |
| #include "core/dom/RawDataDocumentParser.h" |
| #include "core/events/KeyboardEvent.h" |
| #include "core/events/ThreadLocalEventNames.h" |
| @@ -129,16 +129,9 @@ PassRefPtr<DocumentParser> MediaDocument::createParser() |
| return MediaDocumentParser::create(this); |
| } |
| -static inline HTMLVideoElement* descendentVideoElement(Node* root) |
| +static inline HTMLVideoElement* descendentVideoElement(Node& root) |
| { |
| - ASSERT(root); |
| - |
| - for (Node* node = root; node; node = NodeTraversal::next(*node, root)) { |
| - if (node->hasTagName(videoTag)) |
| - return toHTMLVideoElement(node); |
| - } |
| - |
| - return 0; |
| + return Traversal<HTMLVideoElement>::firstWithin(root); |
| } |
| void MediaDocument::defaultEventHandler(Event* event) |
| @@ -148,7 +141,7 @@ void MediaDocument::defaultEventHandler(Event* event) |
| return; |
| if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) { |
| - HTMLVideoElement* video = descendentVideoElement(targetNode); |
| + HTMLVideoElement* video = descendentVideoElement(*targetNode); |
|
philipj_slow
2014/03/13 02:49:56
Just inline descendentVideoElement? Seems like it
Inactive
2014/03/13 04:35:54
I hesitated :) I will do this then.
Inactive
2014/03/13 04:53:55
Done.
|
| if (!video) |
| return; |