⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271446 in webkit


Ignore:
Timestamp:
Jan 13, 2021, 11:20:42 AM (6 years ago)
Author:
Antti Koivisto
Message:

REGRESSION (r257839): Broken focus when 'display' changes in an attribute selector
https://bugs.webkit.org/show_bug.cgi?id=217240
<rdar://problem/69891684>

Reviewed by Wenson Hsieh.

Source/WebCore:

Focus optimization that avoids full style resolution when setting focus in unrendered subtrees
misbehaves when the style is invalidated via an attribute change.

Test case by Ali Juma.

Test: fast/dom/focus-style-resolution-attribute-change.html

  • dom/Element.cpp:

(WebCore::Element::invalidateStyle):

  • dom/Node.cpp:

(WebCore::Node::invalidateStyle):

We need to set the computed style invalidity bit on all style invalidation code paths.

  • html/InputType.cpp:

(WebCore::InputType::setValue):

Don't invalidate style when nothing changes.

LayoutTests:

  • fast/dom/focus-style-resolution-attribute-change-expected.html: Added.
  • fast/dom/focus-style-resolution-attribute-change.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r271444 r271446  
     12021-01-13  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r257839): Broken focus when 'display' changes in an attribute selector
     4        https://bugs.webkit.org/show_bug.cgi?id=217240
     5        <rdar://problem/69891684>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        * fast/dom/focus-style-resolution-attribute-change-expected.html: Added.
     10        * fast/dom/focus-style-resolution-attribute-change.html: Added.
     11
    1122021-01-13  Kenneth Russell  <kbr@chromium.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r271444 r271446  
     12021-01-13  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r257839): Broken focus when 'display' changes in an attribute selector
     4        https://bugs.webkit.org/show_bug.cgi?id=217240
     5        <rdar://problem/69891684>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Focus optimization that avoids full style resolution when setting focus in unrendered subtrees
     10        misbehaves when the style is invalidated via an attribute change.
     11
     12        Test case by Ali Juma.
     13
     14        Test: fast/dom/focus-style-resolution-attribute-change.html
     15
     16        * dom/Element.cpp:
     17        (WebCore::Element::invalidateStyle):
     18        * dom/Node.cpp:
     19        (WebCore::Node::invalidateStyle):
     20
     21        We need to set the computed style invalidity bit on all style invalidation code paths.
     22
     23        * html/InputType.cpp:
     24        (WebCore::InputType::setValue):
     25
     26        Don't invalidate style when nothing changes.
     27
    1282021-01-13  Kenneth Russell  <kbr@chromium.org>
    229
  • trunk/Source/WebCore/dom/Element.cpp

    r271439 r271446  
    19671967    Node::invalidateStyle(Style::Validity::ElementInvalid);
    19681968    invalidateSiblingsIfNeeded(*this);
    1969 
    1970     // FIXME: This flag should be set whenever styles are invalidated while computed styles are present,
    1971     // not just in this codepath.
    1972     setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
    19731969}
    19741970
  • trunk/Source/WebCore/dom/Node.cpp

    r269946 r271446  
    891891        return;
    892892
     893    // FIXME: This should be set on all descendants in case of a subtree invalidation.
     894    setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
     895
    893896    // FIXME: Why the second condition?
    894897    bool markAncestors = styleValidity() == Style::Validity::Valid || validity == Style::Validity::SubtreeAndRenderersInvalid;
  • trunk/Source/WebCore/html/InputType.cpp

    r269587 r271446  
    657657    ASSERT(element());
    658658    element()->setValueInternal(sanitizedValue, eventBehavior);
    659     element()->invalidateStyleForSubtree();
    660659    if (!valueChanged)
    661660        return;
     661    element()->invalidateStyleForSubtree();
    662662
    663663    switch (eventBehavior) {
Note: See TracChangeset for help on using the changeset viewer.