Closed Bug 793515 Opened 12 years ago Closed 11 years ago

Search results page displays a single line of tiles

Categories

(Firefox for Metro Graveyard :: Theme, defect)

x86_64
Windows 8.1
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jimm, Assigned: sfoster)

References

Details

(Whiteboard: [metro-it1] )

Attachments

(1 file, 2 obsolete files)

STR:

1) type a letter in the address bar

You get "Your Results" as a single line across the top of the results ui. Also this view can't be scrolled.
Attached patch fix (obsolete) — Splinter Review
rolling into bug 792901
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
Whiteboard: completed-elm
Attachment #664000 - Attachment is obsolete: true
Reopening. There were two bugs that could cause this, one will be fixed in bug 792901. 

The second bug involves initial display of autocomplete - there seems to be a layout bug with the smart grid such that on initial display of the autocomplete popup dimensional data for the top grid item is bogus. This is used in arrangeItems to calculate the layout of the grid.

STR:

1) type a letter in the address bar
result: you'll get a busted layout
2) type another letter while the autocomplete popup is still displayed
result: arrangeItems successfully sets the correct layout
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Component: General → Theme
Product: Firefox → Firefox for Metro
Blocks: 747790
No longer blocks: 747789
Assignee: jmathies → sfoster
Whiteboard: [metro-it1]
There is a simmilar issue going on in (true) fullscreen/metro where the bookmarks are all strung up on a single row. I assume this is related if not a manifestation of the same bug
When an item has not been previously rendered it shows up in arrangeItems with height of 10px. This change schedules arrangeItems to be called again later. 

If for some reason the item never gets height > 10 as it stands we would loop forever. I'm open to ideas on whether to either bail after n tries or n seconds, or other ways to improve how this is handled. 

Also the threshold of 10 is brittle - I suspect changes to the item css might break this. Is there a better way to know if the item's box is rendered and ready for measurement

A nice side effect of this change is that the repeated calls to arrangeItems are aborted until the first item has height. Its not true batching but helps in some cases.
Attachment #682445 - Flags: review?(mbrubeck)
Attachment #682445 - Flags: review?(mark.finkle)
Comment on attachment 682445 [details] [diff] [review]
Change to richgrid's arrangeItems to delay arrangment until the first item has height

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

::: browser/metro/base/content/bindings/grid.xml
@@ +232,5 @@
> +            // delay as necessary until the item has a proper height
> +            if(gridItemRect.height <= itemHeightThreshold) { 
> +              // TODO: track # calls to ensure we don't loop endlessly?
> +              if(!this._scheduledArrangeItemsTimerId)
> +                this._scheduledArrangeItemsTimerId = setTimeout(this.arrangeItems.bind(this), 1);

If setTimeout(...,0) works, I'd prefer that to setTimeout(...,1).

Nit: Add a space after each "if" keyword, and remove trailing spaces.

I'm a bit worried about this solution in general.  It would be better if we could listen for some event or callback to tell us when the item heights were available, so we could retry exactly once.  Or maybe we can do something that forces a reflow like accessing item.offsetHeight?

r- for now until we've looked for some alternatives.
Attachment #682445 - Flags: review?(mbrubeck) → review-
Agreed, the setTimeout is always a pretty cruddy solution. I resorted to it only because I saw the same used elsewhere. Does the event you describe exist though? I don't think anything needs to block on arrangeItems, so scheduling to retry later should work - vs. needing to force the reflow by accessing offsetHeight. 

I can rework this patch to at least tuck away the nastiness so we are speaking in terms of events/callbacks? As to what fires that event/callback I'm all ears and will fall back o polling for > 10 height in the interim
I'm open to using setTimeout if there's not a better pre-existing event (and no, I can't think of one off the top of my head).  If we do stick with this approach, no need to hide the timeout behind an event.  My main worry is that we'll end up with an infinite timeout loop if something goes wrong, so maybe the retry limit mentioned in you comment is a good idea...

Anyway, feel free to re-request review on the current patch if you think it's the right solution for now (or upload a new version with nits addressed).  In the long term I think we might end up rewriting a lot of this code anyway, as we find ways to simplify it.  Perhaps I am over-optimistic. :)
Comment on attachment 682445 [details] [diff] [review]
Change to richgrid's arrangeItems to delay arrangment until the first item has height

Matt's got this one
Attachment #682445 - Flags: review?(mark.finkle)
Comment on attachment 683064 [details] [diff] [review]
Revised patch with max-tries to avoid infinite re-tries of arrangeItems

I've reworked the arrangeItems patch a little to avoid endlessly re-scheduling if for some reason the item height never meets the condition.  Also fixed the style issues and moved a couple of the temporary/state variables into widget fields (which I /think/ is the right thing to do in this case?)
Attachment #682445 - Attachment is obsolete: true
Comment on attachment 683064 [details] [diff] [review]
Revised patch with max-tries to avoid infinite re-tries of arrangeItems

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

::: browser/metro/base/content/bindings/grid.xml
@@ +231,5 @@
>                return;
>              let gridItemRect = item.getBoundingClientRect();
> +
> +            // cap the number of times we reschedule calling arrangeItems
> +            let maxRetries = 5;

Nit: Let's make this "const maxRetries."  (I can fix this before checking in the patch.)
Attachment #683064 - Flags: review?(mbrubeck) → review+
Status: REOPENED → RESOLVED
Closed: 12 years ago11 years ago
Resolution: --- → FIXED
OS: Windows 8 Metro → Windows 8.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: