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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |