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

Side by Side Diff: Source/core/html/ImageDocument.cpp

Issue 18034007: Add viewport settings for ImageDocument and MediaDocument (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: LayoutTests Created 7 years, 5 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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 185
186 void ImageDocument::createDocumentStructure() 186 void ImageDocument::createDocumentStructure()
187 { 187 {
188 RefPtr<Element> rootElement = Document::createElement(htmlTag, false); 188 RefPtr<Element> rootElement = Document::createElement(htmlTag, false);
189 appendChild(rootElement, IGNORE_EXCEPTION); 189 appendChild(rootElement, IGNORE_EXCEPTION);
190 static_cast<HTMLHtmlElement*>(rootElement.get())->insertedByParser(); 190 static_cast<HTMLHtmlElement*>(rootElement.get())->insertedByParser();
191 191
192 if (frame() && frame()->loader()) 192 if (frame() && frame()->loader())
193 frame()->loader()->dispatchDocumentElementAvailable(); 193 frame()->loader()->dispatchDocumentElementAvailable();
194 194
195 RefPtr<Element> head = document()->createElement(headTag, false);
196 rootElement->appendChild(head, IGNORE_EXCEPTION);
197
198 RefPtr<Element> meta = document()->createElement(metaTag, false);
199 meta->setAttribute(nameAttr, "viewport");
200 meta->setAttribute(contentAttr, "width=device-width");
201 head->appendChild(meta, IGNORE_EXCEPTION);
202
195 RefPtr<Element> body = Document::createElement(bodyTag, false); 203 RefPtr<Element> body = Document::createElement(bodyTag, false);
196 body->setAttribute(styleAttr, "margin: 0px;"); 204 body->setAttribute(styleAttr, "margin: 0px;");
197 205
198 rootElement->appendChild(body, IGNORE_EXCEPTION); 206 rootElement->appendChild(body, IGNORE_EXCEPTION);
199 207
200 RefPtr<ImageDocumentElement> imageElement = ImageDocumentElement::create(thi s); 208 RefPtr<ImageDocumentElement> imageElement = ImageDocumentElement::create(thi s);
201 209
202 imageElement->setAttribute(styleAttr, "-webkit-user-select: none"); 210 imageElement->setAttribute(styleAttr, "-webkit-user-select: none");
203 imageElement->setLoadManually(true); 211 imageElement->setLoadManually(true);
204 imageElement->setSrc(url().string()); 212 imageElement->setSrc(url().string());
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 void ImageDocumentElement::didMoveToNewDocument(Document* oldDocument) 406 void ImageDocumentElement::didMoveToNewDocument(Document* oldDocument)
399 { 407 {
400 if (m_imageDocument) { 408 if (m_imageDocument) {
401 m_imageDocument->disconnectImageElement(); 409 m_imageDocument->disconnectImageElement();
402 m_imageDocument = 0; 410 m_imageDocument = 0;
403 } 411 }
404 HTMLImageElement::didMoveToNewDocument(oldDocument); 412 HTMLImageElement::didMoveToNewDocument(oldDocument);
405 } 413 }
406 414
407 } 415 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/media/viewport-in-standalone-media-document-expected.txt ('k') | Source/core/html/MediaDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698