Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(624)

Unified Diff: Source/core/dom/Document.cpp

Issue 19555002: Translate viewport related meta tags into @viewport descriptors as suggested by the CSS Device Adap… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index a5dddea9ff27a0d1ab8a4d19beb42ad0897e3fd2..46b6ec0fcb58529b52e0a50fa13bc7f840baedab 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -662,11 +662,9 @@ void Document::setDocType(PassRefPtr<DocumentType> docType)
// This should never be called more than once.
ASSERT(!m_docType || !docType);
m_docType = docType;
- if (m_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);
- }
+
// Doctype affects the interpretation of the stylesheets.
clearStyleResolver();
}
@@ -2039,6 +2037,11 @@ PassRefPtr<DocumentParser> Document::createParser()
return XMLDocumentParser::create(this, view());
}
+bool Document::isXHTMLMobileProfile() const
+{
+ return m_docType && m_docType->publicId().startsWith("-//WAPFORUM//DTD XHTML MOBILE 1.", /* caseSensitive */ false);
+}
+
bool Document::isFrameSet() const
{
if (!isHTMLDocument())
@@ -2841,76 +2844,6 @@ void Document::processHttpEquivXFrameOptions(const String& content)
}
}
-// Though isspace() considers \t and \v to be whitespace, Win IE doesn't.
-static bool isSeparator(UChar c)
-{
- return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '=' || c == ',' || c == '\0';
-}
-
-void Document::processArguments(const String& features, void* data, ArgumentsCallback callback)
-{
- // Tread lightly in this code -- it was specifically designed to mimic Win IE's parsing behavior.
- int keyBegin, keyEnd;
- int valueBegin, valueEnd;
-
- int i = 0;
- int length = features.length();
- String buffer = features.lower();
- while (i < length) {
- // skip to first non-separator, but don't skip past the end of the string
- while (isSeparator(buffer[i])) {
- if (i >= length)
- break;
- i++;
- }
- keyBegin = i;
-
- // skip to first separator
- while (!isSeparator(buffer[i]))
- i++;
- keyEnd = i;
-
- // skip to first '=', but don't skip past a ',' or the end of the string
- while (buffer[i] != '=') {
- if (buffer[i] == ',' || i >= length)
- break;
- i++;
- }
-
- // skip to first non-separator, but don't skip past a ',' or the end of the string
- while (isSeparator(buffer[i])) {
- if (buffer[i] == ',' || i >= length)
- break;
- i++;
- }
- valueBegin = i;
-
- // skip to first separator
- while (!isSeparator(buffer[i]))
- i++;
- valueEnd = i;
-
- ASSERT_WITH_SECURITY_IMPLICATION(i <= length);
-
- String keyString = buffer.substring(keyBegin, keyEnd - keyBegin);
- String valueString = buffer.substring(valueBegin, valueEnd - valueBegin);
- callback(keyString, valueString, this, data);
- }
-}
-
-void Document::processViewport(const String& features, ViewportArguments::Type origin)
-{
- ASSERT(!features.isNull());
-
- if (origin < m_viewportArguments.type)
- return;
-
- m_viewportArguments = ViewportArguments(origin);
- processArguments(features, (void*)&m_viewportArguments, &setViewportFeature);
-
- updateViewportArguments();
-}
-
void Document::updateViewportArguments()
{
if (page() && page()->mainFrame() == frame()) {

Powered by Google App Engine
This is Rietveld 408576698