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

Fix a few issues #6682

Merged
merged 4 commits into from Jul 22, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Fix #6676

  • Loading branch information
boghison committed Jul 22, 2015
commit e10a524c8145d5bc903eaa0aa6161d20593c463a
@@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::NodeFilterBinding::NodeFilter;
use dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::codegen::InheritTypes::{DocumentDerived, EventCast, HTMLBodyElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLHeadElementCast, ElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLHeadElementCast, ElementCast, HTMLIFrameElementCast};
use dom::bindings::codegen::InheritTypes::{DocumentTypeCast, HTMLHtmlElementCast, NodeCast};
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLAnchorElementCast};
use dom::bindings::codegen::InheritTypes::{HTMLAnchorElementDerived, HTMLAppletElementDerived};
@@ -49,6 +49,7 @@ use dom::htmlcollection::{HTMLCollection, CollectionFilter};
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
use dom::htmlheadelement::HTMLHeadElement;
use dom::htmlhtmlelement::HTMLHtmlElement;
use dom::htmliframeelement::HTMLIFrameElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::location::Location;
use dom::mouseevent::MouseEvent;
@@ -69,7 +70,7 @@ use layout_interface::{HitTestResponse, MouseOverResponse};
use msg::compositor_msg::ScriptListener;
use msg::constellation_msg::AnimationState;
use msg::constellation_msg::Msg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, FocusType, Key, KeyState, KeyModifiers, MozBrowserEvent};
use msg::constellation_msg::{ConstellationChan, FocusType, Key, KeyState, KeyModifiers, MozBrowserEvent, SubpageId};
use msg::constellation_msg::{SUPER, ALT, SHIFT, CONTROL};
use net_traits::CookieSource::NonHTTP;
use net_traits::ControlMsg::{SetCookiesForUrl, GetCookiesForUrl};
@@ -287,6 +288,7 @@ pub trait DocumentHelpers<'a> {
fn finish_load(self, load: LoadType);
fn set_current_parser(self, script: Option<&ServoHTMLParser>);
fn get_current_parser(self) -> Option<Root<ServoHTMLParser>>;
fn find_iframe(self, subpage_id: SubpageId) -> Option<Root<HTMLIFrameElement>>;
}

impl<'a> DocumentHelpers<'a> for &'a Document {
@@ -989,6 +991,13 @@ impl<'a> DocumentHelpers<'a> for &'a Document {
fn get_current_parser(self) -> Option<Root<ServoHTMLParser>> {
self.current_parser.get().map(Root::from_rooted)
}

/// Find an iframe element in the document.
fn find_iframe(self, subpage_id: SubpageId) -> Option<Root<HTMLIFrameElement>> {
NodeCast::from_ref(self).traverse_preorder()
.filter_map(HTMLIFrameElementCast::to_root)
.find(|node| node.r().subpage_id() == Some(subpage_id))
}
}

pub enum MouseEventType {
@@ -22,7 +22,7 @@
use document_loader::{LoadType, DocumentLoader, NotifierData};
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState};
use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, HTMLIFrameElementCast, NodeCast, EventCast};
use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, NodeCast, EventCast};
use dom::bindings::conversions::FromJSValConvertible;
use dom::bindings::conversions::StringificationBehavior;
use dom::bindings::js::{JS, RootCollection, trace_roots};
@@ -35,7 +35,7 @@ use dom::document::{Document, IsHTMLDocument, DocumentHelpers, DocumentProgressH
DocumentProgressTask, DocumentSource, MouseEventType};
use dom::element::{Element, AttributeHandlers};
use dom::event::{EventHelpers, EventBubbles, EventCancelable};
use dom::htmliframeelement::{HTMLIFrameElement, HTMLIFrameElementHelpers};
use dom::htmliframeelement::HTMLIFrameElementHelpers;
use dom::uievent::UIEvent;
use dom::node::{Node, NodeHelpers, NodeDamage, window_from_node};
use dom::servohtmlparser::{ServoHTMLParser, ParserContext};
@@ -1103,7 +1103,7 @@ impl ScriptTask {
let page = borrowed_page.find(parent_pipeline_id).unwrap();

let doc = page.document();
let frame_element = self.find_iframe(doc.r(), subpage_id);
let frame_element = doc.find_iframe(subpage_id);

if let Some(ref frame_element) = frame_element {
let element = ElementCast::from_ref(frame_element.r());
@@ -1123,7 +1123,7 @@ impl ScriptTask {

let frame_element = borrowed_page.find(parent_pipeline_id).and_then(|page| {
let doc = page.document();
self.find_iframe(doc.r(), subpage_id)
doc.find_iframe(subpage_id)
});

if let Some(ref frame_element) = frame_element {
@@ -1139,7 +1139,7 @@ impl ScriptTask {

let frame_element = borrowed_page.find(containing_pipeline_id).and_then(|page| {
let doc = page.document();
self.find_iframe(doc.r(), old_subpage_id)
doc.find_iframe(old_subpage_id)
});

frame_element.r().unwrap().update_subpage_id(new_subpage_id);
@@ -1290,7 +1290,7 @@ impl ScriptTask {
borrowed_page.as_ref().and_then(|borrowed_page| {
borrowed_page.find(parent_id).and_then(|page| {
let doc = page.document();
self.find_iframe(doc.r(), subpage_id)
doc.find_iframe(subpage_id)
})
})
});
@@ -1457,16 +1457,6 @@ impl ScriptTask {
window.r().reflow(ReflowGoal::ForDisplay, ReflowQueryType::NoQuery, reason);
}

/// Find an iframe element in a provided document.
fn find_iframe(&self, doc: &Document, subpage_id: SubpageId)
-> Option<Root<HTMLIFrameElement>> {
let doc = NodeCast::from_ref(doc);

doc.traverse_preorder()
.filter_map(HTMLIFrameElementCast::to_root)
.find(|node| node.r().subpage_id() == Some(subpage_id))
}

/// This is the main entry point for receiving and dispatching DOM events.
///
/// TODO: Actually perform DOM event dispatch.
@@ -1545,7 +1535,7 @@ impl ScriptTask {
let borrowed_page = self.root_page();
let iframe = borrowed_page.find(pipeline_id).and_then(|page| {
let doc = page.document();
self.find_iframe(doc.r(), subpage_id)
doc.find_iframe(subpage_id)
});
if let Some(iframe) = iframe.r() {
iframe.navigate_child_browsing_context(load_data.url);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.