Changeset 196080 in webkit
- Timestamp:
- Feb 3, 2016 2:08:57 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r196077 r196080 1 2016-02-03 Darin Adler <darin@apple.com> 2 3 Convert another batch of String::lower callsites to something better, typically convertToASCIILowercase 4 https://bugs.webkit.org/show_bug.cgi?id=153789 5 6 Reviewed by Sam Weinig. 7 8 * wtf/text/StringView.h: 9 (WTF::StringView::toInt): Added an overload without the out parameter. 10 1 11 2016-02-03 Michael Catanzaro <mcatanzaro@igalia.com> 2 12 -
trunk/Source/WTF/wtf/text/StringView.h
r195951 r196080 126 126 WTF_EXPORT_STRING_API bool endsWithIgnoringASCIICase(const StringView&) const; 127 127 128 int toInt() const; 128 129 int toInt(bool& isValid) const; 129 130 int toIntStrict(bool& isValid) const; … … 456 457 } 457 458 459 inline int StringView::toInt() const 460 { 461 bool isValid; 462 return toInt(isValid); 463 } 464 458 465 inline int StringView::toInt(bool& isValid) const 459 466 { -
trunk/Source/WebCore/ChangeLog
r196075 r196080 1 2016-02-03 Darin Adler <darin@apple.com> 2 3 Convert another batch of String::lower callsites to something better, typically convertToASCIILowercase 4 https://bugs.webkit.org/show_bug.cgi?id=153789 5 6 Reviewed by Sam Weinig. 7 8 * dom/DOMImplementation.cpp: 9 (WebCore::DOMImplementation::isXMLMIMEType): Use equalLettersIgnoringASCIICase 10 and the boolean argument to endsWith to ignore ASCII case. 11 (WebCore::DOMImplementation::isTextMIMEType): Ditto. Also simplified the logic 12 by removing an if statement. 13 14 * dom/Document.cpp: 15 (WebCore::isSeparator): Deleted. Moved to WindowFeatures.cpp. 16 (WebCore::processArguments): Ditto. 17 (WebCore::Document::processViewport): Call the processFeaturesString function 18 from WindowFeatures.h; the code here was originally just a pasted copy of that code! 19 (WebCore::Document::processFormatDetection): Ditto. 20 21 * html/HTMLCanvasElement.cpp: 22 (WebCore::HTMLCanvasElement::toEncodingMimeType): Remove now-unneeded 23 lowercasing of MIME type before calling isSupportedImageMIMETypeForEncoding, 24 since the MIME type registry now ignores ASCII case. Use convertToASCIILowercase 25 on the return value, to preserve behavior. 26 (WebCore::HTMLCanvasElement::toDataURL): Minor coding style tweaks. 27 28 * html/HTMLEmbedElement.cpp: 29 (WebCore::HTMLEmbedElement::parseAttribute): Use convertToASCIILowercase for 30 the service type here. 31 32 * html/HTMLImageElement.cpp: 33 (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Remove now-unneeded 34 lowercasing since MIME type registry now ignores ASCII case. And use 35 equalLettersIgnoringASCIICase for the case here. 36 37 * html/HTMLInputElement.cpp: 38 (WebCore::parseAcceptAttribute): Use convertToASCIILowercase for the type here. 39 40 * html/HTMLLinkElement.cpp: 41 (WebCore::HTMLLinkElement::parseAttribute): Use convertToASCIILowercase for the 42 media value here. 43 44 * html/HTMLMediaElement.cpp: 45 (WebCore::HTMLMediaElement::canPlayType): Use convertToASCIILowercase for the 46 content type here. 47 (WebCore::HTMLMediaElement::selectNextSourceChild): Ditto. 48 49 * html/HTMLObjectElement.cpp: 50 (WebCore::HTMLObjectElement::parseAttribute): Use convertToASCIILowercase for 51 the service type here. 52 53 * html/HTMLTrackElement.cpp: 54 (WebCore::HTMLTrackElement::parseAttribute): Use convertToASCIILowercase for 55 the kind here. 56 (WebCore::HTMLTrackElement::ensureTrack): Ditto. Also use fastGetAttribute 57 since this is neither the style attribute nor an animatable SVG attribute. 58 59 * html/parser/HTMLTreeBuilder.cpp: 60 (WebCore::createCaseMap): Use convertToASCIILowercase for the local names here. 61 62 * inspector/DOMPatchSupport.cpp: 63 (WebCore::DOMPatchSupport::patchNode): Use containsIgnoringASCIICase instead 64 of combining lower with find == notFound here. 65 (WebCore::nodeName): Use convertToASCIILowercase here. 66 67 * inspector/InspectorOverlay.cpp: 68 (WebCore::buildObjectForElementData): Use convertToASCIILowercase for node 69 name here. 70 71 * inspector/InspectorPageAgent.cpp: 72 (WebCore::createXHRTextDecoder): Remove a now-unneeded call to lower since 73 DOMImplementation::isXMLMIMEType now ignores ASCII case. 74 75 * inspector/InspectorStyleSheet.cpp: 76 (WebCore::lowercasePropertyName): Use convertToASCIILowercase for property 77 names here. Also use startsWith rather than a hand-written alternative. 78 (WebCore::InspectorStyle::populateAllProperties): Use the return value of 79 the add function to avoid doing a double hash table lookp. 80 (WebCore::InspectorStyle::styleWithProperties): Use convertToASCIILowercase 81 to lowercase the property name. 82 83 * inspector/NetworkResourcesData.cpp: 84 (WebCore::createOtherResourceTextDecoder): Remove unneeded call to lower since 85 DOMImplement::isXMLMIMEType now ignores ASCII case. 86 87 * loader/CrossOriginAccessControl.cpp: 88 (WebCore::createAccessControlPreflightRequest): Use convertToASCIILowercase 89 to lowercase the access control request header field value. 90 91 * loader/cache/CachedScript.cpp: 92 (WebCore::CachedScript::mimeType): Use convertToASCIILowercase on the content type. 93 94 * page/CaptionUserPreferencesMediaAF.cpp: 95 (WebCore::languageIdentifier): Use convertToASCIILowercase on the language code. 96 97 * page/DOMWindow.cpp: 98 (WebCore::DOMWindow::open): Call parseWindowFeatures instead of using the 99 constructor for WindowFeatures. 100 (WebCore::DOMWindow::showModalDialog): Call parseDialogFeatures instead of 101 using the constructor for WindowFeatures. 102 103 * page/EventHandler.cpp: 104 (WebCore::findDropZone): Remove unneeded lowercasing and empty string checking, 105 and use the option SpaceSplitString already has to convert to lowercase. 106 (WebCore::EventHandler::handleAccessKey): Remove unneeded call to lower since 107 getElementByAccessKey now ignores case. Also tweaked coding style a bit. 108 109 * page/OriginAccessEntry.cpp: 110 (WebCore::OriginAccessEntry::OriginAccessEntry): Use convertToASCIILowercase 111 on the protocol and host. 112 (WebCore::OriginAccessEntry::matchesOrigin): Ditto. 113 114 * page/SecurityOrigin.cpp: 115 (WebCore::shouldTreatAsUniqueOrigin): Remove unneeded call to lower since 116 SchemeRegistry now ignores ASCII case. 117 (WebCore::SecurityOrigin::SecurityOrigin): Use convertToASCIILowercase on 118 the protocol and host. 119 (WebCore::SecurityOrigin::setDomainFromDOM): Use convertToASCIILowercase on 120 the domain. 121 (WebCore::SecurityOrigin::canDisplay): Remove call to lower since SchemeRegistry 122 now ignores ASCII case and because this now uses equalIgnoringASCIICase in 123 one place that used to use exact matching. 124 125 * page/WindowFeatures.cpp: Refactored so this is now some helper functions 126 plus a struct rather than a class. 127 (WebCore::isSeparator): Renamed this and removed special handling for NUL. 128 (WebCore::parseWindowFeatures): Moved the code that was formerly in the 129 WindowFeatures constructor in here. Refactored the parsing into the 130 processFeaturesString function, shared with the functions in Document that 131 do the same kind of parsing. Removed the code that converts the entire string 132 to lowercase before parsing. 133 (WebCore::processFeaturesString): Moved the improved version of this function 134 here from Document.cpp; more efficient because it doesn't allocate strings. 135 (WebCore::setWindowFeature): Changed to be a function private to this file 136 with internal linkage. Use equalLettersIgnoringASCIICase so we no longer 137 rely on converting the string to lowercase before parsing. 138 (WebCore::parseDialogFeatures): Similar refactoring, but also changed all 139 the default handling to use Optional<> instead of default values. 140 (WebCore::boolFeature): Changed to use option and to ignore ASCII case. 141 (WebCore::floatFeature): Ditto. 142 (WebCore::parseDialogFeaturesMap): Removed the calls to lower, which are 143 not needed any more. 144 145 * page/WindowFeatures.h: Added default values for all the data members, 146 and removed all the functions from the WindowFeatures struct. Added the two 147 functions for parsing window and dialog features. Also added the 148 processFeaturesString function so we can share it with Document.cpp. 149 150 * platform/SchemeRegistry.cpp: 151 (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal): Use 152 equalLettersIgnoringASCIICase to ignore ASCII case. 153 154 * platform/efl/MIMETypeRegistryEfl.cpp: 155 (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Use a modern for loop, 156 and equalIgnoringASCIICase rather than calling lower. 157 158 * platform/graphics/MediaPlayer.cpp: 159 (WebCore::MediaPlayer::load): Use convertToASCIILowercase on MIME type and 160 key system. 161 (WebCore::MediaPlayer::generateKeyRequest): Ditto. 162 (WebCore::MediaPlayer::addKey): Ditto. 163 (WebCore::MediaPlayer::cancelKeyRequest): Ditto. 164 165 * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: 166 (WebCore::Extensions3DOpenGLCommon::Extensions3DOpenGLCommon): Use 167 convertToASCIILowercase on vendor string. 168 169 * platform/gtk/MIMETypeRegistryGtk.cpp: 170 (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Use a modern for loop, 171 and equalIgnoringASCIICase rather than calling lower. 172 173 * platform/mac/PasteboardMac.mm: 174 (WebCore::cocoaTypeFromHTMLClipboardType): Use convertToASCIILowercase 175 on the type. Also did a bit of renaming and tweaking the logic. 176 1 177 2016-02-03 Dave Hyatt <hyatt@apple.com> 2 178 -
trunk/Source/WebCore/dom/DOMImplementation.cpp
r195928 r196080 269 269 bool DOMImplementation::isXMLMIMEType(const String& mimeType) 270 270 { 271 if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "text/xsl") 271 // FIXME: Can we move this logic to MIMETypeRegistry and have this just be a single function call? 272 273 if (equalLettersIgnoringASCIICase(mimeType, "text/xml") || equalLettersIgnoringASCIICase(mimeType, "application/xml") || equalLettersIgnoringASCIICase(mimeType, "text/xsl")) 272 274 return true; 273 275 274 if (!mimeType.endsWith("+xml" ))276 if (!mimeType.endsWith("+xml", false)) 275 277 return false; 276 278 … … 292 294 bool DOMImplementation::isTextMIMEType(const String& mimeType) 293 295 { 294 if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) 295 || mimeType == "application/json" // Render JSON as text/plain. 296 || (mimeType.startsWith("text/") && mimeType != "text/html" 297 && mimeType != "text/xml" && mimeType != "text/xsl")) 298 return true; 299 300 return false; 296 // FIXME: Can we move this logic to MIMETypeRegistry and have this just be a single function call? 297 298 return MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) 299 || equalLettersIgnoringASCIICase(mimeType, "application/json") // Render JSON as text/plain. 300 || (mimeType.startsWith("text/", false) 301 && !equalLettersIgnoringASCIICase(mimeType, "text/html") 302 && !equalLettersIgnoringASCIICase(mimeType, "text/xml") 303 && !equalLettersIgnoringASCIICase(mimeType, "text/xsl")); 301 304 } 302 305 -
trunk/Source/WebCore/dom/Document.cpp
r196012 r196080 169 169 #include "VisitedLinkState.h" 170 170 #include "WheelEvent.h" 171 #include "WindowFeatures.h" 171 172 #include "XMLDocument.h" 172 173 #include "XMLDocumentParser.h" … … 3279 3280 } 3280 3281 3281 static bool isSeparator(UChar character)3282 {3283 return character == ' ' || character == '\t' || character == '\n' || character == '\r' || character == '=' || character == ',';3284 }3285 3286 static void processArguments(StringView features, std::function<void(StringView type, StringView value)> callback)3287 {3288 unsigned length = features.length();3289 for (unsigned i = 0; i < length; ) {3290 // skip to first non-separator3291 while (i < length && isSeparator(features[i]))3292 ++i;3293 unsigned keyBegin = i;3294 3295 // skip to first separator3296 while (i < length && !isSeparator(features[i]))3297 i++;3298 unsigned keyEnd = i;3299 3300 // skip to first '=', but don't skip past a ','3301 while (i < length && features[i] != '=' && features[i] != ',')3302 ++i;3303 3304 // skip to first non-separator, but don't skip past a ','3305 while (i < length && isSeparator(features[i]) && features[i] != ',')3306 ++i;3307 unsigned valueBegin = i;3308 3309 // skip to first separator3310 while (i < length && !isSeparator(features[i]))3311 ++i;3312 unsigned valueEnd = i;3313 3314 callback(features.substring(keyBegin, keyEnd - keyBegin), features.substring(valueBegin, valueEnd - valueBegin));3315 }3316 }3317 3318 3282 void Document::processViewport(const String& features, ViewportArguments::Type origin) 3319 3283 { … … 3325 3289 m_viewportArguments = ViewportArguments(origin); 3326 3290 3327 process Arguments(features, [this](StringView key, StringView value) {3291 processFeaturesString(features, [this](StringView key, StringView value) { 3328 3292 setViewportFeature(m_viewportArguments, *this, key, value); 3329 3293 }); … … 3350 3314 { 3351 3315 // FIXME: Find a better place for this function. 3352 process Arguments(features, [this](StringView key, StringView value) {3316 processFeaturesString(features, [this](StringView key, StringView value) { 3353 3317 if (equalLettersIgnoringASCIICase(key, "telephone") && equalLettersIgnoringASCIICase(value, "no")) 3354 3318 setIsTelephoneNumberParsingAllowed(false); -
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
r195848 r196080 481 481 String HTMLCanvasElement::toEncodingMimeType(const String& mimeType) 482 482 { 483 String lowercaseMimeType = mimeType.lower(); 484 485 // FIXME: Make isSupportedImageMIMETypeForEncoding threadsafe (to allow this method to be used on a worker thread). 486 if (mimeType.isNull() || !MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(lowercaseMimeType)) 487 lowercaseMimeType = "image/png"; 488 489 return lowercaseMimeType; 483 if (!MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)) 484 return ASCIILiteral("image/png"); 485 return mimeType.convertToASCIILowercase(); 490 486 } 491 487 … … 500 496 return ASCIILiteral("data:,"); 501 497 502 String encodingM imeType = toEncodingMimeType(mimeType);498 String encodingMIMEType = toEncodingMimeType(mimeType); 503 499 504 500 #if USE(CG) 505 501 // Try to get ImageData first, as that may avoid lossy conversions. 506 RefPtr<ImageData> imageData = getImageData(); 507 508 if (imageData) 509 return ImageDataToDataURL(*imageData, encodingMimeType, quality); 502 if (auto imageData = getImageData()) 503 return ImageDataToDataURL(*imageData, encodingMIMEType, quality); 510 504 #endif 511 505 512 506 makeRenderingResultsAvailable(); 513 507 514 return buffer()->toDataURL(encodingM imeType, quality);508 return buffer()->toDataURL(encodingMIMEType, quality); 515 509 } 516 510 -
trunk/Source/WebCore/html/HTMLEmbedElement.cpp
r195452 r196080 102 102 { 103 103 if (name == typeAttr) { 104 m_serviceType = value.string().left(value.find(';')). lower();104 m_serviceType = value.string().left(value.find(';')).convertToASCIILowercase(); 105 105 // FIXME: The only difference between this and HTMLObjectElement's corresponding 106 106 // code is that HTMLObjectElement does setNeedsWidgetUpdate(true). Consider moving -
trunk/Source/WebCore/html/HTMLImageElement.cpp
r195452 r196080 163 163 type.truncate(indexOfSemicolon); 164 164 type = stripLeadingAndTrailingHTMLSpaces(type); 165 type = type.lower(); 166 if (!type.isEmpty() && !MIMETypeRegistry::isSupportedImageMIMEType(type) && type != "image/svg+xml") 165 if (!type.isEmpty() && !MIMETypeRegistry::isSupportedImageMIMEType(type) && !equalLettersIgnoringASCIICase(type, "image/svg+xml")) 167 166 continue; 168 167 } -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r195685 r196080 1230 1230 if (!predicate(trimmedType)) 1231 1231 continue; 1232 types.append(trimmedType. lower());1232 types.append(trimmedType.convertToASCIILowercase()); 1233 1233 } 1234 1234 -
trunk/Source/WebCore/html/HTMLLinkElement.cpp
r194819 r196080 165 165 } 166 166 if (name == mediaAttr) { 167 m_media = value.string(). lower();167 m_media = value.string().convertToASCIILowercase(); 168 168 process(); 169 169 if (m_sheet && !isDisabled()) -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r196010 r196080 921 921 MediaEngineSupportParameters parameters; 922 922 ContentType contentType(mimeType); 923 parameters.type = contentType.type(). lower();923 parameters.type = contentType.type().convertToASCIILowercase(); 924 924 parameters.codecs = contentType.parameter(ASCIILiteral("codecs")); 925 925 parameters.url = url; … … 4177 4177 MediaEngineSupportParameters parameters; 4178 4178 ContentType contentType(type); 4179 parameters.type = contentType.type(). lower();4179 parameters.type = contentType.type().convertToASCIILowercase(); 4180 4180 parameters.codecs = contentType.parameter(ASCIILiteral("codecs")); 4181 4181 parameters.url = mediaURL; -
trunk/Source/WebCore/html/HTMLObjectElement.cpp
r195928 r196080 113 113 formAttributeChanged(); 114 114 else if (name == typeAttr) { 115 m_serviceType = value.string().left(value.find(';')). lower();115 m_serviceType = value.string().left(value.find(';')).convertToASCIILowercase(); 116 116 invalidateRenderer = !fastHasAttribute(classidAttr); 117 117 setNeedsWidgetUpdate(true); -
trunk/Source/WebCore/html/HTMLTrackElement.cpp
r192354 r196080 103 103 // As the kind, label, and srclang attributes are set, changed, or removed, the text track must update accordingly... 104 104 } else if (name == kindAttr) 105 track()->setKind(value. lower());105 track()->setKind(value.convertToASCIILowercase()); 106 106 else if (name == labelAttr) 107 107 track()->setLabel(value); … … 158 158 { 159 159 if (!m_track) { 160 // The kind attribute is an enumerated attribute, limited only to know values. It defaults to 'subtitles' if missing or invalid.161 String kind = getAttribute(kindAttr).lower();160 // The kind attribute is an enumerated attribute, limited only to known values. It defaults to 'subtitles' if missing or invalid. 161 String kind = fastGetAttribute(kindAttr).convertToASCIILowercase(); 162 162 if (!TextTrack::isValidKindKeyword(kind)) 163 163 kind = TextTrack::subtitlesKeyword(); -
trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp
r195452 r196080 512 512 const QualifiedName& name = *names[i]; 513 513 const AtomicString& localName = name.localName(); 514 AtomicString loweredLocalName = localName. lower();514 AtomicString loweredLocalName = localName.convertToASCIILowercase(); 515 515 if (loweredLocalName != localName) 516 516 map.add(loweredLocalName, name); -
trunk/Source/WebCore/inspector/DOMPatchSupport.cpp
r195520 r196080 137 137 138 138 // Compose the new list. 139 String markupCopy = markup.lower();140 139 Vector<std::unique_ptr<Digest>> newList; 141 140 for (Node* child = parentNode->firstChild(); child != &node; child = child->nextSibling()) 142 141 newList.append(createDigest(child, nullptr)); 143 142 for (Node* child = fragment->firstChild(); child; child = child->nextSibling()) { 144 if (child->hasTagName(headTag) && !child->firstChild() && markupCopy.find("</head>") == notFound)143 if (child->hasTagName(headTag) && !child->firstChild() && !markup.containsIgnoringASCIICase("</head>")) 145 144 continue; // HTML5 parser inserts empty <head> tag whenever it parses <body> 146 if (child->hasTagName(bodyTag) && !child->firstChild() && markupCopy.find("</body>") == notFound)145 if (child->hasTagName(bodyTag) && !child->firstChild() && !markup.containsIgnoringASCIICase("</body>")) 147 146 continue; // HTML5 parser inserts empty <body> tag whenever it parses </head> 148 147 newList.append(createDigest(child, &m_unusedNodesMap)); … … 497 496 498 497 #ifdef DEBUG_DOM_PATCH_SUPPORT 498 499 499 static String nodeName(Node* node) 500 500 { 501 501 if (node->document().isXHTMLDocument()) 502 502 return node->nodeName(); 503 return node->nodeName(). lower();503 return node->nodeName().convertToASCIILowercase(); 504 504 } 505 505 … … 510 510 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map[i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map[i].second); 511 511 } 512 512 513 #endif 513 514 -
trunk/Source/WebCore/inspector/InspectorOverlay.cpp
r194496 r196080 710 710 bool isXHTML = element.document().isXHTMLDocument(); 711 711 auto elementData = Inspector::Protocol::OverlayTypes::ElementData::create() 712 .setTagName(isXHTML ? element.nodeName() : element.nodeName(). lower())712 .setTagName(isXHTML ? element.nodeName() : element.nodeName().convertToASCIILowercase()) 713 713 .setIdValue(element.getIdAttribute()) 714 714 .release(); -
trunk/Source/WebCore/inspector/InspectorPageAgent.cpp
r195452 r196080 124 124 if (!textEncodingName.isEmpty()) 125 125 decoder = TextResourceDecoder::create("text/plain", textEncodingName); 126 else if (DOMImplementation::isXMLMIMEType(mimeType .lower())) {126 else if (DOMImplementation::isXMLMIMEType(mimeType)) { 127 127 decoder = TextResourceDecoder::create("application/xml"); 128 128 decoder->useLenientXMLDecoding(); -
trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp
r195293 r196080 351 351 { 352 352 // Custom properties are case-sensitive. 353 if (name. length() > 2 && name.characterAt(0) == '-' && name.characterAt(1) == '-')353 if (name.startsWith("--")) 354 354 return name; 355 return name. lower();355 return name.convertToASCIILowercase(); 356 356 } 357 357 … … 376 376 for (int i = 0, size = m_style->length(); i < size; ++i) { 377 377 String name = m_style->item(i); 378 String lowerName = lowercasePropertyName(name); 379 if (sourcePropertyNames.contains(lowerName)) 380 continue; 381 sourcePropertyNames.add(lowerName); 382 result->append(InspectorStyleProperty(CSSPropertySourceData(name, m_style->getPropertyValue(name), !m_style->getPropertyPriority(name).isEmpty(), true, SourceRange()), false, false)); 378 if (sourcePropertyNames.add(lowercasePropertyName(name))) 379 result->append(InspectorStyleProperty(CSSPropertySourceData(name, m_style->getPropertyValue(name), !m_style->getPropertyPriority(name).isEmpty(), true, SourceRange()), false, false)); 383 380 } 384 381 … … 414 411 415 412 RefPtr<Inspector::Protocol::CSS::CSSProperty> property = Inspector::Protocol::CSS::CSSProperty::create() 416 .setName(name. lower())413 .setName(name.convertToASCIILowercase()) 417 414 .setValue(propertyEntry.value) 418 415 .release(); -
trunk/Source/WebCore/inspector/NetworkResourcesData.cpp
r195452 r196080 142 142 if (!textEncodingName.isEmpty()) 143 143 decoder = TextResourceDecoder::create("text/plain", textEncodingName); 144 else if (DOMImplementation::isXMLMIMEType(mimeType .lower())) {144 else if (DOMImplementation::isXMLMIMEType(mimeType)) { 145 145 decoder = TextResourceDecoder::create("application/xml"); 146 146 decoder->useLenientXMLDecoding(); -
trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp
r195452 r196080 128 128 } 129 129 130 preflightRequest.setHTTPHeaderField(HTTPHeaderName::AccessControlRequestHeaders, headerBuffer.toString(). lower());130 preflightRequest.setHTTPHeaderField(HTTPHeaderName::AccessControlRequestHeaders, headerBuffer.toString().convertToASCIILowercase()); 131 131 } 132 132 -
trunk/Source/WebCore/loader/cache/CachedScript.cpp
r194529 r196080 67 67 String CachedScript::mimeType() const 68 68 { 69 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPHeaderName::ContentType)). lower();69 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPHeaderName::ContentType)).convertToASCIILowercase(); 70 70 } 71 71 -
trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
r196010 r196080 594 594 return languageCode; 595 595 596 String lowercaseLanguageCode = languageCode. lower();596 String lowercaseLanguageCode = languageCode.convertToASCIILowercase(); 597 597 598 598 // Need 2U here to disambiguate String::operator[] from operator(NSString*, int)[] in a production build. -
trunk/Source/WebCore/page/DOMWindow.cpp
r195694 r196080 2218 2218 } 2219 2219 2220 WindowFeatures windowFeatures(windowFeaturesString); 2221 RefPtr<Frame> result = createWindow(urlString, frameName, windowFeatures, activeWindow, *firstFrame, *m_frame); 2220 RefPtr<Frame> result = createWindow(urlString, frameName, parseWindowFeatures(windowFeaturesString), activeWindow, *firstFrame, *m_frame); 2222 2221 return result ? result->document()->domWindow() : nullptr; 2223 2222 } … … 2246 2245 return; 2247 2246 2248 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_frame->view())); 2249 RefPtr<Frame> dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, activeWindow, *firstFrame, *m_frame, WTFMove(prepareDialogFunction)); 2247 RefPtr<Frame> dialogFrame = createWindow(urlString, emptyAtom, parseDialogFeatures(dialogFeaturesString, screenAvailableRect(m_frame->view())), activeWindow, *firstFrame, *m_frame, WTFMove(prepareDialogFunction)); 2250 2248 if (!dialogFrame) 2251 2249 return; -
trunk/Source/WebCore/page/EventHandler.cpp
r195659 r196080 2167 2167 Element* element = is<Element>(*target) ? downcast<Element>(target) : target->parentElement(); 2168 2168 for (; element; element = element->parentElement()) { 2169 SpaceSplitString keywords(element->fastGetAttribute(webkitdropzoneAttr), true); 2169 2170 bool matched = false; 2170 String dropZoneStr = element->fastGetAttribute(webkitdropzoneAttr);2171 2172 if (dropZoneStr.isEmpty())2173 continue;2174 2175 dropZoneStr = dropZoneStr.lower();2176 2177 SpaceSplitString keywords(dropZoneStr, false);2178 if (keywords.isEmpty())2179 continue;2180 2181 2171 DragOperation dragOperation = DragOperationNone; 2182 for (unsigned i nt i = 0; i < keywords.size(); i++) {2172 for (unsigned i = 0, size = keywords.size(); i < size; ++i) { 2183 2173 DragOperation op = convertDropZoneOperationToDragOperation(keywords[i]); 2184 2174 if (op != DragOperationNone) { … … 2187 2177 } else 2188 2178 matched = matched || hasDropZoneType(*dataTransfer, keywords[i].string()); 2189 2190 2179 if (matched && dragOperation != DragOperationNone) 2191 2180 break; … … 2914 2903 } 2915 2904 2916 bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& ev t)2905 bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& event) 2917 2906 { 2918 2907 // FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do. … … 2921 2910 // Firefox only matches an access key if Shift is not pressed, and does that case-insensitively. 2922 2911 ASSERT(!(accessKeyModifiers() & PlatformEvent::ShiftKey)); 2923 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) 2924 return false; 2925 String key = evt.unmodifiedText(); 2926 Element* elem = m_frame.document()->getElementByAccessKey(key.lower()); 2927 if (!elem) 2928 return false; 2929 elem->accessKeyAction(false); 2912 if ((event.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) 2913 return false; 2914 Element* element = m_frame.document()->getElementByAccessKey(event.unmodifiedText()); 2915 if (!element) 2916 return false; 2917 element->accessKeyAction(false); 2930 2918 return true; 2931 2919 } -
trunk/Source/WebCore/page/OriginAccessEntry.cpp
r95901 r196080 37 37 38 38 OriginAccessEntry::OriginAccessEntry(const String& protocol, const String& host, SubdomainSetting subdomainSetting) 39 : m_protocol(protocol. lower())40 , m_host(host. lower())39 : m_protocol(protocol.convertToASCIILowercase()) 40 , m_host(host.convertToASCIILowercase()) 41 41 , m_subdomainSettings(subdomainSetting) 42 42 { … … 49 49 bool OriginAccessEntry::matchesOrigin(const SecurityOrigin& origin) const 50 50 { 51 ASSERT(origin.host() == origin.host(). lower());52 ASSERT(origin.protocol() == origin.protocol(). lower());51 ASSERT(origin.host() == origin.host().convertToASCIILowercase()); 52 ASSERT(origin.protocol() == origin.protocol().convertToASCIILowercase()); 53 53 54 54 if (m_protocol != origin.protocol()) -
trunk/Source/WebCore/page/SecurityOrigin.cpp
r195452 r196080 98 98 return true; 99 99 100 // SchemeRegistry needs a lower case protocol because it uses HashMaps 101 // that assume the scheme has already been canonicalized. 102 String protocol = innerURL.protocol().lower(); 103 104 if (SchemeRegistry::shouldTreatURLSchemeAsNoAccess(protocol)) 100 if (SchemeRegistry::shouldTreatURLSchemeAsNoAccess(innerURL.protocol())) 105 101 return true; 106 102 … … 110 106 111 107 SecurityOrigin::SecurityOrigin(const URL& url) 112 : m_protocol(url.protocol().isNull() ? emptyString() : url.protocol(). lower())113 , m_host(url.host().isNull() ? emptyString() : url.host(). lower())108 : m_protocol(url.protocol().isNull() ? emptyString() : url.protocol().convertToASCIILowercase()) 109 , m_host(url.host().isNull() ? emptyString() : url.host().convertToASCIILowercase()) 114 110 , m_port(url.port()) 115 111 , m_isUnique(false) … … 204 200 { 205 201 m_domainWasSetInDOM = true; 206 m_domain = newDomain. lower();202 m_domain = newDomain.convertToASCIILowercase(); 207 203 } 208 204 … … 355 351 return true; 356 352 357 String protocol = url.protocol().lower();358 359 353 if (isFeedWithNestedProtocolInHTTPFamily(url)) 360 354 return true; 355 356 String protocol = url.protocol(); 361 357 362 358 if (SchemeRegistry::canDisplayOnlyIfCanRequest(protocol)) … … 364 360 365 361 if (SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(protocol)) 366 return m_protocol == protocol|| SecurityPolicy::isAccessToURLWhiteListed(this, url);362 return equalIgnoringASCIICase(m_protocol, protocol) || SecurityPolicy::isAccessToURLWhiteListed(this, url); 367 363 368 364 if (SecurityPolicy::restrictAccessToLocal() && SchemeRegistry::shouldTreatURLSchemeAsLocal(protocol)) -
trunk/Source/WebCore/page/WindowFeatures.cpp
r188386 r196080 26 26 #include "FloatRect.h" 27 27 #include <wtf/Assertions.h> 28 #include <wtf/HashMap.h> 28 29 #include <wtf/MathExtras.h> 29 30 #include <wtf/text/StringHash.h> … … 31 32 namespace WebCore { 32 33 33 // Though isspace() considers \t and \v to be whitespace, Win IE doesn't when parsing window features. 34 static bool isWindowFeaturesSeparator(UChar c) 35 { 36 return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '=' || c == ',' || c == '\0'; 37 } 38 39 WindowFeatures::WindowFeatures(const String& features) 40 : resizable(true) 41 , fullscreen(false) 42 , dialog(false) 43 { 44 /* 45 The IE rule is: all features except for channelmode and fullscreen default to YES, but 46 if the user specifies a feature string, all features default to NO. (There is no public 47 standard that applies to this method.) 48 49 <http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp> 50 We always allow a window to be resized, which is consistent with Firefox. 51 */ 52 53 if (features.isEmpty()) { 54 menuBarVisible = true; 55 statusBarVisible = true; 56 toolBarVisible = true; 57 locationBarVisible = true; 58 scrollbarsVisible = true; 59 return; 34 typedef HashMap<String, String, ASCIICaseInsensitiveHash> DialogFeaturesMap; 35 36 static void setWindowFeature(WindowFeatures&, StringView key, StringView value); 37 38 static DialogFeaturesMap parseDialogFeaturesMap(const String&); 39 static Optional<bool> boolFeature(const DialogFeaturesMap&, const char* key); 40 static Optional<float> floatFeature(const DialogFeaturesMap&, const char* key, float min, float max); 41 42 static bool isSeparator(UChar character) 43 { 44 return character == ' ' || character == '\t' || character == '\n' || character == '\r' || character == '=' || character == ','; 45 } 46 47 WindowFeatures parseWindowFeatures(StringView featuresString) 48 { 49 // The IE rule is: all features except for channelmode and fullscreen default to YES, but 50 // if the user specifies a feature string, all features default to NO. (There is no public 51 // standard that applies to this method.) 52 // 53 // <http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp> 54 // We always allow a window to be resized, which is consistent with Firefox. 55 56 WindowFeatures features; 57 58 if (featuresString.isEmpty()) 59 return features; 60 61 features.menuBarVisible = false; 62 features.statusBarVisible = false; 63 features.toolBarVisible = false; 64 features.locationBarVisible = false; 65 features.scrollbarsVisible = false; 66 67 processFeaturesString(featuresString, [&features](StringView key, StringView value) { 68 setWindowFeature(features, key, value); 69 }); 70 71 return features; 72 } 73 74 void processFeaturesString(StringView features, std::function<void(StringView type, StringView value)> callback) 75 { 76 unsigned length = features.length(); 77 for (unsigned i = 0; i < length; ) { 78 // skip to first non-separator 79 while (i < length && isSeparator(features[i])) 80 ++i; 81 unsigned keyBegin = i; 82 83 // skip to first separator 84 while (i < length && !isSeparator(features[i])) 85 i++; 86 unsigned keyEnd = i; 87 88 // skip to first '=', but don't skip past a ',' 89 while (i < length && features[i] != '=' && features[i] != ',') 90 ++i; 91 92 // skip to first non-separator, but don't skip past a ',' 93 while (i < length && isSeparator(features[i]) && features[i] != ',') 94 ++i; 95 unsigned valueBegin = i; 96 97 // skip to first separator 98 while (i < length && !isSeparator(features[i])) 99 ++i; 100 unsigned valueEnd = i; 101 102 callback(features.substring(keyBegin, keyEnd - keyBegin), features.substring(valueBegin, valueEnd - valueBegin)); 60 103 } 61 62 menuBarVisible = false; 63 statusBarVisible = false; 64 toolBarVisible = false; 65 locationBarVisible = false; 66 scrollbarsVisible = false; 67 68 // Tread lightly in this code -- it was specifically designed to mimic Win IE's parsing behavior. 69 unsigned keyBegin, keyEnd; 70 unsigned valueBegin, valueEnd; 71 72 String buffer = features.lower(); 73 unsigned length = buffer.length(); 74 for (unsigned i = 0; i < length; ) { 75 // skip to first non-separator, but don't skip past the end of the string 76 while (isWindowFeaturesSeparator(buffer[i])) { 77 if (i >= length) 78 break; 79 i++; 80 } 81 keyBegin = i; 82 83 // skip to first separator 84 while (!isWindowFeaturesSeparator(buffer[i])) 85 i++; 86 keyEnd = i; 87 88 // skip to first '=', but don't skip past a ',' or the end of the string 89 while (buffer[i] != '=') { 90 if (buffer[i] == ',' || i >= length) 91 break; 92 i++; 93 } 94 95 // skip to first non-separator, but don't skip past a ',' or the end of the string 96 while (isWindowFeaturesSeparator(buffer[i])) { 97 if (buffer[i] == ',' || i >= length) 98 break; 99 i++; 100 } 101 valueBegin = i; 102 103 // skip to first separator 104 while (!isWindowFeaturesSeparator(buffer[i])) 105 i++; 106 valueEnd = i; 107 108 ASSERT_WITH_SECURITY_IMPLICATION(i <= length); 109 110 String keyString(buffer.substring(keyBegin, keyEnd - keyBegin)); 111 String valueString(buffer.substring(valueBegin, valueEnd - valueBegin)); 112 setWindowFeature(keyString, valueString); 113 } 114 } 115 116 void WindowFeatures::setWindowFeature(const String& keyString, const String& valueString) 117 { 118 int value; 119 104 } 105 106 static void setWindowFeature(WindowFeatures& features, StringView key, StringView value) 107 { 120 108 // Listing a key with no value is shorthand for key=yes 121 if (valueString.isEmpty() || valueString == "yes") 122 value = 1; 109 int numericValue; 110 if (value.isEmpty() || equalLettersIgnoringASCIICase(value, "yes")) 111 numericValue = 1; 123 112 else 124 value = valueString.toInt();125 126 // We treat key Stringof "resizable" here as an additional feature rather than setting resizeable to true.113 numericValue = value.toInt(); 114 115 // We treat key of "resizable" here as an additional feature rather than setting resizeable to true. 127 116 // This is consistent with Firefox, but could also be handled at another level. 128 117 129 if (keyString == "left" || keyString == "screenx") 130 x = value; 131 else if (keyString == "top" || keyString == "screeny") 132 y = value; 133 else if (keyString == "width" || keyString == "innerwidth") 134 width = value; 135 else if (keyString == "height" || keyString == "innerheight") 136 height = value; 137 else if (keyString == "menubar") 138 menuBarVisible = value; 139 else if (keyString == "toolbar") 140 toolBarVisible = value; 141 else if (keyString == "location") 142 locationBarVisible = value; 143 else if (keyString == "status") 144 statusBarVisible = value; 145 else if (keyString == "fullscreen") 146 fullscreen = value; 147 else if (keyString == "scrollbars") 148 scrollbarsVisible = value; 149 else if (value == 1) 150 additionalFeatures.append(keyString); 151 } 152 153 WindowFeatures::WindowFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect) 154 : menuBarVisible(false) 155 , toolBarVisible(false) 156 , locationBarVisible(false) 157 , fullscreen(false) 158 , dialog(true) 159 { 160 auto features = parseDialogFeatures(dialogFeaturesString); 161 162 const bool trusted = false; 118 if (equalLettersIgnoringASCIICase(key, "left") || equalLettersIgnoringASCIICase(key, "screenx")) 119 features.x = numericValue; 120 else if (equalLettersIgnoringASCIICase(key, "top") || equalLettersIgnoringASCIICase(key, "screeny")) 121 features.y = numericValue; 122 else if (equalLettersIgnoringASCIICase(key, "width") || equalLettersIgnoringASCIICase(key, "innerwidth")) 123 features.width = numericValue; 124 else if (equalLettersIgnoringASCIICase(key, "height") || equalLettersIgnoringASCIICase(key, "innerheight")) 125 features.height = numericValue; 126 else if (equalLettersIgnoringASCIICase(key, "menubar")) 127 features.menuBarVisible = numericValue; 128 else if (equalLettersIgnoringASCIICase(key, "toolbar")) 129 features.toolBarVisible = numericValue; 130 else if (equalLettersIgnoringASCIICase(key, "location")) 131 features.locationBarVisible = numericValue; 132 else if (equalLettersIgnoringASCIICase(key, "status")) 133 features.statusBarVisible = numericValue; 134 else if (equalLettersIgnoringASCIICase(key, "fullscreen")) 135 features.fullscreen = numericValue; 136 else if (equalLettersIgnoringASCIICase(key, "scrollbars")) 137 features.scrollbarsVisible = numericValue; 138 else if (numericValue == 1) 139 features.additionalFeatures.append(key.toString()); 140 } 141 142 WindowFeatures parseDialogFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect) 143 { 144 auto featuresMap = parseDialogFeaturesMap(dialogFeaturesString); 163 145 164 146 // The following features from Microsoft's documentation are not implemented: … … 170 152 // - unadorned: trusted && boolFeature(features, "unadorned"); 171 153 172 width = floatFeature(features, "dialogwidth", 100, screenAvailableRect.width(), 620); // default here came from frame size of dialog in MacIE 173 height = floatFeature(features, "dialogheight", 100, screenAvailableRect.height(), 450); // default here came from frame size of dialog in MacIE 174 175 auto dialogLeft = floatFeature(features, "dialogleft", screenAvailableRect.x(), screenAvailableRect.maxX() - *width, -1); 176 if (dialogLeft > 0) 177 x = dialogLeft; 178 179 auto dialogTop = floatFeature(features, "dialogtop", screenAvailableRect.y(), screenAvailableRect.maxY() - *height, -1); 180 if (dialogTop > 0) 181 y = dialogTop; 182 183 if (boolFeature(features, "center", true)) { 184 if (!x) 185 x = screenAvailableRect.x() + (screenAvailableRect.width() - *width) / 2; 186 187 if (!y) 188 y = screenAvailableRect.y() + (screenAvailableRect.height() - *height) / 2; 154 WindowFeatures features; 155 156 features.menuBarVisible = false; 157 features.toolBarVisible = false; 158 features.locationBarVisible = false; 159 features.dialog = true; 160 161 float width = floatFeature(featuresMap, "dialogwidth", 100, screenAvailableRect.width()).valueOr(620); // default here came from frame size of dialog in MacIE 162 float height = floatFeature(featuresMap, "dialogheight", 100, screenAvailableRect.height()).valueOr(450); // default here came from frame size of dialog in MacIE 163 164 features.width = width; 165 features.height = height; 166 167 features.x = floatFeature(featuresMap, "dialogleft", screenAvailableRect.x(), screenAvailableRect.maxX() - width); 168 features.y = floatFeature(featuresMap, "dialogtop", screenAvailableRect.y(), screenAvailableRect.maxY() - height); 169 170 if (boolFeature(featuresMap, "center").valueOr(true)) { 171 if (!features.x) 172 features.x = screenAvailableRect.x() + (screenAvailableRect.width() - width) / 2; 173 if (!features.y) 174 features.y = screenAvailableRect.y() + (screenAvailableRect.height() - height) / 2; 189 175 } 190 176 191 resizable = boolFeature(features, "resizable"); 192 scrollbarsVisible = boolFeature(features, "scroll", true); 193 statusBarVisible = boolFeature(features, "status", !trusted); 194 } 195 196 bool WindowFeatures::boolFeature(const HashMap<String, String>& features, const char* key, bool defaultValue) 177 features.resizable = boolFeature(featuresMap, "resizable").valueOr(false); 178 features.scrollbarsVisible = boolFeature(featuresMap, "scroll").valueOr(true); 179 features.statusBarVisible = boolFeature(featuresMap, "status").valueOr(false); 180 181 return features; 182 } 183 184 static Optional<bool> boolFeature(const DialogFeaturesMap& features, const char* key) 197 185 { 198 186 auto it = features.find(key); 199 187 if (it == features.end()) 200 return defaultValue; 201 202 const String& value = it->value; 203 return value.isNull() || value == "1" || value == "yes" || value == "on"; 204 } 205 206 float WindowFeatures::floatFeature(const HashMap<String, String>& features, const char* key, float min, float max, float defaultValue) 188 return Nullopt; 189 190 auto& value = it->value; 191 return value.isNull() 192 || value == "1" 193 || equalLettersIgnoringASCIICase(value, "yes") 194 || equalLettersIgnoringASCIICase(value, "on"); 195 } 196 197 static Optional<float> floatFeature(const DialogFeaturesMap& features, const char* key, float min, float max) 207 198 { 208 199 auto it = features.find(key); 209 200 if (it == features.end()) 210 return defaultValue;201 return Nullopt; 211 202 212 203 // FIXME: The toDouble function does not offer a way to tell "0q" from string with no digits in it: Both … … 215 206 double parsedNumber = it->value.toDouble(&ok); 216 207 if ((!parsedNumber && !ok) || std::isnan(parsedNumber)) 217 return defaultValue;208 return Nullopt; 218 209 if (parsedNumber < min || max <= min) 219 210 return min; … … 225 216 } 226 217 227 HashMap<String, String> WindowFeatures::parseDialogFeatures(const String& string) 228 { 229 HashMap<String, String> features; 218 static DialogFeaturesMap parseDialogFeaturesMap(const String& string) 219 { 220 // FIXME: Not clear why we take such a different approach to parsing dialog features 221 // as opposed to window features (using a map, different parsing quirks). 222 223 DialogFeaturesMap features; 230 224 231 225 Vector<String> vector; … … 240 234 separatorPosition = colonPosition; 241 235 242 String key = featureString.left(separatorPosition).stripWhiteSpace() .lower();236 String key = featureString.left(separatorPosition).stripWhiteSpace(); 243 237 244 238 // Null string for value indicates key without value. 245 239 String value; 246 240 if (separatorPosition != notFound) { 247 value = featureString.substring(separatorPosition + 1).stripWhiteSpace() .lower();241 value = featureString.substring(separatorPosition + 1).stripWhiteSpace(); 248 242 value = value.left(value.find(' ')); 249 243 } -
trunk/Source/WebCore/page/WindowFeatures.h
r188386 r196080 1 1 /* 2 * Copyright (C) 2003, 2007, 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2003, 2007, 2010, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #define WindowFeatures_h 31 31 32 #include <wtf/Forward.h> 33 #include <wtf/HashMap.h> 32 #include <functional> 34 33 #include <wtf/Optional.h> 35 34 #include <wtf/Vector.h> 36 #include <wtf/text/ StringHash.h>35 #include <wtf/text/WTFString.h> 37 36 38 37 namespace WebCore { … … 41 40 42 41 struct WindowFeatures { 43 WindowFeatures()44 : menuBarVisible(true)45 , statusBarVisible(true)46 , toolBarVisible(true)47 , locationBarVisible(true)48 , scrollbarsVisible(true)49 , resizable(true)50 , fullscreen(false)51 , dialog(false)52 {53 }54 explicit WindowFeatures(const String& windowFeaturesString);55 WindowFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect);56 57 42 Optional<float> x; 58 43 Optional<float> y; … … 60 45 Optional<float> height; 61 46 62 bool menuBarVisible ;63 bool statusBarVisible ;64 bool toolBarVisible ;65 bool locationBarVisible ;66 bool scrollbarsVisible ;67 bool resizable ;47 bool menuBarVisible { true }; 48 bool statusBarVisible { true }; 49 bool toolBarVisible { true }; 50 bool locationBarVisible { true }; 51 bool scrollbarsVisible { true }; 52 bool resizable { true }; 68 53 69 bool fullscreen ;70 bool dialog ;54 bool fullscreen { false }; 55 bool dialog { false }; 71 56 72 57 Vector<String> additionalFeatures; 58 }; 73 59 74 private: 75 static HashMap<String, String> parseDialogFeatures(const String&); 76 static bool boolFeature(const HashMap<String, String>&, const char* key, bool defaultValue = false); 77 static float floatFeature(const HashMap<String, String>&, const char* key, float min, float max, float defaultValue); 78 void setWindowFeature(const String& keyString, const String& valueString); 79 }; 60 WindowFeatures parseWindowFeatures(StringView windowFeaturesString); 61 WindowFeatures parseDialogFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect); 62 63 void processFeaturesString(StringView features, std::function<void(StringView type, StringView value)> callback); 80 64 81 65 } // namespace WebCore -
trunk/Source/WebCore/platform/SchemeRegistry.cpp
r195951 r196080 127 127 void SchemeRegistry::removeURLSchemeRegisteredAsLocal(const String& scheme) 128 128 { 129 if ( scheme == "file")129 if (equalLettersIgnoringASCIICase(scheme, "file")) 130 130 return; 131 131 #if PLATFORM(COCOA) 132 if ( scheme == "applewebdata")132 if (equalLettersIgnoringASCIICase(scheme, "applewebdata")) 133 133 return; 134 134 #endif -
trunk/Source/WebCore/platform/efl/MIMETypeRegistryEfl.cpp
r187206 r196080 31 31 #include "config.h" 32 32 #include "MIMETypeRegistry.h" 33 34 #include "NotImplemented.h"35 #include <wtf/Assertions.h>36 #include <wtf/MainThread.h>37 33 38 34 namespace WebCore { … … 75 71 { "wml", "text/vnd.wap.wml" }, 76 72 { "wmlc", "application/vnd.wap.wmlc" }, 77 { 0, 0 }78 73 }; 79 74 80 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)75 String MIMETypeRegistry::getMIMETypeForExtension(const String& extension) 81 76 { 82 ASSERT(isMainThread()); 83 84 String s = ext.lower(); 85 const ExtensionMap *e = extensionMap; 86 while (e->extension) { 87 if (s == e->extension) 88 return e->mimeType; 89 ++e; 77 for (auto& entry : extensionMap) { 78 if (equalIgnoringASCIICase(extension, entry.extension)) 79 return entry.mimeType; 90 80 } 91 92 81 return String(); 93 82 } -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r195951 r196080 325 325 ASSERT(!m_reloadTimer.isActive()); 326 326 327 m_contentMIMEType = contentType.type(). lower();327 m_contentMIMEType = contentType.type().convertToASCIILowercase(); 328 328 m_contentTypeCodecs = contentType.parameter(codecs()); 329 329 m_url = url; 330 m_keySystem = keySystem. lower();330 m_keySystem = keySystem.convertToASCIILowercase(); 331 331 m_contentMIMETypeWasInferredFromExtension = false; 332 332 … … 367 367 368 368 m_mediaSource = mediaSource; 369 m_contentMIMEType = contentType.type(). lower();369 m_contentMIMEType = contentType.type().convertToASCIILowercase(); 370 370 m_contentTypeCodecs = contentType.parameter(codecs()); 371 371 m_url = url; … … 518 518 MediaPlayer::MediaKeyException MediaPlayer::generateKeyRequest(const String& keySystem, const unsigned char* initData, unsigned initDataLength) 519 519 { 520 return m_private->generateKeyRequest(keySystem. lower(), initData, initDataLength);520 return m_private->generateKeyRequest(keySystem.convertToASCIILowercase(), initData, initDataLength); 521 521 } 522 522 523 523 MediaPlayer::MediaKeyException MediaPlayer::addKey(const String& keySystem, const unsigned char* key, unsigned keyLength, const unsigned char* initData, unsigned initDataLength, const String& sessionId) 524 524 { 525 return m_private->addKey(keySystem. lower(), key, keyLength, initData, initDataLength, sessionId);525 return m_private->addKey(keySystem.convertToASCIILowercase(), key, keyLength, initData, initDataLength, sessionId); 526 526 } 527 527 528 528 MediaPlayer::MediaKeyException MediaPlayer::cancelKeyRequest(const String& keySystem, const String& sessionId) 529 529 { 530 return m_private->cancelKeyRequest(keySystem. lower(), sessionId);530 return m_private->cancelKeyRequest(keySystem.convertToASCIILowercase(), sessionId); 531 531 } 532 532 #endif -
trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
r196039 r196080 66 66 67 67 Vector<String> vendorComponents; 68 m_vendor. lower().split(' ', vendorComponents);68 m_vendor.convertToASCIILowercase().split(' ', vendorComponents); 69 69 if (vendorComponents.contains("nvidia")) 70 70 m_isNVIDIA = true; -
trunk/Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp
r186581 r196080 28 28 #include "config.h" 29 29 #include "MIMETypeRegistry.h" 30 31 #include <wtf/Assertions.h>32 #include <wtf/MainThread.h>33 30 34 31 namespace WebCore { … … 62 59 { "wml", "text/vnd.wap.wml" }, 63 60 { "wmlc", "application/vnd.wap.wmlc" }, 64 { 0, 0 }65 61 }; 66 62 67 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)63 String MIMETypeRegistry::getMIMETypeForExtension(const String& extension) 68 64 { 69 ASSERT(isMainThread()); 70 71 String s = ext.lower(); 72 const ExtensionMap *e = extensionMap; 73 while (e->extension) { 74 if (s == e->extension) 75 return e->mimeType; 76 ++e; 65 for (auto& entry : extensionMap) { 66 if (equalIgnoringASCIICase(extension, entry.extension)) 67 return entry.mimeType; 77 68 } 78 79 69 return String(); 80 70 } -
trunk/Source/WebCore/platform/mac/PasteboardMac.mm
r195452 r196080 418 418 { 419 419 // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dom-datatransfer-setdata 420 String qType = type.lower(); 421 422 if (qType == "text") 423 qType = ASCIILiteral("text/plain"); 424 if (qType == "url") 425 qType = ASCIILiteral("text/uri-list"); 426 427 // Ignore any trailing charset - JS strings are Unicode, which encapsulates the charset issue 428 if (qType == "text/plain" || qType.startsWith("text/plain;")) 429 return String(NSStringPboardType); 430 if (qType == "text/uri-list") 431 // special case because UTI doesn't work with Cocoa's URL type 432 return String(NSURLPboardType); // note special case in getData to read NSFilenamesType 433 434 // Blacklist types that might contain subframe information 435 if (qType == "text/rtf" || qType == "public.rtf" || qType == "com.apple.traditional-mac-plain-text") 420 String lowercasedType = type.convertToASCIILowercase(); 421 422 if (lowercasedType == "text") 423 lowercasedType = ASCIILiteral("text/plain"); 424 if (lowercasedType == "url") 425 lowercasedType = ASCIILiteral("text/uri-list"); 426 427 // Ignore any trailing charset - strings are already UTF-16, and the charset issue has already been dealt with. 428 if (lowercasedType == "text/plain" || lowercasedType.startsWith("text/plain;")) 429 return NSStringPboardType; 430 if (lowercasedType == "text/uri-list") { 431 // Special case because UTI doesn't work with Cocoa's URL type. 432 return NSURLPboardType; 433 } 434 435 // Blacklist types that might contain subframe information. 436 if (lowercasedType == "text/rtf" || lowercasedType == "public.rtf" || lowercasedType == "com.apple.traditional-mac-plain-text") 436 437 return String(); 437 438 438 // Try UTI now 439 String mimeType = qType; 440 if (RetainPtr<CFStringRef> utiType = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType.createCFString().get(), NULL))) { 441 RetainPtr<CFStringRef> pbType = adoptCF(UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassNSPboardType)); 442 if (pbType) 439 if (auto utiType = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, lowercasedType.createCFString().get(), NULL))) { 440 if (auto pbType = adoptCF(UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassNSPboardType))) 443 441 return pbType.get(); 444 442 } 445 443 446 444 // No mapping, just pass the whole string though 447 return qType;445 return lowercasedType; 448 446 } 449 447
Note: See TracChangeset
for help on using the changeset viewer.