Commit e4e7ab94 authored by eae@chromium.org's avatar eae@chromium.org
Browse files

snapToSize rounds the incorrectly for negative locations

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

Reviewed by Eric Seidel.

Source/WebCore: 

Change snapSizeToPixel to preserve sign for location which
affects rounding.

Test: fast/sub-pixel/snap-negative-location.html

* platform/FractionalLayoutUnit.h:
(WebCore::snapSizeToPixel):

LayoutTests: 

Add test for snapSizeToPixel handling of negative locations.
Skipped on platforms that do not enable subpixel layout.

* fast/sub-pixel/snap-negative-location-expected.html: Added.
* fast/sub-pixel/snap-negative-location.html: Added.
* platform/mac-lion/Skipped:
* platform/mac-snowleopard/Skipped:
* platform/mac-wk2/Skipped:
* platform/mac/Skipped:
* platform/qt-4.8/Skipped:
* platform/qt/Skipped:
* platform/win-wk2/Skipped:
* platform/win-xp/Skipped:
* platform/win/Skipped:
* platform/wincairo/Skipped:
* platform/wk2/Skipped:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 76701750
2012-09-20 Emil A Eklund <eae@chromium.org>
snapToSize rounds the incorrectly for negative locations
https://bugs.webkit.org/show_bug.cgi?id=97265
Reviewed by Eric Seidel.
Add test for snapSizeToPixel handling of negative locations.
Skipped on platforms that do not enable subpixel layout.
* fast/sub-pixel/snap-negative-location-expected.html: Added.
* fast/sub-pixel/snap-negative-location.html: Added.
* platform/mac-lion/Skipped:
* platform/mac-snowleopard/Skipped:
* platform/mac-wk2/Skipped:
* platform/mac/Skipped:
* platform/qt-4.8/Skipped:
* platform/qt/Skipped:
* platform/win-wk2/Skipped:
* platform/win-xp/Skipped:
* platform/win/Skipped:
* platform/wincairo/Skipped:
* platform/wk2/Skipped:
2012-09-24 Zan Dobersek <zandobersek@gmail.com>
 
REGRESSION (r129211-r129218): http/tests/loading/redirect-with-no-location-crash.html failing on GTK Linux 64-bit Release WK2 (Tests)
<!DOCTYPE html>
<html>
<body>
<div style="position: absolute; top: -4.5px; left: -4.5px; width: 50px; height: 50px; background: navy;">&nbsp;</div>
<p style="position: absolute; top: 50px;">
Figure above should appear as a solid dark blue square.
</p>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<div style="position: absolute; top: -4.5px; left: -4.5px; width: 25px; height: 25px; background: navy;">&nbsp;</div>
<div style="position: absolute; top: -4.5px; left: 20.5px; width: 25px; height: 25px; background: navy;">&nbsp;</div>
<div style="position: absolute; top: 20.5px; left: -4.5px; width: 25px; height: 25px; background: navy;">&nbsp;</div>
<div style="position: absolute; top: 20.5px; left: 20.5px; width: 25px; height: 25px; background: navy;">&nbsp;</div>
<p style="position: absolute; top: 50px;">
Figure above should appear as a solid dark blue square.
</p>
</body>
</html>
......@@ -119,6 +119,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# This media test always failed on Lion
# https://bugs.webkit.org/show_bug.cgi?id=86527 and <rdar://problem/11458493>
......@@ -136,4 +137,4 @@ inspector/profiler/heap-snapshot-containment-show-all.html
inspector/debugger/debugger-expand-scope.html
# Lion does not support web notifications
http/tests/notifications
\ No newline at end of file
http/tests/notifications
......@@ -213,6 +213,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# Frame::findString does nothing on pages that prevent selection
# https://bugs.webkit.org/show_bug.cgi?id=40361
......
......@@ -216,6 +216,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# fast/events/pagehide-timeout.html, pageshow-pagehide-on-back-cached-with-frames.html, and
# pageshow-pagehide-on-back-cached.html flakey on Lion Intel Debug WebKit testers.
......
......@@ -726,6 +726,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# No CORS support for media elements is implemented yet.
http/tests/security/video-cross-origin-readback.html
......
......@@ -106,6 +106,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# SVG Fonts are only supported when using QRawFont, which is not
# supported with Qt 4.
......
......@@ -312,6 +312,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# USE(V8)
......
......@@ -950,6 +950,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# HiDPI tests require test infrastructure enhancements
fast/hidpi
......
......@@ -49,6 +49,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# REGRESSION (r83928 or before): Some tests failing assertions in MarkStack::internalAppend / MarkStack::drain
# https://bugs.webkit.org/show_bug.cgi?id=58657
......
......@@ -1752,6 +1752,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# No CORS support for media elements is implemented yet.
http/tests/security/video-cross-origin-readback.html
......
......@@ -2283,6 +2283,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# No CORS support for media elements is implemented yet.
http/tests/security/video-cross-origin-readback.html
......
......@@ -98,6 +98,7 @@ fast/sub-pixel/size-of-box-with-zoom.html
fast/sub-pixel/table-rows-no-gaps.html
fast/sub-pixel/sub-pixel-accumulates-to-layers.html
fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
fast/sub-pixel/snap-negative-location.html
# [WK2][WTR] svg/animations/animate-text-nested-transforms.html fails
# https://bugs.webkit.org/show_bug.cgi?id=95191
......
2012-09-20 Emil A Eklund <eae@chromium.org>
snapToSize rounds the incorrectly for negative locations
https://bugs.webkit.org/show_bug.cgi?id=97265
Reviewed by Eric Seidel.
Change snapSizeToPixel to preserve sign for location which
affects rounding.
Test: fast/sub-pixel/snap-negative-location.html
* platform/FractionalLayoutUnit.h:
(WebCore::snapSizeToPixel):
2012-09-24 Jonathan Liu <net147@gmail.com>
 
Use unsigned char for bitfield instead of unsigned.
......@@ -227,6 +227,15 @@ public:
#endif
}
FractionalLayoutUnit fraction() const
{
// Add the fraction to the size (as opposed to the full location) to avoid overflows.
// Compute fraction using the mod operator to preserve the sign of the value as it may affect rounding.
FractionalLayoutUnit fraction;
fraction.setRawValue(rawValue() % kFixedPointDenominator);
return fraction;
}
#if ENABLE(SUBPIXEL_LAYOUT)
static float epsilon() { return 1.0f / kFixedPointDenominator; }
#else
......@@ -807,7 +816,7 @@ inline float& operator/=(float& a, const FractionalLayoutUnit& b)
inline int snapSizeToPixel(FractionalLayoutUnit size, FractionalLayoutUnit location)
{
FractionalLayoutUnit fraction = location - location.floor();
FractionalLayoutUnit fraction = location.fraction();
return (fraction + size).round() - fraction.round();
}
......
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