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

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

Powered by Google App Engine
This is Rietveld 408576698