diff options
author | Shimeng (Simon) Wang <swang@google.com> | 2011-07-01 11:02:59 -0700 |
---|---|---|
committer | Shimeng (Simon) Wang <swang@google.com> | 2011-07-01 11:14:47 -0700 |
commit | 8db9f9e9e78973e25adf06722ce8f9126e92c60b (patch) | |
tree | b6d6349c5385749c7e37c07dcfb879ccf9506cfd /Source/WebCore/html | |
parent | c19571f3ec3bec025fa05e8d81ffd1998324e844 (diff) | |
download | external_webkit-8db9f9e9e78973e25adf06722ce8f9126e92c60b.zip external_webkit-8db9f9e9e78973e25adf06722ce8f9126e92c60b.tar.gz external_webkit-8db9f9e9e78973e25adf06722ce8f9126e92c60b.tar.bz2 |
Update viewport using webkit's way.
The Android's customized way of parsing viewport meta tags is kept intact;
while the viewport update notification mechanism is changed to use webkit's
way. This gives much better notification of viewport switching.
issue: 4975315
Change-Id: I7896b67d684efec015245ee804a9243e72ff0b50
Diffstat (limited to 'Source/WebCore/html')
-rw-r--r-- | Source/WebCore/html/HTMLBodyElement.cpp | 8 | ||||
-rw-r--r-- | Source/WebCore/html/HTMLMetaElement.cpp | 22 |
2 files changed, 6 insertions, 24 deletions
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) |