Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for fullscreen #10102 #13489

Merged
merged 1 commit into from Dec 9, 2016
Merged

Add support for fullscreen #10102 #13489

merged 1 commit into from Dec 9, 2016

Conversation

@farodin91
Copy link
Contributor

farodin91 commented Sep 28, 2016

I'm start working on fullscreen support.
@jdm Should be the entry_point in ScriptReflow a Option if fullscreen is enabled or point on the entry_node? For example the RootNode.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #10102 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Sep 28, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/webidls/Document.webidl, components/script/dom/document.rs, components/script/dom/webidls/Element.webidl, components/script_layout_interface/message.rs, components/script/dom/element.rs
@highfive
Copy link

highfive commented Sep 28, 2016

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@jdm
Copy link
Member

jdm commented Sep 28, 2016

I suspect an Option makes the most sense; I expect we still want to reflow the rest of the page even if an element is fullscreen.

@emilio
Copy link
Member

emilio commented Sep 29, 2016

Do we plan to land this without implementing the per-platform bits? (Not a huge deal, just curious).

@paulrouget
Copy link
Contributor

paulrouget commented Sep 29, 2016

Is the plan to make the DOM element full window, and than send a message to the glutin window to go fullscreen?

@jdm
Copy link
Member

jdm commented Sep 29, 2016

Yep.

@farodin91
Copy link
Contributor Author

farodin91 commented Oct 2, 2016

@farodin91
Copy link
Contributor Author

farodin91 commented Oct 2, 2016

Thank you

@farodin91
Copy link
Contributor Author

farodin91 commented Oct 2, 2016

@jdm How to set a Pseudo-Class (:fullscreen)?

@farodin91 farodin91 force-pushed the farodin91:fullscreen branch from a40a7bd to 9db3134 Oct 2, 2016
@jdm
Copy link
Member

jdm commented Oct 2, 2016

I recommend looking at how the :target pseudoclass is implemented (look at target_element).

Copy link
Member

jdm left a comment

Good start!

@@ -1137,13 +1138,23 @@ impl Window {
let document = self.Document();
let stylesheets_changed = document.get_and_reset_stylesheets_changed_since_reflow();

// fullscreen actions
let entry_node = match self.Document().GetFullscreenElement() {

This comment has been minimized.

@jdm

jdm Oct 4, 2016

Member
let entry_node = self.Document()
    .GetFullScreenElement()
    .map(|e| e.upcast::<Node>().to_trusted_node_address());
@@ -1137,13 +1138,23 @@ impl Window {
let document = self.Document();
let stylesheets_changed = document.get_and_reset_stylesheets_changed_since_reflow();

// fullscreen actions

This comment has been minimized.

@jdm

jdm Oct 4, 2016

Member

I don't think this comment adds anything to the code.

@@ -121,6 +121,8 @@ pub struct ScriptReflow {
pub reflow_info: Reflow,
/// The document node.
pub document: TrustedNodeAddress,
/// The render entry point need for fullscreen.

This comment has been minimized.

@jdm

jdm Oct 4, 2016

Member

s/need/needed/

@@ -2108,6 +2111,13 @@ impl ElementMethods for Element {
None => return Err(Error::NotSupported)
}
}

#[allow(unrooted_must_root)]
fn RequestFullscreen(&self) -> Rc<Promise> {

This comment has been minimized.

@jdm

jdm Oct 4, 2016

Member

There's a missing specification link comment.

fn RequestFullscreen(&self) -> Rc<Promise> {
let doc = document_from_node(self);
doc.set_fullscreen_element(Some(self));
Promise::new(self.global().r())

This comment has been minimized.

@jdm

jdm Oct 4, 2016

Member

This promise needs to be resolved when the fullscreen status has changed. We can probably use this instead:

let global = self.global().r();
Promise::Resolve(global, global.get_cx(), HandleValue::undefined())
@@ -2951,6 +2966,28 @@ impl DocumentMethods for Document {

// https://html.spec.whatwg.org/multipage/#documentandelementeventhandlers
document_and_element_event_handlers!();

event_handler!(fullscreenerror, GetOnfullscreenerror, SetOnfullscreenerror);

This comment has been minimized.

@jdm

jdm Oct 4, 2016

Member

Specification links are missing for these changes.

#[allow(unrooted_must_root)]
fn ExitFullscreen(&self) -> Rc<Promise> {
self.set_fullscreen_element(None);
Promise::new(self.global().r())

This comment has been minimized.

@jdm

jdm Oct 4, 2016

Member

Same promise comment. set_fullscreen_element should probably return the Promise value so we don't duplicate the code.

@bors-servo
Copy link
Contributor

bors-servo commented Oct 7, 2016

The latest upstream changes (presumably #13596) made this pull request unmergeable. Please resolve the merge conflicts.

@farodin91 farodin91 force-pushed the farodin91:fullscreen branch from 9db3134 to c4a1849 Oct 8, 2016
@farodin91 farodin91 force-pushed the farodin91:fullscreen branch from c4a1849 to 7aa9a93 Oct 8, 2016
@farodin91
Copy link
Contributor Author

farodin91 commented Oct 12, 2016

@jdm i read the spec a bit more, due to spec i shouldn't set a new entry in reflow.
https://fullscreen.spec.whatwg.org/#user-agent-level-style-sheet-defaults. I think this would be better.
Any preference?

@jdm
Copy link
Member

jdm commented Oct 12, 2016

Oh, that's interesting indeed. If we can do it entirely with CSS that would definitely be preferable.

Copy link
Member

jdm left a comment

Sorry, I noticed one last problem :( I've filed #14500 about making this impossible in the future.

@@ -64,6 +64,7 @@ impl TrustedReference {
/// in asynchronous operations. The underlying DOM object is guaranteed to live at least
/// as long as the last outstanding `TrustedPromise` instance. These values cannot be cloned,
/// only created from existing Rc<Promise> values.
#[derive(Clone)]

This comment has been minimized.

@jdm

jdm Dec 8, 2016

Member

This is not safe. We need to make a new TrustedPromise value from the Rc<Promise> value instead.

let document = document_from_node(element.r());
// JSAutoCompartment needs to be manually made.
// Otherwise, Servo will crash.
let promise = self.promise.clone().root();

This comment has been minimized.

@jdm

jdm Dec 8, 2016

Member

Why we can't use self.promise.root() here?

This comment has been minimized.

@farodin91

farodin91 Dec 9, 2016

Author Contributor

I don't like my new solution.

@bors-servo
Copy link
Contributor

bors-servo commented Dec 8, 2016

The latest upstream changes (presumably #14495) made this pull request unmergeable. Please resolve the merge conflicts.

@farodin91 farodin91 force-pushed the farodin91:fullscreen branch from 574addd to fe12ab7 Dec 9, 2016
Jansen Jan
@farodin91 farodin91 force-pushed the farodin91:fullscreen branch from fe12ab7 to 55f0e56 Dec 9, 2016
@jdm
Copy link
Member

jdm commented Dec 9, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 9, 2016

📌 Commit 55f0e56 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Dec 9, 2016

Testing commit 55f0e56 with merge 8b69e73...

bors-servo added a commit that referenced this pull request Dec 9, 2016
Add support for fullscreen #10102

<!-- Please describe your changes on the following line: -->

I'm start working on fullscreen support.
@jdm Should be the entry_point in ScriptReflow a Option if fullscreen is enabled or point on the entry_node? For example the RootNode.

---

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #10102  (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->

---

This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13489)

<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 9, 2016

@bors-servo bors-servo merged commit 55f0e56 into servo:master Dec 9, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@foolip
Copy link

foolip commented Feb 9, 2017

Could @farodin91 or someone else take a look at web-platform-tests/wpt#4394 and my comment in 8b69e73?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

8 participants
You can’t perform that action at this time.