mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #16785 - aethanyc:fix-typo-and-simplify, r=mbrubeck
Fix typo and simplify for PresentationalHintsSynthesizer <!-- 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 only affects build. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16785) <!-- Reviewable:end -->
This commit is contained in:
commit
48fdda3f07
5 changed files with 13 additions and 18 deletions
|
@ -66,7 +66,7 @@ use style::computed_values::display;
|
||||||
use style::context::{QuirksMode, SharedStyleContext};
|
use style::context::{QuirksMode, SharedStyleContext};
|
||||||
use style::data::ElementData;
|
use style::data::ElementData;
|
||||||
use style::dom::{DescendantsBit, DirtyDescendants, LayoutIterator, NodeInfo, OpaqueNode};
|
use style::dom::{DescendantsBit, DirtyDescendants, LayoutIterator, NodeInfo, OpaqueNode};
|
||||||
use style::dom::{PresentationalHintsSynthetizer, TElement, TNode, UnsafeNode};
|
use style::dom::{PresentationalHintsSynthesizer, TElement, TNode, UnsafeNode};
|
||||||
use style::element_state::*;
|
use style::element_state::*;
|
||||||
use style::font_metrics::ServoMetricsProvider;
|
use style::font_metrics::ServoMetricsProvider;
|
||||||
use style::properties::{ComputedValues, PropertyDeclarationBlock};
|
use style::properties::{ComputedValues, PropertyDeclarationBlock};
|
||||||
|
@ -363,7 +363,7 @@ impl<'le> fmt::Debug for ServoLayoutElement<'le> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le> PresentationalHintsSynthetizer for ServoLayoutElement<'le> {
|
impl<'le> PresentationalHintsSynthesizer for ServoLayoutElement<'le> {
|
||||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
|
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
|
||||||
where V: Push<ApplicableDeclarationBlock>
|
where V: Push<ApplicableDeclarationBlock>
|
||||||
{
|
{
|
||||||
|
@ -1183,7 +1183,7 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le> PresentationalHintsSynthetizer for ServoThreadSafeLayoutElement<'le> {
|
impl<'le> PresentationalHintsSynthesizer for ServoThreadSafeLayoutElement<'le> {
|
||||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, _hints: &mut V)
|
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, _hints: &mut V)
|
||||||
where V: Push<ApplicableDeclarationBlock> {}
|
where V: Push<ApplicableDeclarationBlock> {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ use std::fmt::Debug;
|
||||||
use style::computed_values::display;
|
use style::computed_values::display;
|
||||||
use style::context::SharedStyleContext;
|
use style::context::SharedStyleContext;
|
||||||
use style::data::ElementData;
|
use style::data::ElementData;
|
||||||
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TNode};
|
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthesizer, TNode};
|
||||||
use style::dom::OpaqueNode;
|
use style::dom::OpaqueNode;
|
||||||
use style::font_metrics::ServoMetricsProvider;
|
use style::font_metrics::ServoMetricsProvider;
|
||||||
use style::properties::{CascadeFlags, ServoComputedValues};
|
use style::properties::{CascadeFlags, ServoComputedValues};
|
||||||
|
@ -306,7 +306,7 @@ pub trait DangerousThreadSafeLayoutNode: ThreadSafeLayoutNode {
|
||||||
pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
||||||
::selectors::Element<Impl=SelectorImpl> +
|
::selectors::Element<Impl=SelectorImpl> +
|
||||||
GetLayoutData +
|
GetLayoutData +
|
||||||
PresentationalHintsSynthetizer {
|
PresentationalHintsSynthesizer {
|
||||||
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<ConcreteThreadSafeLayoutElement = Self>;
|
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<ConcreteThreadSafeLayoutElement = Self>;
|
||||||
|
|
||||||
fn as_node(&self) -> Self::ConcreteThreadSafeLayoutNode;
|
fn as_node(&self) -> Self::ConcreteThreadSafeLayoutNode;
|
||||||
|
|
|
@ -267,7 +267,7 @@ pub unsafe fn raw_note_descendants<E, B>(element: E) -> bool
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A trait used to synthesize presentational hints for HTML element attributes.
|
/// A trait used to synthesize presentational hints for HTML element attributes.
|
||||||
pub trait PresentationalHintsSynthetizer {
|
pub trait PresentationalHintsSynthesizer {
|
||||||
/// Generate the proper applicable declarations due to presentational hints,
|
/// Generate the proper applicable declarations due to presentational hints,
|
||||||
/// and insert them into `hints`.
|
/// and insert them into `hints`.
|
||||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
|
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
|
||||||
|
@ -290,7 +290,7 @@ impl AnimationRules {
|
||||||
|
|
||||||
/// The element trait, the main abstraction the style crate acts over.
|
/// The element trait, the main abstraction the style crate acts over.
|
||||||
pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
|
pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
|
||||||
ElementExt + PresentationalHintsSynthetizer {
|
ElementExt + PresentationalHintsSynthesizer {
|
||||||
/// The concrete node type.
|
/// The concrete node type.
|
||||||
type ConcreteNode: TNode<ConcreteElement = Self>;
|
type ConcreteNode: TNode<ConcreteElement = Self>;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ use atomic_refcell::AtomicRefCell;
|
||||||
use context::{QuirksMode, SharedStyleContext, UpdateAnimationsTasks};
|
use context::{QuirksMode, SharedStyleContext, UpdateAnimationsTasks};
|
||||||
use data::ElementData;
|
use data::ElementData;
|
||||||
use dom::{self, AnimationRules, DescendantsBit, LayoutIterator, NodeInfo, TElement, TNode, UnsafeNode};
|
use dom::{self, AnimationRules, DescendantsBit, LayoutIterator, NodeInfo, TElement, TNode, UnsafeNode};
|
||||||
use dom::{OpaqueNode, PresentationalHintsSynthetizer};
|
use dom::{OpaqueNode, PresentationalHintsSynthesizer};
|
||||||
use element_state::ElementState;
|
use element_state::ElementState;
|
||||||
use error_reporting::RustLogReporter;
|
use error_reporting::RustLogReporter;
|
||||||
use font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult};
|
use font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult};
|
||||||
|
@ -932,7 +932,7 @@ impl<'le> Hash for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le> PresentationalHintsSynthetizer for GeckoElement<'le> {
|
impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
|
||||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
|
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
|
||||||
where V: Push<ApplicableDeclarationBlock>,
|
where V: Push<ApplicableDeclarationBlock>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ use {Atom, LocalName};
|
||||||
use bit_vec::BitVec;
|
use bit_vec::BitVec;
|
||||||
use context::QuirksMode;
|
use context::QuirksMode;
|
||||||
use data::ComputedStyle;
|
use data::ComputedStyle;
|
||||||
use dom::{AnimationRules, PresentationalHintsSynthetizer, TElement};
|
use dom::{AnimationRules, TElement};
|
||||||
use error_reporting::RustLogReporter;
|
use error_reporting::RustLogReporter;
|
||||||
use font_metrics::FontMetricsProvider;
|
use font_metrics::FontMetricsProvider;
|
||||||
use keyframes::KeyframesAnimation;
|
use keyframes::KeyframesAnimation;
|
||||||
|
@ -35,7 +35,6 @@ use sink::Push;
|
||||||
use smallvec::VecLike;
|
use smallvec::VecLike;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt;
|
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
@ -542,9 +541,7 @@ impl Stylist {
|
||||||
parent: &Arc<ComputedValues>,
|
parent: &Arc<ComputedValues>,
|
||||||
font_metrics: &FontMetricsProvider)
|
font_metrics: &FontMetricsProvider)
|
||||||
-> Option<ComputedStyle>
|
-> Option<ComputedStyle>
|
||||||
where E: TElement +
|
where E: TElement,
|
||||||
fmt::Debug +
|
|
||||||
PresentationalHintsSynthetizer
|
|
||||||
{
|
{
|
||||||
let rule_node = match self.lazy_pseudo_rules(guards, element, pseudo) {
|
let rule_node = match self.lazy_pseudo_rules(guards, element, pseudo) {
|
||||||
Some(rule_node) => rule_node,
|
Some(rule_node) => rule_node,
|
||||||
|
@ -579,7 +576,7 @@ impl Stylist {
|
||||||
element: &E,
|
element: &E,
|
||||||
pseudo: &PseudoElement)
|
pseudo: &PseudoElement)
|
||||||
-> Option<StrongRuleNode>
|
-> Option<StrongRuleNode>
|
||||||
where E: TElement + fmt::Debug + PresentationalHintsSynthetizer
|
where E: TElement
|
||||||
{
|
{
|
||||||
debug_assert!(pseudo.is_lazy());
|
debug_assert!(pseudo.is_lazy());
|
||||||
if self.pseudos_map.get(pseudo).is_none() {
|
if self.pseudos_map.get(pseudo).is_none() {
|
||||||
|
@ -743,9 +740,7 @@ impl Stylist {
|
||||||
applicable_declarations: &mut V,
|
applicable_declarations: &mut V,
|
||||||
flags_setter: &mut F)
|
flags_setter: &mut F)
|
||||||
-> StyleRelations
|
-> StyleRelations
|
||||||
where E: TElement +
|
where E: TElement,
|
||||||
fmt::Debug +
|
|
||||||
PresentationalHintsSynthetizer,
|
|
||||||
V: Push<ApplicableDeclarationBlock> + VecLike<ApplicableDeclarationBlock>,
|
V: Push<ApplicableDeclarationBlock> + VecLike<ApplicableDeclarationBlock>,
|
||||||
F: FnMut(&E, ElementSelectorFlags),
|
F: FnMut(&E, ElementSelectorFlags),
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue