Changeset 93626 in webkit


Ignore:
Timestamp:
Aug 23, 2011 12:38:05 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Text-indent and floats push the text out of the container box
https://bugs.webkit.org/show_bug.cgi?id=66662

Source/WebCore:

Text indent was not propagated when a new float was pushed on the line.
It was only calculated when the logicalLeft/RightOffsetForLine was called.
Because of that RenderBlock::LineBreaker::nextLineBreak used a bigger width
than actually available and made the line render on top of the borders.

Patch by Alexandru Chiculita <Alexandru Chiculita> on 2011-08-23
Reviewed by David Hyatt.

Tests: fast/block/float/floats-and-text-indent-rl.html

fast/block/float/floats-and-text-indent.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::textIndentOffset):
(WebCore::RenderBlock::logicalLeftOffsetForLine):
(WebCore::RenderBlock::logicalRightOffsetForLine):

  • rendering/RenderBlock.h:
  • rendering/RenderBlockLineLayout.cpp:

(WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded):

LayoutTests:

Patch by Alexandru Chiculita <Alexandru Chiculita> on 2011-08-23
Reviewed by David Hyatt.

  • fast/block/float/floats-and-text-indent-rl.html: Added.
  • fast/block/float/floats-and-text-indent.html: Added.
  • platform/chromium/test_expectations.txt:
  • platform/gtk/Skipped:
  • platform/mac/fast/block/float/floats-and-text-indent-expected.png: Added.
  • platform/mac/fast/block/float/floats-and-text-indent-expected.txt: Added.
  • platform/mac/fast/block/float/floats-and-text-indent-rl-expected.png: Added.
  • platform/mac/fast/block/float/floats-and-text-indent-rl-expected.txt: Added.
  • platform/qt/Skipped:
Location:
trunk
Files:
6 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r93624 r93626  
     12011-08-23  Alexandru Chiculita  <achicu@adobe.com>
     2
     3        Text-indent and floats push the text out of the container box
     4        https://bugs.webkit.org/show_bug.cgi?id=66662
     5
     6        Reviewed by David Hyatt.
     7
     8        * fast/block/float/floats-and-text-indent-rl.html: Added.
     9        * fast/block/float/floats-and-text-indent.html: Added.
     10        * platform/chromium/test_expectations.txt:
     11        * platform/gtk/Skipped:
     12        * platform/mac/fast/block/float/floats-and-text-indent-expected.png: Added.
     13        * platform/mac/fast/block/float/floats-and-text-indent-expected.txt: Added.
     14        * platform/mac/fast/block/float/floats-and-text-indent-rl-expected.png: Added.
     15        * platform/mac/fast/block/float/floats-and-text-indent-rl-expected.txt: Added.
     16        * platform/qt/Skipped:
     17
    1182011-08-23  Gavin Barraclough  <barraclough@apple.com>
    219
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r93593 r93626  
    36963696BUGV8_1634 : fast/js/const.html = TEXT
    36973697
     3698// Needs new baseline.
     3699BUGWK66662 : fast/block/float/floats-and-text-indent.html = IMAGE+TEXT
     3700BUGWK66662 : fast/block/float/floats-and-text-indent-rl.html = IMAGE+TEXT
     3701
    36983702BUGWK66730 WIN : http/tests/websocket/tests/hixie76/handshake-fail-by-no-connection-header.html = PASS TEXT
    36993703BUGWK66730 WIN : http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header.html = PASS TEXT
  • trunk/LayoutTests/platform/gtk/Skipped

    r93593 r93626  
    16131613webaudio/
    16141614
     1615# Need new baseline http://webkit.org/b/66662
     1616fast/block/float/floats-and-text-indent.html
     1617fast/block/float/floats-and-text-indent-rl.html
     1618
    16151619# Text shadow extents are calculated incorrectly
    16161620# https://bugs.webkit.org/show_bug.cgi?id=65035
  • trunk/LayoutTests/platform/qt/Skipped

    r93612 r93626  
    23802380fast/parser/innerhtml-with-prefixed-elements.xhtml
    23812381
     2382# Need new baseline http://webkit.org/b/66662
     2383fast/block/float/floats-and-text-indent.html
     2384fast/block/float/floats-and-text-indent-rl.html
     2385
    23822386# [Qt] editing/selection/caret-at-bidi-boundary.html fails
    23832387# https://bugs.webkit.org/show_bug.cgi?id=66514
  • trunk/Source/WebCore/ChangeLog

    r93625 r93626  
     12011-08-23  Alexandru Chiculita  <achicu@adobe.com>
     2
     3        Text-indent and floats push the text out of the container box
     4        https://bugs.webkit.org/show_bug.cgi?id=66662
     5
     6        Text indent was not propagated when a new float was pushed on the line.
     7        It was only calculated when the logicalLeft/RightOffsetForLine was called.
     8        Because of that RenderBlock::LineBreaker::nextLineBreak used a bigger width
     9        than actually available and made the line render on top of the borders.
     10
     11        Reviewed by David Hyatt.
     12
     13        Tests: fast/block/float/floats-and-text-indent-rl.html
     14               fast/block/float/floats-and-text-indent.html
     15
     16        * rendering/RenderBlock.cpp:
     17        (WebCore::RenderBlock::textIndentOffset):
     18        (WebCore::RenderBlock::logicalLeftOffsetForLine):
     19        (WebCore::RenderBlock::logicalRightOffsetForLine):
     20        * rendering/RenderBlock.h:
     21        * rendering/RenderBlockLineLayout.cpp:
     22        (WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded):
     23
    1242011-08-23  Al Patrick  <apatrick@chromium.org>
    225
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r93621 r93626  
    35363536}
    35373537
     3538LayoutUnit RenderBlock::textIndentOffset() const
     3539{
     3540    LayoutUnit cw = 0;
     3541    if (style()->textIndent().isPercent())
     3542        cw = containingBlock()->availableLogicalWidth();
     3543    return style()->textIndent().calcMinValue(cw);
     3544}
     3545
    35383546LayoutUnit RenderBlock::logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const
    35393547{
     
    35473555    }
    35483556
    3549     if (applyTextIndent && style()->isLeftToRightDirection()) {
    3550         LayoutUnit cw = 0;
    3551         if (style()->textIndent().isPercent())
    3552             cw = containingBlock()->availableLogicalWidth();
    3553         left += style()->textIndent().calcMinValue(cw);
    3554     }
     3557    if (applyTextIndent && style()->isLeftToRightDirection())
     3558        left += textIndentOffset();
    35553559
    35563560    return left;
     
    35693573    }
    35703574   
    3571     if (applyTextIndent && !style()->isLeftToRightDirection()) {
    3572         LayoutUnit cw = 0;
    3573         if (style()->textIndent().isPercent())
    3574             cw = containingBlock()->availableLogicalWidth();
    3575         right -= style()->textIndent().calcMinValue(cw);
    3576     }
     3575    if (applyTextIndent && !style()->isLeftToRightDirection())
     3576        right -= textIndentOffset();
    35773577   
    35783578    return right;
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r93621 r93626  
    130130    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool firstLine) const { return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(), firstLine); }
    131131    LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine) const { return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine) : logicalRightOffsetForLine(position, firstLine); }
     132    LayoutUnit textIndentOffset() const;
    132133
    133134    virtual VisiblePosition positionForPoint(const LayoutPoint&);
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r93621 r93626  
    17951795        return;
    17961796
    1797     if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft)
     1797    if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) {
    17981798        m_left = m_block->logicalRightForFloat(newFloat);
    1799     else
     1799        if (m_isFirstLine && m_block->style()->isLeftToRightDirection())
     1800            m_left += m_block->textIndentOffset();
     1801    } else {
    18001802        m_right = m_block->logicalLeftForFloat(newFloat);
     1803        if (m_isFirstLine && !m_block->style()->isLeftToRightDirection())
     1804            m_right -= m_block->textIndentOffset();
     1805    }
    18011806
    18021807    computeAvailableWidthFromLeftAndRight();
Note: See TracChangeset for help on using the changeset viewer.