mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #14367 - mrobinson:scroll-fragment-point, r=pcwalton
Reimplement scrolling to fragments <!-- Please describe your changes on the following line: --> --- <!-- 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 #13736, #10753 (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. --> This reimplemntation of the feature uses ScrollRootIds to scroll particular scrollable areas of the page. Fixes #13736. Fixes #10753. <!-- 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/14367) <!-- Reviewable:end -->
This commit is contained in:
commit
a0619688a6
18 changed files with 154 additions and 45 deletions
|
@ -39,7 +39,7 @@ use util::geometry::ScreenPx;
|
|||
use util::opts;
|
||||
use util::prefs::PREFS;
|
||||
use webrender;
|
||||
use webrender_traits::{self, ScrollEventPhase};
|
||||
use webrender_traits::{self, ScrollEventPhase, ServoScrollRootId};
|
||||
use windowing::{self, MouseWindowEvent, WindowEvent, WindowMethods, WindowNavigateMsg};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
@ -493,9 +493,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
self.title_for_main_frame();
|
||||
}
|
||||
|
||||
(Msg::ScrollFragmentPoint(pipeline_id, point, _),
|
||||
(Msg::ScrollFragmentPoint(pipeline_id, scroll_root_id, point, _),
|
||||
ShutdownState::NotShuttingDown) => {
|
||||
self.scroll_fragment_to_point(pipeline_id, point);
|
||||
self.scroll_fragment_to_point(pipeline_id, scroll_root_id, point);
|
||||
}
|
||||
|
||||
(Msg::MoveTo(point),
|
||||
|
@ -761,9 +761,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
|
||||
fn scroll_fragment_to_point(&mut self,
|
||||
_pipeline_id: PipelineId,
|
||||
_point: Point2D<f32>) {
|
||||
println!("TODO: Support scroll_fragment_to_point again");
|
||||
pipeline_id: PipelineId,
|
||||
scroll_root_id: ScrollRootId,
|
||||
point: Point2D<f32>) {
|
||||
self.webrender_api.scroll_layers_with_scroll_root_id(
|
||||
point,
|
||||
pipeline_id.to_webrender(),
|
||||
ServoScrollRootId(scroll_root_id.0));
|
||||
}
|
||||
|
||||
fn handle_window_message(&mut self, event: WindowEvent) {
|
||||
|
|
|
@ -8,6 +8,7 @@ use SendableFrameTree;
|
|||
use compositor::CompositingReason;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::size::Size2D;
|
||||
use gfx_traits::ScrollRootId;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, PipelineId};
|
||||
use net_traits::image::base::Image;
|
||||
|
@ -72,7 +73,7 @@ pub enum Msg {
|
|||
ShutdownComplete,
|
||||
|
||||
/// Scroll a page in a window
|
||||
ScrollFragmentPoint(PipelineId, Point2D<f32>, bool),
|
||||
ScrollFragmentPoint(PipelineId, ScrollRootId, Point2D<f32>, bool),
|
||||
/// Alerts the compositor that the current page has changed its title.
|
||||
ChangePageTitle(PipelineId, Option<String>),
|
||||
/// Alerts the compositor that the current page has changed its URL.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue