Changeset 67506 in webkit
- Timestamp:
- Sep 14, 2010 3:53:02 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/text/WTFString.h
r67423 r67506 460 460 using WTF::appendNumber; 461 461 using WTF::charactersAreAllASCII; 462 using WTF::charactersToIntStrict; 463 using WTF::charactersToUIntStrict; 464 using WTF::charactersToInt64Strict; 465 using WTF::charactersToUInt64Strict; 466 using WTF::charactersToIntPtrStrict; 467 using WTF::charactersToInt; 468 using WTF::charactersToUInt; 469 using WTF::charactersToInt64; 470 using WTF::charactersToUInt64; 471 using WTF::charactersToIntPtr; 462 472 using WTF::charactersToDouble; 463 473 using WTF::charactersToFloat; 464 using WTF::charactersToInt;465 474 using WTF::equal; 466 475 using WTF::equalIgnoringCase; -
trunk/LayoutTests/ChangeLog
r67503 r67506 1 2010-09-14 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 incorrect tabindex parsing 6 https://bugs.webkit.org/show_bug.cgi?id=21076 7 8 * fast/parser/tabindex-parsing-2-expected.txt: Added. 9 * fast/parser/tabindex-parsing-2.html: Added. 10 - Test a bunch of corner cases in tabindex parsing. 11 * fast/parser/tabindex-parsing-expected.txt: 12 * fast/parser/tabindex-parsing.html: 13 - Update expected result. This case is actually the one that the 14 original reporter was complaining about. 15 1 16 2010-09-14 Jian Li <jianli@chromium.org> 2 17 -
trunk/LayoutTests/fast/parser/tabindex-parsing-expected.txt
r32677 r67506 10 10 .tabIndex=7 getAttribute('tabindex')='007' 11 11 12 This element should n'tbe focusable PASSED13 .tabIndex= -1 getAttribute('tabindex')='1px'12 This element should be focusable PASSED 13 .tabIndex=1 getAttribute('tabindex')='1px' 14 14 15 15 This element should be focusable PASSED -
trunk/LayoutTests/fast/parser/tabindex-parsing.html
r32677 r67506 60 60 <span id="sp3">Click to test manually</span> 61 61 </p> 62 <p tabindex="1px" onfocus="p4Focused=true" onclick="test(p4Focused, false,4)">This element shouldn'tbe focusable <br>62 <p tabindex="1px" onfocus="p4Focused=true" onclick="test(p4Focused,true,4)">This element should be focusable <br> 63 63 <span id="sp4">Click to test manually</span> 64 64 </p> -
trunk/WebCore/ChangeLog
r67505 r67506 1 2010-09-14 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 incorrect tabindex parsing 6 https://bugs.webkit.org/show_bug.cgi?id=21076 7 8 Updated our integer parsing for tabindex to use the algorithm from the 9 HTML5 spec. 10 11 Test: fast/parser/tabindex-parsing-2.html 12 13 * html/HTMLElement.cpp: 14 (WebCore::HTMLElement::parseMappedAttribute): 15 * html/parser/HTMLParserIdioms.cpp: 16 (WebCore::parseHTMLInteger): 17 * html/parser/HTMLParserIdioms.h: 18 1 19 2010-09-14 Brent Fulgham <bfulgham@webkit.org> 2 20 -
trunk/WebCore/html/HTMLElement.cpp
r67292 r67506 40 40 #include "HTMLFormElement.h" 41 41 #include "HTMLNames.h" 42 #include "HTMLParserIdioms.h" 42 43 #include "RenderWordBreak.h" 43 44 #include "ScriptEventListener.h" … … 143 144 } else if (attr->name() == tabindexAttr) { 144 145 indexstring = getAttribute(tabindexAttr); 145 if (indexstring.length()) { 146 bool parsedOK; 147 int tabindex = indexstring.toIntStrict(&parsedOK); 148 if (parsedOK) 149 // Clamp tabindex to the range of 'short' to match Firefox's behavior. 150 setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); 146 int tabindex = 0; 147 if (parseHTMLInteger(indexstring, tabindex)) { 148 // Clamp tabindex to the range of 'short' to match Firefox's behavior. 149 setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); 151 150 } 152 151 } else if (attr->name() == langAttr) { -
trunk/WebCore/html/parser/HTMLParserIdioms.cpp
r67423 r67506 92 92 } 93 93 94 // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers 95 bool parseHTMLInteger(const String& input, int& value) 96 { 97 // Step 1 98 // Step 2 99 const UChar* position = input.characters(); 100 const UChar* end = position + input.length(); 101 102 // Step 3 103 int sign = 1; 104 105 // Step 4 106 while (position < end) { 107 if (!isHTMLSpace(*position)) 108 break; 109 ++position; 110 } 111 112 // Step 5 113 if (position == end) 114 return false; 115 ASSERT(position < end); 116 117 // Step 6 118 if (*position == '-') { 119 sign = -1; 120 ++position; 121 } else if (*position == '+') 122 ++position; 123 if (position == end) 124 return false; 125 ASSERT(position < end); 126 127 // Step 7 128 if (!isASCIIDigit(*position)) 129 return false; 130 131 // Step 8 132 Vector<UChar, 16> digits; 133 while (position < end) { 134 if (!isASCIIDigit(*position)) 135 break; 136 digits.append(*position++); 137 } 138 139 // Step 9 140 value = sign * charactersToIntStrict(digits.data(), digits.size()); 141 return true; 94 142 } 143 144 } -
trunk/WebCore/html/parser/HTMLParserIdioms.h
r67423 r67506 46 46 bool parseToDoubleForNumberType(const String&, double*); 47 47 48 // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers 49 bool parseHTMLInteger(const String&, int&); 50 48 51 // Inline implementations of some of the functions declared above. 49 52 -
trunk/WebCore/wml/WMLElement.cpp
r66498 r67506 73 73 } else if (attr->name() == HTMLNames::tabindexAttr) { 74 74 String indexstring = attr->value(); 75 if (indexstring.length()) { 76 bool parsedOK; 77 int tabindex = indexstring.toIntStrict(&parsedOK); 78 if (parsedOK) 79 // Clamp tabindex to the range of 'short' to match Firefox's behavior. 80 setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); 75 int tabindex = 0; 76 if (parseHTMLInteger(tabindex)) { 77 // Clamp tabindex to the range of 'short' to match Firefox's behavior. 78 setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); 81 79 } 82 80 }
Note: See TracChangeset
for help on using the changeset viewer.