diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-08-17 18:19:17 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-08-17 18:19:17 -0700 |
commit | 8bba87309bc6171f066820ce64c7e73b725a94e1 (patch) | |
tree | 5791b4da74b35aa42b1b9185325076450af7d479 /WebCore | |
parent | 9f2051acd1dd94e6621616a99c50c409c941ad56 (diff) | |
parent | 4604c0d13ca11ad633e6b3f7adb64c6ee886705d (diff) | |
download | external_webkit-8bba87309bc6171f066820ce64c7e73b725a94e1.zip external_webkit-8bba87309bc6171f066820ce64c7e73b725a94e1.tar.gz external_webkit-8bba87309bc6171f066820ce64c7e73b725a94e1.tar.bz2 |
Merge change 21618 into eclair
* changes:
Fix #2058833. For mobile sites, add "width=device-width" if viewport width is not defined as our default viewport width is 800px now.
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/html/HTMLBodyElement.cpp | 13 | ||||
-rw-r--r-- | WebCore/html/HTMLMetaElement.cpp | 8 |
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) |