Changeset 109134 in webkit


Ignore:
Timestamp:
Feb 28, 2012 11:55:39 AM (12 years ago)
Author:
alexis.menard@openbossa.org
Message:

getComputedStyle fails for 'first-line' pseudo-element
https://bugs.webkit.org/show_bug.cgi?id=57505

Reviewed by Tony Chang.

Source/WebCore:

Querying the selector with a pseudo-element using getComputedStyle should work
even if the selector was not declared in the stylesheet. When not declared, we need
to use the RenderStyle created to do the rendering as there is no pseudo-style.
This match the behavior of Firefox.

No new tests : Updated expectation and extended getComputedStyle-with-pseudo-element.html.

  • dom/Element.cpp:

(WebCore::Element::computedStyle):

LayoutTests:

Update expected results to the new behavior. Also added some extra checks on
other pseudo-elements.

  • fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt:
  • fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r109132 r109134  
     12012-02-28  Alexis Menard  <alexis.menard@openbossa.org>
     2
     3        getComputedStyle fails for 'first-line' pseudo-element
     4        https://bugs.webkit.org/show_bug.cgi?id=57505
     5
     6        Reviewed by Tony Chang.
     7
     8        Update expected results to the new behavior. Also added some extra checks on
     9        other pseudo-elements.
     10
     11        * fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt:
     12        * fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html:
     13
    1142012-02-28  Alexey Proskuryakov  <ap@apple.com>
    215
  • trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt

    r65062 r109134  
    1818PASS Expected 'rgb(0, 0, 255)' for color in the computed style for element with id testBeforeAfter and pseudo-element :after and got 'rgb(0, 0, 255)'
    1919PASS Expected 'rgb(165, 42, 42)' for color in the computed style for element with id testNoPseudoElement and pseudo-element null and got 'rgb(165, 42, 42)'
    20 PASS Expected '' for color in the computed style for element with id testNoPseudoElement and pseudo-element :first-line and got ''
     20PASS Expected 'rgb(165, 42, 42)' for color in the computed style for element with id testNoPseudoElement and pseudo-element :first-line and got 'rgb(165, 42, 42)'
     21PASS Expected 'rgb(165, 42, 42)' for color in the computed style for element with id testNoPseudoElement and pseudo-element :first-letter and got 'rgb(165, 42, 42)'
     22PASS Expected 'rgb(165, 42, 42)' for color in the computed style for element with id testNoPseudoElement and pseudo-element :before and got 'rgb(165, 42, 42)'
     23PASS Expected 'rgb(165, 42, 42)' for color in the computed style for element with id testNoPseudoElement and pseudo-element :after and got 'rgb(165, 42, 42)'
    2124PASS Expected 'rgb(165, 42, 42)' for color in the computed style for element with id testNoPseudoElement and pseudo-element :garbage and got 'rgb(165, 42, 42)'
    2225PASS Expected '0.5' for opacity in the computed style for element with id testHardwareAcceleratedCompositing and pseudo-element :before and got '0.5'
  • trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html

    r57861 r109134  
    6868        { 'elementId' : 'testBeforeAfter', 'pseudoElement' : ':after', 'property' : 'color', 'expectedValue' : 'rgb(0, 0, 255)' },
    6969        { 'elementId' : 'testNoPseudoElement', 'pseudoElement' : null, 'property' : 'color', 'expectedValue' : 'rgb(165, 42, 42)' },
    70         { 'elementId' : 'testNoPseudoElement', 'pseudoElement' : ':first-line', 'property' : 'color', 'expectedValue' : '' },
     70        { 'elementId' : 'testNoPseudoElement', 'pseudoElement' : ':first-line', 'property' : 'color', 'expectedValue' : 'rgb(165, 42, 42)' },
     71        { 'elementId' : 'testNoPseudoElement', 'pseudoElement' : ':first-letter', 'property' : 'color', 'expectedValue' : 'rgb(165, 42, 42)' },
     72        { 'elementId' : 'testNoPseudoElement', 'pseudoElement' : ':before', 'property' : 'color', 'expectedValue' : 'rgb(165, 42, 42)' },
     73        { 'elementId' : 'testNoPseudoElement', 'pseudoElement' : ':after', 'property' : 'color', 'expectedValue' : 'rgb(165, 42, 42)' },
    7174        { 'elementId' : 'testNoPseudoElement', 'pseudoElement' : ':garbage', 'property' : 'color', 'expectedValue' : 'rgb(165, 42, 42)' },
    7275        { 'elementId' : 'testHardwareAcceleratedCompositing', 'pseudoElement' : ':before', 'property' : 'opacity', 'expectedValue' : '0.5' }
  • trunk/Source/WebCore/ChangeLog

    r109133 r109134  
     12012-02-28  Alexis Menard  <alexis.menard@openbossa.org>
     2
     3        getComputedStyle fails for 'first-line' pseudo-element
     4        https://bugs.webkit.org/show_bug.cgi?id=57505
     5
     6        Reviewed by Tony Chang.
     7
     8        Querying the selector with a pseudo-element using getComputedStyle should work
     9        even if the selector was not declared in the stylesheet. When not declared, we need
     10        to use the RenderStyle created to do the rendering as there is no pseudo-style.
     11        This match the behavior of Firefox.
     12
     13        No new tests : Updated expectation and extended getComputedStyle-with-pseudo-element.html.
     14
     15        * dom/Element.cpp:
     16        (WebCore::Element::computedStyle):
     17
    1182012-02-28  Ashod Nakashian  <ashodnakashian@yahoo.com>
    219
  • trunk/Source/WebCore/dom/Element.cpp

    r109096 r109134  
    16081608    // properties, which are only known by the renderer because it did the layout, will be correct and so that the
    16091609    // values returned for the ":selection" pseudo-element will be correct.
    1610     if (RenderStyle* usedStyle = renderStyle())
    1611         return pseudoElementSpecifier ? usedStyle->getCachedPseudoStyle(pseudoElementSpecifier) : usedStyle;
     1610    if (RenderStyle* usedStyle = renderStyle()) {
     1611        if (pseudoElementSpecifier) {
     1612            RenderStyle* cachedPseudoStyle = usedStyle->getCachedPseudoStyle(pseudoElementSpecifier);
     1613            return cachedPseudoStyle ? cachedPseudoStyle : usedStyle;
     1614         } else
     1615            return usedStyle;
     1616    }
    16121617
    16131618    if (!attached())
Note: See TracChangeset for help on using the changeset viewer.