Skip to content

Commit

Permalink
2008-08-21 Chris Marrin <cmarrin@apple.com>
Browse files Browse the repository at this point in the history
        Allow 0 (without units) for Time eg. duration
        Fix for https://bugs.webkit.org/show_bug.cgi?id=20467

        Reviewed by Dave Hyatt.

        Test: css1/units/zero-duration-without-units.html

        * css/CSSParser.cpp:
        (WebCore::CSSParser::validUnit):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@35879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
dino@apple.com committed Aug 21, 2008
1 parent ca11cd8 commit aa75e4c
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 2 deletions.
10 changes: 10 additions & 0 deletions LayoutTests/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2008-08-21 Chris Marrin <cmarrin@apple.com>

Allow 0 (without units) for Time eg. duration
Fix for https://bugs.webkit.org/show_bug.cgi?id=20467

Reviewed by Dave Hyatt.

* css1/units/zero-duration-without-units-expected.txt: Added.
* css1/units/zero-duration-without-units.html: Added.

2008-08-20 Simon Fraser <simon.fraser@apple.com>

Reviewed by Dave Hyatt
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Box should start moving left after left style is reset after 500ms

PASS
44 changes: 44 additions & 0 deletions LayoutTests/css1/units/zero-duration-without-units.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Zero Duration Without Units</title>
<style type="text/css" media="screen">
#box {
height: 100px;
width: 100px;
background-color: blue;
-webkit-transition-property: top, left;
-webkit-transition-duration: 1s;
-webkit-transition-duration: 0;
-webkit-transition-timing-function: linear;
}
</style>
<script type="text/javascript" charset="utf-8">
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}

function test()
{
var box = document.getElementById('box');
var dur = parseInt(window.getComputedStyle(box).webkitTransitionDuration);
document.getElementById('result').innerHTML = (dur == 0) ? "PASS" : "FAIL";
if (window.layoutTestController)
layoutTestController.notifyDone();
}
window.addEventListener('load', test, false)
</script>
</head>
<body>

<p>Box should start moving left after left style is reset after 500ms</p>
<div id="box">
</div>
<div id="result">
</div>
</body>
</html>
12 changes: 12 additions & 0 deletions WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2008-08-21 Chris Marrin <cmarrin@apple.com>

Allow 0 (without units) for Time eg. duration
Fix for https://bugs.webkit.org/show_bug.cgi?id=20467

Reviewed by Dave Hyatt.

Test: css1/units/zero-duration-without-units.html

* css/CSSParser.cpp:
(WebCore::CSSParser::validUnit):

2008-08-21 Timothy Hatcher <timothy@apple.com>

Make deleting all text while editing a DOM attribute in
Expand Down
5 changes: 3 additions & 2 deletions WebCore/css/CSSParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,9 @@ bool CSSParser::validUnit(CSSParserValue* value, Units unitflags, bool strict)
switch(value->unit) {
case CSSPrimitiveValue::CSS_NUMBER:
b = (unitflags & FNumber);
if (!b && ((unitflags & (FLength | FAngle)) && (value->fValue == 0 || !strict))) {
value->unit = (unitflags & FLength) ? CSSPrimitiveValue::CSS_PX : CSSPrimitiveValue::CSS_DEG;
if (!b && ((unitflags & (FLength | FAngle | FTime)) && (value->fValue == 0 || !strict))) {
value->unit = (unitflags & FLength) ? CSSPrimitiveValue::CSS_PX :
((unitflags & FAngle) ? CSSPrimitiveValue::CSS_DEG : CSSPrimitiveValue::CSS_S);
b = true;
}
if (!b && (unitflags & FInteger) && value->isInt)
Expand Down

0 comments on commit aa75e4c

Please sign in to comment.