Commit c27d725c authored by abarth@webkit.org's avatar abarth@webkit.org

Remove support for target-densitydpi in the viewport meta tag

https://bugs.webkit.org/show_bug.cgi?id=88047

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

The target-densitydpi parameter was originally implemented on Android,
but it does not appear to be widely used and introduces significant
implementation complexity because it forces us to track three scale
factors (defaultDeviceScaleFactor, deviceScaleFactor, and
pageScaleFactor) rather than just two (deviceScaleFactor and
pageScaleFactor).

There don't appear to be many web sites that use target-densitydpi
because it is not supported on iOS.  There are also concerns from the
standards community about the design of the feature.  It seems our best
course of action is to remove target-densitydpi and address these use
cases via other mechanisms, such as responsive images and device units
in CSS because those approaches are likely to be implemented broadly.

* dom/ViewportArguments.cpp:
(WebCore::computeViewportAttributes):
(WebCore):
(WebCore::setViewportFeature):
(WebCore::viewportErrorMessageTemplate):
(WebCore::viewportErrorMessageLevel):
* dom/ViewportArguments.h:
(WebCore::ViewportArguments::ViewportArguments):
(ViewportArguments):
(WebCore::ViewportArguments::operator==):

Source/WebKit/blackberry:

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::recomputeVirtualViewportFromViewportArguments):
* Api/WebViewportArguments.cpp:
(BlackBerry::WebKit::WebViewportArguments::targetDensityDpi):
(BlackBerry::WebKit::WebViewportArguments::setTargetDensityDpi):
* Api/WebViewportArguments.h:

Source/WebKit/efl:

* ewk/ewk_view.cpp:
(_ewk_view_priv_new):

LayoutTests:

These tests are no longer needed because they're testing a feature we
no longer support.

* fast/viewport/viewport-133-expected.txt: Removed.
* fast/viewport/viewport-133.html: Removed.
* fast/viewport/viewport-92-expected.txt: Removed.
* fast/viewport/viewport-92.html: Removed.
* fast/viewport/viewport-93-expected.txt: Removed.
* fast/viewport/viewport-93.html: Removed.
* fast/viewport/viewport-94-expected.txt: Removed.
* fast/viewport/viewport-94.html: Removed.
* fast/viewport/viewport-95-expected.txt: Removed.
* fast/viewport/viewport-95.html: Removed.
* fast/viewport/viewport-96-expected.txt: Removed.
* fast/viewport/viewport-96.html: Removed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119527 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e7bee138
2012-06-05 Adam Barth <abarth@webkit.org>
Remove support for target-densitydpi in the viewport meta tag
https://bugs.webkit.org/show_bug.cgi?id=88047
Reviewed by Kenneth Rohde Christiansen.
These tests are no longer needed because they're testing a feature we
no longer support.
* fast/viewport/viewport-133-expected.txt: Removed.
* fast/viewport/viewport-133.html: Removed.
* fast/viewport/viewport-92-expected.txt: Removed.
* fast/viewport/viewport-92.html: Removed.
* fast/viewport/viewport-93-expected.txt: Removed.
* fast/viewport/viewport-93.html: Removed.
* fast/viewport/viewport-94-expected.txt: Removed.
* fast/viewport/viewport-94.html: Removed.
* fast/viewport/viewport-95-expected.txt: Removed.
* fast/viewport/viewport-95.html: Removed.
* fast/viewport/viewport-96-expected.txt: Removed.
* fast/viewport/viewport-96.html: Removed.
2012-06-05 Ryosuke Niwa <rniwa@webkit.org>
Fix Chromium test expectations.
......
viewport size 480x534 scale 1.000000 with limits [1.000000, 5.000000] and userScalable -1.000000
PASS window.devicePixelRatio is within 0.001 of 0.7083333134651184
<head>
<title>Check that device dimensions are not adapted due to the higher DPI.</title>
<meta name="viewport" content="width=device-width, target-densitydpi=high-dpi">
<script src="../../fast/js/resources/js-test-pre.js"></script>
<script>
function test() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.dumpConfigurationForViewport(240, 480, 564, 480, 534);
shouldBeCloseTo("window.devicePixelRatio", 0.7083333134651184, 0.001, false);
}
}
</script>
</head>
<body onload="test();">
viewport size 480x534 scale 1.000000 with limits [1.000000, 5.000000] and userScalable -1.000000
<head>
<title>Check that device dimensions are not adapted due to the higher DPI.</title>
<meta name="viewport" content="width=device-width, target-densitydpi=device-dpi">
<script>
function test() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.dumpConfigurationForViewport(240, 480, 564, 480, 534);
}
}
</script>
</head>
<body onload="test();">
viewport size 240x267 scale 1.000000 with limits [1.000000, 5.000000] and userScalable -1.000000
<head>
<title>Check that device dimensions are adapted due to the lower DPI.</title>
<meta name="viewport" content="width=device-width, target-densitydpi=low-dpi">
<script>
function test() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.dumpConfigurationForViewport(240, 480, 564, 480, 534);
}
}
</script>
</head>
<body onload="test();">
viewport size 320x356 scale 1.000000 with limits [1.000000, 5.000000] and userScalable -1.000000
<head>
<title>Check that device dimensions are not adapted due to using the DPI used to define a density-independent pixel.</title>
<meta name="viewport" content="width=device-width, target-densitydpi=medium-dpi">
<script>
function test() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.dumpConfigurationForViewport(240, 480, 564, 480, 534);
}
}
</script>
</head>
<body onload="test();">
viewport size 480x534 scale 1.000000 with limits [1.000000, 5.000000] and userScalable -1.000000
<head>
<title>Check that device dimensions are not adapted due to the higher DPI.</title>
<meta name="viewport" content="width=device-width, target-densitydpi=high-dpi">
<script>
function test() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.dumpConfigurationForViewport(240, 480, 564, 480, 534);
}
}
</script>
</head>
<body onload="test();">
viewport size 640x712 scale 1.000000 with limits [1.000000, 5.000000] and userScalable -1.000000
<head>
<title>Check that device dimensions are adapted due to the higher DPI.</title>
<meta name="viewport" content="width=device-width, target-densitydpi=320">
<script>
function test() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.dumpConfigurationForViewport(240, 480, 564, 480, 534);
}
}
</script>
</head>
<body onload="test();">
2012-06-05 Adam Barth <abarth@webkit.org>
Remove support for target-densitydpi in the viewport meta tag
https://bugs.webkit.org/show_bug.cgi?id=88047
Reviewed by Kenneth Rohde Christiansen.
The target-densitydpi parameter was originally implemented on Android,
but it does not appear to be widely used and introduces significant
implementation complexity because it forces us to track three scale
factors (defaultDeviceScaleFactor, deviceScaleFactor, and
pageScaleFactor) rather than just two (deviceScaleFactor and
pageScaleFactor).
There don't appear to be many web sites that use target-densitydpi
because it is not supported on iOS. There are also concerns from the
standards community about the design of the feature. It seems our best
course of action is to remove target-densitydpi and address these use
cases via other mechanisms, such as responsive images and device units
in CSS because those approaches are likely to be implemented broadly.
* dom/ViewportArguments.cpp:
(WebCore::computeViewportAttributes):
(WebCore):
(WebCore::setViewportFeature):
(WebCore::viewportErrorMessageTemplate):
(WebCore::viewportErrorMessageLevel):
* dom/ViewportArguments.h:
(WebCore::ViewportArguments::ViewportArguments):
(ViewportArguments):
(WebCore::ViewportArguments::operator==):
2012-06-05 Erik Arvidsson <arv@chromium.org>
[V8] Improve variable resolution order on window
......
......@@ -41,6 +41,10 @@ using namespace std;
namespace WebCore {
// FIXME: We shouldn't hardcode the targetDPI to 160.
// See https://bugs.webkit.org/show_bug.cgi?id=88114
static float targetDPI = 160;
ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, int deviceDPI, IntSize visibleViewport)
{
ViewportAttributes result;
......@@ -57,29 +61,11 @@ ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktop
autoDPI = deviceDPI;
break;
case ViewportArguments::ViewportMeta:
autoDPI = 160;
autoDPI = targetDPI;
break;
}
switch (int(args.targetDensityDpi)) {
case ViewportArguments::ValueDeviceDPI:
args.targetDensityDpi = deviceDPI;
break;
case ViewportArguments::ValueLowDPI:
args.targetDensityDpi = 120;
break;
case ViewportArguments::ValueAuto:
args.targetDensityDpi = autoDPI;
break;
case ViewportArguments::ValueMediumDPI:
args.targetDensityDpi = 160;
break;
case ViewportArguments::ValueHighDPI:
args.targetDensityDpi = 240;
break;
}
result.devicePixelRatio = float(deviceDPI / args.targetDensityDpi);
result.devicePixelRatio = deviceDPI / targetDPI;
// Resolve non-'auto' width and height to pixel values.
if (result.devicePixelRatio != 1.0) {
......@@ -315,30 +301,6 @@ static float findUserScalableValue(const String& keyString, const String& valueS
return 1;
}
static float findTargetDensityDPIValue(const String& keyString, const String& valueString, Document* document)
{
if (equalIgnoringCase(valueString, "device-dpi"))
return ViewportArguments::ValueDeviceDPI;
if (equalIgnoringCase(valueString, "low-dpi"))
return ViewportArguments::ValueLowDPI;
if (equalIgnoringCase(valueString, "medium-dpi"))
return ViewportArguments::ValueMediumDPI;
if (equalIgnoringCase(valueString, "high-dpi"))
return ViewportArguments::ValueHighDPI;
bool ok;
float value = numericPrefix(keyString, valueString, document, &ok);
if (!ok)
return ViewportArguments::ValueAuto;
if (value < 70 || value > 400) {
reportViewportWarning(document, TargetDensityDpiTooSmallOrLargeError, String(), String());
return ViewportArguments::ValueAuto;
}
return value;
}
void setViewportFeature(const String& keyString, const String& valueString, Document* document, void* data)
{
ViewportArguments* arguments = static_cast<ViewportArguments*>(data);
......@@ -356,7 +318,7 @@ void setViewportFeature(const String& keyString, const String& valueString, Docu
else if (keyString == "user-scalable")
arguments->userScalable = findUserScalableValue(keyString, valueString, document);
else if (keyString == "target-densitydpi")
arguments->targetDensityDpi = findTargetDensityDPIValue(keyString, valueString, document);
reportViewportWarning(document, TargetDensityDpiUnsupported, String(), String());
else
reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, keyString, String());
}
......@@ -368,7 +330,7 @@ static const char* viewportErrorMessageTemplate(ViewportErrorCode errorCode)
"Viewport argument value \"%replacement1\" for key \"%replacement2\" not recognized. Content ignored.",
"Viewport argument value \"%replacement1\" for key \"%replacement2\" was truncated to its numeric prefix.",
"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."
"Viewport target-densitydpi is not supported.",
};
return errors[errorCode];
......@@ -378,7 +340,7 @@ static MessageLevel viewportErrorMessageLevel(ViewportErrorCode errorCode)
{
switch (errorCode) {
case TruncatedViewportArgumentValueError:
case TargetDensityDpiTooSmallOrLargeError:
case TargetDensityDpiUnsupported:
return TipMessageLevel;
case UnrecognizedViewportArgumentKeyError:
case UnrecognizedViewportArgumentValueError:
......
......@@ -39,7 +39,7 @@ enum ViewportErrorCode {
UnrecognizedViewportArgumentValueError,
TruncatedViewportArgumentValueError,
MaximumScaleTooLargeError,
TargetDensityDpiTooSmallOrLargeError
TargetDensityDpiUnsupported
};
struct ViewportAttributes {
......@@ -85,7 +85,6 @@ struct ViewportArguments {
, maximumScale(ValueAuto)
, width(ValueAuto)
, height(ValueAuto)
, targetDensityDpi(ValueAuto)
, userScalable(ValueAuto)
{
}
......@@ -95,7 +94,6 @@ struct ViewportArguments {
float maximumScale;
float width;
float height;
float targetDensityDpi;
float userScalable;
bool operator==(const ViewportArguments& other) const
......@@ -107,7 +105,6 @@ struct ViewportArguments {
&& maximumScale == other.maximumScale
&& width == other.width
&& height == other.height
&& targetDensityDpi == other.targetDensityDpi
&& userScalable == other.userScalable;
}
};
......
......@@ -3382,14 +3382,6 @@ IntSize WebPagePrivate::recomputeVirtualViewportFromViewportArguments()
int deviceHeight = Platform::Graphics::Screen::primaryScreen()->height();
FloatSize currentPPI = Platform::Graphics::Screen::primaryScreen()->pixelsPerInch(-1);
int deviceDPI = int(roundf((currentPPI.width() + currentPPI.height()) / 2));
if (m_viewportArguments.targetDensityDpi == ViewportArguments::ValueAuto
&& !Platform::DeviceInfo::instance()->isMobile()) {
// If the content provider hasn't specified a target dpi and we have a large
// screen we assume the content is fine and set the targetDensityDpi to our dpi.
// On smaller screen mobile devices we skip this and use WebCore dpi scaling.
m_viewportArguments.targetDensityDpi = deviceDPI;
}
ViewportAttributes result = computeViewportAttributes(m_viewportArguments, desktopWidth, deviceWidth, deviceHeight, deviceDPI, m_defaultLayoutSize);
m_page->setDeviceScaleFactor(result.devicePixelRatio);
return IntSize(result.layoutSize.width(), result.layoutSize.height());
......
......@@ -87,12 +87,11 @@ void WebViewportArguments::setHeight(float height)
float WebViewportArguments::targetDensityDpi() const
{
return d->targetDensityDpi;
return 0;
}
void WebViewportArguments::setTargetDensityDpi(float dpi)
void WebViewportArguments::setTargetDensityDpi(float)
{
d->targetDensityDpi = dpi;
}
float WebViewportArguments::userScalable() const
......
......@@ -71,6 +71,7 @@ public:
float height() const;
void setHeight(float);
// FIXME: Can we remove these functions? WebKit no longer supports targetDensityDpi.
float targetDensityDpi() const;
void setTargetDensityDpi(float);
......
2012-06-05 Adam Barth <abarth@webkit.org>
Remove support for target-densitydpi in the viewport meta tag
https://bugs.webkit.org/show_bug.cgi?id=88047
Reviewed by Kenneth Rohde Christiansen.
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::recomputeVirtualViewportFromViewportArguments):
* Api/WebViewportArguments.cpp:
(BlackBerry::WebKit::WebViewportArguments::targetDensityDpi):
(BlackBerry::WebKit::WebViewportArguments::setTargetDensityDpi):
* Api/WebViewportArguments.h:
2012-06-05 Konrad Piascik <kpiascik@rim.com>
[BlackBerry]Web Inspector highlight is slow
......
2012-06-05 Adam Barth <abarth@webkit.org>
Remove support for target-densitydpi in the viewport meta tag
https://bugs.webkit.org/show_bug.cgi?id=88047
Reviewed by Kenneth Rohde Christiansen.
* ewk/ewk_view.cpp:
(_ewk_view_priv_new):
2012-06-05 Dongwoo Im <dw.im@samsung.com>
Add 'isProtocolHandlerRegistered' and 'unregisterProtocolHandler'.
......
......@@ -752,7 +752,6 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData)
priv->viewportArguments.initialScale = WebCore::ViewportArguments::ValueAuto;
priv->viewportArguments.minimumScale = WebCore::ViewportArguments::ValueAuto;
priv->viewportArguments.maximumScale = WebCore::ViewportArguments::ValueAuto;
priv->viewportArguments.targetDensityDpi = WebCore::ViewportArguments::ValueAuto;
priv->viewportArguments.userScalable = true;
priv->pageSettings->setLoadsImagesAutomatically(true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment