servo: Merge #17285 - geckolib: Don't panic when attempting to restyle an element with newly applied XBL bindings (from heycam:newly-bound); r=bholley

From https://bugzilla.mozilla.org/show_bug.cgi?id=1370793.

Source-Repo: https://github.com/servo/servo
Source-Revision: 8449eb4a6230d07faafc28a0d277b323e2da5e12

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 0a492da9c92ce20694f87777f42e31c622f4d596
This commit is contained in:
Cameron McCormack 2017-06-12 18:46:41 -07:00
Родитель 20a52db2f2
Коммит 9ebc1a575e
4 изменённых файлов: 37 добавлений и 13 удалений

Просмотреть файл

@ -2113,9 +2113,9 @@ extern "C" {
}
extern "C" {
pub fn Servo_StyleRule_GetSelectorTextAtIndex(rule:
RawServoStyleRuleBorrowed,
index: u32,
result: *mut nsAString);
RawServoStyleRuleBorrowed,
index: u32,
result: *mut nsAString);
}
extern "C" {
pub fn Servo_StyleRule_GetSpecificityAtIndex(rule:

Просмотреть файл

@ -6644,9 +6644,10 @@ pub mod root {
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum TraversalRestyleBehavior {
Normal = 0,
ForReconstruct = 1,
ForAnimationOnly = 2,
ForCSSRuleChanges = 3,
ForNewlyBoundElement = 1,
ForReconstruct = 2,
ForAnimationOnly = 3,
ForCSSRuleChanges = 4,
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@ -10436,6 +10437,12 @@ pub mod root {
eFloatID_SpellCheckerUnderlineRelativeSize = 1,
eFloatID_CaretAspectRatio = 2,
}
pub const LookAndFeel_FontID_FontID_MINIMUM:
root::mozilla::LookAndFeel_FontID =
LookAndFeel_FontID::eFont_Caption;
pub const LookAndFeel_FontID_FontID_MAXIMUM:
root::mozilla::LookAndFeel_FontID =
LookAndFeel_FontID::eFont_Widget;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum LookAndFeel_FontID {
@ -34397,7 +34404,7 @@ pub mod root {
root::nsCharTraits ) ));
}
#[test]
fn __bindgen_test_layout__bindgen_ty_id_215166_instantiation_103() {
fn __bindgen_test_layout__bindgen_ty_id_215184_instantiation_103() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
@ -34406,7 +34413,7 @@ pub mod root {
) ));
}
#[test]
fn __bindgen_test_layout__bindgen_ty_id_215202_instantiation_104() {
fn __bindgen_test_layout__bindgen_ty_id_215220_instantiation_104() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));

Просмотреть файл

@ -6500,9 +6500,10 @@ pub mod root {
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum TraversalRestyleBehavior {
Normal = 0,
ForReconstruct = 1,
ForAnimationOnly = 2,
ForCSSRuleChanges = 3,
ForNewlyBoundElement = 1,
ForReconstruct = 2,
ForAnimationOnly = 3,
ForCSSRuleChanges = 4,
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@ -10169,6 +10170,12 @@ pub mod root {
eFloatID_SpellCheckerUnderlineRelativeSize = 1,
eFloatID_CaretAspectRatio = 2,
}
pub const LookAndFeel_FontID_FontID_MINIMUM:
root::mozilla::LookAndFeel_FontID =
LookAndFeel_FontID::eFont_Caption;
pub const LookAndFeel_FontID_FontID_MAXIMUM:
root::mozilla::LookAndFeel_FontID =
LookAndFeel_FontID::eFont_Widget;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum LookAndFeel_FontID {
@ -33852,7 +33859,7 @@ pub mod root {
root::nsCharTraits ) ));
}
#[test]
fn __bindgen_test_layout__bindgen_ty_id_211327_instantiation_98() {
fn __bindgen_test_layout__bindgen_ty_id_211345_instantiation_98() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));
@ -33861,7 +33868,7 @@ pub mod root {
) ));
}
#[test]
fn __bindgen_test_layout__bindgen_ty_id_211363_instantiation_99() {
fn __bindgen_test_layout__bindgen_ty_id_211381_instantiation_99() {
assert_eq!(::std::mem::size_of::<u8>() , 1usize , concat ! (
"Size of template specialization: " , stringify ! ( u8 )
));

Просмотреть файл

@ -263,9 +263,11 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
let traversal_flags = match (root_behavior, restyle_behavior) {
(Root::Normal, Restyle::Normal) |
(Root::Normal, Restyle::ForNewlyBoundElement) |
(Root::Normal, Restyle::ForAnimationOnly)
=> TraversalFlags::empty(),
(Root::UnstyledChildrenOnly, Restyle::Normal) |
(Root::UnstyledChildrenOnly, Restyle::ForNewlyBoundElement) |
(Root::UnstyledChildrenOnly, Restyle::ForAnimationOnly)
=> UNSTYLED_CHILDREN_ONLY,
(Root::Normal, Restyle::ForCSSRuleChanges) => FOR_CSS_RULE_CHANGES,
@ -291,6 +293,14 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
traversal_flags,
unsafe { &*snapshots });
if restyle_behavior == Restyle::ForNewlyBoundElement {
// In this mode, we only ever restyle new elements, so there is no
// need for a post-traversal, and the borrow_data().unwrap() call below
// could panic, so we don't bother computing whether a post-traversal
// is required.
return false;
}
element.has_dirty_descendants() || element.borrow_data().unwrap().has_restyle()
}