Changeset 152611 in webkit
- Timestamp:
- Jul 13, 2013, 6:11:43 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r152610 r152611 1 2013-07-13 Ryosuke Niwa <rniwa@webkit.org> 2 3 Avoid upconverting strings in various places in WebCore 4 https://bugs.webkit.org/show_bug.cgi?id=118632 5 6 Reviewed by Andreas Kling. 7 8 Avoid calling String::characters() in various places since it upconverts 8-bit strings to 16-bit strings. 9 10 Merge 11 https://chromium.googlesource.com/chromium/blink/+/a6162e2ad7c7870e22445d3c463d17e7ac871e80 12 https://chromium.googlesource.com/chromium/blink/+/18095209b3f467758b83894e7b14f813f6953f81 13 https://chromium.googlesource.com/chromium/blink/+/fefcf2b95d55f24c60fd2e95978cf4544f3c92ca 14 https://chromium.googlesource.com/chromium/blink/+/8e0527b0fb33998318aedfd74b3511025f7ff294 15 https://chromium.googlesource.com/chromium/blink/+/feaf798b04597b0849b4000fc305264895d3eac5 16 https://chromium.googlesource.com/chromium/blink/+/bd1a49103a6e07b1023d2c742d8217769efbffb4 17 18 * css/CSSParser.cpp: 19 (WebCore::CSSParser::setupParser): 20 (WebCore::CSSParser::parseImageSet): 21 (WebCore::CSSParser::rewriteSpecifiers): 22 * css/CSSParserValues.h: 23 (WebCore::CSSParserString::init): 24 (WebCore::CSSParserString::clear): 25 * dom/DatasetDOMStringMap.cpp: 26 (WebCore::isValidAttributeName): 27 (WebCore::convertAttributeNameToPropertyName): 28 (WebCore::propertyNameMatchesAttributeName): 29 (WebCore::isValidPropertyName): 30 (WebCore::convertPropertyNameToAttributeName): 31 * dom/Range.cpp: 32 (WebCore::Range::toString): 33 * dom/SecurityContext.cpp: 34 (WebCore::SecurityContext::parseSandboxPolicy): 35 * html/canvas/CanvasRenderingContext2D.cpp: 36 (WebCore::CanvasRenderingContext2D::measureText): 37 * html/track/TextTrackCue.cpp: 38 (WebCore::TextTrackCue::markFutureAndPastNodes): 39 1 40 2013-07-13 Ryosuke Niwa <rniwa@webkit.org> 2 41 -
trunk/Source/WebCore/css/CSSParser.cpp
r152479 r152611 437 437 m_dataStart16[i] = prefix[i]; 438 438 439 memcpy(m_dataStart16.get() + m_parsedTextPrefixLength, string.characters(), stringLength * sizeof(UChar)); 439 ASSERT(stringLength); 440 memcpy(m_dataStart16.get() + m_parsedTextPrefixLength, string.characters16(), stringLength * sizeof(UChar)); 440 441 441 442 unsigned start = m_parsedTextPrefixLength + stringLength; … … 8060 8061 parseDouble(start, start + length, 'x', imageScaleFactor); 8061 8062 } else { 8062 const UChar* start = string.characters ();8063 const UChar* start = string.characters16(); 8063 8064 parseDouble(start, start + length, 'x', imageScaleFactor); 8064 8065 } … … 12203 12204 return CSSPropertyInvalid; 12204 12205 12205 return string.is8Bit() ? cssPropertyID(string.characters8(), length) : cssPropertyID(string.characters (), length);12206 return string.is8Bit() ? cssPropertyID(string.characters8(), length) : cssPropertyID(string.characters16(), length); 12206 12207 } 12207 12208 … … 12301 12302 if (string.is8Bit()) 12302 12303 return isCSSTokenizerIdentifier(string.characters8(), length); 12303 return isCSSTokenizerIdentifier(string.characters (), length);12304 return isCSSTokenizerIdentifier(string.characters16(), length); 12304 12305 } 12305 12306 … … 12341 12342 if (string.is8Bit()) 12342 12343 return isCSSTokenizerURL(string.characters8(), length); 12343 return isCSSTokenizerURL(string.characters (), length);12344 return isCSSTokenizerURL(string.characters16(), length); 12344 12345 } 12345 12346 -
trunk/Source/WebCore/css/CSSParserValues.h
r151754 r152611 51 51 { 52 52 m_length = string.length(); 53 if ( m_length &&string.is8Bit()) {53 if (!m_length || string.is8Bit()) { 54 54 m_data.characters8 = const_cast<LChar*>(string.characters8()); 55 55 m_is8Bit = true; 56 56 } else { 57 m_data.characters16 = const_cast<UChar*>(string.characters ());57 m_data.characters16 = const_cast<UChar*>(string.characters16()); 58 58 m_is8Bit = false; 59 59 } … … 64 64 m_data.characters8 = 0; 65 65 m_length = 0; 66 m_is8Bit = false;66 m_is8Bit = true; 67 67 } 68 68 -
trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp
r123636 r152611 40 40 return false; 41 41 42 const UChar* characters = name.characters();43 42 unsigned length = name.length(); 44 43 for (unsigned i = 5; i < length; ++i) { 45 if (isASCIIUpper( characters[i]))44 if (isASCIIUpper(name[i])) 46 45 return false; 47 46 } … … 54 53 StringBuilder stringBuilder; 55 54 56 const UChar* characters = name.characters();57 55 unsigned length = name.length(); 58 56 for (unsigned i = 5; i < length; ++i) { 59 UChar character = characters[i];57 UChar character = name[i]; 60 58 if (character != '-') 61 59 stringBuilder.append(character); 62 60 else { 63 if ((i + 1 < length) && isASCIILower( characters[i + 1])) {64 stringBuilder.append(toASCIIUpper( characters[i + 1]));61 if ((i + 1 < length) && isASCIILower(name[i + 1])) { 62 stringBuilder.append(toASCIIUpper(name[i + 1])); 65 63 ++i; 66 64 } else … … 77 75 return false; 78 76 79 const UChar* property = propertyName.characters();80 const UChar* attribute = attributeName.characters();81 77 unsigned propertyLength = propertyName.length(); 82 78 unsigned attributeLength = attributeName.length(); 83 79 84 80 unsigned a = 5; 85 81 unsigned p = 0; 86 82 bool wordBoundary = false; 87 83 while (a < attributeLength && p < propertyLength) { 88 if (attribute[a] == '-' && a + 1 < attributeLength && attribute[a + 1] != '-') 84 const UChar currentAttributeNameChar = attributeName[a]; 85 if (currentAttributeNameChar == '-' && a + 1 < attributeLength && attributeName[a + 1] != '-') 89 86 wordBoundary = true; 90 87 else { 91 if ((wordBoundary ? toASCIIUpper( attribute[a]) : attribute[a]) != property[p])88 if ((wordBoundary ? toASCIIUpper(currentAttributeNameChar) : currentAttributeNameChar) != propertyName[p]) 92 89 return false; 93 90 p++; … … 102 99 static bool isValidPropertyName(const String& name) 103 100 { 104 const UChar* characters = name.characters();105 101 unsigned length = name.length(); 106 102 for (unsigned i = 0; i < length; ++i) { 107 if ( characters[i] == '-' && (i + 1 < length) && isASCIILower(characters[i + 1]))103 if (name[i] == '-' && (i + 1 < length) && isASCIILower(name[i + 1])) 108 104 return false; 109 105 } … … 116 112 builder.append("data-"); 117 113 118 const UChar* characters = name.characters();119 114 unsigned length = name.length(); 120 115 for (unsigned i = 0; i < length; ++i) { 121 UChar character = characters[i];116 UChar character = name[i]; 122 117 if (isASCIIUpper(character)) { 123 118 builder.append('-'); -
trunk/Source/WebCore/dom/Range.cpp
r151627 r152611 1067 1067 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(n)) { 1068 1068 if (n->nodeType() == Node::TEXT_NODE || n->nodeType() == Node::CDATA_SECTION_NODE) { 1069 Stringdata = static_cast<CharacterData*>(n)->data();1069 const String& data = static_cast<CharacterData*>(n)->data(); 1070 1070 int length = data.length(); 1071 1071 int start = (n == m_start.container()) ? min(max(0, m_start.offset()), length) : 0; 1072 1072 int end = (n == m_end.container()) ? min(max(start, m_end.offset()), length) : length; 1073 builder.append(data .characters() +start, end - start);1073 builder.append(data, start, end - start); 1074 1074 } 1075 1075 } -
trunk/Source/WebCore/dom/SecurityContext.cpp
r149865 r152611 83 83 // Parse the unordered set of unique space-separated tokens. 84 84 SandboxFlags flags = SandboxAll; 85 const UChar* characters = policy.characters();86 85 unsigned length = policy.length(); 87 86 unsigned start = 0; … … 89 88 StringBuilder tokenErrors; 90 89 while (true) { 91 while (start < length && isHTMLSpace( characters[start]))90 while (start < length && isHTMLSpace(policy[start])) 92 91 ++start; 93 92 if (start >= length) 94 93 break; 95 94 unsigned end = start + 1; 96 while (end < length && !isHTMLSpace( characters[end]))95 while (end < length && !isHTMLSpace(policy[end])) 97 96 ++end; 98 97 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r151947 r152611 2114 2114 #endif 2115 2115 2116 metrics->setWidth(accessFont().width(TextRun(text .characters(), text.length())));2116 metrics->setWidth(accessFont().width(TextRun(text))); 2117 2117 2118 2118 #if PLATFORM(QT) -
trunk/Source/WebCore/html/track/TextTrackCue.cpp
r152459 r152611 777 777 // Make an elemenet id match a cue id for style matching purposes. 778 778 if (!m_id.isEmpty()) 779 toElement(child)->setIdAttribute( AtomicString(m_id.characters(), m_id.length()));779 toElement(child)->setIdAttribute(m_id); 780 780 } 781 781 }
Note:
See TracChangeset
for help on using the changeset viewer.