зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #19023 - style: Remove PresentationalHintsSynthesizer (from emilio:remove-pres-hints-trait); r=KiChjang
This is not really an useful abstraction, and I never knew how to spell it. Source-Repo: https://github.com/servo/servo Source-Revision: b2867c0afa8bc728c13ddfd56678170dfba98967 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 0cc73981a77aa96cd0ce3486fc82e1f106f37496
This commit is contained in:
Родитель
6926e37396
Коммит
029ecbb951
|
@ -69,7 +69,7 @@ use style::computed_values::display;
|
|||
use style::context::SharedStyleContext;
|
||||
use style::data::ElementData;
|
||||
use style::dom::{DomChildren, LayoutIterator, NodeInfo, OpaqueNode};
|
||||
use style::dom::{PresentationalHintsSynthesizer, TElement, TNode};
|
||||
use style::dom::{TElement, TNode};
|
||||
use style::element_state::*;
|
||||
use style::font_metrics::ServoMetricsProvider;
|
||||
use style::properties::{ComputedValues, PropertyDeclarationBlock};
|
||||
|
@ -338,18 +338,6 @@ impl<'le> fmt::Debug for ServoLayoutElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'le> PresentationalHintsSynthesizer for ServoLayoutElement<'le> {
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self,
|
||||
_visited_handling: VisitedHandlingMode,
|
||||
hints: &mut V)
|
||||
where V: Push<ApplicableDeclarationBlock>
|
||||
{
|
||||
unsafe {
|
||||
self.element.synthesize_presentational_hints_for_legacy_attributes(hints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'le> TElement for ServoLayoutElement<'le> {
|
||||
type ConcreteNode = ServoLayoutNode<'le>;
|
||||
type TraversalChildrenIterator = DomChildren<Self::ConcreteNode>;
|
||||
|
@ -520,6 +508,19 @@ impl<'le> TElement for ServoLayoutElement<'le> {
|
|||
// FIXME(emilio): We should be able to give the right answer though!
|
||||
false
|
||||
}
|
||||
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(
|
||||
&self,
|
||||
_visited_handling: VisitedHandlingMode,
|
||||
hints: &mut V,
|
||||
)
|
||||
where
|
||||
V: Push<ApplicableDeclarationBlock>,
|
||||
{
|
||||
unsafe {
|
||||
self.element.synthesize_presentational_hints_for_legacy_attributes(hints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'le> PartialEq for ServoLayoutElement<'le> {
|
||||
|
@ -1245,10 +1246,3 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
|
|||
false
|
||||
}
|
||||
}
|
||||
|
||||
impl<'le> PresentationalHintsSynthesizer for ServoThreadSafeLayoutElement<'le> {
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self,
|
||||
_visited_handling: VisitedHandlingMode,
|
||||
_hints: &mut V)
|
||||
where V: Push<ApplicableDeclarationBlock> {}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ use style::attr::AttrValue;
|
|||
use style::computed_values::display;
|
||||
use style::context::SharedStyleContext;
|
||||
use style::data::ElementData;
|
||||
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthesizer, TNode};
|
||||
use style::dom::{LayoutIterator, NodeInfo, TNode};
|
||||
use style::dom::OpaqueNode;
|
||||
use style::font_metrics::ServoMetricsProvider;
|
||||
use style::properties::{CascadeFlags, ComputedValues};
|
||||
|
@ -290,10 +290,14 @@ pub trait DangerousThreadSafeLayoutNode: ThreadSafeLayoutNode {
|
|||
unsafe fn dangerous_next_sibling(&self) -> Option<Self>;
|
||||
}
|
||||
|
||||
pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
||||
::selectors::Element<Impl=SelectorImpl> +
|
||||
GetLayoutData +
|
||||
PresentationalHintsSynthesizer {
|
||||
pub trait ThreadSafeLayoutElement
|
||||
: Clone
|
||||
+ Copy
|
||||
+ Sized
|
||||
+ Debug
|
||||
+ ::selectors::Element<Impl=SelectorImpl>
|
||||
+ GetLayoutData
|
||||
{
|
||||
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<ConcreteThreadSafeLayoutElement = Self>;
|
||||
|
||||
fn as_node(&self) -> Self::ConcreteThreadSafeLayoutNode;
|
||||
|
|
|
@ -311,16 +311,6 @@ fn fmt_subtree<F, N: TNode>(f: &mut fmt::Formatter, stringify: &F, n: N, indent:
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// A trait used to synthesize presentational hints for HTML element attributes.
|
||||
pub trait PresentationalHintsSynthesizer {
|
||||
/// Generate the proper applicable declarations due to presentational hints,
|
||||
/// and insert them into `hints`.
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self,
|
||||
visited_handling: VisitedHandlingMode,
|
||||
hints: &mut V)
|
||||
where V: Push<ApplicableDeclarationBlock>;
|
||||
}
|
||||
|
||||
/// The element trait, the main abstraction the style crate acts over.
|
||||
pub trait TElement
|
||||
: Eq
|
||||
|
@ -331,7 +321,6 @@ pub trait TElement
|
|||
+ Copy
|
||||
+ Clone
|
||||
+ SelectorsElement<Impl = SelectorImpl>
|
||||
+ PresentationalHintsSynthesizer
|
||||
{
|
||||
/// The concrete node type.
|
||||
type ConcreteNode: TNode<ConcreteElement = Self>;
|
||||
|
@ -808,6 +797,16 @@ pub trait TElement
|
|||
/// Returns whether this element is the main body element of the HTML
|
||||
/// document it is on.
|
||||
fn is_html_document_body_element(&self) -> bool;
|
||||
|
||||
/// Generate the proper applicable declarations due to presentational hints,
|
||||
/// and insert them into `hints`.
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(
|
||||
&self,
|
||||
visited_handling: VisitedHandlingMode,
|
||||
hints: &mut V,
|
||||
)
|
||||
where
|
||||
V: Push<ApplicableDeclarationBlock>;
|
||||
}
|
||||
|
||||
/// TNode and TElement aren't Send because we want to be careful and explicit
|
||||
|
|
|
@ -20,8 +20,7 @@ use applicable_declarations::ApplicableDeclarationBlock;
|
|||
use atomic_refcell::{AtomicRefCell, AtomicRef, AtomicRefMut};
|
||||
use context::{QuirksMode, SharedStyleContext, PostAnimationTasks, UpdateAnimationsTasks};
|
||||
use data::ElementData;
|
||||
use dom::{LayoutIterator, NodeInfo, TElement, TNode};
|
||||
use dom::{OpaqueNode, PresentationalHintsSynthesizer};
|
||||
use dom::{LayoutIterator, NodeInfo, OpaqueNode, TElement, TNode};
|
||||
use element_state::{ElementState, DocumentState, NS_DOCUMENT_STATE_WINDOW_INACTIVE};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult};
|
||||
|
@ -1526,23 +1525,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
|
||||
unsafe { bindings::Gecko_IsDocumentBody(self.0) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'le> PartialEq for GeckoElement<'le> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.0 as *const _ == other.0 as *const _
|
||||
}
|
||||
}
|
||||
|
||||
impl<'le> Eq for GeckoElement<'le> {}
|
||||
|
||||
impl<'le> Hash for GeckoElement<'le> {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
(self.0 as *const _).hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(
|
||||
&self,
|
||||
visited_handling: VisitedHandlingMode,
|
||||
|
@ -1690,6 +1673,20 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'le> PartialEq for GeckoElement<'le> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.0 as *const _ == other.0 as *const _
|
||||
}
|
||||
}
|
||||
|
||||
impl<'le> Eq for GeckoElement<'le> {}
|
||||
|
||||
impl<'le> Hash for GeckoElement<'le> {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
(self.0 as *const _).hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||
type Impl = SelectorImpl;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче