Bug 681443 - Fennec does not resize document properly in portrait mode; f=mbrubeck r=jst
authorOleg Romashin <romaxa@gmail.com>
Thu, 01 Sep 2011 22:16:13 +0100
changeset 77731 e6fc4594c22eff5fb29eaf616129f81b1022bbb4
parent 77730 9ef862cbcc5e8968887f67250dfbd8aa301c9a78
child 77732 4e76b1e5c1d1e28ee14779e8c3b32e9a1c7d4057
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs681443
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 681443 - Fennec does not resize document properly in portrait mode; f=mbrubeck r=jst
content/html/document/src/MediaDocument.cpp
--- a/content/html/document/src/MediaDocument.cpp
+++ b/content/html/document/src/MediaDocument.cpp
@@ -257,16 +257,35 @@ MediaDocument::CreateSyntheticDocument()
   NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
 
   // Create a <head> so our title has somewhere to live
   nsRefPtr<nsGenericHTMLElement> head = NS_NewHTMLHeadElement(nodeInfo.forget());
   if (!head) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
+  nsCOMPtr<nsINodeInfo> nodeInfoMeta;
+  nodeInfoMeta = mNodeInfoManager->GetNodeInfo(nsGkAtoms::meta, nsnull,
+                                               kNameSpaceID_XHTML,
+                                               nsIDOMNode::ELEMENT_NODE);
+  NS_ENSURE_TRUE(nodeInfoMeta, NS_ERROR_OUT_OF_MEMORY);
+
+  nsRefPtr<nsGenericHTMLElement> metaContent = NS_NewHTMLMetaElement(nodeInfoMeta.forget());
+  if (!metaContent) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+  metaContent->SetAttr(kNameSpaceID_None, nsGkAtoms::name,
+                       NS_LITERAL_STRING("viewport"),
+                       PR_TRUE);
+
+  metaContent->SetAttr(kNameSpaceID_None, nsGkAtoms::content,
+                       NS_LITERAL_STRING("width=device-width; height=device-height;"),
+                       PR_TRUE);
+  head->AppendChildTo(metaContent, PR_FALSE);
+
   root->AppendChildTo(head, PR_FALSE);
 
   nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::body, nsnull,
                                            kNameSpaceID_XHTML,
                                            nsIDOMNode::ELEMENT_NODE);
   NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
 
   nsRefPtr<nsGenericHTMLElement> body = NS_NewHTMLBodyElement(nodeInfo.forget());