+2013-02-26 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r144019.
+ http://trac.webkit.org/changeset/144019
+ https://bugs.webkit.org/show_bug.cgi?id=110892
+
+ due to 8% perf regression on chromium-win7 intl1 page cycler,
+ see https://bugs.webkit.org/show_bug.cgi?id=110872 (Requested
+ by gasubic on #webkit).
+
+ * platform/mac/TestExpectations:
+
2013-02-26 Stephen Chenney <schenney@chromium.org>
[Chromium] New baselines for css3-modsel-15c
# User Timing is not enable yet. so skip it.
webkit.org/b/84893 http/tests/w3c/webperf/submission/Intel/user-timing [ Skip ]
-# Verified passing, so override generic skip
-webkit.org/b/89235 css3/line-break [ Pass ]
-
# Expected to fail until WebGL extension implementation lands
webkit.org/b/98257 fast/canvas/webgl/oes-element-index-uint.html [ Failure Pass ]
+2013-02-26 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r144019.
+ http://trac.webkit.org/changeset/144019
+ https://bugs.webkit.org/show_bug.cgi?id=110892
+
+ due to 8% perf regression on chromium-win7 intl1 page cycler,
+ see https://bugs.webkit.org/show_bug.cgi?id=110872 (Requested
+ by gasubic on #webkit).
+
+ * platform/text/LineBreakIteratorPoolICU.h:
+ (WebCore::LineBreakIteratorPool::take):
+ (WebCore::LineBreakIteratorPool::put):
+ (LineBreakIteratorPool):
+ * platform/text/TextBreakIterator.h:
+ (WebCore):
+ (WebCore::LazyLineBreakIterator::LazyLineBreakIterator):
+ (WebCore::LazyLineBreakIterator::get):
+ (WebCore::LazyLineBreakIterator::reset):
+ (LazyLineBreakIterator):
+ * platform/text/TextBreakIteratorICU.cpp:
+ (WebCore::acquireLineBreakIterator):
+ (WebCore::releaseLineBreakIterator):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::LineBreaker::nextSegmentBreak):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::computePreferredLogicalWidths):
+ * rendering/RenderText.h:
+ (WebCore):
+ * rendering/break_lines.cpp:
+ (WebCore):
+ (WebCore::isBreakableSpace):
+ (WebCore::needsLineBreakIterator):
+ (WebCore::nextBreakablePosition):
+ (WebCore::nextBreakablePositionIgnoringNBSP):
+ * rendering/break_lines.h:
+ (WebCore):
+ (WebCore::isBreakable):
+
2013-02-26 Dana Jansens <danakj@chromium.org>
Create the SharedGraphicsContext3D through its own method.
#ifndef LineBreakIteratorPoolICU_h
#define LineBreakIteratorPoolICU_h
-#include "TextBreakIterator.h"
#include "TextBreakIteratorInternalICU.h"
+#include <unicode/ubrk.h>
#include <wtf/Assertions.h>
#include <wtf/HashMap.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/ThreadSpecific.h>
#include <wtf/text/AtomicString.h>
#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
namespace WebCore {
static PassOwnPtr<LineBreakIteratorPool> create() { return adoptPtr(new LineBreakIteratorPool); }
- static String makeLocaleWithBreakKeyword(const AtomicString& locale, LineBreakIteratorMode mode)
+ UBreakIterator* take(const AtomicString& locale)
{
- StringBuilder localeWithKeyword;
- localeWithKeyword.append(locale);
- localeWithKeyword.appendLiteral("@break=");
- switch (mode) {
- case LineBreakIteratorModeUAX14:
- break;
- case LineBreakIteratorModeUAX14Loose:
- localeWithKeyword.appendLiteral("loose");
- break;
- case LineBreakIteratorModeUAX14Normal:
- localeWithKeyword.appendLiteral("normal");
- break;
- case LineBreakIteratorModeUAX14Strict:
- localeWithKeyword.appendLiteral("strict");
- break;
- }
- return localeWithKeyword.toString();
- }
-
- TextBreakIterator* take(const AtomicString& locale, LineBreakIteratorMode mode, bool isCJK)
- {
- AtomicString localeWithOptionalBreakKeyword;
- if (mode == LineBreakIteratorModeUAX14)
- localeWithOptionalBreakKeyword = locale;
- else
- localeWithOptionalBreakKeyword = makeLocaleWithBreakKeyword(locale, mode);
-
- TextBreakIterator* iterator = 0;
+ UBreakIterator* iterator = 0;
for (size_t i = 0; i < m_pool.size(); ++i) {
- if (m_pool[i].first == localeWithOptionalBreakKeyword) {
+ if (m_pool[i].first == locale) {
iterator = m_pool[i].second;
m_pool.remove(i);
break;
}
if (!iterator) {
- iterator = openLineBreakIterator(localeWithOptionalBreakKeyword, mode, isCJK);
- if (!iterator)
+ UErrorCode openStatus = U_ZERO_ERROR;
+ bool localeIsEmpty = locale.isEmpty();
+ iterator = ubrk_open(UBRK_LINE, localeIsEmpty ? currentTextBreakLocaleID() : locale.string().utf8().data(), 0, 0, &openStatus);
+ // locale comes from a web page and it can be invalid, leading ICU
+ // to fail, in which case we fall back to the default locale.
+ if (!localeIsEmpty && U_FAILURE(openStatus)) {
+ openStatus = U_ZERO_ERROR;
+ iterator = ubrk_open(UBRK_LINE, currentTextBreakLocaleID(), 0, 0, &openStatus);
+ }
+
+ if (U_FAILURE(openStatus)) {
+ LOG_ERROR("ubrk_open failed with status %d", openStatus);
return 0;
+ }
}
ASSERT(!m_vendedIterators.contains(iterator));
- m_vendedIterators.set(iterator, localeWithOptionalBreakKeyword);
+ m_vendedIterators.set(iterator, locale);
return iterator;
}
- void put(TextBreakIterator* iterator)
+ void put(UBreakIterator* iterator)
{
ASSERT_ARG(iterator, m_vendedIterators.contains(iterator));
if (m_pool.size() == capacity) {
- closeLineBreakIterator(m_pool[0].second);
+ ubrk_close(m_pool[0].second);
m_pool.remove(0);
}
static const size_t capacity = 4;
- typedef pair<AtomicString, TextBreakIterator*> Entry;
+ typedef pair<AtomicString, UBreakIterator*> Entry;
typedef Vector<Entry, capacity> Pool;
Pool m_pool;
- HashMap<TextBreakIterator*, AtomicString> m_vendedIterators;
+ HashMap<UBreakIterator*, AtomicString> m_vendedIterators;
friend WTF::ThreadSpecific<LineBreakIteratorPool>::operator LineBreakIteratorPool*();
};
// Note: The returned iterator is good only until you get another iterator, with the exception of acquireLineBreakIterator.
- enum LineBreakIteratorMode {
- LineBreakIteratorModeUAX14,
- LineBreakIteratorModeUAX14Loose,
- LineBreakIteratorModeUAX14Normal,
- LineBreakIteratorModeUAX14Strict,
- };
-
// This is similar to character break iterator in most cases, but is subject to
// platform UI conventions. One notable example where this can be different
// from character break iterator is Thai prepend characters, see bug 24342.
TextBreakIterator* cursorMovementIterator(const UChar*, int length);
TextBreakIterator* wordBreakIterator(const UChar*, int length);
- TextBreakIterator* acquireLineBreakIterator(const LChar*, int length, const AtomicString& locale, LineBreakIteratorMode, bool isCJK);
- TextBreakIterator* acquireLineBreakIterator(const UChar*, int length, const AtomicString& locale, LineBreakIteratorMode, bool isCJK);
+ TextBreakIterator* acquireLineBreakIterator(const LChar*, int length, const AtomicString& locale);
+ TextBreakIterator* acquireLineBreakIterator(const UChar*, int length, const AtomicString& locale);
void releaseLineBreakIterator(TextBreakIterator*);
- TextBreakIterator* openLineBreakIterator(const AtomicString& locale, LineBreakIteratorMode, bool isCJK);
- void closeLineBreakIterator(TextBreakIterator*&);
TextBreakIterator* sentenceBreakIterator(const UChar*, int length);
int textBreakFirst(TextBreakIterator*);
const int TextBreakDone = -1;
- bool isCJKLocale(const AtomicString&);
-
class LazyLineBreakIterator {
public:
LazyLineBreakIterator()
- : m_mode(LineBreakIteratorModeUAX14)
- , m_isCJK(false)
- , m_iterator(0)
+ : m_iterator(0)
{
}
- LazyLineBreakIterator(String string, const AtomicString& locale = AtomicString(), LineBreakIteratorMode mode = LineBreakIteratorModeUAX14)
+ LazyLineBreakIterator(String string, const AtomicString& locale = AtomicString())
: m_string(string)
, m_locale(locale)
- , m_mode(mode)
, m_iterator(0)
{
- m_isCJK = isCJKLocale(locale);
}
~LazyLineBreakIterator()
}
String string() const { return m_string; }
- bool isLooseCJKMode() const { return m_isCJK && m_mode == LineBreakIteratorModeUAX14Loose; }
TextBreakIterator* get()
{
if (!m_iterator) {
if (m_string.is8Bit())
- m_iterator = acquireLineBreakIterator(m_string.characters8(), m_string.length(), m_locale, m_mode, m_isCJK);
+ m_iterator = acquireLineBreakIterator(m_string.characters8(), m_string.length(), m_locale);
else
- m_iterator = acquireLineBreakIterator(m_string.characters16(), m_string.length(), m_locale, m_mode, m_isCJK);
+ m_iterator = acquireLineBreakIterator(m_string.characters16(), m_string.length(), m_locale);
}
return m_iterator;
}
- void reset(String string, const AtomicString& locale, LineBreakIteratorMode mode)
+ void reset(String string, const AtomicString& locale)
{
if (m_iterator)
releaseLineBreakIterator(m_iterator);
m_string = string;
m_locale = locale;
- m_mode = mode;
- m_isCJK = isCJKLocale(locale);
m_iterator = 0;
}
private:
String m_string;
AtomicString m_locale;
- LineBreakIteratorMode m_mode;
- bool m_isCJK;
TextBreakIterator* m_iterator;
};
#include "TextBreakIterator.h"
#include "LineBreakIteratorPoolICU.h"
-#include <unicode/ubrk.h>
-#include <unicode/uloc.h>
#include <wtf/Atomics.h>
#include <wtf/text/WTFString.h>
staticWordBreakIterator, UBRK_WORD, string, length);
}
-TextBreakIterator* acquireLineBreakIterator(const LChar* string, int length, const AtomicString& locale, LineBreakIteratorMode mode, bool isCJK)
+TextBreakIterator* acquireLineBreakIterator(const LChar* string, int length, const AtomicString& locale)
{
- TextBreakIterator* iterator = LineBreakIteratorPool::sharedPool().take(locale, mode, isCJK);
+ UBreakIterator* iterator = LineBreakIteratorPool::sharedPool().take(locale);
if (!iterator)
return 0;
return 0;
}
- UBreakIterator* ubrkIter = reinterpret_cast<UBreakIterator*>(iterator);
UErrorCode setTextStatus = U_ZERO_ERROR;
- ubrk_setUText(ubrkIter, uTextLatin1, &setTextStatus);
+ ubrk_setUText(iterator, uTextLatin1, &setTextStatus);
if (U_FAILURE(setTextStatus)) {
LOG_ERROR("ubrk_setUText failed with status %d", setTextStatus);
return 0;
utext_close(uTextLatin1);
- return iterator;
+ return reinterpret_cast<TextBreakIterator*>(iterator);
}
-TextBreakIterator* acquireLineBreakIterator(const UChar* string, int length, const AtomicString& locale, LineBreakIteratorMode mode, bool isCJK)
+TextBreakIterator* acquireLineBreakIterator(const UChar* string, int length, const AtomicString& locale)
{
- TextBreakIterator* iterator = LineBreakIteratorPool::sharedPool().take(locale, mode, isCJK);
+ UBreakIterator* iterator = LineBreakIteratorPool::sharedPool().take(locale);
if (!iterator)
return 0;
- UBreakIterator* ubrkIter = reinterpret_cast<UBreakIterator*>(iterator);
UErrorCode setTextStatus = U_ZERO_ERROR;
- ubrk_setText(ubrkIter, string, length, &setTextStatus);
+ ubrk_setText(iterator, string, length, &setTextStatus);
if (U_FAILURE(setTextStatus)) {
LOG_ERROR("ubrk_setText failed with status %d", setTextStatus);
return 0;
}
- return iterator;
+ return reinterpret_cast<TextBreakIterator*>(iterator);
}
void releaseLineBreakIterator(TextBreakIterator* iterator)
{
ASSERT_ARG(iterator, iterator);
- LineBreakIteratorPool::sharedPool().put(iterator);
-}
-
-// Recognize BCP47 compliant primary language values of 'zh', 'ja', 'ko'
-// (in any combination of case), optionally followed by subtags. Don't
-// recognize 3-letter variants 'chi'/'zho', 'jpn', or 'kor' since BCP47
-// requires use of shortest language tag.
-template<typename T>
-static bool isCJKLocale(const T* s, size_t length)
-{
- if (!s || length < 2)
- return false;
- T c1 = s[0];
- T c2 = s[1];
- T c3 = length == 2 ? 0 : s[2];
- if (!c3 || c3 == '-' || c3 == '_' || c3 == '@') {
- if (c1 == 'z' || c1 == 'Z')
- return c2 == 'h' || c2 == 'H';
- if (c1 == 'j' || c1 == 'J')
- return c2 == 'a' || c2 == 'A';
- if (c1 == 'k' || c1 == 'K')
- return c2 == 'o' || c2 == 'O';
- }
- return false;
-}
-
-bool isCJKLocale(const AtomicString& locale)
-{
- if (locale.isEmpty())
- return false;
- size_t length = locale.length();
- if (locale.is8Bit())
- return isCJKLocale<LChar>(locale.characters8(), length);
- return isCJKLocale<UChar>(locale.characters16(), length);
-}
-
-static void mapLineIteratorModeToRules(LineBreakIteratorMode, bool isCJK, String& rules);
-
-TextBreakIterator* openLineBreakIterator(const AtomicString& locale, LineBreakIteratorMode mode, bool isCJK)
-{
- UBreakIterator* ubrkIter;
- UErrorCode openStatus = U_ZERO_ERROR;
- bool isLocaleEmpty = locale.isEmpty();
- if ((mode == LineBreakIteratorModeUAX14) && !isCJK)
- ubrkIter = ubrk_open(UBRK_LINE, isLocaleEmpty ? currentTextBreakLocaleID() : locale.string().utf8().data(), 0, 0, &openStatus);
- else {
- UParseError parseStatus;
- String rules;
- mapLineIteratorModeToRules(mode, isCJK, rules);
- ubrkIter = ubrk_openRules(rules.characters(), rules.length(), 0, 0, &parseStatus, &openStatus);
- }
- // Locale comes from a web page and it can be invalid, leading ICU
- // to fail, in which case we fall back to the default locale (with default rules).
- if (!isLocaleEmpty && U_FAILURE(openStatus)) {
- openStatus = U_ZERO_ERROR;
- ubrkIter = ubrk_open(UBRK_LINE, currentTextBreakLocaleID(), 0, 0, &openStatus);
- }
-
- if (U_FAILURE(openStatus)) {
- LOG_ERROR("ubrk_open failed with status %d", openStatus);
- ASSERT(!ubrkIter);
- }
- return reinterpret_cast<TextBreakIterator*>(ubrkIter);
-}
-
-void closeLineBreakIterator(TextBreakIterator*& iterator)
-{
- UBreakIterator* ubrkIter = reinterpret_cast<UBreakIterator*>(iterator);
- ASSERT(ubrkIter);
- ubrk_close(ubrkIter);
- iterator = 0;
+ LineBreakIteratorPool::sharedPool().put(reinterpret_cast<UBreakIterator*>(iterator));
}
static TextBreakIterator* nonSharedCharacterBreakIterator;
return setUpIteratorWithRules(createdCursorMovementIterator, staticCursorMovementIterator, kRules, string, length);
}
-static const char* uax14Prologue =
- "!!chain;"
- "!!LBCMNoChain;"
- "!!lookAheadHardBreak;";
-
-static const char* uax14AssignmentsBefore =
- // explicitly enumerate $CJ since ICU versions prior to 49 don't support :LineBreak=Conditional_Japanese_Starter:
- "$CJ = ["
-#if (U_ICU_VERSION_MAJOR_NUM >= 4) && (U_ICU_VERSION_MINOR_NUM >= 9)
- ":LineBreak=Conditional_Japanese_Starter:"
-#else
- "\\u3041\\u3043\\u3045\\u3047\\u3049\\u3063\\u3083\\u3085\\u3087\\u308E\\u3095\\u3096\\u30A1\\u30A3\\u30A5\\u30A7"
- "\\u30A9\\u30C3\\u30E3\\u30E5\\u30E7\\u30EE\\u30F5\\u30F6\\u30FC"
- "\\u31F0\\u31F1\\u31F2\\u31F3\\u31F4\\u31F5\\u31F6\\u31F7\\u31F8\\u31F9\\u31FA\\u31FB\\u31FC\\u31FD\\u31FE\\u31FF"
- "\\uFF67\\uFF68\\uFF69\\uFF6A\\uFF6B\\uFF6C\\uFF6D\\uFF6E\\uFF6F\\uFF70"
-#endif
- "];";
-
-static const char* uax14AssignmentsCustomLooseCJK =
- "$BA_SUB = [\\u2010\\u2013];"
- "$EX_SUB = [\\u0021\\u003F\\uFF01\\uFF1F];"
- "$ID_SUB = '';"
- "$IN_SUB = [\\u2025\\u2026];"
- "$IS_SUB = [\\u003A\\u003B];"
- "$NS_SUB = [\\u203C\\u2047\\u2048\\u2049\\u3005\\u301C\\u303B\\u309D\\u309E\\u30A0\\u30FB\\u30FD\\u30FE\\uFF1A\\uFF1B\\uFF65];"
- "$PO_SUB = [\\u0025\\u00A2\\u00B0\\u2030\\u2032\\u2033\\u2103\\uFF05\\uFFE0];"
- "$PR_SUB = [\\u0024\\u00A3\\u00A5\\u20AC\\u2116\\uFF04\\uFFE1\\uFFE5];"
- "$ID_ADD = [$CJ $BA_SUB $EX_SUB $IN_SUB $IS_SUB $NS_SUB $PO_SUB $PR_SUB];"
- "$NS_ADD = '';";
-
-static const char* uax14AssignmentsCustomLooseNonCJK =
- "$BA_SUB = '';"
- "$EX_SUB = '';"
- "$ID_SUB = '';"
- "$IN_SUB = [\\u2025\\u2026];"
- "$IS_SUB = '';"
- "$NS_SUB = [\\u3005\\u303B\\u309D\\u309E\\u30FD\\u30FE];"
- "$PO_SUB = '';"
- "$PR_SUB = '';"
- "$ID_ADD = [$CJ $IN_SUB $NS_SUB];"
- "$NS_ADD = '';";
-
-static const char* uax14AssignmentsCustomNormalCJK =
- "$BA_SUB = [\\u2010\\u2013];"
- "$EX_SUB = '';"
- "$IN_SUB = '';"
- "$ID_SUB = '';"
- "$IS_SUB = '';"
- "$NS_SUB = [\\u301C\\u30A0];"
- "$PO_SUB = '';"
- "$PR_SUB = '';"
- "$ID_ADD = [$CJ $BA_SUB $NS_SUB];"
- "$NS_ADD = '';";
-
-static const char* uax14AssignmentsCustomNormalNonCJK =
- "$BA_SUB = '';"
- "$EX_SUB = '';"
- "$ID_SUB = '';"
- "$IN_SUB = '';"
- "$IS_SUB = '';"
- "$NS_SUB = '';"
- "$PO_SUB = '';"
- "$PR_SUB = '';"
- "$ID_ADD = [$CJ];"
- "$NS_ADD = '';";
-
-static const char* uax14AssignmentsCustomStrictCJK =
- "$BA_SUB = '';"
- "$EX_SUB = '';"
- "$ID_SUB = '';"
- "$IN_SUB = '';"
- "$IS_SUB = '';"
- "$NS_SUB = '';"
- "$PO_SUB = '';"
- "$PR_SUB = '';"
- "$ID_ADD = '';"
- "$NS_ADD = [$CJ];";
-
-#define uax14AssignmentsCustomStrictNonCJK uax14AssignmentsCustomStrictCJK
-#define uax14AssignmentsCustomDefaultCJK uax14AssignmentsCustomNormalCJK
-#define uax14AssignmentsCustomDefaultNonCJK uax14AssignmentsCustomStrictNonCJK
-
-static const char* uax14AssignmentsAfter =
- "$AI = [:LineBreak = Ambiguous:];"
- "$AL = [:LineBreak = Alphabetic:];"
- "$BA = [[:LineBreak = Break_After:] - $BA_SUB];"
- "$BB = [:LineBreak = Break_Before:];"
- "$BK = [:LineBreak = Mandatory_Break:];"
- "$B2 = [:LineBreak = Break_Both:];"
- "$CB = [:LineBreak = Contingent_Break:];"
- "$CL = [:LineBreak = Close_Punctuation:];"
- "$CM = [:LineBreak = Combining_Mark:];"
- "$CP = [:LineBreak = Close_Parenthesis:];"
- "$CR = [:LineBreak = Carriage_Return:];"
- "$EX = [[:LineBreak = Exclamation:] - $EX_SUB];"
- "$GL = [:LineBreak = Glue:];"
-#if (U_ICU_VERSION_MAJOR_NUM >= 4) && (U_ICU_VERSION_MINOR_NUM >= 9)
- "$HL = [:LineBreak = Hebrew_Letter:];"
-#else
- "$HL = [[:Hebrew:] & [:Letter:]];"
-#endif
- "$HY = [:LineBreak = Hyphen:];"
- "$H2 = [:LineBreak = H2:];"
- "$H3 = [:LineBreak = H3:];"
- "$ID = [[[[:LineBreak = Ideographic:] - $CJ] $ID_ADD] - $ID_SUB];"
- "$IN = [[:LineBreak = Inseparable:] - $IN_SUB];"
- "$IS = [[:LineBreak = Infix_Numeric:] - $IS_SUB];"
- "$JL = [:LineBreak = JL:];"
- "$JV = [:LineBreak = JV:];"
- "$JT = [:LineBreak = JT:];"
- "$LF = [:LineBreak = Line_Feed:];"
- "$NL = [:LineBreak = Next_Line:];"
- "$NS = [[[[:LineBreak = Nonstarter:] - $CJ] $NS_ADD] - $NS_SUB];"
- "$NU = [:LineBreak = Numeric:];"
- "$OP = [:LineBreak = Open_Punctuation:];"
- "$PO = [[:LineBreak = Postfix_Numeric:] - $PO_SUB];"
- "$PR = [[:LineBreak = Prefix_Numeric:] - $PR_SUB];"
- "$QU = [:LineBreak = Quotation:];"
- "$SA = [:LineBreak = Complex_Context:];"
- "$SG = [:LineBreak = Surrogate:];"
- "$SP = [:LineBreak = Space:];"
- "$SY = [:LineBreak = Break_Symbols:];"
- "$WJ = [:LineBreak = Word_Joiner:];"
- "$XX = [:LineBreak = Unknown:];"
- "$ZW = [:LineBreak = ZWSpace:];"
- "$dictionary = [:LineBreak = Complex_Context:];"
- "$ALPlus = [$AL $AI $SA $SG $XX];"
- "$ALcm = $ALPlus $CM*;"
- "$BAcm = $BA $CM*;"
- "$BBcm = $BB $CM*;"
- "$B2cm = $B2 $CM*;"
- "$CLcm = $CL $CM*;"
- "$CPcm = $CP $CM*;"
- "$EXcm = $EX $CM*;"
- "$GLcm = $GL $CM*;"
- "$HLcm = $HL $CM*;"
- "$HYcm = $HY $CM*;"
- "$H2cm = $H2 $CM*;"
- "$H3cm = $H3 $CM*;"
- "$IDcm = $ID $CM*;"
- "$INcm = $IN $CM*;"
- "$IScm = $IS $CM*;"
- "$JLcm = $JL $CM*;"
- "$JVcm = $JV $CM*;"
- "$JTcm = $JT $CM*;"
- "$NScm = $NS $CM*;"
- "$NUcm = $NU $CM*;"
- "$OPcm = $OP $CM*;"
- "$POcm = $PO $CM*;"
- "$PRcm = $PR $CM*;"
- "$QUcm = $QU $CM*;"
- "$SYcm = $SY $CM*;"
- "$WJcm = $WJ $CM*;";
-
-static const char* uax14Forward =
- "!!forward;"
- "$CAN_CM = [^$SP $BK $CR $LF $NL $ZW $CM];"
- "$CANT_CM = [$SP $BK $CR $LF $NL $ZW $CM];"
- "$AL_FOLLOW_NOCM = [$BK $CR $LF $NL $ZW $SP];"
- "$AL_FOLLOW_CM = [$CL $CP $EX $HL $IS $SY $WJ $GL $OP $QU $BA $HY $NS $IN $NU $ALPlus];"
- "$AL_FOLLOW = [$AL_FOLLOW_NOCM $AL_FOLLOW_CM];"
- "$LB4Breaks = [$BK $CR $LF $NL];"
- "$LB4NonBreaks = [^$BK $CR $LF $NL];"
- "$LB8Breaks = [$LB4Breaks $ZW];"
- "$LB8NonBreaks = [[$LB4NonBreaks] - [$ZW]];"
- "$LB18NonBreaks = [$LB8NonBreaks - [$SP]];"
- "$LB18Breaks = [$LB8Breaks $SP];"
- "$LB20NonBreaks = [$LB18NonBreaks - $CB];"
- "$ALPlus $CM+;"
- "$BA $CM+;"
- "$BB $CM+;"
- "$B2 $CM+;"
- "$CL $CM+;"
- "$CP $CM+;"
- "$EX $CM+;"
- "$GL $CM+;"
- "$HL $CM+;"
- "$HY $CM+;"
- "$H2 $CM+;"
- "$H3 $CM+;"
- "$ID $CM+;"
- "$IN $CM+;"
- "$IS $CM+;"
- "$JL $CM+;"
- "$JV $CM+;"
- "$JT $CM+;"
- "$NS $CM+;"
- "$NU $CM+;"
- "$OP $CM+;"
- "$PO $CM+;"
- "$PR $CM+;"
- "$QU $CM+;"
- "$SY $CM+;"
- "$WJ $CM+;"
- "$CR $LF {100};"
- "$LB4NonBreaks? $LB4Breaks {100};"
- "$CAN_CM $CM* $LB4Breaks {100};"
- "$CM+ $LB4Breaks {100};"
- "$LB4NonBreaks [$SP $ZW];"
- "$CAN_CM $CM* [$SP $ZW];"
- "$CM+ [$SP $ZW];"
- "$CAN_CM $CM+;"
- "$CM+;"
- "$CAN_CM $CM* $WJcm;"
- "$LB8NonBreaks $WJcm;"
- "$CM+ $WJcm;"
- "$WJcm $CANT_CM;"
- "$WJcm $CAN_CM $CM*;"
- "$GLcm $CAN_CM $CM*;"
- "$GLcm $CANT_CM;"
- "[[$LB8NonBreaks] - [$SP $BA $HY]] $CM* $GLcm;"
- "$CM+ GLcm;"
- "$LB8NonBreaks $CL;"
- "$CAN_CM $CM* $CL;"
- "$CM+ $CL;"
- "$LB8NonBreaks $CP;"
- "$CAN_CM $CM* $CP;"
- "$CM+ $CP;"
- "$LB8NonBreaks $EX;"
- "$CAN_CM $CM* $EX;"
- "$CM+ $EX;"
- "$LB8NonBreaks $IS;"
- "$CAN_CM $CM* $IS;"
- "$CM+ $IS;"
- "$LB8NonBreaks $SY;"
- "$CAN_CM $CM* $SY;"
- "$CM+ $SY;"
- "$OPcm $SP* $CAN_CM $CM*;"
- "$OPcm $SP* $CANT_CM;"
- "$OPcm $SP+ $CM+ $AL_FOLLOW?;"
- "$QUcm $SP* $OPcm;"
- "($CLcm | $CPcm) $SP* $NScm;"
- "$B2cm $SP* $B2cm;"
- "$LB18NonBreaks $CM* $QUcm;"
- "$CM+ $QUcm;"
- "$QUcm .?;"
- "$QUcm $LB18NonBreaks $CM*;"
- "$LB20NonBreaks $CM* ($BAcm | $HYcm | $NScm); "
- "$BBcm [^$CB];"
- "$BBcm $LB20NonBreaks $CM*;"
- "$HLcm ($HYcm | $BAcm) [^$CB]?;"
- "($ALcm | $HLcm) $INcm;"
- "$CM+ $INcm;"
- "$IDcm $INcm;"
- "$INcm $INcm;"
- "$NUcm $INcm;"
- "$IDcm $POcm;"
- "$ALcm $NUcm;"
- "$HLcm $NUcm;"
- "$CM+ $NUcm;"
- "$NUcm $ALcm;"
- "$NUcm $HLcm;"
- "$PRcm $IDcm;"
- "$PRcm ($ALcm | $HLcm);"
- "$POcm ($ALcm | $HLcm);"
- "($PRcm | $POcm)? ($OPcm | $HYcm)? $NUcm ($NUcm | $SYcm | $IScm)* ($CLcm | $CPcm)? ($PRcm | $POcm)?;"
- "$JLcm ($JLcm | $JVcm | $H2cm | $H3cm);"
- "($JVcm | $H2cm) ($JVcm | $JTcm);"
- "($JTcm | $H3cm) $JTcm;"
- "($JLcm | $JVcm | $JTcm | $H2cm | $H3cm) $INcm;"
- "($JLcm | $JVcm | $JTcm | $H2cm | $H3cm) $POcm;"
- "$PRcm ($JLcm | $JVcm | $JTcm | $H2cm | $H3cm);"
- "($ALcm | $HLcm) ($ALcm | $HLcm);"
- "$CM+ ($ALcm | $HLcm);"
- "$IScm ($ALcm | $HLcm);"
- "($ALcm | $HLcm | $NUcm) $OPcm;"
- "$CM+ $OPcm;"
- "$CPcm ($ALcm | $HLcm | $NUcm);";
-
-static const char* uax14Reverse =
- "!!reverse;"
- "$CM+ $ALPlus;"
- "$CM+ $BA;"
- "$CM+ $BB;"
- "$CM+ $B2;"
- "$CM+ $CL;"
- "$CM+ $CP;"
- "$CM+ $EX;"
- "$CM+ $GL;"
- "$CM+ $HL;"
- "$CM+ $HY;"
- "$CM+ $H2;"
- "$CM+ $H3;"
- "$CM+ $ID;"
- "$CM+ $IN;"
- "$CM+ $IS;"
- "$CM+ $JL;"
- "$CM+ $JV;"
- "$CM+ $JT;"
- "$CM+ $NS;"
- "$CM+ $NU;"
- "$CM+ $OP;"
- "$CM+ $PO;"
- "$CM+ $PR;"
- "$CM+ $QU;"
- "$CM+ $SY;"
- "$CM+ $WJ;"
- "$CM+;"
- "$AL_FOLLOW $CM+ / ([$BK $CR $LF $NL $ZW {eof}] | $SP+ $CM+ $SP | $SP+ $CM* ([^$OP $CM $SP] | [$AL {eof}]));"
- "[$PR] / $CM+ [$BK $CR $LF $NL $ZW $SP {eof}];"
- "$LB4Breaks [$LB4NonBreaks-$CM];"
- "$LB4Breaks $CM+ $CAN_CM;"
- "$LF $CR;"
- "[$SP $ZW] [$LB4NonBreaks-$CM];"
- "[$SP $ZW] $CM+ $CAN_CM;"
- "$CM+ $CAN_CM;"
- "$CM* $WJ $CM* $CAN_CM;"
- "$CM* $WJ [$LB8NonBreaks-$CM];"
- "$CANT_CM $CM* $WJ;"
- "$CM* $CAN_CM $CM* $WJ;"
- "$CM* $GL $CM* [$LB8NonBreaks-[$CM $SP $BA $HY]];"
- "$CANT_CM $CM* $GL;"
- "$CM* $CAN_CM $CM* $GL;"
- "$CL $CM+ $CAN_CM;"
- "$CP $CM+ $CAN_CM;"
- "$EX $CM+ $CAN_CM;"
- "$IS $CM+ $CAN_CM;"
- "$SY $CM+ $CAN_CM;"
- "$CL [$LB8NonBreaks-$CM];"
- "$CP [$LB8NonBreaks-$CM];"
- "$EX [$LB8NonBreaks-$CM];"
- "$IS [$LB8NonBreaks-$CM];"
- "$SY [$LB8NonBreaks-$CM];"
- "[$CL $CP $EX $IS $SY] $CM+ $SP+ $CM* $OP; "
- "$CM* $CAN_CM $SP* $CM* $OP;"
- "$CANT_CM $SP* $CM* $OP;"
- "$AL_FOLLOW? $CM+ $SP $SP* $CM* $OP;"
- "$AL_FOLLOW_NOCM $CM+ $SP+ $CM* $OP;"
- "$CM* $AL_FOLLOW_CM $CM+ $SP+ $CM* $OP;"
- "$SY $CM $SP+ $OP;"
- "$CM* $OP $SP* $CM* $QU;"
- "$CM* $NS $SP* $CM* ($CL | $CP);"
- "$CM* $B2 $SP* $CM* $B2;"
- "$CM* $QU $CM* $CAN_CM;"
- "$CM* $QU $LB18NonBreaks;"
- "$CM* $CAN_CM $CM* $QU;"
- "$CANT_CM $CM* $QU;"
- "$CM* ($BA | $HY | $NS) $CM* [$LB20NonBreaks-$CM];"
- "$CM* [$LB20NonBreaks-$CM] $CM* $BB;"
- "[^$CB] $CM* $BB;"
- "[^$CB] $CM* ($HY | $BA) $CM* $HL;"
- "$CM* $IN $CM* ($ALPlus | $HL);"
- "$CM* $IN $CM* $ID;"
- "$CM* $IN $CM* $IN;"
- "$CM* $IN $CM* $NU;"
- "$CM* $PO $CM* $ID;"
- "$CM* $NU $CM* ($ALPlus | $HL);"
- "$CM* ($ALPlus | $HL) $CM* $NU;"
- "$CM* $ID $CM* $PR;"
- "$CM* ($ALPlus | $HL) $CM* $PR;"
- "$CM* ($ALPlus | $HL) $CM* $PO;"
- "($CM* ($PR | $PO))? ($CM* ($CL | $CP))? ($CM* ($NU | $IS | $SY))* $CM* $NU ($CM* ($OP | $HY))? ($CM* ($PR | $PO))?;"
- "$CM* ($H3 | $H2 | $JV | $JL) $CM* $JL;"
- "$CM* ($JT | $JV) $CM* ($H2 | $JV);"
- "$CM* $JT $CM* ($H3 | $JT);"
- "$CM* $IN $CM* ($H3 | $H2 | $JT | $JV | $JL);"
- "$CM* $PO $CM* ($H3 | $H2 | $JT | $JV | $JL);"
- "$CM* ($H3 | $H2 | $JT | $JV | $JL) $CM* $PR;"
- "$CM* ($ALPlus | $HL) $CM* ($ALPlus | $HL);"
- "$CM* ($ALPlus | $HL) $CM* $IS;"
- "$CM* $OP $CM* ($ALPlus | $HL | $NU);"
- "$CM* ($ALPlus | $HL | $NU) $CM* $CP;";
-
-static const char* uax14SafeForward =
- "!!safe_forward;"
- "[$CM $OP $QU $CL $CP $B2 $PR $HY $BA $SP $dictionary]+ [^$CM $OP $QU $CL $CP $B2 $PR $HY $BA $dictionary];"
- "$dictionary $dictionary;";
-
-static const char* uax14SafeReverse =
- "!!safe_reverse;"
- "$CM+ [^$CM $BK $CR $LF $NL $ZW $SP];"
- "$CM+ $SP / .;"
- "$SP+ $CM* $OP;"
- "$SP+ $CM* $QU;"
- "$SP+ $CM* ($CL | $CP);"
- "$SP+ $CM* $B2;"
- "$CM* ($HY | $BA) $CM* $HL;"
- "($CM* ($IS | $SY))+ $CM* $NU;"
- "($CL | $CP) $CM* ($NU | $IS | $SY);"
- "$dictionary $dictionary;";
-
-static void mapLineIteratorModeToRules(LineBreakIteratorMode mode, bool isCJK, String& rules)
-{
- StringBuilder rulesBuilder;
- rulesBuilder.append(uax14Prologue);
- rulesBuilder.append(uax14AssignmentsBefore);
- switch (mode) {
- case LineBreakIteratorModeUAX14:
- rulesBuilder.append(isCJK ? uax14AssignmentsCustomDefaultCJK : uax14AssignmentsCustomDefaultNonCJK);
- break;
- case LineBreakIteratorModeUAX14Loose:
- rulesBuilder.append(isCJK ? uax14AssignmentsCustomLooseCJK : uax14AssignmentsCustomLooseNonCJK);
- break;
- case LineBreakIteratorModeUAX14Normal:
- rulesBuilder.append(isCJK ? uax14AssignmentsCustomNormalCJK : uax14AssignmentsCustomNormalNonCJK);
- break;
- case LineBreakIteratorModeUAX14Strict:
- rulesBuilder.append(isCJK ? uax14AssignmentsCustomStrictCJK : uax14AssignmentsCustomStrictNonCJK);
- break;
- }
- rulesBuilder.append(uax14AssignmentsAfter);
- rulesBuilder.append(uax14Forward);
- rulesBuilder.append(uax14Reverse);
- rulesBuilder.append(uax14SafeForward);
- rulesBuilder.append(uax14SafeReverse);
- rules = rulesBuilder.toString();
-}
-
}
bool midWordBreak = false;
bool breakAll = currentStyle->wordBreak() == BreakAllWordBreak && autoWrap;
float hyphenWidth = 0;
- bool isLooseCJKMode = false;
if (t->isWordBreak()) {
width.commit();
renderTextInfo.m_text = t;
renderTextInfo.m_font = &f;
renderTextInfo.m_layout = f.createLayout(t, width.currentWidth(), collapseWhiteSpace);
- renderTextInfo.m_lineBreakIterator.reset(t->text(), style->locale(), mapLineBreakToIteratorMode(blockStyle->lineBreak()));
- isLooseCJKMode = renderTextInfo.m_lineBreakIterator.isLooseCJKMode();
+ renderTextInfo.m_lineBreakIterator.reset(t->text(), style->locale());
} else if (renderTextInfo.m_layout && renderTextInfo.m_font != &f) {
renderTextInfo.m_font = &f;
renderTextInfo.m_layout = f.createLayout(t, width.currentWidth(), collapseWhiteSpace);
midWordBreak = width.committedWidth() + wrapW + charWidth > width.availableWidth();
}
- bool betweenWords = c == '\n' || (currWS != PRE && !atStart && isBreakable(renderTextInfo.m_lineBreakIterator, current.m_pos, current.m_nextBreakablePosition, breakNBSP, isLooseCJKMode)
+ bool betweenWords = c == '\n' || (currWS != PRE && !atStart && isBreakable(renderTextInfo.m_lineBreakIterator, current.m_pos, current.m_nextBreakablePosition, breakNBSP)
&& (style->hyphens() != HyphensNone || (current.previousInSameNode() != softHyphen)));
if (betweenWords || midWordBreak) {
return maxFragmentWidth;
}
-LineBreakIteratorMode mapLineBreakToIteratorMode(LineBreak lineBreak)
-{
- switch (lineBreak) {
- case LineBreakAuto:
- case LineBreakAfterWhiteSpace:
- return LineBreakIteratorModeUAX14;
- case LineBreakLoose:
- return LineBreakIteratorModeUAX14Loose;
- case LineBreakNormal:
- return LineBreakIteratorModeUAX14Normal;
- case LineBreakStrict:
- return LineBreakIteratorModeUAX14Strict;
- }
- return LineBreakIteratorModeUAX14;
-}
-
void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)
{
ASSERT(m_hasTab || preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts);
const Font& f = styleToUse->font(); // FIXME: This ignores first-line.
float wordSpacing = styleToUse->wordSpacing();
int len = textLength();
- LazyLineBreakIterator breakIterator(m_text, styleToUse->locale(), mapLineBreakToIteratorMode(styleToUse->lineBreak()));
+ LazyLineBreakIterator breakIterator(m_text, styleToUse->locale());
bool needsWordSpacing = false;
bool ignoringSpaces = false;
bool isSpace = false;
bool breakNBSP = styleToUse->autoWrap() && styleToUse->nbspMode() == SPACE;
bool breakAll = (styleToUse->wordBreak() == BreakAllWordBreak || styleToUse->wordBreak() == BreakWordBreak) && styleToUse->autoWrap();
- bool isLooseCJKMode = breakIterator.isLooseCJKMode();
for (int i = 0; i < len; i++) {
UChar c = characterAt(i);
continue;
}
- bool hasBreak = breakAll || isBreakable(breakIterator, i, nextBreakable, breakNBSP, isLooseCJKMode);
+ bool hasBreak = breakAll || isBreakable(breakIterator, i, nextBreakable, breakNBSP);
bool betweenWords = true;
int j = i;
while (c != '\n' && !isSpaceAccordingToStyle(c, styleToUse) && c != '\t' && (c != softHyphen || styleToUse->hyphens() == HyphensNone)) {
if (j == len)
break;
c = characterAt(j);
- if (isBreakable(breakIterator, j, nextBreakable, breakNBSP, isLooseCJKMode) && characterAt(j - 1) != softHyphen)
+ if (isBreakable(breakIterator, j, nextBreakable, breakNBSP) && characterAt(j - 1) != softHyphen)
break;
if (breakAll) {
betweenWords = false;
void applyTextTransform(const RenderStyle*, String&, UChar);
-LineBreakIteratorMode mapLineBreakToIteratorMode(LineBreak);
-
} // namespace WebCore
#endif // RenderText_h
namespace WebCore {
-// Parameterization for non-breaking space (U+00A0) behavior.
-enum NBSPBehavior {
- IgnoreNBSP,
- TreatNBSPAsBreak,
-};
-
-template<NBSPBehavior nbspBehavior>
+template<bool treatNoBreakSpaceAsBreak>
static inline bool isBreakableSpace(UChar ch)
{
switch (ch) {
case '\t':
return true;
case noBreakSpace:
- return (nbspBehavior == TreatNBSPAsBreak);
+ return treatNoBreakSpaceAsBreak;
default:
return false;
}
return false;
}
-template<NBSPBehavior nbspBehavior>
+template<bool treatNoBreakSpaceAsBreak>
inline bool needsLineBreakIterator(UChar ch)
{
- if (nbspBehavior == TreatNBSPAsBreak)
+ if (treatNoBreakSpaceAsBreak)
return ch > asciiLineBreakTableLastChar;
return ch > asciiLineBreakTableLastChar && ch != noBreakSpace;
}
-// When in non-loose mode, we can use the ASCII shortcut table.
-template<typename CharacterType, NBSPBehavior nbspBehavior>
-static inline int nextBreakablePositionNonLoosely(LazyLineBreakIterator& lazyBreakIterator, const CharacterType* str, unsigned length, int pos)
+template<typename CharacterType, bool treatNoBreakSpaceAsBreak>
+static inline int nextBreakablePosition(LazyLineBreakIterator& lazyBreakIterator, const CharacterType* str, unsigned length, int pos)
{
int len = static_cast<int>(length);
int nextBreak = -1;
for (int i = pos; i < len; i++) {
CharacterType ch = str[i];
- // Non-loose mode, so use ASCII shortcut (shouldBreakAfter) if not breakable space.
- if (isBreakableSpace<nbspBehavior>(ch) || shouldBreakAfter(lastLastCh, lastCh, ch))
+ if (isBreakableSpace<treatNoBreakSpaceAsBreak>(ch) || shouldBreakAfter(lastLastCh, lastCh, ch))
return i;
- // Non-loose mode, so conditionally use break iterator.
- if (needsLineBreakIterator<nbspBehavior>(ch) || needsLineBreakIterator<nbspBehavior>(lastCh)) {
+ if (needsLineBreakIterator<treatNoBreakSpaceAsBreak>(ch) || needsLineBreakIterator<treatNoBreakSpaceAsBreak>(lastCh)) {
if (nextBreak < i && i) {
TextBreakIterator* breakIterator = lazyBreakIterator.get();
if (breakIterator)
nextBreak = textBreakFollowing(breakIterator, i - 1);
}
- if (i == nextBreak && !isBreakableSpace<nbspBehavior>(lastCh))
+ if (i == nextBreak && !isBreakableSpace<treatNoBreakSpaceAsBreak>(lastCh))
return i;
}
return len;
}
-// When in loose mode, we can't use the ASCII shortcut table since loose mode allows "$100" to break after '$' in content marked as CJK.
-// N.B. It should be possible to combine the following with the non-loose version above by adding a LooseBehavior template parameter;
-// however, when doing this, a 10% performance regression appeared on chromium-win (https://bugs.webkit.org/show_bug.cgi?id=89235#c112).
-template<typename CharacterType, NBSPBehavior nbspBehavior>
-static inline int nextBreakablePositionLoosely(LazyLineBreakIterator& lazyBreakIterator, const CharacterType* str, unsigned length, int pos)
-{
- int len = static_cast<int>(length);
- int nextBreak = -1;
-
- CharacterType lastCh = pos > 0 ? str[pos - 1] : 0;
- for (int i = pos; i < len; i++) {
- CharacterType ch = str[i];
-
- // Always loose mode, so don't use ASCII shortcut (shouldBreakAfter).
- if (isBreakableSpace<nbspBehavior>(ch))
- return i;
-
- // Always use line break iterator in loose mode.
- if (nextBreak < i && i) {
- TextBreakIterator* breakIterator = lazyBreakIterator.get();
- if (breakIterator)
- nextBreak = textBreakFollowing(breakIterator, i - 1);
- }
- if (i == nextBreak && !isBreakableSpace<nbspBehavior>(lastCh))
- return i;
-
- lastCh = ch;
- }
-
- return len;
-}
-
-int nextBreakablePosition(LazyLineBreakIterator& lazyBreakIterator, int pos)
-{
- String string = lazyBreakIterator.string();
- if (string.is8Bit())
- return nextBreakablePositionNonLoosely<LChar, TreatNBSPAsBreak>(lazyBreakIterator, string.characters8(), string.length(), pos);
- return nextBreakablePositionNonLoosely<UChar, TreatNBSPAsBreak>(lazyBreakIterator, string.characters16(), string.length(), pos);
-}
-
int nextBreakablePositionIgnoringNBSP(LazyLineBreakIterator& lazyBreakIterator, int pos)
{
String string = lazyBreakIterator.string();
if (string.is8Bit())
- return nextBreakablePositionNonLoosely<LChar, IgnoreNBSP>(lazyBreakIterator, string.characters8(), string.length(), pos);
- return nextBreakablePositionNonLoosely<UChar, IgnoreNBSP>(lazyBreakIterator, string.characters16(), string.length(), pos);
-}
-
-int nextBreakablePositionLoose(LazyLineBreakIterator& lazyBreakIterator, int pos)
-{
- String string = lazyBreakIterator.string();
- if (string.is8Bit())
- return nextBreakablePositionLoosely<LChar, TreatNBSPAsBreak>(lazyBreakIterator, string.characters8(), string.length(), pos);
- return nextBreakablePositionLoosely<UChar, TreatNBSPAsBreak>(lazyBreakIterator, string.characters16(), string.length(), pos);
+ return nextBreakablePosition<LChar, false>(lazyBreakIterator, string.characters8(), string.length(), pos);
+ return nextBreakablePosition<UChar, false>(lazyBreakIterator, string.characters16(), string.length(), pos);
}
-int nextBreakablePositionIgnoringNBSPLoose(LazyLineBreakIterator& lazyBreakIterator, int pos)
+int nextBreakablePosition(LazyLineBreakIterator& lazyBreakIterator, int pos)
{
String string = lazyBreakIterator.string();
if (string.is8Bit())
- return nextBreakablePositionLoosely<LChar, IgnoreNBSP>(lazyBreakIterator, string.characters8(), string.length(), pos);
- return nextBreakablePositionLoosely<UChar, IgnoreNBSP>(lazyBreakIterator, string.characters16(), string.length(), pos);
+ return nextBreakablePosition<LChar, true>(lazyBreakIterator, string.characters8(), string.length(), pos);
+ return nextBreakablePosition<UChar, true>(lazyBreakIterator, string.characters16(), string.length(), pos);
}
} // namespace WebCore
class LazyLineBreakIterator;
int nextBreakablePositionIgnoringNBSP(LazyLineBreakIterator&, int pos);
-int nextBreakablePositionIgnoringNBSPLoose(LazyLineBreakIterator&, int pos);
int nextBreakablePosition(LazyLineBreakIterator&, int pos);
-int nextBreakablePositionLoose(LazyLineBreakIterator&, int pos);
-inline bool isBreakable(LazyLineBreakIterator& lazyBreakIterator, int pos, int& nextBreakable, bool breakNBSP, bool isLooseMode)
+inline bool isBreakable(LazyLineBreakIterator& lazyBreakIterator, int pos, int& nextBreakable, bool breakNBSP)
{
if (pos > nextBreakable) {
- if (isLooseMode) {
- if (breakNBSP)
- nextBreakable = nextBreakablePositionLoose(lazyBreakIterator, pos);
- else
- nextBreakable = nextBreakablePositionIgnoringNBSPLoose(lazyBreakIterator, pos);
- } else {
- if (breakNBSP)
- nextBreakable = nextBreakablePosition(lazyBreakIterator, pos);
- else
- nextBreakable = nextBreakablePositionIgnoringNBSP(lazyBreakIterator, pos);
- }
+ if (breakNBSP)
+ nextBreakable = nextBreakablePosition(lazyBreakIterator, pos);
+ else
+ nextBreakable = nextBreakablePositionIgnoringNBSP(lazyBreakIterator, pos);
}
return pos == nextBreakable;
}