Changeset 204952 in webkit
- Timestamp:
- Aug 24, 2016 7:40:55 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r204951 r204952 1 2016-08-24 Joseph Pecoraro <pecoraro@apple.com> 2 3 Implement `CSS.escape` as per CSSOM 4 https://bugs.webkit.org/show_bug.cgi?id=126337 5 6 Reviewed by Dean Jackson. 7 8 CSS.escape is part of the CSSOM Spec: 9 https://drafts.csswg.org/cssom/#the-css.escape%28%29-method 10 11 Tests: 12 https://github.com/mathiasbynens/CSS.escape/blob/master/tests/tests.js 13 14 Change is based on the Blink change (patch by <rob.buis@samsung.com>) and follow-ups: 15 <https://chromium.googlesource.com/chromium/blink/+/c1a5ffdc924b089e70cd33ad2726b58cc8312abe> 16 17 * css3/escape-dom-api-expected.txt: Added. 18 * css3/escape-dom-api.html: Added. 19 New tests, taken from the polyfill. 20 21 * fast/css/parsing-css-nonascii-expected.txt: 22 * fast/css/parsing-css-nonascii.html: 23 * fast/css/selector-text-escape.html: 24 Update existing tests now that 0x7f is escaped. 25 26 * js/dom/function-removed-after-parsing-expected.txt: 27 * js/dom/function-removed-after-parsing.html: 28 Rename use of `CSS.escape` here now that `CSS.escape` exists. 29 1 30 2016-08-24 Zalan Bujtas <zalan@apple.com> 2 31 -
trunk/LayoutTests/fast/css/parsing-css-nonascii-expected.txt
r98744 r204952 5 5 Rules from the stylesheet: 6 6 7 #a127_\ { color: red; }7 #a127_\7f { color: red; } 8 8 #a128_ { color: red; } 9 9 #b128_ { color: green; } … … 16 16 Expected result: 17 17 18 #a127_\ { color: red; }18 #a127_\7f { color: red; } 19 19 #a128_ { color: red; } 20 20 #b128_ { color: green; } -
trunk/LayoutTests/fast/css/parsing-css-nonascii.html
r120683 r204952 6 6 === Warning === 7 7 8 This file intentionally contains s cpecial characters which8 This file intentionally contains special characters which 9 9 cannot be displayed by some text editors. Please 10 10 carefully edit the file. … … 65 65 <p>Expected result:</p> 66 66 67 <pre id="expected">#a127_\ { color: red; }67 <pre id="expected">#a127_\7f { color: red; } 68 68 #a128_ { color: red; } 69 69 #b128_ { color: green; } -
trunk/LayoutTests/fast/css/selector-text-escape.html
r155263 r204952 94 94 ".-\\30 _class", 95 95 ".-\\39 _class", 96 ".- \\-_class",96 ".--_class", 97 97 ".\x81_class", 98 98 ".日本語_class", -
trunk/LayoutTests/js/dom/function-removed-after-parsing-expected.txt
r200518 r204952 1 window.CSS. escape still here1 window.CSS.layoutTestEscape still here 2 2 -
trunk/LayoutTests/js/dom/function-removed-after-parsing.html
r200518 r204952 3 3 NOTE: This intentionally does not use description() and does not include js-test-post because 4 4 doing either of those things made the bug go away. 5 6 NOTE: This intentionally does not use the name `CSS.escape` because that function exists now but 7 did not when this test was added. The name was changed to `CSS.layoutTestEscape` for this test. 5 8 --> 6 9 <script src="../../resources/js-test-pre.js"></script> … … 21 24 InvalidCharacterError.prototype.name = 'InvalidCharacterError'; 22 25 23 if (!CSS. escape) {26 if (!CSS.layoutTestEscape) { 24 27 // https://drafts.csswg.org/cssom/#serialize-an-identifier 25 CSS. escape = function(value) {28 CSS.layoutTestEscape = function(value) { 26 29 var string = String(value); 27 30 var length = string.length; … … 113 116 testRunner.waitUntilDone(); 114 117 } catch (e) { } 115 if (!window.CSS. escape) {116 debug('window.CSS. escape not loaded');118 if (!window.CSS.layoutTestEscape) { 119 debug('window.CSS.layoutTestEscape not loaded'); 117 120 } 118 121 setTimeout(function() { 119 if (window.CSS. escape)120 debug("window.CSS. escape still here");122 if (window.CSS.layoutTestEscape) 123 debug("window.CSS.layoutTestEscape still here"); 121 124 else 122 debug('window.CSS. escape missing in event');125 debug('window.CSS.layoutTestEscape missing in event'); 123 126 try { 124 127 testRunner.notifyDone(); -
trunk/Source/WebCore/ChangeLog
r204951 r204952 1 2016-08-24 Joseph Pecoraro <pecoraro@apple.com> 2 3 Implement `CSS.escape` as per CSSOM 4 https://bugs.webkit.org/show_bug.cgi?id=126337 5 6 Reviewed by Dean Jackson. 7 8 Test: css3/escape-dom-api.html 9 10 * css/CSSOMUtils.cpp: 11 (WebCore::serializeIdentifier): 12 Update serialization to match the latest version of the spec: 13 <https://drafts.csswg.org/cssom/#serialize-an-identifier> 14 New handling for 0x0, 0x7f, just "-", and "--" is now allowed. 15 16 * css/DOMCSSNamespace.cpp: 17 (WebCore::DOMCSSNamespace::escape): 18 * css/DOMCSSNamespace.h: 19 * css/DOMCSSNamespace.idl: 20 New CSS.escape method. 21 1 22 2016-08-24 Zalan Bujtas <zalan@apple.com> 2 23 -
trunk/Source/WebCore/css/CSSOMUtils.cpp
r166044 r204952 58 58 while (index < identifier.length()) { 59 59 UChar32 c = identifier.characterStartingAt(index); 60 if (!c) { 61 // Check for lone surrogate which characterStartingAt does not return. 62 c = identifier[index]; 63 } 64 60 65 index += U16_LENGTH(c); 61 66 62 if (c <= 0x1f || (0x30 <= c && c <= 0x39 && (isFirst || (isSecond && isFirstCharHyphen)))) 67 if (!c) 68 appendTo.append(0xfffd); 69 else if (c <= 0x1f || c == 0x7f || (0x30 <= c && c <= 0x39 && (isFirst || (isSecond && isFirstCharHyphen)))) 63 70 serializeCharacterAsCodePoint(c, appendTo); 64 else if (c == 0x2d && is Second && isFirstCharHyphen)71 else if (c == 0x2d && isFirst && index == identifier.length()) 65 72 serializeCharacter(c, appendTo); 66 73 else if (0x80 <= c || c == 0x2d || c == 0x5f || (0x30 <= c && c <= 0x39) || (0x41 <= c && c <= 0x5a) || (0x61 <= c && c <= 0x7a)) … … 73 80 isSecond = true; 74 81 isFirstCharHyphen = (c == 0x2d); 75 } else if (isSecond) {82 } else if (isSecond) 76 83 isSecond = false; 77 }78 84 } 79 85 } -
trunk/Source/WebCore/css/DOMCSSNamespace.cpp
r201290 r204952 31 31 #include "DOMCSSNamespace.h" 32 32 33 #include "CSSOMUtils.h" 33 34 #include "CSSParser.h" 34 35 #include "StyleProperties.h" 36 #include <wtf/text/StringBuilder.h> 35 37 #include <wtf/text/WTFString.h> 36 38 … … 78 80 } 79 81 82 String DOMCSSNamespace::escape(const String& ident) 83 { 84 StringBuilder builder; 85 serializeIdentifier(ident, builder); 86 return builder.toString(); 80 87 } 88 89 } -
trunk/Source/WebCore/css/DOMCSSNamespace.h
r199112 r204952 39 39 static bool supports(const String& property, const String& value); 40 40 static bool supports(const String& conditionText); 41 static String escape(const String& ident); 41 42 }; 42 43 -
trunk/Source/WebCore/css/DOMCSSNamespace.idl
r199112 r204952 34 34 static boolean supports(DOMString property, DOMString value); 35 35 static boolean supports(DOMString conditionText); 36 static DOMString escape(DOMString ident); 36 37 };
Note: See TracChangeset
for help on using the changeset viewer.