Commit a2c2e1bf authored by harrison's avatar harrison
Browse files

LayoutTests:

        Reviewed by John Sullivan.

        <rdar://problem/4641262> REGRESSION: Japanese text corrupts on wrapping point

        * fast/text/international/wrap-CJK-001-expected.checksum: Added.
        * fast/text/international/wrap-CJK-001-expected.png: Added.
        * fast/text/international/wrap-CJK-001-expected.txt: Added.
        * fast/text/international/wrap-CJK-001.html: Added.

WebCore:

        Reviewed by John Sullivan.

        <rdar://problem/4641262> REGRESSION: Japanese text corrupts on wrapping point

        Problem was that the decision to trim was based only on whether the character
        is a soft hyphen, which caused pretty much any Japanese character to go.
        Changed to decide based on whether the character is ignorable whitespace.
        
        Test:
        * fast/text/international/wrap-CJK-001.html

        * rendering/bidi.cpp:
        (WebCore::isTrimmableChar):
        New. Checks whether character is whitespace that can be ignored
        according to the text node's style.
        trimmed from the end of wrapped line.
        (WebCore::checkMidpoints):
        Call isTrimmable() rather than checking for char != SOFT_HYPHEN.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16700 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 604f4f32
2006-09-30 David Harrison <harrison@apple.com>
Reviewed by John Sullivan.
<rdar://problem/4641262> REGRESSION: Japanese text corrupts on wrapping point
* fast/text/international/wrap-CJK-001-expected.checksum: Added.
* fast/text/international/wrap-CJK-001-expected.png: Added.
* fast/text/international/wrap-CJK-001-expected.txt: Added.
* fast/text/international/wrap-CJK-001.html: Added.
2006-10-01 Graham Dennis <graham.dennis@gmail.com>
 
Reviewed by Hyatt.
aabc4e5b15132f95a15057762a39f2fa
\ No newline at end of file
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 784x580
RenderBlock (anonymous) at (0,0) size 784x14
RenderText {#text} at (0,0) size 345x14
text run at (0,0) width 345: "Tests that wrapping does not trim the last character if it is not whitespace."
RenderBlock {P} at (0,26) size 551x34 [border: (3px solid #FF0000)]
RenderText {#text} at (3,3) size 545x28
text run at (3,3) width 545: "\x{6700}\x{5927}2GHz\x{306E}Intel Core Duo\x{30D7}\x{30ED}\x{30BB}\x{30C3}\x{30B5}\x{306E}\x{30D1}\x{30EF}\x{30FC}\x{3001}iSight\x{30AB}\x{30E1}\x{30E9}\x{3001}Front Row\x{3001}iLife \x{2019}06\x{3001}13\x{30A4}\x{30F3}\x{30C1}\x{306E}\x{30AF}\x{30EA}\x{30A2}"
text run at (3,17) width 168: "\x{30EF}\x{30A4}\x{30C9}\x{30B9}\x{30AF}\x{30EA}\x{30FC}\x{30F3}\x{30C7}\x{30A3}\x{30B9}\x{30D7}\x{30EC}\x{30A4}"
RenderText {#text} at (0,0) size 0x0
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=x-sjis"></head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-family:'Times'; font-size:12px">
Tests that wrapping does not trim the last character if it is not whitespace.
<p style="border-style:solid; border-color:red; width:545px">最大2GHzのIntel Core Duoプロセッサのパワー、iSightカメラ、Front Row、iLife ’06、13インチのクリアワイドスクリーンディスプレイ
</body>
</html>
\ No newline at end of file
2006-09-30 David Harrison <harrison@apple.com>
Reviewed by John Sullivan.
<rdar://problem/4641262> REGRESSION: Japanese text corrupts on wrapping point
Problem was that the decision to trim was based only on whether the character
is a soft hyphen, which caused pretty much any Japanese character to go.
Changed to decide based on whether the character is ignorable whitespace.
Test:
* fast/text/international/wrap-CJK-001.html
* rendering/bidi.cpp:
(WebCore::isTrimmableChar):
New. Checks whether character is whitespace that can be ignored
according to the text node's style.
trimmed from the end of wrapped line.
(WebCore::checkMidpoints):
Call isTrimmable() rather than checking for char != SOFT_HYPHEN.
2006-10-01 Anders Carlsson <acarlsson@apple.com>
 
Reviewed by Mitz Pettel.
......@@ -104,6 +104,8 @@ static bool previousLineBrokeCleanly = true;
static bool emptyRun = true;
static int numSpaces;
static const unsigned short nonBreakingSpace = 0xa0;
static void embed(UCharDirection, BidiState&);
static void appendRun(BidiState&);
......@@ -501,6 +503,17 @@ static void chopMidpointsAt(RenderObject* obj, unsigned pos)
}
}
static bool isTrimmable(RenderText* textObj, unsigned int index)
{
ASSERT(index < textObj->length());
// FIXME: Also ask ICU whether character is whitespace? Seems expensive. Is it needed for correctness?
UChar c = textObj->text()[index];
return c == ' ' || c == '\t' ||
(c == '\n' && !textObj->style()->preserveNewline()) ||
(c == nonBreakingSpace && textObj->style()->nbspMode() == SPACE);
}
static void checkMidpoints(BidiIterator& lBreak, BidiState& bidi)
{
// Check to see if our last midpoint is a start point beyond the line break. If so,
......@@ -518,10 +531,9 @@ static void checkMidpoints(BidiIterator& lBreak, BidiState& bidi)
sNumMidpoints--;
if (endpoint.obj->style()->collapseWhiteSpace()) {
if (endpoint.obj->isText()) {
// Don't shave a character off the endpoint if it was from a soft hyphen.
RenderText* textObj = static_cast<RenderText*>(endpoint.obj);
if (endpoint.pos+1 < textObj->length()) {
if (textObj->text()[endpoint.pos+1] == SOFT_HYPHEN)
if (!isTrimmable(textObj, endpoint.pos+1))
return;
} else if (startpoint.obj->isText()) {
RenderText *startText = static_cast<RenderText*>(startpoint.obj);
......@@ -1895,8 +1907,6 @@ bool RenderBlock::matchedEndLine(const BidiIterator& start, const BidiStatus& st
return false;
}
static const unsigned short nonBreakingSpace = 0xa0;
static inline bool skipNonBreakingSpace(BidiIterator &it)
{
if (it.obj->style()->nbspMode() != SPACE || it.current() != nonBreakingSpace)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment