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

Issue 412073002: Local NTP: prevent tiles from reloading on resize by moving them into single <div>. (Closed)

Created:
6 years, 5 months ago by huangs
Modified:
6 years, 4 months ago
CC:
chromium-reviews, skanuj+watch_chromium.org, melevin+watch_chromium.org, dhollowa+watch_chromium.org, dougw+watch_chromium.org, donnd+watch_chromium.org, dominich, jfweitz+watch_chromium.org, David Black, arv+watch_chromium.org, samarth+watch_chromium.org, kmadhusu+watch_chromium.org
Project:
chromium
Visibility:
Public.

Description

Local NTP: prevent tiles from reloading on resize by moving them into single <div>. Tiles in chrome-search://local-ntp/local-ntp.html used to be arranged in 2 rows, and get reshuffled when screen resize causes number of columns to change. However, detaching and reattaching elements with <iframe>s cause the <iframe>s to reload, resulting in flickering. This CL places all tiles in a single <div>, so no reshuffling is needed. Instead, if number of columns change we resize the container width (and also hide tiles beyond row 2), and let HTML layout place handle the proper wrapping. On blacklisting, we cannot compare identities between old tiles and new, so a reload is necessary, which leads to some flickering. Also tested for <body dir="RTL"> Additional cleanups: - To show all tiles only after everything is loaded: using a Barrier counter instead of looping on every load, which was O(n^2). - Broke apart onMostVisitedChange() and added more comments. - Removed unused CSS for fakebox and tiles resizing (JS does resizing now). - Using CSS visibility instead of hidden to show #mv-tiles, so it take up space and prevent content beneath tiles from jumping up briefly. - Refactoring the logic to hide tiles during load and show all at once when everything loads (or timeout occurs). Using new class Barrier to do this. BUG=399388 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=287120

Patch Set 1 #

Total comments: 24

Patch Set 2 : Using Barrier; cleaned up onResize(); comments. #

Total comments: 2

Patch Set 3 : Switching back to userInitiatedMostVisitedChange; hiding tiles using visibility. #

Total comments: 16

Patch Set 4 : Adding local_ntp_utils.js and moving Barrier there. #

Total comments: 29

Patch Set 5 : Fixing comments; improving renderTiles(). #

Total comments: 8

Patch Set 6 : Fixing comments. #

Total comments: 10

Patch Set 7 : Moving tile visibility logic to renderAndShowTiles(), using per-session Barrier. #

Total comments: 4

Patch Set 8 : Comment fixes. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+202 lines, -169 lines) Patch
M chrome/browser/browser_resources.grd View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/resources/local_ntp/local_ntp.css View 1 2 2 chunks +8 lines, -39 lines 0 comments Download
M chrome/browser/resources/local_ntp/local_ntp.js View 1 2 3 4 5 6 7 15 chunks +138 lines, -130 lines 0 comments Download
A chrome/browser/resources/local_ntp/local_ntp_util.js View 1 2 3 4 5 6 1 chunk +54 lines, -0 lines 0 comments Download
M chrome/browser/search/local_ntp_source.cc View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 33 (0 generated)
huangs
Starting my single-<div> cleanup on local NTP first. PTAL.
6 years, 5 months ago (2014-07-23 22:46:42 UTC) #1
huangs
+mathp@
6 years, 5 months ago (2014-07-24 14:37:44 UTC) #2
Mathieu
First pass https://codereview.chromium.org/412073002/diff/1/chrome/browser/resources/local_ntp/local_ntp.js File chrome/browser/resources/local_ntp/local_ntp.js (right): https://codereview.chromium.org/412073002/diff/1/chrome/browser/resources/local_ntp/local_ntp.js#newcode449 chrome/browser/resources/local_ntp/local_ntp.js:449: remove extra new line https://codereview.chromium.org/412073002/diff/1/chrome/browser/resources/local_ntp/local_ntp.js#newcode506 chrome/browser/resources/local_ntp/local_ntp.js:506: * ...
6 years, 5 months ago (2014-07-24 15:11:26 UTC) #3
beaudoin
https://codereview.chromium.org/412073002/diff/1/chrome/browser/resources/local_ntp/local_ntp.css File chrome/browser/resources/local_ntp/local_ntp.css (right): https://codereview.chromium.org/412073002/diff/1/chrome/browser/resources/local_ntp/local_ntp.css#newcode148 chrome/browser/resources/local_ntp/local_ntp.css:148: width: 478px; Did you really want to change the ...
6 years, 5 months ago (2014-07-24 15:24:37 UTC) #4
huangs
Did more cleanup: - Removed "@media only" CSS, which are not used. - Added Barrier ...
6 years, 5 months ago (2014-07-24 19:33:12 UTC) #5
beaudoin
LGTM with one comment to fix. https://codereview.chromium.org/412073002/diff/20001/chrome/browser/resources/local_ntp/local_ntp.js File chrome/browser/resources/local_ntp/local_ntp.js (right): https://codereview.chromium.org/412073002/diff/20001/chrome/browser/resources/local_ntp/local_ntp.js#newcode524 chrome/browser/resources/local_ntp/local_ntp.js:524: userInitiatedCounter = Math.max(0, ...
6 years, 5 months ago (2014-07-24 22:09:16 UTC) #6
huangs
Updated. Ready for OWNER review from jered@. https://codereview.chromium.org/412073002/diff/20001/chrome/browser/resources/local_ntp/local_ntp.js File chrome/browser/resources/local_ntp/local_ntp.js (right): https://codereview.chromium.org/412073002/diff/20001/chrome/browser/resources/local_ntp/local_ntp.js#newcode524 chrome/browser/resources/local_ntp/local_ntp.js:524: userInitiatedCounter = ...
6 years, 5 months ago (2014-07-24 22:56:57 UTC) #7
Mathieu
Some comments https://codereview.chromium.org/412073002/diff/40001/chrome/browser/resources/local_ntp/local_ntp.js File chrome/browser/resources/local_ntp/local_ntp.js (right): https://codereview.chromium.org/412073002/diff/40001/chrome/browser/resources/local_ntp/local_ntp.js#newcode171 chrome/browser/resources/local_ntp/local_ntp.js:171: * A flag to indicate Most Visit ...
6 years, 5 months ago (2014-07-25 00:19:17 UTC) #8
huangs
Updated https://codereview.chromium.org/412073002/diff/40001/chrome/browser/resources/local_ntp/local_ntp.js File chrome/browser/resources/local_ntp/local_ntp.js (right): https://codereview.chromium.org/412073002/diff/40001/chrome/browser/resources/local_ntp/local_ntp.js#newcode171 chrome/browser/resources/local_ntp/local_ntp.js:171: * A flag to indicate Most Visit changed ...
6 years, 5 months ago (2014-07-25 20:12:18 UTC) #9
huangs
OWNER review to jhawkins@. Thanks!
6 years, 5 months ago (2014-07-25 20:15:12 UTC) #10
James Hawkins
On 2014/07/25 20:15:12, huangs1 wrote: > OWNER review to jhawkins@. Thanks! Which files?
6 years, 5 months ago (2014-07-25 20:24:13 UTC) #11
huangs
All files if possible (jered@ haven't replied yet), but especially chrome/browser/browser_resources.grd Thanks!
6 years, 5 months ago (2014-07-25 23:40:39 UTC) #12
Jered
On 2014/07/25 23:40:39, huangs1 wrote: > All files if possible (jered@ haven't replied yet), but ...
6 years, 5 months ago (2014-07-26 00:06:23 UTC) #13
huangs
Please take your time, as I'm taking Monday off. Thanks!
6 years, 5 months ago (2014-07-26 02:37:43 UTC) #14
Mathieu
My concerns are addressed :) lgtm
6 years, 4 months ago (2014-07-28 17:25:35 UTC) #15
James Hawkins
In the future, please break up CLs into independent chunks (e.g., all of the little ...
6 years, 4 months ago (2014-07-28 17:43:35 UTC) #16
Jered
https://chromiumcodereview.appspot.com/412073002/diff/80001/chrome/browser/resources/local_ntp/local_ntp.css File chrome/browser/resources/local_ntp/local_ntp.css (right): https://chromiumcodereview.appspot.com/412073002/diff/80001/chrome/browser/resources/local_ntp/local_ntp.css#newcode54 chrome/browser/resources/local_ntp/local_ntp.css:54: #fakebox { Do we now need an extra 10px ...
6 years, 4 months ago (2014-07-28 18:32:51 UTC) #17
huangs
Found and fixed bug where if you start from small window, on resize no new ...
6 years, 4 months ago (2014-07-29 19:43:46 UTC) #18
Mathieu
nits https://chromiumcodereview.appspot.com/412073002/diff/80001/chrome/browser/resources/local_ntp/local_ntp_util.js File chrome/browser/resources/local_ntp/local_ntp_util.js (right): https://chromiumcodereview.appspot.com/412073002/diff/80001/chrome/browser/resources/local_ntp/local_ntp_util.js#newcode12 chrome/browser/resources/local_ntp/local_ntp_util.js:12: * A counter with a callback that gets ...
6 years, 4 months ago (2014-07-29 21:36:08 UTC) #19
huangs
Oops forgot to mail out. Ping jered@ for more feedback. https://chromiumcodereview.appspot.com/412073002/diff/100001/chrome/browser/resources/local_ntp/local_ntp.js File chrome/browser/resources/local_ntp/local_ntp.js (right): https://chromiumcodereview.appspot.com/412073002/diff/100001/chrome/browser/resources/local_ntp/local_ntp.js#newcode481 ...
6 years, 4 months ago (2014-07-30 17:30:39 UTC) #20
Jered
https://codereview.chromium.org/412073002/diff/120001/chrome/browser/resources/local_ntp/local_ntp.js File chrome/browser/resources/local_ntp/local_ntp.js (right): https://codereview.chromium.org/412073002/diff/120001/chrome/browser/resources/local_ntp/local_ntp.js#newcode487 chrome/browser/resources/local_ntp/local_ntp.js:487: tilesContainer.style.visibility = 'visible'; You should also reset the barrier ...
6 years, 4 months ago (2014-07-30 17:52:15 UTC) #21
huangs
I realized that if there are 3 or 2 columns, then on load the tiles ...
6 years, 4 months ago (2014-07-30 21:14:47 UTC) #22
huangs
Ping jered@ re. recent changes. Thanks!
6 years, 4 months ago (2014-07-31 19:04:54 UTC) #23
Jered
lgtm I didn't try this change out. I assume you've tested it pretty thoroughly, manually, ...
6 years, 4 months ago (2014-08-01 15:07:16 UTC) #24
huangs
Thanks! Committing. https://chromiumcodereview.appspot.com/412073002/diff/130001/chrome/browser/resources/local_ntp/local_ntp.js File chrome/browser/resources/local_ntp/local_ntp.js (right): https://chromiumcodereview.appspot.com/412073002/diff/130001/chrome/browser/resources/local_ntp/local_ntp.js#newcode523 chrome/browser/resources/local_ntp/local_ntp.js:523: // invisible then we leave it in ...
6 years, 4 months ago (2014-08-01 15:42:16 UTC) #25
huangs
The CQ bit was checked by huangs@chromium.org
6 years, 4 months ago (2014-08-01 15:43:17 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/huangs@chromium.org/412073002/150001
6 years, 4 months ago (2014-08-01 15:45:10 UTC) #27
huangs
The CQ bit was unchecked by huangs@chromium.org
6 years, 4 months ago (2014-08-01 15:47:42 UTC) #28
huangs
Ping jhawkins@ for OWNER review of: chrome\browser\browser_resources.grd
6 years, 4 months ago (2014-08-01 15:48:08 UTC) #29
James Hawkins
lgtm
6 years, 4 months ago (2014-08-01 16:03:33 UTC) #30
Mathieu
The CQ bit was checked by mathp@chromium.org
6 years, 4 months ago (2014-08-01 16:04:34 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/huangs@chromium.org/412073002/150001
6 years, 4 months ago (2014-08-01 16:06:19 UTC) #32
commit-bot: I haz the power
6 years, 4 months ago (2014-08-01 23:47:01 UTC) #33
Message was sent while issue was closed.
Change committed as 287120

Powered by Google App Engine
This is Rietveld 408576698