Skip to content
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

Scrolling improvements #491

Closed
wants to merge 16 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Reduce coupling between layout and the DOM by separating out the layo…

…ut interface.

Eventually, the layout interface will be moved along with the DOM into a
separate crate.
  • Loading branch information
pcwalton committed May 28, 2013
commit 0a95672236ad2b54f4cd36cc589ba8ae5bb8b969
@@ -8,7 +8,7 @@ use dom::bindings::utils::{domstring_to_jsval, WrapNewBindingObject};
use dom::bindings::utils::{str, CacheableWrapper, DOM_OBJECT_SLOT, DOMString};
use dom::element::*;
use dom::node::{AbstractNode, Element, ElementNodeTypeId, ScriptView};
use layout::layout_task;
use layout_interface::{ContentBoxQuery, ContentBoxResponse};
use scripting::script_task::task_from_context;
use super::utils;

@@ -216,10 +216,10 @@ extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa
let width = match node.type_id() {
ElementNodeTypeId(HTMLImageElementTypeId) => {
let script_context = task_from_context(cx);
match (*script_context).query_layout(layout_task::ContentBox(node)) {
match (*script_context).query_layout(ContentBoxQuery(node)) {
Ok(rect) => {
match rect {
layout_task::ContentRect(rect) => rect.size.width.to_px(),
ContentBoxResponse(rect) => rect.size.width.to_px(),
_ => fail!(~"unexpected layout reply")
}
}
@@ -2,19 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

//
// Element nodes.
//
//! Element nodes.

use dom::node::{ElementNodeTypeId, Node, ScriptView};
use dom::bindings::utils::DOMString;
use dom::clientrect::ClientRect;
use dom::clientrectlist::ClientRectList;
use dom::bindings::utils::DOMString;

use layout::layout_task;
use dom::node::{ElementNodeTypeId, Node, ScriptView};
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
use layout_interface::{ContentBoxesResponse};

use core::str::eq_slice;
use core::cell::Cell;
use core::str::eq_slice;
use std::net::url::Url;

pub struct Element {
@@ -169,9 +167,9 @@ pub impl<'self> Element {
let script_context = unsafe {
&mut *win.script_context
};
match script_context.query_layout(layout_task::ContentBoxes(node)) {
match script_context.query_layout(ContentBoxesQuery(node)) {
Ok(rects) => match rects {
layout_task::ContentRects(rects) =>
ContentBoxesResponse(rects) =>
do rects.map |r| {
ClientRect::new(
r.origin.y.to_f32(),
@@ -209,9 +207,9 @@ pub impl<'self> Element {
let node = self.parent.abstract.get();
assert!(node.is_element());
let script_context = unsafe { &mut *win.script_context };
match script_context.query_layout(layout_task::ContentBox(node)) {
match script_context.query_layout(ContentBoxQuery(node)) {
Ok(rect) => match rect {
layout_task::ContentRect(rect) =>
ContentBoxResponse(rect) =>
Some(ClientRect::new(
rect.origin.y.to_f32(),
(rect.origin.y + rect.size.height).to_f32(),
@@ -4,8 +4,8 @@

use dom::bindings::utils::WrapperCache;
use dom::bindings::window;
use layout_interface::MatchSelectorsDamage;
use scripting::script_task::{ExitMsg, FireTimerMsg, ScriptMsg, ScriptContext};
use layout::layout_task::MatchSelectorsDamage;
use util::task::spawn_listener;

use core::comm::{Port, Chan, SharedChan};
@@ -3,8 +3,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use compositing::CompositorTask;
use layout::layout_task::LayoutTask;
use layout::layout_task;
use layout_interface::LayoutTask;
use layout_interface;
use scripting::script_task::{ExecuteMsg, LoadMsg, ScriptMsg, ScriptTask};
use scripting::script_task;
use util::task::spawn_listener;
@@ -18,7 +19,6 @@ use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use servo_net::resource_task::ResourceTask;
use servo_net::resource_task;
use servo_util::time::{ProfilerChan, ProfilerPort, ProfilerTask};
use servo_util::time;
use std::net::url::Url;

pub type EngineTask = Chan<Msg>;
@@ -61,10 +61,10 @@ impl Engine {
let profiler_task = ProfilerTask::new(profiler_port.take(), profiler_chan.clone());

let opts = opts.take();
let layout_task = LayoutTask(render_task.clone(),
image_cache_task.clone(),
opts,
profiler_task.chan.clone());
let layout_task = layout_task::create_layout_task(render_task.clone(),
image_cache_task.clone(),
opts,
profiler_task.chan.clone());

let script_task = ScriptTask::new(script_port.take(),
script_chan.take(),
@@ -105,7 +105,7 @@ impl Engine {

ExitMsg(sender) => {
self.script_task.chan.send(script_task::ExitMsg);
self.layout_task.send(layout_task::ExitMsg);
self.layout_task.chan.send(layout_interface::ExitMsg);

let (response_port, response_chan) = comm::stream();

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.