Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Unified Diff: Source/platform/text/TextBreakIterator.h

Issue 1094863007: Implement "word-break: keep-all" in CSS3 Text (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Replace custom SA charset detecting function to already existing one Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/style/ComputedStyleConstants.h ('k') | Source/platform/text/TextBreakIterator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/text/TextBreakIterator.h
diff --git a/Source/platform/text/TextBreakIterator.h b/Source/platform/text/TextBreakIterator.h
index dde67ee9657695cfff41a55be4fc274d8217d8b0..fc11ba8f85322eefa95de07ff319098d2442a8c1 100644
--- a/Source/platform/text/TextBreakIterator.h
+++ b/Source/platform/text/TextBreakIterator.h
@@ -54,6 +54,7 @@ const int TextBreakDone = -1;
enum class LineBreakType {
Normal,
BreakAll, // word-break:break-all allows breaks between letters/numbers
+ KeepAll, // word-break:keep-all doesn't allow breaks between all kind of letters/numbers except some south east asians'.
};
class PLATFORM_EXPORT LazyLineBreakIterator {
@@ -165,9 +166,16 @@ public:
inline bool isBreakable(int pos, int& nextBreakable, LineBreakType lineBreakType = LineBreakType::Normal)
{
if (pos > nextBreakable) {
- nextBreakable = lineBreakType == LineBreakType::BreakAll
- ? nextBreakablePositionBreakAll(pos)
- : nextBreakablePositionIgnoringNBSP(pos);
+ switch (lineBreakType) {
+ case LineBreakType::BreakAll:
+ nextBreakable = nextBreakablePositionBreakAll(pos);
+ break;
+ case LineBreakType::KeepAll:
+ nextBreakable = nextBreakablePositionKeepAll(pos);
+ break;
+ default:
+ nextBreakable = nextBreakablePositionIgnoringNBSP(pos);
+ }
}
return pos == nextBreakable;
}
@@ -175,6 +183,7 @@ public:
private:
int nextBreakablePositionIgnoringNBSP(int pos);
int nextBreakablePositionBreakAll(int pos);
+ int nextBreakablePositionKeepAll(int pos);
static const unsigned priorContextCapacity = 2;
String m_string;
« no previous file with comments | « Source/core/style/ComputedStyleConstants.h ('k') | Source/platform/text/TextBreakIterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698