Remove virtual call and unconditionally dirty node on set_focus_state

This commit is contained in:
Manish Goregaokar 2016-01-07 12:04:27 +05:30
parent 539ee18cf0
commit f67e208630
4 changed files with 3 additions and 19 deletions

View file

@ -72,7 +72,6 @@ use dom::touchevent::TouchEvent;
use dom::touchlist::TouchList;
use dom::treewalker::TreeWalker;
use dom::uievent::UIEvent;
use dom::virtualmethods::{VirtualMethods, vtable_for};
use dom::window::{ReflowReason, Window};
use euclid::point::Point2D;
use html5ever::tree_builder::{LimitedQuirks, NoQuirks, Quirks, QuirksMode};
@ -594,8 +593,6 @@ impl Document {
if let Some(ref elem) = self.focused.get() {
elem.set_focus_state(false);
let node = vtable_for(&elem.upcast::<Node>());
node.handle_blur();
}
self.focused.set(self.possibly_focused.get().r());

View file

@ -1903,7 +1903,9 @@ impl Element {
}
pub fn set_focus_state(&self, value: bool) {
self.set_state(IN_FOCUS_STATE, value)
self.set_state(IN_FOCUS_STATE, value);
let doc = document_from_node(self);
doc.content_changed(self.upcast(), NodeDamage::OtherNodeDamage);
}
pub fn get_hover_state(&self) -> bool {

View file

@ -719,13 +719,6 @@ impl VirtualMethods for HTMLInputElement {
}
}
}
fn handle_blur(&self) {
if let Some(s) = self.super_type() {
s.handle_blur();
}
self.force_relayout();
}
}
impl FormControl for HTMLInputElement {}

View file

@ -102,14 +102,6 @@ pub trait VirtualMethods {
}
}
/// Called when a previously focused element is no longer focused.
/// Use this to trigger relayouts
fn handle_blur(&self) {
if let Some(s) = self.super_type() {
s.handle_blur();
}
}
/// https://dom.spec.whatwg.org/#concept-node-adopt-ext
fn adopting_steps(&self, old_doc: &Document) {
if let Some(ref s) = self.super_type() {