summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2011-07-01 14:41:13 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-01 14:41:13 -0700
commitb18e666e226b16a009467f4c330cf66aa46f55d4 (patch)
tree9becd02fbfc2fc0c856839f40f0ee9ecafa0aa56 /Source/WebCore
parent7397f7999e73d1595f05a8477b786a61cc0ed028 (diff)
parent8db9f9e9e78973e25adf06722ce8f9126e92c60b (diff)
downloadexternal_webkit-b18e666e226b16a009467f4c330cf66aa46f55d4.zip
external_webkit-b18e666e226b16a009467f4c330cf66aa46f55d4.tar.gz
external_webkit-b18e666e226b16a009467f4c330cf66aa46f55d4.tar.bz2
Merge "Update viewport using webkit's way."
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/dom/Document.cpp16
-rw-r--r--Source/WebCore/dom/Document.h8
-rw-r--r--Source/WebCore/html/HTMLBodyElement.cpp8
-rw-r--r--Source/WebCore/html/HTMLMetaElement.cpp22
4 files changed, 8 insertions, 46 deletions
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 60d3af1..1ae3bae 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -695,10 +695,7 @@ void Document::setDocType(PassRefPtr<DocumentType> docType)
if (m_docType && !ownerElement()
&& m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", false)) {
// fit mobile sites directly in the screen
- if (Frame *f = frame())
- f->settings()->setMetadataSettings("width", "device-width");
- if (FrameView* frameView = view())
- PlatformBridge::updateViewport(frameView);
+ processViewport("width=device-width");
}
#endif
}
@@ -2614,14 +2611,6 @@ Node* Document::nodeWithAbsIndex(int absIndex)
return n;
}
-#ifdef ANDROID_META_SUPPORT
-void Document::processMetadataSettings(const String& content)
-{
- ASSERT(!content.isNull());
- processArguments(content, 0, 0);
-}
-#endif
-
void Document::processHttpEquiv(const String& equiv, const String& content)
{
ASSERT(!equiv.isNull() && !content.isNull());
@@ -2729,9 +2718,8 @@ void Document::processArguments(const String& features, void* data, ArgumentsCal
#ifdef ANDROID_META_SUPPORT
if (frame())
frame()->settings()->setMetadataSettings(keyString, valueString);
-#else
- callback(keyString, valueString, this, data);
#endif
+ callback(keyString, valueString, this, data);
}
}
diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h
index 5ab6d77..ca304c1 100644
--- a/Source/WebCore/dom/Document.h
+++ b/Source/WebCore/dom/Document.h
@@ -793,14 +793,6 @@ public:
void processHttpEquiv(const String& equiv, const String& content);
void processViewport(const String& features);
-#ifdef ANDROID_META_SUPPORT
- /**
- * Handles viewport like <meta name = "viewport" content = "width = device-width">
- * or format-detection like <meta name = "format-detection" content = "telephone=no">
- */
- void processMetadataSettings(const String& content);
-#endif
-
// Returns the owning element in the parent document.
// Returns 0 if this is the top level document.
HTMLFrameOwnerElement* ownerElement() const;
diff --git a/Source/WebCore/html/HTMLBodyElement.cpp b/Source/WebCore/html/HTMLBodyElement.cpp
index 9cf8730..0c93c95 100644
--- a/Source/WebCore/html/HTMLBodyElement.cpp
+++ b/Source/WebCore/html/HTMLBodyElement.cpp
@@ -206,13 +206,7 @@ void HTMLBodyElement::insertedIntoDocument()
if (settings->viewportWidth() == -1 && (host.startsWith("m.") || host.startsWith("mobile.")
|| host.startsWith("wap.") || host.contains(".m.") || host.contains(".mobile." || host.contains(".wap.")))) {
// 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)
- PlatformBridge::updateViewport(view);
- }
+ document()->processViewport("width=device-width");
}
}
#endif
diff --git a/Source/WebCore/html/HTMLMetaElement.cpp b/Source/WebCore/html/HTMLMetaElement.cpp
index d8d9fb3..493d4ac 100644
--- a/Source/WebCore/html/HTMLMetaElement.cpp
+++ b/Source/WebCore/html/HTMLMetaElement.cpp
@@ -75,30 +75,18 @@ void HTMLMetaElement::process()
{
if (!inDocument() || m_content.isNull())
return;
+ if (equalIgnoringCase(name(), "viewport"))
+ document()->processViewport(m_content);
#ifdef ANDROID_META_SUPPORT
// TODO: Evaluate whether to take upstreamed meta support
- bool updateViewport = false;
- if (equalIgnoringCase(name(), "viewport")) {
- document()->processMetadataSettings(m_content);
- updateViewport = true;
- } else if (equalIgnoringCase(name(), "format-detection"))
- document()->processMetadataSettings(m_content);
+ else if (equalIgnoringCase(name(), "format-detection"))
+ document()->processViewport(m_content);
else if (((equalIgnoringCase(name(), "HandheldFriendly") && equalIgnoringCase(m_content, "true")) || equalIgnoringCase(name(), "MobileOptimized"))
&& document()->settings()
&& document()->settings()->viewportWidth() == -1) {
// fit mobile sites directly in the screen
- document()->settings()->setMetadataSettings("width", "device-width");
- updateViewport = true;
+ document()->processViewport("width=device-width");
}
- // update the meta data if it is the top document
- if (updateViewport && !document()->ownerElement()) {
- FrameView* view = document()->view();
- if (view)
- PlatformBridge::updateViewport(view);
- }
-#else
- if (equalIgnoringCase(name(), "viewport"))
- document()->processViewport(m_content);
#endif
#if ENABLE(ANDROID_INSTALLABLE_WEB_APPS)