Commit 8725541d authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

[Squad] Remove unnecessary option/optgroup style code.

After the change to recalc style for reattachment in the style recalc
step also for elements with custom style hooks, we no longer need to
have this special code for non-attached style for options/optgroups with
slots.

This also means we don't need to re-retrieve the non-attached style for
the LayoutTreeBuilder.

Bug: 813068
Change-Id: I978a429dd43d00863ca8987054b7902c2e9318f5
Reviewed-on: https://chromium-review.googlesource.com/1059517Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558834}
parent e7f760bc
...@@ -100,10 +100,10 @@ bool LayoutTreeBuilderForElement::ShouldCreateLayoutObject() const { ...@@ -100,10 +100,10 @@ bool LayoutTreeBuilderForElement::ShouldCreateLayoutObject() const {
} }
ComputedStyle& LayoutTreeBuilderForElement::Style() const { ComputedStyle& LayoutTreeBuilderForElement::Style() const {
if (!style_) if (!style_) {
style_ = node_->GetNonAttachedStyle(); DCHECK(!node_->GetNonAttachedStyle());
if (!style_)
style_ = node_->StyleForLayoutObject(); style_ = node_->StyleForLayoutObject();
}
return *style_; return *style_;
} }
......
...@@ -86,16 +86,6 @@ HTMLOptionElement* HTMLOptionElement::CreateForJSConstructor( ...@@ -86,16 +86,6 @@ HTMLOptionElement* HTMLOptionElement::CreateForJSConstructor(
return element; return element;
} }
void HTMLOptionElement::AttachLayoutTree(AttachContext& context) {
AttachContext option_context(context);
if (!GetNonAttachedStyle() && ParentComputedStyle()) {
if (HTMLSelectElement* select = OwnerSelectElement())
select->UpdateListOnLayoutObject();
SetNonAttachedStyle(StyleForLayoutObject());
}
HTMLElement::AttachLayoutTree(option_context);
}
bool HTMLOptionElement::SupportsFocus() const { bool HTMLOptionElement::SupportsFocus() const {
HTMLSelectElement* select = OwnerSelectElement(); HTMLSelectElement* select = OwnerSelectElement();
if (select && select->UsesMenuList()) if (select && select->UsesMenuList())
......
...@@ -97,7 +97,6 @@ class CORE_EXPORT HTMLOptionElement final : public HTMLElement { ...@@ -97,7 +97,6 @@ class CORE_EXPORT HTMLOptionElement final : public HTMLElement {
bool SupportsFocus() const override; bool SupportsFocus() const override;
bool MatchesDefaultPseudoClass() const override; bool MatchesDefaultPseudoClass() const override;
bool MatchesEnabledPseudoClass() const override; bool MatchesEnabledPseudoClass() const override;
void AttachLayoutTree(AttachContext&) override;
void ParseAttribute(const AttributeModificationParams&) override; void ParseAttribute(const AttributeModificationParams&) override;
InsertionNotificationRequest InsertedInto(ContainerNode*) override; InsertionNotificationRequest InsertedInto(ContainerNode*) override;
void RemovedFrom(ContainerNode*) override; void RemovedFrom(ContainerNode*) override;
......
...@@ -1834,10 +1834,6 @@ bool HTMLSelectElement::SupportsAutofocus() const { ...@@ -1834,10 +1834,6 @@ bool HTMLSelectElement::SupportsAutofocus() const {
return true; return true;
} }
void HTMLSelectElement::UpdateListOnLayoutObject() {
SetOptionsChangedOnLayoutObject();
}
void HTMLSelectElement::Trace(blink::Visitor* visitor) { void HTMLSelectElement::Trace(blink::Visitor* visitor) {
visitor->Trace(list_items_); visitor->Trace(list_items_);
visitor->Trace(last_on_change_option_); visitor->Trace(last_on_change_option_);
......
...@@ -136,8 +136,6 @@ class CORE_EXPORT HTMLSelectElement final ...@@ -136,8 +136,6 @@ class CORE_EXPORT HTMLSelectElement final
void OptGroupInsertedOrRemoved(HTMLOptGroupElement&); void OptGroupInsertedOrRemoved(HTMLOptGroupElement&);
void HrInsertedOrRemoved(HTMLHRElement&); void HrInsertedOrRemoved(HTMLHRElement&);
void UpdateListOnLayoutObject();
HTMLOptionElement* SpatialNavigationFocusedOption(); HTMLOptionElement* SpatialNavigationFocusedOption();
void HandleMouseRelease(); void HandleMouseRelease();
......
...@@ -337,20 +337,6 @@ AtomicString HTMLSlotElement::GetName() const { ...@@ -337,20 +337,6 @@ AtomicString HTMLSlotElement::GetName() const {
} }
void HTMLSlotElement::AttachLayoutTree(AttachContext& context) { void HTMLSlotElement::AttachLayoutTree(AttachContext& context) {
if (!GetNonAttachedStyle() && ParentComputedStyle()) {
// The select/optgroup/option assumes computed style is stored on optgroup
// and option even when they are display:none to update selected indices
// correctly. See HTMLOptionElement::IsDisplayNone(). The select and
// optgroup elements use a UA shadow with slots for rendering. With slot
// elements in the flat tree, we need to ensure that also the slot element
// child of optgroups gets their ComputedStyle set in order to inherit and
// set the ComputedStyle of display:none option elements.
if (Element* host = ParentOrShadowHostElement()) {
if (IsHTMLOptGroupElement(host))
SetNonAttachedStyle(StyleForLayoutObject());
}
}
HTMLElement::AttachLayoutTree(context); HTMLElement::AttachLayoutTree(context);
if (SupportsAssignment()) { if (SupportsAssignment()) {
......
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