Changeset 116373 in webkit


Ignore:
Timestamp:
May 7, 2012 4:39:40 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

:first-line text-decorations are not rendered
https://bugs.webkit.org/show_bug.cgi?id=6047

Source/WebCore:

Text-decorations are applied during paint phase. The style was not being properly selected in case of
first line box. The patch fixes this.

Patch by Pravin D <pravind.2k4@gmail.com> on 2012-05-07
Reviewed by Eric Seidel.

Tests: fast/css/first-line-text-decoration-inherited-from-parent.html

fast/css/first-line-text-decoration.html

  • rendering/InlineTextBox.cpp:

(WebCore::InlineTextBox::paintDecoration):
Inform the decoration color retriever if this box is part of the first line box or not.

  • rendering/RenderObject.cpp:

(WebCore::decorationColor):
Changed the argument from RenderObject* to RenderStyle*. As this function is just a helper to getTextDecorationColors
as used RenderObject solely to retrieve the corresponding RenderStyle, which(RenderStyle*) was already available with the latter function.

(WebCore::RenderObject::getTextDecorationColors):
Take a new variable to check if first line style or the regular style has to be used.
Sends RenderStyle* as an argument to decorationColor().

  • rendering/RenderObject.h:

(RenderObject):

LayoutTests:

Patch by Pravin D <pravind.2k4@gmail.com> on 2012-05-07
Reviewed by Eric Seidel.

  • fast/css/first-line-text-decoration.html: Added.
  • platform/qt-linux/fast/css/first-line-text-decoration-expected.png: Added.
  • platform/qt-linux/fast/css/first-line-text-decoration-expected.txt: Added. This test checks if text-decoration present in the tags first-line style is applied properly.
  • fast/css/first-line-text-decoration-inherited-from-parent.html: Added.
  • platform/qt-linux/fast/css/first-line-text-decoration-inherited-from-parent-expected.png: Added.
  • platform/qt-linux/fast/css/first-line-text-decoration-inherited-from-parent-expected.txt: Added. This test checks if the text-decoration and text color is chosen properly in the case where the first-line style is inherited from a parent and contains such text-decorations.
Location:
trunk
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r116370 r116373  
     12012-05-07  Pravin D  <pravind.2k4@gmail.com>
     2
     3        :first-line text-decorations are not rendered
     4        https://bugs.webkit.org/show_bug.cgi?id=6047
     5
     6        Reviewed by Eric Seidel.
     7
     8        * fast/css/first-line-text-decoration.html: Added.
     9        * platform/qt-linux/fast/css/first-line-text-decoration-expected.png: Added.
     10        * platform/qt-linux/fast/css/first-line-text-decoration-expected.txt: Added.
     11         This test checks if text-decoration present in the tags first-line style is applied properly.
     12
     13        * fast/css/first-line-text-decoration-inherited-from-parent.html: Added.
     14        * platform/qt-linux/fast/css/first-line-text-decoration-inherited-from-parent-expected.png: Added.
     15        * platform/qt-linux/fast/css/first-line-text-decoration-inherited-from-parent-expected.txt: Added.
     16         This test checks if the text-decoration and text color is chosen properly in the case where
     17         the first-line style is inherited from a parent and contains such text-decorations.
     18
    1192012-05-07  Philippe Normand  <pnormand@igalia.com>
    220
  • trunk/Source/WebCore/ChangeLog

    r116371 r116373  
     12012-05-07  Pravin D  <pravind.2k4@gmail.com>
     2
     3        :first-line text-decorations are not rendered
     4        https://bugs.webkit.org/show_bug.cgi?id=6047
     5
     6        Text-decorations are applied during paint phase. The style was not being properly selected in case of
     7        first line box. The patch fixes this.
     8
     9        Reviewed by Eric Seidel.
     10
     11        Tests: fast/css/first-line-text-decoration-inherited-from-parent.html
     12               fast/css/first-line-text-decoration.html
     13
     14        * rendering/InlineTextBox.cpp:
     15        (WebCore::InlineTextBox::paintDecoration):
     16        Inform the decoration color retriever if this box is part of the first line box or not.
     17
     18        * rendering/RenderObject.cpp:
     19        (WebCore::decorationColor):
     20        Changed the argument from RenderObject* to RenderStyle*. As this function is just a helper to getTextDecorationColors
     21        as used RenderObject solely to retrieve the corresponding RenderStyle, which(RenderStyle*) was already available with the latter function.
     22
     23        (WebCore::RenderObject::getTextDecorationColors):
     24        Take a new variable to check if first line style or the regular style has to be used.
     25        Sends RenderStyle* as an argument to decorationColor().
     26
     27        * rendering/RenderObject.h:
     28        (RenderObject):
     29
    1302012-05-07  Julien Chaffraix  <jchaffraix@webkit.org>
    231
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r116353 r116373  
    916916    // Get the text decoration colors.
    917917    Color underline, overline, linethrough;
    918     renderer()->getTextDecorationColors(deco, underline, overline, linethrough, true);
     918    renderer()->getTextDecorationColors(deco, underline, overline, linethrough, true, isFirstLineStyle());
    919919   
    920920    // Use a special function for underlines to get the positioning exactly right.
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r116339 r116373  
    25722572}
    25732573
    2574 static Color decorationColor(RenderObject* renderer)
     2574static Color decorationColor(RenderStyle* style)
    25752575{
    25762576    Color result;
    2577     if (renderer->style()->textStrokeWidth() > 0) {
     2577    if (style->textStrokeWidth() > 0) {
    25782578        // Prefer stroke color if possible but not if it's fully transparent.
    2579         result = renderer->style()->visitedDependentColor(CSSPropertyWebkitTextStrokeColor);
     2579        result = style->visitedDependentColor(CSSPropertyWebkitTextStrokeColor);
    25802580        if (result.alpha())
    25812581            return result;
    25822582    }
    25832583   
    2584     result = renderer->style()->visitedDependentColor(CSSPropertyWebkitTextFillColor);
     2584    result = style->visitedDependentColor(CSSPropertyWebkitTextFillColor);
    25852585    return result;
    25862586}
    25872587
    25882588void RenderObject::getTextDecorationColors(int decorations, Color& underline, Color& overline,
    2589                                            Color& linethrough, bool quirksMode)
     2589                                           Color& linethrough, bool quirksMode, bool firstlineStyle)
    25902590{
    25912591    RenderObject* curr = this;
     2592    RenderStyle* styleToUse = 0;
    25922593    do {
    2593         int currDecs = curr->style()->textDecoration();
     2594        styleToUse = curr->style(firstlineStyle);
     2595        int currDecs = styleToUse->textDecoration();
    25942596        if (currDecs) {
    25952597            if (currDecs & UNDERLINE) {
    25962598                decorations &= ~UNDERLINE;
    2597                 underline = decorationColor(curr);
     2599                underline = decorationColor(styleToUse);
    25982600            }
    25992601            if (currDecs & OVERLINE) {
    26002602                decorations &= ~OVERLINE;
    2601                 overline = decorationColor(curr);
     2603                overline = decorationColor(styleToUse);
    26022604            }
    26032605            if (currDecs & LINE_THROUGH) {
    26042606                decorations &= ~LINE_THROUGH;
    2605                 linethrough = decorationColor(curr);
     2607                linethrough = decorationColor(styleToUse);
    26062608            }
    26072609        }
     
    26162618    // If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
    26172619    if (decorations && curr) {
     2620        styleToUse = curr->style(firstlineStyle);
    26182621        if (decorations & UNDERLINE)
    2619             underline = decorationColor(curr);
     2622            underline = decorationColor(styleToUse);
    26202623        if (decorations & OVERLINE)
    2621             overline = decorationColor(curr);
     2624            overline = decorationColor(styleToUse);
    26222625        if (decorations & LINE_THROUGH)
    2623             linethrough = decorationColor(curr);
     2626            linethrough = decorationColor(styleToUse);
    26242627    }
    26252628}
  • trunk/Source/WebCore/rendering/RenderObject.h

    r116238 r116373  
    714714    virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const;
    715715
    716     void getTextDecorationColors(int decorations, Color& underline, Color& overline, Color& linethrough, bool quirksMode = false);
     716    void getTextDecorationColors(int decorations, Color& underline, Color& overline, Color& linethrough, bool quirksMode = false, bool firstlineStyle = false);
    717717
    718718    // Return the RenderBox in the container chain which is responsible for painting this object, or 0
Note: See TracChangeset for help on using the changeset viewer.