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

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

Issue 2427563002: Call willInsertBody() in MediaDocument::createDocumentStructure() (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 source->setSrc(document()->url()); 137 source->setSrc(document()->url());
138 138
139 if (DocumentLoader* loader = document()->loader()) 139 if (DocumentLoader* loader = document()->loader())
140 source->setType(loader->responseMIMEType()); 140 source->setType(loader->responseMIMEType());
141 141
142 media->appendChild(source); 142 media->appendChild(source);
143 143
144 HTMLBodyElement* body = HTMLBodyElement::create(*document()); 144 HTMLBodyElement* body = HTMLBodyElement::create(*document());
145 body->setAttribute(styleAttr, "margin: 0px;"); 145 body->setAttribute(styleAttr, "margin: 0px;");
146 146
147 document()->willInsertBody();
148
147 HTMLDivElement* div = HTMLDivElement::create(*document()); 149 HTMLDivElement* div = HTMLDivElement::create(*document());
148 // Style sheets for media controls are lazily loaded until a media element is 150 // Style sheets for media controls are lazily loaded until a media element is
149 // encountered. As a result, elements encountered before the media element 151 // encountered. As a result, elements encountered before the media element
150 // will not get the right style at first if we put the styles in 152 // will not get the right style at first if we put the styles in
151 // mediacontrols.css. To solve this issue, set the styles inline so that they 153 // mediacontrols.css. To solve this issue, set the styles inline so that they
152 // will be applied when the page loads. See w3c example on how to centering 154 // will be applied when the page loads. See w3c example on how to centering
153 // an element: https://www.w3.org/Style/Examples/007/center.en.html 155 // an element: https://www.w3.org/Style/Examples/007/center.en.html
154 div->setAttribute(styleAttr, 156 div->setAttribute(styleAttr,
155 "display: flex;" 157 "display: flex;"
156 "flex-direction: column;" 158 "flex-direction: column;"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (keyboardEvent->key() == " " || 253 if (keyboardEvent->key() == " " ||
252 keyboardEvent->keyCode() == VKEY_MEDIA_PLAY_PAUSE) { 254 keyboardEvent->keyCode() == VKEY_MEDIA_PLAY_PAUSE) {
253 // space or media key (play/pause) 255 // space or media key (play/pause)
254 video->togglePlayState(); 256 video->togglePlayState();
255 event->setDefaultHandled(); 257 event->setDefaultHandled();
256 } 258 }
257 } 259 }
258 } 260 }
259 261
260 } // namespace blink 262 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698