summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2009-08-17 23:32:07 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-08-17 23:32:07 -0700
commit0570b7719b3def45104c8615a2c88f07ebe4c4c4 (patch)
tree5791b4da74b35aa42b1b9185325076450af7d479
parentf23a68c9f05539aa55ac04960b07aca17bf73f97 (diff)
parentb9b66602e5b40cfd3dfac9a0b1c47fb1a0cfc7c6 (diff)
downloadexternal_webkit-0570b7719b3def45104c8615a2c88f07ebe4c4c4.zip
external_webkit-0570b7719b3def45104c8615a2c88f07ebe4c4c4.tar.gz
external_webkit-0570b7719b3def45104c8615a2c88f07ebe4c4c4.tar.bz2
am b9b66602: am 8bba8730: Merge change 21618 into eclair
Merge commit 'b9b66602e5b40cfd3dfac9a0b1c47fb1a0cfc7c6' * commit 'b9b66602e5b40cfd3dfac9a0b1c47fb1a0cfc7c6': Fix #2058833. For mobile sites, add "width=device-width" if viewport width
-rw-r--r--WebCore/html/HTMLBodyElement.cpp13
-rw-r--r--WebCore/html/HTMLMetaElement.cpp8
2 files changed, 21 insertions, 0 deletions
diff --git a/WebCore/html/HTMLBodyElement.cpp b/WebCore/html/HTMLBodyElement.cpp
index 9828dab..9852858 100644
--- a/WebCore/html/HTMLBodyElement.cpp
+++ b/WebCore/html/HTMLBodyElement.cpp
@@ -39,6 +39,10 @@
#include "MappedAttribute.h"
#include "ScriptEventListener.h"
+#ifdef ANDROID_META_SUPPORT
+#include "Settings.h"
+#endif
+
namespace WebCore {
using namespace HTMLNames;
@@ -173,6 +177,15 @@ void HTMLBodyElement::insertedIntoDocument()
setAttribute(marginheightAttr, String::number(marginHeight));
}
+#ifdef ANDROID_META_SUPPORT
+ Settings * settings = document()->settings();
+ String host = document()->baseURI().host().lower();
+ if (settings->viewportWidth() == -1 && (host.startsWith("m.") || host.startsWith("mobile.")
+ || host.contains(".m.") || host.contains(".mobile.")))
+ // fit mobile sites directly in the screen
+ settings->setMetadataSettings("width", "device-width");
+#endif
+
// FIXME: This call to scheduleRelayout should not be needed here.
// But without it we hang during WebKit tests; need to fix that and remove this.
if (FrameView* view = document()->view())
diff --git a/WebCore/html/HTMLMetaElement.cpp b/WebCore/html/HTMLMetaElement.cpp
index 48284e3..5d3e925 100644
--- a/WebCore/html/HTMLMetaElement.cpp
+++ b/WebCore/html/HTMLMetaElement.cpp
@@ -27,6 +27,10 @@
#include "HTMLNames.h"
#include "MappedAttribute.h"
+#ifdef ANDROID_META_SUPPORT
+#include "Settings.h"
+#endif
+
namespace WebCore {
using namespace HTMLNames;
@@ -68,6 +72,10 @@ void HTMLMetaElement::process()
return;
if (equalIgnoringCase(name(), "viewport") || equalIgnoringCase(name(), "format-detection"))
document()->processMetadataSettings(m_content);
+ else if (equalIgnoringCase(name(), "HandheldFriendly") && equalIgnoringCase(m_content, "true")
+ && document()->settings()->viewportWidth() == -1)
+ // fit mobile sites directly in the screen
+ document()->settings()->setMetadataSettings("width", "device-width");
#endif
// Get the document to process the tag, but only if we're actually part of DOM tree (changing a meta tag while
// it's not in the tree shouldn't have any effect on the document)