Commit 992c22b4 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

[Squad] Get parent ComputedStyle from node, not from SVG layout object.

We currently don't compute style for elements being reattached in the
style recalc step when the element has custom style callbacks. The
reason is that some CustomStyleForLayoutObject() implementations rely on
ancestor elements being attached. Here, we stop relying on SVG
corresponding elements having a LayoutObject by retrieving ComputedStyle
from the Node instead. If the parent element is being (re-)attached, we
will get the non-attached style through Node::GetComputedStyle().

Bug: 813057
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I18b6a41087836746869071a409841692fa168537
Reviewed-on: https://chromium-review.googlesource.com/923732Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537306}
parent 7f56fd82
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "core/css/resolver/StyleResolver.h" #include "core/css/resolver/StyleResolver.h"
#include "core/dom/Document.h" #include "core/dom/Document.h"
#include "core/dom/ElementTraversal.h" #include "core/dom/ElementTraversal.h"
#include "core/dom/NodeComputedStyle.h"
#include "core/dom/ShadowRoot.h" #include "core/dom/ShadowRoot.h"
#include "core/dom/events/Event.h" #include "core/dom/events/Event.h"
#include "core/frame/Settings.h" #include "core/frame/Settings.h"
...@@ -1033,10 +1034,8 @@ scoped_refptr<ComputedStyle> SVGElement::CustomStyleForLayoutObject() { ...@@ -1033,10 +1034,8 @@ scoped_refptr<ComputedStyle> SVGElement::CustomStyleForLayoutObject() {
return GetDocument().EnsureStyleResolver().StyleForElement(this); return GetDocument().EnsureStyleResolver().StyleForElement(this);
const ComputedStyle* style = nullptr; const ComputedStyle* style = nullptr;
if (Element* parent = ParentOrShadowHostElement()) { if (Element* parent = ParentOrShadowHostElement())
if (LayoutObject* layout_object = parent->GetLayoutObject()) style = parent->GetComputedStyle();
style = layout_object->Style();
}
return GetDocument().EnsureStyleResolver().StyleForElement( return GetDocument().EnsureStyleResolver().StyleForElement(
CorrespondingElement(), style, style); CorrespondingElement(), style, style);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment