Title: [196769] trunk
Revision
196769
Author
[email protected]
Date
2016-02-18 12:14:13 -0800 (Thu, 18 Feb 2016)

Log Message

Fix behavior of reflecting unsigned long IDL attributes that are limited to only non-negative numbers greater than zero
https://bugs.webkit.org/show_bug.cgi?id=154398

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

* web-platform-tests/html/dom/reflection-forms-expected.txt:
* web-platform-tests/html/dom/reflection-tabular-expected.txt:

Source/WebCore:

Fix behavior of reflecting unsigned long IDL attributes that are limited
to only non-negative numbers greater than zero to comply with:
- https://html.spec.whatwg.org/#limited-to-only-non-negative-numbers-greater-than-zero

This patch updates the following IDL attributes:
- colgroup.span
- col.span
- input.size
- textarea.cols
- textareal.rows

All of them now:
- Have "unsigned long" type on IDL size and "unsigned" type on native
  side.
- On getting, return the value if it is in the range [1; 2147483647],
  otherwise return the default value.
- On setting, set to the input value if it is in the range
  [1; 2147483647], otherwise, set to the default value.

Note that as per the specification, we are supposed to throw an
IndexSizeError exception when trying to set those attributes to zero.
However, we instead use the default value to match other browsers.
It would be risky to be the only browser to throw in this case.

No new tests, already covered by existing test.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):
(WebCore::HTMLInputElement::setSize):
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::parseAttribute):
(WebCore::HTMLTableColElement::setSpan):
* html/HTMLTableColElement.h:
* html/HTMLTableColElement.idl:
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::parseAttribute):
(WebCore::HTMLTextAreaElement::setCols):
(WebCore::HTMLTextAreaElement::setRows):
(WebCore::HTMLTextAreaElement::shouldUseInputMethod): Deleted.
* html/HTMLTextAreaElement.h:
* html/HTMLTextAreaElement.idl:
* html/parser/HTMLParserIdioms.h:
(WebCore::limitToOnlyNonNegativeNumbersGreaterThanZero):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (196768 => 196769)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-02-18 20:14:13 UTC (rev 196769)
@@ -1,3 +1,15 @@
+2016-02-18  Chris Dumez  <[email protected]>
+
+        Fix behavior of reflecting unsigned long IDL attributes that are limited to only non-negative numbers greater than zero
+        https://bugs.webkit.org/show_bug.cgi?id=154398
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline now that more checks are passing.
+
+        * web-platform-tests/html/dom/reflection-forms-expected.txt:
+        * web-platform-tests/html/dom/reflection-tabular-expected.txt:
+
 2016-02-17  Chris Dumez  <[email protected]>
 
         Regression(r196648): http://w3c-test.org/html/dom/interfaces.html redirects at the end of the test

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt (196768 => 196769)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt	2016-02-18 20:14:13 UTC (rev 196769)
@@ -6951,10 +6951,10 @@
 PASS input.size: IDL set to 2147483647 followed by getAttribute() 
 PASS input.size: IDL set to 2147483647 followed by IDL get 
 PASS input.size: IDL set to 2147483648 should not throw 
-FAIL input.size: IDL set to 2147483648 followed by getAttribute() assert_equals: expected "20" but got "2147483648"
+PASS input.size: IDL set to 2147483648 followed by getAttribute() 
 PASS input.size: IDL set to 2147483648 followed by IDL get 
 PASS input.size: IDL set to 4294967295 should not throw 
-FAIL input.size: IDL set to 4294967295 followed by getAttribute() assert_equals: expected "20" but got "4294967295"
+PASS input.size: IDL set to 4294967295 followed by getAttribute() 
 PASS input.size: IDL set to 4294967295 followed by IDL get 
 PASS input.src: typeof IDL attribute 
 PASS input.src: IDL get with DOM attribute unset 
@@ -14624,10 +14624,10 @@
 PASS textarea.cols: IDL set to 2147483647 followed by getAttribute() 
 PASS textarea.cols: IDL set to 2147483647 followed by IDL get 
 PASS textarea.cols: IDL set to 2147483648 should not throw 
-FAIL textarea.cols: IDL set to 2147483648 followed by getAttribute() assert_equals: expected "20" but got "-2147483648"
+PASS textarea.cols: IDL set to 2147483648 followed by getAttribute() 
 PASS textarea.cols: IDL set to 2147483648 followed by IDL get 
 PASS textarea.cols: IDL set to 4294967295 should not throw 
-FAIL textarea.cols: IDL set to 4294967295 followed by getAttribute() assert_equals: expected "20" but got "-1"
+PASS textarea.cols: IDL set to 4294967295 followed by getAttribute() 
 PASS textarea.cols: IDL set to 4294967295 followed by IDL get 
 PASS textarea.dirName: typeof IDL attribute 
 PASS textarea.dirName: IDL get with DOM attribute unset 
@@ -15683,10 +15683,10 @@
 PASS textarea.rows: IDL set to 2147483647 followed by getAttribute() 
 PASS textarea.rows: IDL set to 2147483647 followed by IDL get 
 PASS textarea.rows: IDL set to 2147483648 should not throw 
-FAIL textarea.rows: IDL set to 2147483648 followed by getAttribute() assert_equals: expected "2" but got "-2147483648"
+PASS textarea.rows: IDL set to 2147483648 followed by getAttribute() 
 PASS textarea.rows: IDL set to 2147483648 followed by IDL get 
 PASS textarea.rows: IDL set to 4294967295 should not throw 
-FAIL textarea.rows: IDL set to 4294967295 followed by getAttribute() assert_equals: expected "2" but got "-1"
+PASS textarea.rows: IDL set to 4294967295 followed by getAttribute() 
 PASS textarea.rows: IDL set to 4294967295 followed by IDL get 
 PASS textarea.wrap: typeof IDL attribute 
 PASS textarea.wrap: IDL get with DOM attribute unset 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-tabular-expected.txt (196768 => 196769)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-tabular-expected.txt	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-tabular-expected.txt	2016-02-18 20:14:13 UTC (rev 196769)
@@ -2974,11 +2974,11 @@
 PASS colgroup.span: setAttribute() to -2147483649 followed by getAttribute() 
 PASS colgroup.span: setAttribute() to -2147483649 followed by IDL get 
 PASS colgroup.span: setAttribute() to -2147483648 followed by getAttribute() 
-FAIL colgroup.span: setAttribute() to -2147483648 followed by IDL get assert_equals: expected 1 but got -2147483648
+PASS colgroup.span: setAttribute() to -2147483648 followed by IDL get 
 PASS colgroup.span: setAttribute() to -36 followed by getAttribute() 
-FAIL colgroup.span: setAttribute() to -36 followed by IDL get assert_equals: expected 1 but got -36
+PASS colgroup.span: setAttribute() to -36 followed by IDL get 
 PASS colgroup.span: setAttribute() to -1 followed by getAttribute() 
-FAIL colgroup.span: setAttribute() to -1 followed by IDL get assert_equals: expected 1 but got -1
+PASS colgroup.span: setAttribute() to -1 followed by IDL get 
 PASS colgroup.span: setAttribute() to 0 followed by getAttribute() 
 PASS colgroup.span: setAttribute() to 0 followed by IDL get 
 PASS colgroup.span: setAttribute() to 1 followed by getAttribute() 
@@ -2994,7 +2994,7 @@
 PASS colgroup.span: setAttribute() to "" followed by getAttribute() 
 PASS colgroup.span: setAttribute() to "" followed by IDL get 
 PASS colgroup.span: setAttribute() to "-1" followed by getAttribute() 
-FAIL colgroup.span: setAttribute() to "-1" followed by IDL get assert_equals: expected 1 but got -1
+PASS colgroup.span: setAttribute() to "-1" followed by IDL get 
 PASS colgroup.span: setAttribute() to "-0" followed by getAttribute() 
 PASS colgroup.span: setAttribute() to "-0" followed by IDL get 
 PASS colgroup.span: setAttribute() to "0" followed by getAttribute() 
@@ -3084,11 +3084,11 @@
 PASS colgroup.span: IDL set to 2147483647 followed by getAttribute() 
 PASS colgroup.span: IDL set to 2147483647 followed by IDL get 
 PASS colgroup.span: IDL set to 2147483648 should not throw 
-FAIL colgroup.span: IDL set to 2147483648 followed by getAttribute() assert_equals: expected "1" but got "-2147483648"
-FAIL colgroup.span: IDL set to 2147483648 followed by IDL get assert_equals: expected 1 but got -2147483648
+PASS colgroup.span: IDL set to 2147483648 followed by getAttribute() 
+PASS colgroup.span: IDL set to 2147483648 followed by IDL get 
 PASS colgroup.span: IDL set to 4294967295 should not throw 
-FAIL colgroup.span: IDL set to 4294967295 followed by getAttribute() assert_equals: expected "1" but got "-1"
-FAIL colgroup.span: IDL set to 4294967295 followed by IDL get assert_equals: expected 1 but got -1
+PASS colgroup.span: IDL set to 4294967295 followed by getAttribute() 
+PASS colgroup.span: IDL set to 4294967295 followed by IDL get 
 PASS colgroup.align: typeof IDL attribute 
 PASS colgroup.align: IDL get with DOM attribute unset 
 PASS colgroup.align: setAttribute() to "" followed by getAttribute() 
@@ -4241,11 +4241,11 @@
 PASS col.span: setAttribute() to -2147483649 followed by getAttribute() 
 PASS col.span: setAttribute() to -2147483649 followed by IDL get 
 PASS col.span: setAttribute() to -2147483648 followed by getAttribute() 
-FAIL col.span: setAttribute() to -2147483648 followed by IDL get assert_equals: expected 1 but got -2147483648
+PASS col.span: setAttribute() to -2147483648 followed by IDL get 
 PASS col.span: setAttribute() to -36 followed by getAttribute() 
-FAIL col.span: setAttribute() to -36 followed by IDL get assert_equals: expected 1 but got -36
+PASS col.span: setAttribute() to -36 followed by IDL get 
 PASS col.span: setAttribute() to -1 followed by getAttribute() 
-FAIL col.span: setAttribute() to -1 followed by IDL get assert_equals: expected 1 but got -1
+PASS col.span: setAttribute() to -1 followed by IDL get 
 PASS col.span: setAttribute() to 0 followed by getAttribute() 
 PASS col.span: setAttribute() to 0 followed by IDL get 
 PASS col.span: setAttribute() to 1 followed by getAttribute() 
@@ -4261,7 +4261,7 @@
 PASS col.span: setAttribute() to "" followed by getAttribute() 
 PASS col.span: setAttribute() to "" followed by IDL get 
 PASS col.span: setAttribute() to "-1" followed by getAttribute() 
-FAIL col.span: setAttribute() to "-1" followed by IDL get assert_equals: expected 1 but got -1
+PASS col.span: setAttribute() to "-1" followed by IDL get 
 PASS col.span: setAttribute() to "-0" followed by getAttribute() 
 PASS col.span: setAttribute() to "-0" followed by IDL get 
 PASS col.span: setAttribute() to "0" followed by getAttribute() 
@@ -4351,11 +4351,11 @@
 PASS col.span: IDL set to 2147483647 followed by getAttribute() 
 PASS col.span: IDL set to 2147483647 followed by IDL get 
 PASS col.span: IDL set to 2147483648 should not throw 
-FAIL col.span: IDL set to 2147483648 followed by getAttribute() assert_equals: expected "1" but got "-2147483648"
-FAIL col.span: IDL set to 2147483648 followed by IDL get assert_equals: expected 1 but got -2147483648
+PASS col.span: IDL set to 2147483648 followed by getAttribute() 
+PASS col.span: IDL set to 2147483648 followed by IDL get 
 PASS col.span: IDL set to 4294967295 should not throw 
-FAIL col.span: IDL set to 4294967295 followed by getAttribute() assert_equals: expected "1" but got "-1"
-FAIL col.span: IDL set to 4294967295 followed by IDL get assert_equals: expected 1 but got -1
+PASS col.span: IDL set to 4294967295 followed by getAttribute() 
+PASS col.span: IDL set to 4294967295 followed by IDL get 
 PASS col.align: typeof IDL attribute 
 PASS col.align: IDL get with DOM attribute unset 
 PASS col.align: setAttribute() to "" followed by getAttribute() 

Modified: trunk/Source/WebCore/ChangeLog (196768 => 196769)


--- trunk/Source/WebCore/ChangeLog	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/Source/WebCore/ChangeLog	2016-02-18 20:14:13 UTC (rev 196769)
@@ -1,3 +1,54 @@
+2016-02-18  Chris Dumez  <[email protected]>
+
+        Fix behavior of reflecting unsigned long IDL attributes that are limited to only non-negative numbers greater than zero
+        https://bugs.webkit.org/show_bug.cgi?id=154398
+
+        Reviewed by Ryosuke Niwa.
+
+        Fix behavior of reflecting unsigned long IDL attributes that are limited
+        to only non-negative numbers greater than zero to comply with:
+        - https://html.spec.whatwg.org/#limited-to-only-non-negative-numbers-greater-than-zero
+
+        This patch updates the following IDL attributes:
+        - colgroup.span
+        - col.span
+        - input.size
+        - textarea.cols
+        - textareal.rows
+
+        All of them now:
+        - Have "unsigned long" type on IDL size and "unsigned" type on native
+          side.
+        - On getting, return the value if it is in the range [1; 2147483647],
+          otherwise return the default value.
+        - On setting, set to the input value if it is in the range
+          [1; 2147483647], otherwise, set to the default value.
+
+        Note that as per the specification, we are supposed to throw an
+        IndexSizeError exception when trying to set those attributes to zero.
+        However, we instead use the default value to match other browsers.
+        It would be risky to be the only browser to throw in this case.
+
+        No new tests, already covered by existing test.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::parseAttribute):
+        (WebCore::HTMLInputElement::setSize):
+        * html/HTMLTableColElement.cpp:
+        (WebCore::HTMLTableColElement::parseAttribute):
+        (WebCore::HTMLTableColElement::setSpan):
+        * html/HTMLTableColElement.h:
+        * html/HTMLTableColElement.idl:
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::parseAttribute):
+        (WebCore::HTMLTextAreaElement::setCols):
+        (WebCore::HTMLTextAreaElement::setRows):
+        (WebCore::HTMLTextAreaElement::shouldUseInputMethod): Deleted.
+        * html/HTMLTextAreaElement.h:
+        * html/HTMLTextAreaElement.idl:
+        * html/parser/HTMLParserIdioms.h:
+        (WebCore::limitToOnlyNonNegativeNumbersGreaterThanZero):
+
 2016-02-18  David Kilzer  <[email protected]>
 
         Remove redundant ASSERT_WITH_MESSAGE_UNUSED() from SOFT_LINK_FRAMEWORK_FOR_SOURCE() macro

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (196768 => 196769)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2016-02-18 20:14:13 UTC (rev 196769)
@@ -685,8 +685,7 @@
         parseMaxLengthAttribute(value);
     else if (name == sizeAttr) {
         int oldSize = m_size;
-        int valueAsInteger = value.toInt();
-        m_size = valueAsInteger > 0 ? valueAsInteger : defaultSize;
+        m_size = limitToOnlyNonNegativeNumbersGreaterThanZero(value.string().toUInt(), defaultSize);
         if (m_size != oldSize && renderer())
             renderer()->setNeedsLayoutAndPrefWidthsRecalc();
     } else if (name == altAttr)
@@ -1275,7 +1274,7 @@
 
 void HTMLInputElement::setSize(unsigned size)
 {
-    setUnsignedIntegralAttribute(sizeAttr, size);
+    setUnsignedIntegralAttribute(sizeAttr, limitToOnlyNonNegativeNumbersGreaterThanZero(size, defaultSize));
 }
 
 void HTMLInputElement::setSize(unsigned size, ExceptionCode& ec)

Modified: trunk/Source/WebCore/html/HTMLTableColElement.cpp (196768 => 196769)


--- trunk/Source/WebCore/html/HTMLTableColElement.cpp	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/Source/WebCore/html/HTMLTableColElement.cpp	2016-02-18 20:14:13 UTC (rev 196769)
@@ -27,6 +27,7 @@
 
 #include "CSSPropertyNames.h"
 #include "HTMLNames.h"
+#include "HTMLParserIdioms.h"
 #include "HTMLTableElement.h"
 #include "RenderTableCol.h"
 #include "Text.h"
@@ -64,8 +65,7 @@
 void HTMLTableColElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (name == spanAttr) {
-        int newSpan = value.toInt();
-        m_span = newSpan ? newSpan : 1;
+        m_span = limitToOnlyNonNegativeNumbersGreaterThanZero(value.string().toUInt());
         if (is<RenderTableCol>(renderer()))
             downcast<RenderTableCol>(*renderer()).updateFromElement();
     } else if (name == widthAttr) {
@@ -90,9 +90,9 @@
     return nullptr;
 }
 
-void HTMLTableColElement::setSpan(int n)
+void HTMLTableColElement::setSpan(unsigned n)
 {
-    setIntegralAttribute(spanAttr, n);
+    setUnsignedIntegralAttribute(spanAttr, limitToOnlyNonNegativeNumbersGreaterThanZero(n));
 }
 
 String HTMLTableColElement::width() const

Modified: trunk/Source/WebCore/html/HTMLTableColElement.h (196768 => 196769)


--- trunk/Source/WebCore/html/HTMLTableColElement.h	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/Source/WebCore/html/HTMLTableColElement.h	2016-02-18 20:14:13 UTC (rev 196769)
@@ -34,8 +34,8 @@
 public:
     static Ref<HTMLTableColElement> create(const QualifiedName& tagName, Document&);
 
-    int span() const { return m_span; }
-    void setSpan(int);
+    unsigned span() const { return m_span; }
+    void setSpan(unsigned);
 
     String width() const;
 
@@ -47,7 +47,7 @@
     virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override;
     virtual const StyleProperties* additionalPresentationAttributeStyle() override;
 
-    int m_span;
+    unsigned m_span;
 };
 
 } //namespace

Modified: trunk/Source/WebCore/html/HTMLTableColElement.idl (196768 => 196769)


--- trunk/Source/WebCore/html/HTMLTableColElement.idl	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/Source/WebCore/html/HTMLTableColElement.idl	2016-02-18 20:14:13 UTC (rev 196769)
@@ -22,7 +22,11 @@
     [Reflect] attribute DOMString align;
     [Reflect=char] attribute DOMString ch;
     [Reflect=charoff] attribute DOMString chOff;
+#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
+    attribute unsigned long span;
+#else
     attribute long span;
+#endif
     [Reflect] attribute DOMString vAlign;
     [Reflect] attribute DOMString width;
 };

Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.cpp (196768 => 196769)


--- trunk/Source/WebCore/html/HTMLTextAreaElement.cpp	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.cpp	2016-02-18 20:14:13 UTC (rev 196769)
@@ -40,6 +40,7 @@
 #include "Frame.h"
 #include "FrameSelection.h"
 #include "HTMLNames.h"
+#include "HTMLParserIdioms.h"
 #include "LocalizedStrings.h"
 #include "RenderTextControlMultiLine.h"
 #include "ShadowRoot.h"
@@ -169,18 +170,14 @@
 void HTMLTextAreaElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (name == rowsAttr) {
-        int rows = value.toInt();
-        if (rows <= 0)
-            rows = defaultRows;
+        unsigned rows = limitToOnlyNonNegativeNumbersGreaterThanZero(value.string().toUInt(), defaultRows);
         if (m_rows != rows) {
             m_rows = rows;
             if (renderer())
                 renderer()->setNeedsLayoutAndPrefWidthsRecalc();
         }
     } else if (name == colsAttr) {
-        int cols = value.toInt();
-        if (cols <= 0)
-            cols = defaultCols;
+        unsigned cols = limitToOnlyNonNegativeNumbersGreaterThanZero(value.string().toUInt(), defaultCols);
         if (m_cols != cols) {
             m_cols = cols;
             if (renderer())
@@ -492,14 +489,14 @@
     focus();
 }
 
-void HTMLTextAreaElement::setCols(int cols)
+void HTMLTextAreaElement::setCols(unsigned cols)
 {
-    setIntegralAttribute(colsAttr, cols);
+    setUnsignedIntegralAttribute(colsAttr, limitToOnlyNonNegativeNumbersGreaterThanZero(cols, defaultCols));
 }
 
-void HTMLTextAreaElement::setRows(int rows)
+void HTMLTextAreaElement::setRows(unsigned rows)
 {
-    setIntegralAttribute(rowsAttr, rows);
+    setUnsignedIntegralAttribute(rowsAttr, limitToOnlyNonNegativeNumbersGreaterThanZero(rows, defaultRows));
 }
 
 bool HTMLTextAreaElement::shouldUseInputMethod()

Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.h (196768 => 196769)


--- trunk/Source/WebCore/html/HTMLTextAreaElement.h	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.h	2016-02-18 20:14:13 UTC (rev 196769)
@@ -35,8 +35,8 @@
 public:
     static Ref<HTMLTextAreaElement> create(const QualifiedName&, Document&, HTMLFormElement*);
 
-    int cols() const { return m_cols; }
-    int rows() const { return m_rows; }
+    unsigned cols() const { return m_cols; }
+    unsigned rows() const { return m_rows; }
 
     bool shouldWrapText() const { return m_wrap != NoWrap; }
 
@@ -57,8 +57,8 @@
 
     void rendererWillBeDestroyed();
 
-    void setCols(int);
-    void setRows(int);
+    void setCols(unsigned);
+    void setRows(unsigned);
 
     virtual bool willRespondToMouseClickEvents() override;
 
@@ -118,8 +118,8 @@
     bool valueMissing(const String& value) const { return isRequiredFormControl() && !isDisabledOrReadOnly() && value.isEmpty(); }
     bool tooLong(const String&, NeedsToCheckDirtyFlag) const;
 
-    int m_rows;
-    int m_cols;
+    unsigned m_rows;
+    unsigned m_cols;
     WrapMethod m_wrap;
     HTMLElement* m_placeholder;
     mutable String m_value;

Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.idl (196768 => 196769)


--- trunk/Source/WebCore/html/HTMLTextAreaElement.idl	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.idl	2016-02-18 20:14:13 UTC (rev 196769)
@@ -21,7 +21,6 @@
 
 interface HTMLTextAreaElement : HTMLElement {
     [Reflect] attribute boolean autofocus;
-    attribute long cols;
     [Reflect] attribute DOMString dirName;
     [Reflect] attribute boolean disabled;
     readonly attribute HTMLFormElement form;
@@ -30,7 +29,13 @@
     [Reflect] attribute DOMString placeholder;
     [Reflect] attribute boolean readOnly;
     [Reflect] attribute boolean required;
+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
     attribute long rows;
+    attribute long cols;
+#else
+    attribute unsigned long rows;
+    attribute unsigned long cols;
+#endif
     [Reflect] attribute DOMString wrap;
 
     readonly attribute DOMString type;

Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.h (196768 => 196769)


--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.h	2016-02-18 20:07:54 UTC (rev 196768)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.h	2016-02-18 20:14:13 UTC (rev 196769)
@@ -106,6 +106,12 @@
     return isHTMLSpace(character) && !isHTMLLineBreak(character);
 }
 
+// https://html.spec.whatwg.org/multipage/infrastructure.html#limited-to-only-non-negative-numbers-greater-than-zero
+inline unsigned limitToOnlyNonNegativeNumbersGreaterThanZero(unsigned value, unsigned defaultValue = 1)
+{
+    return (value > 0 && value <= 2147483647) ? value : defaultValue;
 }
 
+}
+
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to