Changeset 131136 in webkit


Ignore:
Timestamp:
Oct 11, 2012 8:51:37 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[Shadow DOM] Insertion points need resetStyleInheritance
https://bugs.webkit.org/show_bug.cgi?id=93922

Patch by Takashi Sakamoto <tasak@google.com> on 2012-10-11
Reviewed by Dimitri Glazkov.

Source/WebCore:

Implemented resetStyleInheritance of insertion points.
Its spec link is http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-html-content-element-reset-style-inheritance

Test: fast/dom/shadow/insertion-point-resetStyleInheritance.html

  • css/StyleResolver.cpp:

(WebCore::isResetStyleInheritance):
Added a new function to check whether there exists any insertion
point which has reset-style-inhertiance flag set to be true.
(WebCore::StyleResolver::initForStyleResolve):
Modified to use the above function to check reset-style-inheritance.

  • html/shadow/HTMLContentElement.idl:
  • html/shadow/HTMLShadowElement.idl:

Added a new attribute for reset-style-inheritance.

  • html/shadow/InsertionPoint.cpp:

(WebCore::InsertionPoint::InsertionPoint):
Initialized a new member variable for reset-style-inheritance.
(WebCore::InsertionPoint::resetStyleInheritance):
(WebCore::InsertionPoint::setResetStyleInheritance):
Implemented setter/getter for reset-style-inheritance.

  • html/shadow/InsertionPoint.h:

(InsertionPoint):
Added a new member variable for reset-style-inheritance.

LayoutTests:

  • fast/dom/shadow/insertion-point-resetStyleInheritance-expected.txt: Added.
  • fast/dom/shadow/insertion-point-resetStyleInheritance.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r131134 r131136  
     12012-10-11  Takashi Sakamoto  <tasak@google.com>
     2
     3        [Shadow DOM] Insertion points need resetStyleInheritance
     4        https://bugs.webkit.org/show_bug.cgi?id=93922
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        * fast/dom/shadow/insertion-point-resetStyleInheritance-expected.txt: Added.
     9        * fast/dom/shadow/insertion-point-resetStyleInheritance.html: Added.
     10
    1112012-10-11  Kenichi Ishibashi  <bashi@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r131135 r131136  
     12012-10-11  Takashi Sakamoto  <tasak@google.com>
     2
     3        [Shadow DOM] Insertion points need resetStyleInheritance
     4        https://bugs.webkit.org/show_bug.cgi?id=93922
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        Implemented resetStyleInheritance of insertion points.
     9        Its spec link is http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-html-content-element-reset-style-inheritance
     10
     11        Test: fast/dom/shadow/insertion-point-resetStyleInheritance.html
     12
     13        * css/StyleResolver.cpp:
     14        (WebCore::isResetStyleInheritance):
     15        Added a new function to check whether there exists any insertion
     16        point which has reset-style-inhertiance flag set to be true.
     17        (WebCore::StyleResolver::initForStyleResolve):
     18        Modified to use the above function to check reset-style-inheritance.
     19        * html/shadow/HTMLContentElement.idl:
     20        * html/shadow/HTMLShadowElement.idl:
     21        Added a new attribute for reset-style-inheritance.
     22        * html/shadow/InsertionPoint.cpp:
     23        (WebCore::InsertionPoint::InsertionPoint):
     24        Initialized a new member variable for reset-style-inheritance.
     25        (WebCore::InsertionPoint::resetStyleInheritance):
     26        (WebCore::InsertionPoint::setResetStyleInheritance):
     27        Implemented setter/getter for reset-style-inheritance.
     28        * html/shadow/InsertionPoint.h:
     29        (InsertionPoint):
     30        Added a new member variable for reset-style-inheritance.
     31
    1322012-10-11  Anders Carlsson  <andersca@apple.com>
    233
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r131068 r131136  
    6262#include "CursorList.h"
    6363#include "DocumentStyleSheetCollection.h"
     64#include "ElementShadow.h"
    6465#include "FontFeatureValue.h"
    6566#include "FontValue.h"
     
    959960}
    960961
     962inline bool shouldResetStyleInheritance(NodeRenderingContext& context)
     963{
     964    if (context.resetStyleInheritance())
     965        return true;
     966
     967    InsertionPoint* insertionPoint = context.insertionPoint();
     968    if (!insertionPoint)
     969        return false;
     970    ASSERT(context.node()->parentElement());
     971    ElementShadow* shadow = context.node()->parentElement()->shadow();
     972    ASSERT(shadow);
     973
     974    for ( ; insertionPoint; ) {
     975        InsertionPoint* youngerInsertionPoint = shadow->insertionPointFor(insertionPoint);
     976        if (!youngerInsertionPoint)
     977            break;
     978        insertionPoint = youngerInsertionPoint;
     979    }
     980    return insertionPoint->resetStyleInheritance();
     981}
     982
    961983inline void StyleResolver::initForStyleResolve(Element* e, RenderStyle* parentStyle, PseudoId pseudoID)
    962984{
     
    966988        NodeRenderingContext context(e);
    967989        m_parentNode = context.parentNodeForRenderingAndStyle();
    968         m_parentStyle = context.resetStyleInheritance()? 0 :
     990        m_parentStyle = shouldResetStyleInheritance(context) ? 0 :
    969991            parentStyle ? parentStyle :
    970992            m_parentNode ? m_parentNode->renderStyle() : 0;
  • trunk/Source/WebCore/html/shadow/HTMLContentElement.idl

    r106666 r131136  
    3131    ] HTMLContentElement : HTMLElement {
    3232        attribute [Reflect] DOMString select;
     33        attribute boolean resetStyleInheritance;
    3334    };
    3435}
  • trunk/Source/WebCore/html/shadow/HTMLShadowElement.idl

    r108298 r131136  
    3535        V8EnabledAtRuntime=shadowDOM
    3636    ] HTMLShadowElement : HTMLElement {
     37        attribute boolean resetStyleInheritance;
    3738    };
    3839
  • trunk/Source/WebCore/html/shadow/InsertionPoint.cpp

    r130926 r131136  
    4040InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document* document)
    4141    : HTMLElement(tagName, document)
     42    , m_shouldResetStyleInheritance(false)
    4243{
    4344}
     
    160161}
    161162
     163bool InsertionPoint::resetStyleInheritance() const
     164{
     165    return m_shouldResetStyleInheritance;
     166}
     167
     168void InsertionPoint::setResetStyleInheritance(bool value)
     169{
     170    if (value != m_shouldResetStyleInheritance) {
     171        m_shouldResetStyleInheritance = value;
     172        if (attached() && isActive())
     173            shadowRoot()->host()->setNeedsStyleRecalc();
     174    }
     175}
     176
    162177} // namespace WebCore
  • trunk/Source/WebCore/html/shadow/InsertionPoint.h

    r130926 r131136  
    5656    virtual bool doesSelectFromHostChildren() const = 0;
    5757
     58    bool resetStyleInheritance() const;
     59    void setResetStyleInheritance(bool);
     60
    5861    virtual void attach();
    5962    virtual void detach();
     
    7881private:
    7982    ContentDistribution m_distribution;
     83    bool m_shouldResetStyleInheritance : 1;
    8084};
    8185
Note: See TracChangeset for help on using the changeset viewer.