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

Side by Side Diff: third_party/WebKit/Source/core/html/MediaDocument.cpp

Issue 1942623002: Rename Document::ownerElement to localOwner and fix main frame checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed const changes and some gratuitous checks Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageDocument.cpp ('k') | third_party/WebKit/Source/core/html/PluginDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698