Changeset 125202 in webkit


Ignore:
Timestamp:
Aug 9, 2012 2:12:44 PM (12 years ago)
Author:
robert@webkit.org
Message:

CSS 2.1 failure: 'Text-indent' only affects a line if it is the first formatted line of an element
https://bugs.webkit.org/show_bug.cgi?id=63185

Reviewed by Eric Seidel.

Source/WebCore:

Per CSS 2.1 (http://www.w3.org/TR/CSS21/text.html) : "'Text-indent' only affects a line if it is the
first formatted line of an element. For example, the first line of an anonymous block box is only
affected if it is the first child of its parent element."

Tests: fast/css/text-indent-first-line-001.html

fast/css/text-indent-first-line-002.html
fast/css/text-indent-first-line-003.html
fast/css/text-indent-first-line-004.html
fast/css/text-indent-first-line-005.html
fast/css/text-indent-first-line-006.html

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::computeInlineDirectionPositionsForLine): As well as being the first line under a parent block,

check that this is also the first *formatted* line of an element by ensuring that we are at the start of a
formatting context and not just a continuation of a previous anonymous block in an existing formatting context.

LayoutTests:

  • css2.1/20110323/text-indent-014-expected.html: Added.
  • css2.1/20110323/text-indent-014.htm: Added.
  • fast/css/text-indent-first-line-001-expected.html: Added.
  • fast/css/text-indent-first-line-001.html: Added.
  • fast/css/text-indent-first-line-002-expected.html: Added.
  • fast/css/text-indent-first-line-002.html: Added.
  • fast/css/text-indent-first-line-003-expected.html: Added.
  • fast/css/text-indent-first-line-003.html: Added.
  • fast/css/text-indent-first-line-004-expected.html: Added.
  • fast/css/text-indent-first-line-004.html: Added.
  • fast/css/text-indent-first-line-005-expected.html: Added.
  • fast/css/text-indent-first-line-005.html: Added. Text-indent in the span here is inherited from the div. CSS 2.1: "Since the 'text-indent' property inherits, when specified on a block element, it will affect descendant inline-block elements."
  • fast/css/text-indent-first-line-006-expected.html: Added.
  • fast/css/text-indent-first-line-006.html: Added.
Location:
trunk
Files:
14 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125200 r125202  
     12012-08-09  Robert Hogan  <robert@webkit.org>
     2
     3        CSS 2.1 failure: 'Text-indent' only affects a line if it is the first formatted line of an element
     4        https://bugs.webkit.org/show_bug.cgi?id=63185
     5
     6        Reviewed by Eric Seidel.
     7
     8        * css2.1/20110323/text-indent-014-expected.html: Added.
     9        * css2.1/20110323/text-indent-014.htm: Added.
     10        * fast/css/text-indent-first-line-001-expected.html: Added.
     11        * fast/css/text-indent-first-line-001.html: Added.
     12        * fast/css/text-indent-first-line-002-expected.html: Added.
     13        * fast/css/text-indent-first-line-002.html: Added.
     14        * fast/css/text-indent-first-line-003-expected.html: Added.
     15        * fast/css/text-indent-first-line-003.html: Added.
     16        * fast/css/text-indent-first-line-004-expected.html: Added.
     17        * fast/css/text-indent-first-line-004.html: Added.
     18        * fast/css/text-indent-first-line-005-expected.html: Added.
     19        * fast/css/text-indent-first-line-005.html: Added.
     20          Text-indent in the span here is inherited from the div. CSS 2.1: "Since the 'text-indent'
     21          property inherits, when specified on a block element, it will affect descendant
     22          inline-block elements."
     23        * fast/css/text-indent-first-line-006-expected.html: Added.
     24        * fast/css/text-indent-first-line-006.html: Added.
     25
    1262012-08-09  Roger Fong  <roger_fong@apple.com>
    227
  • trunk/Source/WebCore/ChangeLog

    r125201 r125202  
     12012-08-09  Robert Hogan  <robert@webkit.org>
     2
     3        CSS 2.1 failure: 'Text-indent' only affects a line if it is the first formatted line of an element
     4        https://bugs.webkit.org/show_bug.cgi?id=63185
     5
     6        Reviewed by Eric Seidel.
     7
     8        Per CSS 2.1 (http://www.w3.org/TR/CSS21/text.html) : "'Text-indent' only affects a line if it is the
     9        first formatted line of an element. For example, the first line of an anonymous block box is only
     10        affected if it is the first child of its parent element."
     11
     12        Tests: fast/css/text-indent-first-line-001.html
     13               fast/css/text-indent-first-line-002.html
     14               fast/css/text-indent-first-line-003.html
     15               fast/css/text-indent-first-line-004.html
     16               fast/css/text-indent-first-line-005.html
     17               fast/css/text-indent-first-line-006.html
     18
     19        * rendering/RenderBlockLineLayout.cpp:
     20        (WebCore::RenderBlock::computeInlineDirectionPositionsForLine): As well as being the first line under a parent block,
     21          check that this is also the first *formatted* line of an element by ensuring that we are at the start of a
     22          formatting context and not just a continuation of a previous anonymous block in an existing formatting context.
     23
    1242012-08-09  Jan Keromnes  <janx@linux.com>
    225
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r124295 r125202  
    774774   
    775775    LayoutUnit lineLogicalHeight = logicalHeightForLine(this);
    776     float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), lineInfo.isFirstLine(), lineLogicalHeight);
    777     float availableLogicalWidth = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), lineInfo.isFirstLine(), lineLogicalHeight) - logicalLeft;
     776    // CSS 2.1: "'Text-indent' only affects a line if it is the first formatted line of an element. For example, the first line of an anonymous block
     777    // box is only affected if it is the first child of its parent element."
     778    bool firstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent()->firstChild() != this);
     779    float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), firstLine, lineLogicalHeight);
     780    float availableLogicalWidth = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), firstLine, lineLogicalHeight) - logicalLeft;
    778781
    779782    bool needsWordSpacing = false;
Note: See TracChangeset for help on using the changeset viewer.