servo: Merge #17102 - Animation only restyle fix (from hiikezoe:animation-only-restyle-fix); r=heycam

<!-- Please describe your changes on the following line: -->
This is a PR  for https://bugzilla.mozilla.org/show_bug.cgi?id=1361938
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because it's for stylo

Source-Repo: https://github.com/servo/servo
Source-Revision: 31c7198f71550995066de6673af749472f083121

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : d2c75c73e215732279474138e66c73ea3acc3c84
This commit is contained in:
Hiroyuki Ikezoe 2017-05-30 20:07:26 -05:00
Родитель 3b42377db2
Коммит 121e35f3d5
6 изменённых файлов: 2291 добавлений и 4779 удалений

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

@ -329,6 +329,11 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
/// Get this element's style attribute.
fn style_attribute(&self) -> Option<&Arc<Locked<PropertyDeclarationBlock>>>;
/// Unset the style attribute's dirty bit.
/// Servo doesn't need to manage ditry bit for style attribute.
fn unset_dirty_style_attribute(&self) {
}
/// Get this element's SMIL override declarations.
fn get_smil_override(&self) -> Option<&Arc<Locked<PropertyDeclarationBlock>>> {
None

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

@ -7,6 +7,7 @@ type nsAString_internal = nsAString;
use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue;
use gecko_bindings::structs::mozilla::css::ImageValue;
use gecko_bindings::structs::mozilla::css::URLValue;
use gecko_bindings::structs::mozilla::MallocSizeOf;
use gecko_bindings::structs::mozilla::Side;
use gecko_bindings::structs::RawGeckoAnimationPropertySegment;
use gecko_bindings::structs::RawGeckoComputedTiming;
@ -39,7 +40,6 @@ use gecko_bindings::structs::FontSizePrefs;
use gecko_bindings::structs::GeckoFontMetrics;
use gecko_bindings::structs::IterationCompositeOperation;
use gecko_bindings::structs::Keyframe;
use gecko_bindings::structs::MallocSizeOf;
use gecko_bindings::structs::ServoBundledURI;
use gecko_bindings::structs::ServoElementSnapshot;
use gecko_bindings::structs::ServoElementSnapshotTable;
@ -681,6 +681,9 @@ extern "C" {
RawGeckoElementBorrowed)
-> RawServoDeclarationBlockStrongBorrowedOrNull;
}
extern "C" {
pub fn Gecko_UnsetDirtyStyleAttr(element: RawGeckoElementBorrowed);
}
extern "C" {
pub fn Gecko_GetHTMLPresentationAttrDeclarationBlock(element:
RawGeckoElementBorrowed)
@ -1764,7 +1767,8 @@ extern "C" {
}
extern "C" {
pub fn Servo_StyleSheet_SizeOfIncludingThis(malloc_size_of: MallocSizeOf,
sheet: RawServoStyleSheetBorrowed)
sheet:
RawServoStyleSheetBorrowed)
-> usize;
}
extern "C" {

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -43,6 +43,7 @@ use gecko_bindings::bindings::Gecko_GetStyleAttrDeclarationBlock;
use gecko_bindings::bindings::Gecko_GetStyleContext;
use gecko_bindings::bindings::Gecko_IsSignificantChild;
use gecko_bindings::bindings::Gecko_MatchStringArgPseudo;
use gecko_bindings::bindings::Gecko_UnsetDirtyStyleAttr;
use gecko_bindings::bindings::Gecko_UpdateAnimations;
use gecko_bindings::structs;
use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode};
@ -628,6 +629,14 @@ impl<'le> TElement for GeckoElement<'le> {
declarations.map_or(None, |s| s.as_arc_opt())
}
fn unset_dirty_style_attribute(&self) {
if !self.may_have_style_attribute() {
return;
}
unsafe { Gecko_UnsetDirtyStyleAttr(self.0) };
}
fn get_smil_override(&self) -> Option<&Arc<Locked<PropertyDeclarationBlock>>> {
let declarations = unsafe { Gecko_GetSMILOverrideDeclarationBlock(self.0) };
declarations.map(|s| s.as_arc_opt()).unwrap_or(None)

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

@ -1019,6 +1019,7 @@ pub trait MatchMethods : TElement {
&mut matching_context,
&mut set_selector_flags);
}
self.unset_dirty_style_attribute();
let primary_rule_node = stylist.rule_tree().compute_rule_node(
&mut applicable_declarations,
@ -1253,8 +1254,10 @@ pub trait MatchMethods : TElement {
let mut result = false;
result |= self.replace_rules_internal(replacements, context, data,
CascadeVisitedMode::Unvisited);
result |= self.replace_rules_internal(replacements, context, data,
CascadeVisitedMode::Visited);
if !context.shared.traversal_flags.for_animation_only() {
result |= self.replace_rules_internal(replacements, context, data,
CascadeVisitedMode::Visited);
}
result
}
@ -1301,6 +1304,7 @@ pub trait MatchMethods : TElement {
result |= replace_rule_node(CascadeLevel::StyleAttributeImportant,
style_attribute,
primary_rules);
self.unset_dirty_style_attribute();
}
return result;
}