Skip to content

Add support for fullscreen #10102#13489

Merged
bors-servo merged 1 commit intoservo:masterfrom
farodin91:fullscreen
Dec 9, 2016
Merged

Add support for fullscreen #10102#13489
bors-servo merged 1 commit intoservo:masterfrom
farodin91:fullscreen

Conversation

@farodin91
Copy link
Copy Markdown
Contributor

@farodin91 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 Implement the Fullscreen API #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
Copy Markdown

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 highfive added the S-awaiting-review There is new code that needs to be reviewed. label Sep 28, 2016
@highfive
Copy link
Copy Markdown

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!

@jdm
Copy link
Copy Markdown
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.

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Sep 28, 2016
@emilio
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
Member

jdm commented Sep 29, 2016

Yep.

@farodin91
Copy link
Copy Markdown
Contributor Author

farodin91 commented Oct 2, 2016

@jdm
Copy link
Copy Markdown
Member

jdm commented Oct 2, 2016

@farodin91
Copy link
Copy Markdown
Contributor Author

Thank you

@farodin91
Copy link
Copy Markdown
Contributor Author

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

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Oct 2, 2016
@jdm
Copy link
Copy Markdown
Member

jdm commented Oct 2, 2016

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

Copy link
Copy Markdown
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start!

let stylesheets_changed = document.get_and_reset_stylesheets_changed_since_reflow();

// fullscreen actions
let entry_node = match self.Document().GetFullscreenElement() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let entry_node = self.Document()
    .GetFullScreenElement()
    .map(|e| e.upcast::<Node>().to_trusted_node_address());

let document = self.Document();
let stylesheets_changed = document.get_and_reset_stylesheets_changed_since_reflow();

// fullscreen actions
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

pub reflow_info: Reflow,
/// The document node.
pub document: TrustedNodeAddress,
/// The render entry point need for fullscreen.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/need/needed/

}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())

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

event_handler!(fullscreenerror, GetOnfullscreenerror, SetOnfullscreenerror);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. S-fails-tidy `./mach test-tidy` reported errors. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 4, 2016
@bors-servo
Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Oct 7, 2016
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Oct 8, 2016
@farodin91
Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
Member

jdm commented Oct 12, 2016

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

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit e9050b6 has been approved by jdm

@jdm
Copy link
Copy Markdown
Member

jdm commented Nov 15, 2016

@bors-servo: r-
Sorry, the manifest is still not up to date.

@farodin91
Copy link
Copy Markdown
Contributor Author

@jdm Updated

@KiChjang
Copy link
Copy Markdown
Contributor

@bors-servo r=jdm

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit a9e5227 has been approved by jdm

@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit a9e5227 with merge b07f270...

@bors-servo
Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel-wpt

@farodin91
Copy link
Copy Markdown
Contributor Author

@jdm ?

FAIL [expected PASS] /_mozilla/css/incremental_trailing_whitespace_a.html
└ → /_mozilla/css/incremental_trailing_whitespace_a.html da54041086f2975f8e3c776d2283ad6609e6862a
/_mozilla/css/incremental_trailing_whitespace_ref.html f5d0147c8bddbdc772a7e5e86c7c9e433fcd486b
Testing da54041086f2975f8e3c776d2283ad6609e6862a == f5d0147c8bddbdc772a7e5e86c7c9e433fcd486b

@emilio
Copy link
Copy Markdown
Member

emilio commented Nov 16, 2016

@bors-servo retry #10473

@farodin91 that's a known intermittent, no worries :)

@farodin91
Copy link
Copy Markdown
Contributor Author

Stop bors servo that's not the only issue

@emilio
Copy link
Copy Markdown
Member

emilio commented Nov 16, 2016

@bors-servo r-

Right, you need to update a lot more expectations.

@bors-servo
Copy link
Copy Markdown
Contributor

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

@farodin91
Copy link
Copy Markdown
Contributor Author

@jdm Any tipp to update cargo.lock after this commit #14172? The following command doesn't work correct: ./mach update-cargo -p html5ever-atoms

@farodin91
Copy link
Copy Markdown
Contributor Author

@jdm This should run.

@@ -0,0 +1,308 @@
ccopy_reg
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be removed from this commit.

@farodin91
Copy link
Copy Markdown
Contributor Author

Resolved

@bors-servo
Copy link
Copy Markdown
Contributor

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

if let Some(ref value) = *self.id_attribute.borrow() {
let doc = document_from_node(self);
doc.unregister_named_element(self, value.clone());
let fullscreen = doc.GetFullscreenElement();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I just noticed that this comment wasn't addressed.

Copy link
Copy Markdown
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

/// 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)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like my new solution.

@bors-servo
Copy link
Copy Markdown
Contributor

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

@jdm
Copy link
Copy Markdown
Member

jdm commented Dec 9, 2016

@bors-servo: r+

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit 55f0e56 has been approved by jdm

@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit 55f0e56 with merge 8b69e73...

@bors-servo
Copy link
Copy Markdown
Contributor

@foolip
Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the Fullscreen API

8 participants