Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index fff83670193ce1dd38bab7914952d24d3abe66c2..9bc2d02ad567c8bc541f1b10a4a8bbfd4adea2fa 100644 |
| --- a/Source/core/dom/Document.cpp |
| +++ b/Source/core/dom/Document.cpp |
| @@ -43,6 +43,7 @@ |
| #include "bindings/v8/ScriptController.h" |
| #include "core/accessibility/AXObjectCache.h" |
| #include "core/animation/DocumentTimeline.h" |
| +#include "core/css/CSSDefaultStyleSheets.h" |
| #include "core/css/CSSStyleDeclaration.h" |
| #include "core/css/CSSStyleSheet.h" |
| #include "core/css/FontLoader.h" |
| @@ -428,6 +429,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC |
| , m_isViewSource(false) |
| , m_sawElementsInKnownNamespaces(false) |
| , m_isSrcdocDocument(false) |
| + , m_isMobileDocument(false) |
| , m_renderer(0) |
| , m_eventQueue(DocumentEventQueue::create(this)) |
| , m_weakFactory(this) |
| @@ -668,7 +670,7 @@ void Document::setDoctype(PassRefPtr<DocumentType> docType) |
| if (m_docType) { |
| this->adoptIfNeeded(m_docType.get()); |
| if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", /* caseSensitive */ false)) |
| - processViewport("width=device-width, height=device-height", ViewportArguments::XHTMLMobileProfile); |
| + m_isMobileDocument = true; |
| } |
| // Doctype affects the interpretation of the stylesheets. |
| clearStyleResolver(); |
| @@ -2923,13 +2925,34 @@ void Document::processViewport(const String& features, ViewportArguments::Type o |
| { |
| ASSERT(!features.isNull()); |
| - if (origin < m_viewportArguments.type) |
| + if (origin < m_legacyViewportArguments.type) |
|
kenneth.r.christiansen
2013/09/02 09:14:16
I guess this needs a comment
rune
2013/09/02 11:53:39
Done.
|
| return; |
| - m_viewportArguments = ViewportArguments(origin); |
| - processArguments(features, (void*)&m_viewportArguments, &setViewportFeature); |
| + m_legacyViewportArguments = ViewportArguments(origin); |
| - updateViewportArguments(); |
| + processArguments(features, (void*)&m_legacyViewportArguments, &setViewportFeature); |
| + |
| + if (m_legacyViewportArguments.minZoom == ViewportArguments::ValueAuto) |
| + m_legacyViewportArguments.minZoom = 0.25; |
| + |
| + if (m_legacyViewportArguments.maxZoom == ViewportArguments::ValueAuto) { |
| + m_legacyViewportArguments.maxZoom = 5; |
| + if (m_legacyViewportArguments.minZoom > 5) |
| + m_legacyViewportArguments.minZoom = 5; |
| + } |
| + |
| + if (m_legacyViewportArguments.maxWidth == ViewportArguments::ValueAuto) { |
| + |
| + if (m_legacyViewportArguments.zoom == ViewportArguments::ValueAuto) { |
| + m_legacyViewportArguments.minWidth = ViewportArguments::ValueExtendToZoom; |
| + m_legacyViewportArguments.maxWidth = page()->settings().layoutFallbackWidth(); |
| + } else if (m_legacyViewportArguments.maxHeight == ViewportArguments::ValueAuto) { |
| + m_legacyViewportArguments.minWidth = m_legacyViewportArguments.maxWidth = ViewportArguments::ValueExtendToZoom; |
| + } |
| + } |
| + |
| + if (m_viewportArguments.type != ViewportArguments::CSSDeviceAdaptation) |
| + useLegacyViewportArguments(); |
| } |
| void Document::updateViewportArguments() |