Closed Bug 869411 Opened 11 years ago Closed 11 years ago

About:home is cut off beneath title bar

Categories

(Firefox for Android Graveyard :: General, defect, P1)

ARM
Android
defect

Tracking

(firefox23 verified, firefox24 verified, fennec23+)

VERIFIED FIXED
Firefox 24
Tracking Status
firefox23 --- verified
firefox24 --- verified
fennec 23+ ---

People

(Reporter: ibarlow, Assigned: bnicholson)

References

Details

(Whiteboard: [testday-20130726])

Attachments

(4 files, 1 obsolete file)

Now that we have a scrolling header, I frequently run into an issue where about:home gets cut off at the top, and there is no way to pull the page further down to reveal the top.

Presumably it's because we fix the title bar in place and about:home doesn't know to start lower down, but one way or another we should fix it.
This is a regression, if you could add STR if it isn't just self-evident, that'd be good  :)
Flags: needinfo?(ibarlow)
Priority: -- → P1
The only way I seem to be able to reproduce it is similar to bug 869413, where I come in by clicking a link in another app, after the browser has been left unused for a while. Maybe it has something to do with us being killed in the background? Sorry, I know that's pretty vague still
Flags: needinfo?(ibarlow)
I've seen this many times, and it looks like a regression from bug 838793.

STR:
1) Open Fennec and see about:home
2) Open another tab, go to http://www.google.com
3) Minimize Fennec and cause it to be killed in the background
4) Reopen Fennec
5) Switch to about:home tab

This bug is probably only worth tracking for releases that have dynamic toolbar pref'd on by default (23+?).
I don't think we need to dynamically inflate the browser toolbar; we should be able to include it in gecko_app.xml (which, despite its name, is only used in BrowserApp).
Assignee: nobody → bnicholson
Status: NEW → ASSIGNED
Attachment #750167 - Flags: review?(sriram)
Comment on attachment 750167 [details] [diff] [review]
Part 1: Move toolbar to gecko_app layout

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

Looks good to me.
Attachment #750167 - Flags: review?(sriram) → review+
As you mentioned in bug 838793, the extra padding parameters are overkill in AboutHome. This removes them.
Attachment #750169 - Flags: review?(lucasr.at.mozilla)
Bear with me here, because the way I got to this patch is a bit complicated...

First, I noticed that refreshToolbarHeight() uses getUserVisibleHint() to determine whether to set the padding for about:home, but we call refreshToolbarHeight() before we set the hint to true. Simply moving refreshToolbarHeight() after setUserVisibleHint(true) fixes this bug -- mostly. I say mostly because there's still a brief period at startup where about:home is cut off. This happens for a couple of reasons:

1) Since AboutHome is a fragment, it is immediately reattached when BrowserApp is created, and the padding isn't adjusted until after it's shown.

2) We call refreshToolbarHeight() at least once before a layout pass has happened. refreshToolbarHeight() gets the height from mBrowserToolbar's height, but the height is 0 since the toolbar isn't yet attached to the window.

#1 can be addressed by saving the padding in the fragment state (which I do in the next patch). #2 is what this patch tries to fix.

Rather than setting about:home padding every time we refresh the toolbar height, I moved the setTopPadding() call into setDynamicToolbarEnabled(). This sets the padding only when BrowserApp is created or when the dynamic toolbar pref changes. To prevent this method from being called before a layout pass, I posted the call to setDynamicToolbarEnabled() to the View's queue. postToUiThread()/runOnUiThread() don't use the same Handler as View (a new Handler is created when the view is attached to the window [1]), so merely running this on the UI thread means it could happen before a layout pass. View#post() can be called off of the UI thread only when the view is attached to the window, so View#post() is also insufficient on its own. It does work if View#post() is nested inside of runOnUiThread(), which is what I ended up doing, but I don't like that part of the patch. If you know of a better way to do this, I'll happily change it.

Note that since refreshToolbarHeight() no longer calls getUserVisibleHint(), the initial change I mentioned about moving refreshToolbarHeight() after setUserVisibleHint(true) no longer applies.

[1] http://androidxref.com/4.1.1/xref/frameworks/base/tools/layoutlib/bridge/src/android/view/AttachInfo_Accessor.java#32
Attachment #750206 - Flags: review?(chrislord.net)
Attachment #750206 - Flags: feedback?(lucasr.at.mozilla)
Attachment #750206 - Attachment description: Part 3: Save top padding state in AboutHome → Part 3: Set AboutHome padding in setDynamicToolbarEnabled() instead of refreshToolbarHeight()
Saves the padding as part of the fragment state, as mentioned above.
Attachment #750208 - Flags: review?(lucasr.at.mozilla)
I think this is a better way to fix the misalignment at startup issue. Instead of worrying about a race between setDynamicToolbarHeight() and the layout pass, we can remember whether the dynamic toolbar was enabled before the activity is destroyed. Unless the pref changes, setDynamicToolbarEnabled() will now be called only once for the entire duration of Fennec's lifetime, including OOM kills. The reason is that we have a check for "value == mDynamicToolbarEnabled" in the pref observer, and since we're initializing mDynamicToolbarEnabled to its previous state, we won't call setDynamicToolbarEnabled (meaning we won't end up calling mAboutHome.setTopPadding() with a height of 0).
Attachment #750206 - Attachment is obsolete: true
Attachment #750206 - Flags: review?(chrislord.net)
Attachment #750206 - Flags: feedback?(lucasr.at.mozilla)
Attachment #750918 - Flags: review?(chrislord.net)
Attachment #750918 - Flags: feedback?(lucasr.at.mozilla)
tracking-fennec: --- → ?
OS: Mac OS X → Android
Hardware: x86 → ARM
Comment on attachment 750169 [details] [diff] [review]
Part 2: Replace getPadding() with getTopPadding() in AboutHome

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

::: mobile/android/base/widget/AboutHome.java
@@ +40,1 @@
>      private int mPaddingTop;

nit: Rename to mTopPadding for consistency?
Attachment #750169 - Flags: review?(lucasr.at.mozilla) → review+
Comment on attachment 750208 [details] [diff] [review]
Part 4: Save top padding state in AboutHome

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

Looks good.

::: mobile/android/base/widget/AboutHome.java
@@ +43,3 @@
>      private LastTabsSection mLastTabsSection;
>      private RemoteTabsSection mRemoteTabsSection;
>      private TopSitesView mTopSitesView;

nit: add empty line here.

@@ +62,3 @@
>          super.onCreate(savedInstanceState);
>  
>          mLightweightTheme = ((GeckoApplication) getActivity().getApplication()).getLightweightTheme();

nit: add empty line here.

@@ +62,5 @@
>          super.onCreate(savedInstanceState);
>  
>          mLightweightTheme = ((GeckoApplication) getActivity().getApplication()).getLightweightTheme();
> +        if (savedInstanceState != null) {
> +            mPaddingTop = savedInstanceState.getInt(STATE_TOP_PADDING);

I'd use getInt(STATE_TOP_PADDING, 0) just to be more explicit about the intended default value here.
Attachment #750208 - Flags: review?(lucasr.at.mozilla) → review+
Comment on attachment 750918 [details] [diff] [review]
Part 3: Set AboutHome padding in setDynamicToolbarEnabled() instead of refreshToolbarHeight(), v2

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

LGTM. Sorry for taking so long, this got lost under piles of other bug mail :/
Attachment #750918 - Flags: review?(chrislord.net) → review+
tracking-fennec: ? → 23+
Attachment #750918 - Flags: feedback?(lucasr.at.mozilla)
Oops, somehow missed a couple of mPaddingTop->mTopPadding renames. Landed follow-up:

https://hg.mozilla.org/integration/mozilla-inbound/rev/8ad1d3d468d2
Comment on attachment 750167 [details] [diff] [review]
Part 1: Move toolbar to gecko_app layout

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 838793
User impact if declined: top of about:home will be cut off after an OOM restore
Testing completed (on m-c, etc.): m-c
Risk to taking this patch (and alternatives if risky): low risk
String or IDL/UUID changes made by this patch: none
Attachment #750167 - Flags: approval-mozilla-aurora?
Attachment #750169 - Flags: approval-mozilla-aurora?
Attachment #750208 - Flags: approval-mozilla-aurora?
Attachment #750918 - Flags: approval-mozilla-aurora?
Attachment #750167 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #750169 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #750208 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #750918 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Depends on: 878491
I swear that these patches were working for me when I was testing this before, but I still see this issue on 23/24. Filed bug 878491.
I can verify this is fixed in a Galaxy S2 phone with Android 4.0.3 and the latest Firefox Beta.
Whiteboard: [testday-20130726]
Status: RESOLVED → VERIFIED
I am unable to reproduce the issue on Firefox Mobile 23 RC and Aurora 24.0a1 2013-07-31 on the Samsung Galaxy R (Android 2.3.4)
Depends on: 913890
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: