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
Implement viewport stuffs for window #1718 #6875
Closed
+454
−63
Closed
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
40ff6cf
viewport
farodin91 a33ad54
Merge remote-tracking branch 'upstream/master' into window
farodin91 a9df5f2
[WIP] Implement viewport stuffs for window #1718
farodin91 43d6d5e
[WIP] Implement viewport stuffs for window #1718
farodin91 cbaf83b
Merge branch 'window' of github.com:farodin91/servo into window
farodin91 bb393cd
Merging conflict
farodin91 4557a5d
Merging conflict 2
farodin91 d289878
Merge remote-tracking branch 'upstream/master' into window
farodin91 a5944c7
last Conflict
farodin91 8d2008e
Merge remote-tracking branch 'upstream/master' into window
farodin91 6dabb5d
review changes
farodin91 a800294
Merge remote-tracking branch 'upstream/master' into window
farodin91 225d2ee
current state
farodin91 cc7fc18
most changes to the last review
farodin91 96ae3d4
Merge remote-tracking branch 'upstream/master' into window
farodin91 9a80339
init support of smooth
farodin91 c4213b4
Merge remote-tracking branch 'upstream/master' into window
farodin91 c0e028e
review changes
farodin91 36d318b
Merging and fix review
farodin91 10597e2
fix tidy
farodin91 38f318a
Merge remote-tracking branch 'upstream/master' into window
farodin91 a9d703a
fixing borrow_mut
farodin91 3f3b176
Merge remote-tracking branch 'upstream/master' into window
farodin91 5274eab
Merge remote-tracking branch 'upstream/master' into window
farodin91 f655800
Merge remote-tracking branch 'upstream/master' into window
farodin91 File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
most changes to the last review
- Loading branch information
commit cc7fc18722fbd2a474a954da9e0473549c510f40
| @@ -738,7 +738,7 @@ impl<'a> WindowMethods for &'a Window { | ||
| fn DevicePixelRatio(self) -> Finite<f64> { | ||
| let dpr = self.window_size.get() | ||
jdm
Member
|
||
| .map(|data| data.device_pixel_ratio).unwrap_or(ScaleFactor::new(1.0f32)).get(); | ||
| Finite::wrap(dpr.to_f64().unwrap_or(1.0f64)) | ||
| Finite::wrap(dpr as f64) | ||
| } | ||
| } | ||
|
|
||
| @@ -851,8 +851,13 @@ impl<'a> WindowHelpers for &'a Window { | ||
| *self.js_runtime.borrow_mut() = None; | ||
| *self.browsing_context.borrow_mut() = None; | ||
| } | ||
|
|
||
| /// https://drafts.csswg.org/cssom-view/#dom-window-scroll | ||
| fn scroll(self, x_: f64, y_: f64, behavior: ScrollBehavior) { | ||
| // Step 3 | ||
| let xfinite = if x_.is_finite() { x_ } else { 0.0f64 }; | ||
| let yfinite = if y_.is_finite() { y_ } else { 0.0f64 }; | ||
|
|
||
| // Step 4 | ||
| if self.window_size.get().is_none() { | ||
| return; | ||
| @@ -875,17 +880,17 @@ impl<'a> WindowHelpers for &'a Window { | ||
|
|
||
| let content_height = content_size.size.height.to_f64_px(); | ||
| let content_width = content_size.size.width.to_f64_px(); | ||
| (x_.max(0.0f64).min(content_width - width), | ||
| y_.max(0.0f64).min(content_height - height)) | ||
| (xfinite.max(0.0f64).min(content_width - width), | ||
| yfinite.max(0.0f64).min(content_height - height)) | ||
| }, | ||
| None => { | ||
| (x_.max(0.0f64), y_.max(0.0f64)) | ||
| (xfinite.max(0.0f64), yfinite.max(0.0f64)) | ||
| } | ||
| }; | ||
|
|
||
| // Step 10 | ||
| //TODO handling ongoing smoth scrolling | ||
| if x == self.ScrollX() as f64 && y == self.ScrollX() as f64 { | ||
| if x == self.ScrollX() as f64 && y == self.ScrollY() as f64 { | ||
| return; | ||
| } | ||
|
|
||
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
This will return the wrong DPR if we are running with an option specifiying DPR. (See device_pixels_per_screen_px in compositor.rs: http://mxr.mozilla.org/servo/source/components/compositing/compositor.rs#1139)
Not sure how much we care though.