Fix for bug 13208, implement word-break. This patch produces a partial
implementation of word-break. word-break: break-all is implemented. In
addition, a custom value, word-break: break-word is added that is a hybrid
of word-wrap: break-word and word-break: break-all (and more useful than
either).
Reviewed by beth
Added fast/text/word-break.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSPropertyNames.in:
* css/CSSValueKeywords.in:
* css/cssparser.cpp:
(WebCore::CSSParser::parseValue):
* css/cssstyleselector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* rendering/RenderStyle.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):
(WebCore::RenderStyle::diff):
* rendering/RenderStyle.h:
(WebCore::):
(WebCore::RenderStyle::breakWords):
(WebCore::RenderStyle::wordBreak):
(WebCore::RenderStyle::setWordBreak):
(WebCore::RenderStyle::initialWordBreak):
(WebCore::RenderStyle::initialWordWrap):
* rendering/RenderText.cpp:
(WebCore::RenderText::calcMinMaxWidthInternal):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::createInnerTextStyle):
(WebCore::RenderTextControl::calcHeight):
* rendering/bidi.cpp:
(WebCore::RenderBlock::findNextLineBreak):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index bf4b016..7341303 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -2226,9 +2226,10 @@
bool breakNBSP = autoWrap && o->style()->nbspMode() == SPACE;
// Auto-wrapping text should wrap in the middle of a word only if it could not wrap before the word,
// which is only possible if the word is the first thing on the line, that is, if |w| is zero.
- bool breakWords = o->style()->wordWrap() == BREAK_WORD && ((autoWrap && !w) || currWS == PRE);
+ bool breakWords = o->style()->breakWords() && ((autoWrap && !w) || currWS == PRE);
bool midWordBreak = false;
-
+ bool breakAll = o->style()->wordBreak() == BreakAllWordBreak && autoWrap;
+
while (len) {
bool previousCharacterIsSpace = currentCharacterIsSpace;
bool previousCharacterIsWS = currentCharacterIsWS;
@@ -2276,14 +2277,14 @@
currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c == noBreakSpace);
- if (breakWords && !midWordBreak) {
+ if (breakAll || (breakWords && !midWordBreak)) {
wrapW += t->width(pos, 1, f, w + wrapW);
midWordBreak = w + wrapW > width;
}
bool betweenWords = c == '\n' || (currWS != PRE && !atStart && isBreakable(str, pos, strlen, nextBreakable, breakNBSP));
-
- if (betweenWords || midWordBreak) {
+
+ if (betweenWords || midWordBreak || breakAll) {
bool stoppedIgnoringSpaces = false;
if (ignoringSpaces) {
if (!currentCharacterIsSpace) {