Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Windows are restored with the correct z-index #10580

Merged
merged 1 commit into from
Sep 22, 2017

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Aug 18, 2017

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Resolves #10473

Test Plan:
See #10473

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@NejcZdovc NejcZdovc added this to the 0.21.x (Nightly Channel) milestone Aug 18, 2017
@NejcZdovc NejcZdovc self-assigned this Aug 18, 2017
@NejcZdovc NejcZdovc modified the milestones: 0.20.x (Developer Channel), 0.21.x (Nightly Channel) Aug 18, 2017
@codecov-io
Copy link

codecov-io commented Aug 18, 2017

Codecov Report

Merging #10580 into master will decrease coverage by 0.01%.
The diff coverage is 7.69%.

@@            Coverage Diff             @@
##           master   #10580      +/-   ##
==========================================
- Coverage   54.66%   54.64%   -0.02%     
==========================================
  Files         249      249              
  Lines       21932    21943      +11     
  Branches     3429     3431       +2     
==========================================
+ Hits        11989    11991       +2     
- Misses       9943     9952       +9
Flag Coverage Δ
#unittest 54.64% <7.69%> (-0.02%) ⬇️
Impacted Files Coverage Δ
app/browser/windows.js 24.31% <ø> (+0.09%) ⬆️
js/actions/appActions.js 13.28% <ø> (ø) ⬆️
app/browser/reducers/windowsReducer.js 18% <0%> (-0.14%) ⬇️
js/stores/windowStore.js 29.31% <11.11%> (-0.15%) ⬇️

@NejcZdovc
Copy link
Contributor Author

this PR is blocked by #10458

@NejcZdovc NejcZdovc force-pushed the feature/#10473-zindex branch 5 times, most recently from d1b494c to 2eeb806 Compare August 29, 2017 15:08
@cezaraugusto
Copy link
Contributor

@NejcZdovc please confirm if this is ready for review and tag reviewers to check. thanks!

@NejcZdovc
Copy link
Contributor Author

@cezaraugusto it's ready for a review

@ghost ghost added the sprint/1 label Sep 13, 2017
@@ -1211,6 +1211,16 @@ const windowActions = {
},
windowValue
})
},

onWindowFocus: function (windowId, windowValue) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this to appAction?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -332,6 +333,7 @@ const windowsReducer = (state, action, immutableAction) => {
break
case appConstants.APP_WINDOW_CREATED:
state = windowState.maybeCreateWindow(state, action)
windowActions.onWindowFocus(action.getIn(['windowValue', 'windowId']), action.get('windowValue'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can assume that app window created means always focused. You could maybe check the window here and if focused do that if for some reason the focus event isn't firing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@bbondy bbondy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments

@cezaraugusto
Copy link
Contributor

I'm not sure about the test plan but I did the following:

  1. 3 tabs with a, b, c websites
  2. tear-off each tab in that order. Have 3 windows with a, b, c (current visible window)
  3. Shut down, open again
  4. Window with tab c should show

is that an accurate test plan?

@cezaraugusto
Copy link
Contributor

for the above windows opened in the reverse order so a, b, c instead of c, b, a. Not sure if that's the expected behavior.

@NejcZdovc NejcZdovc force-pushed the feature/#10473-zindex branch 2 times, most recently from adc23fd to f2a0ba9 Compare September 18, 2017 06:30
@NejcZdovc
Copy link
Contributor Author

@cezaraugusto yeah I didn't try this scenario, was using keyboard shortcuts only. Nice scenario. This use case should be fixed now. Can you please re-review?

@bbondy I rewrote this PR a little bit, so we don't need focus action anymore and detection rate is a lot better

@NejcZdovc
Copy link
Contributor Author

I will squash commits before merging

loadedPerWindowImmutableState.forEach((wndState) => {
appActions.newWindow(undefined, undefined, wndState)
})
loadedPerWindowImmutableState
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe as a follow up, it would be good to pull out the sorting into something which can easily be unit tested. Maybe a new method determineZindex or similar (maybe in app/commmon/state/windowState)

then the below would be like:

const sortedList = windowState.determineZindex(loadedPerWindowImmutableStore)
sortedList.forEach((wndState) => {
  appActions.newWindow(undefined, undefined, wndState)
})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++!

@@ -788,8 +790,17 @@ const doAction = (action) => {
break
}
case windowConstants.WINDOW_ON_WINDOW_UPDATE:
windowState = windowState.set('windowInfo', action.windowValue)
break
case appConstants.APP_WINDOW_READY:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you did a follow up, this would be fairly easy to add a unit test for too 😄 Basically checking that focusTime gets added to windowInfo

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes work great 😄 👍 I tested on macOS and Windows. Comments left about what could be better (if you wanted to do a follow up). Great job! 😄

@bsclifton
Copy link
Member

I'll hold off on merge if you wanted to squash / address feedback and maybe @bbondy can re-review 😄

Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm but needs rebase on windowStore.js

@NejcZdovc
Copy link
Contributor Author

@cezaraugusto rebased and squashed

@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

/* global performance */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just use window.performance and avoid this.

Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NejcZdovc pls revisit this later for follow-up feedbacks, given this is approved by all I'm merging, thanks

@cezaraugusto cezaraugusto merged commit 843d9b3 into brave:master Sep 22, 2017
cezaraugusto added a commit that referenced this pull request Sep 22, 2017
Windows are restored with the correct z-index
@cezaraugusto
Copy link
Contributor

cezaraugusto commented Sep 22, 2017

master 843d9b3
0.20.x 8e370de

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants