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

Remove HAS_DIRTY_SIBLINGS. #8042

Merged
merged 1 commit into from Oct 21, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -1491,7 +1491,6 @@ impl LayoutTask {
// "changed":
// > node.set_changed(true);
node.set_dirty(true);
node.set_dirty_siblings(true);
node.set_dirty_descendants(true);
}
}
@@ -269,7 +269,6 @@ impl<'a> PostorderDomTraversal for ConstructFlows<'a> {
unsafe {
node.set_changed(false);
node.set_dirty(false);
node.set_dirty_siblings(false);
node.set_dirty_descendants(false);
}

@@ -52,7 +52,7 @@ use script::dom::htmliframeelement::HTMLIFrameElement;
use script::dom::htmlimageelement::LayoutHTMLImageElementHelpers;
use script::dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
use script::dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers};
use script::dom::node::{HAS_CHANGED, HAS_DIRTY_DESCENDANTS, HAS_DIRTY_SIBLINGS, IS_DIRTY};
use script::dom::node::{HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY};
use script::dom::node::{LayoutNodeHelpers, Node, SharedLayoutData};
use script::dom::text::Text;
use selectors::matching::DeclarationBlock;
@@ -258,10 +258,6 @@ impl<'ln> LayoutNode<'ln> {
self.node.set_flag(IS_DIRTY, value)
}

pub unsafe fn set_dirty_siblings(&self, value: bool) {
self.node.set_flag(HAS_DIRTY_SIBLINGS, value);
}

pub fn has_dirty_descendants(&self) -> bool {
unsafe { self.node.get_flag(HAS_DIRTY_DESCENDANTS) }
}
@@ -129,27 +129,24 @@ bitflags! {
const HAS_CHANGED = 0x02,
#[doc = "Specifies whether this node needs style recalc on next reflow."]
const IS_DIRTY = 0x04,
#[doc = "Specifies whether this node has siblings (inclusive of itself) which \
changed since the last reflow."]
const HAS_DIRTY_SIBLINGS = 0x08,
#[doc = "Specifies whether this node has descendants (inclusive of itself) which \
have changed since the last reflow."]
const HAS_DIRTY_DESCENDANTS = 0x10,
const HAS_DIRTY_DESCENDANTS = 0x08,
// TODO: find a better place to keep this (#4105)
// https://critic.hoppipolla.co.uk/showcomment?chain=8873
// Perhaps using a Set in Document?
#[doc = "Specifies whether or not there is an authentic click in progress on \
this element."]
const CLICK_IN_PROGRESS = 0x20,
const CLICK_IN_PROGRESS = 0x10,
#[doc = "Specifies whether this node is focusable and whether it is supposed \
to be reachable with using sequential focus navigation."]
const SEQUENTIALLY_FOCUSABLE = 0x40,
const SEQUENTIALLY_FOCUSABLE = 0x20,
}
}

impl NodeFlags {
pub fn new() -> NodeFlags {
HAS_CHANGED | IS_DIRTY | HAS_DIRTY_SIBLINGS | HAS_DIRTY_DESCENDANTS
HAS_CHANGED | IS_DIRTY | HAS_DIRTY_DESCENDANTS
}
}

@@ -474,14 +471,6 @@ impl Node {
self.set_flag(IS_DIRTY, state)
}

pub fn get_has_dirty_siblings(&self) -> bool {
self.get_flag(HAS_DIRTY_SIBLINGS)
}

pub fn set_has_dirty_siblings(&self, state: bool) {
self.set_flag(HAS_DIRTY_SIBLINGS, state)
}

pub fn get_has_dirty_descendants(&self) -> bool {
self.get_flag(HAS_DIRTY_DESCENDANTS)
}
@@ -514,7 +503,7 @@ impl Node {
// Stop if this subtree is already dirty.
if node.get_is_dirty() { return }

node.set_flag(IS_DIRTY | HAS_DIRTY_SIBLINGS | HAS_DIRTY_DESCENDANTS, true);
node.set_flag(IS_DIRTY | HAS_DIRTY_DESCENDANTS, true);

for kid in node.children() {
dirty_subtree(kid.r());
@@ -523,22 +512,6 @@ impl Node {

dirty_subtree(self);

// 3. Dirty siblings.
//
// TODO(cgaebel): This is a very conservative way to account for sibling
// selectors. Maybe we can do something smarter in the future.
if !self.get_has_dirty_siblings() {
let parent =
match self.parent_node.get() {
None => return,
Some(parent) => parent,
};

for sibling in parent.r().children() {
sibling.r().set_has_dirty_siblings(true);
}
}

// 4. Dirty ancestors.
for ancestor in self.ancestors() {
if !force_ancestors && ancestor.r().get_has_dirty_descendants() { break }
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.