diff options
author | Grace Kloba <klobag@google.com> | 2009-08-18 10:08:49 -0700 |
---|---|---|
committer | Grace Kloba <klobag@google.com> | 2009-08-18 10:08:49 -0700 |
commit | 29efdb685ae2c3da761273415d2f7df07852e463 (patch) | |
tree | 435fb663ceb32a3f37a4e6d59bc762d4ca32f914 /WebCore/html | |
parent | 8bba87309bc6171f066820ce64c7e73b725a94e1 (diff) | |
download | external_webkit-29efdb685ae2c3da761273415d2f7df07852e463.zip external_webkit-29efdb685ae2c3da761273415d2f7df07852e463.tar.gz external_webkit-29efdb685ae2c3da761273415d2f7df07852e463.tar.bz2 |
Need to notify Java side when viewport tag is parsed.
Diffstat (limited to 'WebCore/html')
-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 9852858..119a06a 100644 --- a/WebCore/html/HTMLBodyElement.cpp +++ b/WebCore/html/HTMLBodyElement.cpp @@ -41,6 +41,7 @@ #ifdef ANDROID_META_SUPPORT #include "Settings.h" +#include "WebViewCore.h" #endif namespace WebCore { @@ -181,9 +182,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 01f151c..778c5ae 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 { @@ -399,6 +400,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) |