• rune@opera.com's avatar
    Fix crash when removing stylesheets from shadow tree. · e1127317
    rune@opera.com authored
    The added sheets passed into StyleSheetInvalidationAnalysis may either be
    added or removed. When they are removed style elements from a shadow tree,
    the style element may no longer have a containingShadowRoot if the element
    has already been removed. That caused a crash when the containingShadowRoot
    was accessed without a nullptr check.
    
    Instead of deducing the scope from the style element, pass the stylesheet
    collection TreeScope to the analysis object. The m_scopingNodes, which is
    probably a left-over from <style scoped> has been removed.
    
    Now, the shadow tree root node, or outermost shadow host if ::content
    rules makes that necessary, is always marked sub-tree dirty. The previous
    code-path could trigger id/class invalidation of separate elements when
    the stylesheet contents had multiple owner nodes, but that was most likely
    wrong if it could ever happen.
    
    BUG=522860
    
    Review URL: https://codereview.chromium.org/1313443003
    
    git-svn-id: svn://svn.chromium.org/blink/trunk@201058 bbb929c8-8fbe-4397-9dbb-9b2b20218538
    e1127317
remove-styles-in-shadow-crash-3.html 524 Bytes