Changeset 267642 in webkit
- Timestamp:
- Sep 26, 2020, 6:03:17 PM (6 years ago)
- Location:
- branches/safari-610-branch/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
dom/Element.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-610-branch/Source/WebCore/ChangeLog
r267634 r267642 138 138 (WebCore::RenderLayerBacking::detachFromScrollingCoordinator): 139 139 (WebCore::RenderLayerBacking::setScrollingNodeIDForRole): 140 141 2020-09-25 Alan Coon <alancoon@apple.com>142 143 Cherry-pick r266899. rdar://problem/69586659144 145 Address a post-commit review comment after r266887146 https://bugs.webkit.org/show_bug.cgi?id=216257147 148 Reviewed by Darin Adler.149 150 Remove a check that currently makes us conditionally set `IsComputedStyleInvalidFlag` if there is a computed151 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-d52691b4dbfc159 160 2020-09-10 Wenson Hsieh <wenson_hsieh@apple.com>161 162 Address a post-commit review comment after r266887163 https://bugs.webkit.org/show_bug.cgi?id=216257164 165 Reviewed by Darin Adler.166 167 Remove a check that currently makes us conditionally set `IsComputedStyleInvalidFlag` if there is a computed168 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/69586659177 178 REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced179 https://bugs.webkit.org/show_bug.cgi?id=216257180 <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 null188 text input, and inside of this focus event listener, it reveals a hidden password field by removing an inline189 `display: none;` style rule on the real password input element, programmatically focuses it, and then hides the190 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 the193 case where the programmatically focused element does not have a renderer yet (this applies to the password field194 in this scenario, because it previously had `display: none;`). When we determine whether the newly displayed195 password field is focusable using `Element::isVisibleWithoutResolvingFullStyle`, we then attempt to use either196 the existing computed `RenderStyle` on the element, or perform a partial computed style resolution using the197 `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 the200 inline style changed since the computed style was last set. In the context of this bug, it's actually Safari's201 AutoFill logic (embedded in the injected bundle) that ends up asking for the computed style of the password202 input, forcing it to be created and set (though, as demonstrated in the layout test, simply grabbing the203 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 not206 displayed, and we end up not focusing the element due to believing that the password input is hidden. To fix207 this, we would need to either check whether the element has an invalid style (i.e. `needsStyleRecalc()`) before208 attempting to use the existing computed style, or clear out the `ElementRareData` computed style anytime the209 element's style is invalidated. However, both of these approaches will cause us to perform partial style210 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 can213 remember when computed styles are no longer valid due to style invalidation, and consult this flag in214 `Element::isVisibleWithoutResolvingFullStyle` to avoid using the existing computed style.215 216 Test: fast/forms/programmatic-focus-after-display.html217 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-d52691b4dbfc233 234 2020-09-10 Wenson Hsieh <wenson_hsieh@apple.com>235 236 REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced237 https://bugs.webkit.org/show_bug.cgi?id=216257238 <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 null244 text input, and inside of this focus event listener, it reveals a hidden password field by removing an inline245 `display: none;` style rule on the real password input element, programmatically focuses it, and then hides the246 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 the249 case where the programmatically focused element does not have a renderer yet (this applies to the password field250 in this scenario, because it previously had `display: none;`). When we determine whether the newly displayed251 password field is focusable using `Element::isVisibleWithoutResolvingFullStyle`, we then attempt to use either252 the existing computed `RenderStyle` on the element, or perform a partial computed style resolution using the253 `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 the256 inline style changed since the computed style was last set. In the context of this bug, it's actually Safari's257 AutoFill logic (embedded in the injected bundle) that ends up asking for the computed style of the password258 input, forcing it to be created and set (though, as demonstrated in the layout test, simply grabbing the259 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 not262 displayed, and we end up not focusing the element due to believing that the password input is hidden. To fix263 this, we would need to either check whether the element has an invalid style (i.e. `needsStyleRecalc()`) before264 attempting to use the existing computed style, or clear out the `ElementRareData` computed style anytime the265 element's style is invalidated. However, both of these approaches will cause us to perform partial style266 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 can269 remember when computed styles are no longer valid due to style invalidation, and consult this flag in270 `Element::isVisibleWithoutResolvingFullStyle` to avoid using the existing computed style.271 272 Test: fast/forms/programmatic-focus-after-display.html273 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):280 140 281 141 2020-09-25 Alan Coon <alancoon@apple.com> -
branches/safari-610-branch/Source/WebCore/dom/Element.cpp
r267632 r267642 1948 1948 // FIXME: This flag should be set whenever styles are invalidated while computed styles are present, 1949 1949 // not just in this codepath. 1950 setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag); 1950 if (hasRareData() && elementRareData()->computedStyle()) 1951 setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag); 1951 1952 } 1952 1953 … … 1999 2000 ASSERT(!renderer() || isPseudoElement()); 2000 2001 ensureElementRareData().setComputedStyle(WTFMove(style)); 2001 clearNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);2002 2002 } 2003 2003
Note:
See TracChangeset
for help on using the changeset viewer.