mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #5857 - Ms2ger:preshints, r=pcwalton
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5857) <!-- Reviewable:end -->
This commit is contained in:
commit
1cb012fc50
6 changed files with 115 additions and 108 deletions
|
@ -27,13 +27,14 @@ use std::slice::Iter;
|
|||
use std::sync::Arc;
|
||||
use std::sync::mpsc::Sender;
|
||||
use string_cache::{Atom, Namespace};
|
||||
use style::node::{TElement, TNode};
|
||||
use style::node::{TElement, TElementAttributes, TNode};
|
||||
use style::properties::{ComputedValues, cascade};
|
||||
use style::selector_matching::{Stylist, DeclarationBlock};
|
||||
use util::arc_ptr_eq;
|
||||
use util::cache::{LRUCache, SimpleHashCache};
|
||||
use util::opts;
|
||||
use util::smallvec::{SmallVec, SmallVec16};
|
||||
use util::vec::ForgetfulSink;
|
||||
|
||||
pub struct ApplicableDeclarations {
|
||||
pub normal: SmallVec16<DeclarationBlock>,
|
||||
|
@ -289,6 +290,12 @@ impl StyleSharingCandidate {
|
|||
return false
|
||||
}
|
||||
|
||||
let mut matching_rules = ForgetfulSink::new();
|
||||
element.synthesize_presentational_hints_for_legacy_attributes(&mut matching_rules);
|
||||
if !matching_rules.is_empty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// FIXME(pcwalton): It's probably faster to iterate over all the element's attributes and
|
||||
// use the {common, rare}-style-affecting-attributes tables as lookup tables.
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ use incremental::RestyleDamage;
|
|||
use data::{LayoutDataAccess, LayoutDataFlags, LayoutDataWrapper, PrivateLayoutData};
|
||||
use opaque_node::OpaqueNodeMethods;
|
||||
|
||||
use cssparser::RGBA;
|
||||
use gfx::display_list::OpaqueNode;
|
||||
use script::dom::bindings::codegen::InheritTypes::{CharacterDataCast, ElementCast};
|
||||
use script::dom::bindings::codegen::InheritTypes::{HTMLIFrameElementCast, HTMLCanvasElementCast};
|
||||
|
@ -70,11 +69,13 @@ use std::sync::mpsc::Sender;
|
|||
use string_cache::{Atom, Namespace};
|
||||
use style::computed_values::content::ContentItem;
|
||||
use style::computed_values::{content, display, white_space};
|
||||
use selectors::matching::DeclarationBlock;
|
||||
use selectors::parser::{NamespaceConstraint, AttrSelector};
|
||||
use style::legacy::{IntegerAttribute, LengthAttribute, SimpleColorAttribute};
|
||||
use selectors::smallvec::VecLike;
|
||||
use style::legacy::{IntegerAttribute, LengthAttribute};
|
||||
use style::legacy::{UnsignedIntegerAttribute};
|
||||
use style::node::{TElement, TElementAttributes, TNode};
|
||||
use style::properties::PropertyDeclarationBlock;
|
||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
|
||||
use url::Url;
|
||||
|
||||
/// Allows some convenience methods on generic layout nodes.
|
||||
|
@ -659,6 +660,14 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
|
|||
}
|
||||
|
||||
impl<'le> TElementAttributes for LayoutElement<'le> {
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(self, hints: &mut V)
|
||||
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>
|
||||
{
|
||||
unsafe {
|
||||
self.element.synthesize_presentational_hints_for_legacy_attributes(hints);
|
||||
}
|
||||
}
|
||||
|
||||
fn get_length_attribute(self, length_attribute: LengthAttribute) -> LengthOrPercentageOrAuto {
|
||||
unsafe {
|
||||
self.element.get_length_attribute_for_layout(length_attribute)
|
||||
|
@ -676,12 +685,6 @@ impl<'le> TElementAttributes for LayoutElement<'le> {
|
|||
self.element.get_unsigned_integer_attribute_for_layout(attribute)
|
||||
}
|
||||
}
|
||||
|
||||
fn get_simple_color_attribute(self, attribute: SimpleColorAttribute) -> Option<RGBA> {
|
||||
unsafe {
|
||||
self.element.get_simple_color_attribute_for_layout(attribute)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_content(content_list: &content::T) -> Vec<ContentItem> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue