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

Changeset 267642 in webkit


Ignore:
Timestamp:
Sep 26, 2020, 6:03:17 PM (6 years ago)
Author:
Alan Coon
Message:

Revert r266899. rdar://problem/69586659

Location:
branches/safari-610-branch/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-610-branch/Source/WebCore/ChangeLog

    r267634 r267642  
    138138            (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
    139139            (WebCore::RenderLayerBacking::setScrollingNodeIDForRole):
    140 
    141 2020-09-25  Alan Coon  <alancoon@apple.com>
    142 
    143         Cherry-pick r266899. rdar://problem/69586659
    144 
    145     Address a post-commit review comment after r266887
    146     https://bugs.webkit.org/show_bug.cgi?id=216257
    147    
    148     Reviewed by Darin Adler.
    149    
    150     Remove a check that currently makes us conditionally set `IsComputedStyleInvalidFlag` if there is a computed
    151     style in rare data. There should be no change in behavior; this just makes the code a bit simpler.
    152    
    153     * dom/Element.cpp:
    154     (WebCore::Element::invalidateStyle):
    155     (WebCore::Element::storeDisplayContentsStyle):
    156    
    157    
    158     git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266899 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    159 
    160     2020-09-10  Wenson Hsieh  <wenson_hsieh@apple.com>
    161 
    162             Address a post-commit review comment after r266887
    163             https://bugs.webkit.org/show_bug.cgi?id=216257
    164 
    165             Reviewed by Darin Adler.
    166 
    167             Remove a check that currently makes us conditionally set `IsComputedStyleInvalidFlag` if there is a computed
    168             style in rare data. There should be no change in behavior; this just makes the code a bit simpler.
    169 
    170             * dom/Element.cpp:
    171             (WebCore::Element::invalidateStyle):
    172             (WebCore::Element::storeDisplayContentsStyle):
    173 
    174 2020-09-25  Alan Coon  <alancoon@apple.com>
    175 
    176         Cherry-pick r266887. rdar://problem/69586659
    177 
    178     REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced
    179     https://bugs.webkit.org/show_bug.cgi?id=216257
    180     <rdar://problem/68150686>
    181    
    182     Reviewed by Antti Koivisto.
    183    
    184     Source/WebCore:
    185    
    186     On clickpay.com, the field in the login form that contains the text "Password" is actually a plain text input,
    187     referred to by the site's script as the "null text input". The page adds a focus event listener to this null
    188     text input, and inside of this focus event listener, it reveals a hidden password field by removing an inline
    189     `display: none;` style rule on the real password input element, programmatically focuses it, and then hides the
    190     null text input by setting it to `display: none;` via inline style.
    191    
    192     However, after the changes in r257839, we no longer attempt to do a style update upon programmatic focus in the
    193     case where the programmatically focused element does not have a renderer yet (this applies to the password field
    194     in this scenario, because it previously had `display: none;`). When we determine whether the newly displayed
    195     password field is focusable using `Element::isVisibleWithoutResolvingFullStyle`, we then attempt to use either
    196     the existing computed `RenderStyle` on the element, or perform a partial computed style resolution using the
    197     `ResolveComputedStyleMode::RenderedOnly` flag.
    198    
    199     But in the case where `ElementRareData`'s computed style exists, it is not guaranteed to be up to date if the
    200     inline style changed since the computed style was last set. In the context of this bug, it's actually Safari's
    201     AutoFill logic (embedded in the injected bundle) that ends up asking for the computed style of the password
    202     input, forcing it to be created and set (though, as demonstrated in the layout test, simply grabbing the
    203     computed style is sufficient to replicate the bug outside of Safari).
    204    
    205     The end result is that we'll use this stale computed style, which still believes that the password input is not
    206     displayed, and we end up not focusing the element due to believing that the password input is hidden. To fix
    207     this, we would need to either check whether the element has an invalid style (i.e. `needsStyleRecalc()`) before
    208     attempting to use the existing computed style, or clear out the `ElementRareData` computed style anytime the
    209     element's style is invalidated. However, both of these approaches will cause us to perform partial style
    210     resolution much more aggressively, leading to a 2-3% regression in Speedometer.
    211    
    212     To address the bug without hampering our performance wins from r257839, we add a new node flag so that we can
    213     remember when computed styles are no longer valid due to style invalidation, and consult this flag in
    214     `Element::isVisibleWithoutResolvingFullStyle` to avoid using the existing computed style.
    215    
    216     Test: fast/forms/programmatic-focus-after-display.html
    217    
    218     * dom/Element.cpp:
    219     (WebCore::Element::invalidateStyle):
    220     (WebCore::Element::resolveComputedStyle):
    221     (WebCore::Element::isVisibleWithoutResolvingFullStyle const):
    222     * dom/Node.h:
    223     (WebCore::Node::setHasValidStyle):
    224    
    225     LayoutTests:
    226    
    227     Add a new layout test to verify that the bug does not occur. See WebCore/ChangeLog for more details.
    228    
    229     * fast/forms/programmatic-focus-after-display-expected.txt: Added.
    230     * fast/forms/programmatic-focus-after-display.html: Added.
    231    
    232     git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    233 
    234     2020-09-10  Wenson Hsieh  <wenson_hsieh@apple.com>
    235 
    236             REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced
    237             https://bugs.webkit.org/show_bug.cgi?id=216257
    238             <rdar://problem/68150686>
    239 
    240             Reviewed by Antti Koivisto.
    241 
    242             On clickpay.com, the field in the login form that contains the text "Password" is actually a plain text input,
    243             referred to by the site's script as the "null text input". The page adds a focus event listener to this null
    244             text input, and inside of this focus event listener, it reveals a hidden password field by removing an inline
    245             `display: none;` style rule on the real password input element, programmatically focuses it, and then hides the
    246             null text input by setting it to `display: none;` via inline style.
    247 
    248             However, after the changes in r257839, we no longer attempt to do a style update upon programmatic focus in the
    249             case where the programmatically focused element does not have a renderer yet (this applies to the password field
    250             in this scenario, because it previously had `display: none;`). When we determine whether the newly displayed
    251             password field is focusable using `Element::isVisibleWithoutResolvingFullStyle`, we then attempt to use either
    252             the existing computed `RenderStyle` on the element, or perform a partial computed style resolution using the
    253             `ResolveComputedStyleMode::RenderedOnly` flag.
    254 
    255             But in the case where `ElementRareData`'s computed style exists, it is not guaranteed to be up to date if the
    256             inline style changed since the computed style was last set. In the context of this bug, it's actually Safari's
    257             AutoFill logic (embedded in the injected bundle) that ends up asking for the computed style of the password
    258             input, forcing it to be created and set (though, as demonstrated in the layout test, simply grabbing the
    259             computed style is sufficient to replicate the bug outside of Safari).
    260 
    261             The end result is that we'll use this stale computed style, which still believes that the password input is not
    262             displayed, and we end up not focusing the element due to believing that the password input is hidden. To fix
    263             this, we would need to either check whether the element has an invalid style (i.e. `needsStyleRecalc()`) before
    264             attempting to use the existing computed style, or clear out the `ElementRareData` computed style anytime the
    265             element's style is invalidated. However, both of these approaches will cause us to perform partial style
    266             resolution much more aggressively, leading to a 2-3% regression in Speedometer.
    267 
    268             To address the bug without hampering our performance wins from r257839, we add a new node flag so that we can
    269             remember when computed styles are no longer valid due to style invalidation, and consult this flag in
    270             `Element::isVisibleWithoutResolvingFullStyle` to avoid using the existing computed style.
    271 
    272             Test: fast/forms/programmatic-focus-after-display.html
    273 
    274             * dom/Element.cpp:
    275             (WebCore::Element::invalidateStyle):
    276             (WebCore::Element::resolveComputedStyle):
    277             (WebCore::Element::isVisibleWithoutResolvingFullStyle const):
    278             * dom/Node.h:
    279             (WebCore::Node::setHasValidStyle):
    280140
    2811412020-09-25  Alan Coon  <alancoon@apple.com>
  • branches/safari-610-branch/Source/WebCore/dom/Element.cpp

    r267632 r267642  
    19481948    // FIXME: This flag should be set whenever styles are invalidated while computed styles are present,
    19491949    // not just in this codepath.
    1950     setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
     1950    if (hasRareData() && elementRareData()->computedStyle())
     1951        setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
    19511952}
    19521953
     
    19992000    ASSERT(!renderer() || isPseudoElement());
    20002001    ensureElementRareData().setComputedStyle(WTFMove(style));
    2001     clearNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
    20022002}
    20032003
Note: See TracChangeset for help on using the changeset viewer.