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

Changeset 267643 in webkit


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

Revert r266887. rdar://problem/69586659

Location:
branches/safari-610-branch
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-610-branch/LayoutTests/ChangeLog

    r267634 r267643  
    109109            * fast/scrolling/mac/mousewheel-over-scrollbar.html: Added.
    110110            * fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt:
    111 
    112 2020-09-25  Alan Coon  <alancoon@apple.com>
    113 
    114         Cherry-pick r266887. rdar://problem/69586659
    115 
    116     REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced
    117     https://bugs.webkit.org/show_bug.cgi?id=216257
    118     <rdar://problem/68150686>
    119    
    120     Reviewed by Antti Koivisto.
    121    
    122     Source/WebCore:
    123    
    124     On clickpay.com, the field in the login form that contains the text "Password" is actually a plain text input,
    125     referred to by the site's script as the "null text input". The page adds a focus event listener to this null
    126     text input, and inside of this focus event listener, it reveals a hidden password field by removing an inline
    127     `display: none;` style rule on the real password input element, programmatically focuses it, and then hides the
    128     null text input by setting it to `display: none;` via inline style.
    129    
    130     However, after the changes in r257839, we no longer attempt to do a style update upon programmatic focus in the
    131     case where the programmatically focused element does not have a renderer yet (this applies to the password field
    132     in this scenario, because it previously had `display: none;`). When we determine whether the newly displayed
    133     password field is focusable using `Element::isVisibleWithoutResolvingFullStyle`, we then attempt to use either
    134     the existing computed `RenderStyle` on the element, or perform a partial computed style resolution using the
    135     `ResolveComputedStyleMode::RenderedOnly` flag.
    136    
    137     But in the case where `ElementRareData`'s computed style exists, it is not guaranteed to be up to date if the
    138     inline style changed since the computed style was last set. In the context of this bug, it's actually Safari's
    139     AutoFill logic (embedded in the injected bundle) that ends up asking for the computed style of the password
    140     input, forcing it to be created and set (though, as demonstrated in the layout test, simply grabbing the
    141     computed style is sufficient to replicate the bug outside of Safari).
    142    
    143     The end result is that we'll use this stale computed style, which still believes that the password input is not
    144     displayed, and we end up not focusing the element due to believing that the password input is hidden. To fix
    145     this, we would need to either check whether the element has an invalid style (i.e. `needsStyleRecalc()`) before
    146     attempting to use the existing computed style, or clear out the `ElementRareData` computed style anytime the
    147     element's style is invalidated. However, both of these approaches will cause us to perform partial style
    148     resolution much more aggressively, leading to a 2-3% regression in Speedometer.
    149    
    150     To address the bug without hampering our performance wins from r257839, we add a new node flag so that we can
    151     remember when computed styles are no longer valid due to style invalidation, and consult this flag in
    152     `Element::isVisibleWithoutResolvingFullStyle` to avoid using the existing computed style.
    153    
    154     Test: fast/forms/programmatic-focus-after-display.html
    155    
    156     * dom/Element.cpp:
    157     (WebCore::Element::invalidateStyle):
    158     (WebCore::Element::resolveComputedStyle):
    159     (WebCore::Element::isVisibleWithoutResolvingFullStyle const):
    160     * dom/Node.h:
    161     (WebCore::Node::setHasValidStyle):
    162    
    163     LayoutTests:
    164    
    165     Add a new layout test to verify that the bug does not occur. See WebCore/ChangeLog for more details.
    166    
    167     * fast/forms/programmatic-focus-after-display-expected.txt: Added.
    168     * fast/forms/programmatic-focus-after-display.html: Added.
    169    
    170     git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    171 
    172     2020-09-10  Wenson Hsieh  <wenson_hsieh@apple.com>
    173 
    174             REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced
    175             https://bugs.webkit.org/show_bug.cgi?id=216257
    176             <rdar://problem/68150686>
    177 
    178             Reviewed by Antti Koivisto.
    179 
    180             Add a new layout test to verify that the bug does not occur. See WebCore/ChangeLog for more details.
    181 
    182             * fast/forms/programmatic-focus-after-display-expected.txt: Added.
    183             * fast/forms/programmatic-focus-after-display.html: Added.
    184111
    1851122020-09-25  Alan Coon  <alancoon@apple.com>
  • branches/safari-610-branch/Source/WebCore/dom/Element.cpp

    r267642 r267643  
    19451945    Node::invalidateStyle(Style::Validity::ElementInvalid);
    19461946    invalidateSiblingsIfNeeded(*this);
    1947 
    1948     // FIXME: This flag should be set whenever styles are invalidated while computed styles are present,
    1949     // not just in this codepath.
    1950     if (hasRareData() && elementRareData()->computedStyle())
    1951         setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
    19521947}
    19531948
     
    33233318{
    33243319    ASSERT(isConnected());
    3325     ASSERT(!existingComputedStyle() || hasNodeFlag(NodeFlag::IsComputedStyleInvalidFlag));
     3320    ASSERT(!existingComputedStyle());
    33263321
    33273322    Deque<RefPtr<Element>, 32> elementsRequiringComputedStyle({ this });
     
    33433338        ElementRareData& rareData = element->ensureElementRareData();
    33443339        rareData.setComputedStyle(WTFMove(style));
    3345         element->clearNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
    33463340
    33473341        if (mode == ResolveComputedStyleMode::RenderedOnly && computedStyle->display() == DisplayType::None)
     
    33733367
    33743368    // Compute style in yet unstyled subtree.
    3375     auto* style = hasNodeFlag(NodeFlag::IsComputedStyleInvalidFlag) ? nullptr : existingComputedStyle();
     3369    auto* style = existingComputedStyle();
    33763370    if (!style)
    33773371        style = const_cast<Element&>(*this).resolveComputedStyle(ResolveComputedStyleMode::RenderedOnly);
  • branches/safari-610-branch/Source/WebCore/dom/Node.h

    r267631 r267643  
    554554        ChildrenAffectedByFirstChildRulesFlag = 1 << 25,
    555555        ChildrenAffectedByLastChildRulesFlag = 1 << 26,
    556         IsComputedStyleInvalidFlag = 1 << 27,
     556        // UnusedFlag = 1 << 27,
    557557
    558558        AffectsNextSiblingElementStyle = 1 << 28,
     
    776776    m_nodeFlags &= ~StyleValidityMask;
    777777    clearFlag(StyleResolutionShouldRecompositeLayerFlag);
    778     clearNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
    779778}
    780779
Note: See TracChangeset for help on using the changeset viewer.