aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_layout_interface/wrapper_traits.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2016-11-21 09:48:33 +0100
committerMartin Robinson <mrobinson@igalia.com>2016-11-29 22:12:16 +0100
commit0b56bb2237e1ae7d2ad9f3490f7da89a7999c06a (patch)
treec924c27d1239bfa531d14ec2bcb7879e1b0aac15 /components/script_layout_interface/wrapper_traits.rs
parent39845faf261672b795af59602b45e7ce096b9f33 (diff)
downloadservo-0b56bb2237e1ae7d2ad9f3490f7da89a7999c06a.tar.gz
servo-0b56bb2237e1ae7d2ad9f3490f7da89a7999c06a.zip
Reimplement scrolling to fragments
This reimplemntation of the feature uses ScrollRootIds to scroll particular scrollable areas of the page. Fixes #13736. Fixes #10753.
Diffstat (limited to 'components/script_layout_interface/wrapper_traits.rs')
-rw-r--r--components/script_layout_interface/wrapper_traits.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs
index 428642ce93b..1d1f32bf4b6 100644
--- a/components/script_layout_interface/wrapper_traits.rs
+++ b/components/script_layout_interface/wrapper_traits.rs
@@ -8,7 +8,7 @@ use HTMLCanvasData;
use LayoutNodeType;
use OpaqueStyleAndLayoutData;
use SVGSVGData;
-use gfx_traits::ByteIndex;
+use gfx_traits::{ByteIndex, FragmentType, ScrollRootId};
use html5ever_atoms::{Namespace, LocalName};
use msg::constellation_msg::PipelineId;
use range::Range;
@@ -264,6 +264,20 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
fn iframe_pipeline_id(&self) -> PipelineId;
fn get_colspan(&self) -> u32;
+
+ fn fragment_type(&self) -> FragmentType {
+ match self.get_pseudo_element_type() {
+ PseudoElementType::Normal => FragmentType::FragmentBody,
+ PseudoElementType::Before(_) => FragmentType::BeforePseudoContent,
+ PseudoElementType::After(_) => FragmentType::AfterPseudoContent,
+ PseudoElementType::DetailsSummary(_) => FragmentType::FragmentBody,
+ PseudoElementType::DetailsContent(_) => FragmentType::FragmentBody,
+ }
+ }
+
+ fn scroll_root_id(&self) -> ScrollRootId {
+ ScrollRootId::new_of_type(self.opaque().id() as usize, self.fragment_type())
+ }
}
// This trait is only public so that it can be implemented by the gecko wrapper.