Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Issue 2163893002: Avoid calling isFocusable() during updateLayout. (Closed)

Created:
4 years, 5 months ago by kochi
Modified:
4 years, 5 months ago
Reviewers:
tkent, esprehn
CC:
blink-reviews, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Avoid calling isFocusable() during updateLayout. isFocusable() expects the layout is up-to-date, but in the updateLayout code path one callsite has existed. The call could be delayed after the update layout is complete, and the delayed callback already does the check again. So it is safe to remove the callsite without breaking the whole logic. This removes pre-condition to make a callback request, so there could be extra callbacks could be created which might impact performance. Considering the assertion was added 5+months ago and this is the first report, hitting the code path should be very infrequent and performance impact should be negligible. BUG=627074 TEST=fast/dom/focus-and-update-layout-crash.html

Patch Set 1 #

Patch Set 2 : layout test #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+27 lines, -1 line) Patch
A third_party/WebKit/LayoutTests/fast/dom/focus-and-update-layout-crash.html View 1 chunk +26 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.cpp View 1 chunk +1 line, -1 line 3 comments Download

Messages

Total messages: 12 (6 generated)
kochi
tkent-san, could you review this?
4 years, 5 months ago (2016-07-20 09:39:37 UTC) #2
tkent
https://codereview.chromium.org/2163893002/diff/20001/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (left): https://codereview.chromium.org/2163893002/diff/20001/third_party/WebKit/Source/core/dom/Document.cpp#oldcode1734 third_party/WebKit/Source/core/dom/Document.cpp:1734: if (m_focusedElement && !m_focusedElement->isFocusable()) At this line, we already ...
4 years, 5 months ago (2016-07-21 00:38:50 UTC) #7
kochi
https://codereview.chromium.org/2163893002/diff/20001/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (left): https://codereview.chromium.org/2163893002/diff/20001/third_party/WebKit/Source/core/dom/Document.cpp#oldcode1734 third_party/WebKit/Source/core/dom/Document.cpp:1734: if (m_focusedElement && !m_focusedElement->isFocusable()) On 2016/07/21 00:38:50, tkent wrote: ...
4 years, 5 months ago (2016-07-21 01:32:49 UTC) #8
esprehn
https://codereview.chromium.org/2163893002/diff/20001/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (right): https://codereview.chromium.org/2163893002/diff/20001/third_party/WebKit/Source/core/dom/Document.cpp#newcode1734 third_party/WebKit/Source/core/dom/Document.cpp:1734: if (m_focusedElement) Note that we can't land this change ...
4 years, 5 months ago (2016-07-23 08:37:25 UTC) #10
esprehn
On 2016/07/23 at 08:37:25, esprehn wrote: > https://codereview.chromium.org/2163893002/diff/20001/third_party/WebKit/Source/core/dom/Document.cpp > File third_party/WebKit/Source/core/dom/Document.cpp (right): > > https://codereview.chromium.org/2163893002/diff/20001/third_party/WebKit/Source/core/dom/Document.cpp#newcode1734 ...
4 years, 5 months ago (2016-07-23 08:37:51 UTC) #11
kochi
4 years, 5 months ago (2016-07-25 08:36:30 UTC) #12
On 2016/07/23 08:37:25, esprehn wrote:
>
https://codereview.chromium.org/2163893002/diff/20001/third_party/WebKit/Sour...
> File third_party/WebKit/Source/core/dom/Document.cpp (right):
> 
>
https://codereview.chromium.org/2163893002/diff/20001/third_party/WebKit/Sour...
> third_party/WebKit/Source/core/dom/Document.cpp:1734: if (m_focusedElement)
> Note that we can't land this change anyway, since clearFocusedElementSoon()
> posts a task. This change would have made all calls to
> updateStyleAndLayoutTree() post an unconditional additional task.
> 
> not lgtm

Yeah, indeed.
I'm reinvestigating the issue and will have a new fix.

Powered by Google App Engine
This is Rietveld 408576698