https://bugs.webkit.org/show_bug.cgi?id=66402
Reviewed by Dave Hyatt.
Source/WebCore:
Test: fast/text/midword-break-before-surrogate-pair-2.html
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::LineBreaker::nextLineBreak): Just never allow a mid-word
break before a trailing surrogate.
LayoutTests:
* fast/text/midword-break-before-surrogate-pair-2.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93237
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-08-17 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/9971293> Mid-word breaks can occur in the middle of a surrogate pair
+ https://bugs.webkit.org/show_bug.cgi?id=66402
+
+ Reviewed by Dave Hyatt.
+
+ * fast/text/midword-break-before-surrogate-pair-2.html: Added.
+
2011-08-17 Ryosuke Niwa <rniwa@webkit.org>
Rebaseline for Windows, Chromium Windows, and Chromium Linux after r93221.
--- /dev/null
+<div style="word-break: break-all; border: solid blue; font-size: 36px; width: 5em;">
+ 🇯🇵🇯🇵🇯🇵🇯🇵🇯🇵🇯🇵🇯🇵🇯🇵
+</div>
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 186x100 [border: (3px solid #0000FF)]
+ RenderText {#text} at (3,7) size 145x88
+ text run at (3,7) width 145: "\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}"
+ text run at (3,54) width 145: "\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}"
+2011-08-17 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/9971293> Mid-word breaks can occur in the middle of a surrogate pair
+ https://bugs.webkit.org/show_bug.cgi?id=66402
+
+ Reviewed by Dave Hyatt.
+
+ Test: fast/text/midword-break-before-surrogate-pair-2.html
+
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::LineBreaker::nextLineBreak): Just never allow a mid-word
+ break before a trailing surrogate.
+
2011-08-16 Chang Shu <cshu@webkit.org>
Support reset in WebCore::Internals
currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c == noBreakSpace);
- bool midWordBreakIsBeforeSurrogatePair = false;
if ((breakAll || breakWords) && !midWordBreak) {
wrapW += charWidth;
- midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && current.m_pos + 1 < t->textLength() && U16_IS_TRAIL(t->characters()[current.m_pos + 1]);
+ bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && current.m_pos + 1 < t->textLength() && U16_IS_TRAIL(t->characters()[current.m_pos + 1]);
charWidth = textWidth(t, current.m_pos, midWordBreakIsBeforeSurrogatePair ? 2 : 1, f, width.committedWidth() + wrapW, isFixedPitch, collapseWhiteSpace);
midWordBreak = width.committedWidth() + wrapW + charWidth > width.availableWidth();
}
breakWords = false;
}
- if (midWordBreak) {
+ if (midWordBreak && !U16_IS_TRAIL(c)) {
// Remember this as a breakable position in case
// adding the end width forces a break.
lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition);
midWordBreak &= (breakWords || breakAll);
- if (midWordBreakIsBeforeSurrogatePair)
- current.fastIncrementInTextNode();
}
if (betweenWords) {