Skip to content

Commit

Permalink
Merge DOMSettableTokensList into DOMTokensList
Browse files Browse the repository at this point in the history
This CL tackles the merging of the two token lists, in order to simplify both implementation and spec.

I2InS: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/sXT-rWAd0kk

BUG=584612

Review URL: https://codereview.chromium.org/1629403003

Cr-Commit-Position: refs/heads/master@{#375574}
  • Loading branch information
yoavweiss authored and Commit bot committed Feb 16, 2016
1 parent f3316a4 commit 2ca6e94
Show file tree
Hide file tree
Showing 37 changed files with 127 additions and 313 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ PASS element.htmlFor.length is 2
PASS element.htmlFor.length is 2
PASS element.htmlFor.length is 2
PASS element.htmlFor.length is 2
- DOMSettableTokenList presence and type
PASS 'undefined' != typeof DOMSettableTokenList is true
PASS typeof DOMSettableTokenList.prototype is "object"
- DOMTokenList presence and type
PASS 'undefined' != typeof DOMTokenList is true
PASS typeof DOMTokenList.prototype is "object"
PASS typeof element.htmlFor is "object"
PASS element.htmlFor.constructor is DOMSettableTokenList
PASS element.htmlFor.constructor is DOMTokenList
PASS element.htmlFor === element.htmlFor is true
PASS successfullyParsed is true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script src="script-tests/dom-settable-token-list.js"></script>
<script src="script-tests/dom-token-list.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function createElement(tokenList)

debug('- Tests from http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/');

// HTMLOutputElement::htmlFor setter is forwarding assignment to DOMSettableTokenList.value attribute.
// HTMLOutputElement::htmlFor setter is forwarding assignment to DOMTokenList.value attribute.
createElement('x');
shouldBeEqualToString('element.htmlFor.value', 'x');
shouldBeEqualToString('String(element.htmlFor)', 'x');
Expand Down Expand Up @@ -235,21 +235,21 @@ createElement('x\u000Dy');
shouldEvaluateTo('element.htmlFor.length', 2);


debug('- DOMSettableTokenList presence and type');
debug('- DOMTokenList presence and type');


// Safari returns object
// Firefox returns object
// IE8 returns object
// Chrome returns function
// assertEquals('object', typeof DOMSettableTokenList);
shouldBeTrue('\'undefined\' != typeof DOMSettableTokenList');
// assertEquals('object', typeof DOMTokenList);
shouldBeTrue('\'undefined\' != typeof DOMTokenList');

shouldBeEqualToString('typeof DOMSettableTokenList.prototype', 'object');
shouldBeEqualToString('typeof DOMTokenList.prototype', 'object');

createElement('x');
shouldBeEqualToString('typeof element.htmlFor', 'object');

shouldEvaluateTo('element.htmlFor.constructor', 'DOMSettableTokenList');
shouldEvaluateTo('element.htmlFor.constructor', 'DOMTokenList');

shouldBeTrue('element.htmlFor === element.htmlFor');
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PASS Historical DOM features must be removed: DOMImplementationList
PASS Historical DOM features must be removed: DOMImplementationSource
PASS Historical DOM features must be removed: DOMLocator
PASS Historical DOM features must be removed: DOMObject
FAIL Historical DOM features must be removed: DOMSettableTokenList assert_equals: expected (undefined) undefined but got (function) function "function DOMSettableTokenList() { [native code] }"
PASS Historical DOM features must be removed: DOMSettableTokenList
PASS Historical DOM features must be removed: DOMUserData
PASS Historical DOM features must be removed: Entity
PASS Historical DOM features must be removed: EntityReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ PASS DOMTokenList interface: operation remove(DOMString)
PASS DOMTokenList interface: operation toggle(DOMString,boolean)
FAIL DOMTokenList interface: operation replace(DOMString,DOMString) assert_own_property: interface prototype object missing non-static operation expected property "replace" missing
PASS DOMTokenList interface: operation supports(DOMString)
FAIL DOMTokenList interface: attribute value assert_true: The prototype object must have a property "value" expected true got false
PASS DOMTokenList interface: attribute value
FAIL DOMTokenList interface: stringifier assert_true: property is not enumerable expected true got false
PASS DOMTokenList must be primary interface of document.body.classList
PASS Stringification of document.body.classList
Expand All @@ -1362,6 +1362,6 @@ FAIL DOMTokenList interface: document.body.classList must inherit property "repl
FAIL DOMTokenList interface: calling replace(DOMString,DOMString) on document.body.classList with too few arguments must throw TypeError assert_inherits: property "replace" not found in prototype chain
PASS DOMTokenList interface: document.body.classList must inherit property "supports" with the proper type (7)
PASS DOMTokenList interface: calling supports(DOMString) on document.body.classList with too few arguments must throw TypeError
FAIL DOMTokenList interface: document.body.classList must inherit property "value" with the proper type (8) assert_inherits: property "value" not found in prototype chain
PASS DOMTokenList interface: document.body.classList must inherit property "value" with the proper type (8)
Harness: the test ran to completion.

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ console-format-collections.html:35 [input, input, value: ""]
console-format-collections.html:41 [1, Array[2]]
console-format-collections.html:44 NonArrayWithLength {keys: Array[0]}
console-format-collections.html:51 [1, "2"]
console-format-collections.html:55 ["c1", "c2", "c3"]
console-format-collections.html:55 ["c1", "c2", "c3", value: "c1 c2 c3"]
console-format-collections.html:58 []
console-format-collections.html:59 []
console-format-collections.html:61 ArrayLike {length: -5}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,6 @@ interface DOMImplementation
interface DOMParser
method constructor
method parseFromString
interface DOMSettableTokenList : DOMTokenList
getter value
method constructor
setter value
interface DOMStringList
getter length
method constructor
Expand All @@ -559,6 +555,7 @@ interface DOMStringMap
method constructor
interface DOMTokenList
getter length
getter value
method add
method constructor
method contains
Expand All @@ -571,6 +568,7 @@ interface DOMTokenList
method toString
method toggle
method values
setter value
interface DataTransfer
getter dropEffect
getter effectAllowed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -862,10 +862,6 @@ interface DOMRectReadOnly
getter x
getter y
method constructor
interface DOMSettableTokenList : DOMTokenList
getter value
method constructor
setter value
interface DOMStringList
getter length
method constructor
Expand All @@ -875,6 +871,7 @@ interface DOMStringMap
method constructor
interface DOMTokenList
getter length
getter value
method add
method constructor
method contains
Expand All @@ -887,6 +884,7 @@ interface DOMTokenList
method toString
method toggle
method values
setter value
interface DataTransfer
getter dropEffect
getter effectAllowed
Expand Down
3 changes: 0 additions & 3 deletions third_party/WebKit/Source/core/core.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
'dom/DOMPointReadOnly.idl',
'dom/DOMRect.idl',
'dom/DOMRectReadOnly.idl',
'dom/DOMSettableTokenList.idl',
'dom/DOMStringList.idl',
'dom/DOMStringMap.idl',
'dom/DOMTokenList.idl',
Expand Down Expand Up @@ -2326,8 +2325,6 @@
'dom/DOMRect.h',
'dom/DOMRectReadOnly.cpp',
'dom/DOMRectReadOnly.h',
'dom/DOMSettableTokenList.cpp',
'dom/DOMSettableTokenList.h',
'dom/DOMSharedArrayBuffer.cpp',
'dom/DOMSharedArrayBuffer.h',
'dom/DOMStringList.cpp',
Expand Down
68 changes: 0 additions & 68 deletions third_party/WebKit/Source/core/dom/DOMSettableTokenList.cpp

This file was deleted.

91 changes: 0 additions & 91 deletions third_party/WebKit/Source/core/dom/DOMSettableTokenList.h

This file was deleted.

32 changes: 0 additions & 32 deletions third_party/WebKit/Source/core/dom/DOMSettableTokenList.idl

This file was deleted.

20 changes: 20 additions & 0 deletions third_party/WebKit/Source/core/dom/DOMTokenList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,29 @@ AtomicString DOMTokenList::removeTokens(const AtomicString& input, const Vector<
return output.toAtomicString();
}

void DOMTokenList::setValue(const AtomicString& value)
{
m_value = value;
m_tokens.set(value, SpaceSplitString::ShouldNotFoldCase);
if (m_observer)
m_observer->valueWasSet();
}

bool DOMTokenList::containsInternal(const AtomicString& token) const
{
return m_tokens.contains(token);
}

ValueIterable<String>::IterationSource* DOMTokenList::startIteration(ScriptState*, ExceptionState&)
{
return new DOMTokenListIterationSource(this);
}

const AtomicString DOMTokenList::item(unsigned index) const
{
if (index >= length())
return AtomicString();
return m_tokens[index];
}

} // namespace blink
Loading

0 comments on commit 2ca6e94

Please sign in to comment.