Closed Bug 918044 Opened 11 years ago Closed 11 years ago

TopSitesGridView calls layout infinite times

Categories

(Firefox for Android Graveyard :: Theme and Visual Design, defect)

ARM
Android
defect
Not set
normal

Tracking

(firefox26 fixed, firefox27 fixed, fennec26+)

RESOLVED FIXED
Firefox 27
Tracking Status
firefox26 --- fixed
firefox27 --- fixed
fennec 26+ ---

People

(Reporter: sriram, Assigned: sriram)

References

Details

Attachments

(1 file, 1 obsolete file)

During startup, the TopSitesGridView does a recursive layout call until the screen is touched.
tracking-fennec: --- → ?
This is happening even if the "fixed height" hack on the measure of TopSitesGridView is not used. So our onMeasure() isn't causing the problem.

I see an unfocus() event on the GridView triggering a layout pass. And the measure all have the same widthMeasureSpec (unlike two different ones between the two different measure passes). I've no more clues on what's happening at the startup that could cause this.
tracking-fennec: ? → 26+
I'll have a look at this.
Assignee: nobody → lucasr.at.mozilla
Smoothie is the panacea! This goes away with smoothie library!
Assignee: lucasr.at.mozilla → sriram
I/Sriram  (27332): focus: true
I/Sriram  (27332): request layout
I/Sriram  (27332): request layout
I/Sriram  (27332): focus: false
I/Sriram  (27332): request layout
I/Sriram  (27332): request layout
I/Sriram  (27332): focus: true

Oh well. What's happening with the focus?
I/Sriram  (28235): list focus: true
I/Sriram  (28235): request layout
I/Sriram  (28235): list focus: false
I/Sriram  (28235): focus: true
I/Sriram  (28235): focus: false
I/Sriram  (28235): request layout
I/Sriram  (28235): list focus: true
I/Sriram  (28235): request layout
I/Sriram  (28235): list focus: false
I/Sriram  (28235): focus: true
I/Sriram  (28235): request layout
I/Sriram  (28235): request layout
I/Sriram  (28235): focus: false
I/Sriram  (28235): request layout
I/Sriram  (28235): list focus: true

Oh well. The ListView is also having a problem!
Attached patch Patch (obsolete) — Splinter Review
That's the only permutation that fixes this issue! :(
Attachment #817455 - Flags: review?(lucasr.at.mozilla)
Comment on attachment 817455 [details] [diff] [review]
Patch

Review of attachment 817455 [details] [diff] [review]:
-----------------------------------------------------------------

We don't want to make the GridView unfocusable as this will break keyboard navigation. What we want actually need here is to avoid re-layouts while handling focus in the GridView. I tried a few options and I believe I found a good enough solution. Patch coming in a minute.
Attachment #817455 - Flags: review?(lucasr.at.mozilla) → review-
Comment on attachment 817756 [details] [diff] [review]
Block layout requests while handling focus changes in TopSitesGridView (r=sriram)

Given that we know that our GridView will never scroll or change selection on focus changes (which would usually be the case for an ordinary GridView), we can safely ignore layout requests while handling focus changes in it. The GridView remains focusable with this patch.

Seems to fix the bug in my local builds.
Attachment #817756 - Flags: review?(sriram)
Attachment #817455 - Attachment is obsolete: true
Comment on attachment 817756 [details] [diff] [review]
Block layout requests while handling focus changes in TopSitesGridView (r=sriram)

Review of attachment 817756 [details] [diff] [review]:
-----------------------------------------------------------------

This is a good idea.
Attachment #817756 - Flags: review?(sriram) → review+
https://hg.mozilla.org/mozilla-central/rev/0bc8a298c227
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 27
Comment on attachment 817756 [details] [diff] [review]
Block layout requests while handling focus changes in TopSitesGridView (r=sriram)

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 862793 (new about:home)
User impact if declined: Infinite layout loop on about:home after fennec starts. No apparent performance problem but it's definitely worth uplifting this, just in case. 
Testing completed (on m-c, etc.): Landed on m-c, no issues found.
Risk to taking this patch (and alternatives if risky): Very low, just avoids layout requests while handling focus changes in the about:home top sites grid.
String or IDL/UUID changes made by this patch: n/a
Attachment #817756 - Flags: approval-mozilla-aurora?
Attachment #817756 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: