Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd support for fullscreen #10102 #13489
Conversation
highfive
commented
Sep 28, 2016
|
Heads up! This PR modifies the following files:
|
highfive
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. |
|
Do we plan to land this without implementing the per-platform bits? (Not a huge deal, just curious). |
|
Is the plan to make the DOM element full window, and than send a message to the glutin window to go fullscreen? |
|
Yep. |
|
@jdm For which purpose exists |
|
Thank you |
|
@jdm How to set a Pseudo-Class (:fullscreen)? |
|
I recommend looking at how the :target pseudoclass is implemented (look at target_element). |
|
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.
This comment has been minimized.
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.
This comment has been minimized.
| @@ -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.
This comment has been minimized.
| @@ -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.
This comment has been minimized.
| 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.
This comment has been minimized.
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.
This comment has been minimized.
| #[allow(unrooted_must_root)] | ||
| fn ExitFullscreen(&self) -> Rc<Promise> { | ||
| self.set_fullscreen_element(None); | ||
| Promise::new(self.global().r()) |
This comment has been minimized.
This comment has been minimized.
jdm
Oct 4, 2016
Member
Same promise comment. set_fullscreen_element should probably return the Promise value so we don't duplicate the code.
|
|
|
@jdm i read the spec a bit more, due to spec i shouldn't set a new entry in reflow. |
|
Oh, that's interesting indeed. If we can do it entirely with CSS that would definitely be preferable. |
| @@ -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.
This comment has been minimized.
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
|
@bors-servo: r+ |
|
|
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 -->
|
|
foolip
commented
Feb 9, 2017
|
Could @farodin91 or someone else take a look at web-platform-tests/wpt#4394 and my comment in 8b69e73? |
farodin91 commentedSep 28, 2016
•
edited
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 -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is