| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 createDocumentStructure(); | 228 createDocumentStructure(); |
| 229 finish(); | 229 finish(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 MediaDocument::MediaDocument(const DocumentInit& initializer) | 232 MediaDocument::MediaDocument(const DocumentInit& initializer) |
| 233 : HTMLDocument(initializer, MediaDocumentClass) | 233 : HTMLDocument(initializer, MediaDocumentClass) |
| 234 { | 234 { |
| 235 setCompatibilityMode(QuirksMode); | 235 setCompatibilityMode(QuirksMode); |
| 236 lockCompatibilityMode(); | 236 lockCompatibilityMode(); |
| 237 UseCounter::count(*this, UseCounter::MediaDocument); | 237 UseCounter::count(*this, UseCounter::MediaDocument); |
| 238 if (ownerElement()) | 238 if (!isInMainFrame()) |
| 239 UseCounter::count(*this, UseCounter::MediaDocumentInFrame); | 239 UseCounter::count(*this, UseCounter::MediaDocumentInFrame); |
| 240 } | 240 } |
| 241 | 241 |
| 242 DocumentParser* MediaDocument::createParser() | 242 DocumentParser* MediaDocument::createParser() |
| 243 { | 243 { |
| 244 return MediaDocumentParser::create(this); | 244 return MediaDocumentParser::create(this); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void MediaDocument::defaultEventHandler(Event* event) | 247 void MediaDocument::defaultEventHandler(Event* event) |
| 248 { | 248 { |
| 249 Node* targetNode = event->target()->toNode(); | 249 Node* targetNode = event->target()->toNode(); |
| 250 if (!targetNode) | 250 if (!targetNode) |
| 251 return; | 251 return; |
| 252 | 252 |
| 253 if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) { | 253 if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) { |
| 254 HTMLVideoElement* video = Traversal<HTMLVideoElement>::firstWithin(*targ
etNode); | 254 HTMLVideoElement* video = Traversal<HTMLVideoElement>::firstWithin(*targ
etNode); |
| 255 if (!video) | 255 if (!video) |
| 256 return; | 256 return; |
| 257 | 257 |
| 258 KeyboardEvent* keyboardEvent = toKeyboardEvent(event); | 258 KeyboardEvent* keyboardEvent = toKeyboardEvent(event); |
| 259 if (keyboardEvent->keyIdentifier() == "U+0020" || keyboardEvent->keyCode
() == VKEY_MEDIA_PLAY_PAUSE) { | 259 if (keyboardEvent->keyIdentifier() == "U+0020" || keyboardEvent->keyCode
() == VKEY_MEDIA_PLAY_PAUSE) { |
| 260 // space or media key (play/pause) | 260 // space or media key (play/pause) |
| 261 video->togglePlayState(); | 261 video->togglePlayState(); |
| 262 event->setDefaultHandled(); | 262 event->setDefaultHandled(); |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace blink | 267 } // namespace blink |
| OLD | NEW |