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

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: 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..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;

Powered by Google App Engine
This is Rietveld 408576698