[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:44:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 916900d185e1359281db35f6c4bf1927aad05bc4
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 5 17:50:27 2010 +0000

    2010-08-05  Kenneth Rohde Christiansen  <kenneth.christiansen at openbossa.org>
    
            Reviewed by Simon Hausmann.
    
            Make the viewport meta tag parser support the Android
            target-densitydpi extension.
            http://webkit.org/b/43492
    
            http://developer.android.com/reference/android/webkit/WebView.html
            Section 'Building web pages to support different screen densities'
    
            * dom/ViewportArguments.cpp:
            (WebCore::setViewportFeature):
            (WebCore::viewportErrorMessageTemplate):
            * dom/ViewportArguments.h:
            (WebCore::):
            (WebCore::ViewportArguments::ViewportArguments):
            (WebCore::ViewportArguments::hasCustomArgument):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64764 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2e8bdf2..ceb6d3b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-08-05  Kenneth Rohde Christiansen  <kenneth.christiansen at openbossa.org>
+
+        Reviewed by Simon Hausmann.
+
+        Make the viewport meta tag parser support the Android
+        target-densitydpi extension.
+        http://webkit.org/b/43492
+
+        http://developer.android.com/reference/android/webkit/WebView.html
+        Section 'Building web pages to support different screen densities'
+
+        * dom/ViewportArguments.cpp:
+        (WebCore::setViewportFeature):
+        (WebCore::viewportErrorMessageTemplate):
+        * dom/ViewportArguments.h:
+        (WebCore::):
+        (WebCore::ViewportArguments::ViewportArguments):
+        (WebCore::ViewportArguments::hasCustomArgument):
+
 2010-08-05  Jian Li  <jianli at chromium.org>
  
         Reviewed by David Levin.
diff --git a/WebCore/dom/ViewportArguments.cpp b/WebCore/dom/ViewportArguments.cpp
index c507032..9f831dd 100644
--- a/WebCore/dom/ViewportArguments.cpp
+++ b/WebCore/dom/ViewportArguments.cpp
@@ -53,6 +53,20 @@ void setViewportFeature(const String& keyString, const String& valueString, Docu
         didUseConstants = true;
         if (document->page())
             value = document->page()->chrome()->windowRect().height();
+    } else if (equalIgnoringCase(valueString, "device-dpi")) {
+        didUseConstants = true;
+        // Default of today is 160dpi, resulting in a scaleFactor of 1.0.
+        if (document->page())
+            value = 160 * document->page()->chrome()->scaleFactor();
+    } else if (equalIgnoringCase(valueString, "low-dpi")) {
+        didUseConstants = true;
+        value = 120;
+    } else if (equalIgnoringCase(valueString, "medium-dpi")) {
+        didUseConstants = true;
+        value = 160;
+    } else if (equalIgnoringCase(valueString, "high-dpi")) {
+        didUseConstants = true;
+        value = 240;
     } else if (equalIgnoringCase(valueString, "default")) // This allows us to distinguish the omission of a key from asking for the default value.
         value = -2;
     else if (valueString.length()) // listing a key with no value is shorthand for key=default
@@ -80,19 +94,23 @@ void setViewportFeature(const String& keyString, const String& valueString, Docu
             reportViewportWarning(document, DeviceWidthShouldBeUsedWarning, keyString);
         else if (document->page() && value == document->page()->chrome()->windowRect().height() && !didUseConstants)
             reportViewportWarning(document, DeviceHeightShouldBeUsedWarning, keyString);
-        
         arguments->height = value;
+    } else if (keyString == "target-densitydpi" || keyString == "target-densityDpi") {
+        if (!didUseConstants && (value < 70 || value > 400))
+            reportViewportWarning(document, TargetDensityDpiTooSmallOrLargeError, keyString);
+        arguments->targetDensityDpi = value;
     } else
         reportViewportWarning(document, UnrecognizedViewportArgumentError, keyString);
 }
 
 static const char* viewportErrorMessageTemplate(ViewportErrorCode errorCode)
 {
-    static const char* const errors[] = { 
+    static const char* const errors[] = {
         "Viewport width or height set to physical device width, try using \"device-width\" constant instead for future compatibility.",
         "Viewport height or height set to physical device height, try using \"device-height\" constant instead for future compatibility.",
         "Viewport argument \"%replacement\" not recognized. Content ignored.",
-        "Viewport maximum-scale cannot be larger than 10.0.  The maximum-scale will be set to 10.0."
+        "Viewport maximum-scale cannot be larger than 10.0.  The maximum-scale will be set to 10.0.",
+        "Viewport target-densitydpi has to take a number between 70 and 400 as a valid target dpi, try using \"device-dpi\", \"low-dpi\", \"medium-dpi\" or \"high-dpi\" instead for future compatibility."
     };
 
     return errors[errorCode];
diff --git a/WebCore/dom/ViewportArguments.h b/WebCore/dom/ViewportArguments.h
index 29eec8e..db90111 100644
--- a/WebCore/dom/ViewportArguments.h
+++ b/WebCore/dom/ViewportArguments.h
@@ -35,7 +35,8 @@ enum ViewportErrorCode {
     DeviceWidthShouldBeUsedWarning,
     DeviceHeightShouldBeUsedWarning,
     UnrecognizedViewportArgumentError,
-    MaximumScaleTooLargeError
+    MaximumScaleTooLargeError,
+    TargetDensityDpiTooSmallOrLargeError
 };
 
 struct ViewportArguments {
@@ -48,6 +49,7 @@ struct ViewportArguments {
         , maximumScale(ValueUndefined)
         , width(ValueUndefined)
         , height(ValueUndefined)
+        , targetDensityDpi(ValueUndefined)
         , userScalable(ValueUndefined)
     {
     }
@@ -57,12 +59,13 @@ struct ViewportArguments {
     float maximumScale;
     float width;
     float height;
+    float targetDensityDpi;
 
     float userScalable;
 
     bool hasCustomArgument() const
     {
-        return initialScale != ValueUndefined || minimumScale != ValueUndefined || maximumScale != ValueUndefined || width != ValueUndefined || height != ValueUndefined || userScalable != ValueUndefined;
+        return initialScale != ValueUndefined || minimumScale != ValueUndefined || maximumScale != ValueUndefined || width != ValueUndefined || height != ValueUndefined || userScalable != ValueUndefined || targetDensityDpi != ValueUndefined;
     }
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list