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

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

Issue 1866343002: Measure usage of image/media/plugin/text documents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 16 matching lines...) Expand all
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
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
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