Changeset 67423 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Sep 13, 2010, 4:42:02 PM (15 years ago)
Author:
Darin Adler
Message:

2010-09-13 Darin Adler <Darin Adler>

Reviewed by Adam Barth.

Preparation for eliminating deprecatedParseURL
https://bugs.webkit.org/show_bug.cgi?id=45695

  • wtf/text/WTFString.h: Added isAllSpecialCharacters, moved here from the HTML tree builder.

2010-09-13 Darin Adler <Darin Adler>

Reviewed by Adam Barth.

Preparation for eliminating deprecatedParseURL
https://bugs.webkit.org/show_bug.cgi?id=45695

  • DOM/WebDOMOperations.mm: (-[DOMDocument webFrame]): Get rid of unneeded local variable. (-[DOMDocument URLWithAttributeString:]): Remove unhelpful comment.

2010-09-13 Darin Adler <Darin Adler>

Reviewed by Adam Barth.

Preparation for eliminating deprecatedParseURL
https://bugs.webkit.org/show_bug.cgi?id=45695

Added new HTMLParserIdioms source file, with a name inspired by the HTML
specification, which has a section defining things like "space character"
that talks about common parser idioms. These are idioms for the main HTML
parser and for parsers for various microlanguages as well.

  • Android.mk:
  • CMakeLists.txt:
  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj: Added HTMLParserIdioms.
  • css/CSSHelper.h: Fixed indentation and comments here. Point to the new stripLeadingAndTrailingHTMLSpaces function.
  • html/parser/HTMLParserIdioms.cpp: Added.
  • html/parser/HTMLParserIdioms.h: Added.
  • html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::skipLeadingWhitespace): (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeLeadingWhitespace): (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeLeadingNonWhitespace): (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace): Updated for name changes.
  • html/parser/HTMLTreeBuilder.h: Moved functions to HTMLParserIdioms.h.
  • html/HTMLInputElement.cpp:
  • html/HTMLMeterElement.cpp:
  • html/HTMLProgressElement.cpp:
  • html/StepRange.cpp:
  • rendering/RenderSlider.cpp: Updated includes.
  • svg/SVGImageLoader.cpp: (WebCore::SVGImageLoader::sourceURI): Fixed incorrect use of deprecatedParseURL. This is for use on the attribute value before building the URL, not on the URL after building it. I did not add a test case; this is an obscure corner and soon we will be moving to stripLeadingAndTrailingHTMLSpaces anyway.
  • wml/WMLImageLoader.cpp: (WebCore::WMLImageLoader::sourceURI): Ditto.
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r67401 r67423  
     12010-09-13  Darin Adler  <[email protected]>
     2
     3        Reviewed by Adam Barth.
     4
     5        Preparation for eliminating deprecatedParseURL
     6        https://bugs.webkit.org/show_bug.cgi?id=45695
     7
     8        * wtf/text/WTFString.h: Added isAllSpecialCharacters, moved here from
     9        the HTML tree builder.
     10
    1112010-09-13  Darin Fisher  <[email protected]>
    212
  • trunk/JavaScriptCore/wtf/text/WTFString.h

    r66159 r67423  
    5454
    5555class CString;
     56struct StringHash;
    5657
    5758// Declarations of string operations
     
    7273double charactersToDouble(const UChar*, size_t, bool* ok = 0);
    7374float charactersToFloat(const UChar*, size_t, bool* ok = 0);
     75
     76template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters(const UChar*, size_t);
    7477
    7578class String {
     
    221224
    222225    String removeCharacters(CharacterMatchFunctionPtr) const;
     226    template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters() const;
    223227
    224228    // Return the string with case folded for case insensitive comparison.
     
    424428}
    425429
    426 struct StringHash;
     430template<bool isSpecialCharacter(UChar)> inline bool isAllSpecialCharacters(const UChar* characters, size_t length)
     431{
     432    for (size_t i = 0; i < length; ++i) {
     433        if (!isSpecialCharacter(characters[i]))
     434            return false;
     435    }
     436    return true;
     437}
     438
     439template<bool isSpecialCharacter(UChar)> inline bool String::isAllSpecialCharacters() const
     440{
     441    return WTF::isAllSpecialCharacters<isSpecialCharacter>(characters(), length());
     442}
    427443
    428444// StringHash is the default hash for String
     
    441457using WTF::CString;
    442458using WTF::String;
    443 
    444 using WTF::isSpaceOrNewline;
    445 using WTF::find;
    446 using WTF::reverseFind;
    447459using WTF::append;
    448460using WTF::appendNumber;
     461using WTF::charactersAreAllASCII;
     462using WTF::charactersToDouble;
     463using WTF::charactersToFloat;
     464using WTF::charactersToInt;
    449465using WTF::equal;
    450466using WTF::equalIgnoringCase;
    451 using WTF::charactersAreAllASCII;
    452 using WTF::charactersToInt;
    453 using WTF::charactersToFloat;
    454 using WTF::charactersToDouble;
    455 
    456 #endif
     467using WTF::find;
     468using WTF::isAllSpecialCharacters;
     469using WTF::isSpaceOrNewline;
     470using WTF::reverseFind;
     471
     472#endif
Note: See TracChangeset for help on using the changeset viewer.