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

Unified Diff: Source/core/html/MediaDocument.cpp

Issue 198453003: Use new is*Element() helper functions more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/MediaDocument.cpp
diff --git a/Source/core/html/MediaDocument.cpp b/Source/core/html/MediaDocument.cpp
index 22dc2f6d7cd12b32c150bd522c46cd3dbfff24d7..b7b902418b7b853ceee71a46db26e24b6db0425a 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,18 +129,6 @@ PassRefPtr<DocumentParser> MediaDocument::createParser()
return MediaDocumentParser::create(this);
}
-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;
-}
-
void MediaDocument::defaultEventHandler(Event* event)
{
Node* targetNode = event->target()->toNode();
@@ -148,7 +136,7 @@ void MediaDocument::defaultEventHandler(Event* event)
return;
if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) {
- HTMLVideoElement* video = descendentVideoElement(targetNode);
+ HTMLVideoElement* video = Traversal<HTMLVideoElement>::firstWithin(*targetNode);
if (!video)
return;

Powered by Google App Engine
This is Rietveld 408576698