aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/wrapper.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout/wrapper.rs')
-rw-r--r--components/layout/wrapper.rs43
1 files changed, 40 insertions, 3 deletions
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index 9a70539c78b..97aa8dd189a 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -36,6 +36,7 @@ use incremental::RestyleDamage;
use util::{LayoutDataAccess, LayoutDataFlags, LayoutDataWrapper, OpaqueNodeMethods};
use util::{PrivateLayoutData};
+use cssparser::RGBA;
use gfx::display_list::OpaqueNode;
use script::dom::bindings::codegen::InheritTypes::{ElementCast, HTMLIFrameElementCast};
use script::dom::bindings::codegen::InheritTypes::{HTMLImageElementCast, HTMLInputElementCast};
@@ -56,11 +57,12 @@ use servo_msg::constellation_msg::{PipelineId, SubpageId};
use servo_util::str::{LengthOrPercentageOrAuto, is_whitespace};
use std::kinds::marker::ContravariantLifetime;
use std::mem;
+use string_cache::{Atom, Namespace};
use style::computed_values::{content, display, white_space};
-use style::{AnyNamespace, AttrSelector, IntegerAttribute, LengthAttribute};
-use style::{PropertyDeclarationBlock, SpecificNamespace, TElement, TElementAttributes, TNode};
+use style::{AnyNamespace, AttrSelector, BorderUnsignedIntegerAttribute, IntegerAttribute};
+use style::{LengthAttribute, PropertyDeclarationBlock, SimpleColorAttribute, SpecificNamespace};
+use style::{TElement, TElementAttributes, TNode, UnsignedIntegerAttribute};
use url::Url;
-use string_cache::{Atom, Namespace};
use std::cell::{Ref, RefMut};
@@ -580,6 +582,17 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
}
}
}
+
+ #[inline]
+ fn has_nonzero_border(self) -> bool {
+ unsafe {
+ match self.element
+ .get_unsigned_integer_attribute_for_layout(BorderUnsignedIntegerAttribute) {
+ None | Some(0) => false,
+ _ => true,
+ }
+ }
+ }
}
impl<'le> TElementAttributes for LayoutElement<'le> {
@@ -594,6 +607,18 @@ impl<'le> TElementAttributes for LayoutElement<'le> {
self.element.get_integer_attribute_for_layout(integer_attribute)
}
}
+
+ fn get_unsigned_integer_attribute(self, attribute: UnsignedIntegerAttribute) -> Option<u32> {
+ unsafe {
+ 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) -> String {
@@ -913,6 +938,18 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
}
}
+ pub fn get_unsigned_integer_attribute(self, attribute: UnsignedIntegerAttribute)
+ -> Option<u32> {
+ unsafe {
+ match ElementCast::to_js(self.get_jsmanaged()) {
+ Some(element) => {
+ (*element.unsafe_get()).get_unsigned_integer_attribute_for_layout(attribute)
+ }
+ None => panic!("not an element!")
+ }
+ }
+ }
+
/// Get the description of how to account for recent style changes.
/// This is a simple bitfield and fine to copy by value.
pub fn restyle_damage(self) -> RestyleDamage {