Commit b0ad6eb8 authored by xji@chromium.org's avatar xji@chromium.org

2011-02-01 Xiaomei Ji <xji@chromium.org>

        Reviewed by David Hyatt.

        Fix a text rendering problem when enclosing block is RTL and text runs
        are in different directionality.
        https://bugs.webkit.org/show_bug.cgi?id=34176

        The problem happens in the following example scenario (ABC represents 
        Hebrew characters):
        <div dir=rtl>this is a <span><span>test <span>ABC</span></span></span></div>

        The line consists of 3 text runs -- TextRun1 TextRun2 TextRun3. In which
        TextRun1 and TextRun2's bidi level are 2, and TextRun3's bidi level is 1.
        TextRun2 and TextRun3's least common ancestor is not a sibling of TextRun1.

        The visual bidi run order of the text runs is TextRun3 TextRun1 TextRun2.

        Inside RenderBlock::constructLine(), when RenderBlock::createLineBoxes()
        creates InlineFlowBox for TextRun2, it should check an InlineFlowBox for
        the run's render object's ancestor (not only its parent) has already 
        been constructed or has something following it on the line, in which 
        case, create a new box for TextRun2 instead of sharing the same box with
        TextRun3.

        In other words, the following 2 div should render the same results
        (ABC represents Hebrew characters).
        <div dir=rtl>this is a <span><span>test <span>ABC</span></span></span></div>
        <div dir=rtl>this is a <span>Test <span>ABC</span></span></div>

        Test: fast/dom/34176.html

        * rendering/RenderBlockLineLayout.cpp:
        (WebCore::parentIsConstructedOrHaveNext):
        (WebCore::RenderBlock::createLineBoxes):
2011-02-01  Xiaomei Ji  <xji@chromium.org>

        Reviewed by David Hyatt.

        Fix a text rendering problem when enclosing block is RTL and text runs
        are in different directionality.
        https://bugs.webkit.org/show_bug.cgi?id=34176

        The problem happens in the following example scenario (ABC represents 
        Hebrew characters):
        <div dir=rtl>this is a <span><span>test <span>ABC</span></span></span></div>

        The line consists of 3 text runs -- TextRun1 TextRun2 TextRun3. In which
        TextRun1 and TextRun2's bidi level are 2, and TextRun3's bidi level is 1.
        TextRun2 and TextRun3's least common ancestor is not a sibling of TextRun1.

        The visual bidi run order of the text runs is TextRun3 TextRun1 TextRun2.

        Inside RenderBlock::constructLine(), when RenderBlock::createLineBoxes()
        creates InlineFlowBox for TextRun2, it should check an InlineFlowBox for
        the run's render object's ancestor (not only its parent) has already 
        been constructed or has something following it on the line, in which 
        case, create a new box for TextRun2 instead of sharing the same box with
        TextRun3.

        In other words, the following 2 div should render the same results
        (ABC represents Hebrew characters).
        <div dir=rtl>this is a <span><span>test <span>ABC</span></span></span></div>
        <div dir=rtl>this is a <span>Test <span>ABC</span></span></div>

        * fast/dom/34176.html: Added.
        * platform/mac/fast/dom/34176-expected.checksum: Added.
        * platform/mac/fast/dom/34176-expected.png: Added.
        * platform/mac/fast/dom/34176-expected.txt: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7f811f6d
2011-02-01 Xiaomei Ji <xji@chromium.org>
Reviewed by David Hyatt.
Fix a text rendering problem when enclosing block is RTL and text runs
are in different directionality.
https://bugs.webkit.org/show_bug.cgi?id=34176
The problem happens in the following example scenario (ABC represents
Hebrew characters):
<div dir=rtl>this is a <span><span>test <span>ABC</span></span></span></div>
The line consists of 3 text runs -- TextRun1 TextRun2 TextRun3. In which
TextRun1 and TextRun2's bidi level are 2, and TextRun3's bidi level is 1.
TextRun2 and TextRun3's least common ancestor is not a sibling of TextRun1.
The visual bidi run order of the text runs is TextRun3 TextRun1 TextRun2.
Inside RenderBlock::constructLine(), when RenderBlock::createLineBoxes()
creates InlineFlowBox for TextRun2, it should check an InlineFlowBox for
the run's render object's ancestor (not only its parent) has already
been constructed or has something following it on the line, in which
case, create a new box for TextRun2 instead of sharing the same box with
TextRun3.
In other words, the following 2 div should render the same results
(ABC represents Hebrew characters).
<div dir=rtl>this is a <span><span>test <span>ABC</span></span></span></div>
<div dir=rtl>this is a <span>Test <span>ABC</span></span></div>
* fast/dom/34176.html: Added.
* platform/mac/fast/dom/34176-expected.checksum: Added.
* platform/mac/fast/dom/34176-expected.png: Added.
* platform/mac/fast/dom/34176-expected.txt: Added.
2011-02-01 Mihai Parparita <mihaip@chromium.org>
Unreviewed. Include actual values in fast/canvas/webgl/gl-teximage.html
9cae7936753d75b4040cf4985efd25a5
\ No newline at end of file
This diff is collapsed.
2011-02-01 Xiaomei Ji <xji@chromium.org>
Reviewed by David Hyatt.
Fix a text rendering problem when enclosing block is RTL and text runs
are in different directionality.
https://bugs.webkit.org/show_bug.cgi?id=34176
The problem happens in the following example scenario (ABC represents
Hebrew characters):
<div dir=rtl>this is a <span><span>test <span>ABC</span></span></span></div>
The line consists of 3 text runs -- TextRun1 TextRun2 TextRun3. In which
TextRun1 and TextRun2's bidi level are 2, and TextRun3's bidi level is 1.
TextRun2 and TextRun3's least common ancestor is not a sibling of TextRun1.
The visual bidi run order of the text runs is TextRun3 TextRun1 TextRun2.
Inside RenderBlock::constructLine(), when RenderBlock::createLineBoxes()
creates InlineFlowBox for TextRun2, it should check an InlineFlowBox for
the run's render object's ancestor (not only its parent) has already
been constructed or has something following it on the line, in which
case, create a new box for TextRun2 instead of sharing the same box with
TextRun3.
In other words, the following 2 div should render the same results
(ABC represents Hebrew characters).
<div dir=rtl>this is a <span><span>test <span>ABC</span></span></span></div>
<div dir=rtl>this is a <span>Test <span>ABC</span></span></div>
Test: fast/dom/34176.html
* rendering/RenderBlockLineLayout.cpp:
(WebCore::parentIsConstructedOrHaveNext):
(WebCore::RenderBlock::createLineBoxes):
2011-02-01 Abhishek Arya <inferno@chromium.org>
Reviewed by Dan Bernstein.
......@@ -184,6 +184,16 @@ static inline void dirtyLineBoxesForRenderer(RenderObject* o, bool fullLayout)
toRenderInline(o)->dirtyLineBoxes(fullLayout);
}
static bool parentIsConstructedOrHaveNext(InlineFlowBox* parentBox)
{
do {
if (parentBox->isConstructed() || parentBox->nextOnLine())
return true;
parentBox = parentBox->parent();
} while (parentBox);
return false;
}
InlineFlowBox* RenderBlock::createLineBoxes(RenderObject* obj, bool firstLine)
{
// See if we have an unconstructed line box for this object that is also
......@@ -198,13 +208,13 @@ InlineFlowBox* RenderBlock::createLineBoxes(RenderObject* obj, bool firstLine)
// Get the last box we made for this render object.
parentBox = obj->isRenderInline() ? toRenderInline(obj)->lastLineBox() : toRenderBlock(obj)->lastLineBox();
// If this box is constructed then it is from a previous line, and we need
// to make a new box for our line. If this box is unconstructed but it has
// If this box or its ancestor is constructed then it is from a previous line, and we need
// to make a new box for our line. If this box or its ancestor is unconstructed but it has
// something following it on the line, then we know we have to make a new box
// as well. In this situation our inline has actually been split in two on
// the same line (this can happen with very fancy language mixtures).
bool constructedNewBox = false;
if (!parentBox || parentBox->isConstructed() || parentBox->nextOnLine()) {
if (!parentBox || parentIsConstructedOrHaveNext(parentBox)) {
// We need to make a new box for this render object. Once
// made, we need to place it at the end of the current line.
InlineBox* newBox = createInlineBoxForRenderer(obj, obj == this);
......
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