Closed
Bug 976616
Opened 11 years ago
Closed 9 years ago
Support dynamic viewport changes (changing meta viewport tag from JavaScript)
Categories
(Firefox for Android Graveyard :: Toolbar, defect)
Tracking
(firefox43 fixed)
RESOLVED
FIXED
Firefox 43
Tracking | Status | |
---|---|---|
firefox43 | --- | fixed |
People
(Reporter: miketaylr, Assigned: miketaylr, Mentored)
References
()
Details
(Keywords: dev-doc-complete, Whiteboard: [lang=js][bad first bug])
Attachments
(4 files, 7 obsolete files)
1.30 KB,
patch
|
miketaylr
:
review+
|
Details | Diff | Splinter Review |
4.30 KB,
patch
|
miketaylr
:
review+
|
Details | Diff | Splinter Review |
2.63 KB,
patch
|
miketaylr
:
review+
|
Details | Diff | Splinter Review |
5.85 KB,
patch
|
miketaylr
:
review+
|
Details | Diff | Splinter Review |
Certain mobile sites on the web assume that you can dynamically change meta viewport content (and have it actually do something).
Currently we don't support this, but only allow changing the viewport if you append a new meta element with a different value.
See https://miketaylr.com/bzla/viewport-change.html for a test case.
Expected: Clicking all 4 buttons changes the viewport
Actual: Only the append buttons work
Comment 1•11 years ago
|
||
Thanks for filing this, Mike!
Copying over my comment from bug 784463:
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #15)
> I thought we did support that but looking at our code it seems we only
> listen for new meta elements being added, not removal of meta elements or
> modifications of existing meta elements. The code around [1] probably needs
> to be updated to listen for more events.
>
> [1]
> http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/
> browser.js?rev=267e352db60c#5803
I can mentor this bug if there's anybody interested in fixing it.
OS: Mac OS X → Android
Hardware: x86 → All
Whiteboard: [mentor=kats][lang=js][bad first bug]
Updated•10 years ago
|
Mentor: bugmail.mozilla
Whiteboard: [mentor=kats][lang=js][bad first bug] → [lang=js][bad first bug]
Comment 3•10 years ago
|
||
Updating title to make it easier to find.
Summary: Support dynamic viewport changes → Support dynamic viewport changes (changing meta viewport tag from JavaScript)
Assignee | ||
Comment 4•10 years ago
|
||
Unsure if this should be duped against bug 617331 or bug 714737 or what. I just stumbled upon those.
Comment 7•10 years ago
|
||
I duped them here since this bug had more info and is mentored. Note however that Matt provides a workaround at https://bugzilla.mozilla.org/show_bug.cgi?id=714737#c3
Updated•10 years ago
|
Keywords: dev-doc-needed
Just want to state the obvious. Button 3 and 4 of Mike's test page will also work even if the 'older' meta tag is removed before or after the append action.
Updated•9 years ago
|
See Also: → https://webcompat.com/issues/1140
Assignee | ||
Comment 9•9 years ago
|
||
I've got some local patches that have this working, will try to write some tests and post 'em in the next few days.
Assignee: nobody → miket
Comment 10•9 years ago
|
||
Thanks! If you have patches I'd love to see them. In bug 1180267 I'm in the process of ripping out some of the code that you might have touched depending on your implementation.
Assignee | ||
Comment 11•9 years ago
|
||
Here you go -- nothing fancy, just connecting the dots between HTMLMetaElement::AfterSetAttr and nsContentUtils::ProcessViewportInfo, and then adding a fallthrough for DOMMetaChanged into the DOMMetaAdded condition of ViewPortHandler.handleEvent.
Looking at your patches in 1180267 it seems like there shouldn't be any conflicts.
Attachment #8651519 -
Flags: feedback?(bugmail.mozilla)
Comment 12•9 years ago
|
||
Comment on attachment 8651519 [details] [diff] [review]
976616.-Support-dynamic-viewport-changes.-WIP.patch
Review of attachment 8651519 [details] [diff] [review]:
-----------------------------------------------------------------
Cool, thanks! So the only changes that you'll need are to also listen for the DOMMetaChanged event in layout/base/MobileViewportManager. With my patches applied the viewport computation is no longer done in browser.js but is instead done in MobileViewportManager, same as for all our other platforms. You'll still need the DOMMetaChanged in browser.js because the zoom constraints calculation is still (for now) done there.
Attachment #8651519 -
Flags: feedback?(bugmail.mozilla) → feedback+
Assignee | ||
Comment 13•9 years ago
|
||
bholley, do you mind reviewing the changes to HTMLMetaElement?
Attachment #8651519 -
Attachment is obsolete: true
Attachment #8651989 -
Flags: review?(bobbyholley)
Assignee | ||
Comment 14•9 years ago
|
||
Attachment #8651990 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 15•9 years ago
|
||
Attachment #8651991 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 16•9 years ago
|
||
Attachment #8651992 -
Flags: review?(bugmail.mozilla)
Updated•9 years ago
|
Attachment #8651990 -
Flags: review?(bugmail.mozilla) → review+
Comment 17•9 years ago
|
||
Comment on attachment 8651991 [details] [diff] [review]
976616.-Part-3-Enable-meta-viewport-tests-for-Fe.patch
Review of attachment 8651991 [details] [diff] [review]:
-----------------------------------------------------------------
I don't think this does the right thing. For fennec, for example, toolkit==android but buildapp!=b2g, so the skip-if condition will be true, and the test will be skipped. In fact I think this will skip it in more places than it was skipped before.
Attachment #8651991 -
Flags: review?(bugmail.mozilla) → review-
Comment 18•9 years ago
|
||
I'm confused - why do we have a viewport attribute on media elements at all?
The answer could very well be "no good reason but we need this for webcompat", but I'd like to understand what motivated us to do this in the first place.
Comment 19•9 years ago
|
||
Oh sorry, I read HTMLMediaElement instead of HTMLMetaElement. Don't mind me!
Assignee | ||
Comment 20•9 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #17)
> Comment on attachment 8651991 [details] [diff] [review]
> 976616.-Part-3-Enable-meta-viewport-tests-for-Fe.patch
>
> Review of attachment 8651991 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> I don't think this does the right thing. For fennec, for example,
> toolkit==android but buildapp!=b2g, so the skip-if condition will be true,
> and the test will be skipped. In fact I think this will skip it in more
> places than it was skipped before.
Ah, right. Let me take a closer look at mochitest conditional logic-fu.
Updated•9 years ago
|
Attachment #8651989 -
Flags: review?(bobbyholley) → review+
Assignee | ||
Comment 21•9 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #19)
> Oh sorry, I read HTMLMediaElement instead of HTMLMetaElement. Don't mind me!
:)~
Comment 22•9 years ago
|
||
Comment on attachment 8651992 [details] [diff] [review]
976616.-Part-4-Add-test-for-dynamic-meta-viewpor.patch
Review of attachment 8651992 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, thanks!
::: dom/base/test/test_meta_viewport7.html
@@ +101,5 @@
> + meta.content = content;
> + }
> +
> + function nextTest() {
> + if (tests.length)
braces please (i realize this is copy-paste, but we can update the style a bit :))
Attachment #8651992 -
Flags: review?(bugmail.mozilla) → review+
Assignee | ||
Comment 23•9 years ago
|
||
Adding r=bholley to commit message and carrying forward r+.
Attachment #8651989 -
Attachment is obsolete: true
Attachment #8652031 -
Flags: review+
Assignee | ||
Comment 24•9 years ago
|
||
Adding r=kats to commit msg and carrying forward r+.
Attachment #8651990 -
Attachment is obsolete: true
Attachment #8652032 -
Flags: review+
Assignee | ||
Comment 25•9 years ago
|
||
It looks like other places are using os for b2g and android, so let's try this again w/:
> skip-if = (os != 'b2g' && os != 'android')
Attachment #8651991 -
Attachment is obsolete: true
Attachment #8652035 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 26•9 years ago
|
||
Adding r=kats to commit msg, and carrying forward r+. Also added some (much-needed) braces to nextTest.
Attachment #8651992 -
Attachment is obsolete: true
Attachment #8652036 -
Flags: review+
Comment 27•9 years ago
|
||
Comment on attachment 8652035 [details] [diff] [review]
976616.-Part-3-Enable-meta-viewport-tests-for-Fe.patch
Review of attachment 8652035 [details] [diff] [review]:
-----------------------------------------------------------------
This looks good, thanks.
::: dom/base/test/mochitest.ini
@@ +754,4 @@
> [test_meta_viewport6.html]
> +skip-if = (os != 'b2g' && os != 'android') # meta-viewport tag support is mobile-only
> +[test_meta_viewport7.html]
> +skip-if = buildapp != 'b2g' || toolkit != 'android' # meta-viewport tag support is mobile-only
Technically this test_meta_viewport7.html shouldn't be in this patch, since the test is only added in part 4. Drop these two lines and rebase part 4 accordingly.
Attachment #8652035 -
Flags: review?(bugmail.mozilla) → review+
Assignee | ||
Comment 28•9 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #27)
> Technically this test_meta_viewport7.html shouldn't be in this patch, since
> the test is only added in part 4. Drop these two lines and rebase part 4
> accordingly.
Yeah, that's a mistake from me trying to rebase last night -- will fix (and thanks for catching that).
Thanks for the reviews Kats and Bobby!
Assignee | ||
Comment 29•9 years ago
|
||
Adding r=kats to commit message, carrying forward r+ (and fixing the rebase mistake in this patch).
Attachment #8652035 -
Attachment is obsolete: true
Attachment #8652320 -
Flags: review+
Assignee | ||
Comment 30•9 years ago
|
||
Fixing the rebase mistake in this patch.
Attachment #8652036 -
Attachment is obsolete: true
Attachment #8652321 -
Flags: review+
Assignee | ||
Comment 31•9 years ago
|
||
Assignee | ||
Comment 32•9 years ago
|
||
OK, try looks good. Two unrelated failures on OSX, AFAICT.
Keywords: checkin-needed
Comment 33•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/5ab594873952
https://hg.mozilla.org/integration/mozilla-inbound/rev/84b869138792
https://hg.mozilla.org/integration/mozilla-inbound/rev/0bc0d5200098
https://hg.mozilla.org/integration/mozilla-inbound/rev/8ca999c539d7
Keywords: checkin-needed
Comment 34•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/5ab594873952
https://hg.mozilla.org/mozilla-central/rev/84b869138792
https://hg.mozilla.org/mozilla-central/rev/0bc0d5200098
https://hg.mozilla.org/mozilla-central/rev/8ca999c539d7
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox43:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Comment 35•9 years ago
|
||
I added a note about this in https://developer.mozilla.org/en-US/Firefox/Releases/43#HTML
Keywords: dev-doc-needed → dev-doc-complete
Assignee | ||
Comment 36•9 years ago
|
||
Thanks Jean-Yves!
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•