WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Work in progress
bug-39802-20100526183438.patch (text/plain), 4.58 KB, created by
Adam Barth
on 2010-05-26 18:34:40 PDT
(
hide
)
Description:
Work in progress
Filename:
MIME Type:
Creator:
Adam Barth
Created:
2010-05-26 18:34:40 PDT
Size:
4.58 KB
patch
obsolete
>diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog >index 649478d53192df77cfc078816cd314ec8f85e823..6da6b5998fbdb9a185b493c486f34ebebf3cf21a 100644 >--- a/WebCore/ChangeLog >+++ b/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2010-05-26 Adam Barth <abarth@webkit.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Implement SegmentedString::lookAheadSlowCase >+ https://bugs.webkit.org/show_bug.cgi?id=39802 >+ >+ No new tests. (OOPS!) >+ >+ * platform/text/SegmentedString.cpp: >+ (WebCore::SegmentedString::advance): >+ (WebCore::SegmentedString::lookAheadIgnoringCaseSlowCase): >+ * platform/text/SegmentedString.h: >+ (WebCore::SegmentedString::lookAhead): >+ (WebCore::SegmentedString::lookAheadIgnoringCase): >+ (WebCore::SegmentedString::lookAheadSlowCase): >+ > 2010-05-26 Anders Carlsson <andersca@apple.com> > > Fix GTK+ test failures. >diff --git a/WebCore/platform/text/SegmentedString.cpp b/WebCore/platform/text/SegmentedString.cpp >index f2760deaf925f0d8f1f8376788f3c28b5bcdd37f..037e4f99224d9868107cabf61114f6cd630754ab 100644 >--- a/WebCore/platform/text/SegmentedString.cpp >+++ b/WebCore/platform/text/SegmentedString.cpp >@@ -179,6 +179,30 @@ String SegmentedString::toString() const > return result; > } > >+void SegmentedString::advance(unsigned count, Vector<UChar>& consumedCharacters) >+{ >+ ASSERT(count < length()); >+ for (int i = 0; i < length; ++i) { >+ ASSERT(!isEmpty()); >+ consumedCharacters.append(*this); >+ advance(); >+ } >+ ASSERT(consumedCharacters.length() == count); >+} >+ >+LookAheadResult SegmentedString::lookAheadIgnoringCaseSlowCase(const String& string) >+{ >+ if (string.length() < length()) >+ return NotEnoughCharacters; >+ Vector<UChar> futureCharacters; >+ advance(string.length(), futureCharacters); >+ LookAheadResult result = DidMatch; >+ if (ucasecmp(string.characters(), futureCharacters.data(), length * sizeof(UChar))) >+ result = DidNotMatch; >+ prepend(String::adopt(futureCharacters)); >+ return result; >+} >+ > void SegmentedString::advanceSlowCase() > { > if (m_pushedChar1) { >diff --git a/WebCore/platform/text/SegmentedString.h b/WebCore/platform/text/SegmentedString.h >index 28bba415f9f109dc6c2d2d9d8b686e2687d5305c..fd75e179439a692b323ae922114f1e6c2bdbddbd 100644 >--- a/WebCore/platform/text/SegmentedString.h >+++ b/WebCore/platform/text/SegmentedString.h >@@ -112,7 +112,6 @@ public: > NotEnoughCharacters, > }; > >- // WARNING: This method is currently used only by the HTML5 parser and is incomplete. > LookAheadResult lookAhead(const String& string) > { > if (!m_pushedChar1 && string.length() <= (unsigned) m_currentString.m_length) { >@@ -120,12 +119,9 @@ public: > return DidNotMatch; > return DidMatch; > } >- // We haven't implemented the slow case yet. >- ASSERT_NOT_REACHED(); >- return DidNotMatch; >+ return lookAheadSlowCase<memcmp>(string); > } > >- // WARNING: This method is currently used only by the HTML5 parser and is incomplete. > LookAheadResult lookAheadIgnoringCase(const String& string) > { > if (!m_pushedChar1 && string.length() <= (unsigned) m_currentString.m_length) { >@@ -133,9 +129,7 @@ public: > return DidNotMatch; > return DidMatch; > } >- // We haven't implemented the slow case yet. >- ASSERT_NOT_REACHED(); >- return DidNotMatch; >+ return lookAheadSlowCase<WTF::Unicode::umemcasecmp>(string); > } > > void advance() >@@ -193,9 +187,11 @@ public: > } > advanceSlowCase(lineNumber); > } >- >+ >+ void advance(unsigned count, Vector<UChar>& consumedCharacters); >+ > bool escaped() const { return m_pushedChar1; } >- >+ > String toString() const; > > const UChar& operator*() const { return *current(); } >@@ -210,6 +206,20 @@ private: > void advanceSubstring(); > const UChar* current() const { return m_currentChar; } > >+ template<int compare(const void* ptr1, const void* ptr2, size_t num)> >+ LookAheadResult lookAheadSlowCase(const String& string) >+ { >+ if (string.length() < length()) >+ return NotEnoughCharacters; >+ Vector<UChar> futureCharacters; >+ advance(string.length(), futureCharacters); >+ LookAheadResult result = DidMatch; >+ if (compare(string.characters(), futureCharacters.data(), length * sizeof(UChar))) >+ result = DidNotMatch; >+ prepend(String::adopt(futureCharacters)); >+ return result; >+ } >+ > UChar m_pushedChar1; > UChar m_pushedChar2; > SegmentedSubstring m_currentString;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 39802
:
57184
|
57187
|
57191
|
57198