Changeset 94784 in webkit


Ignore:
Timestamp:
Sep 8, 2011 12:56:38 PM (13 years ago)
Author:
rolandsteiner@chromium.org
Message:

<style scoped>: Add 'scoped' attribute
https://bugs.webkit.org/show_bug.cgi?id=67718

Source/WebCore:

Add 'scoped' attribute to IDL and attribute list,
implement and test setting/resetting of the attribute.

Reviewed by Dimitri Glazkov.

Test: fast/css/style-scoped/basic-attribute.html

  • html/HTMLAttributeNames.in:
  • html/HTMLStyleElement.cpp:

(WebCore::HTMLStyleElement::scoped):
(WebCore::HTMLStyleElement::setScoped):
(WebCore::HTMLStyleElement::scopingElement):

  • html/HTMLStyleElement.h:
  • html/HTMLStyleElement.idl:

LayoutTests:

Test setting/resetting of the 'scoped' attribute in various circumstances.

Reviewed by Dimitri Glazkov.

  • fast/css/style-scoped/basic-attribute-expected.txt: Added.
  • fast/css/style-scoped/basic-attribute.html: Added.
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r94782 r94784  
     12011-09-08  Roland Steiner  <rolandsteiner@chromium.org>
     2
     3        <style scoped>: Add 'scoped' attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=67718
     5
     6        Test setting/resetting of the 'scoped' attribute in various circumstances.
     7
     8        Reviewed by Dimitri Glazkov.
     9
     10        * fast/css/style-scoped/basic-attribute-expected.txt: Added.
     11        * fast/css/style-scoped/basic-attribute.html: Added.
     12
    1132011-09-08  Ben Wells  <benwells@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r94781 r94784  
     12011-09-08  Roland Steiner  <rolandsteiner@chromium.org>
     2
     3        <style scoped>: Add 'scoped' attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=67718
     5
     6        Add 'scoped' attribute to IDL and attribute list,
     7        implement and test setting/resetting of the attribute.
     8
     9        Reviewed by Dimitri Glazkov.
     10
     11        Test: fast/css/style-scoped/basic-attribute.html
     12
     13        * html/HTMLAttributeNames.in:
     14        * html/HTMLStyleElement.cpp:
     15        (WebCore::HTMLStyleElement::scoped):
     16        (WebCore::HTMLStyleElement::setScoped):
     17        (WebCore::HTMLStyleElement::scopingElement):
     18        * html/HTMLStyleElement.h:
     19        * html/HTMLStyleElement.idl:
     20
    1212011-09-08  Erik Arvidsson  <arv@chromium.org>
    222
  • trunk/Source/WebCore/html/HTMLAttributeNames.in

    r94433 r94784  
    267267scheme
    268268scope
     269scoped
    269270scrollamount
    270271scrolldelay
  • trunk/Source/WebCore/html/HTMLStyleElement.cpp

    r94433 r94784  
    9595}
    9696
     97bool HTMLStyleElement::scoped() const
     98{
     99    return fastHasAttribute(scopedAttr);
     100}
     101
     102void HTMLStyleElement::setScoped(bool scopedValue)
     103{
     104    setBooleanAttribute(scopedAttr, scopedValue);
     105}
     106
     107Element* HTMLStyleElement::scopingElement() const
     108{
     109    if (!scoped())
     110        return 0;
     111
     112    // FIXME: This probably needs to be refined for scoped stylesheets within shadow DOM.
     113    // As written, such a stylesheet could style the host element, as well as children of the host.
     114    // OTOH, this paves the way for a :bound-element implementation.
     115    ContainerNode* parentOrHost = parentOrHostNode();
     116    if (!parentOrHost || !parentOrHost->isElementNode())
     117        return 0;
     118
     119    return toElement(parentOrHost);
     120}
     121
    97122void HTMLStyleElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
    98123{   
  • trunk/Source/WebCore/html/HTMLStyleElement.h

    r87867 r94784  
    3838    void setType(const AtomicString&);
    3939
     40    bool scoped() const;
     41    void setScoped(bool);
     42    Element* scopingElement() const;
     43
    4044    using StyleElement::sheet;
    4145
  • trunk/Source/WebCore/html/HTMLStyleElement.idl

    r89269 r94784  
    2323    interface HTMLStyleElement : HTMLElement {
    2424        attribute boolean disabled;
     25        attribute boolean scoped;
    2526        attribute [Reflect] DOMString media;
    2627        attribute [Reflect] DOMString type;
Note: See TracChangeset for help on using the changeset viewer.