Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 5196306347720704: Issue 1965 - Simplified and fixed missing image for icon animation (Closed)

Created:
Feb. 27, 2014, 4:54 p.m. by Sebastian Noack
Modified:
Feb. 13, 2015, 4:12 p.m.
CC:
kzar
Visibility:
Public.

Description

I realized that the filename for the whitelisted icon overlayed with a notification icon at full opacity was generated wrong. While fixing this, I re-considered the approach for generating the animated icon's filename. It worked by recording the filename for the icon of every tab and patching the corresponding suffix into the filename with the power of regex. If this approach wouldn't be already worse enough, fixing the issue would involve stripping "-whitelisted" out of the filename with another regex. So I moved the code generating the icon's filename in a separate function, that can be reused.

Patch Set 1 #

Patch Set 2 : #

Total comments: 16

Patch Set 3 : Rabased and addressed comments #

Patch Set 4 : #

Patch Set 5 : Rabased and refactored code #

Total comments: 5

Patch Set 6 : Rebased and addressed comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+106 lines, -91 lines) Patch
M background.js View 1 2 3 4 3 chunks +9 lines, -15 lines 0 comments Download
M lib/icon.js View 1 2 3 4 5 1 chunk +96 lines, -75 lines 0 comments Download
M metadata.common View 1 2 3 4 2 chunks +1 line, -1 line 0 comments Download

Messages

Total messages: 18
Sebastian Noack
Feb. 27, 2014, 5:04 p.m. (2014-02-27 17:04:50 UTC) #1
Felix Dahlke
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode117 background.js:117: if (whitelisted && (!animation || animation.step < 10)) So ...
Feb. 27, 2014, 10:02 p.m. (2014-02-27 22:02:04 UTC) #2
Sebastian Noack
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode117 background.js:117: if (whitelisted && (!animation || animation.step < 10)) On ...
Feb. 28, 2014, 8:35 a.m. (2014-02-28 08:35:16 UTC) #3
Wladimir Palant
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode128 background.js:128: icon += animation.severity; Nit: why split this to two ...
March 6, 2014, 2:31 p.m. (2014-03-06 14:31:35 UTC) #4
Wladimir Palant
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode147 background.js:147: // But don't interfere the icon animation if active. ...
March 6, 2014, 2:34 p.m. (2014-03-06 14:34:33 UTC) #5
Sebastian Noack
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode128 background.js:128: icon += animation.severity; On 2014/03/06 14:31:35, Wladimir Palant wrote: ...
March 6, 2014, 8:41 p.m. (2014-03-06 20:41:12 UTC) #6
Wladimir Palant
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode147 background.js:147: // But don't interfere the icon animation if active. ...
March 6, 2014, 8:49 p.m. (2014-03-06 20:49:44 UTC) #7
Sebastian Noack
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode147 background.js:147: // But don't interfere the icon animation if active. ...
March 7, 2014, 5:26 p.m. (2014-03-07 17:26:11 UTC) #8
Wladimir Palant
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode147 background.js:147: // But don't interfere the icon animation if active. ...
March 7, 2014, 10:13 p.m. (2014-03-07 22:13:28 UTC) #9
Sebastian Noack
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode147 background.js:147: // But don't interfere the icon animation if active. ...
March 8, 2014, 11:36 a.m. (2014-03-08 11:36:39 UTC) #10
Wladimir Palant
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode147 background.js:147: // But don't interfere the icon animation if active. ...
March 21, 2014, 2:10 p.m. (2014-03-21 14:10:11 UTC) #11
Sebastian Noack
http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js File background.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5156048109305856/background.js#newcode147 background.js:147: // But don't interfere the icon animation if active. ...
March 31, 2014, 1:20 p.m. (2014-03-31 13:20:32 UTC) #12
Felix Dahlke
Is this still something we want to merge? Considering the last patch set is almost ...
Feb. 5, 2015, 3:51 a.m. (2015-02-05 03:51:38 UTC) #13
Sebastian Noack
Feb. 6, 2015, 2:03 p.m. (2015-02-06 14:03:03 UTC) #14
Sebastian Noack
On 2015/02/05 03:51:38, Felix H. Dahlke wrote: > Is this still something we want to ...
Feb. 6, 2015, 2:06 p.m. (2015-02-06 14:06:40 UTC) #15
Felix Dahlke
http://codereview.adblockplus.org/5196306347720704/diff/5753952654065664/lib/icon.js File lib/icon.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5753952654065664/lib/icon.js#newcode62 lib/icon.js:62: if (animationStep < 10) We're checking for `animationStep < ...
Feb. 12, 2015, 4:52 a.m. (2015-02-12 04:52:56 UTC) #16
Sebastian Noack
http://codereview.adblockplus.org/5196306347720704/diff/5753952654065664/lib/icon.js File lib/icon.js (right): http://codereview.adblockplus.org/5196306347720704/diff/5753952654065664/lib/icon.js#newcode62 lib/icon.js:62: if (animationStep < 10) On 2015/02/12 04:52:56, Felix H. ...
Feb. 12, 2015, 11:15 a.m. (2015-02-12 11:15:28 UTC) #17
Felix Dahlke
Feb. 12, 2015, 2:14 p.m. (2015-02-12 14:14:30 UTC) #18
LGTM

http://codereview.adblockplus.org/5196306347720704/diff/5753952654065664/lib/...
File lib/icon.js (right):

http://codereview.adblockplus.org/5196306347720704/diff/5753952654065664/lib/...
lib/icon.js:116: function stopIconAnimation()
On 2015/02/12 11:15:29, Sebastian Noack wrote:
> On 2015/02/12 04:52:56, Felix H. Dahlke wrote:
> > Now that I'm giving this code a good read - don't we have to reset the icon
> for
> > all tabs (active or inactive) when we call this?
> 
> To keep things simple we let the current transition finish, when the icon
> animation is stopped. Otherwise we would need to consider all internal
timeouts
> and intervals used by the animation, clearing them. Moreover, it looks more
> smooth when the current transition finishes instead resetting the icon
> immediately.
> 
> > How I see it: If a tab becomes inactive during the animation, it's going to
> get
> > stuck with some intermediate frame. background.js will only update the icon
> when
> > a new URL is loaded, not when the tab is made active again.
> 
> We check for active tabs everytime we start to transition the icon to the
> notification icon and back. That means if a tab becomes inactive while the
> transition runs, we just keep running the transition for it. So it doesn't get
> stuck.
> 

You're right, I somehow thought we'd abort the transition. The behaviour does
make most sense the way it's implemented.

Powered by Google App Engine
This is Rietveld