Remove concept of Layers from Servo

Layers were a feature of the legacy drawing path. If we re-add them at
some point, it probably makes more sense to make them a product of
display list inspection.

This change also remove a bunch of dead painting code.
This commit is contained in:
Martin Robinson 2016-10-19 15:14:02 +02:00
parent e667e62f0c
commit ccb7ab926a
21 changed files with 57 additions and 745 deletions

View file

@ -12,7 +12,7 @@ use euclid::point::TypedPoint2D;
use euclid::scale_factor::ScaleFactor;
use euclid::size::TypedSize2D;
use gfx_traits::{DevicePixel, LayerPixel, StackingContextId};
use gfx_traits::{Epoch, FrameTreeId, FragmentType, LayerId};
use gfx_traits::{Epoch, FrameTreeId, FragmentType};
use gleam::gl;
use gleam::gl::types::{GLint, GLsizei};
use image::{DynamicImage, ImageFormat, RgbImage};
@ -503,9 +503,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.title_for_main_frame();
}
(Msg::ScrollFragmentPoint(pipeline_id, layer_id, point, _),
(Msg::ScrollFragmentPoint(pipeline_id, point, _),
ShutdownState::NotShuttingDown) => {
self.scroll_fragment_to_point(pipeline_id, layer_id, point);
self.scroll_fragment_to_point(pipeline_id, point);
}
(Msg::MoveTo(point),
@ -770,7 +770,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn scroll_fragment_to_point(&mut self,
_pipeline_id: PipelineId,
_layer_id: LayerId,
_point: Point2D<f32>) {
println!("TODO: Support scroll_fragment_to_point again");
}

View file

@ -8,7 +8,6 @@ use SendableFrameTree;
use compositor::CompositingReason;
use euclid::point::Point2D;
use euclid::size::Size2D;
use gfx_traits::LayerId;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState, PipelineId};
use profile_traits::mem;
@ -72,7 +71,7 @@ pub enum Msg {
ShutdownComplete,
/// Scroll a page in a window
ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>, bool),
ScrollFragmentPoint(PipelineId, 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.

View file

@ -1,57 +0,0 @@
Scrolling
=========
Scrolling is implemented by the compositor. Compositor layers that opt in to
scroll events via the `wants_scroll_events` flag can scroll their contents.
These will be referred "scrolling roots." Scrolling roots serve as a viewport
into their content, which is stored in descendant layers. In order for
scrolling roots to be able to scroll their content, they need to be smaller
than that content. If the content was smaller than the scrolling root, it would
not be able to move around inside the scrolling root. Imagine a browser window
that is larger than the content that it contains. The size of each layer is
defined by the window size (the root layer) or the block size for iframes and
elements with `overflow:scroll`.
Since the compositor allows layers to exist independently of their parents,
child layers can overflow or fail to intersect their parents completely. To
prevent this, scrolling roots use the `masks_to_bounds` flag, which is a signal
to the compositor that it should not paint the parts of descendant layers that
lie outside the boundaries of the scrolling root.
Below is an ASCII art diagram showing a scrolling root with three content
layers (a, b, and c), scrolled down a few ticks. `masks_to_bounds` has not been
applied in the diagram.
<pre>
+-----------------------+
| |
=========================
| | scrolling
| &lt;-------------+root
| |
| +-------+ |
=========================
| | b | |
++-------+ +--^----+ |
|| | | |
|| | | | content
|| c &lt;---------+---------+layers
|+-------+ / |
| a &lt; |
| |
+-----------------------+
</pre>
Everything above and below the set of `====` bars would be hidden by
`masks_to_bounds`, so the composited scene will just be the viewport defined by
the scrolling root with the content layers a and b visible.
<pre>
=========================
| |
| |
| |
| +-------+ |
=========================
</pre>