| Differences between
and this patch
- Source/WebCore/ChangeLog +35 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2011-04-27  Levi Weintraub  <leviw@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Add support for unicode-bidi:plaintext CSS property
6
        https://bugs.webkit.org/show_bug.cgi?id=50949
7
8
        Adding support for unicode-bidi: plaintext. This involves invoking P2 and P3
9
        of the Unicode BiDi algorithm on each paragraph of a block with that style.
10
        This is similar to dir=auto but done per-paragraph instead of per element.
11
12
        Test: fast/text/international/unicode-bidi-plaintext.html
13
14
        * css/CSSParser.cpp:
15
        (WebCore::CSSParser::parseValue):  Added plaintext.
16
        * css/CSSPrimitiveValueMappings.h:
17
        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Ditto.
18
        (WebCore::CSSPrimitiveValue::operator EUnicodeBidi): Ditto.
19
        * css/CSSValueKeywords.in: Ditto.
20
        * html/HTMLElement.cpp:
21
        (WebCore::unicodeBidiAttributeForDirAuto): Helper to map elements with dir=auto
22
        to their proper unicode-bidi attribute.
23
        (WebCore::HTMLElement::parseMappedAttribute): Assign plaintext to pre and textarea
24
        when dir=auto.
25
        * platform/text/UnicodeBidi.h: Added plaintext.
26
        * rendering/RenderBlockLineLayout.cpp:
27
        (WebCore::determineParagraphDirection): Determines the direction of a paragraph
28
        based on the first strong character. Stops at first paragraph separator.
29
        (WebCore::RenderBlock::layoutInlineChildren): Uses determineParagraphDirection
30
        when in unicode-bidi: plaintext mode (and operating at the block's BidiContext)
31
        to set each paragraph to the proper base BidiContext.
32
        (WebCore::RenderBlock::determineStartPosition): Ditto.
33
        * rendering/style/RenderStyle.h: Gave _unicodebidi another bit to accomodate
34
        for plaintext.
35
1
2011-06-21  Dmitry Lomov  <dslomov@google.com>
36
2011-06-21  Dmitry Lomov  <dslomov@google.com>
2
37
3
        Reviewed by Adam Barth.
38
        Reviewed by Adam Barth.
- Source/WebCore/css/CSSParser.cpp -2 / +3 lines
Lines 832-842 bool CSSParser::parseValue(int propId, b Source/WebCore/css/CSSParser.cpp_sec1
832
        else
832
        else
833
            return parseQuotes(propId, important);
833
            return parseQuotes(propId, important);
834
        break;
834
        break;
835
    case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | isolate | inherit
835
    case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | isolate | plaintext | inherit
836
        if (id == CSSValueNormal
836
        if (id == CSSValueNormal
837
            || id == CSSValueEmbed
837
            || id == CSSValueEmbed
838
            || id == CSSValueBidiOverride
838
            || id == CSSValueBidiOverride
839
            || id == CSSValueWebkitIsolate)
839
            || id == CSSValueWebkitIsolate
840
            || id == CSSValueWebkitPlaintext)
840
            validPrimitive = true;
841
            validPrimitive = true;
841
        break;
842
        break;
842
843
- Source/WebCore/css/CSSPrimitiveValueMappings.h +6 lines
Lines 1755-1760 template<> inline CSSPrimitiveValue::CSS Source/WebCore/css/CSSPrimitiveValueMappings.h_sec1
1755
        break;
1755
        break;
1756
    case Isolate:
1756
    case Isolate:
1757
        m_value.ident = CSSValueWebkitIsolate;
1757
        m_value.ident = CSSValueWebkitIsolate;
1758
        break;
1759
    case Plaintext:
1760
        m_value.ident = CSSValueWebkitPlaintext;
1761
        break;
1758
    }
1762
    }
1759
}
1763
}
1760
1764
Lines 1769-1774 template<> inline CSSPrimitiveValue::ope Source/WebCore/css/CSSPrimitiveValueMappings.h_sec2
1769
        return Override;
1773
        return Override;
1770
    case CSSValueWebkitIsolate:
1774
    case CSSValueWebkitIsolate:
1771
        return Isolate;
1775
        return Isolate;
1776
    case CSSValueWebkitPlaintext:
1777
        return Plaintext;
1772
    default:
1778
    default:
1773
        ASSERT_NOT_REACHED();
1779
        ASSERT_NOT_REACHED();
1774
        return UBNormal;
1780
        return UBNormal;
- Source/WebCore/css/CSSValueKeywords.in +1 lines
Lines 408-413 hide Source/WebCore/css/CSSValueKeywords.in_sec1
408
higher
408
higher
409
invert
409
invert
410
-webkit-isolate
410
-webkit-isolate
411
-webkit-plaintext
411
landscape
412
landscape
412
ledger
413
ledger
413
legal
414
legal
- Source/WebCore/html/HTMLElement.cpp -2 / +11 lines
Lines 125-131 bool HTMLElement::mapToEntry(const Quali Source/WebCore/html/HTMLElement.cpp_sec1
125
125
126
    return StyledElement::mapToEntry(attrName, result);
126
    return StyledElement::mapToEntry(attrName, result);
127
}
127
}
128
    
128
129
static inline int unicodeBidiAttributeForDirAuto(HTMLElement* element)
130
{
131
    if (element->hasLocalName(bdoTag))
132
        return CSSValueBidiOverride;
133
    if (element->hasLocalName(preTag) || element->hasLocalName(textareaTag))
134
        return CSSValueWebkitPlaintext;
135
    return CSSValueEmbed;
136
}
137
129
void HTMLElement::parseMappedAttribute(Attribute* attr)
138
void HTMLElement::parseMappedAttribute(Attribute* attr)
130
{
139
{
131
    if (isIdAttributeName(attr->name()) || attr->name() == classAttr || attr->name() == styleAttr)
140
    if (isIdAttributeName(attr->name()) || attr->name() == classAttr || attr->name() == styleAttr)
Lines 156-162 void HTMLElement::parseMappedAttribute(A Source/WebCore/html/HTMLElement.cpp_sec2
156
        if (!equalIgnoringCase(attr->value(), "auto"))
165
        if (!equalIgnoringCase(attr->value(), "auto"))
157
            addCSSProperty(attr, CSSPropertyDirection, attr->value());
166
            addCSSProperty(attr, CSSPropertyDirection, attr->value());
158
        dirAttributeChanged(attr);
167
        dirAttributeChanged(attr);
159
        addCSSProperty(attr, CSSPropertyUnicodeBidi, hasLocalName(bdoTag) ? CSSValueBidiOverride : CSSValueEmbed);
168
        addCSSProperty(attr, CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this));
160
    } else if (attr->name() == draggableAttr) {
169
    } else if (attr->name() == draggableAttr) {
161
        const AtomicString& value = attr->value();
170
        const AtomicString& value = attr->value();
162
        if (equalIgnoringCase(value, "true")) {
171
        if (equalIgnoringCase(value, "true")) {
- Source/WebCore/platform/text/UnicodeBidi.h -1 / +2 lines
Lines 32-38 enum EUnicodeBidi { Source/WebCore/platform/text/UnicodeBidi.h_sec1
32
    UBNormal,
32
    UBNormal,
33
    Embed,
33
    Embed,
34
    Override,
34
    Override,
35
    Isolate
35
    Isolate,
36
    Plaintext
36
};
37
};
37
38
38
}
39
}
- Source/WebCore/rendering/RenderBlockLineLayout.cpp -1 / +31 lines
Lines 112-117 static int inlineLogicalWidth(RenderObje Source/WebCore/rendering/RenderBlockLineLayout.cpp_sec1
112
    return extraWidth;
112
    return extraWidth;
113
}
113
}
114
114
115
static void determineParagraphDirection(TextDirection& dir, InlineIterator iter)
116
{
117
    while (!iter.atEnd()) {
118
        if (iter.atParagraphSeparator())
119
            return;
120
        if (UChar current = iter.current()) {
121
            Direction charDirection = direction(current);
122
            if (charDirection == LeftToRight) {
123
                dir = LTR;
124
                return;
125
            }
126
            if (charDirection == RightToLeft || charDirection == RightToLeftArabic) {
127
                dir = RTL;
128
                return;
129
            }
130
        }
131
        iter.increment();
132
    }
133
}
134
115
static void checkMidpoints(LineMidpointState& lineMidpointState, InlineIterator& lBreak)
135
static void checkMidpoints(LineMidpointState& lineMidpointState, InlineIterator& lBreak)
116
{
136
{
117
    // Check to see if our last midpoint is a start point beyond the line break.  If so,
137
    // Check to see if our last midpoint is a start point beyond the line break.  If so,
Lines 944-949 void RenderBlock::layoutRunsAndFloats(Li Source/WebCore/rendering/RenderBlockLineLayout.cpp_sec2
944
        lineInfo.setEmpty(true);
964
        lineInfo.setEmpty(true);
945
965
946
        InlineIterator oldEnd = end;
966
        InlineIterator oldEnd = end;
967
        bool isNewUBAParagraph = lineInfo.previousLineBrokeCleanly();
947
        FloatingObject* lastFloatFromPreviousLine = (m_floatingObjects && !m_floatingObjects->set().isEmpty()) ? m_floatingObjects->set().last() : 0;
968
        FloatingObject* lastFloatFromPreviousLine = (m_floatingObjects && !m_floatingObjects->set().isEmpty()) ? m_floatingObjects->set().last() : 0;
948
        end = lineBreaker.nextLineBreak(resolver, lineInfo, lineBreakIteratorInfo, lastFloatFromPreviousLine);
969
        end = lineBreaker.nextLineBreak(resolver, lineInfo, lineBreakIteratorInfo, lastFloatFromPreviousLine);
949
        if (resolver.position().atEnd()) {
970
        if (resolver.position().atEnd()) {
Lines 962-967 void RenderBlock::layoutRunsAndFloats(Li Source/WebCore/rendering/RenderBlockLineLayout.cpp_sec3
962
                lastRootBox()->setLineBreakInfo(end.m_obj, end.m_pos, resolver.status());
983
                lastRootBox()->setLineBreakInfo(end.m_obj, end.m_pos, resolver.status());
963
        } else {
984
        } else {
964
            VisualDirectionOverride override = (style()->rtlOrdering() == VisualOrder ? (style()->direction() == LTR ? VisualLeftToRightOverride : VisualRightToLeftOverride) : NoVisualOverride);
985
            VisualDirectionOverride override = (style()->rtlOrdering() == VisualOrder ? (style()->direction() == LTR ? VisualLeftToRightOverride : VisualRightToLeftOverride) : NoVisualOverride);
986
987
            if (isNewUBAParagraph && style()->unicodeBidi() == Plaintext && !resolver.context()->parent()) {
988
                TextDirection direction = style()->direction();
989
                determineParagraphDirection(direction, resolver.position());
990
                resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override));
991
            }
965
            // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine.
992
            // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine.
966
            BidiRunList<BidiRun>& bidiRuns = resolver.runs();
993
            BidiRunList<BidiRun>& bidiRuns = resolver.runs();
967
            resolver.createBidiRunsForLine(end, override, lineInfo.previousLineBrokeCleanly());
994
            resolver.createBidiRunsForLine(end, override, lineInfo.previousLineBrokeCleanly());
Lines 1349-1355 RootInlineBox* RenderBlock::determineSta Source/WebCore/rendering/RenderBlockLineLayout.cpp_sec4
1349
        resolver.setPosition(InlineIterator(this, last->lineBreakObj(), last->lineBreakPos()));
1376
        resolver.setPosition(InlineIterator(this, last->lineBreakObj(), last->lineBreakPos()));
1350
        resolver.setStatus(last->lineBreakBidiStatus());
1377
        resolver.setStatus(last->lineBreakBidiStatus());
1351
    } else {
1378
    } else {
1352
        resolver.setStatus(BidiStatus(style()->direction(), style()->unicodeBidi() == Override));
1379
        TextDirection direction = style()->direction();
1380
        if (style()->unicodeBidi() == Plaintext)
1381
            determineParagraphDirection(direction, InlineIterator(this, bidiFirstNotSkippingInlines(this), 0));
1382
        resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override));
1353
        resolver.setPosition(InlineIterator(this, bidiFirstSkippingInlines(this, &resolver), 0));
1383
        resolver.setPosition(InlineIterator(this, bidiFirstSkippingInlines(this, &resolver), 0));
1354
    }
1384
    }
1355
    return curr;
1385
    return curr;
- Source/WebCore/rendering/style/RenderStyle.h -2 / +2 lines
Lines 256-264 protected: Source/WebCore/rendering/style/RenderStyle.h_sec1
256
        bool _affectedByActive : 1;
256
        bool _affectedByActive : 1;
257
        bool _affectedByDrag : 1;
257
        bool _affectedByDrag : 1;
258
        unsigned _pseudoBits : 7;
258
        unsigned _pseudoBits : 7;
259
        unsigned _unicodeBidi : 2; // EUnicodeBidi
259
        unsigned _unicodeBidi : 3; // EUnicodeBidi
260
        bool _isLink : 1;
260
        bool _isLink : 1;
261
        // 50 bits
261
        // 53 bits
262
    } noninherited_flags;
262
    } noninherited_flags;
263
263
264
// !END SYNC!
264
// !END SYNC!
- LayoutTests/ChangeLog +12 lines
Lines 1-3 LayoutTests/ChangeLog_sec1
1
2011-04-06  Levi Weintraub  <leviw@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Add support for unicode-bidi:plaintext CSS property
6
        https://bugs.webkit.org/show_bug.cgi?id=50949
7
        Adding support for the 'plaintext' mode of unicode-bidi.
8
9
        * fast/text/international/unicode-bidi-plaintext.html: Added.
10
        * platform/mac/fast/text/international/unicode-bidi-plaintext-expected.png: Added.
11
        * platform/mac/fast/text/international/unicode-bidi-plaintext-expected.txt: Added.
12
1
2011-06-21  Dmitry Titov  <dimich@chromium.org>
13
2011-06-21  Dmitry Titov  <dimich@chromium.org>
2
14
3
        [Chromium] Unreviewed update of test expectations.
15
        [Chromium] Unreviewed update of test expectations.
- LayoutTests/fast/text/international/unicode-bidi-plaintext.html +61 lines
Line 0 LayoutTests/fast/text/international/unicode-bidi-plaintext.html_sec1
1
<!DOCTYPE html>
2
3
<html>
4
<head>
5
<style> 
6
.resultsDiv {
7
    position: absolute;
8
    top: 0px;
9
    left: 0px;
10
    -moz-column-width: 13em;
11
    -webkit-column-width: 13em;
12
    -moz-column-gap: 5em;
13
    -webkit-column-gap: 5em;
14
    height: 400px;
15
}
16
</style>
17
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
18
</head>
19
<body>
20
<div>This tests proper handling of unicode-bidi: plaintext. You should not see any red.</div>
21
22
<div style="position:relative">
23
<div class="resultsDiv">
24
<div style="color: red; unicode-bidi: -webkit-plaintext;">
25
!hello.
26
<br>
27
!שלום.
28
<br>
29
hello, לוי!
30
<br>
31
שלום, WebKit!
32
</div>
33
<pre style="color: red; margin: 0;" dir="auto">
34
a
35
(
36
שלום, WebKit!
37
hello, לוי!
38
)
39
</pre>
40
</div>
41
</div>
42
43
<div style="position: relative;">
44
<div style="color:green;" class="resultsDiv" dir=ltr>
45
!hello.<br>
46
<span dir=rtl>
47
!שלום.
48
</span><br>
49
<span dir=ltr>
50
hello, לוי!
51
</span><br>
52
<span dir=rtl>
53
שלום, WebKit!</span><br>
54
<pre style="color: green; margin: 0;">
55
a
56
(
57
!WebKit ,שלום
58
hello, לוי!
59
)
60
</pre>
61
</div>
- LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-expected.txt +79 lines
Line 0 LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-expected.txt_sec1
1
layer at (0,0) size 800x600
2
  RenderView at (0,0) size 800x600
3
layer at (0,0) size 800x34
4
  RenderBlock {HTML} at (0,0) size 800x34
5
    RenderBody {BODY} at (8,8) size 784x18
6
      RenderBlock {DIV} at (0,0) size 784x18
7
        RenderText {#text} at (0,0) size 510x18
8
          text run at (0,0) width 510: "This tests proper handling of unicode-bidi: plaintext. You should not see any red."
9
layer at (8,26) size 102x400
10
  RenderBlock (positioned) {DIV} at (0,0) size 102x400
11
    RenderBlock {DIV} at (0,0) size 102x75 [color=#FF0000]
12
      RenderText {#text} at (0,0) size 44x18
13
        text run at (0,0) width 44: "!hello. "
14
      RenderBR {BR} at (44,0) size 0x18
15
      RenderText {#text} at (0,19) size 50x18
16
        text run at (0,19) width 50 RTL: "!\x{5E9}\x{5DC}\x{5D5}\x{5DD}. "
17
      RenderBR {BR} at (0,19) size 0x18
18
      RenderText {#text} at (0,38) size 67x18
19
        text run at (0,38) width 39: "hello, "
20
        text run at (39,38) width 19 RTL: "\x{5DC}\x{5D5}\x{5D9}"
21
        text run at (57,38) width 10: "! "
22
      RenderBR {BR} at (66,38) size 1x18
23
      RenderText {#text} at (0,57) size 100x18
24
        text run at (0,57) width 5 RTL: "!"
25
        text run at (5,57) width 50: "WebKit"
26
        text run at (55,57) width 45 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}, "
27
    RenderBlock {PRE} at (0,75) size 102x77 [color=#FF0000]
28
      RenderText {#text} at (0,0) size 102x77
29
        text run at (0,0) width 8: "a"
30
        text run at (8,0) width 0: " "
31
        text run at (0,15) width 8: "("
32
        text run at (8,15) width 0: " "
33
        text run at (0,31) width 0 RTL: " "
34
        text run at (0,31) width 8 RTL: "!"
35
        text run at (8,31) width 48: "WebKit"
36
        text run at (56,31) width 46 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}, "
37
        text run at (0,47) width 56: "hello, "
38
        text run at (56,47) width 16 RTL: "\x{5DC}\x{5D5}\x{5D9}"
39
        text run at (71,47) width 9: "!"
40
        text run at (79,47) width 1: " "
41
        text run at (0,62) width 8: ")"
42
        text run at (8,62) width 0: " "
43
layer at (8,26) size 102x400
44
  RenderBlock (positioned) {DIV} at (0,0) size 102x400 [color=#008000]
45
    RenderBlock (anonymous) at (0,0) size 102x75
46
      RenderText {#text} at (0,0) size 40x18
47
        text run at (0,0) width 40: "!hello."
48
      RenderBR {BR} at (40,0) size 0x18
49
      RenderInline {SPAN} at (0,0) size 50x18
50
        RenderText {#text} at (0,19) size 50x18
51
          text run at (0,19) width 50 RTL: "!\x{5E9}\x{5DC}\x{5D5}\x{5DD}. "
52
      RenderBR {BR} at (49,19) size 1x18
53
      RenderInline {SPAN} at (0,0) size 67x18
54
        RenderText {#text} at (0,38) size 67x18
55
          text run at (0,38) width 39: "hello, "
56
          text run at (39,38) width 19 RTL: "\x{5DC}\x{5D5}\x{5D9}"
57
          text run at (57,38) width 10: "! "
58
      RenderBR {BR} at (66,38) size 1x18
59
      RenderInline {SPAN} at (0,0) size 100x18
60
        RenderText {#text} at (0,57) size 100x18
61
          text run at (0,57) width 5 RTL: "!"
62
          text run at (5,57) width 50: "WebKit"
63
          text run at (55,57) width 45 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}, "
64
      RenderBR {BR} at (99,57) size 1x18
65
    RenderBlock {PRE} at (0,75) size 102x77
66
      RenderText {#text} at (0,0) size 102x77
67
        text run at (0,0) width 8: "a"
68
        text run at (8,0) width 0: " "
69
        text run at (0,15) width 8: "("
70
        text run at (8,15) width 0: " "
71
        text run at (0,31) width 72: "!WebKit ,"
72
        text run at (72,31) width 30 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}"
73
        text run at (101,31) width 1: " "
74
        text run at (0,47) width 56: "hello, "
75
        text run at (56,47) width 16 RTL: "\x{5DC}\x{5D5}\x{5D9}"
76
        text run at (71,47) width 9: "!"
77
        text run at (79,47) width 1: " "
78
        text run at (0,62) width 8: ")"
79
        text run at (8,62) width 0: " "
- LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-expected.png
Line 494 LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-expected.png_sec1

Return to Bug 50949