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

style: Recascade the document instead of using the dirty_on_viewport_size_change bit #18268

Merged
merged 4 commits into from Aug 29, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

style: Remove NODE_NEEDS_DIRTY_ON_VIEWPORT_SIZE_CHANGE.

Recascading is enough.
  • Loading branch information
emilio committed Aug 28, 2017
commit dcbe196ed58bc71aa5279a56bbb8e0554d94db18
@@ -38,7 +38,7 @@ use layout::data::StyleAndLayoutData;
use layout::wrapper::GetRawData;
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use range::Range;
use script::layout_exports::{CAN_BE_FRAGMENTED, DIRTY_ON_VIEWPORT_SIZE_CHANGE, HAS_DIRTY_DESCENDANTS, IS_IN_DOC};
use script::layout_exports::{CAN_BE_FRAGMENTED, HAS_DIRTY_DESCENDANTS, IS_IN_DOC};
use script::layout_exports::{CharacterDataTypeId, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use script::layout_exports::{Document, Element, Node, Text};
use script::layout_exports::{HANDLED_SNAPSHOT, HAS_SNAPSHOT};
@@ -205,14 +205,6 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
as_element(self.node)
}

fn needs_dirty_on_viewport_size_changed(&self) -> bool {
unsafe { self.node.get_flag(DIRTY_ON_VIEWPORT_SIZE_CHANGE) }
}

unsafe fn set_dirty_on_viewport_size_changed(&self) {
self.node.set_flag(DIRTY_ON_VIEWPORT_SIZE_CHANGE, true);
}

fn can_be_fragmented(&self) -> bool {
unsafe { self.node.get_flag(CAN_BE_FRAGMENTED) }
}
@@ -169,8 +169,7 @@ bitflags! {
/// Whether any ancestor is a fragmentation container
const CAN_BE_FRAGMENTED = 1 << 4,

#[doc = "Specifies whether this node needs to be dirted when viewport size changed."]
const DIRTY_ON_VIEWPORT_SIZE_CHANGE = 1 << 5,
// There's a free bit here.

#[doc = "Specifies whether the parser has set an associated form owner for \
this element. Only applicable for form-associatable elements."]
@@ -142,7 +142,7 @@ pub mod layout_exports {
pub use dom::characterdata::LayoutCharacterDataHelpers;
pub use dom::document::{Document, LayoutDocumentHelpers, PendingRestyle};
pub use dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers};
pub use dom::node::{CAN_BE_FRAGMENTED, DIRTY_ON_VIEWPORT_SIZE_CHANGE, HAS_DIRTY_DESCENDANTS, IS_IN_DOC};
pub use dom::node::{CAN_BE_FRAGMENTED, HAS_DIRTY_DESCENDANTS, IS_IN_DOC};
pub use dom::node::{HANDLED_SNAPSHOT, HAS_SNAPSHOT};
pub use dom::node::{LayoutNodeHelpers, Node};
pub use dom::text::Text;
@@ -138,12 +138,6 @@ pub trait TNode : Sized + Copy + Clone + Debug + NodeInfo {
/// Get this node as an element, if it's one.
fn as_element(&self) -> Option<Self::ConcreteElement>;

/// Whether this node needs to be laid out on viewport size change.
fn needs_dirty_on_viewport_size_changed(&self) -> bool;

/// Mark this node as needing layout on viewport size change.
unsafe fn set_dirty_on_viewport_size_changed(&self);

/// Whether this node can be fragmented. This is used for multicol, and only
/// for Servo.
fn can_be_fragmented(&self) -> bool;
@@ -318,17 +318,6 @@ impl<'ln> TNode for GeckoNode<'ln> {
fn is_in_doc(&self) -> bool {
unsafe { bindings::Gecko_IsInDocument(self.0) }
}

fn needs_dirty_on_viewport_size_changed(&self) -> bool {
// Gecko's node doesn't have the DIRTY_ON_VIEWPORT_SIZE_CHANGE flag,
// so we force them to be dirtied on viewport size change, regardless if
// they use viewport percentage size or not.
// TODO(shinglyu): implement this in Gecko: https://github.com/servo/servo/pull/11890
true
}

// TODO(shinglyu): implement this in Gecko: https://github.com/servo/servo/pull/11890
unsafe fn set_dirty_on_viewport_size_changed(&self) {}
}

/// A wrapper on top of two kind of iterators, depending on the parent being
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.