| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 28 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 29 #include "core/HTMLNames.h" | 29 #include "core/HTMLNames.h" |
| 30 #include "core/dom/ElementTraversal.h" | 30 #include "core/dom/ElementTraversal.h" |
| 31 #include "core/dom/RawDataDocumentParser.h" | 31 #include "core/dom/RawDataDocumentParser.h" |
| 32 #include "core/dom/shadow/ShadowRoot.h" | 32 #include "core/dom/shadow/ShadowRoot.h" |
| 33 #include "core/events/Event.h" | 33 #include "core/events/Event.h" |
| 34 #include "core/events/EventListener.h" | 34 #include "core/events/EventListener.h" |
| 35 #include "core/events/KeyboardEvent.h" | 35 #include "core/events/KeyboardEvent.h" |
| 36 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
| 37 #include "core/frame/UseCounter.h" |
| 37 #include "core/html/HTMLAnchorElement.h" | 38 #include "core/html/HTMLAnchorElement.h" |
| 38 #include "core/html/HTMLBodyElement.h" | 39 #include "core/html/HTMLBodyElement.h" |
| 39 #include "core/html/HTMLContentElement.h" | 40 #include "core/html/HTMLContentElement.h" |
| 40 #include "core/html/HTMLDivElement.h" | 41 #include "core/html/HTMLDivElement.h" |
| 41 #include "core/html/HTMLHeadElement.h" | 42 #include "core/html/HTMLHeadElement.h" |
| 42 #include "core/html/HTMLHtmlElement.h" | 43 #include "core/html/HTMLHtmlElement.h" |
| 43 #include "core/html/HTMLMetaElement.h" | 44 #include "core/html/HTMLMetaElement.h" |
| 44 #include "core/html/HTMLSourceElement.h" | 45 #include "core/html/HTMLSourceElement.h" |
| 45 #include "core/html/HTMLStyleElement.h" | 46 #include "core/html/HTMLStyleElement.h" |
| 46 #include "core/html/HTMLVideoElement.h" | 47 #include "core/html/HTMLVideoElement.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 228 |
| 228 createDocumentStructure(); | 229 createDocumentStructure(); |
| 229 finish(); | 230 finish(); |
| 230 } | 231 } |
| 231 | 232 |
| 232 MediaDocument::MediaDocument(const DocumentInit& initializer) | 233 MediaDocument::MediaDocument(const DocumentInit& initializer) |
| 233 : HTMLDocument(initializer, MediaDocumentClass) | 234 : HTMLDocument(initializer, MediaDocumentClass) |
| 234 { | 235 { |
| 235 setCompatibilityMode(QuirksMode); | 236 setCompatibilityMode(QuirksMode); |
| 236 lockCompatibilityMode(); | 237 lockCompatibilityMode(); |
| 238 UseCounter::count(*this, UseCounter::MediaDocument); |
| 239 if (ownerElement()) |
| 240 UseCounter::count(*this, UseCounter::MediaDocumentInFrame); |
| 237 } | 241 } |
| 238 | 242 |
| 239 DocumentParser* MediaDocument::createParser() | 243 DocumentParser* MediaDocument::createParser() |
| 240 { | 244 { |
| 241 return MediaDocumentParser::create(this); | 245 return MediaDocumentParser::create(this); |
| 242 } | 246 } |
| 243 | 247 |
| 244 void MediaDocument::defaultEventHandler(Event* event) | 248 void MediaDocument::defaultEventHandler(Event* event) |
| 245 { | 249 { |
| 246 Node* targetNode = event->target()->toNode(); | 250 Node* targetNode = event->target()->toNode(); |
| 247 if (!targetNode) | 251 if (!targetNode) |
| 248 return; | 252 return; |
| 249 | 253 |
| 250 if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) { | 254 if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) { |
| 251 HTMLVideoElement* video = Traversal<HTMLVideoElement>::firstWithin(*targ
etNode); | 255 HTMLVideoElement* video = Traversal<HTMLVideoElement>::firstWithin(*targ
etNode); |
| 252 if (!video) | 256 if (!video) |
| 253 return; | 257 return; |
| 254 | 258 |
| 255 KeyboardEvent* keyboardEvent = toKeyboardEvent(event); | 259 KeyboardEvent* keyboardEvent = toKeyboardEvent(event); |
| 256 if (keyboardEvent->keyIdentifier() == "U+0020" || keyboardEvent->keyCode
() == VKEY_MEDIA_PLAY_PAUSE) { | 260 if (keyboardEvent->keyIdentifier() == "U+0020" || keyboardEvent->keyCode
() == VKEY_MEDIA_PLAY_PAUSE) { |
| 257 // space or media key (play/pause) | 261 // space or media key (play/pause) |
| 258 video->togglePlayState(); | 262 video->togglePlayState(); |
| 259 event->setDefaultHandled(); | 263 event->setDefaultHandled(); |
| 260 } | 264 } |
| 261 } | 265 } |
| 262 } | 266 } |
| 263 | 267 |
| 264 } // namespace blink | 268 } // namespace blink |
| OLD | NEW |