Move LengthOrPercentageOrAuto to style::attr.

This commit is contained in:
Ms2ger 2016-06-05 13:11:33 +02:00
parent 1bc94c132e
commit 06a1d04ca6
10 changed files with 17 additions and 21 deletions

View file

@ -83,7 +83,7 @@ use std::sync::atomic::{AtomicBool, AtomicUsize};
use std::sync::mpsc::{Receiver, Sender};
use std::time::SystemTime;
use string_cache::{Atom, Namespace, QualName};
use style::attr::{AttrIdentifier, AttrValue};
use style::attr::{AttrIdentifier, AttrValue, LengthOrPercentageOrAuto};
use style::element_state::*;
use style::properties::PropertyDeclarationBlock;
use style::restyle_hints::ElementSnapshot;
@ -91,7 +91,6 @@ use style::selector_impl::PseudoElement;
use style::values::specified::Length;
use url::Origin as UrlOrigin;
use url::Url;
use util::str::LengthOrPercentageOrAuto;
use uuid::Uuid;
use webrender_traits::WebGLError;

View file

@ -85,6 +85,7 @@ use std::mem;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace, QualName};
use style::attr::LengthOrPercentageOrAuto;
use style::element_state::*;
use style::parser::ParserContextExtraData;
use style::properties::DeclaredValue;
@ -93,7 +94,6 @@ use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_sty
use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl};
use style::values::CSSFloat;
use style::values::specified::{self, CSSColor, CSSRGBA, LengthOrPercentage};
use util::str::LengthOrPercentageOrAuto;
// TODO: Update focus state when the top-level browsing context gains or loses system focus,
// and when the element enters or leaves a browsing context container.

View file

@ -14,7 +14,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
use util::str::LengthOrPercentageOrAuto;
use style::attr::LengthOrPercentageOrAuto;
#[dom_struct]
pub struct HTMLHRElement {

View file

@ -42,10 +42,10 @@ use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg};
use std::cell::Cell;
use string_cache::Atom;
use style::attr::LengthOrPercentageOrAuto;
use style::context::ReflowGoal;
use url::Url;
use util::prefs::mozbrowser_enabled;
use util::str::LengthOrPercentageOrAuto;
#[derive(HeapSizeOf)]
enum SandboxAllowance {

View file

@ -31,8 +31,8 @@ use script_runtime::ScriptThreadEventCategory::UpdateReplacedElement;
use script_thread::Runnable;
use std::sync::Arc;
use string_cache::Atom;
use style::attr::LengthOrPercentageOrAuto;
use url::Url;
use util::str::LengthOrPercentageOrAuto;
#[derive(JSTraceable, HeapSizeOf)]
#[allow(dead_code)]

View file

@ -16,7 +16,7 @@ use dom::htmltablerowelement::HTMLTableRowElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
use util::str::LengthOrPercentageOrAuto;
use style::attr::LengthOrPercentageOrAuto;
const DEFAULT_COLSPAN: u32 = 1;

View file

@ -24,8 +24,7 @@ use dom::node::{Node, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use std::cell::Cell;
use string_cache::Atom;
use style::attr::parse_unsigned_integer;
use util::str::LengthOrPercentageOrAuto;
use style::attr::{LengthOrPercentageOrAuto, parse_unsigned_integer};
#[dom_struct]
pub struct HTMLTableElement {

View file

@ -10,13 +10,20 @@ use std::ascii::AsciiExt;
use std::str::FromStr;
use string_cache::{Atom, Namespace};
use url::Url;
use util::str::{LengthOrPercentageOrAuto, HTML_SPACE_CHARACTERS};
use util::str::{read_exponent, read_fraction, read_numbers, split_commas, split_html_space_chars};
use util::str::{HTML_SPACE_CHARACTERS, read_exponent, read_fraction};
use util::str::{read_numbers, split_commas, split_html_space_chars};
use values::specified::Length;
// Duplicated from script::dom::values.
const UNSIGNED_LONG_MAX: u32 = 2147483647;
#[derive(Clone, Copy, Debug, HeapSizeOf, PartialEq)]
pub enum LengthOrPercentageOrAuto {
Auto,
Percentage(f32),
Length(Au),
}
#[derive(PartialEq, Clone, HeapSizeOf)]
pub enum AttrValue {
String(String),

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use app_units::Au;
use num_traits::ToPrimitive;
use std::convert::AsRef;
use std::iter::{Filter, Peekable};
@ -118,13 +117,6 @@ pub fn read_exponent<I: Iterator<Item=char>>(mut iter: Peekable<I>) -> Option<i3
}
}
#[derive(Clone, Copy, Debug, HeapSizeOf, PartialEq)]
pub enum LengthOrPercentageOrAuto {
Auto,
Percentage(f32),
Length(Au),
}
#[derive(Clone, Eq, PartialEq, Hash, Debug, Deserialize, Serialize)]
pub struct LowercaseString {
inner: String,

View file

@ -3,8 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use app_units::Au;
use style::attr::{AttrValue, parse_length};
use util::str::LengthOrPercentageOrAuto;
use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_length};
#[test]
fn test_parse_double() {