diff options
author | Andrei Popescu <andreip@google.com> | 2009-08-19 18:23:07 +0100 |
---|---|---|
committer | Andrei Popescu <andreip@google.com> | 2009-08-19 18:23:07 +0100 |
commit | cabf1bfc240bac8f24ff95e3bcc9d2d01d3b8a37 (patch) | |
tree | b87e7a4fafac15d2f51fee7db2547be38db7cf9c /WebCore | |
parent | 72f4ed34e756eaa90b94b74b7a6f43ec33310822 (diff) | |
parent | 1a2d2faa29b8d2ca981ec4f1ccc5d48d24e638cc (diff) | |
download | external_webkit-cabf1bfc240bac8f24ff95e3bcc9d2d01d3b8a37.zip external_webkit-cabf1bfc240bac8f24ff95e3bcc9d2d01d3b8a37.tar.gz external_webkit-cabf1bfc240bac8f24ff95e3bcc9d2d01d3b8a37.tar.bz2 |
Merge commit 'goog/master' into merge
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/html/HTMLBodyElement.cpp | 10 | ||||
-rw-r--r-- | WebCore/html/HTMLDocument.cpp | 4 | ||||
-rw-r--r-- | WebCore/html/HTMLMetaElement.cpp | 20 |
3 files changed, 30 insertions, 4 deletions
diff --git a/WebCore/html/HTMLBodyElement.cpp b/WebCore/html/HTMLBodyElement.cpp index be6663f..c8ae037 100644 --- a/WebCore/html/HTMLBodyElement.cpp +++ b/WebCore/html/HTMLBodyElement.cpp @@ -37,6 +37,7 @@ #ifdef ANDROID_META_SUPPORT #include "Settings.h" +#include "WebViewCore.h" #endif namespace WebCore { @@ -179,9 +180,16 @@ void HTMLBodyElement::insertedIntoDocument() 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."))) + || host.contains(".m.") || host.contains(".mobile."))) { // fit mobile sites directly in the screen settings->setMetadataSettings("width", "device-width"); + // update the meta data if it is the top document + if (!ownerElement) { + FrameView* view = document()->view(); + if (view) + android::WebViewCore::getWebViewCore(view)->updateViewport(); + } + } #endif // FIXME: This call to scheduleRelayout should not be needed here. diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp index 2457c4f..d60d3fa 100644 --- a/WebCore/html/HTMLDocument.cpp +++ b/WebCore/html/HTMLDocument.cpp @@ -78,6 +78,7 @@ #ifdef ANDROID_META_SUPPORT #include "FrameTree.h" #include "Settings.h" +#include "WebViewCore.h" #endif namespace WebCore { @@ -385,6 +386,9 @@ void HTMLDocument::determineParseMode() strstr(pubIDStr.data(), "-//wapforum//dtd xhtml mobile 1.") == pubIDStr.data()) { // fit mobile sites directly in the screen frame()->settings()->setMetadataSettings("width", "device-width"); + FrameView* frameView = view(); + if (frameView) + android::WebViewCore::getWebViewCore(frameView)->updateViewport(); } #endif // Look up the entry in our gperf-generated table. diff --git a/WebCore/html/HTMLMetaElement.cpp b/WebCore/html/HTMLMetaElement.cpp index 5d3e925..83e38fe 100644 --- a/WebCore/html/HTMLMetaElement.cpp +++ b/WebCore/html/HTMLMetaElement.cpp @@ -29,6 +29,7 @@ #ifdef ANDROID_META_SUPPORT #include "Settings.h" +#include "WebViewCore.h" #endif namespace WebCore { @@ -70,12 +71,25 @@ void HTMLMetaElement::process() #ifdef ANDROID_META_SUPPORT if (!inDocument() || m_content.isNull()) return; - if (equalIgnoringCase(name(), "viewport") || equalIgnoringCase(name(), "format-detection")) + bool updateViewport = false; + if (equalIgnoringCase(name(), "viewport")) { document()->processMetadataSettings(m_content); - else if (equalIgnoringCase(name(), "HandheldFriendly") && equalIgnoringCase(m_content, "true") - && document()->settings()->viewportWidth() == -1) + updateViewport = true; + } else if (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"); + updateViewport = true; + } + // update the meta data if it is the top document + if (updateViewport && !document()->ownerElement()) { + FrameView* view = document()->view(); + if (view) + android::WebViewCore::getWebViewCore(view)->updateViewport(); + } #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) |