2011-02-14 Kenichi Ishibashi <bashi@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Feb 2011 13:13:49 +0000 (13:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Feb 2011 13:13:49 +0000 (13:13 +0000)
        Reviewed by Andreas Kling.

        css style="max-width:none" works wrong
        https://bugs.webkit.org/show_bug.cgi?id=53743

        Adds a test to ensure style 'max-width: none' works correctly.

        * fast/css/max-width-none-expected.txt: Added.
        * fast/css/max-width-none.html: Added.
2011-02-14  Kenichi Ishibashi  <bashi@chromium.org>

        Reviewed by Andreas Kling.

        css style="max-width:none" works wrong
        https://bugs.webkit.org/show_bug.cgi?id=53743

        Fix a bug that "max-width:none" works wrong.
        See also: http://trac.webkit.org/changeset/13462

        Test: fast/css/max-width-none.html

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::applyProperty): For max-width of none,
        set it to Length(undefinedLength, Fixed), which is the correct
        value.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@78469 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/max-width-none-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/max-width-none.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSStyleSelector.cpp

index a702fb5..ca9cd4c 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-14  Kenichi Ishibashi  <bashi@chromium.org>
+
+        Reviewed by Andreas Kling.
+
+        css style="max-width:none" works wrong
+        https://bugs.webkit.org/show_bug.cgi?id=53743
+
+        Adds a test to ensure style 'max-width: none' works correctly.
+
+        * fast/css/max-width-none-expected.txt: Added.
+        * fast/css/max-width-none.html: Added.
+
 2011-02-14  Pavel Feldman  <pfeldman@chromium.org>
 
         Not reviewed: follow up to r78460 with more expectation updates.
diff --git a/LayoutTests/fast/css/max-width-none-expected.txt b/LayoutTests/fast/css/max-width-none-expected.txt
new file mode 100644 (file)
index 0000000..ad74d6b
--- /dev/null
@@ -0,0 +1,3 @@
+'max-width: none' should have no effect because it is the initial state. The test succeeds if the following two blocks are rendered in the same way.
+
+PASS
diff --git a/LayoutTests/fast/css/max-width-none.html b/LayoutTests/fast/css/max-width-none.html
new file mode 100644 (file)
index 0000000..e7c47a1
--- /dev/null
@@ -0,0 +1,31 @@
+<html>
+  <script>
+    if (window.layoutTestController)
+        window.layoutTestController.dumpAsText();
+
+    function doTest() {
+        var box1 = document.getElementById('box1');
+        var box2 = document.getElementById('box2');
+        if (box1.clientWidth == box2.clientWidth)
+            document.body.innerHTML += 'PASS';
+        else
+            document.body.innerHTML += 'FAIL';
+    }
+  </script>
+<body onload="doTest()">
+<p>
+'max-width: none' should have no effect because it is the initial state. The test succeeds if the following two blocks are rendered in the same way.
+</p>
+
+<div style="width:400px; border: 3px solid red">
+  <div id="box1" style="width:800px; max-width:none; height:30px; border: 3px solid green">
+  </div>
+</div>
+
+<div style="width:400px; border: 3px solid red">
+  <div id="box2" style="width:800px; height:30px; border: 3px solid green">
+  </div>
+</div>
+
+</body>
+</html>
index f1a6e07..76992e7 100644 (file)
@@ -1,3 +1,20 @@
+2011-02-14  Kenichi Ishibashi  <bashi@chromium.org>
+
+        Reviewed by Andreas Kling.
+
+        css style="max-width:none" works wrong
+        https://bugs.webkit.org/show_bug.cgi?id=53743
+
+        Fix a bug that "max-width:none" works wrong.
+        See also: http://trac.webkit.org/changeset/13462
+
+        Test: fast/css/max-width-none.html
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty): For max-width of none,
+        set it to Length(undefinedLength, Fixed), which is the correct
+        value.
+
 2011-02-14  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Andreas Kling.
index fd8fabb..c506b3b 100644 (file)
@@ -4159,8 +4159,10 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
     // length, percent
     case CSSPropertyMaxWidth:
         // +none +inherit
-        if (primitiveValue && primitiveValue->getIdent() == CSSValueNone)
+        if (primitiveValue && primitiveValue->getIdent() == CSSValueNone) {
+            l = Length(undefinedLength, Fixed);
             apply = true;
+        }
     case CSSPropertyTop:
     case CSSPropertyLeft:
     case CSSPropertyRight: