Changeset 137112 in webkit


Ignore:
Timestamp:
Dec 9, 2012 11:43:42 PM (11 years ago)
Author:
tasak@google.com
Message:

[Shadow DOM]: reset-style-inheritance doesn't work for insertion point
https://bugs.webkit.org/show_bug.cgi?id=103711

Reviewed by Hajime Morita.

Source/WebCore:

reset-style-inheritance can be specified by using insertion points'
attribute, e.g. <content reset-style-inheritance>.
c.f. shadow dom spec:
https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles

No new tests. Updated an existing test,
fast/dom/shadow/insertion-point-resetStyleInheritance.html to cover
this feature.

  • html/HTMLAttributeNames.in:

Added HTMLNames::reset_style_inheritanceAttr.

  • html/shadow/InsertionPoint.cpp:

(WebCore::InsertionPoint::InsertionPoint):
(WebCore::InsertionPoint::parseAttribute):
Since both shadow and content elements have to support
reset-style-inheritance, added InsertionPoint::parseAttribute.
(WebCore::InsertionPoint::resetStyleInheritance):
(WebCore::InsertionPoint::setResetStyleInheritance):
Modified to update reset-style-inheritance attribute value.

  • html/shadow/InsertionPoint.h:

(InsertionPoint):
Removed m_shouldResetStyleInheritance. Instead, use
reset-style-inheritance attribute value.

LayoutTests:

  • fast/dom/shadow/insertion-point-resetStyleInheritance-expected.txt:
  • fast/dom/shadow/insertion-point-resetStyleInheritance.html:

Added two more basic tests to cover <content reset-style-inheritance>
and <shadow reset-style-inheritance>.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r137106 r137112  
     12012-12-09  Takashi Sakamoto  <tasak@google.com>
     2
     3        [Shadow DOM]: reset-style-inheritance doesn't work for insertion point
     4        https://bugs.webkit.org/show_bug.cgi?id=103711
     5
     6        Reviewed by Hajime Morita.
     7
     8        * fast/dom/shadow/insertion-point-resetStyleInheritance-expected.txt:
     9        * fast/dom/shadow/insertion-point-resetStyleInheritance.html:
     10        Added two more basic tests to cover <content reset-style-inheritance>
     11        and <shadow reset-style-inheritance>.
     12
    1132012-12-09  Huang Dongsung  <luxtella@company100.net>
    214
  • trunk/LayoutTests/fast/dom/shadow/insertion-point-resetStyleInheritance-expected.txt

    r131136 r137112  
    33PASS window.getComputedStyle(document.getElementById("no-reset-style-inheritance").firstChild).backgroundColor is "rgba(0, 0, 0, 0)"
    44Test case: reset-style-inhertiace basic test. color value should be initial because insertion point's resetStyleInheritance is true.
     5PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color is "rgb(0, 0, 0)"
     6PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor is "rgba(0, 0, 0, 0)"
     7Test case: make a content element reset-style-inhertiace by using its attribute. color value should be initial because insertion point's resetStyleInheritance is true.
     8PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color is "rgb(0, 0, 0)"
     9PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor is "rgba(0, 0, 0, 0)"
     10Test case: make a shadow element reset-style-inhertiace by using its attribute. color value should be initial because insertion point's resetStyleInheritance is true.
    511PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color is "rgb(0, 0, 0)"
    612PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor is "rgba(0, 0, 0, 0)"
  • trunk/LayoutTests/fast/dom/shadow/insertion-point-resetStyleInheritance.html

    r131136 r137112  
    3131
    3232    shadowRoot.getElementById('content').resetStyleInheritance = true;
     33    shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color', '"rgb(0, 0, 0)"');
     34    shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor', '"rgba(0, 0, 0, 0)"');
     35}
     36
     37function testResetStyleInheritanceWithAttribute() {
     38    debug("Test case: make a content element reset-style-inhertiace by using its attribute. color value should be initial because insertion point's resetStyleInheritance is true.");
     39    var div = document.getElementById('reset-style-inheritance');
     40
     41    var shadowRoot = new WebKitShadowRoot(div);
     42    shadowRoot.innerHTML = '<content id="content" reset-style-inheritance></content>';
     43
     44    shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color', '"rgb(0, 0, 0)"');
     45    shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor', '"rgba(0, 0, 0, 0)"');
     46}
     47
     48function testShadowResetStyleInheritanceWithAttribute() {
     49    debug("Test case: make a shadow element reset-style-inhertiace by using its attribute. color value should be initial because insertion point's resetStyleInheritance is true.");
     50    var div = document.getElementById('reset-style-inheritance');
     51
     52    var shadowRoot = new WebKitShadowRoot(div);
     53    shadowRoot.innerHTML = '<shadow id="content" reset-style-inheritance></content>';
     54
    3355    shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color', '"rgb(0, 0, 0)"');
    3456    shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor', '"rgba(0, 0, 0, 0)"');
     
    107129    testNoResetStyleInheritance();
    108130    testResetStyleInheritance();
     131    testResetStyleInheritanceWithAttribute();
     132    testShadowResetStyleInheritanceWithAttribute();
    109133    testResetStyleInheritanceDynamic();
    110134    testResetStyleInheritanceWithoutCrossingUpperBoundary()
  • trunk/Source/WebCore/ChangeLog

    r137108 r137112  
     12012-12-09  Takashi Sakamoto  <tasak@google.com>
     2
     3        [Shadow DOM]: reset-style-inheritance doesn't work for insertion point
     4        https://bugs.webkit.org/show_bug.cgi?id=103711
     5
     6        Reviewed by Hajime Morita.
     7
     8        reset-style-inheritance can be specified by using insertion points'
     9        attribute, e.g. <content reset-style-inheritance>.
     10        c.f. shadow dom spec:
     11        https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles
     12
     13        No new tests. Updated an existing test,
     14        fast/dom/shadow/insertion-point-resetStyleInheritance.html to cover
     15        this feature.
     16
     17        * html/HTMLAttributeNames.in:
     18        Added HTMLNames::reset_style_inheritanceAttr.
     19        * html/shadow/InsertionPoint.cpp:
     20        (WebCore::InsertionPoint::InsertionPoint):
     21        (WebCore::InsertionPoint::parseAttribute):
     22        Since both shadow and content elements have to support
     23        reset-style-inheritance, added InsertionPoint::parseAttribute.
     24        (WebCore::InsertionPoint::resetStyleInheritance):
     25        (WebCore::InsertionPoint::setResetStyleInheritance):
     26        Modified to update reset-style-inheritance attribute value.
     27        * html/shadow/InsertionPoint.h:
     28        (InsertionPoint):
     29        Removed m_shouldResetStyleInheritance. Instead, use
     30        reset-style-inheritance attribute value.
     31
    1322012-12-09  Ilya Tikhonovsky  <loislo@chromium.org>
    233
  • trunk/Source/WebCore/html/HTMLAttributeNames.in

    r133396 r137112  
    279279rel
    280280required
     281reset-style-inheritance
    281282results
    282283rev
  • trunk/Source/WebCore/html/shadow/InsertionPoint.cpp

    r136924 r137112  
    3333
    3434#include "ElementShadow.h"
     35#include "HTMLNames.h"
     36#include "QualifiedName.h"
    3537#include "ShadowRoot.h"
    3638#include "StaticNodeList.h"
     
    3840namespace WebCore {
    3941
     42using namespace HTMLNames;
     43
    4044InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document* document)
    4145    : HTMLElement(tagName, document, CreateInsertionPoint)
    42     , m_shouldResetStyleInheritance(false)
    4346{
    4447}
     
    164167}
    165168
     169void InsertionPoint::parseAttribute(const QualifiedName& name, const AtomicString& value)
     170{
     171    if (name == reset_style_inheritanceAttr) {
     172        if (!inDocument() || !attached() || !isActive())
     173            return;
     174        containingShadowRoot()->host()->setNeedsStyleRecalc();
     175    } else
     176        HTMLElement::parseAttribute(name, value);
     177}
     178
    166179bool InsertionPoint::resetStyleInheritance() const
    167180{
    168     return m_shouldResetStyleInheritance;
     181    return fastHasAttribute(reset_style_inheritanceAttr);
    169182}
    170183
    171184void InsertionPoint::setResetStyleInheritance(bool value)
    172185{
    173     if (value != m_shouldResetStyleInheritance) {
    174         m_shouldResetStyleInheritance = value;
    175         if (attached() && isActive())
    176             containingShadowRoot()->host()->setNeedsStyleRecalc();
    177     }
     186    setBooleanAttribute(reset_style_inheritanceAttr, value);
    178187}
    179188
  • trunk/Source/WebCore/html/shadow/InsertionPoint.h

    r135251 r137112  
    8181    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    8282    virtual void removedFrom(ContainerNode*) OVERRIDE;
     83    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    8384
    8485private:
     86
    8587    ContentDistribution m_distribution;
    86     bool m_shouldResetStyleInheritance : 1;
    8788};
    8889
Note: See TracChangeset for help on using the changeset viewer.