Changeset 267643 in webkit
- Timestamp:
- Sep 26, 2020, 6:03:21 PM (6 years ago)
- Location:
- branches/safari-610-branch
- Files:
-
- 2 deleted
- 3 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/forms/programmatic-focus-after-display-expected.txt (deleted)
-
LayoutTests/fast/forms/programmatic-focus-after-display.html (deleted)
-
Source/WebCore/dom/Element.cpp (modified) (4 diffs)
-
Source/WebCore/dom/Node.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-610-branch/LayoutTests/ChangeLog
r267634 r267643 109 109 * fast/scrolling/mac/mousewheel-over-scrollbar.html: Added. 110 110 * 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/69586659115 116 REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced117 https://bugs.webkit.org/show_bug.cgi?id=216257118 <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 null126 text input, and inside of this focus event listener, it reveals a hidden password field by removing an inline127 `display: none;` style rule on the real password input element, programmatically focuses it, and then hides the128 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 the131 case where the programmatically focused element does not have a renderer yet (this applies to the password field132 in this scenario, because it previously had `display: none;`). When we determine whether the newly displayed133 password field is focusable using `Element::isVisibleWithoutResolvingFullStyle`, we then attempt to use either134 the existing computed `RenderStyle` on the element, or perform a partial computed style resolution using the135 `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 the138 inline style changed since the computed style was last set. In the context of this bug, it's actually Safari's139 AutoFill logic (embedded in the injected bundle) that ends up asking for the computed style of the password140 input, forcing it to be created and set (though, as demonstrated in the layout test, simply grabbing the141 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 not144 displayed, and we end up not focusing the element due to believing that the password input is hidden. To fix145 this, we would need to either check whether the element has an invalid style (i.e. `needsStyleRecalc()`) before146 attempting to use the existing computed style, or clear out the `ElementRareData` computed style anytime the147 element's style is invalidated. However, both of these approaches will cause us to perform partial style148 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 can151 remember when computed styles are no longer valid due to style invalidation, and consult this flag in152 `Element::isVisibleWithoutResolvingFullStyle` to avoid using the existing computed style.153 154 Test: fast/forms/programmatic-focus-after-display.html155 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-d52691b4dbfc171 172 2020-09-10 Wenson Hsieh <wenson_hsieh@apple.com>173 174 REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced175 https://bugs.webkit.org/show_bug.cgi?id=216257176 <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.184 111 185 112 2020-09-25 Alan Coon <alancoon@apple.com> -
branches/safari-610-branch/Source/WebCore/dom/Element.cpp
r267642 r267643 1945 1945 Node::invalidateStyle(Style::Validity::ElementInvalid); 1946 1946 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);1952 1947 } 1953 1948 … … 3323 3318 { 3324 3319 ASSERT(isConnected()); 3325 ASSERT(!existingComputedStyle() || hasNodeFlag(NodeFlag::IsComputedStyleInvalidFlag));3320 ASSERT(!existingComputedStyle()); 3326 3321 3327 3322 Deque<RefPtr<Element>, 32> elementsRequiringComputedStyle({ this }); … … 3343 3338 ElementRareData& rareData = element->ensureElementRareData(); 3344 3339 rareData.setComputedStyle(WTFMove(style)); 3345 element->clearNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);3346 3340 3347 3341 if (mode == ResolveComputedStyleMode::RenderedOnly && computedStyle->display() == DisplayType::None) … … 3373 3367 3374 3368 // Compute style in yet unstyled subtree. 3375 auto* style = hasNodeFlag(NodeFlag::IsComputedStyleInvalidFlag) ? nullptr :existingComputedStyle();3369 auto* style = existingComputedStyle(); 3376 3370 if (!style) 3377 3371 style = const_cast<Element&>(*this).resolveComputedStyle(ResolveComputedStyleMode::RenderedOnly); -
branches/safari-610-branch/Source/WebCore/dom/Node.h
r267631 r267643 554 554 ChildrenAffectedByFirstChildRulesFlag = 1 << 25, 555 555 ChildrenAffectedByLastChildRulesFlag = 1 << 26, 556 IsComputedStyleInvalidFlag = 1 << 27,556 // UnusedFlag = 1 << 27, 557 557 558 558 AffectsNextSiblingElementStyle = 1 << 28, … … 776 776 m_nodeFlags &= ~StyleValidityMask; 777 777 clearFlag(StyleResolutionShouldRecompositeLayerFlag); 778 clearNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);779 778 } 780 779
Note:
See TracChangeset
for help on using the changeset viewer.