diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
commit | 8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch) | |
tree | 17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebCore/platform/text/TextBreakIterator.h | |
parent | b9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff) |
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well
as the previously cherry-picked changes
Diffstat (limited to 'Source/WebCore/platform/text/TextBreakIterator.h')
-rw-r--r-- | Source/WebCore/platform/text/TextBreakIterator.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/Source/WebCore/platform/text/TextBreakIterator.h b/Source/WebCore/platform/text/TextBreakIterator.h index ac49fb467..de43d0db7 100644 --- a/Source/WebCore/platform/text/TextBreakIterator.h +++ b/Source/WebCore/platform/text/TextBreakIterator.h @@ -38,6 +38,7 @@ namespace WebCore { TextBreakIterator* cursorMovementIterator(const UChar*, int length); TextBreakIterator* wordBreakIterator(const UChar*, int length); + TextBreakIterator* acquireLineBreakIterator(const LChar*, int length, const AtomicString& locale); TextBreakIterator* acquireLineBreakIterator(const UChar*, int length, const AtomicString& locale); void releaseLineBreakIterator(TextBreakIterator*); TextBreakIterator* sentenceBreakIterator(const UChar*, int length); @@ -56,9 +57,13 @@ namespace WebCore { class LazyLineBreakIterator { public: - LazyLineBreakIterator(const UChar* string = 0, int length = 0, const AtomicString& locale = AtomicString()) + LazyLineBreakIterator() + : m_iterator(0) + { + } + + LazyLineBreakIterator(String string, const AtomicString& locale = AtomicString()) : m_string(string) - , m_length(length) , m_locale(locale) , m_iterator(0) { @@ -70,30 +75,31 @@ public: releaseLineBreakIterator(m_iterator); } - const UChar* string() const { return m_string; } - int length() const { return m_length; } + String string() const { return m_string; } TextBreakIterator* get() { - if (!m_iterator) - m_iterator = acquireLineBreakIterator(m_string, m_length, m_locale); + if (!m_iterator) { + if (m_string.is8Bit()) + m_iterator = acquireLineBreakIterator(m_string.characters8(), m_string.length(), m_locale); + else + m_iterator = acquireLineBreakIterator(m_string.characters16(), m_string.length(), m_locale); + } return m_iterator; } - void reset(const UChar* string, int length, const AtomicString& locale) + void reset(String string, const AtomicString& locale) { if (m_iterator) releaseLineBreakIterator(m_iterator); m_string = string; - m_length = length; m_locale = locale; m_iterator = 0; } private: - const UChar* m_string; - int m_length; + String m_string; AtomicString m_locale; TextBreakIterator* m_iterator; }; |