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

Issue 2005593002: Initial ResizeObserver implementation (Closed)

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

Description

This is initial ResizeObserver implementation of the spec https://github.com/WICG/ResizeObserver/, with test cases. This CR does not completely implement the spec. The differences will be resolved in upcoming CRs. The differences are: 1) Notification loop breaks on numeric limit. Should use depth limit. 2) Notification loop polls for size changes. Push is more performant. 3) ResizeObserverEntry should have DOMRectReadOnly, not clientRect. DOMRectReadOnly is still behind a flag, will fix when it lands. BUG=612962

Patch Set 1 #

Total comments: 87

Patch Set 2 : CR fixes. #

Patch Set 3 : Observe content box, not clientWidth #

Total comments: 36

Patch Set 4 : CR fixes, + test suite #

Patch Set 5 : Update to master: Vector<WeakMember> no longer ok. #

Total comments: 23

Patch Set 6 : CR fixes + update to master #

Patch Set 7 : Fix global-interface-listing test #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+1143 lines, -6 lines) Patch
A third_party/WebKit/LayoutTests/resize-observer/notify.html View 1 2 3 1 chunk +359 lines, -0 lines 2 comments Download
A third_party/WebKit/LayoutTests/resize-observer/observe.html View 1 2 3 1 chunk +103 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/resize-observer/resources/resizeTestHelper.js View 1 2 3 1 chunk +90 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt View 1 2 3 4 5 6 1 chunk +11 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/core.gypi View 1 2 3 4 5 2 chunks +12 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.h View 1 2 3 4 5 3 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Document.cpp View 1 2 3 4 5 3 chunks +10 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Element.h View 1 2 3 4 5 2 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Element.cpp View 1 2 3 4 5 1 chunk +12 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ElementRareData.h View 1 2 3 4 3 chunks +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ElementRareData.cpp View 1 2 4 chunks +11 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/FrameView.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/FrameView.cpp View 1 2 3 4 5 4 chunks +36 lines, -0 lines 4 comments Download
A third_party/WebKit/Source/core/observer/ResizeObservation.h View 1 2 3 1 chunk +46 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/observer/ResizeObservation.cpp View 1 2 3 1 chunk +39 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/observer/ResizeObserver.h View 1 2 3 1 chunk +61 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/observer/ResizeObserver.cpp View 1 2 3 4 5 1 chunk +105 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/observer/ResizeObserver.idl View 1 chunk +15 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/observer/ResizeObserverCallback.h View 1 chunk +25 lines, -0 lines 0 comments Download
A + third_party/WebKit/Source/core/observer/ResizeObserverCallback.idl View 1 2 3 4 1 chunk +2 lines, -5 lines 0 comments Download
A third_party/WebKit/Source/core/observer/ResizeObserverController.h View 1 2 3 4 1 chunk +40 lines, -0 lines 2 comments Download
A third_party/WebKit/Source/core/observer/ResizeObserverController.cpp View 1 2 3 4 5 1 chunk +52 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/observer/ResizeObserverEntry.h View 1 2 3 4 5 1 chunk +39 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/observer/ResizeObserverEntry.cpp View 1 2 3 4 5 1 chunk +42 lines, -0 lines 2 comments Download
A third_party/WebKit/Source/core/observer/ResizeObserverEntry.idl View 1 2 1 chunk +13 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 33 (13 generated)
atotic1
4 years, 7 months ago (2016-05-21 00:20:55 UTC) #3
szager1
https://codereview.chromium.org/2005593002/diff/1/third_party/WebKit/Source/core/dom/Document.h File third_party/WebKit/Source/core/dom/Document.h (right): https://codereview.chromium.org/2005593002/diff/1/third_party/WebKit/Source/core/dom/Document.h#newcode693 third_party/WebKit/Source/core/dom/Document.h:693: bool hasResizeObserverController() const { return m_resizeObserverController; } This should ...
4 years, 7 months ago (2016-05-23 19:49:12 UTC) #5
atotic1
This code should address all of the CR issues except: - clientWidth and related fields ...
4 years, 7 months ago (2016-05-25 00:15:54 UTC) #7
atotic1
This commit addresses most CR issues. Big CR related changes were: - created a HashMap ...
4 years, 6 months ago (2016-06-01 17:56:09 UTC) #9
szager1
https://codereview.chromium.org/2005593002/diff/1/third_party/WebKit/Source/core/observer/ResizeObservation.h File third_party/WebKit/Source/core/observer/ResizeObservation.h (right): https://codereview.chromium.org/2005593002/diff/1/third_party/WebKit/Source/core/observer/ResizeObservation.h#newcode25 third_party/WebKit/Source/core/observer/ResizeObservation.h:25: virtual ~ResizeObservation() {}; On 2016/05/25 00:15:52, atotic1 wrote: > ...
4 years, 6 months ago (2016-06-02 20:52:42 UTC) #10
atotic1
Thanks for the well-thought out, and helpful comments. Thanks to you, now I know the ...
4 years, 6 months ago (2016-06-02 23:57:25 UTC) #11
atotic1
This patch set contains: - fixes for CR issues - a LayoutTests test suite I've ...
4 years, 6 months ago (2016-06-08 18:59:22 UTC) #12
szager1
https://codereview.chromium.org/2005593002/diff/80001/third_party/WebKit/Source/core/frame/FrameView.cpp File third_party/WebKit/Source/core/frame/FrameView.cpp (right): https://codereview.chromium.org/2005593002/diff/80001/third_party/WebKit/Source/core/frame/FrameView.cpp#newcode2461 third_party/WebKit/Source/core/frame/FrameView.cpp:2461: while (resizeController.gatherObservations()) { This is a much clearer organization ...
4 years, 5 months ago (2016-07-11 18:33:47 UTC) #13
atotic1
All CR comments have been addressed. I've also rebased to current master. Good review, caught ...
4 years, 5 months ago (2016-07-11 23:18:59 UTC) #14
szager1
lgtm, great work! https://codereview.chromium.org/2005593002/diff/80001/third_party/WebKit/Source/core/frame/FrameView.cpp File third_party/WebKit/Source/core/frame/FrameView.cpp (right): https://codereview.chromium.org/2005593002/diff/80001/third_party/WebKit/Source/core/frame/FrameView.cpp#newcode2467 third_party/WebKit/Source/core/frame/FrameView.cpp:2467: // Ensure notifications will get delivered ...
4 years, 5 months ago (2016-07-11 23:33:34 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2005593002/100001
4 years, 5 months ago (2016-07-12 00:16:15 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/215583)
4 years, 5 months ago (2016-07-12 00:30:22 UTC) #19
atotic1
Hi eae and esprehn, Ian suggested that you'd be good owner reviewers for ResizeObserver. I ...
4 years, 5 months ago (2016-07-12 20:15:49 UTC) #24
eae
This looks great! I have a few questions however. https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/LayoutTests/resize-observer/notify.html File third_party/WebKit/LayoutTests/resize-observer/notify.html (right): https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/LayoutTests/resize-observer/notify.html#newcode130 third_party/WebKit/LayoutTests/resize-observer/notify.html:130: ...
4 years, 5 months ago (2016-07-13 23:39:47 UTC) #27
esprehn
Hmm I'd like to land the code that pushes the resizes down the tree instead ...
4 years, 5 months ago (2016-07-14 02:32:33 UTC) #28
esprehn
Hmm I'd like to land the code that pushes the resizes down the tree instead ...
4 years, 5 months ago (2016-07-14 02:32:33 UTC) #29
esprehn
On 2016/07/14 at 02:32:33, esprehn wrote: > Hmm I'd like to land the code that ...
4 years, 5 months ago (2016-07-14 02:38:26 UTC) #30
atotic1
On 2016/07/14 02:38:26, esprehn wrote: > Also this patch is so massive, can we land ...
4 years, 5 months ago (2016-07-15 01:34:00 UTC) #31
atotic1
Replies to eae comments. https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/LayoutTests/resize-observer/notify.html File third_party/WebKit/LayoutTests/resize-observer/notify.html (right): https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/LayoutTests/resize-observer/notify.html#newcode130 third_party/WebKit/LayoutTests/resize-observer/notify.html:130: t1.style.paddingTop = "10px"; On 2016/07/13 ...
4 years, 5 months ago (2016-07-15 01:43:17 UTC) #32
eae
4 years, 5 months ago (2016-07-15 17:34:38 UTC) #33
On 2016/07/15 01:43:17, atotic1 wrote:
> Replies to eae comments.
> 
>
https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/Lay...
> File third_party/WebKit/LayoutTests/resize-observer/notify.html (right):
> 
>
https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/Lay...
> third_party/WebKit/LayoutTests/resize-observer/notify.html:130:
> t1.style.paddingTop = "10px";
> On 2016/07/13 23:39:47, eae wrote:
> > It would be nice to have a test with borders and margins, even if that
doesn't
> > change things.
> 
> Done.
> 
>
https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/Sou...
> File third_party/WebKit/Source/core/frame/FrameView.cpp (right):
> 
>
https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/Sou...
> third_party/WebKit/Source/core/frame/FrameView.cpp:2512: if
> (!m_frame->document()->resizeObserverController())
> On 2016/07/13 23:39:47, eae wrote:
> > When would notifyResizeObserver ever be called if the document doesn't have
a
> > resizeObserverController? A comment explaining the edge case would be
helpful!
> 
> Controller is allocated only if ResizeObserver is created. This is a common
> case.

Thanks for clarifying!


>
https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/Sou...
> third_party/WebKit/Source/core/frame/FrameView.cpp:2524: // Report the error.
> On 2016/07/13 23:39:47, eae wrote:
> > Please remove redundant comment.
> 
> Done.
> 
>
https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/Sou...
> File third_party/WebKit/Source/core/observer/ResizeObserverController.h
(right):
> 
>
https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/Sou...
> third_party/WebKit/Source/core/observer/ResizeObserverController.h:20: static
> const size_t kRenderLoopLimit = 16;
> On 2016/07/13 23:39:47, eae wrote:
> > A comment explaining the limit would be helpful.
> 
> This limit will go away in the final checkin.

Great!

> 
>
https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/Sou...
> File third_party/WebKit/Source/core/observer/ResizeObserverEntry.cpp (right):
> 
>
https://codereview.chromium.org/2005593002/diff/120001/third_party/WebKit/Sou...
> third_party/WebKit/Source/core/observer/ResizeObserverEntry.cpp:26:
> layout->paddingLeft(), layout->paddingTop(),
> On 2016/07/13 23:39:47, eae wrote:
> > Shouldn't the location include borderLeft and borderTop? contentWidth
> explicitly
> > subtracts the borders (as well as the paddings).
> > 
> > If so you can use ClientRect::create(FloatRect(layout->contentBoxRect()));
> 
> Location does not include borderLeft/Top. See discussion at
> https://github.com/WICG/ResizeObserver/issues/6

Ah, thanks for pointing that out.


LGTM

Powered by Google App Engine
This is Rietveld 408576698