Closed Bug 1147157 Opened 9 years ago Closed 9 years ago

position:fixed elements break layout on orientation change

Categories

(Firefox for iOS :: General, defect)

ARM
iOS 8
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
fennec + ---

People

(Reporter: agibson, Assigned: sleroux)

References

()

Details

(Keywords: reproducible)

Attachments

(3 files)

47 bytes, text/x-github-pull-request
bnicholson
: review+
st3fan
: review+
Details | Review
47 bytes, text/x-github-pull-request
Details | Review
47 bytes, text/x-github-pull-request
Details | Review
STR:

1.) Visit http://bradfrost.com/demo/fixed/index.html in Firefox for iPhone (portrait orientation)
2.) Observe the demo page uses a simple position:fixed header & footer.
3.) Rotate the device to landscape.

Expected results:

The fixed header/footer should resize to the width of the viewport on rotation.

Actual results:

The header/footer do not resize.

Note the layout breaks further if you rotate back to portrait again.

This does not happen in Safari for iOS.
Reproducible. The demo seems to adjust correctly as soon as a scroll happens.
tracking-fennec: --- → ?
Keywords: reproducible
We need to experiment with this more to see what we can do. We'll track for now, and re-evaluate later.
tracking-fennec: ? → +
Blocks: 1133563
Assignee: nobody → sleroux
Attached file PR
(Copied from Github)

So this is kind of a gross hack but it works. It looks like there's an issue with WKWebView where it doesn't invalidate it's drawing area on orientation change. However, it does invalidate it whenever the content area is scrolled (see https://github.com/WebKit/webkit/blob/master/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm#L1430). I added a small method as an extension to WKWebView that will nudge the content area by a single pixel which forces the content area to invalidate and added this to the traitCollectionChange callback in BrowserViewController.
Attachment #8603549 - Flags: review?(sarentz)
Attachment #8603549 - Flags: review?(bnicholson)
Comment on attachment 8603549 [details] [review]
PR

Looks good! Left a few more questions/comments in the PR.
Attachment #8603549 - Flags: review?(bnicholson) → review+
Comment on attachment 8603549 [details] [review]
PR

Great! Do you have permissions on Github to merge this?
Attachment #8603549 - Flags: review?(sarentz) → review+
Yup I do. I'll go ahead and merge it
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Attached file PR
Added a hotfix that solved a bug which was caused by these changes where the toolbar was not being positioned correctly after enter the tab tray, then the browser view controller, then rotating the de
Attached file PR
Bit quick on merging the last patch. This patch includes fixes from wes's comment.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: