Changeset 122663 in webkit


Ignore:
Timestamp:
Jul 14, 2012 1:57:27 AM (12 years ago)
Author:
robert@webkit.org
Message:

CSS 2.1 failure: vertical-align-boxes-001 fails
https://bugs.webkit.org/show_bug.cgi?id=90626

Reviewed by Eric Seidel.

Source/WebCore:

Tests: css2.1/20110323/vertical-align-boxes-001.htm

A percentage value vertical-align is always a percentage of the actual line-height rather than
the margin box per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align: 'Percentages:
refer to the 'line-height' of the element itself'. Confusingly, RenderBox::lineheight() is a
shorthand into the dimensions of the margin box for replaced elements in the other vertical-align
cases, i.e. where it's the margin box that's relevant rather than the 'line-height'. So rather than patch RenderBox's
lineHeight() to somehow consider the percentage cases, just give percentage vertical-align the full computedLineHeight()
rather than lineHeight()'s margin box.

  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::verticalPositionForBox):

LayoutTests:

  • css2.1/20110323/vertical-align-boxes-001-expected.html: Added.
  • css2.1/20110323/vertical-align-boxes-001.htm: Added. This patch fixes the 'percentage' case in this test so that it calculates 50% of the line-height of 60px rather than 50% of the img's margin-box of -8px.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r122662 r122663  
     12012-07-05  Robert Hogan  <robert@webkit.org>
     2
     3        CSS 2.1 failure: vertical-align-boxes-001 fails
     4        https://bugs.webkit.org/show_bug.cgi?id=90626
     5
     6        Reviewed by Eric Seidel.
     7
     8        * css2.1/20110323/vertical-align-boxes-001-expected.html: Added.
     9        * css2.1/20110323/vertical-align-boxes-001.htm: Added.
     10          This patch fixes the 'percentage' case in this test so that it calculates 50% of the
     11          line-height of 60px rather than 50% of the img's margin-box of -8px.
     12
    1132012-07-14  Zan Dobersek  <zandobersek@gmail.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r122660 r122663  
     12012-07-05  Robert Hogan  <robert@webkit.org>
     2
     3        CSS 2.1 failure: vertical-align-boxes-001 fails
     4        https://bugs.webkit.org/show_bug.cgi?id=90626
     5
     6        Reviewed by Eric Seidel.
     7
     8        Tests: css2.1/20110323/vertical-align-boxes-001.htm
     9
     10        A percentage value vertical-align is always a percentage of the actual line-height rather than
     11        the margin box per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align: 'Percentages:
     12        refer to the 'line-height' of the element itself'.  Confusingly, RenderBox::lineheight() is a
     13        shorthand into the dimensions of the margin box for replaced elements in the other vertical-align
     14        cases, i.e. where it's the margin box that's relevant rather than the 'line-height'. So rather than patch RenderBox's
     15        lineHeight() to somehow consider the percentage cases, just give percentage vertical-align the full computedLineHeight()
     16        rather than lineHeight()'s margin box.
     17
     18        * rendering/RootInlineBox.cpp:
     19        (WebCore::RootInlineBox::verticalPositionForBox):
     20
    1212012-07-13  Ryosuke Niwa  <rniwa@webkit.org>
    222
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r121085 r122663  
    884884        } else if (verticalAlign == BASELINE_MIDDLE)
    885885            verticalPosition += -renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection);
    886         else if (verticalAlign == LENGTH)
    887             verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), renderer->lineHeight(firstLine, lineDirection), renderer->view());
     886        else if (verticalAlign == LENGTH) {
     887            LayoutUnit lineHeight;
     888            //Per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align: 'Percentages: refer to the 'line-height' of the element itself'.
     889            if (renderer->style()->verticalAlignLength().isPercent())
     890                lineHeight = renderer->style()->computedLineHeight();
     891            else
     892                lineHeight = renderer->lineHeight(firstLine, lineDirection);
     893            verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), lineHeight, renderer->view());
     894        }
    888895    }
    889896
Note: See TracChangeset for help on using the changeset viewer.