Changeset 115164 in webkit


Ignore:
Timestamp:
Apr 24, 2012 8:25:14 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

getMatchedCSSRules() should return null when the second argument is an unrecognized pseudo-element name
https://bugs.webkit.org/show_bug.cgi?id=83298

Patch by Kulanthaivel Palanichamy <kulanthaivel@codeaurora.org> on 2012-04-24
Reviewed by Ojan Vafai.

Source/WebCore:

I couldn't find any specification or any meaningful discussion on this API, but I
assume that it shouldn't be any different from window.getComputedStyle()
as far as the parameters are concerned.

Test: fast/dom/Window/getMatchedCSSRules-with-invalid-pseudo-elements.html

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::getMatchedCSSRules):

  • page/DOMWindow.idl:

LayoutTests:

  • fast/dom/Window/getMatchedCSSRules-with-invalid-pseudo-elements-expected.txt: Added.
  • fast/dom/Window/getMatchedCSSRules-with-invalid-pseudo-elements.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r115160 r115164  
     12012-04-24  Kulanthaivel Palanichamy  <kulanthaivel@codeaurora.org>
     2
     3        getMatchedCSSRules() should return null when the second argument is an unrecognized pseudo-element name
     4        https://bugs.webkit.org/show_bug.cgi?id=83298
     5
     6        Reviewed by Ojan Vafai.
     7
     8        * fast/dom/Window/getMatchedCSSRules-with-invalid-pseudo-elements-expected.txt: Added.
     9        * fast/dom/Window/getMatchedCSSRules-with-invalid-pseudo-elements.html: Added.
     10
    1112012-04-24  Alexis Menard  <alexis.menard@openbossa.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r115163 r115164  
     12012-04-24  Kulanthaivel Palanichamy  <kulanthaivel@codeaurora.org>
     2
     3        getMatchedCSSRules() should return null when the second argument is an unrecognized pseudo-element name
     4        https://bugs.webkit.org/show_bug.cgi?id=83298
     5
     6        Reviewed by Ojan Vafai.
     7
     8        I couldn't find any specification or any meaningful discussion on this API, but I
     9        assume that it shouldn't be any different from window.getComputedStyle()
     10        as far as the parameters are concerned.
     11
     12        Test: fast/dom/Window/getMatchedCSSRules-with-invalid-pseudo-elements.html
     13
     14        * page/DOMWindow.cpp:
     15        (WebCore::DOMWindow::getMatchedCSSRules):
     16        * page/DOMWindow.idl:
     17
    1182012-04-24  Anders Carlsson  <andersca@apple.com>
    219
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r115136 r115164  
    12881288        return 0;
    12891289
     1290    unsigned colonStart = pseudoElement[0] == ':' ? (pseudoElement[1] == ':' ? 2 : 1) : 0;
     1291    CSSSelector::PseudoType pseudoType = CSSSelector::parsePseudoType(AtomicString(pseudoElement.substring(colonStart)));
     1292    if (pseudoType == CSSSelector::PseudoUnknown && !pseudoElement.isEmpty())
     1293        return 0;
     1294
    12901295    unsigned rulesToInclude = StyleResolver::AuthorCSSRules;
    12911296    if (!authorOnly)
     
    12951300            rulesToInclude |= StyleResolver::CrossOriginCSSRules;
    12961301    }
    1297    
    1298     PseudoId pseudoId = CSSSelector::pseudoId(CSSSelector::parsePseudoType(pseudoElement));
    1299  
     1302
     1303    PseudoId pseudoId = CSSSelector::pseudoId(pseudoType);
     1304
    13001305    return m_frame->document()->styleResolver()->pseudoStyleRulesForElement(element, pseudoId, rulesToInclude);
    13011306}
  • trunk/Source/WebCore/page/DOMWindow.idl

    r114067 r115164  
    154154#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
    155155        CSSRuleList getMatchedCSSRules(in [Optional=DefaultIsUndefined] Element element,
    156                                        in [Optional=DefaultIsUndefined] DOMString pseudoElement);
     156                                       in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString pseudoElement);
    157157#endif
    158158
Note: See TracChangeset for help on using the changeset viewer.