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

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

Issue 1642283002: Deal with frame removal by content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Last nits Created 4 years, 9 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 bool m_didBuildDocumentStructure; 68 bool m_didBuildDocumentStructure;
69 }; 69 };
70 70
71 void MediaDocumentParser::createDocumentStructure() 71 void MediaDocumentParser::createDocumentStructure()
72 { 72 {
73 ASSERT(document()); 73 ASSERT(document());
74 RefPtrWillBeRawPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*d ocument()); 74 RefPtrWillBeRawPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*d ocument());
75 rootElement->insertedByParser(); 75 rootElement->insertedByParser();
76 document()->appendChild(rootElement); 76 document()->appendChild(rootElement);
77 77
78 if (document()->frame()) 78 document()->frame()->loader().dispatchDocumentElementAvailable();
79 document()->frame()->loader().dispatchDocumentElementAvailable(); 79 document()->frame()->loader().runScriptsAtDocumentElementAvailable();
80 if (isDetached())
81 return; // runScriptsAtDocumentElementAvailable can detach the frame.
80 82
81 RefPtrWillBeRawPtr<HTMLHeadElement> head = HTMLHeadElement::create(*document ()); 83 RefPtrWillBeRawPtr<HTMLHeadElement> head = HTMLHeadElement::create(*document ());
82 RefPtrWillBeRawPtr<HTMLMetaElement> meta = HTMLMetaElement::create(*document ()); 84 RefPtrWillBeRawPtr<HTMLMetaElement> meta = HTMLMetaElement::create(*document ());
83 meta->setAttribute(nameAttr, "viewport"); 85 meta->setAttribute(nameAttr, "viewport");
84 meta->setAttribute(contentAttr, "width=device-width"); 86 meta->setAttribute(contentAttr, "width=device-width");
85 head->appendChild(meta.release()); 87 head->appendChild(meta.release());
86 88
87 RefPtrWillBeRawPtr<HTMLVideoElement> media = HTMLVideoElement::create(*docum ent()); 89 RefPtrWillBeRawPtr<HTMLVideoElement> media = HTMLVideoElement::create(*docum ent());
88 media->setAttribute(controlsAttr, ""); 90 media->setAttribute(controlsAttr, "");
89 media->setAttribute(autoplayAttr, ""); 91 media->setAttribute(autoplayAttr, "");
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 KeyboardEvent* keyboardEvent = toKeyboardEvent(event); 147 KeyboardEvent* keyboardEvent = toKeyboardEvent(event);
146 if (keyboardEvent->keyIdentifier() == "U+0020" || keyboardEvent->keyCode () == VKEY_MEDIA_PLAY_PAUSE) { 148 if (keyboardEvent->keyIdentifier() == "U+0020" || keyboardEvent->keyCode () == VKEY_MEDIA_PLAY_PAUSE) {
147 // space or media key (play/pause) 149 // space or media key (play/pause)
148 video->togglePlayState(); 150 video->togglePlayState();
149 event->setDefaultHandled(); 151 event->setDefaultHandled();
150 } 152 }
151 } 153 }
152 } 154 }
153 155
154 } // namespace blink 156 } // 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