mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Bump bitflags to 1.0 in every servo crate
This commit is contained in:
parent
b6475cf433
commit
29b4eec141
131 changed files with 1591 additions and 1580 deletions
42
Cargo.lock
generated
42
Cargo.lock
generated
|
@ -1,13 +1,3 @@
|
|||
[root]
|
||||
name = "webvr_traits"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"rust-webvr-api 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler32"
|
||||
version = "1.0.0"
|
||||
|
@ -210,7 +200,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
name = "bluetooth"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bluetooth_traits 0.0.1",
|
||||
"device 0.0.1 (git+https://github.com/servo/devices)",
|
||||
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -717,7 +707,7 @@ dependencies = [
|
|||
name = "devtools_traits"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper_serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1091,7 +1081,7 @@ name = "gfx"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1190,7 +1180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
name = "glutin_app"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"compositing 0.0.1",
|
||||
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1520,7 +1510,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"canvas_traits 0.0.1",
|
||||
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1932,7 +1922,7 @@ dependencies = [
|
|||
name = "msg"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
"malloc_size_of_derive 0.0.1",
|
||||
"nonzero 0.0.1",
|
||||
|
@ -2086,7 +2076,7 @@ dependencies = [
|
|||
name = "nsstring"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2607,7 +2597,7 @@ dependencies = [
|
|||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audio-video-metadata 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bluetooth_traits 0.0.1",
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"canvas_traits 0.0.1",
|
||||
|
@ -2762,7 +2752,7 @@ dependencies = [
|
|||
name = "selectors"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3162,7 +3152,7 @@ dependencies = [
|
|||
"arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.29.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3245,7 +3235,7 @@ name = "style_traits"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
|
@ -3683,6 +3673,16 @@ dependencies = [
|
|||
"webvr_traits 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webvr_traits"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"ipc-channel 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"rust-webvr-api 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
|
|
|
@ -10,7 +10,7 @@ name = "bluetooth"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "0.7"
|
||||
bitflags = "1.0"
|
||||
bluetooth_traits = {path = "../bluetooth_traits"}
|
||||
device = {git = "https://github.com/servo/devices", features = ["bluetooth-test"]}
|
||||
ipc-channel = "0.9"
|
||||
|
|
|
@ -47,16 +47,16 @@ const DIALOG_COLUMN_ID: &'static str = "Id";
|
|||
const DIALOG_COLUMN_NAME: &'static str = "Name";
|
||||
|
||||
bitflags! {
|
||||
flags Flags: u32 {
|
||||
const BROADCAST = 0b000000001,
|
||||
const READ = 0b000000010,
|
||||
const WRITE_WITHOUT_RESPONSE = 0b000000100,
|
||||
const WRITE = 0b000001000,
|
||||
const NOTIFY = 0b000010000,
|
||||
const INDICATE = 0b000100000,
|
||||
const AUTHENTICATED_SIGNED_WRITES = 0b001000000,
|
||||
const RELIABLE_WRITE = 0b010000000,
|
||||
const WRITABLE_AUXILIARIES = 0b100000000,
|
||||
struct Flags: u32 {
|
||||
const BROADCAST = 0b000000001;
|
||||
const READ = 0b000000010;
|
||||
const WRITE_WITHOUT_RESPONSE = 0b000000100;
|
||||
const WRITE = 0b000001000;
|
||||
const NOTIFY = 0b000010000;
|
||||
const INDICATE = 0b000100000;
|
||||
const AUTHENTICATED_SIGNED_WRITES = 0b001000000;
|
||||
const RELIABLE_WRITE = 0b010000000;
|
||||
const WRITABLE_AUXILIARIES = 0b100000000;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,15 +507,15 @@ impl BluetoothManager {
|
|||
let flags = characteristic.get_flags().unwrap_or(vec!());
|
||||
for flag in flags {
|
||||
match flag.as_ref() {
|
||||
"broadcast" => props.insert(BROADCAST),
|
||||
"read" => props.insert(READ),
|
||||
"write-without-response" => props.insert(WRITE_WITHOUT_RESPONSE),
|
||||
"write" => props.insert(WRITE),
|
||||
"notify" => props.insert(NOTIFY),
|
||||
"indicate" => props.insert(INDICATE),
|
||||
"authenticated-signed-writes" => props.insert(AUTHENTICATED_SIGNED_WRITES),
|
||||
"reliable-write" => props.insert(RELIABLE_WRITE),
|
||||
"writable-auxiliaries" => props.insert(WRITABLE_AUXILIARIES),
|
||||
"broadcast" => props.insert(Flags::BROADCAST),
|
||||
"read" => props.insert(Flags::READ),
|
||||
"write-without-response" => props.insert(Flags::WRITE_WITHOUT_RESPONSE),
|
||||
"write" => props.insert(Flags::WRITE),
|
||||
"notify" => props.insert(Flags::NOTIFY),
|
||||
"indicate" => props.insert(Flags::INDICATE),
|
||||
"authenticated-signed-writes" => props.insert(Flags::AUTHENTICATED_SIGNED_WRITES),
|
||||
"reliable-write" => props.insert(Flags::RELIABLE_WRITE),
|
||||
"writable-auxiliaries" => props.insert(Flags::WRITABLE_AUXILIARIES),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
@ -729,15 +729,15 @@ impl BluetoothManager {
|
|||
BluetoothCharacteristicMsg {
|
||||
uuid: uuid,
|
||||
instance_id: characteristic.get_id(),
|
||||
broadcast: properties.contains(BROADCAST),
|
||||
read: properties.contains(READ),
|
||||
write_without_response: properties.contains(WRITE_WITHOUT_RESPONSE),
|
||||
write: properties.contains(WRITE),
|
||||
notify: properties.contains(NOTIFY),
|
||||
indicate: properties.contains(INDICATE),
|
||||
authenticated_signed_writes: properties.contains(AUTHENTICATED_SIGNED_WRITES),
|
||||
reliable_write: properties.contains(RELIABLE_WRITE),
|
||||
writable_auxiliaries: properties.contains(WRITABLE_AUXILIARIES),
|
||||
broadcast: properties.contains(Flags::BROADCAST),
|
||||
read: properties.contains(Flags::READ),
|
||||
write_without_response: properties.contains(Flags::WRITE_WITHOUT_RESPONSE),
|
||||
write: properties.contains(Flags::WRITE),
|
||||
notify: properties.contains(Flags::NOTIFY),
|
||||
indicate: properties.contains(Flags::INDICATE),
|
||||
authenticated_signed_writes: properties.contains(Flags::AUTHENTICATED_SIGNED_WRITES),
|
||||
reliable_write: properties.contains(Flags::RELIABLE_WRITE),
|
||||
writable_auxiliaries: properties.contains(Flags::WRITABLE_AUXILIARIES),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
use actor::{Actor, ActorMessageStatus, ActorRegistry};
|
||||
use actors::object::ObjectActor;
|
||||
use devtools_traits::{CONSOLE_API, CachedConsoleMessageTypes, DevtoolScriptControlMsg, PAGE_ERROR};
|
||||
use devtools_traits::{CachedConsoleMessageTypes, DevtoolScriptControlMsg};
|
||||
use devtools_traits::CachedConsoleMessage;
|
||||
use devtools_traits::EvaluateJSReply::{ActorValue, BooleanValue, StringValue};
|
||||
use devtools_traits::EvaluateJSReply::{NullValue, NumberValue, VoidValue};
|
||||
|
@ -107,8 +107,8 @@ impl Actor for ConsoleActor {
|
|||
let mut message_types = CachedConsoleMessageTypes::empty();
|
||||
for str_type in str_types {
|
||||
match str_type {
|
||||
"PageError" => message_types.insert(PAGE_ERROR),
|
||||
"ConsoleAPI" => message_types.insert(CONSOLE_API),
|
||||
"PageError" => message_types.insert(CachedConsoleMessageTypes::PAGE_ERROR),
|
||||
"ConsoleAPI" => message_types.insert(CachedConsoleMessageTypes::CONSOLE_API),
|
||||
s => debug!("unrecognized message type requested: \"{}\"", s),
|
||||
};
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ name = "devtools_traits"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "0.7"
|
||||
bitflags = "1.0"
|
||||
hyper = "0.10"
|
||||
hyper_serde = "0.7"
|
||||
ipc-channel = "0.9"
|
||||
|
|
|
@ -243,9 +243,9 @@ pub struct ConsoleMessage {
|
|||
|
||||
bitflags! {
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub flags CachedConsoleMessageTypes: u8 {
|
||||
const PAGE_ERROR = 1 << 0,
|
||||
const CONSOLE_API = 1 << 1,
|
||||
pub struct CachedConsoleMessageTypes: u8 {
|
||||
const PAGE_ERROR = 1 << 0;
|
||||
const CONSOLE_API = 1 << 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ unstable = ["simd"]
|
|||
|
||||
[dependencies]
|
||||
app_units = "0.5"
|
||||
bitflags = "0.7"
|
||||
bitflags = "1.0"
|
||||
euclid = "0.15"
|
||||
fnv = "1.0"
|
||||
fontsan = {git = "https://github.com/servo/fontsan"}
|
||||
|
|
|
@ -139,17 +139,17 @@ impl Font {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
pub flags ShapingFlags: u8 {
|
||||
pub struct ShapingFlags: u8 {
|
||||
#[doc = "Set if the text is entirely whitespace."]
|
||||
const IS_WHITESPACE_SHAPING_FLAG = 0x01,
|
||||
const IS_WHITESPACE_SHAPING_FLAG = 0x01;
|
||||
#[doc = "Set if we are to ignore ligatures."]
|
||||
const IGNORE_LIGATURES_SHAPING_FLAG = 0x02,
|
||||
const IGNORE_LIGATURES_SHAPING_FLAG = 0x02;
|
||||
#[doc = "Set if we are to disable kerning."]
|
||||
const DISABLE_KERNING_SHAPING_FLAG = 0x04,
|
||||
const DISABLE_KERNING_SHAPING_FLAG = 0x04;
|
||||
#[doc = "Text direction is right-to-left."]
|
||||
const RTL_FLAG = 0x08,
|
||||
const RTL_FLAG = 0x08;
|
||||
#[doc = "Set if word-break is set to keep-all."]
|
||||
const KEEP_ALL_FLAG = 0x10,
|
||||
const KEEP_ALL_FLAG = 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,8 +186,8 @@ impl Font {
|
|||
let result = self.shape_cache.borrow_mut().entry(lookup_key).or_insert_with(|| {
|
||||
let start_time = time::precise_time_ns();
|
||||
let mut glyphs = GlyphStore::new(text.len(),
|
||||
options.flags.contains(IS_WHITESPACE_SHAPING_FLAG),
|
||||
options.flags.contains(RTL_FLAG));
|
||||
options.flags.contains(ShapingFlags::IS_WHITESPACE_SHAPING_FLAG),
|
||||
options.flags.contains(ShapingFlags::RTL_FLAG));
|
||||
|
||||
if self.can_do_fast_shaping(text, options) {
|
||||
debug!("shape_text: Using ASCII fast path.");
|
||||
|
@ -211,7 +211,7 @@ impl Font {
|
|||
|
||||
fn can_do_fast_shaping(&self, text: &str, options: &ShapingOptions) -> bool {
|
||||
options.script == Script::Latin &&
|
||||
!options.flags.contains(RTL_FLAG) &&
|
||||
!options.flags.contains(ShapingFlags::RTL_FLAG) &&
|
||||
self.handle.can_do_fast_shaping() &&
|
||||
text.is_ascii()
|
||||
}
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use euclid::Point2D;
|
||||
use font::{DISABLE_KERNING_SHAPING_FLAG, Font, FontTableMethods, FontTableTag};
|
||||
use font::{IGNORE_LIGATURES_SHAPING_FLAG, KERN, RTL_FLAG, ShapingOptions};
|
||||
use font::{ShapingFlags, Font, FontTableMethods, FontTableTag, ShapingOptions, KERN};
|
||||
use harfbuzz::{HB_DIRECTION_LTR, HB_DIRECTION_RTL, HB_MEMORY_MODE_READONLY};
|
||||
use harfbuzz::{hb_blob_create, hb_face_create_for_tables};
|
||||
use harfbuzz::{hb_buffer_create, hb_font_destroy};
|
||||
|
@ -189,7 +188,7 @@ impl ShaperMethods for Shaper {
|
|||
fn shape_text(&self, text: &str, options: &ShapingOptions, glyphs: &mut GlyphStore) {
|
||||
unsafe {
|
||||
let hb_buffer: *mut hb_buffer_t = hb_buffer_create();
|
||||
hb_buffer_set_direction(hb_buffer, if options.flags.contains(RTL_FLAG) {
|
||||
hb_buffer_set_direction(hb_buffer, if options.flags.contains(ShapingFlags::RTL_FLAG) {
|
||||
HB_DIRECTION_RTL
|
||||
} else {
|
||||
HB_DIRECTION_LTR
|
||||
|
@ -204,7 +203,7 @@ impl ShaperMethods for Shaper {
|
|||
text.len() as c_int);
|
||||
|
||||
let mut features = Vec::new();
|
||||
if options.flags.contains(IGNORE_LIGATURES_SHAPING_FLAG) {
|
||||
if options.flags.contains(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG) {
|
||||
features.push(hb_feature_t {
|
||||
tag: LIGA,
|
||||
value: 0,
|
||||
|
@ -212,7 +211,7 @@ impl ShaperMethods for Shaper {
|
|||
end: hb_buffer_get_length(hb_buffer),
|
||||
})
|
||||
}
|
||||
if options.flags.contains(DISABLE_KERNING_SHAPING_FLAG) {
|
||||
if options.flags.contains(ShapingFlags::DISABLE_KERNING_SHAPING_FLAG) {
|
||||
features.push(hb_feature_t {
|
||||
tag: KERN,
|
||||
value: 0,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use font::{Font, FontHandleMethods, FontMetrics, IS_WHITESPACE_SHAPING_FLAG, KEEP_ALL_FLAG};
|
||||
use font::{Font, FontHandleMethods, FontMetrics, ShapingFlags};
|
||||
use font::{RunMetrics, ShapingOptions};
|
||||
use platform::font_template::FontTemplateData;
|
||||
use range::Range;
|
||||
|
@ -210,7 +210,7 @@ impl<'a> TextRun {
|
|||
.take_while(|&(_, c)| char_is_whitespace(c)).last() {
|
||||
whitespace.start = slice.start + i;
|
||||
slice.end = whitespace.start;
|
||||
} else if idx != text.len() && options.flags.contains(KEEP_ALL_FLAG) {
|
||||
} else if idx != text.len() && options.flags.contains(ShapingFlags::KEEP_ALL_FLAG) {
|
||||
// If there's no whitespace and word-break is set to
|
||||
// keep-all, try increasing the slice.
|
||||
continue;
|
||||
|
@ -224,7 +224,7 @@ impl<'a> TextRun {
|
|||
}
|
||||
if whitespace.len() > 0 {
|
||||
let mut options = options.clone();
|
||||
options.flags.insert(IS_WHITESPACE_SHAPING_FLAG);
|
||||
options.flags.insert(ShapingFlags::IS_WHITESPACE_SHAPING_FLAG);
|
||||
glyphs.push(GlyphRun {
|
||||
glyph_store: font.shape_text(&text[whitespace.clone()], &options),
|
||||
range: Range::new(ByteIndex(whitespace.start as isize),
|
||||
|
|
|
@ -12,7 +12,7 @@ path = "lib.rs"
|
|||
[dependencies]
|
||||
app_units = "0.5"
|
||||
atomic_refcell = "0.1"
|
||||
bitflags = "0.8"
|
||||
bitflags = "1.0"
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
euclid = "0.15"
|
||||
fnv = "1.0"
|
||||
|
|
|
@ -35,13 +35,9 @@ use display_list_builder::StackingContextCollectionState;
|
|||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use floats::{ClearType, FloatKind, Floats, PlacementInfo};
|
||||
use flow::{self, BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag};
|
||||
use flow::{BLOCK_POSITION_IS_STATIC, CLEARS_LEFT, CLEARS_RIGHT};
|
||||
use flow::{CONTAINS_TEXT_OR_REPLACED_FRAGMENTS, INLINE_POSITION_IS_STATIC};
|
||||
use flow::{IS_ABSOLUTELY_POSITIONED, FragmentationContext, MARGINS_CANNOT_COLLAPSE};
|
||||
use flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow};
|
||||
use flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, OpaqueFlow, FragmentationContext, FlowFlags};
|
||||
use flow_list::FlowList;
|
||||
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use fragment::{IS_INLINE_FLEX_ITEM, IS_BLOCK_FLEX_ITEM};
|
||||
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow, FragmentFlags};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use incremental::RelayoutMode;
|
||||
use layout_debug;
|
||||
|
@ -57,7 +53,7 @@ use style::computed_values::{position, text_align};
|
|||
use style::context::SharedStyleContext;
|
||||
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage};
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use traversal::PreorderFlowTraversal;
|
||||
|
@ -455,11 +451,11 @@ impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> {
|
|||
|
||||
// This flow might not be an absolutely positioned flow if it is the root of the tree.
|
||||
let block = flow.as_mut_block();
|
||||
if !block.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if !block.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
return;
|
||||
}
|
||||
|
||||
if !block.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||
if !block.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -513,11 +509,11 @@ pub struct BlockFlow {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
flags BlockFlowFlags: u8 {
|
||||
struct BlockFlowFlags: u8 {
|
||||
#[doc = "If this is set, then this block flow is the root flow."]
|
||||
const IS_ROOT = 0b0000_0001,
|
||||
const IS_ROOT = 0b0000_0001;
|
||||
#[doc = "If this is set, then this block flow has overflow and it will scroll."]
|
||||
const HAS_SCROLLING_OVERFLOW = 0b0000_0010,
|
||||
const HAS_SCROLLING_OVERFLOW = 0b0000_0010;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,7 +547,7 @@ impl BlockFlow {
|
|||
/// This determines the algorithm used to calculate inline-size, block-size, and the
|
||||
/// relevant margins for this Block.
|
||||
pub fn block_type(&self) -> BlockType {
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
if self.fragment.is_replaced() {
|
||||
BlockType::AbsoluteReplaced
|
||||
} else {
|
||||
|
@ -664,7 +660,7 @@ impl BlockFlow {
|
|||
#[inline]
|
||||
pub fn containing_block_size(&self, viewport_size: &Size2D<Au>, descendant: OpaqueFlow)
|
||||
-> LogicalSize<Au> {
|
||||
debug_assert!(self.base.flags.contains(IS_ABSOLUTELY_POSITIONED));
|
||||
debug_assert!(self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED));
|
||||
if self.is_fixed() || self.is_root() {
|
||||
// Initial containing block is the CB for the root
|
||||
LogicalSize::from_physical(self.base.writing_mode, *viewport_size)
|
||||
|
@ -783,13 +779,13 @@ impl BlockFlow {
|
|||
|
||||
let mut break_at = None;
|
||||
let content_box = self.fragment.content_box();
|
||||
if self.base.restyle_damage.contains(REFLOW) {
|
||||
if self.base.restyle_damage.contains(ServoRestyleDamage::REFLOW) {
|
||||
// Our current border-box position.
|
||||
let mut cur_b = Au(0);
|
||||
|
||||
// Absolute positioning establishes a block formatting context. Don't propagate floats
|
||||
// in or out. (But do propagate them between kids.)
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
|
||||
if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) ||
|
||||
margins_may_collapse != MarginsMayCollapseFlag::MarginsMayCollapse {
|
||||
self.base.floats = Floats::new(self.fragment.style.writing_mode);
|
||||
}
|
||||
|
@ -805,7 +801,7 @@ impl BlockFlow {
|
|||
|
||||
let can_collapse_block_start_margin_with_kids =
|
||||
margins_may_collapse == MarginsMayCollapseFlag::MarginsMayCollapse &&
|
||||
!self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
|
||||
!self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
||||
self.fragment.border_padding.block_start == Au(0);
|
||||
margin_collapse_info.initialize_block_start_margin(
|
||||
&self.fragment,
|
||||
|
@ -816,10 +812,10 @@ impl BlockFlow {
|
|||
let thread_id = self.base.thread_id;
|
||||
let (mut had_floated_children, mut had_children_with_clearance) = (false, false);
|
||||
for (child_index, kid) in self.base.child_iter_mut().enumerate() {
|
||||
if flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if flow::base(kid).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
// Assume that the *hypothetical box* for an absolute flow starts immediately
|
||||
// after the margin-end border edge of the previous flow.
|
||||
if flow::base(kid).flags.contains(BLOCK_POSITION_IS_STATIC) {
|
||||
if flow::base(kid).flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
|
||||
let previous_bottom_margin = margin_collapse_info.current_float_ceiling();
|
||||
|
||||
flow::mut_base(kid).position.start.b = cur_b +
|
||||
|
@ -887,8 +883,8 @@ impl BlockFlow {
|
|||
|
||||
if !had_children_with_clearance &&
|
||||
floats.is_present() &&
|
||||
(flow::base(kid).flags.contains(CLEARS_LEFT) ||
|
||||
flow::base(kid).flags.contains(CLEARS_RIGHT)) {
|
||||
(flow::base(kid).flags.contains(FlowFlags::CLEARS_LEFT) ||
|
||||
flow::base(kid).flags.contains(FlowFlags::CLEARS_RIGHT)) {
|
||||
had_children_with_clearance = true
|
||||
}
|
||||
|
||||
|
@ -905,8 +901,8 @@ impl BlockFlow {
|
|||
}
|
||||
|
||||
// Clear past the floats that came in, if necessary.
|
||||
let clearance = match (flow::base(kid).flags.contains(CLEARS_LEFT),
|
||||
flow::base(kid).flags.contains(CLEARS_RIGHT)) {
|
||||
let clearance = match (flow::base(kid).flags.contains(FlowFlags::CLEARS_LEFT),
|
||||
flow::base(kid).flags.contains(FlowFlags::CLEARS_RIGHT)) {
|
||||
(false, false) => Au(0),
|
||||
(true, false) => floats.clearance(ClearType::Left),
|
||||
(false, true) => floats.clearance(ClearType::Right),
|
||||
|
@ -967,7 +963,7 @@ impl BlockFlow {
|
|||
// Add in our block-end margin and compute our collapsible margins.
|
||||
let can_collapse_block_end_margin_with_kids =
|
||||
margins_may_collapse == MarginsMayCollapseFlag::MarginsMayCollapse &&
|
||||
!self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
|
||||
!self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
||||
self.fragment.border_padding.block_end == Au(0);
|
||||
let (collapsible_margins, delta) =
|
||||
margin_collapse_info.finish_and_compute_collapsible_margins(
|
||||
|
@ -982,13 +978,13 @@ impl BlockFlow {
|
|||
let is_root = self.is_root();
|
||||
|
||||
if is_root || self.formatting_context_type() != FormattingContextType::None ||
|
||||
self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
// The content block-size includes all the floats per CSS 2.1 § 10.6.7. The easiest
|
||||
// way to handle this is to just treat it as clearance.
|
||||
block_size = block_size + floats.clearance(ClearType::Both);
|
||||
}
|
||||
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
// FIXME(#2003, pcwalton): The max is taken here so that you can scroll the page,
|
||||
// but this is not correct behavior according to CSS 2.1 § 10.5. Instead I think we
|
||||
// should treat the root element as having `overflow: scroll` and use the layers-
|
||||
|
@ -1008,7 +1004,7 @@ impl BlockFlow {
|
|||
}
|
||||
|
||||
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
self.propagate_early_absolute_position_info_to_children();
|
||||
return None
|
||||
}
|
||||
|
@ -1076,9 +1072,9 @@ impl BlockFlow {
|
|||
// size has not yet been computed. (See `assign_inline_position_for_formatting_context()`.)
|
||||
if (self.base.flags.is_float() ||
|
||||
self.formatting_context_type() == FormattingContextType::None) &&
|
||||
!self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
!self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
self.fragment.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
}
|
||||
|
||||
break_at.and_then(|(i, child_remaining)| {
|
||||
|
@ -1162,7 +1158,7 @@ impl BlockFlow {
|
|||
let viewport_size = LogicalSize::from_physical(self.fragment.style.writing_mode,
|
||||
shared_context.viewport_size());
|
||||
Some(viewport_size.block)
|
||||
} else if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
|
||||
} else if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
||||
self.base.block_container_explicit_block_size.is_none() {
|
||||
self.base.absolute_cb.explicit_block_containing_size(shared_context)
|
||||
} else {
|
||||
|
@ -1300,7 +1296,7 @@ impl BlockFlow {
|
|||
self.fragment.margin.block_end = solution.margin_block_end;
|
||||
self.fragment.border_box.start.b = Au(0);
|
||||
|
||||
if !self.base.flags.contains(BLOCK_POSITION_IS_STATIC) {
|
||||
if !self.base.flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
|
||||
self.base.position.start.b = solution.block_start + self.fragment.margin.block_start
|
||||
}
|
||||
|
||||
|
@ -1308,8 +1304,8 @@ impl BlockFlow {
|
|||
self.fragment.border_box.size.block = block_size;
|
||||
self.base.position.size.block = block_size;
|
||||
|
||||
self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
self.fragment.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
}
|
||||
|
||||
/// Compute inline size based using the `block_container_inline_size` set by the parent flow.
|
||||
|
@ -1358,7 +1354,7 @@ impl BlockFlow {
|
|||
.map(|x| if x < box_border { Au(0) } else { x - box_border });
|
||||
if self.is_root() { explicit_content_size = max(parent_container_size, explicit_content_size); }
|
||||
// Calculate containing block inline size.
|
||||
let containing_block_size = if flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
let containing_block_size = if flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
self.containing_block_size(&shared_context.viewport_size(), opaque_self).inline
|
||||
} else {
|
||||
content_inline_size
|
||||
|
@ -1386,12 +1382,12 @@ impl BlockFlow {
|
|||
// float child does not have `REFLOW` set, we must be careful to avoid touching its
|
||||
// inline position, as no logic will run afterward to set its true value.
|
||||
let kid_base = flow::mut_base(kid);
|
||||
let reflow_damage = if kid_base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
REFLOW_OUT_OF_FLOW
|
||||
let reflow_damage = if kid_base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
ServoRestyleDamage::REFLOW_OUT_OF_FLOW
|
||||
} else {
|
||||
REFLOW
|
||||
ServoRestyleDamage::REFLOW
|
||||
};
|
||||
if kid_base.flags.contains(INLINE_POSITION_IS_STATIC) &&
|
||||
if kid_base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) &&
|
||||
kid_base.restyle_damage.contains(reflow_damage) {
|
||||
kid_base.position.start.i =
|
||||
if kid_mode.is_bidi_ltr() == containing_block_mode.is_bidi_ltr() {
|
||||
|
@ -1475,13 +1471,13 @@ impl BlockFlow {
|
|||
content_box: LogicalRect<Au>) {
|
||||
debug_assert!(self.formatting_context_type() != FormattingContextType::None);
|
||||
|
||||
if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||
if !self.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW) {
|
||||
return
|
||||
}
|
||||
|
||||
// We do this first to avoid recomputing our inline size when we propagate it.
|
||||
self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
self.fragment.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
|
||||
// The code below would completely wreck the layout if run on a flex item, however:
|
||||
// * Flex items are always the children of flex containers.
|
||||
|
@ -1591,14 +1587,14 @@ impl BlockFlow {
|
|||
// This is kind of a hack for Acid2. But it's a harmless one, because (a) this behavior
|
||||
// is unspecified; (b) it matches the behavior one would intuitively expect, since
|
||||
// floats don't flow around blocks that take up no space in the block direction.
|
||||
flags.remove(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
flags.remove(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
} else if self.fragment.is_text_or_replaced() {
|
||||
flags.insert(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
flags.insert(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
} else {
|
||||
flags.remove(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
flags.remove(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
for kid in self.base.children.iter() {
|
||||
if flow::base(kid).flags.contains(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS) {
|
||||
flags.insert(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
if flow::base(kid).flags.contains(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS) {
|
||||
flags.insert(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -1615,7 +1611,7 @@ impl BlockFlow {
|
|||
let (mut left_float_width_accumulator, mut right_float_width_accumulator) = (Au(0), Au(0));
|
||||
let mut preferred_inline_size_of_children_without_text_or_replaced_fragments = Au(0);
|
||||
for kid in self.base.child_iter_mut() {
|
||||
if flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) || !consult_children {
|
||||
if flow::base(kid).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) || !consult_children {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -1625,16 +1621,16 @@ impl BlockFlow {
|
|||
max(computation.content_intrinsic_sizes.minimum_inline_size,
|
||||
child_base.intrinsic_inline_sizes.minimum_inline_size);
|
||||
|
||||
if child_base.flags.contains(CLEARS_LEFT) {
|
||||
if child_base.flags.contains(FlowFlags::CLEARS_LEFT) {
|
||||
left_float_width = max(left_float_width, left_float_width_accumulator);
|
||||
left_float_width_accumulator = Au(0)
|
||||
}
|
||||
if child_base.flags.contains(CLEARS_RIGHT) {
|
||||
if child_base.flags.contains(FlowFlags::CLEARS_RIGHT) {
|
||||
right_float_width = max(right_float_width, right_float_width_accumulator);
|
||||
right_float_width_accumulator = Au(0)
|
||||
}
|
||||
|
||||
match (float_kind, child_base.flags.contains(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS)) {
|
||||
match (float_kind, child_base.flags.contains(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS)) {
|
||||
(float::T::none, true) => {
|
||||
computation.content_intrinsic_sizes.preferred_inline_size =
|
||||
max(computation.content_intrinsic_sizes.preferred_inline_size,
|
||||
|
@ -1681,7 +1677,7 @@ impl BlockFlow {
|
|||
}
|
||||
|
||||
pub fn compute_inline_sizes(&mut self, shared_context: &SharedStyleContext) {
|
||||
if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||
if !self.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1762,23 +1758,23 @@ impl BlockFlow {
|
|||
}
|
||||
|
||||
pub fn is_inline_flex_item(&self) -> bool {
|
||||
self.fragment.flags.contains(IS_INLINE_FLEX_ITEM)
|
||||
self.fragment.flags.contains(FragmentFlags::IS_INLINE_FLEX_ITEM)
|
||||
}
|
||||
|
||||
pub fn is_block_flex_item(&self) -> bool {
|
||||
self.fragment.flags.contains(IS_BLOCK_FLEX_ITEM)
|
||||
self.fragment.flags.contains(FragmentFlags::IS_BLOCK_FLEX_ITEM)
|
||||
}
|
||||
|
||||
pub fn mark_scrolling_overflow(&mut self, has_scrolling_overflow: bool) {
|
||||
if has_scrolling_overflow {
|
||||
self.flags.insert(HAS_SCROLLING_OVERFLOW);
|
||||
self.flags.insert(BlockFlowFlags::HAS_SCROLLING_OVERFLOW);
|
||||
} else {
|
||||
self.flags.remove(HAS_SCROLLING_OVERFLOW);
|
||||
self.flags.remove(BlockFlowFlags::HAS_SCROLLING_OVERFLOW);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_scrolling_overflow(&mut self) -> bool {
|
||||
self.flags.contains(HAS_SCROLLING_OVERFLOW)
|
||||
self.flags.contains(BlockFlowFlags::HAS_SCROLLING_OVERFLOW)
|
||||
}
|
||||
|
||||
// Return offset from original position because of `position: sticky`.
|
||||
|
@ -1824,7 +1820,7 @@ impl Flow for BlockFlow {
|
|||
_ => true,
|
||||
};
|
||||
self.bubble_inline_sizes_for_block(consult_children);
|
||||
self.fragment.restyle_damage.remove(BUBBLE_ISIZES);
|
||||
self.fragment.restyle_damage.remove(ServoRestyleDamage::BUBBLE_ISIZES);
|
||||
}
|
||||
|
||||
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
||||
|
@ -1874,13 +1870,14 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
|
||||
let is_formatting_context = self.formatting_context_type() != FormattingContextType::None;
|
||||
if !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) && is_formatting_context {
|
||||
if !self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) && is_formatting_context {
|
||||
self.assign_inline_position_for_formatting_context(layout_context, content_box);
|
||||
}
|
||||
|
||||
if (self as &Flow).floats_might_flow_through() {
|
||||
self.base.thread_id = parent_thread_id;
|
||||
if self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||
if self.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW |
|
||||
ServoRestyleDamage::REFLOW) {
|
||||
self.assign_block_size(layout_context);
|
||||
// Don't remove the restyle damage; `assign_block_size` decides whether that is
|
||||
// appropriate (which in the case of e.g. absolutely-positioned flows, it is not).
|
||||
|
@ -1914,7 +1911,7 @@ impl Flow for BlockFlow {
|
|||
|
||||
// Assign block-size for fragment if it is an image fragment.
|
||||
self.fragment.assign_replaced_block_size_if_necessary();
|
||||
if !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if !self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
self.base.position.size.block = self.fragment.border_box.size.block;
|
||||
let mut block_start = AdjoiningMargins::from_margin(self.fragment.margin.block_start);
|
||||
let block_end = AdjoiningMargins::from_margin(self.fragment.margin.block_end);
|
||||
|
@ -1924,13 +1921,14 @@ impl Flow for BlockFlow {
|
|||
} else {
|
||||
self.base.collapsible_margins = CollapsibleMargins::Collapse(block_start, block_end);
|
||||
}
|
||||
self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
self.fragment.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW |
|
||||
ServoRestyleDamage::REFLOW);
|
||||
}
|
||||
None
|
||||
} else if self.is_root() ||
|
||||
self.formatting_context_type() != FormattingContextType::None ||
|
||||
self.base.flags.contains(MARGINS_CANNOT_COLLAPSE) {
|
||||
self.base.flags.contains(FlowFlags::MARGINS_CANNOT_COLLAPSE) {
|
||||
// Root element margins should never be collapsed according to CSS § 8.3.1.
|
||||
debug!("assign_block_size: assigning block_size for root flow {:?}",
|
||||
flow::base(self).debug_id());
|
||||
|
@ -1957,7 +1955,7 @@ impl Flow for BlockFlow {
|
|||
self.base.clip = max_rect();
|
||||
}
|
||||
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
let position_start = self.base.position.start.to_physical(self.base.writing_mode,
|
||||
container_size);
|
||||
|
||||
|
@ -1975,17 +1973,17 @@ impl Flow for BlockFlow {
|
|||
};
|
||||
|
||||
if !self.base.writing_mode.is_vertical() {
|
||||
if !self.base.flags.contains(INLINE_POSITION_IS_STATIC) {
|
||||
if !self.base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
|
||||
self.base.stacking_relative_position.x = absolute_stacking_relative_position.x
|
||||
}
|
||||
if !self.base.flags.contains(BLOCK_POSITION_IS_STATIC) {
|
||||
if !self.base.flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
|
||||
self.base.stacking_relative_position.y = absolute_stacking_relative_position.y
|
||||
}
|
||||
} else {
|
||||
if !self.base.flags.contains(INLINE_POSITION_IS_STATIC) {
|
||||
if !self.base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
|
||||
self.base.stacking_relative_position.y = absolute_stacking_relative_position.y
|
||||
}
|
||||
if !self.base.flags.contains(BLOCK_POSITION_IS_STATIC) {
|
||||
if !self.base.flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
|
||||
self.base.stacking_relative_position.x = absolute_stacking_relative_position.x
|
||||
}
|
||||
}
|
||||
|
@ -2058,28 +2056,28 @@ impl Flow for BlockFlow {
|
|||
|
||||
// Process children.
|
||||
for kid in self.base.child_iter_mut() {
|
||||
if flow::base(kid).flags.contains(INLINE_POSITION_IS_STATIC) ||
|
||||
flow::base(kid).flags.contains(BLOCK_POSITION_IS_STATIC) {
|
||||
if flow::base(kid).flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) ||
|
||||
flow::base(kid).flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
|
||||
let kid_base = flow::mut_base(kid);
|
||||
let physical_position = kid_base.position.to_physical(kid_base.writing_mode,
|
||||
container_size_for_children);
|
||||
|
||||
// Set the inline and block positions as necessary.
|
||||
if !kid_base.writing_mode.is_vertical() {
|
||||
if kid_base.flags.contains(INLINE_POSITION_IS_STATIC) {
|
||||
if kid_base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
|
||||
kid_base.stacking_relative_position.x = origin_for_children.x +
|
||||
physical_position.origin.x
|
||||
}
|
||||
if kid_base.flags.contains(BLOCK_POSITION_IS_STATIC) {
|
||||
if kid_base.flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
|
||||
kid_base.stacking_relative_position.y = origin_for_children.y +
|
||||
physical_position.origin.y
|
||||
}
|
||||
} else {
|
||||
if kid_base.flags.contains(INLINE_POSITION_IS_STATIC) {
|
||||
if kid_base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
|
||||
kid_base.stacking_relative_position.y = origin_for_children.y +
|
||||
physical_position.origin.y
|
||||
}
|
||||
if kid_base.flags.contains(BLOCK_POSITION_IS_STATIC) {
|
||||
if kid_base.flags.contains(FlowFlags::BLOCK_POSITION_IS_STATIC) {
|
||||
kid_base.stacking_relative_position.x = origin_for_children.x +
|
||||
physical_position.origin.x
|
||||
}
|
||||
|
@ -2092,11 +2090,11 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
|
||||
fn mark_as_root(&mut self) {
|
||||
self.flags.insert(IS_ROOT)
|
||||
self.flags.insert(BlockFlowFlags::IS_ROOT)
|
||||
}
|
||||
|
||||
fn is_root(&self) -> bool {
|
||||
self.flags.contains(IS_ROOT)
|
||||
self.flags.contains(BlockFlowFlags::IS_ROOT)
|
||||
}
|
||||
|
||||
/// The 'position' property of this flow.
|
||||
|
@ -2122,7 +2120,7 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
|
||||
fn update_late_computed_inline_position_if_necessary(&mut self, inline_position: Au) {
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
|
||||
if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
||||
self.fragment.style().logical_position().inline_start ==
|
||||
LengthOrPercentageOrAuto::Auto &&
|
||||
self.fragment.style().logical_position().inline_end ==
|
||||
|
@ -2132,7 +2130,7 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
|
||||
fn update_late_computed_block_position_if_necessary(&mut self, block_position: Au) {
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) &&
|
||||
if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) &&
|
||||
self.fragment.style().logical_position().block_start ==
|
||||
LengthOrPercentageOrAuto::Auto &&
|
||||
self.fragment.style().logical_position().block_end ==
|
||||
|
@ -2748,7 +2746,7 @@ impl ISizeAndMarginsComputer for AbsoluteNonReplaced {
|
|||
block: &mut BlockFlow,
|
||||
solution: ISizeConstraintSolution) {
|
||||
// Set the inline position of the absolute flow wrt to its containing block.
|
||||
if !block.base.flags.contains(INLINE_POSITION_IS_STATIC) {
|
||||
if !block.base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
|
||||
block.base.position.start.i = solution.inline_start;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,22 +16,19 @@
|
|||
use ServoArc;
|
||||
use block::BlockFlow;
|
||||
use context::{LayoutContext, with_thread_local_font_context};
|
||||
use data::{HAS_NEWLY_CONSTRUCTED_FLOW, LayoutData};
|
||||
use data::{LayoutDataFlags, LayoutData};
|
||||
use flex::FlexFlow;
|
||||
use floats::FloatKind;
|
||||
use flow::{self, AbsoluteDescendants, Flow, FlowClass, ImmutableFlowUtils};
|
||||
use flow::{CAN_BE_FRAGMENTED, IS_ABSOLUTELY_POSITIONED, MARGINS_CANNOT_COLLAPSE};
|
||||
use flow::{MutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use flow::{FlowFlags, MutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use flow_ref::FlowRef;
|
||||
use fragment::{CanvasFragmentInfo, ImageFragmentInfo, InlineAbsoluteFragmentInfo, SvgFragmentInfo};
|
||||
use fragment::{Fragment, GeneratedContentInfo, IframeFragmentInfo};
|
||||
use fragment::{IS_INLINE_FLEX_ITEM, IS_BLOCK_FLEX_ITEM};
|
||||
use fragment::{Fragment, GeneratedContentInfo, IframeFragmentInfo, FragmentFlags};
|
||||
use fragment::{InlineAbsoluteHypotheticalFragmentInfo, TableColumnFragmentInfo};
|
||||
use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
|
||||
use fragment::WhitespaceStrippingResult;
|
||||
use gfx::display_list::OpaqueNode;
|
||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow};
|
||||
use inline::{InlineFragmentNodeInfo, LAST_FRAGMENT_OF_ELEMENT};
|
||||
use inline::{InlineFlow, InlineFragmentNodeInfo, InlineFragmentNodeFlags};
|
||||
use linked_list::prepend_from;
|
||||
use list_item::{ListItemFlow, ListStyleTypeContent};
|
||||
use multicol::{MulticolColumnFlow, MulticolFlow};
|
||||
|
@ -54,7 +51,7 @@ use style::logical_geometry::Direction;
|
|||
use style::properties::ComputedValues;
|
||||
use style::properties::longhands::list_style_image;
|
||||
use style::selector_parser::{PseudoElement, RestyleDamage};
|
||||
use style::servo::restyle_damage::{BUBBLE_ISIZES, RECONSTRUCT_FLOW};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::Either;
|
||||
use table::TableFlow;
|
||||
use table_caption::TableCaptionFlow;
|
||||
|
@ -173,7 +170,7 @@ impl InlineBlockSplit {
|
|||
-> InlineBlockSplit {
|
||||
fragment_accumulator.enclosing_node.as_mut().expect(
|
||||
"enclosing_node is None; Are {ib} splits being generated outside of an inline node?"
|
||||
).flags.remove(LAST_FRAGMENT_OF_ELEMENT);
|
||||
).flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
|
||||
|
||||
let split = InlineBlockSplit {
|
||||
predecessors: mem::replace(
|
||||
|
@ -183,7 +180,8 @@ impl InlineBlockSplit {
|
|||
flow: flow,
|
||||
};
|
||||
|
||||
fragment_accumulator.enclosing_node.as_mut().unwrap().flags.remove(FIRST_FRAGMENT_OF_ELEMENT);
|
||||
fragment_accumulator.enclosing_node.as_mut().unwrap().flags.remove(
|
||||
InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT);
|
||||
|
||||
split
|
||||
}
|
||||
|
@ -258,7 +256,8 @@ impl InlineFragmentsAccumulator {
|
|||
pseudo: node.get_pseudo_element_type().strip(),
|
||||
style: node.style(style_context),
|
||||
selected_style: node.selected_style(),
|
||||
flags: FIRST_FRAGMENT_OF_ELEMENT | LAST_FRAGMENT_OF_ELEMENT,
|
||||
flags: InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT |
|
||||
InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT,
|
||||
}),
|
||||
bidi_control_chars: None,
|
||||
restyle_damage: node.restyle_damage(),
|
||||
|
@ -287,17 +286,18 @@ impl InlineFragmentsAccumulator {
|
|||
for (index, fragment) in fragments.fragments.iter_mut().enumerate() {
|
||||
let mut enclosing_node = enclosing_node.clone();
|
||||
if index != 0 {
|
||||
enclosing_node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT)
|
||||
enclosing_node.flags.remove(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT)
|
||||
}
|
||||
if index != fragment_count - 1 {
|
||||
enclosing_node.flags.remove(LAST_FRAGMENT_OF_ELEMENT)
|
||||
enclosing_node.flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT)
|
||||
}
|
||||
fragment.add_inline_context_style(enclosing_node);
|
||||
}
|
||||
|
||||
// Control characters are later discarded in transform_text, so they don't affect the
|
||||
// is_first/is_last styles above.
|
||||
enclosing_node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT | LAST_FRAGMENT_OF_ELEMENT);
|
||||
enclosing_node.flags.remove(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT |
|
||||
InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
|
||||
|
||||
if let Some((start, end)) = bidi_control_chars {
|
||||
fragments.fragments.push_front(
|
||||
|
@ -493,7 +493,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
ConstructionResult::Flow(kid_flow, AbsoluteDescendants::new());
|
||||
self.set_flow_construction_result(&kid, construction_result)
|
||||
} else {
|
||||
if !flow::base(&*kid_flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if !flow::base(&*kid_flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
// Flush any inline fragments that we were gathering up. This allows us to
|
||||
// handle {ib} splits.
|
||||
let old_inline_fragment_accumulator =
|
||||
|
@ -621,7 +621,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
flow.set_absolute_descendants(abs_descendants);
|
||||
|
||||
abs_descendants = AbsoluteDescendants::new();
|
||||
if flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if flow::base(&*flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
// This is now the only absolute flow in the subtree which hasn't yet
|
||||
// reached its CB.
|
||||
abs_descendants.push(flow.clone());
|
||||
|
@ -776,7 +776,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
match kid.get_construction_result() {
|
||||
ConstructionResult::None => {}
|
||||
ConstructionResult::Flow(flow, kid_abs_descendants) => {
|
||||
if !flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if !flow::base(&*flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
opt_inline_block_splits.push_back(InlineBlockSplit::new(
|
||||
&mut fragment_accumulator, node, self.style_context(), flow));
|
||||
abs_descendants.push_descendants(kid_abs_descendants);
|
||||
|
@ -1066,7 +1066,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
|
||||
abs_descendants = AbsoluteDescendants::new();
|
||||
|
||||
if flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if flow::base(&*flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
// This is now the only absolute flow in the subtree which hasn't yet
|
||||
// reached its containing block.
|
||||
abs_descendants.push(flow.clone());
|
||||
|
@ -1137,7 +1137,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
|
||||
abs_descendants = AbsoluteDescendants::new();
|
||||
|
||||
if flow::base(&*wrapper_flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if flow::base(&*wrapper_flow).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
// This is now the only absolute flow in the subtree which hasn't yet
|
||||
// reached its containing block.
|
||||
abs_descendants.push(wrapper_flow.clone());
|
||||
|
@ -1332,8 +1332,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
}
|
||||
|
||||
for kid in node.children() {
|
||||
if kid.flags().contains(HAS_NEWLY_CONSTRUCTED_FLOW) {
|
||||
kid.remove_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
if kid.flags().contains(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW) {
|
||||
kid.remove_flags(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
need_to_reconstruct = true
|
||||
}
|
||||
}
|
||||
|
@ -1342,7 +1342,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
return false
|
||||
}
|
||||
|
||||
if node.restyle_damage().contains(RECONSTRUCT_FLOW) {
|
||||
if node.restyle_damage().contains(ServoRestyleDamage::RECONSTRUCT_FLOW) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -1436,7 +1436,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
}
|
||||
};
|
||||
if set_has_newly_constructed_flow_flag {
|
||||
node.insert_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
node.insert_flags(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1452,7 +1452,7 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
|||
// TODO: This should actually consult the table in that section to get the
|
||||
// final computed value for 'display'.
|
||||
fn process(&mut self, node: &ConcreteThreadSafeLayoutNode) {
|
||||
node.insert_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
node.insert_flags(LayoutDataFlags::HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
|
||||
// Bail out if this node has an ancestor with display: none.
|
||||
if node.style(self.style_context()).is_in_display_none_subtree() {
|
||||
|
@ -1654,7 +1654,7 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
|
|||
fn set_flow_construction_result(self, mut result: ConstructionResult) {
|
||||
if self.can_be_fragmented() {
|
||||
if let ConstructionResult::Flow(ref mut flow, _) = result {
|
||||
flow::mut_base(FlowRef::deref_mut(flow)).flags.insert(CAN_BE_FRAGMENTED);
|
||||
flow::mut_base(FlowRef::deref_mut(flow)).flags.insert(FlowFlags::CAN_BE_FRAGMENTED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1744,7 +1744,7 @@ impl FlowConstructionUtils for FlowRef {
|
|||
fn finish(&mut self) {
|
||||
if !opts::get().bubble_inline_sizes_separately {
|
||||
FlowRef::deref_mut(self).bubble_inline_sizes();
|
||||
flow::mut_base(FlowRef::deref_mut(self)).restyle_damage.remove(BUBBLE_ISIZES);
|
||||
flow::mut_base(FlowRef::deref_mut(self)).restyle_damage.remove(ServoRestyleDamage::BUBBLE_ISIZES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1945,7 +1945,7 @@ impl Legalizer {
|
|||
}
|
||||
|
||||
(FlowClass::Flex, FlowClass::Inline) => {
|
||||
flow::mut_base(FlowRef::deref_mut(child)).flags.insert(MARGINS_CANNOT_COLLAPSE);
|
||||
flow::mut_base(FlowRef::deref_mut(child)).flags.insert(FlowFlags::MARGINS_CANNOT_COLLAPSE);
|
||||
let mut block_wrapper =
|
||||
Legalizer::create_anonymous_flow(context,
|
||||
parent,
|
||||
|
@ -1954,12 +1954,12 @@ impl Legalizer {
|
|||
BlockFlow::from_fragment);
|
||||
{
|
||||
let flag = if parent.as_flex().main_mode() == Direction::Inline {
|
||||
IS_INLINE_FLEX_ITEM
|
||||
FragmentFlags::IS_INLINE_FLEX_ITEM
|
||||
} else {
|
||||
IS_BLOCK_FLEX_ITEM
|
||||
FragmentFlags::IS_BLOCK_FLEX_ITEM
|
||||
};
|
||||
let block = FlowRef::deref_mut(&mut block_wrapper).as_mut_block();
|
||||
block.base.flags.insert(MARGINS_CANNOT_COLLAPSE);
|
||||
block.base.flags.insert(FlowFlags::MARGINS_CANNOT_COLLAPSE);
|
||||
block.fragment.flags.insert(flag);
|
||||
}
|
||||
block_wrapper.add_new_child((*child).clone());
|
||||
|
@ -1971,12 +1971,12 @@ impl Legalizer {
|
|||
(FlowClass::Flex, _) => {
|
||||
{
|
||||
let flag = if parent.as_flex().main_mode() == Direction::Inline {
|
||||
IS_INLINE_FLEX_ITEM
|
||||
FragmentFlags::IS_INLINE_FLEX_ITEM
|
||||
} else {
|
||||
IS_BLOCK_FLEX_ITEM
|
||||
FragmentFlags::IS_BLOCK_FLEX_ITEM
|
||||
};
|
||||
let block = FlowRef::deref_mut(child).as_mut_block();
|
||||
block.base.flags.insert(MARGINS_CANNOT_COLLAPSE);
|
||||
block.base.flags.insert(FlowFlags::MARGINS_CANNOT_COLLAPSE);
|
||||
block.fragment.flags.insert(flag);
|
||||
}
|
||||
parent.add_new_child((*child).clone());
|
||||
|
|
|
@ -60,10 +60,10 @@ impl LayoutData {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
pub flags LayoutDataFlags: u8 {
|
||||
pub struct LayoutDataFlags: u8 {
|
||||
#[doc = "Whether a flow has been newly constructed."]
|
||||
const HAS_NEWLY_CONSTRUCTED_FLOW = 0x01,
|
||||
const HAS_NEWLY_CONSTRUCTED_FLOW = 0x01;
|
||||
#[doc = "Whether this node has been traversed by layout."]
|
||||
const HAS_BEEN_TRAVERSED = 0x02,
|
||||
const HAS_BEEN_TRAVERSED = 0x02;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg};
|
|||
use context::LayoutContext;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Transform3D, TypedRect, TypedSize2D, Vector2D};
|
||||
use flex::FlexFlow;
|
||||
use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED};
|
||||
use flow::{BaseFlow, Flow, FlowFlags};
|
||||
use flow_ref::FlowRef;
|
||||
use fnv::FnvHashMap;
|
||||
use fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ImageFragmentInfo, ScannedTextFragmentInfo};
|
||||
|
@ -33,7 +33,7 @@ use gfx::display_list::{RadialGradientDisplayItem, SolidColorDisplayItem, Stacki
|
|||
use gfx::display_list::{StackingContextType, StickyFrameData, TextDisplayItem, TextOrientation};
|
||||
use gfx::display_list::WebRenderImageInfo;
|
||||
use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId};
|
||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT};
|
||||
use inline::{InlineFragmentNodeFlags, InlineFlow};
|
||||
use ipc_channel::ipc;
|
||||
use list_item::ListItemFlow;
|
||||
use model::{self, MaybeAuto};
|
||||
|
@ -55,7 +55,7 @@ use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalS
|
|||
use style::properties::ComputedValues;
|
||||
use style::properties::longhands::border_image_repeat::computed_value::RepeatKeyword;
|
||||
use style::properties::style_structs;
|
||||
use style::servo::restyle_damage::REPAINT;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::{Either, RGBA};
|
||||
use style::values::computed::{Angle, Gradient, GradientItem, LengthOrPercentage, Percentage};
|
||||
use style::values::computed::{LengthOrPercentageOrAuto, NumberOrPercentage, Position};
|
||||
|
@ -106,7 +106,8 @@ fn convert_repeat_mode(from: RepeatKeyword) -> RepeatMode {
|
|||
fn establishes_containing_block_for_absolute(flags: StackingContextCollectionFlags,
|
||||
positioning: position::T)
|
||||
-> bool {
|
||||
!flags.contains(NEVER_CREATES_CONTAINING_BLOCK) && position::T::static_ != positioning
|
||||
!flags.contains(StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK) &&
|
||||
position::T::static_ != positioning
|
||||
}
|
||||
|
||||
trait RgbColor {
|
||||
|
@ -1878,7 +1879,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
border_painting_mode: BorderPaintingMode,
|
||||
display_list_section: DisplayListSection,
|
||||
clip: &Rect<Au>) {
|
||||
self.restyle_damage.remove(REPAINT);
|
||||
self.restyle_damage.remove(ServoRestyleDamage::REPAINT);
|
||||
if self.style().get_inheritedbox().visibility != visibility::T::visible {
|
||||
return
|
||||
}
|
||||
|
@ -1924,8 +1925,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
state,
|
||||
&*node.style,
|
||||
Some(InlineNodeBorderInfo {
|
||||
is_first_fragment_of_element: node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT),
|
||||
is_last_fragment_of_element: node.flags.contains(LAST_FRAGMENT_OF_ELEMENT),
|
||||
is_first_fragment_of_element:
|
||||
node.flags.contains(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT),
|
||||
is_last_fragment_of_element:
|
||||
node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT),
|
||||
}),
|
||||
border_painting_mode,
|
||||
&stacking_relative_border_box,
|
||||
|
@ -2407,13 +2410,13 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
pub flags StackingContextCollectionFlags: u8 {
|
||||
pub struct StackingContextCollectionFlags: u8 {
|
||||
/// This flow never establishes a containing block.
|
||||
const NEVER_CREATES_CONTAINING_BLOCK = 0b001,
|
||||
const NEVER_CREATES_CONTAINING_BLOCK = 0b001;
|
||||
/// This flow never creates a ClipScrollNode.
|
||||
const NEVER_CREATES_CLIP_SCROLL_NODE = 0b010,
|
||||
const NEVER_CREATES_CLIP_SCROLL_NODE = 0b010;
|
||||
/// This flow never creates a stacking context.
|
||||
const NEVER_CREATES_STACKING_CONTEXT = 0b100,
|
||||
const NEVER_CREATES_STACKING_CONTEXT = 0b100;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2679,7 +2682,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
self.transform_clip_to_coordinate_space(state, preserved_state);
|
||||
}
|
||||
|
||||
if !flags.contains(NEVER_CREATES_CLIP_SCROLL_NODE) {
|
||||
if !flags.contains(StackingContextCollectionFlags::NEVER_CREATES_CLIP_SCROLL_NODE) {
|
||||
self.setup_clip_scroll_node_for_position(state, &stacking_relative_border_box);
|
||||
self.setup_clip_scroll_node_for_overflow(state, &stacking_relative_border_box);
|
||||
self.setup_clip_scroll_node_for_css_clip(state, preserved_state,
|
||||
|
@ -2689,7 +2692,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
|
||||
// We keep track of our position so that any stickily positioned elements can
|
||||
// properly determine the extent of their movement relative to scrolling containers.
|
||||
if !flags.contains(NEVER_CREATES_CONTAINING_BLOCK) {
|
||||
if !flags.contains(StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK) {
|
||||
let border_box = if self.fragment.establishes_stacking_context() {
|
||||
stacking_relative_border_box
|
||||
} else {
|
||||
|
@ -2887,7 +2890,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
parent_clipping_and_scrolling: ClippingAndScrolling,
|
||||
state: &mut StackingContextCollectionState
|
||||
) {
|
||||
let creation_mode = if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
|
||||
let creation_mode = if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) ||
|
||||
self.fragment.style.get_box().position != position::T::static_ {
|
||||
StackingContextType::PseudoPositioned
|
||||
} else {
|
||||
|
@ -2946,7 +2949,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
border_painting_mode: BorderPaintingMode) {
|
||||
let background_border_section = if self.base.flags.is_float() {
|
||||
DisplayListSection::BackgroundAndBorders
|
||||
} else if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
} else if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
if self.fragment.establishes_stacking_context() {
|
||||
DisplayListSection::BackgroundAndBorders
|
||||
} else {
|
||||
|
@ -2982,7 +2985,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
&self,
|
||||
flags: StackingContextCollectionFlags,
|
||||
) -> BlockStackingContextType {
|
||||
if flags.contains(NEVER_CREATES_STACKING_CONTEXT) {
|
||||
if flags.contains(StackingContextCollectionFlags::NEVER_CREATES_STACKING_CONTEXT) {
|
||||
return BlockStackingContextType::NonstackingContext;
|
||||
}
|
||||
|
||||
|
@ -2990,7 +2993,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
return BlockStackingContextType::StackingContext
|
||||
}
|
||||
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if self.base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
return BlockStackingContextType::PseudoStackingContext
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,7 @@ use display_list_builder::StackingContextCollectionState;
|
|||
use euclid::Point2D;
|
||||
use floats::FloatKind;
|
||||
use flow;
|
||||
use flow::{Flow, FlowClass, ImmutableFlowUtils, OpaqueFlow};
|
||||
use flow::{INLINE_POSITION_IS_STATIC, IS_ABSOLUTELY_POSITIONED};
|
||||
use flow::{Flow, FlowClass, ImmutableFlowUtils, OpaqueFlow, FlowFlags};
|
||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use layout_debug;
|
||||
use model::{AdjoiningMargins, CollapsibleMargins};
|
||||
|
@ -25,7 +24,7 @@ use std::ops::Range;
|
|||
use style::computed_values::{align_content, align_self, flex_direction, flex_wrap, justify_content};
|
||||
use style::logical_geometry::{Direction, LogicalSize};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use style::values::computed::flex::FlexBasis;
|
||||
use style::values::generics::flex::FlexBasis as GenericFlexBasis;
|
||||
|
@ -449,7 +448,7 @@ impl FlexFlow {
|
|||
if !fixed_width {
|
||||
for kid in self.block_flow.base.children.iter_mut() {
|
||||
let base = flow::mut_base(kid);
|
||||
let is_absolutely_positioned = base.flags.contains(IS_ABSOLUTELY_POSITIONED);
|
||||
let is_absolutely_positioned = base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED);
|
||||
if !is_absolutely_positioned {
|
||||
let flex_item_inline_sizes = IntrinsicISizes {
|
||||
minimum_inline_size: base.intrinsic_inline_sizes.minimum_inline_size,
|
||||
|
@ -475,7 +474,7 @@ impl FlexFlow {
|
|||
if !fixed_width {
|
||||
for kid in self.block_flow.base.children.iter_mut() {
|
||||
let base = flow::mut_base(kid);
|
||||
let is_absolutely_positioned = base.flags.contains(IS_ABSOLUTELY_POSITIONED);
|
||||
let is_absolutely_positioned = base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED);
|
||||
if !is_absolutely_positioned {
|
||||
computation.content_intrinsic_sizes.minimum_inline_size =
|
||||
max(computation.content_intrinsic_sizes.minimum_inline_size,
|
||||
|
@ -518,7 +517,7 @@ impl FlexFlow {
|
|||
for kid in &mut self.items {
|
||||
let kid_base = flow::mut_base(children.get(kid.index));
|
||||
kid_base.block_container_explicit_block_size = container_block_size;
|
||||
if kid_base.flags.contains(INLINE_POSITION_IS_STATIC) {
|
||||
if kid_base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
|
||||
// The inline-start margin edge of the child flow is at our inline-start content
|
||||
// edge, and its inline-size is our content inline-size.
|
||||
kid_base.position.start.i =
|
||||
|
@ -855,7 +854,7 @@ impl Flow for FlexFlow {
|
|||
.iter()
|
||||
.enumerate()
|
||||
.filter(|&(_, flow)| {
|
||||
!flow.as_block().base.flags.contains(IS_ABSOLUTELY_POSITIONED)
|
||||
!flow.as_block().base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
})
|
||||
.map(|(index, flow)| FlexItem::new(index, flow))
|
||||
.collect();
|
||||
|
@ -873,7 +872,8 @@ impl Flow for FlexFlow {
|
|||
let _scope = layout_debug_scope!("flex::assign_inline_sizes {:x}", self.block_flow.base.debug_id());
|
||||
debug!("assign_inline_sizes");
|
||||
|
||||
if !self.block_flow.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||
if !self.block_flow.base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW |
|
||||
ServoRestyleDamage::REFLOW) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use app_units::{Au, MAX_AU};
|
||||
use block::FormattingContextType;
|
||||
use flow::{self, CLEARS_LEFT, CLEARS_RIGHT, Flow, ImmutableFlowUtils};
|
||||
use flow::{self, Flow, FlowFlags, ImmutableFlowUtils};
|
||||
use persistent_list::PersistentList;
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
|
@ -459,10 +459,10 @@ impl SpeculatedFloatPlacement {
|
|||
/// flow, computes the speculated inline size of the floats flowing in.
|
||||
pub fn compute_floats_in(&mut self, flow: &mut Flow) {
|
||||
let base_flow = flow::base(flow);
|
||||
if base_flow.flags.contains(CLEARS_LEFT) {
|
||||
if base_flow.flags.contains(FlowFlags::CLEARS_LEFT) {
|
||||
self.left = Au(0)
|
||||
}
|
||||
if base_flow.flags.contains(CLEARS_RIGHT) {
|
||||
if base_flow.flags.contains(FlowFlags::CLEARS_RIGHT) {
|
||||
self.right = Au(0)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ use style::context::SharedStyleContext;
|
|||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::selector_parser::RestyleDamage;
|
||||
use style::servo::restyle_damage::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use table::TableFlow;
|
||||
use table_caption::TableCaptionFlow;
|
||||
|
@ -252,7 +252,7 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
|
|||
if might_have_floats_in_or_out {
|
||||
mut_base(self).thread_id = parent_thread_id;
|
||||
self.assign_block_size(layout_context);
|
||||
mut_base(self).restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
mut_base(self).restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
}
|
||||
might_have_floats_in_or_out
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
|
|||
|
||||
fn contains_positioned_fragments(&self) -> bool {
|
||||
self.contains_relatively_positioned_fragments() ||
|
||||
base(self).flags.contains(IS_ABSOLUTELY_POSITIONED)
|
||||
base(self).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED)
|
||||
}
|
||||
|
||||
fn contains_relatively_positioned_fragments(&self) -> bool {
|
||||
|
@ -591,52 +591,52 @@ impl FlowClass {
|
|||
|
||||
bitflags! {
|
||||
#[doc = "Flags used in flows."]
|
||||
pub flags FlowFlags: u32 {
|
||||
pub struct FlowFlags: u32 {
|
||||
// text align flags
|
||||
#[doc = "Whether this flow is absolutely positioned. This is checked all over layout, so a"]
|
||||
#[doc = "virtual call is too expensive."]
|
||||
const IS_ABSOLUTELY_POSITIONED = 0b0000_0000_0000_0000_0100_0000,
|
||||
const IS_ABSOLUTELY_POSITIONED = 0b0000_0000_0000_0000_0100_0000;
|
||||
#[doc = "Whether this flow clears to the left. This is checked all over layout, so a"]
|
||||
#[doc = "virtual call is too expensive."]
|
||||
const CLEARS_LEFT = 0b0000_0000_0000_0000_1000_0000,
|
||||
const CLEARS_LEFT = 0b0000_0000_0000_0000_1000_0000;
|
||||
#[doc = "Whether this flow clears to the right. This is checked all over layout, so a"]
|
||||
#[doc = "virtual call is too expensive."]
|
||||
const CLEARS_RIGHT = 0b0000_0000_0000_0001_0000_0000,
|
||||
const CLEARS_RIGHT = 0b0000_0000_0000_0001_0000_0000;
|
||||
#[doc = "Whether this flow is left-floated. This is checked all over layout, so a"]
|
||||
#[doc = "virtual call is too expensive."]
|
||||
const FLOATS_LEFT = 0b0000_0000_0000_0010_0000_0000,
|
||||
const FLOATS_LEFT = 0b0000_0000_0000_0010_0000_0000;
|
||||
#[doc = "Whether this flow is right-floated. This is checked all over layout, so a"]
|
||||
#[doc = "virtual call is too expensive."]
|
||||
const FLOATS_RIGHT = 0b0000_0000_0000_0100_0000_0000,
|
||||
const FLOATS_RIGHT = 0b0000_0000_0000_0100_0000_0000;
|
||||
#[doc = "Text alignment. \
|
||||
|
||||
NB: If you update this, update `TEXT_ALIGN_SHIFT` below."]
|
||||
const TEXT_ALIGN = 0b0000_0000_0111_1000_0000_0000,
|
||||
const TEXT_ALIGN = 0b0000_0000_0111_1000_0000_0000;
|
||||
#[doc = "Whether this flow has a fragment with `counter-reset` or `counter-increment` \
|
||||
styles."]
|
||||
const AFFECTS_COUNTERS = 0b0000_0000_1000_0000_0000_0000,
|
||||
const AFFECTS_COUNTERS = 0b0000_0000_1000_0000_0000_0000;
|
||||
#[doc = "Whether this flow's descendants have fragments that affect `counter-reset` or \
|
||||
`counter-increment` styles."]
|
||||
const HAS_COUNTER_AFFECTING_CHILDREN = 0b0000_0001_0000_0000_0000_0000,
|
||||
const HAS_COUNTER_AFFECTING_CHILDREN = 0b0000_0001_0000_0000_0000_0000;
|
||||
#[doc = "Whether this flow behaves as though it had `position: static` for the purposes \
|
||||
of positioning in the inline direction. This is set for flows with `position: \
|
||||
static` and `position: relative` as well as absolutely-positioned flows with \
|
||||
unconstrained positions in the inline direction."]
|
||||
const INLINE_POSITION_IS_STATIC = 0b0000_0010_0000_0000_0000_0000,
|
||||
const INLINE_POSITION_IS_STATIC = 0b0000_0010_0000_0000_0000_0000;
|
||||
#[doc = "Whether this flow behaves as though it had `position: static` for the purposes \
|
||||
of positioning in the block direction. This is set for flows with `position: \
|
||||
static` and `position: relative` as well as absolutely-positioned flows with \
|
||||
unconstrained positions in the block direction."]
|
||||
const BLOCK_POSITION_IS_STATIC = 0b0000_0100_0000_0000_0000_0000,
|
||||
const BLOCK_POSITION_IS_STATIC = 0b0000_0100_0000_0000_0000_0000;
|
||||
|
||||
/// Whether any ancestor is a fragmentation container
|
||||
const CAN_BE_FRAGMENTED = 0b0000_1000_0000_0000_0000_0000,
|
||||
const CAN_BE_FRAGMENTED = 0b0000_1000_0000_0000_0000_0000;
|
||||
|
||||
/// Whether this flow contains any text and/or replaced fragments.
|
||||
const CONTAINS_TEXT_OR_REPLACED_FRAGMENTS = 0b0001_0000_0000_0000_0000_0000,
|
||||
const CONTAINS_TEXT_OR_REPLACED_FRAGMENTS = 0b0001_0000_0000_0000_0000_0000;
|
||||
|
||||
/// Whether margins are prohibited from collapsing with this flow.
|
||||
const MARGINS_CANNOT_COLLAPSE = 0b0010_0000_0000_0000_0000_0000,
|
||||
const MARGINS_CANNOT_COLLAPSE = 0b0010_0000_0000_0000_0000_0000;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -648,20 +648,20 @@ static TEXT_ALIGN_SHIFT: usize = 11;
|
|||
impl FlowFlags {
|
||||
#[inline]
|
||||
pub fn text_align(self) -> text_align::T {
|
||||
text_align::T::from_u32((self & TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap()
|
||||
text_align::T::from_u32((self & FlowFlags::TEXT_ALIGN).bits() >> TEXT_ALIGN_SHIFT).unwrap()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_text_align(&mut self, value: text_align::T) {
|
||||
*self = (*self & !TEXT_ALIGN) |
|
||||
*self = (*self & !FlowFlags::TEXT_ALIGN) |
|
||||
FlowFlags::from_bits(value.to_u32() << TEXT_ALIGN_SHIFT).unwrap();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn float_kind(&self) -> float::T {
|
||||
if self.contains(FLOATS_LEFT) {
|
||||
if self.contains(FlowFlags::FLOATS_LEFT) {
|
||||
float::T::left
|
||||
} else if self.contains(FLOATS_RIGHT) {
|
||||
} else if self.contains(FlowFlags::FLOATS_RIGHT) {
|
||||
float::T::right
|
||||
} else {
|
||||
float::T::none
|
||||
|
@ -670,12 +670,12 @@ impl FlowFlags {
|
|||
|
||||
#[inline]
|
||||
pub fn is_float(&self) -> bool {
|
||||
self.contains(FLOATS_LEFT) || self.contains(FLOATS_RIGHT)
|
||||
self.contains(FlowFlags::FLOATS_LEFT) || self.contains(FlowFlags::FLOATS_RIGHT)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn clears_floats(&self) -> bool {
|
||||
self.contains(CLEARS_LEFT) || self.contains(CLEARS_RIGHT)
|
||||
self.contains(FlowFlags::CLEARS_LEFT) || self.contains(FlowFlags::CLEARS_RIGHT)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -947,8 +947,8 @@ impl fmt::Debug for BaseFlow {
|
|||
overflow={:?}{}{}{}",
|
||||
self.stacking_context_id,
|
||||
self.position,
|
||||
if self.flags.contains(FLOATS_LEFT) { "FL" } else { "" },
|
||||
if self.flags.contains(FLOATS_RIGHT) { "FR" } else { "" },
|
||||
if self.flags.contains(FlowFlags::FLOATS_LEFT) { "FL" } else { "" },
|
||||
if self.flags.contains(FlowFlags::FLOATS_RIGHT) { "FR" } else { "" },
|
||||
self.speculated_float_placement_in,
|
||||
self.speculated_float_placement_out,
|
||||
self.overflow,
|
||||
|
@ -991,50 +991,50 @@ impl BaseFlow {
|
|||
Some(style) => {
|
||||
match style.get_box().position {
|
||||
position::T::absolute | position::T::fixed => {
|
||||
flags.insert(IS_ABSOLUTELY_POSITIONED);
|
||||
flags.insert(FlowFlags::IS_ABSOLUTELY_POSITIONED);
|
||||
|
||||
let logical_position = style.logical_position();
|
||||
if logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
|
||||
logical_position.inline_end == LengthOrPercentageOrAuto::Auto {
|
||||
flags.insert(INLINE_POSITION_IS_STATIC);
|
||||
flags.insert(FlowFlags::INLINE_POSITION_IS_STATIC);
|
||||
}
|
||||
if logical_position.block_start == LengthOrPercentageOrAuto::Auto &&
|
||||
logical_position.block_end == LengthOrPercentageOrAuto::Auto {
|
||||
flags.insert(BLOCK_POSITION_IS_STATIC);
|
||||
flags.insert(FlowFlags::BLOCK_POSITION_IS_STATIC);
|
||||
}
|
||||
}
|
||||
_ => flags.insert(BLOCK_POSITION_IS_STATIC | INLINE_POSITION_IS_STATIC),
|
||||
_ => flags.insert(FlowFlags::BLOCK_POSITION_IS_STATIC | FlowFlags::INLINE_POSITION_IS_STATIC),
|
||||
}
|
||||
|
||||
if force_nonfloated == ForceNonfloatedFlag::FloatIfNecessary {
|
||||
match style.get_box().float {
|
||||
float::T::none => {}
|
||||
float::T::left => flags.insert(FLOATS_LEFT),
|
||||
float::T::right => flags.insert(FLOATS_RIGHT),
|
||||
float::T::left => flags.insert(FlowFlags::FLOATS_LEFT),
|
||||
float::T::right => flags.insert(FlowFlags::FLOATS_RIGHT),
|
||||
}
|
||||
}
|
||||
|
||||
match style.get_box().clear {
|
||||
clear::T::none => {}
|
||||
clear::T::left => flags.insert(CLEARS_LEFT),
|
||||
clear::T::right => flags.insert(CLEARS_RIGHT),
|
||||
clear::T::left => flags.insert(FlowFlags::CLEARS_LEFT),
|
||||
clear::T::right => flags.insert(FlowFlags::CLEARS_RIGHT),
|
||||
clear::T::both => {
|
||||
flags.insert(CLEARS_LEFT);
|
||||
flags.insert(CLEARS_RIGHT);
|
||||
flags.insert(FlowFlags::CLEARS_LEFT);
|
||||
flags.insert(FlowFlags::CLEARS_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
if !style.get_counters().counter_reset.0.is_empty() ||
|
||||
!style.get_counters().counter_increment.0.is_empty() {
|
||||
flags.insert(AFFECTS_COUNTERS)
|
||||
flags.insert(FlowFlags::AFFECTS_COUNTERS)
|
||||
}
|
||||
}
|
||||
None => flags.insert(BLOCK_POSITION_IS_STATIC | INLINE_POSITION_IS_STATIC),
|
||||
None => flags.insert(FlowFlags::BLOCK_POSITION_IS_STATIC | FlowFlags::INLINE_POSITION_IS_STATIC),
|
||||
}
|
||||
|
||||
// New flows start out as fully damaged.
|
||||
let mut damage = RestyleDamage::rebuild_and_reflow();
|
||||
damage.remove(RECONSTRUCT_FLOW);
|
||||
damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW);
|
||||
|
||||
BaseFlow {
|
||||
restyle_damage: damage,
|
||||
|
@ -1071,15 +1071,15 @@ impl BaseFlow {
|
|||
pub fn update_flags_if_needed(&mut self, style: &ComputedValues) {
|
||||
// For absolutely-positioned flows, changes to top/bottom/left/right can cause these flags
|
||||
// to get out of date:
|
||||
if self.restyle_damage.contains(REFLOW_OUT_OF_FLOW) {
|
||||
if self.restyle_damage.contains(ServoRestyleDamage::REFLOW_OUT_OF_FLOW) {
|
||||
// Note: We don't need to check whether IS_ABSOLUTELY_POSITIONED has changed, because
|
||||
// changes to the 'position' property trigger flow reconstruction.
|
||||
if self.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if self.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
let logical_position = style.logical_position();
|
||||
self.flags.set(INLINE_POSITION_IS_STATIC,
|
||||
self.flags.set(FlowFlags::INLINE_POSITION_IS_STATIC,
|
||||
logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
|
||||
logical_position.inline_end == LengthOrPercentageOrAuto::Auto);
|
||||
self.flags.set(BLOCK_POSITION_IS_STATIC,
|
||||
self.flags.set(FlowFlags::BLOCK_POSITION_IS_STATIC,
|
||||
logical_position.block_start == LengthOrPercentageOrAuto::Auto &&
|
||||
logical_position.block_end == LengthOrPercentageOrAuto::Auto);
|
||||
}
|
||||
|
@ -1090,7 +1090,8 @@ impl BaseFlow {
|
|||
pub fn clone_with_children(&self, children: FlowList) -> BaseFlow {
|
||||
BaseFlow {
|
||||
children: children,
|
||||
restyle_damage: self.restyle_damage | REPAINT | REFLOW_OUT_OF_FLOW | REFLOW,
|
||||
restyle_damage: self.restyle_damage | ServoRestyleDamage::REPAINT |
|
||||
ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW,
|
||||
parallel: FlowParallelInfo::new(),
|
||||
floats: self.floats.clone(),
|
||||
abs_descendants: self.abs_descendants.clone(),
|
||||
|
@ -1288,7 +1289,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
|||
return Some(base(kid).position.start.b + baseline_offset)
|
||||
}
|
||||
}
|
||||
if kid.is_block_like() && !base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if kid.is_block_like() && !base(kid).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
if let Some(baseline_offset) = kid.baseline_offset_of_last_line_box_in_flow() {
|
||||
return Some(base(kid).position.start.b + baseline_offset)
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode};
|
|||
use gfx::text::glyph::ByteIndex;
|
||||
use gfx::text::text_run::{TextRun, TextRunSlice};
|
||||
use gfx_traits::StackingContextId;
|
||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo};
|
||||
use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT, LineMetrics};
|
||||
use inline::{InlineFragmentNodeFlags, InlineFragmentContext, InlineFragmentNodeInfo};
|
||||
use inline::{InlineMetrics, LineMetrics};
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
#[cfg(debug_assertions)]
|
||||
use layout_debug;
|
||||
|
@ -48,7 +48,7 @@ use style::logical_geometry::{Direction, LogicalMargin, LogicalRect, LogicalSize
|
|||
use style::properties::ComputedValues;
|
||||
use style::properties::longhands::transform::computed_value::T as TransformList;
|
||||
use style::selector_parser::RestyleDamage;
|
||||
use style::servo::restyle_damage::RECONSTRUCT_FLOW;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::str::char_is_whitespace;
|
||||
use style::values::{self, Either, Auto};
|
||||
use style::values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
|
@ -533,13 +533,13 @@ pub struct ScannedTextFragmentInfo {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
pub flags ScannedTextFlags: u8 {
|
||||
pub struct ScannedTextFlags: u8 {
|
||||
/// Whether a line break is required after this fragment if wrapping on newlines (e.g. if
|
||||
/// `white-space: pre` is in effect).
|
||||
const REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES = 0x01,
|
||||
const REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES = 0x01;
|
||||
|
||||
/// Is this fragment selected?
|
||||
const SELECTED = 0x02,
|
||||
const SELECTED = 0x02;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,11 +566,11 @@ impl ScannedTextFragmentInfo {
|
|||
}
|
||||
|
||||
pub fn requires_line_break_afterward_if_wrapping_on_newlines(&self) -> bool {
|
||||
self.flags.contains(REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES)
|
||||
self.flags.contains(ScannedTextFlags::REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES)
|
||||
}
|
||||
|
||||
pub fn selected(&self) -> bool {
|
||||
self.flags.contains(SELECTED)
|
||||
self.flags.contains(ScannedTextFlags::SELECTED)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -671,7 +671,7 @@ impl Fragment {
|
|||
let writing_mode = style.writing_mode;
|
||||
|
||||
let mut restyle_damage = node.restyle_damage();
|
||||
restyle_damage.remove(RECONSTRUCT_FLOW);
|
||||
restyle_damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW);
|
||||
|
||||
Fragment {
|
||||
node: node.opaque(),
|
||||
|
@ -700,7 +700,7 @@ impl Fragment {
|
|||
-> Fragment {
|
||||
let writing_mode = style.writing_mode;
|
||||
|
||||
restyle_damage.remove(RECONSTRUCT_FLOW);
|
||||
restyle_damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW);
|
||||
|
||||
Fragment {
|
||||
node: node,
|
||||
|
@ -753,7 +753,7 @@ impl Fragment {
|
|||
size);
|
||||
|
||||
let mut restyle_damage = RestyleDamage::rebuild_and_reflow();
|
||||
restyle_damage.remove(RECONSTRUCT_FLOW);
|
||||
restyle_damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW);
|
||||
|
||||
Fragment {
|
||||
node: self.node,
|
||||
|
@ -818,7 +818,7 @@ impl Fragment {
|
|||
});
|
||||
debug_assert!(ellipsis_fragments.len() == 1);
|
||||
ellipsis_fragment = ellipsis_fragments.fragments.into_iter().next().unwrap();
|
||||
ellipsis_fragment.flags |= IS_ELLIPSIS;
|
||||
ellipsis_fragment.flags |= FragmentFlags::IS_ELLIPSIS;
|
||||
ellipsis_fragment
|
||||
}
|
||||
|
||||
|
@ -858,35 +858,36 @@ impl Fragment {
|
|||
QuantitiesIncludedInIntrinsicInlineSizes::all()
|
||||
}
|
||||
SpecificFragmentInfo::Table => {
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED |
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED |
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
}
|
||||
SpecificFragmentInfo::TableCell => {
|
||||
let base_quantities = INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
|
||||
let base_quantities = QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_PADDING |
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
|
||||
if self.style.get_inheritedtable().border_collapse ==
|
||||
border_collapse::T::separate {
|
||||
base_quantities | INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
base_quantities | QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
} else {
|
||||
base_quantities
|
||||
}
|
||||
}
|
||||
SpecificFragmentInfo::TableWrapper => {
|
||||
let base_quantities = INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS |
|
||||
INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
|
||||
let base_quantities = QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS |
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
|
||||
if self.style.get_inheritedtable().border_collapse ==
|
||||
border_collapse::T::separate {
|
||||
base_quantities | INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
base_quantities | QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
} else {
|
||||
base_quantities
|
||||
}
|
||||
}
|
||||
SpecificFragmentInfo::TableRow => {
|
||||
let base_quantities = INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
|
||||
let base_quantities =
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED;
|
||||
if self.style.get_inheritedtable().border_collapse ==
|
||||
border_collapse::T::separate {
|
||||
base_quantities | INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
base_quantities | QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER
|
||||
} else {
|
||||
base_quantities
|
||||
}
|
||||
|
@ -914,7 +915,8 @@ impl Fragment {
|
|||
// FIXME(pcwalton): Percentages should be relative to any definite size per CSS-SIZING.
|
||||
// This will likely need to be done by pushing down definite sizes during selector
|
||||
// cascading.
|
||||
let margin = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS) {
|
||||
let margin = if flags.contains(
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS) {
|
||||
let margin = style.logical_margin();
|
||||
(MaybeAuto::from_style(margin.inline_start, Au(0)).specified_or_zero() +
|
||||
MaybeAuto::from_style(margin.inline_end, Au(0)).specified_or_zero())
|
||||
|
@ -925,7 +927,8 @@ impl Fragment {
|
|||
// FIXME(pcwalton): Percentages should be relative to any definite size per CSS-SIZING.
|
||||
// This will likely need to be done by pushing down definite sizes during selector
|
||||
// cascading.
|
||||
let padding = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_PADDING) {
|
||||
let padding = if flags.contains(
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_PADDING) {
|
||||
let padding = style.logical_padding();
|
||||
(padding.inline_start.to_used_value(Au(0)) +
|
||||
padding.inline_end.to_used_value(Au(0)))
|
||||
|
@ -933,7 +936,8 @@ impl Fragment {
|
|||
Au(0)
|
||||
};
|
||||
|
||||
let border = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_BORDER) {
|
||||
let border = if flags.contains(
|
||||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_BORDER) {
|
||||
self.border_width().inline_start_end()
|
||||
} else {
|
||||
Au(0)
|
||||
|
@ -952,7 +956,7 @@ impl Fragment {
|
|||
let (border_padding, margin) = self.surrounding_intrinsic_inline_size();
|
||||
|
||||
let mut specified = Au(0);
|
||||
if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) {
|
||||
if flags.contains(QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) {
|
||||
specified = MaybeAuto::from_style(style.content_inline_size(),
|
||||
Au(0)).specified_or_zero();
|
||||
specified = max(style.min_inline_size().to_used_value(Au(0)), specified);
|
||||
|
@ -1203,10 +1207,10 @@ impl Fragment {
|
|||
inline_fragment_context.nodes.iter().fold(style_border_width, |accumulator, node| {
|
||||
let mut this_border_width =
|
||||
node.style.border_width_for_writing_mode(writing_mode);
|
||||
if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
if !node.flags.contains(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
this_border_width.inline_start = Au(0)
|
||||
}
|
||||
if !node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
|
||||
if !node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
|
||||
this_border_width.inline_end = Au(0)
|
||||
}
|
||||
accumulator + this_border_width
|
||||
|
@ -1260,13 +1264,15 @@ impl Fragment {
|
|||
if let Some(ref inline_context) = self.inline_context {
|
||||
for node in &inline_context.nodes {
|
||||
let margin = node.style.logical_margin();
|
||||
let this_inline_start_margin = if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
let this_inline_start_margin = if !node.flags.contains(
|
||||
InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
Au(0)
|
||||
} else {
|
||||
MaybeAuto::from_style(margin.inline_start,
|
||||
containing_block_inline_size).specified_or_zero()
|
||||
};
|
||||
let this_inline_end_margin = if !node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
|
||||
let this_inline_end_margin = if!node.flags.contains(
|
||||
InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
|
||||
Au(0)
|
||||
} else {
|
||||
MaybeAuto::from_style(margin.inline_end,
|
||||
|
@ -1339,10 +1345,10 @@ impl Fragment {
|
|||
let zero_padding = LogicalMargin::zero(writing_mode);
|
||||
inline_fragment_context.nodes.iter().fold(zero_padding, |accumulator, node| {
|
||||
let mut padding = model::padding_from_style(&*node.style, Au(0), writing_mode);
|
||||
if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
if !node.flags.contains(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
padding.inline_start = Au(0)
|
||||
}
|
||||
if !node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
|
||||
if !node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
|
||||
padding.inline_end = Au(0)
|
||||
}
|
||||
accumulator + padding
|
||||
|
@ -1584,12 +1590,12 @@ impl Fragment {
|
|||
let mut border_width = node.style.logical_border_width();
|
||||
let mut padding = model::padding_from_style(&*node.style, Au(0), writing_mode);
|
||||
let mut margin = model::specified_margin_from_style(&*node.style, writing_mode);
|
||||
if !node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
if !node.flags.contains(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
border_width.inline_start = Au(0);
|
||||
padding.inline_start = Au(0);
|
||||
margin.inline_start = Au(0);
|
||||
}
|
||||
if !node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
|
||||
if !node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
|
||||
border_width.inline_end = Au(0);
|
||||
padding.inline_end = Au(0);
|
||||
margin.inline_end = Au(0);
|
||||
|
@ -1647,9 +1653,9 @@ impl Fragment {
|
|||
|
||||
let mut flags = SplitOptions::empty();
|
||||
if starts_line {
|
||||
flags.insert(STARTS_LINE);
|
||||
flags.insert(SplitOptions::STARTS_LINE);
|
||||
if self.style().get_inheritedtext().overflow_wrap == overflow_wrap::T::break_word {
|
||||
flags.insert(RETRY_AT_CHARACTER_BOUNDARIES)
|
||||
flags.insert(SplitOptions::RETRY_AT_CHARACTER_BOUNDARIES)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1667,7 +1673,7 @@ impl Fragment {
|
|||
// Break at character boundaries.
|
||||
let character_breaking_strategy =
|
||||
text_fragment_info.run.character_slices_in_range(&text_fragment_info.range);
|
||||
flags.remove(RETRY_AT_CHARACTER_BOUNDARIES);
|
||||
flags.remove(SplitOptions::RETRY_AT_CHARACTER_BOUNDARIES);
|
||||
self.calculate_split_position_using_breaking_strategy(
|
||||
character_breaking_strategy,
|
||||
max_inline_size,
|
||||
|
@ -1830,12 +1836,12 @@ impl Fragment {
|
|||
if split_is_empty || overflowing {
|
||||
// If we've been instructed to retry at character boundaries (probably via
|
||||
// `overflow-wrap: break-word`), do so.
|
||||
if flags.contains(RETRY_AT_CHARACTER_BOUNDARIES) {
|
||||
if flags.contains(SplitOptions::RETRY_AT_CHARACTER_BOUNDARIES) {
|
||||
let character_breaking_strategy =
|
||||
text_fragment_info.run
|
||||
.character_slices_in_range(&text_fragment_info.range);
|
||||
let mut flags = flags;
|
||||
flags.remove(RETRY_AT_CHARACTER_BOUNDARIES);
|
||||
flags.remove(SplitOptions::RETRY_AT_CHARACTER_BOUNDARIES);
|
||||
return self.calculate_split_position_using_breaking_strategy(
|
||||
character_breaking_strategy,
|
||||
max_inline_size,
|
||||
|
@ -1844,7 +1850,7 @@ impl Fragment {
|
|||
|
||||
// We aren't at the start of the line, so don't overflow. Let inline layout wrap to
|
||||
// the next line instead.
|
||||
if !flags.contains(STARTS_LINE) {
|
||||
if !flags.contains(SplitOptions::STARTS_LINE) {
|
||||
return None
|
||||
}
|
||||
}
|
||||
|
@ -1880,7 +1886,7 @@ impl Fragment {
|
|||
this_info.range_end_including_stripped_whitespace =
|
||||
other_info.range_end_including_stripped_whitespace;
|
||||
if other_info.requires_line_break_afterward_if_wrapping_on_newlines() {
|
||||
this_info.flags.insert(REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
|
||||
this_info.flags.insert(ScannedTextFlags::REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
|
||||
}
|
||||
if other_info.insertion_point.is_some() {
|
||||
this_info.insertion_point = other_info.insertion_point;
|
||||
|
@ -2340,7 +2346,7 @@ impl Fragment {
|
|||
// side, then we can't merge with the next fragment.
|
||||
if let Some(ref inline_context) = self.inline_context {
|
||||
for inline_context_node in inline_context.nodes.iter() {
|
||||
if !inline_context_node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
|
||||
if !inline_context_node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
|
||||
continue
|
||||
}
|
||||
if inline_context_node.style.logical_margin().inline_end !=
|
||||
|
@ -2361,7 +2367,7 @@ impl Fragment {
|
|||
// preceding side, then it can't merge with us.
|
||||
if let Some(ref inline_context) = other.inline_context {
|
||||
for inline_context_node in inline_context.nodes.iter() {
|
||||
if !inline_context_node.flags.contains(FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
if !inline_context_node.flags.contains(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
continue
|
||||
}
|
||||
if inline_context_node.style.logical_margin().inline_start !=
|
||||
|
@ -2807,14 +2813,15 @@ impl Fragment {
|
|||
.zip(inline_context_of_next_fragment.nodes.iter().rev())
|
||||
{
|
||||
if !inline_context_node_from_next_fragment.flags.contains(
|
||||
LAST_FRAGMENT_OF_ELEMENT) {
|
||||
InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
|
||||
continue
|
||||
}
|
||||
if inline_context_node_from_next_fragment.address !=
|
||||
inline_context_node_from_this_fragment.address {
|
||||
continue
|
||||
}
|
||||
inline_context_node_from_this_fragment.flags.insert(LAST_FRAGMENT_OF_ELEMENT);
|
||||
inline_context_node_from_this_fragment.flags.insert(
|
||||
InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2829,7 +2836,7 @@ impl Fragment {
|
|||
inline_context_of_this_fragment.nodes.iter_mut().rev())
|
||||
{
|
||||
if !inline_context_node_from_prev_fragment.flags.contains(
|
||||
FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT) {
|
||||
continue
|
||||
}
|
||||
if inline_context_node_from_prev_fragment.address !=
|
||||
|
@ -2837,7 +2844,7 @@ impl Fragment {
|
|||
continue
|
||||
}
|
||||
inline_context_node_from_this_fragment.flags.insert(
|
||||
FIRST_FRAGMENT_OF_ELEMENT);
|
||||
InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2975,23 +2982,23 @@ impl fmt::Debug for Fragment {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
flags QuantitiesIncludedInIntrinsicInlineSizes: u8 {
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS = 0x01,
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_PADDING = 0x02,
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_BORDER = 0x04,
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED = 0x08,
|
||||
struct QuantitiesIncludedInIntrinsicInlineSizes: u8 {
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS = 0x01;
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_PADDING = 0x02;
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_BORDER = 0x04;
|
||||
const INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED = 0x08;
|
||||
}
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
// Various flags we can use when splitting fragments. See
|
||||
// `calculate_split_position_using_breaking_strategy()`.
|
||||
flags SplitOptions: u8 {
|
||||
struct SplitOptions: u8 {
|
||||
#[doc = "True if this is the first fragment on the line."]
|
||||
const STARTS_LINE = 0x01,
|
||||
const STARTS_LINE = 0x01;
|
||||
#[doc = "True if we should attempt to split at character boundaries if this split fails. \
|
||||
This is used to implement `overflow-wrap: break-word`."]
|
||||
const RETRY_AT_CHARACTER_BOUNDARIES = 0x02,
|
||||
const RETRY_AT_CHARACTER_BOUNDARIES = 0x02;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3104,14 +3111,14 @@ impl Overflow {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
pub flags FragmentFlags: u8 {
|
||||
pub struct FragmentFlags: u8 {
|
||||
// TODO(stshine): find a better name since these flags can also be used for grid item.
|
||||
/// Whether this fragment represents a child in a row flex container.
|
||||
const IS_INLINE_FLEX_ITEM = 0b0000_0001,
|
||||
const IS_INLINE_FLEX_ITEM = 0b0000_0001;
|
||||
/// Whether this fragment represents a child in a column flex container.
|
||||
const IS_BLOCK_FLEX_ITEM = 0b0000_0010,
|
||||
const IS_BLOCK_FLEX_ITEM = 0b0000_0010;
|
||||
/// Whether this fragment represents the generated text from a text-overflow clip.
|
||||
const IS_ELLIPSIS = 0b0000_0100,
|
||||
const IS_ELLIPSIS = 0b0000_0100;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
//! as possible.
|
||||
|
||||
use context::{LayoutContext, with_thread_local_font_context};
|
||||
use flow::{self, AFFECTS_COUNTERS, Flow, HAS_COUNTER_AFFECTING_CHILDREN, ImmutableFlowUtils};
|
||||
use flow::{self, Flow, FlowFlags, ImmutableFlowUtils};
|
||||
use fragment::{Fragment, GeneratedContentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
|
||||
use gfx::display_list::OpaqueNode;
|
||||
use script_layout_interface::wrapper_traits::PseudoElementType;
|
||||
|
@ -19,7 +19,7 @@ use style::computed_values::{display, list_style_type};
|
|||
use style::computed_values::content::ContentItem;
|
||||
use style::properties::ComputedValues;
|
||||
use style::selector_parser::RestyleDamage;
|
||||
use style::servo::restyle_damage::RESOLVE_GENERATED_CONTENT;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use text::TextRunScanner;
|
||||
use traversal::InorderFlowTraversal;
|
||||
|
||||
|
@ -131,8 +131,8 @@ impl<'a> InorderFlowTraversal for ResolveGeneratedContent<'a> {
|
|||
|
||||
#[inline]
|
||||
fn should_process_subtree(&mut self, flow: &mut Flow) -> bool {
|
||||
flow::base(flow).restyle_damage.intersects(RESOLVE_GENERATED_CONTENT) ||
|
||||
flow::base(flow).flags.intersects(AFFECTS_COUNTERS | HAS_COUNTER_AFFECTING_CHILDREN)
|
||||
flow::base(flow).restyle_damage.intersects(ServoRestyleDamage::RESOLVE_GENERATED_CONTENT) ||
|
||||
flow::base(flow).flags.intersects(FlowFlags::AFFECTS_COUNTERS | FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
* 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 flow::{self, AFFECTS_COUNTERS, Flow, HAS_COUNTER_AFFECTING_CHILDREN, IS_ABSOLUTELY_POSITIONED};
|
||||
use flow::{self, FlowFlags, Flow};
|
||||
use style::computed_values::float;
|
||||
use style::selector_parser::RestyleDamage;
|
||||
use style::servo::restyle_damage::{REFLOW, RECONSTRUCT_FLOW};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
|
||||
/// Used in a flow traversal to indicate whether this re-layout should be incremental or not.
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
|
@ -15,10 +15,10 @@ pub enum RelayoutMode {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
pub flags SpecialRestyleDamage: u8 {
|
||||
pub struct SpecialRestyleDamage: u8 {
|
||||
#[doc = "If this flag is set, we need to reflow the entire document. This is more or less a \
|
||||
temporary hack to deal with cases that we don't handle incrementally yet."]
|
||||
const REFLOW_ENTIRE_DOCUMENT = 0x01,
|
||||
const REFLOW_ENTIRE_DOCUMENT = 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ pub trait LayoutDamageComputation {
|
|||
impl<'a> LayoutDamageComputation for &'a mut Flow {
|
||||
fn compute_layout_damage(self) -> SpecialRestyleDamage {
|
||||
let mut special_damage = SpecialRestyleDamage::empty();
|
||||
let is_absolutely_positioned = flow::base(self).flags.contains(IS_ABSOLUTELY_POSITIONED);
|
||||
let is_absolutely_positioned = flow::base(self).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED);
|
||||
|
||||
// In addition to damage, we use this phase to compute whether nodes affect CSS counters.
|
||||
let mut has_counter_affecting_children = false;
|
||||
|
@ -42,7 +42,7 @@ impl<'a> LayoutDamageComputation for &'a mut Flow {
|
|||
|
||||
for kid in self_base.children.iter_mut() {
|
||||
let child_is_absolutely_positioned =
|
||||
flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED);
|
||||
flow::base(kid).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED);
|
||||
flow::mut_base(kid).restyle_damage.insert(
|
||||
parent_damage.damage_for_child(is_absolutely_positioned,
|
||||
child_is_absolutely_positioned));
|
||||
|
@ -55,21 +55,21 @@ impl<'a> LayoutDamageComputation for &'a mut Flow {
|
|||
child_is_absolutely_positioned));
|
||||
|
||||
has_counter_affecting_children = has_counter_affecting_children ||
|
||||
flow::base(kid).flags.intersects(AFFECTS_COUNTERS |
|
||||
HAS_COUNTER_AFFECTING_CHILDREN);
|
||||
flow::base(kid).flags.intersects(FlowFlags::AFFECTS_COUNTERS |
|
||||
FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN);
|
||||
}
|
||||
}
|
||||
|
||||
let self_base = flow::mut_base(self);
|
||||
if self_base.flags.float_kind() != float::T::none &&
|
||||
self_base.restyle_damage.intersects(REFLOW) {
|
||||
special_damage.insert(REFLOW_ENTIRE_DOCUMENT);
|
||||
self_base.restyle_damage.intersects(ServoRestyleDamage::REFLOW) {
|
||||
special_damage.insert(SpecialRestyleDamage::REFLOW_ENTIRE_DOCUMENT);
|
||||
}
|
||||
|
||||
if has_counter_affecting_children {
|
||||
self_base.flags.insert(HAS_COUNTER_AFFECTING_CHILDREN)
|
||||
self_base.flags.insert(FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN)
|
||||
} else {
|
||||
self_base.flags.remove(HAS_COUNTER_AFFECTING_CHILDREN)
|
||||
self_base.flags.remove(FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN)
|
||||
}
|
||||
|
||||
special_damage
|
||||
|
@ -78,7 +78,7 @@ impl<'a> LayoutDamageComputation for &'a mut Flow {
|
|||
fn reflow_entire_document(self) {
|
||||
let self_base = flow::mut_base(self);
|
||||
self_base.restyle_damage.insert(RestyleDamage::rebuild_and_reflow());
|
||||
self_base.restyle_damage.remove(RECONSTRUCT_FLOW);
|
||||
self_base.restyle_damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW);
|
||||
for kid in self_base.children.iter_mut() {
|
||||
kid.reflow_entire_document();
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ use display_list_builder::StackingContextCollectionState;
|
|||
use euclid::{Point2D, Size2D};
|
||||
use floats::{FloatKind, Floats, PlacementInfo};
|
||||
use flow::{self, BaseFlow, Flow, FlowClass, ForceNonfloatedFlag};
|
||||
use flow::{CONTAINS_TEXT_OR_REPLACED_FRAGMENTS, EarlyAbsolutePositionInfo, OpaqueFlow};
|
||||
use flow::{FlowFlags, EarlyAbsolutePositionInfo, OpaqueFlow};
|
||||
use flow_ref::FlowRef;
|
||||
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use fragment::IS_ELLIPSIS;
|
||||
use fragment::FragmentFlags;
|
||||
use fragment::SpecificFragmentInfo;
|
||||
use gfx::display_list::OpaqueNode;
|
||||
use gfx::font::FontMetrics;
|
||||
|
@ -34,7 +34,7 @@ use style::computed_values::{display, overflow_x, position, text_align, text_jus
|
|||
use style::computed_values::{vertical_align, white_space};
|
||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, RESOLVE_GENERATED_CONTENT};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::generics::box_::VerticalAlign;
|
||||
use style::values::specified::text::TextOverflowSide;
|
||||
use text;
|
||||
|
@ -345,7 +345,7 @@ impl LineBreaker {
|
|||
};
|
||||
|
||||
// Do not reflow truncated fragments. Reflow the original fragment only.
|
||||
let fragment = if fragment.flags.contains(IS_ELLIPSIS) {
|
||||
let fragment = if fragment.flags.contains(FragmentFlags::IS_ELLIPSIS) {
|
||||
continue
|
||||
} else if let SpecificFragmentInfo::TruncatedFragment(info) = fragment.specific {
|
||||
info.full
|
||||
|
@ -665,7 +665,7 @@ impl LineBreaker {
|
|||
inline_start_fragment.border_padding.inline_end = Au(0);
|
||||
if let Some(ref mut inline_context) = inline_start_fragment.inline_context {
|
||||
for node in &mut inline_context.nodes {
|
||||
node.flags.remove(LAST_FRAGMENT_OF_ELEMENT);
|
||||
node.flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
|
||||
}
|
||||
}
|
||||
inline_start_fragment.border_box.size.inline += inline_start_fragment.border_padding.inline_start;
|
||||
|
@ -673,7 +673,7 @@ impl LineBreaker {
|
|||
inline_end_fragment.border_padding.inline_start = Au(0);
|
||||
if let Some(ref mut inline_context) = inline_end_fragment.inline_context {
|
||||
for node in &mut inline_context.nodes {
|
||||
node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT);
|
||||
node.flags.remove(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT);
|
||||
}
|
||||
}
|
||||
inline_end_fragment.border_box.size.inline += inline_end_fragment.border_padding.inline_end;
|
||||
|
@ -897,7 +897,7 @@ impl InlineFlow {
|
|||
};
|
||||
|
||||
if flow.fragments.fragments.iter().any(Fragment::is_unscanned_generated_content) {
|
||||
flow.base.restyle_damage.insert(RESOLVE_GENERATED_CONTENT);
|
||||
flow.base.restyle_damage.insert(ServoRestyleDamage::RESOLVE_GENERATED_CONTENT);
|
||||
}
|
||||
|
||||
flow
|
||||
|
@ -1313,7 +1313,7 @@ impl Flow for InlineFlow {
|
|||
flow::mut_base(kid).floats = Floats::new(writing_mode);
|
||||
}
|
||||
|
||||
self.base.flags.remove(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
self.base.flags.remove(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
|
||||
let mut intrinsic_sizes_for_flow = IntrinsicISizesContribution::new();
|
||||
let mut intrinsic_sizes_for_inline_run = IntrinsicISizesContribution::new();
|
||||
|
@ -1372,10 +1372,10 @@ impl Flow for InlineFlow {
|
|||
}
|
||||
}
|
||||
|
||||
fragment.restyle_damage.remove(BUBBLE_ISIZES);
|
||||
fragment.restyle_damage.remove(ServoRestyleDamage::BUBBLE_ISIZES);
|
||||
|
||||
if fragment.is_text_or_replaced() {
|
||||
self.base.flags.insert(CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
self.base.flags.insert(FlowFlags::CONTAINS_TEXT_OR_REPLACED_FRAGMENTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1535,9 +1535,9 @@ impl Flow for InlineFlow {
|
|||
}
|
||||
});
|
||||
|
||||
self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
for fragment in &mut self.fragments.fragments {
|
||||
fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
fragment.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1766,9 +1766,9 @@ pub struct InlineFragmentNodeInfo {
|
|||
}
|
||||
|
||||
bitflags! {
|
||||
pub flags InlineFragmentNodeFlags: u8 {
|
||||
const FIRST_FRAGMENT_OF_ELEMENT = 0x01,
|
||||
const LAST_FRAGMENT_OF_ELEMENT = 0x02,
|
||||
pub struct InlineFragmentNodeFlags: u8 {
|
||||
const FIRST_FRAGMENT_OF_ELEMENT = 0x01;
|
||||
const LAST_FRAGMENT_OF_ELEMENT = 0x02;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ use inline::InlineFlow;
|
|||
use style::computed_values::{list_style_type, position};
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::RESOLVE_GENERATED_CONTENT;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl ::flow::HasBaseFlow for ListItemFlow {}
|
||||
|
@ -56,7 +56,7 @@ impl ListItemFlow {
|
|||
list_style_type::T::square |
|
||||
list_style_type::T::disclosure_open |
|
||||
list_style_type::T::disclosure_closed => {}
|
||||
_ => this.block_flow.base.restyle_damage.insert(RESOLVE_GENERATED_CONTENT),
|
||||
_ => this.block_flow.base.restyle_damage.insert(ServoRestyleDamage::RESOLVE_GENERATED_CONTENT),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use euclid::{Point2D, Vector2D, Rect, Size2D};
|
|||
use flow::{self, Flow};
|
||||
use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
|
||||
use gfx::display_list::{DisplayList, OpaqueNode, ScrollOffsetMap};
|
||||
use inline::LAST_FRAGMENT_OF_ELEMENT;
|
||||
use inline::InlineFragmentNodeFlags;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use opaque_node::OpaqueNodeMethods;
|
||||
|
@ -562,7 +562,7 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
|
|||
},
|
||||
}
|
||||
|
||||
if node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
|
||||
if node.flags.contains(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT) {
|
||||
self.has_processed_node = true;
|
||||
}
|
||||
} else if self.node_offset_box.is_none() {
|
||||
|
|
|
@ -9,12 +9,12 @@ use context::LayoutContext;
|
|||
use display_list_builder::{DisplayListBuildState, StackingContextCollectionState};
|
||||
use euclid::{Point2D, Vector2D};
|
||||
use floats::SpeculatedFloatPlacement;
|
||||
use flow::{self, Flow, ImmutableFlowUtils, IS_ABSOLUTELY_POSITIONED};
|
||||
use flow::{self, Flow, ImmutableFlowUtils, FlowFlags};
|
||||
use fragment::{FragmentBorderBoxIterator, CoordinateSystem};
|
||||
use generated_content::ResolveGeneratedContent;
|
||||
use incremental::RelayoutMode;
|
||||
use servo_config::opts;
|
||||
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, STORE_OVERFLOW};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
|
||||
use traversal::{InorderFlowTraversal, PostorderFlowTraversal, PreorderFlowTraversal};
|
||||
|
||||
|
@ -33,7 +33,7 @@ pub fn reflow(root: &mut Flow, layout_context: &LayoutContext, relayout_mode: Re
|
|||
if relayout_mode == RelayoutMode::Force {
|
||||
flow::mut_base(flow)
|
||||
.restyle_damage
|
||||
.insert(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
.insert(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
}
|
||||
|
||||
if assign_inline_sizes.should_process(flow) {
|
||||
|
@ -112,7 +112,7 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut Flow, iterator
|
|||
}
|
||||
|
||||
pub fn store_overflow(layout_context: &LayoutContext, flow: &mut Flow) {
|
||||
if !flow::base(flow).restyle_damage.contains(STORE_OVERFLOW) {
|
||||
if !flow::base(flow).restyle_damage.contains(ServoRestyleDamage::STORE_OVERFLOW) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -124,20 +124,20 @@ pub fn store_overflow(layout_context: &LayoutContext, flow: &mut Flow) {
|
|||
|
||||
flow::mut_base(flow)
|
||||
.restyle_damage
|
||||
.remove(STORE_OVERFLOW);
|
||||
.remove(ServoRestyleDamage::STORE_OVERFLOW);
|
||||
}
|
||||
|
||||
/// Guesses how much inline size will be taken up by floats on the left and right sides of the
|
||||
/// given flow. This is needed to speculatively calculate the inline sizes of block formatting
|
||||
/// contexts. The speculation typically succeeds, but if it doesn't we have to lay it out again.
|
||||
pub fn guess_float_placement(flow: &mut Flow) {
|
||||
if !flow::base(flow).restyle_damage.intersects(REFLOW) {
|
||||
if !flow::base(flow).restyle_damage.intersects(ServoRestyleDamage::REFLOW) {
|
||||
return;
|
||||
}
|
||||
|
||||
let mut floats_in = SpeculatedFloatPlacement::compute_floats_in_for_first_child(flow);
|
||||
for kid in flow::mut_base(flow).child_iter_mut() {
|
||||
if flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if flow::base(kid).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
// Do not propagate floats in or out, but do propogate between kids.
|
||||
guess_float_placement(kid);
|
||||
} else {
|
||||
|
|
|
@ -11,8 +11,7 @@ use block::{BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer};
|
|||
use block::{ISizeConstraintInput, ISizeConstraintSolution};
|
||||
use context::LayoutContext;
|
||||
use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode};
|
||||
use display_list_builder::{DisplayListBuildState, NEVER_CREATES_STACKING_CONTEXT};
|
||||
use display_list_builder::StackingContextCollectionState;
|
||||
use display_list_builder::{DisplayListBuildState, StackingContextCollectionFlags, StackingContextCollectionState};
|
||||
use euclid::Point2D;
|
||||
use flow;
|
||||
use flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils, OpaqueFlow};
|
||||
|
@ -27,7 +26,7 @@ use style::computed_values::{border_collapse, border_spacing, table_layout};
|
|||
use style::context::SharedStyleContext;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::CSSFloat;
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, CollapsedBorderProvenance};
|
||||
|
@ -505,7 +504,8 @@ impl Flow for TableFlow {
|
|||
|
||||
fn collect_stacking_contexts(&mut self, state: &mut StackingContextCollectionState) {
|
||||
// Stacking contexts are collected by the table wrapper.
|
||||
self.block_flow.collect_stacking_contexts_for_block(state, NEVER_CREATES_STACKING_CONTEXT);
|
||||
self.block_flow.collect_stacking_contexts_for_block(state,
|
||||
StackingContextCollectionFlags::NEVER_CREATES_STACKING_CONTEXT);
|
||||
}
|
||||
|
||||
fn repair_style(&mut self, new_style: &::ServoArc<ComputedValues>) {
|
||||
|
@ -735,7 +735,7 @@ impl TableLikeFlow for BlockFlow {
|
|||
debug_assert!(self.fragment.style.get_inheritedtable().border_collapse ==
|
||||
border_collapse::T::separate || block_direction_spacing == Au(0));
|
||||
|
||||
if self.base.restyle_damage.contains(REFLOW) {
|
||||
if self.base.restyle_damage.contains(ServoRestyleDamage::REFLOW) {
|
||||
// Our current border-box position.
|
||||
let block_start_border_padding = self.fragment.border_padding.block_start;
|
||||
let mut current_block_offset = block_start_border_padding;
|
||||
|
@ -809,7 +809,7 @@ impl TableLikeFlow for BlockFlow {
|
|||
}
|
||||
}
|
||||
|
||||
self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
self.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use display_list_builder::{BlockFlowDisplayListBuilding, BorderPaintingMode};
|
|||
use display_list_builder::{DisplayListBuildState, StackingContextCollectionFlags};
|
||||
use display_list_builder::StackingContextCollectionState;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use flow::{self, Flow, FlowClass, IS_ABSOLUTELY_POSITIONED, OpaqueFlow};
|
||||
use flow::{self, Flow, FlowClass, FlowFlags, OpaqueFlow};
|
||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use layout_debug;
|
||||
|
@ -102,7 +102,7 @@ impl TableCellFlow {
|
|||
let mut extents = None;
|
||||
for kid in flow::base(self).children.iter() {
|
||||
let kid_base = flow::base(kid);
|
||||
if kid_base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if kid_base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
continue
|
||||
}
|
||||
let start = kid_base.position.start.b -
|
||||
|
@ -144,7 +144,7 @@ impl TableCellFlow {
|
|||
|
||||
for kid in flow::mut_base(self).children.iter_mut() {
|
||||
let kid_base = flow::mut_base(kid);
|
||||
if !kid_base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
if !kid_base.flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED) {
|
||||
kid_base.position.start.b += offset
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ use std::iter::{Enumerate, IntoIterator, Peekable};
|
|||
use style::computed_values::{border_collapse, border_spacing, border_top_style};
|
||||
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::{Color, LengthOrPercentageOrAuto};
|
||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
|
||||
use table_cell::{CollapsedBordersForCell, TableCellFlow};
|
||||
|
@ -114,7 +114,7 @@ impl TableRowFlow {
|
|||
/// methods
|
||||
#[inline(always)]
|
||||
fn assign_block_size_table_row_base(&mut self, layout_context: &LayoutContext) {
|
||||
if self.block_flow.base.restyle_damage.contains(REFLOW) {
|
||||
if self.block_flow.base.restyle_damage.contains(ServoRestyleDamage::REFLOW) {
|
||||
// Per CSS 2.1 § 17.5.3, find max_y = max(computed `block-size`, minimum block-size of
|
||||
// all cells).
|
||||
let mut max_block_size = Au(0);
|
||||
|
@ -195,7 +195,7 @@ impl TableRowFlow {
|
|||
}
|
||||
}
|
||||
|
||||
self.block_flow.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
self.block_flow.base.restyle_damage.remove(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW);
|
||||
}
|
||||
|
||||
pub fn populate_collapsed_border_spacing<'a, I>(
|
||||
|
|
|
@ -10,7 +10,7 @@ use app_units::Au;
|
|||
use block::{BlockFlow, ISizeAndMarginsComputer};
|
||||
use context::LayoutContext;
|
||||
use display_list_builder::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||
use display_list_builder::{NEVER_CREATES_CONTAINING_BLOCK, StackingContextCollectionState};
|
||||
use display_list_builder::{StackingContextCollectionFlags, StackingContextCollectionState};
|
||||
use euclid::Point2D;
|
||||
use flow::{Flow, FlowClass, OpaqueFlow};
|
||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
|
@ -184,7 +184,8 @@ impl Flow for TableRowGroupFlow {
|
|||
}
|
||||
|
||||
fn collect_stacking_contexts(&mut self, state: &mut StackingContextCollectionState) {
|
||||
self.block_flow.collect_stacking_contexts_for_block(state, NEVER_CREATES_CONTAINING_BLOCK);
|
||||
self.block_flow.collect_stacking_contexts_for_block(state,
|
||||
StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK);
|
||||
}
|
||||
|
||||
fn repair_style(&mut self, new_style: &::ServoArc<ComputedValues>) {
|
||||
|
|
|
@ -17,12 +17,11 @@ use app_units::Au;
|
|||
use block::{AbsoluteNonReplaced, BlockFlow, FloatNonReplaced, ISizeAndMarginsComputer, ISizeConstraintInput};
|
||||
use block::{ISizeConstraintSolution, MarginsMayCollapseFlag};
|
||||
use context::LayoutContext;
|
||||
use display_list_builder::{BlockFlowDisplayListBuilding, DisplayListBuildState};
|
||||
use display_list_builder::{NEVER_CREATES_CLIP_SCROLL_NODE, NEVER_CREATES_CONTAINING_BLOCK};
|
||||
use display_list_builder::{BlockFlowDisplayListBuilding, DisplayListBuildState, StackingContextCollectionFlags};
|
||||
use display_list_builder::StackingContextCollectionState;
|
||||
use euclid::Point2D;
|
||||
use floats::FloatKind;
|
||||
use flow::{Flow, FlowClass, ImmutableFlowUtils, INLINE_POSITION_IS_STATIC, OpaqueFlow};
|
||||
use flow::{Flow, FlowClass, ImmutableFlowUtils, FlowFlags, OpaqueFlow};
|
||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use model::MaybeAuto;
|
||||
|
@ -256,7 +255,7 @@ impl TableWrapperFlow {
|
|||
return
|
||||
}
|
||||
|
||||
if !self.block_flow.base.flags.contains(INLINE_POSITION_IS_STATIC) {
|
||||
if !self.block_flow.base.flags.contains(FlowFlags::INLINE_POSITION_IS_STATIC) {
|
||||
let inline_size_computer = AbsoluteTable {
|
||||
minimum_width_of_all_columns: minimum_width_of_all_columns,
|
||||
preferred_width_of_all_columns: preferred_width_of_all_columns,
|
||||
|
@ -464,7 +463,9 @@ impl Flow for TableWrapperFlow {
|
|||
|
||||
fn collect_stacking_contexts(&mut self, state: &mut StackingContextCollectionState) {
|
||||
self.block_flow.collect_stacking_contexts_for_block(
|
||||
state, NEVER_CREATES_CONTAINING_BLOCK | NEVER_CREATES_CLIP_SCROLL_NODE);
|
||||
state,
|
||||
StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK |
|
||||
StackingContextCollectionFlags::NEVER_CREATES_CLIP_SCROLL_NODE);
|
||||
}
|
||||
|
||||
fn repair_style(&mut self, new_style: &::ServoArc<ComputedValues>) {
|
||||
|
|
|
@ -7,15 +7,14 @@
|
|||
#![deny(unsafe_code)]
|
||||
|
||||
use app_units::Au;
|
||||
use fragment::{Fragment, REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES, ScannedTextFlags};
|
||||
use fragment::{SELECTED, ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
|
||||
use gfx::font::{DISABLE_KERNING_SHAPING_FLAG, FontMetrics, IGNORE_LIGATURES_SHAPING_FLAG};
|
||||
use gfx::font::{KEEP_ALL_FLAG, RTL_FLAG, RunMetrics, ShapingFlags, ShapingOptions};
|
||||
use fragment::{Fragment, ScannedTextFlags};
|
||||
use fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo, UnscannedTextFragmentInfo};
|
||||
use gfx::font::{FontMetrics, RunMetrics, ShapingFlags, ShapingOptions};
|
||||
use gfx::font_context::FontContext;
|
||||
use gfx::text::glyph::ByteIndex;
|
||||
use gfx::text::text_run::TextRun;
|
||||
use gfx::text::util::{self, CompressionMode};
|
||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragments, LAST_FRAGMENT_OF_ELEMENT};
|
||||
use inline::{InlineFragmentNodeFlags, InlineFragments};
|
||||
use linked_list::split_off_head;
|
||||
use ordered_float::NotNaN;
|
||||
use range::Range;
|
||||
|
@ -291,15 +290,15 @@ impl TextRunScanner {
|
|||
let mut flags = ShapingFlags::empty();
|
||||
if let Some(v) = letter_spacing.value() {
|
||||
if v.px() != 0. {
|
||||
flags.insert(IGNORE_LIGATURES_SHAPING_FLAG);
|
||||
flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG);
|
||||
}
|
||||
}
|
||||
if text_rendering == text_rendering::T::optimizespeed {
|
||||
flags.insert(IGNORE_LIGATURES_SHAPING_FLAG);
|
||||
flags.insert(DISABLE_KERNING_SHAPING_FLAG)
|
||||
flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG);
|
||||
flags.insert(ShapingFlags::DISABLE_KERNING_SHAPING_FLAG)
|
||||
}
|
||||
if word_break == word_break::T::keep_all {
|
||||
flags.insert(KEEP_ALL_FLAG);
|
||||
flags.insert(ShapingFlags::KEEP_ALL_FLAG);
|
||||
}
|
||||
let options = ShapingOptions {
|
||||
letter_spacing: letter_spacing.value().cloned().map(Au::from),
|
||||
|
@ -313,7 +312,7 @@ impl TextRunScanner {
|
|||
let mut options = options;
|
||||
options.script = run_info.script;
|
||||
if run_info.bidi_level.is_rtl() {
|
||||
options.flags.insert(RTL_FLAG);
|
||||
options.flags.insert(ShapingFlags::RTL_FLAG);
|
||||
}
|
||||
let mut font = fontgroup.fonts.get(run_info.font_index).unwrap().borrow_mut();
|
||||
ScannedTextRun {
|
||||
|
@ -364,11 +363,11 @@ impl TextRunScanner {
|
|||
|
||||
if requires_line_break_afterward_if_wrapping_on_newlines {
|
||||
byte_range.extend_by(ByteIndex(-1)); // Trim the '\n'
|
||||
flags.insert(REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
|
||||
flags.insert(ScannedTextFlags::REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES);
|
||||
}
|
||||
|
||||
if mapping.selected {
|
||||
flags.insert(SELECTED);
|
||||
flags.insert(ScannedTextFlags::SELECTED);
|
||||
}
|
||||
|
||||
let insertion_point = if mapping.contains_insertion_point(scanned_run.insertion_point) {
|
||||
|
@ -402,10 +401,10 @@ impl TextRunScanner {
|
|||
if let Some(ref mut context) = new_fragment.inline_context {
|
||||
for node in &mut context.nodes {
|
||||
if !is_last_mapping_of_this_old_fragment {
|
||||
node.flags.remove(LAST_FRAGMENT_OF_ELEMENT);
|
||||
node.flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT);
|
||||
}
|
||||
if !is_first_mapping_of_this_old_fragment {
|
||||
node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT);
|
||||
node.flags.remove(InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
use construct::FlowConstructor;
|
||||
use context::LayoutContext;
|
||||
use display_list_builder::DisplayListBuildState;
|
||||
use flow::{self, CAN_BE_FRAGMENTED, Flow, ImmutableFlowUtils};
|
||||
use flow::{self, FlowFlags, Flow, ImmutableFlowUtils};
|
||||
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
|
||||
use servo_config::opts;
|
||||
use style::context::{SharedStyleContext, StyleContext};
|
||||
use style::data::ElementData;
|
||||
use style::dom::{NodeInfo, TElement, TNode};
|
||||
use style::selector_parser::RestyleDamage;
|
||||
use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::traversal::{DomTraversal, recalc_style_at};
|
||||
use style::traversal::PerLevelTraversalData;
|
||||
use wrapper::{GetRawData, LayoutNodeLayoutData};
|
||||
|
@ -209,7 +209,7 @@ fn construct_flows_at<N>(context: &LayoutContext, node: N)
|
|||
}
|
||||
}
|
||||
|
||||
tnode.mutate_layout_data().unwrap().flags.insert(::data::HAS_BEEN_TRAVERSED);
|
||||
tnode.mutate_layout_data().unwrap().flags.insert(::data::LayoutDataFlags::HAS_BEEN_TRAVERSED);
|
||||
}
|
||||
|
||||
if let Some(el) = node.as_element() {
|
||||
|
@ -227,12 +227,12 @@ impl<'a> PostorderFlowTraversal for BubbleISizes<'a> {
|
|||
#[inline]
|
||||
fn process(&self, flow: &mut Flow) {
|
||||
flow.bubble_inline_sizes();
|
||||
flow::mut_base(flow).restyle_damage.remove(BUBBLE_ISIZES);
|
||||
flow::mut_base(flow).restyle_damage.remove(ServoRestyleDamage::BUBBLE_ISIZES);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn should_process(&self, flow: &mut Flow) -> bool {
|
||||
flow::base(flow).restyle_damage.contains(BUBBLE_ISIZES)
|
||||
flow::base(flow).restyle_damage.contains(ServoRestyleDamage::BUBBLE_ISIZES)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ impl<'a> PreorderFlowTraversal for AssignISizes<'a> {
|
|||
|
||||
#[inline]
|
||||
fn should_process(&self, flow: &mut Flow) -> bool {
|
||||
flow::base(flow).restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW)
|
||||
flow::base(flow).restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,9 +280,9 @@ impl<'a> PostorderFlowTraversal for AssignBSizes<'a> {
|
|||
#[inline]
|
||||
fn should_process(&self, flow: &mut Flow) -> bool {
|
||||
let base = flow::base(flow);
|
||||
base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) &&
|
||||
base.restyle_damage.intersects(ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW) &&
|
||||
// The fragmentation countainer is responsible for calling Flow::fragment recursively
|
||||
!base.flags.contains(CAN_BE_FRAGMENTED)
|
||||
!base.flags.contains(FlowFlags::CAN_BE_FRAGMENTED)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,13 +293,13 @@ pub struct ComputeStackingRelativePositions<'a> {
|
|||
impl<'a> PreorderFlowTraversal for ComputeStackingRelativePositions<'a> {
|
||||
#[inline]
|
||||
fn should_process_subtree(&self, flow: &mut Flow) -> bool {
|
||||
flow::base(flow).restyle_damage.contains(REPOSITION)
|
||||
flow::base(flow).restyle_damage.contains(ServoRestyleDamage::REPOSITION)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn process(&self, flow: &mut Flow) {
|
||||
flow.compute_stacking_relative_position(self.layout_context);
|
||||
flow::mut_base(flow).restyle_damage.remove(REPOSITION)
|
||||
flow::mut_base(flow).restyle_damage.remove(ServoRestyleDamage::REPOSITION)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ impl<'a> BuildDisplayList<'a> {
|
|||
self.state.current_clipping_and_scrolling = flow.clipping_and_scrolling();
|
||||
|
||||
flow.build_display_list(&mut self.state);
|
||||
flow::mut_base(flow).restyle_damage.remove(REPAINT);
|
||||
flow::mut_base(flow).restyle_damage.remove(ServoRestyleDamage::REPAINT);
|
||||
|
||||
for kid in flow::child_iter_mut(flow) {
|
||||
self.traverse(kid);
|
||||
|
|
|
@ -140,7 +140,7 @@ impl<T: ThreadSafeLayoutNode> ThreadSafeLayoutNodeHelpers for T {
|
|||
let damage = {
|
||||
let data = node.get_raw_data().unwrap();
|
||||
|
||||
if !data.layout_data.borrow().flags.contains(::data::HAS_BEEN_TRAVERSED) {
|
||||
if !data.layout_data.borrow().flags.contains(::data::LayoutDataFlags::HAS_BEEN_TRAVERSED) {
|
||||
// We're reflowing a node that was styled for the first time and
|
||||
// has never been visited by layout. Return rebuild_and_reflow,
|
||||
// because that's what the code expects.
|
||||
|
|
|
@ -38,13 +38,11 @@ use layout::wrapper::GetRawData;
|
|||
use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
||||
use nonzero::NonZero;
|
||||
use range::Range;
|
||||
use script::layout_exports::{CAN_BE_FRAGMENTED, HAS_DIRTY_DESCENDANTS, IS_IN_DOC};
|
||||
use script::layout_exports::{CharacterDataTypeId, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
||||
use script::layout_exports::{Document, Element, Node, Text};
|
||||
use script::layout_exports::{HANDLED_SNAPSHOT, HAS_SNAPSHOT};
|
||||
use script::layout_exports::{LayoutCharacterDataHelpers, LayoutDocumentHelpers};
|
||||
use script::layout_exports::{LayoutElementHelpers, LayoutNodeHelpers, RawLayoutElementHelpers};
|
||||
use script::layout_exports::LayoutDom;
|
||||
use script::layout_exports::{LayoutElementHelpers, LayoutNodeHelpers, LayoutDom, RawLayoutElementHelpers};
|
||||
use script::layout_exports::NodeFlags;
|
||||
use script::layout_exports::PendingRestyle;
|
||||
use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, TrustedNodeAddress};
|
||||
use script_layout_interface::{OpaqueStyleAndLayoutData, StyleData};
|
||||
|
@ -212,11 +210,11 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
|
|||
}
|
||||
|
||||
fn can_be_fragmented(&self) -> bool {
|
||||
unsafe { self.node.get_flag(CAN_BE_FRAGMENTED) }
|
||||
unsafe { self.node.get_flag(NodeFlags::CAN_BE_FRAGMENTED) }
|
||||
}
|
||||
|
||||
unsafe fn set_can_be_fragmented(&self, value: bool) {
|
||||
self.node.set_flag(CAN_BE_FRAGMENTED, value)
|
||||
self.node.set_flag(NodeFlags::CAN_BE_FRAGMENTED, value)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,28 +401,28 @@ impl<'le> TElement for ServoLayoutElement<'le> {
|
|||
}
|
||||
|
||||
fn has_dirty_descendants(&self) -> bool {
|
||||
unsafe { self.as_node().node.get_flag(HAS_DIRTY_DESCENDANTS) }
|
||||
unsafe { self.as_node().node.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS) }
|
||||
}
|
||||
|
||||
fn has_snapshot(&self) -> bool {
|
||||
unsafe { self.as_node().node.get_flag(HAS_SNAPSHOT) }
|
||||
unsafe { self.as_node().node.get_flag(NodeFlags::HAS_SNAPSHOT) }
|
||||
}
|
||||
|
||||
fn handled_snapshot(&self) -> bool {
|
||||
unsafe { self.as_node().node.get_flag(HANDLED_SNAPSHOT) }
|
||||
unsafe { self.as_node().node.get_flag(NodeFlags::HANDLED_SNAPSHOT) }
|
||||
}
|
||||
|
||||
unsafe fn set_handled_snapshot(&self) {
|
||||
self.as_node().node.set_flag(HANDLED_SNAPSHOT, true);
|
||||
self.as_node().node.set_flag(NodeFlags::HANDLED_SNAPSHOT, true);
|
||||
}
|
||||
|
||||
unsafe fn set_dirty_descendants(&self) {
|
||||
debug_assert!(self.as_node().node.get_flag(IS_IN_DOC));
|
||||
self.as_node().node.set_flag(HAS_DIRTY_DESCENDANTS, true)
|
||||
debug_assert!(self.as_node().node.get_flag(NodeFlags::IS_IN_DOC));
|
||||
self.as_node().node.set_flag(NodeFlags::HAS_DIRTY_DESCENDANTS, true)
|
||||
}
|
||||
|
||||
unsafe fn unset_dirty_descendants(&self) {
|
||||
self.as_node().node.set_flag(HAS_DIRTY_DESCENDANTS, false)
|
||||
self.as_node().node.set_flag(NodeFlags::HAS_DIRTY_DESCENDANTS, false)
|
||||
}
|
||||
|
||||
fn store_children_to_process(&self, n: isize) {
|
||||
|
@ -583,11 +581,11 @@ impl<'le> ServoLayoutElement<'le> {
|
|||
}
|
||||
|
||||
pub unsafe fn unset_snapshot_flags(&self) {
|
||||
self.as_node().node.set_flag(HAS_SNAPSHOT | HANDLED_SNAPSHOT, false);
|
||||
self.as_node().node.set_flag(NodeFlags::HAS_SNAPSHOT | NodeFlags::HANDLED_SNAPSHOT, false);
|
||||
}
|
||||
|
||||
pub unsafe fn set_has_snapshot(&self) {
|
||||
self.as_node().node.set_flag(HAS_SNAPSHOT, true);
|
||||
self.as_node().node.set_flag(NodeFlags::HAS_SNAPSHOT, true);
|
||||
}
|
||||
|
||||
pub unsafe fn note_dirty_descendant(&self) {
|
||||
|
|
|
@ -72,7 +72,7 @@ use layout::context::malloc_size_of_persistent_local_context;
|
|||
use layout::display_list_builder::ToGfxColor;
|
||||
use layout::flow::{self, Flow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
||||
use layout::flow_ref::FlowRef;
|
||||
use layout::incremental::{LayoutDamageComputation, REFLOW_ENTIRE_DOCUMENT, RelayoutMode};
|
||||
use layout::incremental::{LayoutDamageComputation, RelayoutMode, SpecialRestyleDamage};
|
||||
use layout::layout_debug;
|
||||
use layout::parallel;
|
||||
use layout::query::{LayoutRPCImpl, LayoutThreadData, process_content_box_request, process_content_boxes_request};
|
||||
|
@ -132,11 +132,11 @@ use style::logical_geometry::LogicalPoint;
|
|||
use style::media_queries::{Device, MediaList, MediaType};
|
||||
use style::properties::PropertyId;
|
||||
use style::selector_parser::SnapshotMap;
|
||||
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION, STORE_OVERFLOW};
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard, StylesheetGuards};
|
||||
use style::stylesheets::{Origin, Stylesheet, DocumentStyleSheet, StylesheetInDocument, UserAgentStylesheets};
|
||||
use style::stylist::Stylist;
|
||||
use style::thread_state;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
use style::timer::Timer;
|
||||
use style::traversal::DomTraversal;
|
||||
use style::traversal_flags::TraversalFlags;
|
||||
|
@ -285,7 +285,7 @@ impl LayoutThreadFactory for LayoutThread {
|
|||
layout_threads: usize,
|
||||
paint_time_metrics: PaintTimeMetrics) {
|
||||
thread::Builder::new().name(format!("LayoutThread {:?}", id)).spawn(move || {
|
||||
thread_state::initialize(thread_state::LAYOUT);
|
||||
thread_state::initialize(ThreadState::LAYOUT);
|
||||
|
||||
// In order to get accurate crash reports, we install the top-level bc id.
|
||||
TopLevelBrowsingContextId::install(top_level_browsing_context_id);
|
||||
|
@ -971,7 +971,7 @@ impl LayoutThread {
|
|||
let traversal = ComputeStackingRelativePositions { layout_context: layout_context };
|
||||
traversal.traverse(layout_root);
|
||||
|
||||
if flow::base(layout_root).restyle_damage.contains(REPAINT) ||
|
||||
if flow::base(layout_root).restyle_damage.contains(ServoRestyleDamage::REPAINT) ||
|
||||
rw_data.display_list.is_none() {
|
||||
if reflow_goal.needs_display_list() {
|
||||
let mut build_state =
|
||||
|
@ -1541,7 +1541,7 @@ impl LayoutThread {
|
|||
// that are needed in both incremental and non-incremental traversals.
|
||||
let damage = FlowRef::deref_mut(root_flow).compute_layout_damage();
|
||||
|
||||
if opts::get().nonincremental_layout || damage.contains(REFLOW_ENTIRE_DOCUMENT) {
|
||||
if opts::get().nonincremental_layout || damage.contains(SpecialRestyleDamage::REFLOW_ENTIRE_DOCUMENT) {
|
||||
FlowRef::deref_mut(root_flow).reflow_entire_document()
|
||||
}
|
||||
});
|
||||
|
@ -1564,7 +1564,8 @@ impl LayoutThread {
|
|||
|
||||
// Perform the primary layout passes over the flow tree to compute the locations of all
|
||||
// the boxes.
|
||||
if flow::base(&**root_flow).restyle_damage.intersects(REFLOW | REFLOW_OUT_OF_FLOW) {
|
||||
if flow::base(&**root_flow).restyle_damage.intersects(ServoRestyleDamage::REFLOW |
|
||||
ServoRestyleDamage::REFLOW_OUT_OF_FLOW) {
|
||||
profile(time::ProfilerCategory::LayoutMain,
|
||||
self.profiler_metadata(),
|
||||
self.time_profiler_chan.clone(),
|
||||
|
@ -1631,7 +1632,8 @@ impl LayoutThread {
|
|||
debug!("reflowing all nodes!");
|
||||
flow::mut_base(flow)
|
||||
.restyle_damage
|
||||
.insert(REPAINT | STORE_OVERFLOW | REFLOW | REPOSITION);
|
||||
.insert(ServoRestyleDamage::REPAINT | ServoRestyleDamage::STORE_OVERFLOW |
|
||||
ServoRestyleDamage::REFLOW | ServoRestyleDamage::REPOSITION);
|
||||
|
||||
for child in flow::child_iter_mut(flow) {
|
||||
LayoutThread::reflow_all_nodes(child);
|
||||
|
|
|
@ -13,7 +13,7 @@ path = "lib.rs"
|
|||
unstable = ["nonzero/unstable"]
|
||||
|
||||
[dependencies]
|
||||
bitflags = "0.7"
|
||||
bitflags = "1.0"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
nonzero = {path = "../nonzero"}
|
||||
|
|
|
@ -148,12 +148,12 @@ pub enum Key {
|
|||
|
||||
bitflags! {
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub flags KeyModifiers: u8 {
|
||||
const NONE = 0x00,
|
||||
const SHIFT = 0x01,
|
||||
const CONTROL = 0x02,
|
||||
const ALT = 0x04,
|
||||
const SUPER = 0x08,
|
||||
pub struct KeyModifiers: u8 {
|
||||
const NONE = 0x00;
|
||||
const SHIFT = 0x01;
|
||||
const CONTROL = 0x02;
|
||||
const ALT = 0x04;
|
||||
const SUPER = 0x08;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ tinyfiledialogs = "2.5.9"
|
|||
app_units = "0.5"
|
||||
audio-video-metadata = "0.1.4"
|
||||
base64 = "0.6"
|
||||
bitflags = "0.7"
|
||||
bitflags = "1.0"
|
||||
bluetooth_traits = {path = "../bluetooth_traits"}
|
||||
byteorder = "1.0"
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* 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 devtools_traits::{AutoMargins, CONSOLE_API, CachedConsoleMessage, CachedConsoleMessageTypes};
|
||||
use devtools_traits::{AutoMargins, CachedConsoleMessage, CachedConsoleMessageTypes};
|
||||
use devtools_traits::{ComputedNodeLayout, ConsoleAPI, PageError};
|
||||
use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, PAGE_ERROR, TimelineMarker};
|
||||
use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, TimelineMarker};
|
||||
use devtools_traits::TimelineMarkerType;
|
||||
use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods;
|
||||
use dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods;
|
||||
|
@ -168,7 +168,7 @@ pub fn handle_get_cached_messages(_pipeline_id: PipelineId,
|
|||
reply: IpcSender<Vec<CachedConsoleMessage>>) {
|
||||
// TODO: check the messageTypes against a global Cache for console messages and page exceptions
|
||||
let mut messages = Vec::new();
|
||||
if message_types.contains(PAGE_ERROR) {
|
||||
if message_types.contains(CachedConsoleMessageTypes::PAGE_ERROR) {
|
||||
// TODO: make script error reporter pass all reported errors
|
||||
// to devtools and cache them for returning here.
|
||||
let msg = PageError {
|
||||
|
@ -188,7 +188,7 @@ pub fn handle_get_cached_messages(_pipeline_id: PipelineId,
|
|||
};
|
||||
messages.push(CachedConsoleMessage::PageError(msg));
|
||||
}
|
||||
if message_types.contains(CONSOLE_API) {
|
||||
if message_types.contains(CachedConsoleMessageTypes::CONSOLE_API) {
|
||||
// TODO: do for real
|
||||
let msg = ConsoleAPI {
|
||||
type_: "ConsoleAPI".to_owned(),
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! A shareable mutable container for the DOM.
|
||||
|
||||
use std::cell::{BorrowError, BorrowMutError, Ref, RefCell, RefMut};
|
||||
use style::thread_state;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
|
||||
/// A mutable field in the DOM.
|
||||
///
|
||||
|
@ -45,7 +45,7 @@ impl<T> DomRefCell<T> {
|
|||
///
|
||||
#[allow(unsafe_code)]
|
||||
pub unsafe fn borrow_for_script_deallocation(&self) -> &mut T {
|
||||
debug_assert!(thread_state::get().contains(thread_state::SCRIPT));
|
||||
debug_assert!(thread_state::get().contains(ThreadState::SCRIPT));
|
||||
&mut *self.value.as_ptr()
|
||||
}
|
||||
|
||||
|
|
|
@ -2039,7 +2039,7 @@ DOMClass {
|
|||
interface_chain: [ %s ],
|
||||
type_id: %s,
|
||||
malloc_size_of: %s as unsafe fn(&mut _, _) -> _,
|
||||
global: InterfaceObjectMap::%s,
|
||||
global: InterfaceObjectMap::Globals::%s,
|
||||
}""" % (prototypeChainString, DOMClassTypeId(descriptor), mallocSizeOf, globals_)
|
||||
|
||||
|
||||
|
@ -2445,7 +2445,7 @@ class CGConstructorEnabled(CGAbstractMethod):
|
|||
iface = self.descriptor.interface
|
||||
|
||||
bits = " | ".join(sorted(
|
||||
"InterfaceObjectMap::" + camel_to_upper_snake(i) for i in iface.exposureSet
|
||||
"InterfaceObjectMap::Globals::" + camel_to_upper_snake(i) for i in iface.exposureSet
|
||||
))
|
||||
conditions.append("is_exposed_in(aObj, %s)" % bits)
|
||||
|
||||
|
@ -7102,9 +7102,9 @@ class GlobalGenRoots():
|
|||
for (idx, d) in enumerate(global_descriptors)
|
||||
)
|
||||
global_flags = CGWrapper(CGIndenter(CGList([
|
||||
CGGeneric("const %s = %#x," % args)
|
||||
CGGeneric("const %s = %#x;" % args)
|
||||
for args in flags
|
||||
], "\n")), pre="pub flags Globals: u8 {\n", post="\n}")
|
||||
], "\n")), pre="pub struct Globals: u8 {\n", post="\n}")
|
||||
globals_ = CGWrapper(CGIndenter(global_flags), pre="bitflags! {\n", post="\n}")
|
||||
|
||||
phf = CGGeneric("include!(concat!(env!(\"OUT_DIR\"), \"/InterfaceObjectMapPhf.rs\"));")
|
||||
|
|
|
@ -13,7 +13,7 @@ use style::context::QuirksMode;
|
|||
use style::parser::ParserContext;
|
||||
use style::stylesheets::CssRuleType;
|
||||
use style::stylesheets::supports_rule::{Declaration, parse_condition_or_declaration};
|
||||
use style_traits::PARSING_MODE_DEFAULT;
|
||||
use style_traits::ParsingMode;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSS {
|
||||
|
@ -39,7 +39,7 @@ impl CSS {
|
|||
let context = ParserContext::new_for_cssom(
|
||||
&url,
|
||||
Some(CssRuleType::Style),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
QuirksMode::NoQuirks
|
||||
);
|
||||
decl.eval(&context)
|
||||
|
@ -55,7 +55,7 @@ impl CSS {
|
|||
let context = ParserContext::new_for_cssom(
|
||||
&url,
|
||||
Some(CssRuleType::Style),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
QuirksMode::NoQuirks
|
||||
);
|
||||
cond.eval(&context)
|
||||
|
|
|
@ -20,7 +20,7 @@ use style::media_queries::parse_media_query_list;
|
|||
use style::parser::ParserContext;
|
||||
use style::shared_lock::{Locked, ToCssWithGuard};
|
||||
use style::stylesheets::{CssRuleType, MediaRule};
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
||||
use style_traits::{ParsingMode, ToCss};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSMediaRule {
|
||||
|
@ -76,7 +76,7 @@ impl CSSMediaRule {
|
|||
let url = window.get_url();
|
||||
let quirks_mode = window.Document().quirks_mode();
|
||||
let context = ParserContext::new_for_cssom(&url, Some(CssRuleType::Media),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
quirks_mode);
|
||||
|
||||
let new_medialist = parse_media_query_list(&context, &mut input,
|
||||
|
|
|
@ -22,7 +22,7 @@ use style::properties::{DeclarationSource, Importance, PropertyDeclarationBlock,
|
|||
use style::properties::{parse_one_declaration_into, parse_style_attribute, SourcePropertyDeclaration};
|
||||
use style::selector_parser::PseudoElement;
|
||||
use style::shared_lock::Locked;
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
||||
use style_traits::{ParsingMode, ToCss};
|
||||
|
||||
// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
|
||||
#[dom_struct]
|
||||
|
@ -261,7 +261,7 @@ impl CSSStyleDeclaration {
|
|||
let mut declarations = SourcePropertyDeclaration::new();
|
||||
let result = parse_one_declaration_into(
|
||||
&mut declarations, id, &value, &self.owner.base_url(),
|
||||
window.css_error_reporter(), PARSING_MODE_DEFAULT, quirks_mode);
|
||||
window.css_error_reporter(), ParsingMode::DEFAULT, quirks_mode);
|
||||
|
||||
// Step 6
|
||||
match result {
|
||||
|
|
|
@ -18,7 +18,7 @@ use style::parser::ParserContext;
|
|||
use style::shared_lock::{Locked, ToCssWithGuard};
|
||||
use style::stylesheets::{CssRuleType, SupportsRule};
|
||||
use style::stylesheets::supports_rule::SupportsCondition;
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
||||
use style_traits::{ParsingMode, ToCss};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSSupportsRule {
|
||||
|
@ -64,7 +64,7 @@ impl CSSSupportsRule {
|
|||
let url = win.Document().url();
|
||||
let quirks_mode = win.Document().quirks_mode();
|
||||
let context = ParserContext::new_for_cssom(&url, Some(CssRuleType::Supports),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
quirks_mode);
|
||||
let enabled = cond.eval(&context);
|
||||
let mut guard = self.cssconditionrule.shared_lock().write();
|
||||
|
|
|
@ -41,7 +41,7 @@ use std::sync::{Arc, Mutex};
|
|||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
|
||||
use std::thread;
|
||||
use style::thread_state;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
|
||||
/// Set the `worker` field of a related DedicatedWorkerGlobalScope object to a particular
|
||||
/// value for the duration of this object's lifetime. This ensures that the related Worker
|
||||
|
@ -166,7 +166,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
let origin = GlobalScope::current().expect("No current global object").origin().immutable().clone();
|
||||
|
||||
thread::Builder::new().name(name).spawn(move || {
|
||||
thread_state::initialize(thread_state::SCRIPT | thread_state::IN_WORKER);
|
||||
thread_state::initialize(ThreadState::SCRIPT | ThreadState::IN_WORKER);
|
||||
|
||||
if let Some(top_level_browsing_context_id) = top_level_browsing_context_id {
|
||||
TopLevelBrowsingContextId::install(top_level_browsing_context_id);
|
||||
|
|
|
@ -66,7 +66,7 @@ use dom::keyboardevent::KeyboardEvent;
|
|||
use dom::location::Location;
|
||||
use dom::messageevent::MessageEvent;
|
||||
use dom::mouseevent::MouseEvent;
|
||||
use dom::node::{self, CloneChildrenFlag, Node, NodeDamage, window_from_node, IS_IN_DOC, LayoutNodeHelpers};
|
||||
use dom::node::{self, CloneChildrenFlag, Node, NodeDamage, window_from_node, NodeFlags, LayoutNodeHelpers};
|
||||
use dom::node::VecPreOrderInsertionHelper;
|
||||
use dom::nodeiterator::NodeIterator;
|
||||
use dom::nodelist::NodeList;
|
||||
|
@ -100,7 +100,6 @@ use ipc_channel::ipc::{self, IpcSender};
|
|||
use js::jsapi::{JSContext, JSRuntime};
|
||||
use js::jsapi::JS_GetRuntime;
|
||||
use metrics::{InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory};
|
||||
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
|
||||
use msg::constellation_msg::{BrowsingContextId, Key, KeyModifiers, KeyState, TopLevelBrowsingContextId};
|
||||
use net_traits::{FetchResponseMsg, IpcSend, ReferrerPolicy};
|
||||
use net_traits::CookieSource::NonHTTP;
|
||||
|
@ -132,7 +131,7 @@ use std::rc::Rc;
|
|||
use std::time::{Duration, Instant};
|
||||
use style::attr::AttrValue;
|
||||
use style::context::QuirksMode;
|
||||
use style::invalidation::element::restyle_hints::{RestyleHint, RESTYLE_SELF, RESTYLE_STYLE_ATTRIBUTE};
|
||||
use style::invalidation::element::restyle_hints::RestyleHint;
|
||||
use style::media_queries::{Device, MediaList, MediaType};
|
||||
use style::selector_parser::{RestyleDamage, Snapshot};
|
||||
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard};
|
||||
|
@ -1296,10 +1295,10 @@ impl Document {
|
|||
(&None, &None) => self.window.upcast(),
|
||||
};
|
||||
|
||||
let ctrl = modifiers.contains(CONTROL);
|
||||
let alt = modifiers.contains(ALT);
|
||||
let shift = modifiers.contains(SHIFT);
|
||||
let meta = modifiers.contains(SUPER);
|
||||
let ctrl = modifiers.contains(KeyModifiers::CONTROL);
|
||||
let alt = modifiers.contains(KeyModifiers::ALT);
|
||||
let shift = modifiers.contains(KeyModifiers::SHIFT);
|
||||
let meta = modifiers.contains(KeyModifiers::SUPER);
|
||||
|
||||
let is_composing = false;
|
||||
let is_repeating = state == KeyState::Repeated;
|
||||
|
@ -2066,7 +2065,7 @@ impl LayoutDocumentHelpers for LayoutDom<Document> {
|
|||
// may no longer be true when the next layout occurs.
|
||||
let result = elements.drain()
|
||||
.map(|(k, v)| (k.to_layout(), v))
|
||||
.filter(|&(ref k, _)| k.upcast::<Node>().get_flag(IS_IN_DOC))
|
||||
.filter(|&(ref k, _)| k.upcast::<Node>().get_flag(NodeFlags::IS_IN_DOC))
|
||||
.collect();
|
||||
result
|
||||
}
|
||||
|
@ -2512,11 +2511,11 @@ impl Document {
|
|||
entry.snapshot = Some(Snapshot::new(el.html_element_in_html_document()));
|
||||
}
|
||||
if attr.local_name() == &local_name!("style") {
|
||||
entry.hint.insert(RESTYLE_STYLE_ATTRIBUTE);
|
||||
entry.hint.insert(RestyleHint::RESTYLE_STYLE_ATTRIBUTE);
|
||||
}
|
||||
|
||||
if vtable_for(el.upcast()).attribute_affects_presentational_hints(attr) {
|
||||
entry.hint.insert(RESTYLE_SELF);
|
||||
entry.hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
}
|
||||
|
||||
let snapshot = entry.snapshot.as_mut().unwrap();
|
||||
|
|
|
@ -65,8 +65,8 @@ use dom::htmltemplateelement::HTMLTemplateElement;
|
|||
use dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers};
|
||||
use dom::mutationobserver::{Mutation, MutationObserver};
|
||||
use dom::namednodemap::NamedNodeMap;
|
||||
use dom::node::{CLICK_IN_PROGRESS, ChildrenMutation, LayoutNodeHelpers, Node};
|
||||
use dom::node::{NodeDamage, SEQUENTIALLY_FOCUSABLE, UnbindContext};
|
||||
use dom::node::{ChildrenMutation, LayoutNodeHelpers, Node};
|
||||
use dom::node::{NodeDamage, NodeFlags, UnbindContext};
|
||||
use dom::node::{document_from_node, window_from_node};
|
||||
use dom::nodelist::NodeList;
|
||||
use dom::promise::Promise;
|
||||
|
@ -90,7 +90,6 @@ use script_thread::ScriptThread;
|
|||
use selectors::Element as SelectorsElement;
|
||||
use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext, RelevantLinkStatus};
|
||||
use selectors::matching::{HAS_EDGE_CHILD_SELECTOR, HAS_SLOW_SELECTOR, HAS_SLOW_SELECTOR_LATER_SIBLINGS};
|
||||
use selectors::sink::Push;
|
||||
use servo_arc::Arc;
|
||||
use servo_atoms::Atom;
|
||||
|
@ -107,8 +106,8 @@ use style::applicable_declarations::ApplicableDeclarationBlock;
|
|||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::context::QuirksMode;
|
||||
use style::dom_apis;
|
||||
use style::element_state::*;
|
||||
use style::invalidation::element::restyle_hints::RESTYLE_SELF;
|
||||
use style::element_state::ElementState;
|
||||
use style::invalidation::element::restyle_hints::RestyleHint;
|
||||
use style::properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
|
||||
use style::properties::longhands::{self, background_image, border_spacing, font_family, font_size, overflow_x};
|
||||
use style::rule_tree::CascadeLevel;
|
||||
|
@ -292,7 +291,7 @@ impl Element {
|
|||
|
||||
// FIXME(bholley): I think we should probably only do this for
|
||||
// NodeStyleDamaged, but I'm preserving existing behavior.
|
||||
restyle.hint.insert(RESTYLE_SELF);
|
||||
restyle.hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
|
||||
if damage == NodeDamage::OtherNodeDamage {
|
||||
restyle.damage = RestyleDamage::rebuild_and_reflow();
|
||||
|
@ -1062,7 +1061,7 @@ impl Element {
|
|||
}
|
||||
// TODO: Check whether the element is being rendered (i.e. not hidden).
|
||||
let node = self.upcast::<Node>();
|
||||
if node.get_flag(SEQUENTIALLY_FOCUSABLE) {
|
||||
if node.get_flag(NodeFlags::SEQUENTIALLY_FOCUSABLE) {
|
||||
return true;
|
||||
}
|
||||
// https://html.spec.whatwg.org/multipage/#specially-focusable
|
||||
|
@ -2480,11 +2479,11 @@ impl VirtualMethods for Element {
|
|||
}
|
||||
|
||||
let flags = self.selector_flags.get();
|
||||
if flags.intersects(HAS_SLOW_SELECTOR) {
|
||||
if flags.intersects(ElementSelectorFlags::HAS_SLOW_SELECTOR) {
|
||||
// All children of this node need to be restyled when any child changes.
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
} else {
|
||||
if flags.intersects(HAS_SLOW_SELECTOR_LATER_SIBLINGS) {
|
||||
if flags.intersects(ElementSelectorFlags::HAS_SLOW_SELECTOR_LATER_SIBLINGS) {
|
||||
if let Some(next_child) = mutation.next_child() {
|
||||
for child in next_child.inclusively_following_siblings() {
|
||||
if child.is::<Element>() {
|
||||
|
@ -2493,7 +2492,7 @@ impl VirtualMethods for Element {
|
|||
}
|
||||
}
|
||||
}
|
||||
if flags.intersects(HAS_EDGE_CHILD_SELECTOR) {
|
||||
if flags.intersects(ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR) {
|
||||
if let Some(child) = mutation.modified_edge_element() {
|
||||
child.dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
|
@ -2747,11 +2746,11 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn click_in_progress(&self) -> bool {
|
||||
self.upcast::<Node>().get_flag(CLICK_IN_PROGRESS)
|
||||
self.upcast::<Node>().get_flag(NodeFlags::CLICK_IN_PROGRESS)
|
||||
}
|
||||
|
||||
pub fn set_click_in_progress(&self, click: bool) {
|
||||
self.upcast::<Node>().set_flag(CLICK_IN_PROGRESS, click)
|
||||
self.upcast::<Node>().set_flag(NodeFlags::CLICK_IN_PROGRESS, click)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#nearest-activatable-element
|
||||
|
@ -2851,12 +2850,12 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn active_state(&self) -> bool {
|
||||
self.state.get().contains(IN_ACTIVE_STATE)
|
||||
self.state.get().contains(ElementState::IN_ACTIVE_STATE)
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-selector-active>
|
||||
pub fn set_active_state(&self, value: bool) {
|
||||
self.set_state(IN_ACTIVE_STATE, value);
|
||||
self.set_state(ElementState::IN_ACTIVE_STATE, value);
|
||||
|
||||
if let Some(parent) = self.upcast::<Node>().GetParentElement() {
|
||||
parent.set_active_state(value);
|
||||
|
@ -2864,71 +2863,71 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn focus_state(&self) -> bool {
|
||||
self.state.get().contains(IN_FOCUS_STATE)
|
||||
self.state.get().contains(ElementState::IN_FOCUS_STATE)
|
||||
}
|
||||
|
||||
pub fn set_focus_state(&self, value: bool) {
|
||||
self.set_state(IN_FOCUS_STATE, value);
|
||||
self.set_state(ElementState::IN_FOCUS_STATE, value);
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
|
||||
pub fn hover_state(&self) -> bool {
|
||||
self.state.get().contains(IN_HOVER_STATE)
|
||||
self.state.get().contains(ElementState::IN_HOVER_STATE)
|
||||
}
|
||||
|
||||
pub fn set_hover_state(&self, value: bool) {
|
||||
self.set_state(IN_HOVER_STATE, value)
|
||||
self.set_state(ElementState::IN_HOVER_STATE, value)
|
||||
}
|
||||
|
||||
pub fn enabled_state(&self) -> bool {
|
||||
self.state.get().contains(IN_ENABLED_STATE)
|
||||
self.state.get().contains(ElementState::IN_ENABLED_STATE)
|
||||
}
|
||||
|
||||
pub fn set_enabled_state(&self, value: bool) {
|
||||
self.set_state(IN_ENABLED_STATE, value)
|
||||
self.set_state(ElementState::IN_ENABLED_STATE, value)
|
||||
}
|
||||
|
||||
pub fn disabled_state(&self) -> bool {
|
||||
self.state.get().contains(IN_DISABLED_STATE)
|
||||
self.state.get().contains(ElementState::IN_DISABLED_STATE)
|
||||
}
|
||||
|
||||
pub fn set_disabled_state(&self, value: bool) {
|
||||
self.set_state(IN_DISABLED_STATE, value)
|
||||
self.set_state(ElementState::IN_DISABLED_STATE, value)
|
||||
}
|
||||
|
||||
pub fn read_write_state(&self) -> bool {
|
||||
self.state.get().contains(IN_READ_WRITE_STATE)
|
||||
self.state.get().contains(ElementState::IN_READ_WRITE_STATE)
|
||||
}
|
||||
|
||||
pub fn set_read_write_state(&self, value: bool) {
|
||||
self.set_state(IN_READ_WRITE_STATE, value)
|
||||
self.set_state(ElementState::IN_READ_WRITE_STATE, value)
|
||||
}
|
||||
|
||||
pub fn placeholder_shown_state(&self) -> bool {
|
||||
self.state.get().contains(IN_PLACEHOLDER_SHOWN_STATE)
|
||||
self.state.get().contains(ElementState::IN_PLACEHOLDER_SHOWN_STATE)
|
||||
}
|
||||
|
||||
pub fn set_placeholder_shown_state(&self, value: bool) {
|
||||
if self.placeholder_shown_state() != value {
|
||||
self.set_state(IN_PLACEHOLDER_SHOWN_STATE, value);
|
||||
self.set_state(ElementState::IN_PLACEHOLDER_SHOWN_STATE, value);
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn target_state(&self) -> bool {
|
||||
self.state.get().contains(IN_TARGET_STATE)
|
||||
self.state.get().contains(ElementState::IN_TARGET_STATE)
|
||||
}
|
||||
|
||||
pub fn set_target_state(&self, value: bool) {
|
||||
self.set_state(IN_TARGET_STATE, value)
|
||||
self.set_state(ElementState::IN_TARGET_STATE, value)
|
||||
}
|
||||
|
||||
pub fn fullscreen_state(&self) -> bool {
|
||||
self.state.get().contains(IN_FULLSCREEN_STATE)
|
||||
self.state.get().contains(ElementState::IN_FULLSCREEN_STATE)
|
||||
}
|
||||
|
||||
pub fn set_fullscreen_state(&self, value: bool) {
|
||||
self.set_state(IN_FULLSCREEN_STATE, value)
|
||||
self.set_state(ElementState::IN_FULLSCREEN_STATE, value)
|
||||
}
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#connected>
|
||||
|
|
|
@ -27,7 +27,7 @@ use dom_struct::dom_struct;
|
|||
use html5ever::{LocalName, Prefix};
|
||||
use std::cell::Cell;
|
||||
use std::default::Default;
|
||||
use style::element_state::*;
|
||||
use style::element_state::ElementState;
|
||||
|
||||
#[derive(Clone, Copy, JSTraceable, PartialEq)]
|
||||
#[derive(MallocSizeOf)]
|
||||
|
@ -51,7 +51,7 @@ impl HTMLButtonElement {
|
|||
document: &Document) -> HTMLButtonElement {
|
||||
HTMLButtonElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE,
|
||||
local_name, prefix, document),
|
||||
button_type: Cell::new(ButtonType::Submit),
|
||||
form_owner: Default::default(),
|
||||
|
|
|
@ -24,7 +24,7 @@ use dom::htmlframesetelement::HTMLFrameSetElement;
|
|||
use dom::htmlhtmlelement::HTMLHtmlElement;
|
||||
use dom::htmlinputelement::HTMLInputElement;
|
||||
use dom::htmllabelelement::HTMLLabelElement;
|
||||
use dom::node::{Node, SEQUENTIALLY_FOCUSABLE};
|
||||
use dom::node::{Node, NodeFlags};
|
||||
use dom::node::{document_from_node, window_from_node};
|
||||
use dom::nodelist::NodeList;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
|
@ -76,18 +76,18 @@ impl HTMLElement {
|
|||
let element = self.upcast::<Element>();
|
||||
let node = self.upcast::<Node>();
|
||||
if element.has_attribute(&local_name!("tabindex")) {
|
||||
node.set_flag(SEQUENTIALLY_FOCUSABLE, true);
|
||||
node.set_flag(NodeFlags::SEQUENTIALLY_FOCUSABLE, true);
|
||||
} else {
|
||||
match node.type_id() {
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) |
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement)) |
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement))
|
||||
=> node.set_flag(SEQUENTIALLY_FOCUSABLE, true),
|
||||
=> node.set_flag(NodeFlags::SEQUENTIALLY_FOCUSABLE, true),
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) |
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) => {
|
||||
if element.has_attribute(&local_name!("href")) {
|
||||
node.set_flag(SEQUENTIALLY_FOCUSABLE, true);
|
||||
node.set_flag(NodeFlags::SEQUENTIALLY_FOCUSABLE, true);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
|
@ -97,9 +97,9 @@ impl HTMLElement {
|
|||
AttrValue::String(ref string) => string == "true",
|
||||
_ => false,
|
||||
};
|
||||
node.set_flag(SEQUENTIALLY_FOCUSABLE, is_true);
|
||||
node.set_flag(NodeFlags::SEQUENTIALLY_FOCUSABLE, is_true);
|
||||
} else {
|
||||
node.set_flag(SEQUENTIALLY_FOCUSABLE, false);
|
||||
node.set_flag(NodeFlags::SEQUENTIALLY_FOCUSABLE, false);
|
||||
}
|
||||
//TODO set SEQUENTIALLY_FOCUSABLE flag if editing host
|
||||
//TODO set SEQUENTIALLY_FOCUSABLE flag if "sorting interface th elements"
|
||||
|
|
|
@ -19,7 +19,7 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix};
|
||||
use std::default::Default;
|
||||
use style::element_state::*;
|
||||
use style::element_state::ElementState;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLFieldSetElement {
|
||||
|
@ -33,7 +33,7 @@ impl HTMLFieldSetElement {
|
|||
document: &Document) -> HTMLFieldSetElement {
|
||||
HTMLFieldSetElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE,
|
||||
local_name, prefix, document),
|
||||
form_owner: Default::default(),
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ use dom::htmlobjectelement::HTMLObjectElement;
|
|||
use dom::htmloutputelement::HTMLOutputElement;
|
||||
use dom::htmlselectelement::HTMLSelectElement;
|
||||
use dom::htmltextareaelement::HTMLTextAreaElement;
|
||||
use dom::node::{Node, PARSER_ASSOCIATED_FORM_OWNER, UnbindContext, VecPreOrderInsertionHelper};
|
||||
use dom::node::{Node, NodeFlags, UnbindContext, VecPreOrderInsertionHelper};
|
||||
use dom::node::{document_from_node, window_from_node};
|
||||
use dom::validitystate::ValidationFlags;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
|
@ -879,7 +879,7 @@ pub trait FormControl: DomObject {
|
|||
fn set_form_owner_from_parser(&self, form: &HTMLFormElement) {
|
||||
let elem = self.to_element();
|
||||
let node = elem.upcast::<Node>();
|
||||
node.set_flag(PARSER_ASSOCIATED_FORM_OWNER, true);
|
||||
node.set_flag(NodeFlags::PARSER_ASSOCIATED_FORM_OWNER, true);
|
||||
form.add_control(self);
|
||||
self.set_form_owner(Some(form));
|
||||
}
|
||||
|
@ -968,8 +968,8 @@ pub trait FormControl: DomObject {
|
|||
// Part of step 12.
|
||||
// '..suppress the running of the reset the form owner algorithm
|
||||
// when the parser subsequently attempts to insert the element..'
|
||||
let must_skip_reset = node.get_flag(PARSER_ASSOCIATED_FORM_OWNER);
|
||||
node.set_flag(PARSER_ASSOCIATED_FORM_OWNER, false);
|
||||
let must_skip_reset = node.get_flag(NodeFlags::PARSER_ASSOCIATED_FORM_OWNER);
|
||||
node.set_flag(NodeFlags::PARSER_ASSOCIATED_FORM_OWNER, false);
|
||||
|
||||
if !must_skip_reset {
|
||||
self.form_attribute_mutated(AttributeMutation::Set(None));
|
||||
|
|
|
@ -57,14 +57,14 @@ use task_source::TaskSource;
|
|||
|
||||
bitflags! {
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
flags SandboxAllowance: u8 {
|
||||
const ALLOW_NOTHING = 0x00,
|
||||
const ALLOW_SAME_ORIGIN = 0x01,
|
||||
const ALLOW_TOP_NAVIGATION = 0x02,
|
||||
const ALLOW_FORMS = 0x04,
|
||||
const ALLOW_SCRIPTS = 0x08,
|
||||
const ALLOW_POINTER_LOCK = 0x10,
|
||||
const ALLOW_POPUPS = 0x20
|
||||
struct SandboxAllowance: u8 {
|
||||
const ALLOW_NOTHING = 0x00;
|
||||
const ALLOW_SAME_ORIGIN = 0x01;
|
||||
const ALLOW_TOP_NAVIGATION = 0x02;
|
||||
const ALLOW_FORMS = 0x04;
|
||||
const ALLOW_SCRIPTS = 0x08;
|
||||
const ALLOW_POINTER_LOCK = 0x10;
|
||||
const ALLOW_POPUPS = 0x20;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -722,16 +722,16 @@ impl VirtualMethods for HTMLIFrameElement {
|
|||
match attr.local_name() {
|
||||
&local_name!("sandbox") => {
|
||||
self.sandbox_allowance.set(mutation.new_value(attr).map(|value| {
|
||||
let mut modes = ALLOW_NOTHING;
|
||||
let mut modes = SandboxAllowance::ALLOW_NOTHING;
|
||||
for token in value.as_tokens() {
|
||||
modes |= match &*token.to_ascii_lowercase() {
|
||||
"allow-same-origin" => ALLOW_SAME_ORIGIN,
|
||||
"allow-forms" => ALLOW_FORMS,
|
||||
"allow-pointer-lock" => ALLOW_POINTER_LOCK,
|
||||
"allow-popups" => ALLOW_POPUPS,
|
||||
"allow-scripts" => ALLOW_SCRIPTS,
|
||||
"allow-top-navigation" => ALLOW_TOP_NAVIGATION,
|
||||
_ => ALLOW_NOTHING
|
||||
"allow-same-origin" => SandboxAllowance::ALLOW_SAME_ORIGIN,
|
||||
"allow-forms" => SandboxAllowance::ALLOW_FORMS,
|
||||
"allow-pointer-lock" => SandboxAllowance::ALLOW_POINTER_LOCK,
|
||||
"allow-popups" => SandboxAllowance::ALLOW_POPUPS,
|
||||
"allow-scripts" => SandboxAllowance::ALLOW_SCRIPTS,
|
||||
"allow-top-navigation" => SandboxAllowance::ALLOW_TOP_NAVIGATION,
|
||||
_ => SandboxAllowance::ALLOW_NOTHING
|
||||
};
|
||||
}
|
||||
modes
|
||||
|
|
|
@ -48,7 +48,7 @@ use std::borrow::ToOwned;
|
|||
use std::cell::Cell;
|
||||
use std::ops::Range;
|
||||
use style::attr::AttrValue;
|
||||
use style::element_state::*;
|
||||
use style::element_state::ElementState;
|
||||
use style::str::split_commas;
|
||||
use textinput::{SelectionDirection, TextInput};
|
||||
use textinput::KeyReaction::{DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction};
|
||||
|
@ -137,7 +137,8 @@ impl HTMLInputElement {
|
|||
let chan = document.window().upcast::<GlobalScope>().script_to_constellation_chan().clone();
|
||||
HTMLInputElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE,
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE |
|
||||
ElementState::IN_READ_WRITE_STATE,
|
||||
local_name, prefix, document),
|
||||
input_type: Cell::new(InputType::InputText),
|
||||
placeholder: DomRefCell::new(DOMString::new()),
|
||||
|
@ -280,13 +281,13 @@ impl LayoutHTMLInputElementHelpers for LayoutDom<HTMLInputElement> {
|
|||
#[allow(unrooted_must_root)]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn checked_state_for_layout(self) -> bool {
|
||||
self.upcast::<Element>().get_state_for_layout().contains(IN_CHECKED_STATE)
|
||||
self.upcast::<Element>().get_state_for_layout().contains(ElementState::IN_CHECKED_STATE)
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn indeterminate_state_for_layout(self) -> bool {
|
||||
self.upcast::<Element>().get_state_for_layout().contains(IN_INDETERMINATE_STATE)
|
||||
self.upcast::<Element>().get_state_for_layout().contains(ElementState::IN_INDETERMINATE_STATE)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,7 +337,7 @@ impl HTMLInputElementMethods for HTMLInputElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-checked
|
||||
fn Checked(&self) -> bool {
|
||||
self.upcast::<Element>().state().contains(IN_CHECKED_STATE)
|
||||
self.upcast::<Element>().state().contains(ElementState::IN_CHECKED_STATE)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-checked
|
||||
|
@ -538,12 +539,12 @@ impl HTMLInputElementMethods for HTMLInputElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-indeterminate
|
||||
fn Indeterminate(&self) -> bool {
|
||||
self.upcast::<Element>().state().contains(IN_INDETERMINATE_STATE)
|
||||
self.upcast::<Element>().state().contains(ElementState::IN_INDETERMINATE_STATE)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-indeterminate
|
||||
fn SetIndeterminate(&self, val: bool) {
|
||||
self.upcast::<Element>().set_state(IN_INDETERMINATE_STATE, val)
|
||||
self.upcast::<Element>().set_state(ElementState::IN_INDETERMINATE_STATE, val)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-lfe-labels
|
||||
|
@ -745,7 +746,7 @@ impl HTMLInputElement {
|
|||
}
|
||||
|
||||
fn update_checked_state(&self, checked: bool, dirty: bool) {
|
||||
self.upcast::<Element>().set_state(IN_CHECKED_STATE, checked);
|
||||
self.upcast::<Element>().set_state(ElementState::IN_CHECKED_STATE, checked);
|
||||
|
||||
if dirty {
|
||||
self.checked_changed.set(true);
|
||||
|
|
|
@ -35,7 +35,7 @@ use style::media_queries::parse_media_query_list;
|
|||
use style::parser::ParserContext as CssParserContext;
|
||||
use style::str::HTML_SPACE_CHARACTERS;
|
||||
use style::stylesheets::{CssRuleType, Stylesheet};
|
||||
use style_traits::PARSING_MODE_DEFAULT;
|
||||
use style_traits::ParsingMode;
|
||||
use stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner};
|
||||
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
|
@ -287,7 +287,7 @@ impl HTMLLinkElement {
|
|||
let mut css_parser = CssParser::new(&mut input);
|
||||
let doc_url = document.url();
|
||||
let context = CssParserContext::new_for_cssom(&doc_url, Some(CssRuleType::Media),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
document.quirks_mode());
|
||||
let window = document.window();
|
||||
let media = parse_media_query_list(&context, &mut css_parser,
|
||||
|
|
|
@ -15,7 +15,7 @@ use dom::node::Node;
|
|||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix};
|
||||
use style::element_state::*;
|
||||
use style::element_state::ElementState;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLOptGroupElement {
|
||||
|
@ -28,7 +28,7 @@ impl HTMLOptGroupElement {
|
|||
document: &Document) -> HTMLOptGroupElement {
|
||||
HTMLOptGroupElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE,
|
||||
local_name, prefix, document)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix};
|
||||
use std::cell::Cell;
|
||||
use style::element_state::*;
|
||||
use style::element_state::ElementState;
|
||||
use style::str::{split_html_space_chars, str_join};
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -45,7 +45,7 @@ impl HTMLOptionElement {
|
|||
document: &Document) -> HTMLOptionElement {
|
||||
HTMLOptionElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE,
|
||||
local_name, prefix, document),
|
||||
selectedness: Cell::new(false),
|
||||
dirtiness: Cell::new(false),
|
||||
|
|
|
@ -35,7 +35,7 @@ use html5ever::{LocalName, Prefix};
|
|||
use std::default::Default;
|
||||
use std::iter;
|
||||
use style::attr::AttrValue;
|
||||
use style::element_state::*;
|
||||
use style::element_state::ElementState;
|
||||
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct OptionsFilter;
|
||||
|
@ -73,7 +73,7 @@ impl HTMLSelectElement {
|
|||
document: &Document) -> HTMLSelectElement {
|
||||
HTMLSelectElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE,
|
||||
local_name, prefix, document),
|
||||
options: Default::default(),
|
||||
form_owner: Default::default(),
|
||||
|
|
|
@ -25,7 +25,7 @@ use std::cell::Cell;
|
|||
use style::media_queries::parse_media_query_list;
|
||||
use style::parser::ParserContext as CssParserContext;
|
||||
use style::stylesheets::{CssRuleType, Stylesheet, Origin};
|
||||
use style_traits::PARSING_MODE_DEFAULT;
|
||||
use style_traits::ParsingMode;
|
||||
use stylesheet_loader::{StylesheetLoader, StylesheetOwner};
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -87,7 +87,7 @@ impl HTMLStyleElement {
|
|||
let url = window.get_url();
|
||||
let context = CssParserContext::new_for_cssom(&url,
|
||||
Some(CssRuleType::Media),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
doc.quirks_mode());
|
||||
let shared_lock = node.owner_doc().style_shared_lock().clone();
|
||||
let mut input = ParserInput::new(&mq_str);
|
||||
|
|
|
@ -32,7 +32,7 @@ use std::cell::Cell;
|
|||
use std::default::Default;
|
||||
use std::ops::Range;
|
||||
use style::attr::AttrValue;
|
||||
use style::element_state::*;
|
||||
use style::element_state::ElementState;
|
||||
use textinput::{KeyReaction, Lines, SelectionDirection, TextInput};
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -111,7 +111,8 @@ impl HTMLTextAreaElement {
|
|||
let chan = document.window().upcast::<GlobalScope>().script_to_constellation_chan().clone();
|
||||
HTMLTextAreaElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE,
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE |
|
||||
ElementState::IN_READ_WRITE_STATE,
|
||||
local_name, prefix, document),
|
||||
placeholder: DomRefCell::new(DOMString::new()),
|
||||
textinput: DomRefCell::new(TextInput::new(
|
||||
|
|
|
@ -15,7 +15,6 @@ use dom::event::Event;
|
|||
use dom::uievent::UIEvent;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use msg::constellation_msg;
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
use std::borrow::Cow;
|
||||
use std::cell::Cell;
|
||||
|
@ -144,16 +143,16 @@ impl KeyboardEvent {
|
|||
pub fn get_key_modifiers(&self) -> KeyModifiers {
|
||||
let mut result = KeyModifiers::empty();
|
||||
if self.shift.get() {
|
||||
result = result | constellation_msg::SHIFT;
|
||||
result = result | KeyModifiers::SHIFT;
|
||||
}
|
||||
if self.ctrl.get() {
|
||||
result = result | constellation_msg::CONTROL;
|
||||
result = result | KeyModifiers::CONTROL;
|
||||
}
|
||||
if self.alt.get() {
|
||||
result = result | constellation_msg::ALT;
|
||||
result = result | KeyModifiers::ALT;
|
||||
}
|
||||
if self.meta.get() {
|
||||
result = result | constellation_msg::SUPER;
|
||||
result = result | KeyModifiers::SUPER;
|
||||
}
|
||||
result
|
||||
}
|
||||
|
@ -165,7 +164,7 @@ pub fn key_value(ch: Option<char>, key: Key, mods: KeyModifiers) -> Cow<'static,
|
|||
return Cow::from(format!("{}", ch));
|
||||
}
|
||||
|
||||
let shift = mods.contains(constellation_msg::SHIFT);
|
||||
let shift = mods.contains(KeyModifiers::SHIFT);
|
||||
Cow::from(match key {
|
||||
Key::Space => " ",
|
||||
Key::Apostrophe if shift => "\"",
|
||||
|
|
|
@ -18,7 +18,7 @@ use style::media_queries::MediaList as StyleMediaList;
|
|||
use style::parser::ParserContext;
|
||||
use style::shared_lock::{SharedRwLock, Locked};
|
||||
use style::stylesheets::CssRuleType;
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ToCss};
|
||||
use style_traits::{ParsingMode, ToCss};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct MediaList {
|
||||
|
@ -78,7 +78,7 @@ impl MediaListMethods for MediaList {
|
|||
let url = window.get_url();
|
||||
let quirks_mode = window.Document().quirks_mode();
|
||||
let context = ParserContext::new_for_cssom(&url, Some(CssRuleType::Media),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
quirks_mode);
|
||||
*media_queries = parse_media_query_list(&context, &mut parser,
|
||||
window.css_error_reporter());
|
||||
|
@ -116,7 +116,7 @@ impl MediaListMethods for MediaList {
|
|||
let url = win.get_url();
|
||||
let quirks_mode = win.Document().quirks_mode();
|
||||
let context = ParserContext::new_for_cssom(&url, Some(CssRuleType::Media),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
quirks_mode);
|
||||
let m = MediaQuery::parse(&context, &mut parser);
|
||||
// Step 2
|
||||
|
@ -145,7 +145,7 @@ impl MediaListMethods for MediaList {
|
|||
let url = win.get_url();
|
||||
let quirks_mode = win.Document().quirks_mode();
|
||||
let context = ParserContext::new_for_cssom(&url, Some(CssRuleType::Media),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
quirks_mode);
|
||||
let m = MediaQuery::parse(&context, &mut parser);
|
||||
// Step 2
|
||||
|
|
|
@ -148,39 +148,39 @@ pub struct Node {
|
|||
bitflags! {
|
||||
#[doc = "Flags for node items."]
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
pub flags NodeFlags: u16 {
|
||||
pub struct NodeFlags: u16 {
|
||||
#[doc = "Specifies whether this node is in a document."]
|
||||
const IS_IN_DOC = 1 << 0,
|
||||
const IS_IN_DOC = 1 << 0;
|
||||
|
||||
#[doc = "Specifies whether this node needs style recalc on next reflow."]
|
||||
const HAS_DIRTY_DESCENDANTS = 1 << 1,
|
||||
const HAS_DIRTY_DESCENDANTS = 1 << 1;
|
||||
// TODO: find a better place to keep this (#4105)
|
||||
// https://critic.hoppipolla.co.uk/showcomment?chain=8873
|
||||
// Perhaps using a Set in Document?
|
||||
#[doc = "Specifies whether or not there is an authentic click in progress on \
|
||||
this element."]
|
||||
const CLICK_IN_PROGRESS = 1 << 2,
|
||||
const CLICK_IN_PROGRESS = 1 << 2;
|
||||
#[doc = "Specifies whether this node is focusable and whether it is supposed \
|
||||
to be reachable with using sequential focus navigation."]
|
||||
const SEQUENTIALLY_FOCUSABLE = 1 << 3,
|
||||
const SEQUENTIALLY_FOCUSABLE = 1 << 3;
|
||||
|
||||
/// Whether any ancestor is a fragmentation container
|
||||
const CAN_BE_FRAGMENTED = 1 << 4,
|
||||
const CAN_BE_FRAGMENTED = 1 << 4;
|
||||
|
||||
// There's a free bit here.
|
||||
|
||||
#[doc = "Specifies whether the parser has set an associated form owner for \
|
||||
this element. Only applicable for form-associatable elements."]
|
||||
const PARSER_ASSOCIATED_FORM_OWNER = 1 << 6,
|
||||
const PARSER_ASSOCIATED_FORM_OWNER = 1 << 6;
|
||||
|
||||
/// Whether this element has a snapshot stored due to a style or
|
||||
/// attribute change.
|
||||
///
|
||||
/// See the `style::restyle_hints` module.
|
||||
const HAS_SNAPSHOT = 1 << 7,
|
||||
const HAS_SNAPSHOT = 1 << 7;
|
||||
|
||||
/// Whether this element has already handled the stored snapshot.
|
||||
const HANDLED_SNAPSHOT = 1 << 8,
|
||||
const HANDLED_SNAPSHOT = 1 << 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,9 +261,9 @@ impl Node {
|
|||
|
||||
let parent_in_doc = self.is_in_doc();
|
||||
for node in new_child.traverse_preorder() {
|
||||
node.set_flag(IS_IN_DOC, parent_in_doc);
|
||||
node.set_flag(NodeFlags::IS_IN_DOC, parent_in_doc);
|
||||
// Out-of-document elements never have the descendants flag set.
|
||||
debug_assert!(!node.get_flag(HAS_DIRTY_DESCENDANTS));
|
||||
debug_assert!(!node.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS));
|
||||
vtable_for(&&*node).bind_to_tree(parent_in_doc);
|
||||
}
|
||||
let document = new_child.owner_doc();
|
||||
|
@ -303,8 +303,8 @@ impl Node {
|
|||
|
||||
for node in child.traverse_preorder() {
|
||||
// Out-of-document elements never have the descendants flag set.
|
||||
node.set_flag(IS_IN_DOC | HAS_DIRTY_DESCENDANTS |
|
||||
HAS_SNAPSHOT | HANDLED_SNAPSHOT,
|
||||
node.set_flag(NodeFlags::IS_IN_DOC | NodeFlags::HAS_DIRTY_DESCENDANTS |
|
||||
NodeFlags::HAS_SNAPSHOT | NodeFlags::HANDLED_SNAPSHOT,
|
||||
false);
|
||||
}
|
||||
for node in child.traverse_preorder() {
|
||||
|
@ -427,7 +427,7 @@ impl Node {
|
|||
}
|
||||
|
||||
pub fn is_in_doc(&self) -> bool {
|
||||
self.flags.get().contains(IS_IN_DOC)
|
||||
self.flags.get().contains(NodeFlags::IS_IN_DOC)
|
||||
}
|
||||
|
||||
/// Returns the type ID of this node.
|
||||
|
@ -489,7 +489,7 @@ impl Node {
|
|||
}
|
||||
|
||||
pub fn has_dirty_descendants(&self) -> bool {
|
||||
self.get_flag(HAS_DIRTY_DESCENDANTS)
|
||||
self.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS)
|
||||
}
|
||||
|
||||
pub fn rev_version(&self) {
|
||||
|
@ -1378,7 +1378,7 @@ impl Node {
|
|||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new_document_node() -> Node {
|
||||
Node::new_(NodeFlags::new() | IS_IN_DOC, None)
|
||||
Node::new_(NodeFlags::new() | NodeFlags::IS_IN_DOC, None)
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
|
|
|
@ -32,7 +32,7 @@ use servo_url::ServoUrl;
|
|||
use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use style::thread_state::{self, IN_WORKER, SCRIPT};
|
||||
use style::thread_state::{self, ThreadState};
|
||||
|
||||
/// Messages used to control service worker event loop
|
||||
pub enum ServiceWorkerScriptMsg {
|
||||
|
@ -153,7 +153,7 @@ impl ServiceWorkerGlobalScope {
|
|||
let serialized_worker_url = script_url.to_string();
|
||||
let origin = GlobalScope::current().expect("No current global object").origin().immutable().clone();
|
||||
thread::Builder::new().name(format!("ServiceWorker for {}", serialized_worker_url)).spawn(move || {
|
||||
thread_state::initialize(SCRIPT | IN_WORKER);
|
||||
thread_state::initialize(ThreadState::SCRIPT | ThreadState::IN_WORKER);
|
||||
let roots = RootCollection::new();
|
||||
let _stack_roots = ThreadLocalStackRoots::new(&roots);
|
||||
|
||||
|
|
|
@ -28,17 +28,17 @@ pub enum ValidityStatus {
|
|||
}
|
||||
|
||||
bitflags!{
|
||||
pub flags ValidationFlags: u32 {
|
||||
const VALUE_MISSING = 0b0000000001,
|
||||
const TYPE_MISMATCH = 0b0000000010,
|
||||
const PATTERN_MISMATCH = 0b0000000100,
|
||||
const TOO_LONG = 0b0000001000,
|
||||
const TOO_SHORT = 0b0000010000,
|
||||
const RANGE_UNDERFLOW = 0b0000100000,
|
||||
const RANGE_OVERFLOW = 0b0001000000,
|
||||
const STEP_MISMATCH = 0b0010000000,
|
||||
const BAD_INPUT = 0b0100000000,
|
||||
const CUSTOM_ERROR = 0b1000000000,
|
||||
pub struct ValidationFlags: u32 {
|
||||
const VALUE_MISSING = 0b0000000001;
|
||||
const TYPE_MISMATCH = 0b0000000010;
|
||||
const PATTERN_MISMATCH = 0b0000000100;
|
||||
const TOO_LONG = 0b0000001000;
|
||||
const TOO_SHORT = 0b0000010000;
|
||||
const RANGE_UNDERFLOW = 0b0000100000;
|
||||
const RANGE_OVERFLOW = 0b0001000000;
|
||||
const STEP_MISMATCH = 0b0010000000;
|
||||
const BAD_INPUT = 0b0100000000;
|
||||
const CUSTOM_ERROR = 0b1000000000;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,10 +136,10 @@ fn has_invalid_blend_constants(arg1: u32, arg2: u32) -> bool {
|
|||
/// Set of bitflags for texture unpacking (texImage2d, etc...)
|
||||
bitflags! {
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
flags TextureUnpacking: u8 {
|
||||
const FLIP_Y_AXIS = 0x01,
|
||||
const PREMULTIPLY_ALPHA = 0x02,
|
||||
const CONVERT_COLORSPACE = 0x04,
|
||||
struct TextureUnpacking: u8 {
|
||||
const FLIP_Y_AXIS = 0x01;
|
||||
const PREMULTIPLY_ALPHA = 0x02;
|
||||
const CONVERT_COLORSPACE = 0x04;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ impl WebGLRenderingContext {
|
|||
limits: ctx_data.limits,
|
||||
canvas: Dom::from_ref(canvas),
|
||||
last_error: Cell::new(None),
|
||||
texture_unpacking_settings: Cell::new(CONVERT_COLORSPACE),
|
||||
texture_unpacking_settings: Cell::new(TextureUnpacking::CONVERT_COLORSPACE),
|
||||
texture_unpacking_alignment: Cell::new(4),
|
||||
bound_framebuffer: MutNullableDom::new(None),
|
||||
bound_textures: DomRefCell::new(Default::default()),
|
||||
|
@ -887,7 +887,7 @@ impl WebGLRenderingContext {
|
|||
width: usize,
|
||||
height: usize,
|
||||
unpacking_alignment: usize) -> Vec<u8> {
|
||||
if !self.texture_unpacking_settings.get().contains(FLIP_Y_AXIS) {
|
||||
if !self.texture_unpacking_settings.get().contains(TextureUnpacking::FLIP_Y_AXIS) {
|
||||
return pixels;
|
||||
}
|
||||
|
||||
|
@ -915,7 +915,7 @@ impl WebGLRenderingContext {
|
|||
format: TexFormat,
|
||||
data_type: TexDataType,
|
||||
pixels: Vec<u8>) -> Vec<u8> {
|
||||
if !self.texture_unpacking_settings.get().contains(PREMULTIPLY_ALPHA) {
|
||||
if !self.texture_unpacking_settings.get().contains(TextureUnpacking::PREMULTIPLY_ALPHA) {
|
||||
return pixels;
|
||||
}
|
||||
|
||||
|
@ -999,7 +999,7 @@ impl WebGLRenderingContext {
|
|||
source_premultiplied: bool,
|
||||
source_from_image_or_canvas: bool,
|
||||
mut pixels: Vec<u8>) -> Vec<u8> {
|
||||
let dest_premultiply = self.texture_unpacking_settings.get().contains(PREMULTIPLY_ALPHA);
|
||||
let dest_premultiply = self.texture_unpacking_settings.get().contains(TextureUnpacking::PREMULTIPLY_ALPHA);
|
||||
if !source_premultiplied && dest_premultiply {
|
||||
if source_from_image_or_canvas {
|
||||
// When the pixels come from image or canvas or imagedata, use RGBA8 format
|
||||
|
@ -2459,9 +2459,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
match param_name {
|
||||
constants::UNPACK_FLIP_Y_WEBGL => {
|
||||
if param_value != 0 {
|
||||
texture_settings.insert(FLIP_Y_AXIS)
|
||||
texture_settings.insert(TextureUnpacking::FLIP_Y_AXIS)
|
||||
} else {
|
||||
texture_settings.remove(FLIP_Y_AXIS)
|
||||
texture_settings.remove(TextureUnpacking::FLIP_Y_AXIS)
|
||||
}
|
||||
|
||||
self.texture_unpacking_settings.set(texture_settings);
|
||||
|
@ -2469,9 +2469,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
},
|
||||
constants::UNPACK_PREMULTIPLY_ALPHA_WEBGL => {
|
||||
if param_value != 0 {
|
||||
texture_settings.insert(PREMULTIPLY_ALPHA)
|
||||
texture_settings.insert(TextureUnpacking::PREMULTIPLY_ALPHA)
|
||||
} else {
|
||||
texture_settings.remove(PREMULTIPLY_ALPHA)
|
||||
texture_settings.remove(TextureUnpacking::PREMULTIPLY_ALPHA)
|
||||
}
|
||||
|
||||
self.texture_unpacking_settings.set(texture_settings);
|
||||
|
@ -2480,9 +2480,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
constants::UNPACK_COLORSPACE_CONVERSION_WEBGL => {
|
||||
match param_value as u32 {
|
||||
constants::BROWSER_DEFAULT_WEBGL
|
||||
=> texture_settings.insert(CONVERT_COLORSPACE),
|
||||
=> texture_settings.insert(TextureUnpacking::CONVERT_COLORSPACE),
|
||||
constants::NONE
|
||||
=> texture_settings.remove(CONVERT_COLORSPACE),
|
||||
=> texture_settings.remove(TextureUnpacking::CONVERT_COLORSPACE),
|
||||
_ => return self.webgl_error(InvalidEnum),
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ use style::properties::longhands::overflow_x;
|
|||
use style::selector_parser::PseudoElement;
|
||||
use style::str::HTML_SPACE_CHARACTERS;
|
||||
use style::stylesheets::CssRuleType;
|
||||
use style_traits::PARSING_MODE_DEFAULT;
|
||||
use style_traits::ParsingMode;
|
||||
use task::TaskCanceller;
|
||||
use task_source::dom_manipulation::DOMManipulationTaskSource;
|
||||
use task_source::file_reading::FileReadingTaskSource;
|
||||
|
@ -1012,7 +1012,7 @@ impl WindowMethods for Window {
|
|||
let url = self.get_url();
|
||||
let quirks_mode = self.Document().quirks_mode();
|
||||
let context = CssParserContext::new_for_cssom(&url, Some(CssRuleType::Media),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
quirks_mode);
|
||||
let media_query_list = media_queries::parse_media_query_list(&context, &mut parser,
|
||||
self.css_error_reporter());
|
||||
|
|
|
@ -62,7 +62,7 @@ use std::sync::mpsc;
|
|||
use std::sync::mpsc::Receiver;
|
||||
use std::sync::mpsc::Sender;
|
||||
use std::thread;
|
||||
use style::thread_state;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
use swapper::Swapper;
|
||||
use swapper::swapper;
|
||||
use task::TaskBox;
|
||||
|
@ -425,7 +425,7 @@ impl WorkletThread {
|
|||
// TODO: set interrupt handler?
|
||||
// TODO: configure the JS runtime (e.g. discourage GC, encourage agressive JIT)
|
||||
debug!("Initializing worklet thread.");
|
||||
thread_state::initialize(thread_state::SCRIPT | thread_state::IN_WORKER);
|
||||
thread_state::initialize(ThreadState::SCRIPT | ThreadState::IN_WORKER);
|
||||
let roots = RootCollection::new();
|
||||
let _stack_roots = ThreadLocalStackRoots::new(&roots);
|
||||
let mut thread = RootedTraceableBox::new(WorkletThread {
|
||||
|
|
|
@ -140,8 +140,7 @@ pub mod layout_exports {
|
|||
pub use dom::characterdata::LayoutCharacterDataHelpers;
|
||||
pub use dom::document::{Document, LayoutDocumentHelpers, PendingRestyle};
|
||||
pub use dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers};
|
||||
pub use dom::node::{CAN_BE_FRAGMENTED, HAS_DIRTY_DESCENDANTS, IS_IN_DOC};
|
||||
pub use dom::node::{HANDLED_SNAPSHOT, HAS_SNAPSHOT};
|
||||
pub use dom::node::NodeFlags;
|
||||
pub use dom::node::{LayoutNodeHelpers, Node};
|
||||
pub use dom::text::Text;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ use std::os;
|
|||
use std::os::raw::c_void;
|
||||
use std::panic::AssertUnwindSafe;
|
||||
use std::ptr;
|
||||
use style::thread_state;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
use task::TaskBox;
|
||||
use time::{Tm, now};
|
||||
|
||||
|
@ -411,8 +411,8 @@ unsafe extern "C" fn gc_slice_callback(_rt: *mut JSRuntime, progress: GCProgress
|
|||
#[allow(unsafe_code)]
|
||||
unsafe extern "C" fn debug_gc_callback(_rt: *mut JSRuntime, status: JSGCStatus, _data: *mut os::raw::c_void) {
|
||||
match status {
|
||||
JSGCStatus::JSGC_BEGIN => thread_state::enter(thread_state::IN_GC),
|
||||
JSGCStatus::JSGC_END => thread_state::exit(thread_state::IN_GC),
|
||||
JSGCStatus::JSGC_BEGIN => thread_state::enter(ThreadState::IN_GC),
|
||||
JSGCStatus::JSGC_END => thread_state::exit(ThreadState::IN_GC),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ use std::result::Result;
|
|||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, Select, Sender, channel};
|
||||
use std::thread;
|
||||
use style::thread_state;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
use task_source::dom_manipulation::DOMManipulationTaskSource;
|
||||
use task_source::file_reading::FileReadingTaskSource;
|
||||
use task_source::history_traversal::HistoryTraversalTaskSource;
|
||||
|
@ -547,7 +547,7 @@ impl ScriptThreadFactory for ScriptThread {
|
|||
let (sender, receiver) = channel();
|
||||
let layout_chan = sender.clone();
|
||||
thread::Builder::new().name(format!("ScriptThread {:?}", state.id)).spawn(move || {
|
||||
thread_state::initialize(thread_state::SCRIPT);
|
||||
thread_state::initialize(ThreadState::SCRIPT);
|
||||
PipelineNamespace::install(state.pipeline_namespace_id);
|
||||
TopLevelBrowsingContextId::install(state.top_level_browsing_context_id);
|
||||
let roots = RootCollection::new();
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
use clipboard_provider::ClipboardProvider;
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::keyboardevent::KeyboardEvent;
|
||||
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
use std::borrow::ToOwned;
|
||||
use std::cmp::{max, min};
|
||||
|
@ -114,12 +113,12 @@ pub enum Direction {
|
|||
/// i.e. cmd on Mac OS or ctrl on other platforms.
|
||||
#[cfg(target_os = "macos")]
|
||||
fn is_control_key(mods: KeyModifiers) -> bool {
|
||||
mods.contains(SUPER) && !mods.contains(CONTROL | ALT)
|
||||
mods.contains(KeyModifiers::SUPER) && !mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT)
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
fn is_control_key(mods: KeyModifiers) -> bool {
|
||||
mods.contains(CONTROL) && !mods.contains(SUPER | ALT)
|
||||
mods.contains(KeyModifiers::CONTROL) && !mods.contains(KeyModifiers::SUPER | KeyModifiers::ALT)
|
||||
}
|
||||
|
||||
/// The length in bytes of the first n characters in a UTF-8 string.
|
||||
|
@ -585,31 +584,36 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
printable: Option<char>,
|
||||
key: Key,
|
||||
mods: KeyModifiers) -> KeyReaction {
|
||||
let maybe_select = if mods.contains(SHIFT) { Selection::Selected } else { Selection::NotSelected };
|
||||
let maybe_select = if mods.contains(KeyModifiers::SHIFT) {
|
||||
Selection::Selected
|
||||
} else {
|
||||
Selection::NotSelected
|
||||
};
|
||||
|
||||
match (printable, key) {
|
||||
(_, Key::B) if mods.contains(CONTROL | ALT) => {
|
||||
(_, Key::B) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => {
|
||||
self.adjust_horizontal_by_word(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
(_, Key::F) if mods.contains(CONTROL | ALT) => {
|
||||
(_, Key::F) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => {
|
||||
self.adjust_horizontal_by_word(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
(_, Key::A) if mods.contains(CONTROL | ALT) => {
|
||||
(_, Key::A) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
(_, Key::E) if mods.contains(CONTROL | ALT) => {
|
||||
(_, Key::E) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::A) if mods == CONTROL => {
|
||||
(None, Key::A) if mods == KeyModifiers::CONTROL => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::E) if mods == CONTROL => {
|
||||
(None, Key::E) if mods == KeyModifiers::CONTROL => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
|
@ -641,30 +645,30 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
KeyReaction::DispatchInput
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::Left) if mods.contains(SUPER) => {
|
||||
(None, Key::Left) if mods.contains(KeyModifiers::SUPER) => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::Right) if mods.contains(SUPER) => {
|
||||
(None, Key::Right) if mods.contains(KeyModifiers::SUPER) => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::Up) if mods.contains(SUPER) => {
|
||||
(None, Key::Up) if mods.contains(KeyModifiers::SUPER) => {
|
||||
self.adjust_horizontal_to_limit(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::Down) if mods.contains(SUPER) => {
|
||||
(None, Key::Down) if mods.contains(KeyModifiers::SUPER) => {
|
||||
self.adjust_horizontal_to_limit(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
(None, Key::Left) if mods.contains(ALT) => {
|
||||
(None, Key::Left) if mods.contains(KeyModifiers::ALT) => {
|
||||
self.adjust_horizontal_by_word(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
(None, Key::Right) if mods.contains(ALT) => {
|
||||
(None, Key::Right) if mods.contains(KeyModifiers::ALT) => {
|
||||
self.adjust_horizontal_by_word(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
|
|
|
@ -23,7 +23,7 @@ gecko_like_types = []
|
|||
bench = []
|
||||
|
||||
[dependencies]
|
||||
bitflags = "0.7"
|
||||
bitflags = "1.0"
|
||||
matches = "0.1"
|
||||
cssparser = "0.22.0"
|
||||
log = "0.3"
|
||||
|
|
|
@ -20,37 +20,39 @@ pub static RECOMMENDED_SELECTOR_BLOOM_FILTER_SIZE: usize = 4096;
|
|||
bitflags! {
|
||||
/// Set of flags that are set on either the element or its parent (depending
|
||||
/// on the flag) if the element could potentially match a selector.
|
||||
pub flags ElementSelectorFlags: usize {
|
||||
pub struct ElementSelectorFlags: usize {
|
||||
/// When a child is added or removed from the parent, all the children
|
||||
/// must be restyled, because they may match :nth-last-child,
|
||||
/// :last-of-type, :nth-last-of-type, or :only-of-type.
|
||||
const HAS_SLOW_SELECTOR = 1 << 0,
|
||||
const HAS_SLOW_SELECTOR = 1 << 0;
|
||||
|
||||
/// When a child is added or removed from the parent, any later
|
||||
/// children must be restyled, because they may match :nth-child,
|
||||
/// :first-of-type, or :nth-of-type.
|
||||
const HAS_SLOW_SELECTOR_LATER_SIBLINGS = 1 << 1,
|
||||
const HAS_SLOW_SELECTOR_LATER_SIBLINGS = 1 << 1;
|
||||
|
||||
/// When a child is added or removed from the parent, the first and
|
||||
/// last children must be restyled, because they may match :first-child,
|
||||
/// :last-child, or :only-child.
|
||||
const HAS_EDGE_CHILD_SELECTOR = 1 << 2,
|
||||
const HAS_EDGE_CHILD_SELECTOR = 1 << 2;
|
||||
|
||||
/// The element has an empty selector, so when a child is appended we
|
||||
/// might need to restyle the parent completely.
|
||||
const HAS_EMPTY_SELECTOR = 1 << 3,
|
||||
const HAS_EMPTY_SELECTOR = 1 << 3;
|
||||
}
|
||||
}
|
||||
|
||||
impl ElementSelectorFlags {
|
||||
/// Returns the subset of flags that apply to the element.
|
||||
pub fn for_self(self) -> ElementSelectorFlags {
|
||||
self & (HAS_EMPTY_SELECTOR)
|
||||
self & (ElementSelectorFlags::HAS_EMPTY_SELECTOR)
|
||||
}
|
||||
|
||||
/// Returns the subset of flags that apply to the parent.
|
||||
pub fn for_parent(self) -> ElementSelectorFlags {
|
||||
self & (HAS_SLOW_SELECTOR | HAS_SLOW_SELECTOR_LATER_SIBLINGS | HAS_EDGE_CHILD_SELECTOR)
|
||||
self & (ElementSelectorFlags::HAS_SLOW_SELECTOR |
|
||||
ElementSelectorFlags::HAS_SLOW_SELECTOR_LATER_SIBLINGS |
|
||||
ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,7 +553,7 @@ where
|
|||
|
||||
let combinator = selector_iter.next_sequence();
|
||||
if combinator.map_or(false, |c| c.is_sibling()) {
|
||||
flags_setter(element, HAS_SLOW_SELECTOR_LATER_SIBLINGS);
|
||||
flags_setter(element, ElementSelectorFlags::HAS_SLOW_SELECTOR_LATER_SIBLINGS);
|
||||
}
|
||||
|
||||
if !matches_all_simple_selectors {
|
||||
|
@ -748,7 +750,7 @@ where
|
|||
element.is_root()
|
||||
}
|
||||
Component::Empty => {
|
||||
flags_setter(element, HAS_EMPTY_SELECTOR);
|
||||
flags_setter(element, ElementSelectorFlags::HAS_EMPTY_SELECTOR);
|
||||
element.is_empty()
|
||||
}
|
||||
Component::Scope => {
|
||||
|
@ -823,9 +825,9 @@ where
|
|||
}
|
||||
|
||||
flags_setter(element, if is_from_end {
|
||||
HAS_SLOW_SELECTOR
|
||||
ElementSelectorFlags::HAS_SLOW_SELECTOR
|
||||
} else {
|
||||
HAS_SLOW_SELECTOR_LATER_SIBLINGS
|
||||
ElementSelectorFlags::HAS_SLOW_SELECTOR_LATER_SIBLINGS
|
||||
});
|
||||
|
||||
// Grab a reference to the appropriate cache.
|
||||
|
@ -918,7 +920,7 @@ where
|
|||
E: Element,
|
||||
F: FnMut(&E, ElementSelectorFlags),
|
||||
{
|
||||
flags_setter(element, HAS_EDGE_CHILD_SELECTOR);
|
||||
flags_setter(element, ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR);
|
||||
element.prev_sibling_element().is_none()
|
||||
}
|
||||
|
||||
|
@ -928,6 +930,6 @@ where
|
|||
E: Element,
|
||||
F: FnMut(&E, ElementSelectorFlags),
|
||||
{
|
||||
flags_setter(element, HAS_EDGE_CHILD_SELECTOR);
|
||||
flags_setter(element, ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR);
|
||||
element.next_sibling_element().is_none()
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ gecko_debug = ["nsstring/gecko_debug"]
|
|||
app_units = "0.5.5"
|
||||
arrayvec = "0.3.20"
|
||||
atomic_refcell = "0.1"
|
||||
bitflags = "0.7"
|
||||
bitflags = "1.0"
|
||||
byteorder = "1.0"
|
||||
cfg-if = "0.1.0"
|
||||
cssparser = "0.22.0"
|
||||
|
|
|
@ -37,7 +37,7 @@ use style_traits::CSSPixel;
|
|||
use style_traits::DevicePixel;
|
||||
#[cfg(feature = "servo")] use style_traits::SpeculativePainter;
|
||||
use stylist::Stylist;
|
||||
use thread_state;
|
||||
use thread_state::{self, ThreadState};
|
||||
use time;
|
||||
use timer::Timer;
|
||||
use traversal::DomTraversal;
|
||||
|
@ -421,15 +421,15 @@ impl TraversalStatistics {
|
|||
bitflags! {
|
||||
/// Represents which tasks are performed in a SequentialTask of
|
||||
/// UpdateAnimations which is a result of normal restyle.
|
||||
pub flags UpdateAnimationsTasks: u8 {
|
||||
pub struct UpdateAnimationsTasks: u8 {
|
||||
/// Update CSS Animations.
|
||||
const CSS_ANIMATIONS = structs::UpdateAnimationsTasks_CSSAnimations,
|
||||
const CSS_ANIMATIONS = structs::UpdateAnimationsTasks_CSSAnimations;
|
||||
/// Update CSS Transitions.
|
||||
const CSS_TRANSITIONS = structs::UpdateAnimationsTasks_CSSTransitions,
|
||||
const CSS_TRANSITIONS = structs::UpdateAnimationsTasks_CSSTransitions;
|
||||
/// Update effect properties.
|
||||
const EFFECT_PROPERTIES = structs::UpdateAnimationsTasks_EffectProperties,
|
||||
const EFFECT_PROPERTIES = structs::UpdateAnimationsTasks_EffectProperties;
|
||||
/// Update animation cacade results for animations running on the compositor.
|
||||
const CASCADE_RESULTS = structs::UpdateAnimationsTasks_CascadeResults,
|
||||
const CASCADE_RESULTS = structs::UpdateAnimationsTasks_CascadeResults;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,11 +437,11 @@ bitflags! {
|
|||
bitflags! {
|
||||
/// Represents which tasks are performed in a SequentialTask as a result of
|
||||
/// animation-only restyle.
|
||||
pub flags PostAnimationTasks: u8 {
|
||||
pub struct PostAnimationTasks: u8 {
|
||||
/// Display property was changed from none in animation-only restyle so
|
||||
/// that we need to resolve styles for descendants in a subsequent
|
||||
/// normal restyle.
|
||||
const DISPLAY_CHANGED_FROM_NONE_FOR_SMIL = 0x01,
|
||||
const DISPLAY_CHANGED_FROM_NONE_FOR_SMIL = 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@ impl<E: TElement> SequentialTask<E> {
|
|||
/// Executes this task.
|
||||
pub fn execute(self) {
|
||||
use self::SequentialTask::*;
|
||||
debug_assert!(thread_state::get() == thread_state::LAYOUT);
|
||||
debug_assert!(thread_state::get() == ThreadState::LAYOUT);
|
||||
match self {
|
||||
Unused(_) => unreachable!(),
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -571,7 +571,7 @@ impl<E: TElement> SelectorFlagsMap<E> {
|
|||
|
||||
/// Applies the flags. Must be called on the main thread.
|
||||
pub fn apply_flags(&mut self) {
|
||||
debug_assert!(thread_state::get() == thread_state::LAYOUT);
|
||||
debug_assert!(thread_state::get() == ThreadState::LAYOUT);
|
||||
for (el, flags) in self.map.drain() {
|
||||
unsafe { el.set_selector_flags(flags); }
|
||||
}
|
||||
|
@ -608,7 +608,7 @@ where
|
|||
E: TElement,
|
||||
{
|
||||
fn drop(&mut self) {
|
||||
debug_assert!(thread_state::get() == thread_state::LAYOUT);
|
||||
debug_assert!(thread_state::get() == ThreadState::LAYOUT);
|
||||
for task in self.0.drain(..) {
|
||||
task.execute()
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ impl<E: TElement> ThreadLocalStyleContext<E> {
|
|||
impl<E: TElement> Drop for ThreadLocalStyleContext<E> {
|
||||
fn drop(&mut self) {
|
||||
debug_assert!(self.current_element_info.is_none());
|
||||
debug_assert!(thread_state::get() == thread_state::LAYOUT);
|
||||
debug_assert!(thread_state::get() == ThreadState::LAYOUT);
|
||||
|
||||
// Apply any slow selector flags that need to be set on parents.
|
||||
self.selector_flags.apply_flags();
|
||||
|
|
|
@ -26,9 +26,9 @@ use style_resolver::{PrimaryStyle, ResolvedElementStyles, ResolvedStyle};
|
|||
bitflags! {
|
||||
/// Various flags stored on ElementData.
|
||||
#[derive(Default)]
|
||||
pub flags ElementDataFlags: u8 {
|
||||
pub struct ElementDataFlags: u8 {
|
||||
/// Whether the styles changed for this restyle.
|
||||
const WAS_RESTYLED = 1 << 0,
|
||||
const WAS_RESTYLED = 1 << 0;
|
||||
/// Whether the last traversal of this element did not do
|
||||
/// any style computation. This is not true during the initial
|
||||
/// styling pass, nor is it true when we restyle (in which case
|
||||
|
@ -37,16 +37,16 @@ bitflags! {
|
|||
/// This bit always corresponds to the last time the element was
|
||||
/// traversed, so each traversal simply updates it with the appropriate
|
||||
/// value.
|
||||
const TRAVERSED_WITHOUT_STYLING = 1 << 1,
|
||||
const TRAVERSED_WITHOUT_STYLING = 1 << 1;
|
||||
/// Whether we reframed/reconstructed any ancestor or self.
|
||||
const ANCESTOR_WAS_RECONSTRUCTED = 1 << 2,
|
||||
const ANCESTOR_WAS_RECONSTRUCTED = 1 << 2;
|
||||
/// Whether the primary style of this element data was reused from another
|
||||
/// element via a rule node comparison. This allows us to differentiate
|
||||
/// between elements that shared styles because they met all the criteria
|
||||
/// of the style sharing cache, compared to elements that reused style
|
||||
/// structs via rule node identity. The former gives us stronger transitive
|
||||
/// guarantees that allows us to apply the style sharing cache to cousins.
|
||||
const PRIMARY_STYLE_REUSED_VIA_RULE_NODE = 1 << 3,
|
||||
const PRIMARY_STYLE_REUSED_VIA_RULE_NODE = 1 << 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ impl ElementData {
|
|||
/// Returns this element's primary style as a resolved style to use for sharing.
|
||||
pub fn share_primary_style(&self) -> PrimaryStyle {
|
||||
let reused_via_rule_node =
|
||||
self.flags.contains(PRIMARY_STYLE_REUSED_VIA_RULE_NODE);
|
||||
self.flags.contains(ElementDataFlags::PRIMARY_STYLE_REUSED_VIA_RULE_NODE);
|
||||
|
||||
PrimaryStyle {
|
||||
style: ResolvedStyle(self.styles.primary().clone()),
|
||||
|
@ -315,9 +315,9 @@ impl ElementData {
|
|||
/// Sets a new set of styles, returning the old ones.
|
||||
pub fn set_styles(&mut self, new_styles: ResolvedElementStyles) -> ElementStyles {
|
||||
if new_styles.primary.reused_via_rule_node {
|
||||
self.flags.insert(PRIMARY_STYLE_REUSED_VIA_RULE_NODE);
|
||||
self.flags.insert(ElementDataFlags::PRIMARY_STYLE_REUSED_VIA_RULE_NODE);
|
||||
} else {
|
||||
self.flags.remove(PRIMARY_STYLE_REUSED_VIA_RULE_NODE);
|
||||
self.flags.remove(ElementDataFlags::PRIMARY_STYLE_REUSED_VIA_RULE_NODE);
|
||||
}
|
||||
mem::replace(&mut self.styles, new_styles.into())
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ impl ElementData {
|
|||
#[inline]
|
||||
pub fn clear_restyle_flags_and_damage(&mut self) {
|
||||
self.damage = RestyleDamage::empty();
|
||||
self.flags.remove(WAS_RESTYLED | ANCESTOR_WAS_RECONSTRUCTED)
|
||||
self.flags.remove(ElementDataFlags::WAS_RESTYLED | ElementDataFlags::ANCESTOR_WAS_RECONSTRUCTED)
|
||||
}
|
||||
|
||||
/// Returns whether this element or any ancestor is going to be
|
||||
|
@ -422,7 +422,7 @@ impl ElementData {
|
|||
/// Returns whether any ancestor of this element is going to be
|
||||
/// reconstructed.
|
||||
fn reconstructed_ancestor(&self) -> bool {
|
||||
self.flags.contains(ANCESTOR_WAS_RECONSTRUCTED)
|
||||
self.flags.contains(ElementDataFlags::ANCESTOR_WAS_RECONSTRUCTED)
|
||||
}
|
||||
|
||||
/// Sets the flag that tells us whether we've reconstructed an ancestor.
|
||||
|
@ -430,34 +430,34 @@ impl ElementData {
|
|||
if reconstructed {
|
||||
// If it weren't for animation-only traversals, we could assert
|
||||
// `!self.reconstructed_ancestor()` here.
|
||||
self.flags.insert(ANCESTOR_WAS_RECONSTRUCTED);
|
||||
self.flags.insert(ElementDataFlags::ANCESTOR_WAS_RECONSTRUCTED);
|
||||
} else {
|
||||
self.flags.remove(ANCESTOR_WAS_RECONSTRUCTED);
|
||||
self.flags.remove(ElementDataFlags::ANCESTOR_WAS_RECONSTRUCTED);
|
||||
}
|
||||
}
|
||||
|
||||
/// Mark this element as restyled, which is useful to know whether we need
|
||||
/// to do a post-traversal.
|
||||
pub fn set_restyled(&mut self) {
|
||||
self.flags.insert(WAS_RESTYLED);
|
||||
self.flags.remove(TRAVERSED_WITHOUT_STYLING);
|
||||
self.flags.insert(ElementDataFlags::WAS_RESTYLED);
|
||||
self.flags.remove(ElementDataFlags::TRAVERSED_WITHOUT_STYLING);
|
||||
}
|
||||
|
||||
/// Returns true if this element was restyled.
|
||||
#[inline]
|
||||
pub fn is_restyle(&self) -> bool {
|
||||
self.flags.contains(WAS_RESTYLED)
|
||||
self.flags.contains(ElementDataFlags::WAS_RESTYLED)
|
||||
}
|
||||
|
||||
/// Mark that we traversed this element without computing any style for it.
|
||||
pub fn set_traversed_without_styling(&mut self) {
|
||||
self.flags.insert(TRAVERSED_WITHOUT_STYLING);
|
||||
self.flags.insert(ElementDataFlags::TRAVERSED_WITHOUT_STYLING);
|
||||
}
|
||||
|
||||
/// Returns whether the element was traversed without computing any style for
|
||||
/// it.
|
||||
pub fn traversed_without_styling(&self) -> bool {
|
||||
self.flags.contains(TRAVERSED_WITHOUT_STYLING)
|
||||
self.flags.contains(ElementDataFlags::TRAVERSED_WITHOUT_STYLING)
|
||||
}
|
||||
|
||||
/// Returns whether this element has been part of a restyle.
|
||||
|
@ -499,7 +499,8 @@ impl ElementData {
|
|||
/// happens later in the styling pipeline. The former gives us the stronger guarantees
|
||||
/// we need for style sharing, the latter does not.
|
||||
pub fn safe_for_cousin_sharing(&self) -> bool {
|
||||
!self.flags.intersects(TRAVERSED_WITHOUT_STYLING | PRIMARY_STYLE_REUSED_VIA_RULE_NODE)
|
||||
!self.flags.intersects(ElementDataFlags::TRAVERSED_WITHOUT_STYLING |
|
||||
ElementDataFlags::PRIMARY_STYLE_REUSED_VIA_RULE_NODE)
|
||||
}
|
||||
|
||||
/// Measures memory usage.
|
||||
|
|
|
@ -32,7 +32,7 @@ use std::fmt::Debug;
|
|||
use std::hash::Hash;
|
||||
use std::ops::Deref;
|
||||
use stylist::Stylist;
|
||||
use traversal_flags::{TraversalFlags, self};
|
||||
use traversal_flags::TraversalFlags;
|
||||
|
||||
/// An opaque handle to a node, which, unlike UnsafeNode, cannot be transformed
|
||||
/// back into a non-opaque representation. The only safe operation that can be
|
||||
|
@ -555,7 +555,7 @@ pub trait TElement
|
|||
!data.hint.has_animation_hint_or_recascade();
|
||||
}
|
||||
|
||||
if traversal_flags.contains(traversal_flags::UnstyledOnly) {
|
||||
if traversal_flags.contains(TraversalFlags::UnstyledOnly) {
|
||||
// We don't process invalidations in UnstyledOnly mode.
|
||||
return data.has_styles();
|
||||
}
|
||||
|
|
|
@ -15,127 +15,128 @@ bitflags! {
|
|||
/// TODO(emilio): We really really want to use the NS_EVENT_STATE bindings
|
||||
/// for this.
|
||||
#[derive(MallocSizeOf)]
|
||||
pub flags ElementState: u64 {
|
||||
pub struct ElementState: u64 {
|
||||
/// The mouse is down on this element.
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-active>
|
||||
/// FIXME(#7333): set/unset this when appropriate
|
||||
const IN_ACTIVE_STATE = 1 << 0,
|
||||
const IN_ACTIVE_STATE = 1 << 0;
|
||||
/// This element has focus.
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-focus>
|
||||
const IN_FOCUS_STATE = 1 << 1,
|
||||
const IN_FOCUS_STATE = 1 << 1;
|
||||
/// The mouse is hovering over this element.
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-hover>
|
||||
const IN_HOVER_STATE = 1 << 2,
|
||||
const IN_HOVER_STATE = 1 << 2;
|
||||
/// Content is enabled (and can be disabled).
|
||||
/// <http://www.whatwg.org/html/#selector-enabled>
|
||||
const IN_ENABLED_STATE = 1 << 3,
|
||||
const IN_ENABLED_STATE = 1 << 3;
|
||||
/// Content is disabled.
|
||||
/// <http://www.whatwg.org/html/#selector-disabled>
|
||||
const IN_DISABLED_STATE = 1 << 4,
|
||||
const IN_DISABLED_STATE = 1 << 4;
|
||||
/// Content is checked.
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-checked>
|
||||
const IN_CHECKED_STATE = 1 << 5,
|
||||
const IN_CHECKED_STATE = 1 << 5;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-indeterminate>
|
||||
const IN_INDETERMINATE_STATE = 1 << 6,
|
||||
const IN_INDETERMINATE_STATE = 1 << 6;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-placeholder-shown>
|
||||
const IN_PLACEHOLDER_SHOWN_STATE = 1 << 7,
|
||||
const IN_PLACEHOLDER_SHOWN_STATE = 1 << 7;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-target>
|
||||
const IN_TARGET_STATE = 1 << 8,
|
||||
const IN_TARGET_STATE = 1 << 8;
|
||||
/// <https://fullscreen.spec.whatwg.org/#%3Afullscreen-pseudo-class>
|
||||
const IN_FULLSCREEN_STATE = 1 << 9,
|
||||
const IN_FULLSCREEN_STATE = 1 << 9;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-valid>
|
||||
const IN_VALID_STATE = 1 << 10,
|
||||
const IN_VALID_STATE = 1 << 10;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-invalid>
|
||||
const IN_INVALID_STATE = 1 << 11,
|
||||
const IN_INVALID_STATE = 1 << 11;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-valid
|
||||
const IN_MOZ_UI_VALID_STATE = 1 << 12,
|
||||
const IN_MOZ_UI_VALID_STATE = 1 << 12;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-invalid
|
||||
const IN_MOZ_UI_INVALID_STATE = 1 << 13,
|
||||
const IN_MOZ_UI_INVALID_STATE = 1 << 13;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-broken
|
||||
const IN_BROKEN_STATE = 1 << 14,
|
||||
const IN_BROKEN_STATE = 1 << 14;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-user-disabled
|
||||
const IN_USER_DISABLED_STATE = 1 << 15,
|
||||
const IN_USER_DISABLED_STATE = 1 << 15;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-suppressed
|
||||
const IN_SUPPRESSED_STATE = 1 << 16,
|
||||
const IN_SUPPRESSED_STATE = 1 << 16;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-loading
|
||||
const IN_LOADING_STATE = 1 << 17,
|
||||
const IN_LOADING_STATE = 1 << 17;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-blocked
|
||||
const IN_HANDLER_BLOCKED_STATE = 1 << 18,
|
||||
const IN_HANDLER_BLOCKED_STATE = 1 << 18;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-disabled
|
||||
const IN_HANDLER_DISABLED_STATE = 1 << 19,
|
||||
const IN_HANDLER_DISABLED_STATE = 1 << 19;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-crashed
|
||||
const IN_HANDLER_CRASHED_STATE = 1 << 20,
|
||||
const IN_HANDLER_CRASHED_STATE = 1 << 20;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-required>
|
||||
const IN_REQUIRED_STATE = 1 << 21,
|
||||
const IN_REQUIRED_STATE = 1 << 21;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-optional>
|
||||
const IN_OPTIONAL_STATE = 1 << 22,
|
||||
const IN_OPTIONAL_STATE = 1 << 22;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-read-write>
|
||||
const IN_READ_WRITE_STATE = 1 << 22,
|
||||
const IN_READ_WRITE_STATE = 1 << 22;
|
||||
/// Non-standard: Older custom-elements spec.
|
||||
const IN_UNRESOLVED_STATE = 1 << 23,
|
||||
const IN_UNRESOLVED_STATE = 1 << 23;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-visited>
|
||||
const IN_VISITED_STATE = 1 << 24,
|
||||
const IN_VISITED_STATE = 1 << 24;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-link>
|
||||
const IN_UNVISITED_STATE = 1 << 25,
|
||||
const IN_UNVISITED_STATE = 1 << 25;
|
||||
/// <https://drafts.csswg.org/selectors-4/#the-any-link-pseudo>
|
||||
const IN_VISITED_OR_UNVISITED_STATE = IN_VISITED_STATE.bits | IN_UNVISITED_STATE.bits,
|
||||
const IN_VISITED_OR_UNVISITED_STATE = ElementState::IN_VISITED_STATE.bits |
|
||||
ElementState::IN_UNVISITED_STATE.bits;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-drag-over
|
||||
const IN_DRAGOVER_STATE = 1 << 26,
|
||||
const IN_DRAGOVER_STATE = 1 << 26;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-in-range>
|
||||
const IN_INRANGE_STATE = 1 << 27,
|
||||
const IN_INRANGE_STATE = 1 << 27;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-out-of-range>
|
||||
const IN_OUTOFRANGE_STATE = 1 << 28,
|
||||
const IN_OUTOFRANGE_STATE = 1 << 28;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-read-only>
|
||||
const IN_MOZ_READONLY_STATE = 1 << 29,
|
||||
const IN_MOZ_READONLY_STATE = 1 << 29;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-read-write>
|
||||
const IN_MOZ_READWRITE_STATE = 1 << 30,
|
||||
const IN_MOZ_READWRITE_STATE = 1 << 30;
|
||||
/// <https://html.spec.whatwg.org/multipage/#selector-default>
|
||||
const IN_DEFAULT_STATE = 1 << 31,
|
||||
const IN_DEFAULT_STATE = 1 << 31;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-submit-invalid
|
||||
const IN_MOZ_SUBMITINVALID_STATE = 1 << 32,
|
||||
const IN_MOZ_SUBMITINVALID_STATE = 1 << 32;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_OPTIMUM_STATE = 1 << 33,
|
||||
const IN_OPTIMUM_STATE = 1 << 33;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_SUB_OPTIMUM_STATE = 1 << 34,
|
||||
const IN_SUB_OPTIMUM_STATE = 1 << 34;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_SUB_SUB_OPTIMUM_STATE = 1 << 35,
|
||||
const IN_SUB_SUB_OPTIMUM_STATE = 1 << 35;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_DEVTOOLS_HIGHLIGHTED_STATE = 1 << 36,
|
||||
const IN_DEVTOOLS_HIGHLIGHTED_STATE = 1 << 36;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_STYLEEDITOR_TRANSITIONING_STATE = 1 << 37,
|
||||
const IN_STYLEEDITOR_TRANSITIONING_STATE = 1 << 37;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_INCREMENT_SCRIPT_LEVEL_STATE = 1 << 38,
|
||||
const IN_INCREMENT_SCRIPT_LEVEL_STATE = 1 << 38;
|
||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-focusring
|
||||
const IN_FOCUSRING_STATE = 1 << 39,
|
||||
const IN_FOCUSRING_STATE = 1 << 39;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_HANDLER_CLICK_TO_PLAY_STATE = 1 << 40,
|
||||
const IN_HANDLER_CLICK_TO_PLAY_STATE = 1 << 40;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_HANDLER_VULNERABLE_UPDATABLE_STATE = 1 << 41,
|
||||
const IN_HANDLER_VULNERABLE_UPDATABLE_STATE = 1 << 41;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_HANDLER_VULNERABLE_NO_UPDATE_STATE = 1 << 42,
|
||||
const IN_HANDLER_VULNERABLE_NO_UPDATE_STATE = 1 << 42;
|
||||
/// <https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo>
|
||||
const IN_FOCUS_WITHIN_STATE = 1 << 43,
|
||||
const IN_FOCUS_WITHIN_STATE = 1 << 43;
|
||||
/// :dir matching; the states are used for dynamic change detection.
|
||||
/// State that elements that match :dir(ltr) are in.
|
||||
const IN_LTR_STATE = 1 << 44,
|
||||
const IN_LTR_STATE = 1 << 44;
|
||||
/// State that elements that match :dir(rtl) are in.
|
||||
const IN_RTL_STATE = 1 << 45,
|
||||
const IN_RTL_STATE = 1 << 45;
|
||||
/// State that HTML elements that have a "dir" attr are in.
|
||||
const IN_HAS_DIR_ATTR_STATE = 1 << 46,
|
||||
const IN_HAS_DIR_ATTR_STATE = 1 << 46;
|
||||
/// State that HTML elements with dir="ltr" (or something
|
||||
/// case-insensitively equal to "ltr") are in.
|
||||
const IN_HAS_DIR_ATTR_LTR_STATE = 1 << 47,
|
||||
const IN_HAS_DIR_ATTR_LTR_STATE = 1 << 47;
|
||||
/// State that HTML elements with dir="rtl" (or something
|
||||
/// case-insensitively equal to "rtl") are in.
|
||||
const IN_HAS_DIR_ATTR_RTL_STATE = 1 << 48,
|
||||
const IN_HAS_DIR_ATTR_RTL_STATE = 1 << 48;
|
||||
/// State that HTML <bdi> elements without a valid-valued "dir" attr or
|
||||
/// any HTML elements (including <bdi>) with dir="auto" (or something
|
||||
/// case-insensitively equal to "auto") are in.
|
||||
const IN_HAS_DIR_ATTR_LIKE_AUTO_STATE = 1 << 49,
|
||||
const IN_HAS_DIR_ATTR_LIKE_AUTO_STATE = 1 << 49;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_AUTOFILL_STATE = 1 << 50,
|
||||
const IN_AUTOFILL_STATE = 1 << 50;
|
||||
/// Non-standard & undocumented.
|
||||
const IN_AUTOFILL_PREVIEW_STATE = 1 << 51,
|
||||
const IN_AUTOFILL_PREVIEW_STATE = 1 << 51;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,10 +146,10 @@ bitflags! {
|
|||
/// NB: Is important for this to remain in sync with Gecko's
|
||||
/// dom/base/nsIDocument.h.
|
||||
#[derive(MallocSizeOf)]
|
||||
pub flags DocumentState: u64 {
|
||||
pub struct DocumentState: u64 {
|
||||
/// RTL locale: specific to the XUL localedir attribute
|
||||
const NS_DOCUMENT_STATE_RTL_LOCALE = 1 << 0,
|
||||
const NS_DOCUMENT_STATE_RTL_LOCALE = 1 << 0;
|
||||
/// Window activation status
|
||||
const NS_DOCUMENT_STATE_WINDOW_INACTIVE = 1 << 1,
|
||||
const NS_DOCUMENT_STATE_WINDOW_INACTIVE = 1 << 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
|
||||
use cssparser::{ToCss, serialize_identifier};
|
||||
use gecko_bindings::structs::{self, CSSPseudoElementType};
|
||||
use properties::{PropertyFlags, APPLIES_TO_FIRST_LETTER, APPLIES_TO_FIRST_LINE};
|
||||
use properties::APPLIES_TO_PLACEHOLDER;
|
||||
use properties::ComputedValues;
|
||||
use properties::{ComputedValues, PropertyFlags};
|
||||
use properties::longhands::display::computed_value as display;
|
||||
use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl};
|
||||
use std::fmt;
|
||||
|
@ -153,9 +151,9 @@ impl PseudoElement {
|
|||
#[inline]
|
||||
pub fn property_restriction(&self) -> Option<PropertyFlags> {
|
||||
match *self {
|
||||
PseudoElement::FirstLetter => Some(APPLIES_TO_FIRST_LETTER),
|
||||
PseudoElement::FirstLine => Some(APPLIES_TO_FIRST_LINE),
|
||||
PseudoElement::Placeholder => Some(APPLIES_TO_PLACEHOLDER),
|
||||
PseudoElement::FirstLetter => Some(PropertyFlags::APPLIES_TO_FIRST_LETTER),
|
||||
PseudoElement::FirstLine => Some(PropertyFlags::APPLIES_TO_FIRST_LINE),
|
||||
PseudoElement::Placeholder => Some(PropertyFlags::APPLIES_TO_PLACEHOLDER),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! Gecko-specific bits for selector-parsing.
|
||||
|
||||
use cssparser::{BasicParseError, BasicParseErrorKind, Parser, ToCss, Token, CowRcStr, SourceLocation};
|
||||
use element_state::{self, DocumentState, ElementState};
|
||||
use element_state::{DocumentState, ElementState};
|
||||
use gecko_bindings::structs::CSSPseudoClassType;
|
||||
use gecko_bindings::structs::RawServoSelectorList;
|
||||
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||
|
@ -22,11 +22,12 @@ pub use gecko::snapshot::SnapshotMap;
|
|||
|
||||
bitflags! {
|
||||
// See NonTSPseudoClass::is_enabled_in()
|
||||
flags NonTSPseudoClassFlag: u8 {
|
||||
const PSEUDO_CLASS_ENABLED_IN_UA_SHEETS = 1 << 0,
|
||||
const PSEUDO_CLASS_ENABLED_IN_CHROME = 1 << 1,
|
||||
struct NonTSPseudoClassFlag: u8 {
|
||||
const PSEUDO_CLASS_ENABLED_IN_UA_SHEETS = 1 << 0;
|
||||
const PSEUDO_CLASS_ENABLED_IN_CHROME = 1 << 1;
|
||||
const PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME =
|
||||
PSEUDO_CLASS_ENABLED_IN_UA_SHEETS.bits | PSEUDO_CLASS_ENABLED_IN_CHROME.bits,
|
||||
NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS.bits |
|
||||
NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_CHROME.bits;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +135,7 @@ impl NonTSPseudoClass {
|
|||
fn has_any_flag(&self, flags: NonTSPseudoClassFlag) -> bool {
|
||||
macro_rules! check_flag {
|
||||
(_) => (false);
|
||||
($flags:expr) => ($flags.intersects(flags));
|
||||
($flags:ident) => (NonTSPseudoClassFlag::$flags.intersects(flags));
|
||||
}
|
||||
macro_rules! pseudo_class_check_is_enabled_in {
|
||||
(bare: [$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*],
|
||||
|
@ -161,7 +162,7 @@ impl NonTSPseudoClass {
|
|||
unsafe { mozilla::StylePrefs_sUnprefixedFullscreenApiEnabled },
|
||||
// Otherwise, a pseudo-class is enabled in content when it
|
||||
// doesn't have any enabled flag.
|
||||
_ => !self.has_any_flag(PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
||||
_ => !self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,7 +179,7 @@ impl NonTSPseudoClass {
|
|||
pub fn state_flag(&self) -> ElementState {
|
||||
macro_rules! flag {
|
||||
(_) => (ElementState::empty());
|
||||
($state:ident) => (::element_state::$state);
|
||||
($state:ident) => (ElementState::$state);
|
||||
}
|
||||
macro_rules! pseudo_class_state {
|
||||
(bare: [$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*],
|
||||
|
@ -198,8 +199,8 @@ impl NonTSPseudoClass {
|
|||
/// Get the document state flag associated with a pseudo-class, if any.
|
||||
pub fn document_state_flag(&self) -> DocumentState {
|
||||
match *self {
|
||||
NonTSPseudoClass::MozLocaleDir(..) => element_state::NS_DOCUMENT_STATE_RTL_LOCALE,
|
||||
NonTSPseudoClass::MozWindowInactive => element_state::NS_DOCUMENT_STATE_WINDOW_INACTIVE,
|
||||
NonTSPseudoClass::MozLocaleDir(..) => DocumentState::NS_DOCUMENT_STATE_RTL_LOCALE,
|
||||
NonTSPseudoClass::MozWindowInactive => DocumentState::NS_DOCUMENT_STATE_WINDOW_INACTIVE,
|
||||
_ => DocumentState::empty(),
|
||||
}
|
||||
}
|
||||
|
@ -299,9 +300,9 @@ impl<'a> SelectorParser<'a> {
|
|||
-> bool {
|
||||
pseudo_class.is_enabled_in_content() ||
|
||||
(self.in_user_agent_stylesheet() &&
|
||||
pseudo_class.has_any_flag(PSEUDO_CLASS_ENABLED_IN_UA_SHEETS)) ||
|
||||
pseudo_class.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS)) ||
|
||||
(self.in_chrome_stylesheet() &&
|
||||
pseudo_class.has_any_flag(PSEUDO_CLASS_ENABLED_IN_CHROME))
|
||||
pseudo_class.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_CHROME))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ use atomic_refcell::{AtomicRefCell, AtomicRef, AtomicRefMut};
|
|||
use context::{QuirksMode, SharedStyleContext, PostAnimationTasks, UpdateAnimationsTasks};
|
||||
use data::ElementData;
|
||||
use dom::{LayoutIterator, NodeInfo, OpaqueNode, TElement, TDocument, TNode};
|
||||
use element_state::{ElementState, DocumentState, NS_DOCUMENT_STATE_WINDOW_INACTIVE};
|
||||
use element_state::{ElementState, DocumentState};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use font_metrics::{FontMetrics, FontMetricsProvider, FontMetricsQueryResult};
|
||||
use gecko::data::PerDocumentStyleData;
|
||||
|
@ -774,18 +774,17 @@ impl<'le> GeckoElement<'le> {
|
|||
/// it's probably not worth the trouble.
|
||||
fn selector_flags_to_node_flags(flags: ElementSelectorFlags) -> u32 {
|
||||
use gecko_bindings::structs::*;
|
||||
use selectors::matching::*;
|
||||
let mut gecko_flags = 0u32;
|
||||
if flags.contains(HAS_SLOW_SELECTOR) {
|
||||
if flags.contains(ElementSelectorFlags::HAS_SLOW_SELECTOR) {
|
||||
gecko_flags |= NODE_HAS_SLOW_SELECTOR as u32;
|
||||
}
|
||||
if flags.contains(HAS_SLOW_SELECTOR_LATER_SIBLINGS) {
|
||||
if flags.contains(ElementSelectorFlags::HAS_SLOW_SELECTOR_LATER_SIBLINGS) {
|
||||
gecko_flags |= NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS as u32;
|
||||
}
|
||||
if flags.contains(HAS_EDGE_CHILD_SELECTOR) {
|
||||
if flags.contains(ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR) {
|
||||
gecko_flags |= NODE_HAS_EDGE_CHILD_SELECTOR as u32;
|
||||
}
|
||||
if flags.contains(HAS_EMPTY_SELECTOR) {
|
||||
if flags.contains(ElementSelectorFlags::HAS_EMPTY_SELECTOR) {
|
||||
gecko_flags |= NODE_HAS_EMPTY_SELECTOR as u32;
|
||||
}
|
||||
|
||||
|
@ -1147,8 +1146,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
}
|
||||
|
||||
fn is_visited_link(&self) -> bool {
|
||||
use element_state::IN_VISITED_STATE;
|
||||
self.get_state().intersects(IN_VISITED_STATE)
|
||||
self.get_state().intersects(ElementState::IN_VISITED_STATE)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -1259,7 +1257,6 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
/// Process various tasks that are a result of animation-only restyle.
|
||||
fn process_post_animation(&self,
|
||||
tasks: PostAnimationTasks) {
|
||||
use context::DISPLAY_CHANGED_FROM_NONE_FOR_SMIL;
|
||||
use gecko_bindings::structs::nsChangeHint_nsChangeHint_Empty;
|
||||
use gecko_bindings::structs::nsRestyleHint_eRestyle_Subtree;
|
||||
|
||||
|
@ -1269,7 +1266,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
// the descendants in the display:none subtree. Instead of resolving
|
||||
// those styles in animation-only restyle, we defer it to a subsequent
|
||||
// normal restyle.
|
||||
if tasks.intersects(DISPLAY_CHANGED_FROM_NONE_FOR_SMIL) {
|
||||
if tasks.intersects(PostAnimationTasks::DISPLAY_CHANGED_FROM_NONE_FOR_SMIL) {
|
||||
debug_assert!(self.implemented_pseudo_element()
|
||||
.map_or(true, |p| !p.is_before_or_after()),
|
||||
"display property animation shouldn't run on pseudo elements \
|
||||
|
@ -1964,7 +1961,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
NonTSPseudoClass::Link => relevant_link.is_unvisited(self, context),
|
||||
NonTSPseudoClass::Visited => relevant_link.is_visited(self, context),
|
||||
NonTSPseudoClass::MozFirstNode => {
|
||||
flags_setter(self, HAS_EDGE_CHILD_SELECTOR);
|
||||
flags_setter(self, ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR);
|
||||
let mut elem = self.as_node();
|
||||
while let Some(prev) = elem.prev_sibling() {
|
||||
if prev.contains_non_whitespace_content() {
|
||||
|
@ -1975,7 +1972,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
true
|
||||
}
|
||||
NonTSPseudoClass::MozLastNode => {
|
||||
flags_setter(self, HAS_EDGE_CHILD_SELECTOR);
|
||||
flags_setter(self, ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR);
|
||||
let mut elem = self.as_node();
|
||||
while let Some(next) = elem.next_sibling() {
|
||||
if next.contains_non_whitespace_content() {
|
||||
|
@ -1986,7 +1983,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
true
|
||||
}
|
||||
NonTSPseudoClass::MozOnlyWhitespace => {
|
||||
flags_setter(self, HAS_EMPTY_SELECTOR);
|
||||
flags_setter(self, ElementSelectorFlags::HAS_EMPTY_SELECTOR);
|
||||
if self.as_node().dom_children().any(|c| c.contains_non_whitespace_content()) {
|
||||
return false
|
||||
}
|
||||
|
@ -2011,7 +2008,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
self.get_document_theme() == DocumentTheme::Doc_Theme_Dark
|
||||
}
|
||||
NonTSPseudoClass::MozWindowInactive => {
|
||||
self.document_state().contains(NS_DOCUMENT_STATE_WINDOW_INACTIVE)
|
||||
self.document_state().contains(DocumentState::NS_DOCUMENT_STATE_WINDOW_INACTIVE)
|
||||
}
|
||||
NonTSPseudoClass::MozPlaceholder => false,
|
||||
NonTSPseudoClass::MozAny(ref sels) => {
|
||||
|
|
|
@ -13,9 +13,9 @@ use stylesheets::OriginSet;
|
|||
/// Checks that the values for OriginFlags are the ones we expect.
|
||||
pub fn assert_flags_match() {
|
||||
use stylesheets::origin::*;
|
||||
debug_assert_eq!(OriginFlags_UserAgent.0, ORIGIN_USER_AGENT.bits());
|
||||
debug_assert_eq!(OriginFlags_Author.0, ORIGIN_AUTHOR.bits());
|
||||
debug_assert_eq!(OriginFlags_User.0, ORIGIN_USER.bits());
|
||||
debug_assert_eq!(OriginFlags_UserAgent.0, OriginSet::ORIGIN_USER_AGENT.bits());
|
||||
debug_assert_eq!(OriginFlags_Author.0, OriginSet::ORIGIN_AUTHOR.bits());
|
||||
debug_assert_eq!(OriginFlags_User.0, OriginSet::ORIGIN_USER.bits());
|
||||
}
|
||||
|
||||
impl From<OriginFlags> for OriginSet {
|
||||
|
|
|
@ -10,11 +10,11 @@ use atomic_refcell::AtomicRef;
|
|||
use context::{QuirksMode, SharedStyleContext};
|
||||
use data::ElementData;
|
||||
use dom::TElement;
|
||||
use element_state::{ElementState, IN_VISITED_OR_UNVISITED_STATE};
|
||||
use element_state::ElementState;
|
||||
use invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper};
|
||||
use invalidation::element::invalidation_map::*;
|
||||
use invalidation::element::invalidator::{InvalidationVector, Invalidation, InvalidationProcessor};
|
||||
use invalidation::element::restyle_hints::*;
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use selector_map::SelectorMap;
|
||||
use selector_parser::Snapshot;
|
||||
use selectors::NthIndexCache;
|
||||
|
@ -128,7 +128,7 @@ where
|
|||
// force a restyle here. Matching doesn't depend on the actual visited
|
||||
// state at all, so we can't look at matching results to decide what to
|
||||
// do for this case.
|
||||
if state_changes.intersects(IN_VISITED_OR_UNVISITED_STATE) {
|
||||
if state_changes.intersects(ElementState::IN_VISITED_OR_UNVISITED_STATE) {
|
||||
trace!(" > visitedness change, force subtree restyle");
|
||||
// We can't just return here because there may also be attribute
|
||||
// changes as well that imply additional hints.
|
||||
|
@ -215,7 +215,7 @@ where
|
|||
};
|
||||
|
||||
if invalidated_self {
|
||||
self.data.hint.insert(RESTYLE_SELF);
|
||||
self.data.hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
}
|
||||
|
||||
invalidated_self
|
||||
|
@ -224,7 +224,7 @@ where
|
|||
fn should_process_descendants(&mut self, element: E) -> bool {
|
||||
if element == self.element {
|
||||
return !self.data.styles.is_display_none() &&
|
||||
!self.data.hint.contains(RESTYLE_DESCENDANTS)
|
||||
!self.data.hint.contains(RestyleHint::RESTYLE_DESCENDANTS)
|
||||
}
|
||||
|
||||
let data = match element.borrow_data() {
|
||||
|
@ -233,17 +233,17 @@ where
|
|||
};
|
||||
|
||||
!data.styles.is_display_none() &&
|
||||
!data.hint.contains(RESTYLE_DESCENDANTS)
|
||||
!data.hint.contains(RestyleHint::RESTYLE_DESCENDANTS)
|
||||
}
|
||||
|
||||
fn recursion_limit_exceeded(&mut self, element: E) {
|
||||
if element == self.element {
|
||||
self.data.hint.insert(RESTYLE_DESCENDANTS);
|
||||
self.data.hint.insert(RestyleHint::RESTYLE_DESCENDANTS);
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(mut data) = element.mutate_data() {
|
||||
data.hint.insert(RESTYLE_DESCENDANTS);
|
||||
data.hint.insert(RestyleHint::RESTYLE_DESCENDANTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ where
|
|||
fn invalidated_self(&mut self, element: E) {
|
||||
debug_assert_ne!(element, self.element);
|
||||
if let Some(mut data) = element.mutate_data() {
|
||||
data.hint.insert(RESTYLE_SELF);
|
||||
data.hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ where
|
|||
return true;
|
||||
}
|
||||
let visited_dependent =
|
||||
if dependency.state.intersects(IN_VISITED_OR_UNVISITED_STATE) {
|
||||
if dependency.state.intersects(ElementState::IN_VISITED_OR_UNVISITED_STATE) {
|
||||
VisitedDependent::Yes
|
||||
} else {
|
||||
VisitedDependent::No
|
||||
|
|
|
@ -20,16 +20,16 @@ use smallvec::SmallVec;
|
|||
#[cfg(feature = "gecko")]
|
||||
/// Gets the element state relevant to the given `:dir` pseudo-class selector.
|
||||
pub fn dir_selector_to_state(s: &[u16]) -> ElementState {
|
||||
use element_state::{IN_LTR_STATE, IN_RTL_STATE};
|
||||
use element_state::ElementState;
|
||||
|
||||
// Jump through some hoops to deal with our Box<[u16]> thing.
|
||||
const LTR: [u16; 4] = [b'l' as u16, b't' as u16, b'r' as u16, 0];
|
||||
const RTL: [u16; 4] = [b'r' as u16, b't' as u16, b'l' as u16, 0];
|
||||
|
||||
if LTR == *s {
|
||||
IN_LTR_STATE
|
||||
ElementState::IN_LTR_STATE
|
||||
} else if RTL == *s {
|
||||
IN_RTL_STATE
|
||||
ElementState::IN_RTL_STATE
|
||||
} else {
|
||||
// :dir(something-random) is a valid selector, but shouldn't
|
||||
// match anything.
|
||||
|
|
|
@ -10,38 +10,38 @@ use traversal_flags::TraversalFlags;
|
|||
|
||||
bitflags! {
|
||||
/// The kind of restyle we need to do for a given element.
|
||||
pub flags RestyleHint: u8 {
|
||||
pub struct RestyleHint: u8 {
|
||||
/// Do a selector match of the element.
|
||||
const RESTYLE_SELF = 1 << 0,
|
||||
const RESTYLE_SELF = 1 << 0;
|
||||
|
||||
/// Do a selector match of the element's descendants.
|
||||
const RESTYLE_DESCENDANTS = 1 << 1,
|
||||
const RESTYLE_DESCENDANTS = 1 << 1;
|
||||
|
||||
/// Recascade the current element.
|
||||
const RECASCADE_SELF = 1 << 2,
|
||||
const RECASCADE_SELF = 1 << 2;
|
||||
|
||||
/// Recascade all descendant elements.
|
||||
const RECASCADE_DESCENDANTS = 1 << 3,
|
||||
const RECASCADE_DESCENDANTS = 1 << 3;
|
||||
|
||||
/// Replace the style data coming from CSS transitions without updating
|
||||
/// any other style data. This hint is only processed in animation-only
|
||||
/// traversal which is prior to normal traversal.
|
||||
const RESTYLE_CSS_TRANSITIONS = 1 << 4,
|
||||
const RESTYLE_CSS_TRANSITIONS = 1 << 4;
|
||||
|
||||
/// Replace the style data coming from CSS animations without updating
|
||||
/// any other style data. This hint is only processed in animation-only
|
||||
/// traversal which is prior to normal traversal.
|
||||
const RESTYLE_CSS_ANIMATIONS = 1 << 5,
|
||||
const RESTYLE_CSS_ANIMATIONS = 1 << 5;
|
||||
|
||||
/// Don't re-run selector-matching on the element, only the style
|
||||
/// attribute has changed, and this change didn't have any other
|
||||
/// dependencies.
|
||||
const RESTYLE_STYLE_ATTRIBUTE = 1 << 6,
|
||||
const RESTYLE_STYLE_ATTRIBUTE = 1 << 6;
|
||||
|
||||
/// Replace the style data coming from SMIL animations without updating
|
||||
/// any other style data. This hint is only processed in animation-only
|
||||
/// traversal which is prior to normal traversal.
|
||||
const RESTYLE_SMIL = 1 << 7,
|
||||
const RESTYLE_SMIL = 1 << 7;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,26 +49,26 @@ impl RestyleHint {
|
|||
/// Creates a new `RestyleHint` indicating that the current element and all
|
||||
/// its descendants must be fully restyled.
|
||||
pub fn restyle_subtree() -> Self {
|
||||
RESTYLE_SELF | RESTYLE_DESCENDANTS
|
||||
RestyleHint::RESTYLE_SELF | RestyleHint::RESTYLE_DESCENDANTS
|
||||
}
|
||||
|
||||
/// Creates a new `RestyleHint` indicating that the current element and all
|
||||
/// its descendants must be recascaded.
|
||||
pub fn recascade_subtree() -> Self {
|
||||
RECASCADE_SELF | RECASCADE_DESCENDANTS
|
||||
RestyleHint::RECASCADE_SELF | RestyleHint::RECASCADE_DESCENDANTS
|
||||
}
|
||||
|
||||
/// Returns whether this hint invalidates the element and all its
|
||||
/// descendants.
|
||||
pub fn contains_subtree(&self) -> bool {
|
||||
self.contains(RESTYLE_SELF | RESTYLE_DESCENDANTS)
|
||||
self.contains(RestyleHint::RESTYLE_SELF | RestyleHint::RESTYLE_DESCENDANTS)
|
||||
}
|
||||
|
||||
/// Returns whether we need to restyle this element.
|
||||
pub fn has_non_animation_invalidations(&self) -> bool {
|
||||
self.intersects(
|
||||
RESTYLE_SELF |
|
||||
RECASCADE_SELF |
|
||||
RestyleHint::RESTYLE_SELF |
|
||||
RestyleHint::RECASCADE_SELF |
|
||||
(Self::replacements() & !Self::for_animations())
|
||||
)
|
||||
}
|
||||
|
@ -96,10 +96,10 @@ impl RestyleHint {
|
|||
/// Returns a new `CascadeHint` appropriate for children of the current
|
||||
/// element.
|
||||
fn propagate_for_non_animation_restyle(&self) -> Self {
|
||||
if self.contains(RESTYLE_DESCENDANTS) {
|
||||
if self.contains(RestyleHint::RESTYLE_DESCENDANTS) {
|
||||
return Self::restyle_subtree()
|
||||
}
|
||||
if self.contains(RECASCADE_DESCENDANTS) {
|
||||
if self.contains(RestyleHint::RECASCADE_DESCENDANTS) {
|
||||
return Self::recascade_subtree()
|
||||
}
|
||||
Self::empty()
|
||||
|
@ -108,24 +108,24 @@ impl RestyleHint {
|
|||
/// Creates a new `RestyleHint` that indicates the element must be
|
||||
/// recascaded.
|
||||
pub fn recascade_self() -> Self {
|
||||
RECASCADE_SELF
|
||||
RestyleHint::RECASCADE_SELF
|
||||
}
|
||||
|
||||
/// Returns a hint that contains all the replacement hints.
|
||||
pub fn replacements() -> Self {
|
||||
RESTYLE_STYLE_ATTRIBUTE | Self::for_animations()
|
||||
RestyleHint::RESTYLE_STYLE_ATTRIBUTE | Self::for_animations()
|
||||
}
|
||||
|
||||
/// The replacements for the animation cascade levels.
|
||||
#[inline]
|
||||
pub fn for_animations() -> Self {
|
||||
RESTYLE_SMIL | RESTYLE_CSS_ANIMATIONS | RESTYLE_CSS_TRANSITIONS
|
||||
RestyleHint::RESTYLE_SMIL | RestyleHint::RESTYLE_CSS_ANIMATIONS | RestyleHint::RESTYLE_CSS_TRANSITIONS
|
||||
}
|
||||
|
||||
/// Returns whether the hint specifies that the currently element must be
|
||||
/// recascaded.
|
||||
pub fn has_recascade_self(&self) -> bool {
|
||||
self.contains(RECASCADE_SELF)
|
||||
self.contains(RestyleHint::RECASCADE_SELF)
|
||||
}
|
||||
|
||||
/// Returns whether the hint specifies that an animation cascade level must
|
||||
|
@ -139,7 +139,7 @@ impl RestyleHint {
|
|||
/// be replaced.
|
||||
#[inline]
|
||||
pub fn has_animation_hint_or_recascade(&self) -> bool {
|
||||
self.intersects(Self::for_animations() | RECASCADE_SELF)
|
||||
self.intersects(Self::for_animations() | RestyleHint::RECASCADE_SELF)
|
||||
}
|
||||
|
||||
/// Returns whether the hint specifies some restyle work other than an
|
||||
|
@ -153,7 +153,7 @@ impl RestyleHint {
|
|||
/// for the element.
|
||||
#[inline]
|
||||
pub fn match_self(&self) -> bool {
|
||||
self.intersects(RESTYLE_SELF)
|
||||
self.intersects(RestyleHint::RESTYLE_SELF)
|
||||
}
|
||||
|
||||
/// Returns whether the hint specifies that some cascade levels must be
|
||||
|
@ -177,7 +177,7 @@ impl RestyleHint {
|
|||
// normal restyle. (We could have separate RECASCADE_SELF_NORMAL and
|
||||
// RECASCADE_SELF_ANIMATIONS flags to make it clear, but this isn't
|
||||
// currently necessary.)
|
||||
self.remove(RECASCADE_SELF);
|
||||
self.remove(RestyleHint::RECASCADE_SELF);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,23 +204,23 @@ impl From<nsRestyleHint> for RestyleHint {
|
|||
|
||||
if (raw.0 & (eRestyle_Self.0 | eRestyle_Subtree.0)) != 0 {
|
||||
raw.0 &= !eRestyle_Self.0;
|
||||
hint.insert(RESTYLE_SELF);
|
||||
hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
}
|
||||
|
||||
if (raw.0 & (eRestyle_Subtree.0 | eRestyle_SomeDescendants.0)) != 0 {
|
||||
raw.0 &= !eRestyle_Subtree.0;
|
||||
raw.0 &= !eRestyle_SomeDescendants.0;
|
||||
hint.insert(RESTYLE_DESCENDANTS);
|
||||
hint.insert(RestyleHint::RESTYLE_DESCENDANTS);
|
||||
}
|
||||
|
||||
if (raw.0 & (eRestyle_ForceDescendants.0 | eRestyle_Force.0)) != 0 {
|
||||
raw.0 &= !eRestyle_Force.0;
|
||||
hint.insert(RECASCADE_SELF);
|
||||
hint.insert(RestyleHint::RECASCADE_SELF);
|
||||
}
|
||||
|
||||
if (raw.0 & eRestyle_ForceDescendants.0) != 0 {
|
||||
raw.0 &= !eRestyle_ForceDescendants.0;
|
||||
hint.insert(RECASCADE_DESCENDANTS);
|
||||
hint.insert(RestyleHint::RECASCADE_DESCENDANTS);
|
||||
}
|
||||
|
||||
hint.insert(RestyleHint::from_bits_truncate(raw.0 as u8));
|
||||
|
@ -239,7 +239,7 @@ pub fn assert_restyle_hints_match() {
|
|||
use gecko_bindings::structs;
|
||||
|
||||
macro_rules! check_restyle_hints {
|
||||
( $( $a:ident => $b:ident ),*, ) => {
|
||||
( $( $a:ident => $b:path),*, ) => {
|
||||
if cfg!(debug_assertions) {
|
||||
let mut replacements = RestyleHint::replacements();
|
||||
$(
|
||||
|
@ -254,9 +254,9 @@ pub fn assert_restyle_hints_match() {
|
|||
}
|
||||
|
||||
check_restyle_hints! {
|
||||
nsRestyleHint_eRestyle_CSSTransitions => RESTYLE_CSS_TRANSITIONS,
|
||||
nsRestyleHint_eRestyle_CSSAnimations => RESTYLE_CSS_ANIMATIONS,
|
||||
nsRestyleHint_eRestyle_StyleAttribute => RESTYLE_STYLE_ATTRIBUTE,
|
||||
nsRestyleHint_eRestyle_StyleAttribute_Animations => RESTYLE_SMIL,
|
||||
nsRestyleHint_eRestyle_CSSTransitions => RestyleHint::RESTYLE_CSS_TRANSITIONS,
|
||||
nsRestyleHint_eRestyle_CSSAnimations => RestyleHint::RESTYLE_CSS_ANIMATIONS,
|
||||
nsRestyleHint_eRestyle_StyleAttribute => RestyleHint::RESTYLE_STYLE_ATTRIBUTE,
|
||||
nsRestyleHint_eRestyle_StyleAttribute_Animations => RestyleHint::RESTYLE_SMIL,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use Atom;
|
|||
use LocalName as SelectorLocalName;
|
||||
use dom::{TElement, TNode};
|
||||
use fnv::FnvHashSet;
|
||||
use invalidation::element::restyle_hints::{RESTYLE_SELF, RestyleHint};
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use media_queries::Device;
|
||||
use selector_parser::SelectorImpl;
|
||||
use selectors::attr::CaseSensitivity;
|
||||
|
@ -223,12 +223,12 @@ impl StylesheetInvalidationSet {
|
|||
|
||||
let mut self_invalid = false;
|
||||
|
||||
if !data.hint.contains(RESTYLE_SELF) {
|
||||
if !data.hint.contains(RestyleHint::RESTYLE_SELF) {
|
||||
for invalidation in &self.invalid_elements {
|
||||
if invalidation.matches(element) {
|
||||
debug!("process_invalidations_in_subtree: {:?} matched self {:?}",
|
||||
element, invalidation);
|
||||
data.hint.insert(RESTYLE_SELF);
|
||||
data.hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
self_invalid = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -25,51 +25,51 @@ pub enum InlineBaseDirection {
|
|||
// TODO: improve the readability of the WritingMode serialization, refer to the Debug:fmt()
|
||||
bitflags!(
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf, Serialize))]
|
||||
pub flags WritingMode: u8 {
|
||||
const FLAG_RTL = 1 << 0,
|
||||
const FLAG_VERTICAL = 1 << 1,
|
||||
const FLAG_VERTICAL_LR = 1 << 2,
|
||||
pub struct WritingMode: u8 {
|
||||
const RTL = 1 << 0;
|
||||
const VERTICAL = 1 << 1;
|
||||
const VERTICAL_LR = 1 << 2;
|
||||
/// For vertical writing modes only. When set, line-over/line-under
|
||||
/// sides are inverted from block-start/block-end. This flag is
|
||||
/// set when sideways-lr is used.
|
||||
const FLAG_LINE_INVERTED = 1 << 3,
|
||||
const FLAG_SIDEWAYS = 1 << 4,
|
||||
const FLAG_UPRIGHT = 1 << 5,
|
||||
const LINE_INVERTED = 1 << 3;
|
||||
const SIDEWAYS = 1 << 4;
|
||||
const UPRIGHT = 1 << 5;
|
||||
}
|
||||
);
|
||||
|
||||
impl WritingMode {
|
||||
#[inline]
|
||||
pub fn is_vertical(&self) -> bool {
|
||||
self.intersects(FLAG_VERTICAL)
|
||||
self.intersects(WritingMode::VERTICAL)
|
||||
}
|
||||
|
||||
/// Assuming .is_vertical(), does the block direction go left to right?
|
||||
#[inline]
|
||||
pub fn is_vertical_lr(&self) -> bool {
|
||||
self.intersects(FLAG_VERTICAL_LR)
|
||||
self.intersects(WritingMode::VERTICAL_LR)
|
||||
}
|
||||
|
||||
/// Assuming .is_vertical(), does the inline direction go top to bottom?
|
||||
#[inline]
|
||||
pub fn is_inline_tb(&self) -> bool {
|
||||
// https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical
|
||||
self.intersects(FLAG_RTL) == self.intersects(FLAG_LINE_INVERTED)
|
||||
self.intersects(WritingMode::RTL) == self.intersects(WritingMode::LINE_INVERTED)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_bidi_ltr(&self) -> bool {
|
||||
!self.intersects(FLAG_RTL)
|
||||
!self.intersects(WritingMode::RTL)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_sideways(&self) -> bool {
|
||||
self.intersects(FLAG_SIDEWAYS)
|
||||
self.intersects(WritingMode::SIDEWAYS)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_upright(&self) -> bool {
|
||||
self.intersects(FLAG_UPRIGHT)
|
||||
self.intersects(WritingMode::UPRIGHT)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -121,7 +121,7 @@ impl WritingMode {
|
|||
|
||||
#[inline]
|
||||
pub fn inline_base_direction(&self) -> InlineBaseDirection {
|
||||
if self.intersects(FLAG_RTL) {
|
||||
if self.intersects(WritingMode::RTL) {
|
||||
InlineBaseDirection::RightToLeft
|
||||
} else {
|
||||
InlineBaseDirection::LeftToRight
|
||||
|
@ -150,10 +150,10 @@ impl fmt::Display for WritingMode {
|
|||
} else {
|
||||
write!(formatter, " RL")?;
|
||||
}
|
||||
if self.intersects(FLAG_SIDEWAYS) {
|
||||
if self.intersects(WritingMode::SIDEWAYS) {
|
||||
write!(formatter, " Sideways")?;
|
||||
}
|
||||
if self.intersects(FLAG_LINE_INVERTED) {
|
||||
if self.intersects(WritingMode::LINE_INVERTED) {
|
||||
write!(formatter, " Inverted")?;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -11,8 +11,6 @@ use context::{ElementCascadeInputs, QuirksMode, SelectorFlagsMap};
|
|||
use context::{SharedStyleContext, StyleContext};
|
||||
use data::ElementData;
|
||||
use dom::TElement;
|
||||
use invalidation::element::restyle_hints::{RESTYLE_CSS_ANIMATIONS, RESTYLE_CSS_TRANSITIONS};
|
||||
use invalidation::element::restyle_hints::{RESTYLE_SMIL, RESTYLE_STYLE_ATTRIBUTE};
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use properties::ComputedValues;
|
||||
use rule_tree::{CascadeLevel, StrongRuleNode};
|
||||
|
@ -20,7 +18,7 @@ use selector_parser::{PseudoElement, RestyleDamage};
|
|||
use selectors::matching::ElementSelectorFlags;
|
||||
use servo_arc::{Arc, ArcBorrow};
|
||||
use style_resolver::ResolvedElementStyles;
|
||||
use traversal_flags;
|
||||
use traversal_flags::TraversalFlags;
|
||||
|
||||
/// Represents the result of comparing an element's old and new style.
|
||||
#[derive(Debug)]
|
||||
|
@ -161,7 +159,7 @@ trait PrivateMatchMethods: TElement {
|
|||
// animation is running or not.
|
||||
// TODO: We should check which @keyframes changed/added/deleted
|
||||
// and update only animations corresponding to those @keyframes.
|
||||
(context.shared.traversal_flags.contains(traversal_flags::ForCSSRuleChanges) &&
|
||||
(context.shared.traversal_flags.contains(TraversalFlags::ForCSSRuleChanges) &&
|
||||
(has_new_animation_style || has_animations)) ||
|
||||
!old_box_style.animations_equals(new_box_style) ||
|
||||
(old_display_style == display::T::none &&
|
||||
|
@ -183,10 +181,10 @@ trait PrivateMatchMethods: TElement {
|
|||
new_values: &ComputedValues,
|
||||
restyle_hints: RestyleHint
|
||||
) {
|
||||
use context::DISPLAY_CHANGED_FROM_NONE_FOR_SMIL;
|
||||
use context::PostAnimationTasks;
|
||||
use properties::longhands::display::computed_value as display;
|
||||
|
||||
if !restyle_hints.intersects(RESTYLE_SMIL) {
|
||||
if !restyle_hints.intersects(RestyleHint::RESTYLE_SMIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -206,7 +204,7 @@ trait PrivateMatchMethods: TElement {
|
|||
// restyle).
|
||||
let task = ::context::SequentialTask::process_post_animation(
|
||||
*self,
|
||||
DISPLAY_CHANGED_FROM_NONE_FOR_SMIL,
|
||||
PostAnimationTasks::DISPLAY_CHANGED_FROM_NONE_FOR_SMIL,
|
||||
);
|
||||
context.thread_local.tasks.push(task);
|
||||
}
|
||||
|
@ -219,7 +217,6 @@ trait PrivateMatchMethods: TElement {
|
|||
new_values: &mut Arc<ComputedValues>,
|
||||
restyle_hint: RestyleHint,
|
||||
important_rules_changed: bool) {
|
||||
use context::{CASCADE_RESULTS, CSS_ANIMATIONS, CSS_TRANSITIONS, EFFECT_PROPERTIES};
|
||||
use context::UpdateAnimationsTasks;
|
||||
|
||||
if context.shared.traversal_flags.for_animation_only() {
|
||||
|
@ -237,7 +234,7 @@ trait PrivateMatchMethods: TElement {
|
|||
|
||||
let mut tasks = UpdateAnimationsTasks::empty();
|
||||
if self.needs_animations_update(context, old_values.as_ref(), new_values) {
|
||||
tasks.insert(CSS_ANIMATIONS);
|
||||
tasks.insert(UpdateAnimationsTasks::CSS_ANIMATIONS);
|
||||
}
|
||||
|
||||
let before_change_style = if self.might_need_transitions_update(old_values.as_ref().map(|s| &**s),
|
||||
|
@ -265,7 +262,7 @@ trait PrivateMatchMethods: TElement {
|
|||
if let Some(values_without_transitions) = after_change_style {
|
||||
*new_values = values_without_transitions;
|
||||
}
|
||||
tasks.insert(CSS_TRANSITIONS);
|
||||
tasks.insert(UpdateAnimationsTasks::CSS_TRANSITIONS);
|
||||
|
||||
// We need to clone old_values into SequentialTask, so we can use it later.
|
||||
old_values.clone()
|
||||
|
@ -277,9 +274,9 @@ trait PrivateMatchMethods: TElement {
|
|||
};
|
||||
|
||||
if self.has_animations() {
|
||||
tasks.insert(EFFECT_PROPERTIES);
|
||||
tasks.insert(UpdateAnimationsTasks::EFFECT_PROPERTIES);
|
||||
if important_rules_changed {
|
||||
tasks.insert(CASCADE_RESULTS);
|
||||
tasks.insert(UpdateAnimationsTasks::CASCADE_RESULTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -345,7 +342,7 @@ trait PrivateMatchMethods: TElement {
|
|||
debug!("accumulate_damage_for: {:?}", self);
|
||||
|
||||
// Don't accumulate damage if we're in a forgetful traversal.
|
||||
if shared_context.traversal_flags.contains(traversal_flags::Forgetful) {
|
||||
if shared_context.traversal_flags.contains(TraversalFlags::Forgetful) {
|
||||
debug!(" > forgetful traversal");
|
||||
return ChildCascadeRequirement::MustCascadeChildren;
|
||||
}
|
||||
|
@ -401,7 +398,7 @@ trait PrivateMatchMethods: TElement {
|
|||
// seems not common enough to care about.
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
use values::specified::align;
|
||||
use values::specified::align::AlignFlags;
|
||||
|
||||
let old_justify_items =
|
||||
old_values.get_position().clone_justify_items();
|
||||
|
@ -409,10 +406,10 @@ trait PrivateMatchMethods: TElement {
|
|||
new_values.get_position().clone_justify_items();
|
||||
|
||||
let was_legacy_justify_items =
|
||||
old_justify_items.computed.0.contains(align::ALIGN_LEGACY);
|
||||
old_justify_items.computed.0.contains(AlignFlags::LEGACY);
|
||||
|
||||
let is_legacy_justify_items =
|
||||
new_justify_items.computed.0.contains(align::ALIGN_LEGACY);
|
||||
new_justify_items.computed.0.contains(AlignFlags::LEGACY);
|
||||
|
||||
if is_legacy_justify_items != was_legacy_justify_items {
|
||||
return ChildCascadeRequirement::MustCascadeChildren;
|
||||
|
@ -584,7 +581,7 @@ pub trait MatchMethods : TElement {
|
|||
}
|
||||
|
||||
// Don't accumulate damage if we're in a forgetful traversal.
|
||||
if context.shared.traversal_flags.contains(traversal_flags::Forgetful) {
|
||||
if context.shared.traversal_flags.contains(TraversalFlags::Forgetful) {
|
||||
return ChildCascadeRequirement::MustCascadeChildren;
|
||||
}
|
||||
|
||||
|
@ -768,7 +765,7 @@ pub trait MatchMethods : TElement {
|
|||
|
||||
if !context.shared.traversal_flags.for_animation_only() {
|
||||
let mut result = false;
|
||||
if replacements.contains(RESTYLE_STYLE_ATTRIBUTE) {
|
||||
if replacements.contains(RestyleHint::RESTYLE_STYLE_ATTRIBUTE) {
|
||||
let style_attribute = self.style_attribute();
|
||||
result |= replace_rule_node(CascadeLevel::StyleAttributeNormal,
|
||||
style_attribute,
|
||||
|
@ -790,7 +787,7 @@ pub trait MatchMethods : TElement {
|
|||
if replacements.intersects(RestyleHint::for_animations()) {
|
||||
debug_assert!(context.shared.traversal_flags.for_animation_only());
|
||||
|
||||
if replacements.contains(RESTYLE_SMIL) {
|
||||
if replacements.contains(RestyleHint::RESTYLE_SMIL) {
|
||||
replace_rule_node(CascadeLevel::SMILOverride,
|
||||
self.get_smil_override(),
|
||||
primary_rules);
|
||||
|
@ -806,12 +803,12 @@ pub trait MatchMethods : TElement {
|
|||
|
||||
// Apply Transition rules and Animation rules if the corresponding restyle hint
|
||||
// is contained.
|
||||
if replacements.contains(RESTYLE_CSS_TRANSITIONS) {
|
||||
if replacements.contains(RestyleHint::RESTYLE_CSS_TRANSITIONS) {
|
||||
replace_rule_node_for_animation(CascadeLevel::Transitions,
|
||||
primary_rules);
|
||||
}
|
||||
|
||||
if replacements.contains(RESTYLE_CSS_ANIMATIONS) {
|
||||
if replacements.contains(RestyleHint::RESTYLE_CSS_ANIMATIONS) {
|
||||
replace_rule_node_for_animation(CascadeLevel::Animations,
|
||||
primary_rules);
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ use context::QuirksMode;
|
|||
use cssparser::{Parser, SourceLocation, UnicodeRange};
|
||||
use error_reporting::{ParseErrorReporter, ContextualParseError};
|
||||
use style_traits::{OneOrMoreSeparated, ParseError, ParsingMode, Separator};
|
||||
#[cfg(feature = "gecko")]
|
||||
use style_traits::{PARSING_MODE_DEFAULT, PARSING_MODE_ALLOW_UNITLESS_LENGTH, PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES};
|
||||
use stylesheets::{CssRuleType, Origin, UrlExtraData, Namespaces};
|
||||
|
||||
/// Asserts that all ParsingMode flags have a matching ParsingMode value in gecko.
|
||||
|
@ -19,7 +17,7 @@ pub fn assert_parsing_mode_match() {
|
|||
use gecko_bindings::structs;
|
||||
|
||||
macro_rules! check_parsing_modes {
|
||||
( $( $a:ident => $b:ident ),*, ) => {
|
||||
( $( $a:ident => $b:path ),*, ) => {
|
||||
if cfg!(debug_assertions) {
|
||||
let mut modes = ParsingMode::all();
|
||||
$(
|
||||
|
@ -32,9 +30,9 @@ pub fn assert_parsing_mode_match() {
|
|||
}
|
||||
|
||||
check_parsing_modes! {
|
||||
ParsingMode_Default => PARSING_MODE_DEFAULT,
|
||||
ParsingMode_AllowUnitlessLength => PARSING_MODE_ALLOW_UNITLESS_LENGTH,
|
||||
ParsingMode_AllowAllNumericValues => PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES,
|
||||
ParsingMode_Default => ParsingMode::DEFAULT,
|
||||
ParsingMode_AllowUnitlessLength => ParsingMode::ALLOW_UNITLESS_LENGTH,
|
||||
ParsingMode_AllowAllNumericValues => ParsingMode::ALLOW_ALL_NUMERIC_VALUES,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ bitflags! {
|
|||
/// anonymous boxes, see StyleBuilder::for_inheritance and its callsites.
|
||||
/// If we ever want to add some flags that shouldn't inherit for them,
|
||||
/// we might want to add a function to handle this.
|
||||
pub flags ComputedValueFlags: u16 {
|
||||
pub struct ComputedValueFlags: u16 {
|
||||
/// Whether the style or any of the ancestors has a text-decoration-line
|
||||
/// property that should get propagated to descendants.
|
||||
///
|
||||
/// text-decoration-line is a reset property, but gets propagated in the
|
||||
/// frame/box tree.
|
||||
const HAS_TEXT_DECORATION_LINES = 1 << 0,
|
||||
const HAS_TEXT_DECORATION_LINES = 1 << 0;
|
||||
|
||||
/// Whether line break inside should be suppressed.
|
||||
///
|
||||
|
@ -27,41 +27,41 @@ bitflags! {
|
|||
///
|
||||
/// This bit is propagated to all children of line participants.
|
||||
/// It is currently used by ruby to make its content unbreakable.
|
||||
const SHOULD_SUPPRESS_LINEBREAK = 1 << 1,
|
||||
const SHOULD_SUPPRESS_LINEBREAK = 1 << 1;
|
||||
|
||||
/// A flag used to mark text that that has text-combine-upright.
|
||||
///
|
||||
/// This is used from Gecko's layout engine.
|
||||
const IS_TEXT_COMBINED = 1 << 2,
|
||||
const IS_TEXT_COMBINED = 1 << 2;
|
||||
|
||||
/// A flag used to mark styles under a relevant link that is also
|
||||
/// visited.
|
||||
const IS_RELEVANT_LINK_VISITED = 1 << 3,
|
||||
const IS_RELEVANT_LINK_VISITED = 1 << 3;
|
||||
|
||||
/// A flag used to mark styles which are a pseudo-element or under one.
|
||||
const IS_IN_PSEUDO_ELEMENT_SUBTREE = 1 << 4,
|
||||
const IS_IN_PSEUDO_ELEMENT_SUBTREE = 1 << 4;
|
||||
|
||||
/// A flag used to mark styles which are in a display: none subtree, or
|
||||
/// under one.
|
||||
const IS_IN_DISPLAY_NONE_SUBTREE = 1 << 5,
|
||||
const IS_IN_DISPLAY_NONE_SUBTREE = 1 << 5;
|
||||
|
||||
/// Whether this style inherits the `display` property.
|
||||
///
|
||||
/// This is important because it may affect our optimizations to avoid
|
||||
/// computing the style of pseudo-elements, given whether the
|
||||
/// pseudo-element is generated depends on the `display` value.
|
||||
const INHERITS_DISPLAY = 1 << 6,
|
||||
const INHERITS_DISPLAY = 1 << 6;
|
||||
|
||||
/// Whether this style inherits the `content` property.
|
||||
///
|
||||
/// Important because of the same reason.
|
||||
const INHERITS_CONTENT = 1 << 7,
|
||||
const INHERITS_CONTENT = 1 << 7;
|
||||
|
||||
/// Whether the child explicitly inherits any reset property.
|
||||
const INHERITS_RESET_STYLE = 1 << 8,
|
||||
const INHERITS_RESET_STYLE = 1 << 8;
|
||||
|
||||
/// A flag to mark a style which is a visited style.
|
||||
const IS_STYLE_IF_VISITED = 1 << 9,
|
||||
const IS_STYLE_IF_VISITED = 1 << 9;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,8 @@ impl ComputedValueFlags {
|
|||
/// Returns the flags that are inherited.
|
||||
#[inline]
|
||||
pub fn inherited(self) -> Self {
|
||||
self & !(INHERITS_DISPLAY | INHERITS_CONTENT | INHERITS_RESET_STYLE)
|
||||
self & !(ComputedValueFlags::INHERITS_DISPLAY |
|
||||
ComputedValueFlags::INHERITS_CONTENT |
|
||||
ComputedValueFlags::INHERITS_RESET_STYLE)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use smallvec::SmallVec;
|
|||
use std::fmt;
|
||||
use std::iter::{DoubleEndedIterator, Zip};
|
||||
use std::slice::Iter;
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError, ParsingMode, StyleParseErrorKind};
|
||||
use style_traits::{ToCss, ParseError, ParsingMode, StyleParseErrorKind};
|
||||
use stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
use super::*;
|
||||
use values::computed::Context;
|
||||
|
@ -853,7 +853,7 @@ impl ToCss for PropertyDeclarationBlock {
|
|||
// Substeps 7 and 8
|
||||
// We need to check the shorthand whether it's an alias property or not.
|
||||
// If it's an alias property, it should be serialized like its longhand.
|
||||
if shorthand.flags().contains(SHORTHAND_ALIAS_PROPERTY) {
|
||||
if shorthand.flags().contains(PropertyFlags::SHORTHAND_ALIAS_PROPERTY) {
|
||||
append_serialization::<_, Cloned<slice::Iter< _>>, _>(
|
||||
dest,
|
||||
&property,
|
||||
|
@ -1023,7 +1023,7 @@ pub fn parse_style_attribute<R>(input: &str,
|
|||
let context = ParserContext::new(Origin::Author,
|
||||
url_data,
|
||||
Some(CssRuleType::Style),
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
quirks_mode);
|
||||
let error_context = ParserErrorContext { error_reporter: error_reporter };
|
||||
let mut input = ParserInput::new(input);
|
||||
|
|
|
@ -1539,7 +1539,7 @@ fn static_assert() {
|
|||
}
|
||||
|
||||
pub fn set_computed_justify_items(&mut self, v: values::specified::JustifyItems) {
|
||||
debug_assert!(v.0 != ::values::specified::align::ALIGN_AUTO);
|
||||
debug_assert!(v.0 != ::values::specified::align::AlignFlags::AUTO);
|
||||
self.gecko.mJustifyItems = v.into();
|
||||
}
|
||||
|
||||
|
@ -3412,20 +3412,20 @@ fn static_assert() {
|
|||
use properties::longhands::will_change::computed_value::T;
|
||||
|
||||
fn will_change_bitfield_from_prop_flags(prop: &LonghandId) -> u8 {
|
||||
use properties::{ABSPOS_CB, CREATES_STACKING_CONTEXT, FIXPOS_CB};
|
||||
use properties::PropertyFlags;
|
||||
use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_ABSPOS_CB;
|
||||
use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_FIXPOS_CB;
|
||||
use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_STACKING_CONTEXT;
|
||||
let servo_flags = prop.flags();
|
||||
let mut bitfield = 0;
|
||||
|
||||
if servo_flags.contains(CREATES_STACKING_CONTEXT) {
|
||||
if servo_flags.contains(PropertyFlags::CREATES_STACKING_CONTEXT) {
|
||||
bitfield |= NS_STYLE_WILL_CHANGE_STACKING_CONTEXT;
|
||||
}
|
||||
if servo_flags.contains(FIXPOS_CB) {
|
||||
if servo_flags.contains(PropertyFlags::FIXPOS_CB) {
|
||||
bitfield |= NS_STYLE_WILL_CHANGE_FIXPOS_CB;
|
||||
}
|
||||
if servo_flags.contains(ABSPOS_CB) {
|
||||
if servo_flags.contains(PropertyFlags::ABSPOS_CB) {
|
||||
bitfield |= NS_STYLE_WILL_CHANGE_ABSPOS_CB;
|
||||
}
|
||||
|
||||
|
@ -3518,26 +3518,26 @@ fn static_assert() {
|
|||
use gecko_bindings::structs::NS_STYLE_CONTAIN_STYLE;
|
||||
use gecko_bindings::structs::NS_STYLE_CONTAIN_PAINT;
|
||||
use gecko_bindings::structs::NS_STYLE_CONTAIN_ALL_BITS;
|
||||
use properties::longhands::contain;
|
||||
use properties::longhands::contain::SpecifiedValue;
|
||||
|
||||
if v.is_empty() {
|
||||
self.gecko.mContain = NS_STYLE_CONTAIN_NONE as u8;
|
||||
return;
|
||||
}
|
||||
|
||||
if v.contains(contain::STRICT) {
|
||||
if v.contains(SpecifiedValue::STRICT) {
|
||||
self.gecko.mContain = (NS_STYLE_CONTAIN_STRICT | NS_STYLE_CONTAIN_ALL_BITS) as u8;
|
||||
return;
|
||||
}
|
||||
|
||||
let mut bitfield = 0;
|
||||
if v.contains(contain::LAYOUT) {
|
||||
if v.contains(SpecifiedValue::LAYOUT) {
|
||||
bitfield |= NS_STYLE_CONTAIN_LAYOUT;
|
||||
}
|
||||
if v.contains(contain::STYLE) {
|
||||
if v.contains(SpecifiedValue::STYLE) {
|
||||
bitfield |= NS_STYLE_CONTAIN_STYLE;
|
||||
}
|
||||
if v.contains(contain::PAINT) {
|
||||
if v.contains(SpecifiedValue::PAINT) {
|
||||
bitfield |= NS_STYLE_CONTAIN_PAINT;
|
||||
}
|
||||
|
||||
|
@ -3550,25 +3550,25 @@ fn static_assert() {
|
|||
use gecko_bindings::structs::NS_STYLE_CONTAIN_STYLE;
|
||||
use gecko_bindings::structs::NS_STYLE_CONTAIN_PAINT;
|
||||
use gecko_bindings::structs::NS_STYLE_CONTAIN_ALL_BITS;
|
||||
use properties::longhands::contain;
|
||||
use properties::longhands::contain::{self, SpecifiedValue};
|
||||
|
||||
let mut servo_flags = contain::computed_value::T::empty();
|
||||
let gecko_flags = self.gecko.mContain;
|
||||
|
||||
if gecko_flags & (NS_STYLE_CONTAIN_STRICT as u8) != 0 &&
|
||||
gecko_flags & (NS_STYLE_CONTAIN_ALL_BITS as u8) != 0 {
|
||||
servo_flags.insert(contain::STRICT | contain::STRICT_BITS);
|
||||
servo_flags.insert(SpecifiedValue::STRICT | SpecifiedValue::STRICT_BITS);
|
||||
return servo_flags;
|
||||
}
|
||||
|
||||
if gecko_flags & (NS_STYLE_CONTAIN_LAYOUT as u8) != 0 {
|
||||
servo_flags.insert(contain::LAYOUT);
|
||||
servo_flags.insert(SpecifiedValue::LAYOUT);
|
||||
}
|
||||
if gecko_flags & (NS_STYLE_CONTAIN_STYLE as u8) != 0{
|
||||
servo_flags.insert(contain::STYLE);
|
||||
servo_flags.insert(SpecifiedValue::STYLE);
|
||||
}
|
||||
if gecko_flags & (NS_STYLE_CONTAIN_PAINT as u8) != 0 {
|
||||
servo_flags.insert(contain::PAINT);
|
||||
servo_flags.insert(SpecifiedValue::PAINT);
|
||||
}
|
||||
|
||||
return servo_flags;
|
||||
|
|
|
@ -1570,12 +1570,12 @@ ${helpers.predefined_type("transform-origin",
|
|||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, ToComputedValue)]
|
||||
pub flags SpecifiedValue: u8 {
|
||||
const LAYOUT = 0x01,
|
||||
const STYLE = 0x02,
|
||||
const PAINT = 0x04,
|
||||
const STRICT = 0x8,
|
||||
const STRICT_BITS = LAYOUT.bits | STYLE.bits | PAINT.bits,
|
||||
pub struct SpecifiedValue: u8 {
|
||||
const LAYOUT = 0x01;
|
||||
const STYLE = 0x02;
|
||||
const PAINT = 0x04;
|
||||
const STRICT = 0x8;
|
||||
const STRICT_BITS = SpecifiedValue::LAYOUT.bits | SpecifiedValue::STYLE.bits | SpecifiedValue::PAINT.bits;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1584,13 +1584,13 @@ ${helpers.predefined_type("transform-origin",
|
|||
if self.is_empty() {
|
||||
return dest.write_str("none")
|
||||
}
|
||||
if self.contains(STRICT) {
|
||||
if self.contains(SpecifiedValue::STRICT) {
|
||||
return dest.write_str("strict")
|
||||
}
|
||||
|
||||
let mut has_any = false;
|
||||
macro_rules! maybe_write_value {
|
||||
($ident:ident => $str:expr) => {
|
||||
($ident:path => $str:expr) => {
|
||||
if self.contains($ident) {
|
||||
if has_any {
|
||||
dest.write_str(" ")?;
|
||||
|
@ -1600,9 +1600,9 @@ ${helpers.predefined_type("transform-origin",
|
|||
}
|
||||
}
|
||||
}
|
||||
maybe_write_value!(LAYOUT => "layout");
|
||||
maybe_write_value!(STYLE => "style");
|
||||
maybe_write_value!(PAINT => "paint");
|
||||
maybe_write_value!(SpecifiedValue::LAYOUT => "layout");
|
||||
maybe_write_value!(SpecifiedValue::STYLE => "style");
|
||||
maybe_write_value!(SpecifiedValue::PAINT => "paint");
|
||||
|
||||
debug_assert!(has_any);
|
||||
Ok(())
|
||||
|
@ -1623,15 +1623,15 @@ ${helpers.predefined_type("transform-origin",
|
|||
return Ok(result)
|
||||
}
|
||||
if input.try(|input| input.expect_ident_matching("strict")).is_ok() {
|
||||
result.insert(STRICT | STRICT_BITS);
|
||||
result.insert(SpecifiedValue::STRICT | SpecifiedValue::STRICT_BITS);
|
||||
return Ok(result)
|
||||
}
|
||||
|
||||
while let Ok(name) = input.try(|i| i.expect_ident_cloned()) {
|
||||
let flag = match_ignore_ascii_case! { &name,
|
||||
"layout" => Some(LAYOUT),
|
||||
"style" => Some(STYLE),
|
||||
"paint" => Some(PAINT),
|
||||
"layout" => Some(SpecifiedValue::LAYOUT),
|
||||
"style" => Some(SpecifiedValue::STYLE),
|
||||
"paint" => Some(SpecifiedValue::PAINT),
|
||||
_ => None
|
||||
};
|
||||
let flag = match flag {
|
||||
|
@ -1782,28 +1782,28 @@ ${helpers.predefined_type(
|
|||
/// These constants match Gecko's `NS_STYLE_TOUCH_ACTION_*` constants.
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(ToComputedValue)]
|
||||
pub flags SpecifiedValue: u8 {
|
||||
const TOUCH_ACTION_NONE = structs::NS_STYLE_TOUCH_ACTION_NONE as u8,
|
||||
const TOUCH_ACTION_AUTO = structs::NS_STYLE_TOUCH_ACTION_AUTO as u8,
|
||||
const TOUCH_ACTION_PAN_X = structs::NS_STYLE_TOUCH_ACTION_PAN_X as u8,
|
||||
const TOUCH_ACTION_PAN_Y = structs::NS_STYLE_TOUCH_ACTION_PAN_Y as u8,
|
||||
const TOUCH_ACTION_MANIPULATION = structs::NS_STYLE_TOUCH_ACTION_MANIPULATION as u8,
|
||||
pub struct SpecifiedValue: u8 {
|
||||
const TOUCH_ACTION_NONE = structs::NS_STYLE_TOUCH_ACTION_NONE as u8;
|
||||
const TOUCH_ACTION_AUTO = structs::NS_STYLE_TOUCH_ACTION_AUTO as u8;
|
||||
const TOUCH_ACTION_PAN_X = structs::NS_STYLE_TOUCH_ACTION_PAN_X as u8;
|
||||
const TOUCH_ACTION_PAN_Y = structs::NS_STYLE_TOUCH_ACTION_PAN_Y as u8;
|
||||
const TOUCH_ACTION_MANIPULATION = structs::NS_STYLE_TOUCH_ACTION_MANIPULATION as u8;
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for SpecifiedValue {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
TOUCH_ACTION_NONE => dest.write_str("none"),
|
||||
TOUCH_ACTION_AUTO => dest.write_str("auto"),
|
||||
TOUCH_ACTION_MANIPULATION => dest.write_str("manipulation"),
|
||||
_ if self.contains(TOUCH_ACTION_PAN_X | TOUCH_ACTION_PAN_Y) => {
|
||||
SpecifiedValue::TOUCH_ACTION_NONE => dest.write_str("none"),
|
||||
SpecifiedValue::TOUCH_ACTION_AUTO => dest.write_str("auto"),
|
||||
SpecifiedValue::TOUCH_ACTION_MANIPULATION => dest.write_str("manipulation"),
|
||||
_ if self.contains(SpecifiedValue::TOUCH_ACTION_PAN_X | SpecifiedValue::TOUCH_ACTION_PAN_Y) => {
|
||||
dest.write_str("pan-x pan-y")
|
||||
},
|
||||
_ if self.contains(TOUCH_ACTION_PAN_X) => {
|
||||
_ if self.contains(SpecifiedValue::TOUCH_ACTION_PAN_X) => {
|
||||
dest.write_str("pan-x")
|
||||
},
|
||||
_ if self.contains(TOUCH_ACTION_PAN_Y) => {
|
||||
_ if self.contains(SpecifiedValue::TOUCH_ACTION_PAN_Y) => {
|
||||
dest.write_str("pan-y")
|
||||
},
|
||||
_ => panic!("invalid touch-action value"),
|
||||
|
@ -1813,28 +1813,28 @@ ${helpers.predefined_type(
|
|||
|
||||
#[inline]
|
||||
pub fn get_initial_value() -> computed_value::T {
|
||||
TOUCH_ACTION_AUTO
|
||||
SpecifiedValue::TOUCH_ACTION_AUTO
|
||||
}
|
||||
|
||||
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<SpecifiedValue, ParseError<'i>> {
|
||||
// FIXME: remove clone() when lifetimes are non-lexical
|
||||
try_match_ident_ignore_ascii_case! { input,
|
||||
"auto" => Ok(TOUCH_ACTION_AUTO),
|
||||
"none" => Ok(TOUCH_ACTION_NONE),
|
||||
"manipulation" => Ok(TOUCH_ACTION_MANIPULATION),
|
||||
"auto" => Ok(SpecifiedValue::TOUCH_ACTION_AUTO),
|
||||
"none" => Ok(SpecifiedValue::TOUCH_ACTION_NONE),
|
||||
"manipulation" => Ok(SpecifiedValue::TOUCH_ACTION_MANIPULATION),
|
||||
"pan-x" => {
|
||||
if input.try(|i| i.expect_ident_matching("pan-y")).is_ok() {
|
||||
Ok(TOUCH_ACTION_PAN_X | TOUCH_ACTION_PAN_Y)
|
||||
Ok(SpecifiedValue::TOUCH_ACTION_PAN_X | SpecifiedValue::TOUCH_ACTION_PAN_Y)
|
||||
} else {
|
||||
Ok(TOUCH_ACTION_PAN_X)
|
||||
Ok(SpecifiedValue::TOUCH_ACTION_PAN_X)
|
||||
}
|
||||
},
|
||||
"pan-y" => {
|
||||
if input.try(|i| i.expect_ident_matching("pan-x")).is_ok() {
|
||||
Ok(TOUCH_ACTION_PAN_X | TOUCH_ACTION_PAN_Y)
|
||||
Ok(SpecifiedValue::TOUCH_ACTION_PAN_X | SpecifiedValue::TOUCH_ACTION_PAN_Y)
|
||||
} else {
|
||||
Ok(TOUCH_ACTION_PAN_Y)
|
||||
Ok(SpecifiedValue::TOUCH_ACTION_PAN_Y)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1253,15 +1253,15 @@ ${helpers.single_keyword_system("font-kerning",
|
|||
|
||||
bitflags! {
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
|
||||
pub flags ParsingFlags: u8 {
|
||||
const NORMAL = 0,
|
||||
const HISTORICAL_FORMS = 0x01,
|
||||
const STYLISTIC = 0x02,
|
||||
const STYLESET = 0x04,
|
||||
const CHARACTER_VARIANT = 0x08,
|
||||
const SWASH = 0x10,
|
||||
const ORNAMENTS = 0x20,
|
||||
const ANNOTATION = 0x40,
|
||||
pub struct ParsingFlags: u8 {
|
||||
const NORMAL = 0;
|
||||
const HISTORICAL_FORMS = 0x01;
|
||||
const STYLISTIC = 0x02;
|
||||
const STYLESET = 0x04;
|
||||
const CHARACTER_VARIANT = 0x08;
|
||||
const SWASH = 0x10;
|
||||
const ORNAMENTS = 0x20;
|
||||
const ANNOTATION = 0x40;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1282,7 +1282,7 @@ ${helpers.single_keyword_system("font-kerning",
|
|||
|
||||
let mut parsed_alternates = ParsingFlags::empty();
|
||||
macro_rules! check_if_parsed(
|
||||
($input:expr, $flag:ident) => (
|
||||
($input:expr, $flag:path) => (
|
||||
if parsed_alternates.contains($flag) {
|
||||
return Err($input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
|
||||
}
|
||||
|
@ -1294,7 +1294,7 @@ ${helpers.single_keyword_system("font-kerning",
|
|||
match input.next()?.clone() {
|
||||
Token::Ident(ref ident) => {
|
||||
if *ident == "historical-forms" {
|
||||
check_if_parsed!(input, HISTORICAL_FORMS);
|
||||
check_if_parsed!(input, ParsingFlags::HISTORICAL_FORMS);
|
||||
alternates.push(VariantAlternates::HistoricalForms);
|
||||
Ok(())
|
||||
} else {
|
||||
|
@ -1306,7 +1306,7 @@ ${helpers.single_keyword_system("font-kerning",
|
|||
match_ignore_ascii_case! { &name,
|
||||
% for value in "swash stylistic ornaments annotation".split():
|
||||
"${value}" => {
|
||||
check_if_parsed!(i, ${value.upper()});
|
||||
check_if_parsed!(i, ParsingFlags::${value.upper()});
|
||||
let location = i.current_source_location();
|
||||
let ident = CustomIdent::from_ident(location, i.expect_ident()?, &[])?;
|
||||
alternates.push(VariantAlternates::${to_camel_case(value)}(ident));
|
||||
|
@ -1315,7 +1315,7 @@ ${helpers.single_keyword_system("font-kerning",
|
|||
% endfor
|
||||
% for value in "styleset character-variant".split():
|
||||
"${value}" => {
|
||||
check_if_parsed!(i, ${to_rust_ident(value).upper()});
|
||||
check_if_parsed!(i, ParsingFlags:: ${to_rust_ident(value).upper()});
|
||||
let idents = i.parse_comma_separated(|i| {
|
||||
let location = i.current_source_location();
|
||||
CustomIdent::from_ident(location, i.expect_ident()?, &[])
|
||||
|
@ -1341,7 +1341,7 @@ ${helpers.single_keyword_system("font-kerning",
|
|||
|
||||
#[cfg(feature = "gecko")]
|
||||
macro_rules! exclusive_value {
|
||||
(($value:ident, $set:expr) => $ident:ident) => {
|
||||
(($value:ident, $set:expr) => $ident:path) => {
|
||||
if $value.intersects($set) {
|
||||
return Err(())
|
||||
} else {
|
||||
|
@ -1360,17 +1360,17 @@ macro_rules! exclusive_value {
|
|||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf)]
|
||||
pub flags VariantEastAsian: u16 {
|
||||
const NORMAL = 0,
|
||||
const JIS78 = 0x01,
|
||||
const JIS83 = 0x02,
|
||||
const JIS90 = 0x04,
|
||||
const JIS04 = 0x08,
|
||||
const SIMPLIFIED = 0x10,
|
||||
const TRADITIONAL = 0x20,
|
||||
const FULL_WIDTH = 0x40,
|
||||
const PROPORTIONAL_WIDTH = 0x80,
|
||||
const RUBY = 0x100,
|
||||
pub struct VariantEastAsian: u16 {
|
||||
const NORMAL = 0;
|
||||
const JIS78 = 0x01;
|
||||
const JIS83 = 0x02;
|
||||
const JIS90 = 0x04;
|
||||
const JIS04 = 0x08;
|
||||
const SIMPLIFIED = 0x10;
|
||||
const TRADITIONAL = 0x20;
|
||||
const FULL_WIDTH = 0x40;
|
||||
const PROPORTIONAL_WIDTH = 0x80;
|
||||
const RUBY = 0x100;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1384,15 +1384,15 @@ macro_rules! exclusive_value {
|
|||
<%self:simple_system_boilerplate name="font_variant_east_asian"></%self:simple_system_boilerplate>
|
||||
|
||||
// servo_bit: gecko_bit
|
||||
<% font_variant_east_asian_map = { "JIS78": "JIS78",
|
||||
"JIS83": "JIS83",
|
||||
"JIS90": "JIS90",
|
||||
"JIS04": "JIS04",
|
||||
"SIMPLIFIED": "SIMPLIFIED",
|
||||
"TRADITIONAL": "TRADITIONAL",
|
||||
"FULL_WIDTH": "FULL_WIDTH",
|
||||
"PROPORTIONAL_WIDTH": "PROP_WIDTH",
|
||||
"RUBY": "RUBY" } %>
|
||||
<% font_variant_east_asian_map = { "VariantEastAsian::JIS78": "JIS78",
|
||||
"VariantEastAsian::JIS83": "JIS83",
|
||||
"VariantEastAsian::JIS90": "JIS90",
|
||||
"VariantEastAsian::JIS04": "JIS04",
|
||||
"VariantEastAsian::SIMPLIFIED": "SIMPLIFIED",
|
||||
"VariantEastAsian::TRADITIONAL": "TRADITIONAL",
|
||||
"VariantEastAsian::FULL_WIDTH": "FULL_WIDTH",
|
||||
"VariantEastAsian::PROPORTIONAL_WIDTH": "PROP_WIDTH",
|
||||
"VariantEastAsian::RUBY": "RUBY" } %>
|
||||
|
||||
${helpers.gecko_bitflags_conversion(font_variant_east_asian_map, 'NS_FONT_VARIANT_EAST_ASIAN_',
|
||||
'VariantEastAsian', kw_type='u16')}
|
||||
|
@ -1407,7 +1407,7 @@ macro_rules! exclusive_value {
|
|||
let mut has_any = false;
|
||||
|
||||
macro_rules! write_value {
|
||||
($ident:ident => $str:expr) => {
|
||||
($ident:path => $str:expr) => {
|
||||
if self.intersects($ident) {
|
||||
if has_any {
|
||||
dest.write_str(" ")?;
|
||||
|
@ -1418,15 +1418,15 @@ macro_rules! exclusive_value {
|
|||
}
|
||||
}
|
||||
|
||||
write_value!(JIS78 => "jis78");
|
||||
write_value!(JIS83 => "jis83");
|
||||
write_value!(JIS90 => "jis90");
|
||||
write_value!(JIS04 => "jis04");
|
||||
write_value!(SIMPLIFIED => "simplified");
|
||||
write_value!(TRADITIONAL => "traditional");
|
||||
write_value!(FULL_WIDTH => "full-width");
|
||||
write_value!(PROPORTIONAL_WIDTH => "proportional-width");
|
||||
write_value!(RUBY => "ruby");
|
||||
write_value!(VariantEastAsian::JIS78 => "jis78");
|
||||
write_value!(VariantEastAsian::JIS83 => "jis83");
|
||||
write_value!(VariantEastAsian::JIS90 => "jis90");
|
||||
write_value!(VariantEastAsian::JIS04 => "jis04");
|
||||
write_value!(VariantEastAsian::SIMPLIFIED => "simplified");
|
||||
write_value!(VariantEastAsian::TRADITIONAL => "traditional");
|
||||
write_value!(VariantEastAsian::FULL_WIDTH => "full-width");
|
||||
write_value!(VariantEastAsian::PROPORTIONAL_WIDTH => "proportional-width");
|
||||
write_value!(VariantEastAsian::RUBY => "ruby");
|
||||
|
||||
debug_assert!(has_any);
|
||||
Ok(())
|
||||
|
@ -1448,8 +1448,10 @@ macro_rules! exclusive_value {
|
|||
/// normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]
|
||||
/// <east-asian-variant-values> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]
|
||||
/// <east-asian-width-values> = [ full-width | proportional-width ]
|
||||
<% east_asian_variant_values = "JIS78 | JIS83 | JIS90 | JIS04 | SIMPLIFIED | TRADITIONAL" %>
|
||||
<% east_asian_width_values = "FULL_WIDTH | PROPORTIONAL_WIDTH" %>
|
||||
<% east_asian_variant_values = """VariantEastAsian::JIS78 | VariantEastAsian::JIS83 |
|
||||
VariantEastAsian::JIS90 | VariantEastAsian::JIS04 |
|
||||
VariantEastAsian::SIMPLIFIED | VariantEastAsian::TRADITIONAL""" %>
|
||||
<% east_asian_width_values = "VariantEastAsian::FULL_WIDTH | VariantEastAsian::PROPORTIONAL_WIDTH" %>
|
||||
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<SpecifiedValue, ParseError<'i>> {
|
||||
let mut result = VariantEastAsian::empty();
|
||||
|
@ -1461,23 +1463,23 @@ macro_rules! exclusive_value {
|
|||
while let Ok(flag) = input.try(|input| {
|
||||
Ok(match_ignore_ascii_case! { &input.expect_ident().map_err(|_| ())?,
|
||||
"jis78" =>
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => JIS78),
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::JIS78),
|
||||
"jis83" =>
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => JIS83),
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::JIS83),
|
||||
"jis90" =>
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => JIS90),
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::JIS90),
|
||||
"jis04" =>
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => JIS04),
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::JIS04),
|
||||
"simplified" =>
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => SIMPLIFIED),
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::SIMPLIFIED),
|
||||
"traditional" =>
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => TRADITIONAL),
|
||||
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::TRADITIONAL),
|
||||
"full-width" =>
|
||||
exclusive_value!((result, ${east_asian_width_values}) => FULL_WIDTH),
|
||||
exclusive_value!((result, ${east_asian_width_values}) => VariantEastAsian::FULL_WIDTH),
|
||||
"proportional-width" =>
|
||||
exclusive_value!((result, ${east_asian_width_values}) => PROPORTIONAL_WIDTH),
|
||||
exclusive_value!((result, ${east_asian_width_values}) => VariantEastAsian::PROPORTIONAL_WIDTH),
|
||||
"ruby" =>
|
||||
exclusive_value!((result, RUBY) => RUBY),
|
||||
exclusive_value!((result, VariantEastAsian::RUBY) => VariantEastAsian::RUBY),
|
||||
_ => return Err(()),
|
||||
})
|
||||
}) {
|
||||
|
@ -1504,18 +1506,18 @@ macro_rules! exclusive_value {
|
|||
|
||||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf)]
|
||||
pub flags VariantLigatures: u16 {
|
||||
const NORMAL = 0,
|
||||
const NONE = 0x01,
|
||||
const COMMON_LIGATURES = 0x02,
|
||||
const NO_COMMON_LIGATURES = 0x04,
|
||||
const DISCRETIONARY_LIGATURES = 0x08,
|
||||
const NO_DISCRETIONARY_LIGATURES = 0x10,
|
||||
const HISTORICAL_LIGATURES = 0x20,
|
||||
const NO_HISTORICAL_LIGATURES = 0x40,
|
||||
const CONTEXTUAL = 0x80,
|
||||
const NO_CONTEXTUAL = 0x100,
|
||||
#[derive(MallocSizeOf)]
|
||||
pub struct VariantLigatures: u16 {
|
||||
const NORMAL = 0;
|
||||
const NONE = 0x01;
|
||||
const COMMON_LIGATURES = 0x02;
|
||||
const NO_COMMON_LIGATURES = 0x04;
|
||||
const DISCRETIONARY_LIGATURES = 0x08;
|
||||
const NO_DISCRETIONARY_LIGATURES = 0x10;
|
||||
const HISTORICAL_LIGATURES = 0x20;
|
||||
const NO_HISTORICAL_LIGATURES = 0x40;
|
||||
const CONTEXTUAL = 0x80;
|
||||
const NO_CONTEXTUAL = 0x100;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1529,15 +1531,15 @@ macro_rules! exclusive_value {
|
|||
<%self:simple_system_boilerplate name="font_variant_ligatures"></%self:simple_system_boilerplate>
|
||||
|
||||
// servo_bit: gecko_bit
|
||||
<% font_variant_ligatures_map = { "NONE": "NONE",
|
||||
"COMMON_LIGATURES": "COMMON",
|
||||
"NO_COMMON_LIGATURES": "NO_COMMON",
|
||||
"DISCRETIONARY_LIGATURES": "DISCRETIONARY",
|
||||
"NO_DISCRETIONARY_LIGATURES": "NO_DISCRETIONARY",
|
||||
"HISTORICAL_LIGATURES": "HISTORICAL",
|
||||
"NO_HISTORICAL_LIGATURES": "NO_HISTORICAL",
|
||||
"CONTEXTUAL": "CONTEXTUAL",
|
||||
"NO_CONTEXTUAL": "NO_CONTEXTUAL" } %>
|
||||
<% font_variant_ligatures_map = { "VariantLigatures::NONE": "NONE",
|
||||
"VariantLigatures::COMMON_LIGATURES": "COMMON",
|
||||
"VariantLigatures::NO_COMMON_LIGATURES": "NO_COMMON",
|
||||
"VariantLigatures::DISCRETIONARY_LIGATURES": "DISCRETIONARY",
|
||||
"VariantLigatures::NO_DISCRETIONARY_LIGATURES": "NO_DISCRETIONARY",
|
||||
"VariantLigatures::HISTORICAL_LIGATURES": "HISTORICAL",
|
||||
"VariantLigatures::NO_HISTORICAL_LIGATURES": "NO_HISTORICAL",
|
||||
"VariantLigatures::CONTEXTUAL": "CONTEXTUAL",
|
||||
"VariantLigatures::NO_CONTEXTUAL": "NO_CONTEXTUAL" } %>
|
||||
|
||||
${helpers.gecko_bitflags_conversion(font_variant_ligatures_map, 'NS_FONT_VARIANT_LIGATURES_',
|
||||
'VariantLigatures', kw_type='u16')}
|
||||
|
@ -1547,14 +1549,14 @@ macro_rules! exclusive_value {
|
|||
if self.is_empty() {
|
||||
return dest.write_str("normal")
|
||||
}
|
||||
if self.contains(NONE) {
|
||||
if self.contains(VariantLigatures::NONE) {
|
||||
return dest.write_str("none")
|
||||
}
|
||||
|
||||
let mut has_any = false;
|
||||
|
||||
macro_rules! write_value {
|
||||
($ident:ident => $str:expr) => {
|
||||
($ident:path => $str:expr) => {
|
||||
if self.intersects($ident) {
|
||||
if has_any {
|
||||
dest.write_str(" ")?;
|
||||
|
@ -1565,14 +1567,14 @@ macro_rules! exclusive_value {
|
|||
}
|
||||
}
|
||||
|
||||
write_value!(COMMON_LIGATURES => "common-ligatures");
|
||||
write_value!(NO_COMMON_LIGATURES => "no-common-ligatures");
|
||||
write_value!(DISCRETIONARY_LIGATURES => "discretionary-ligatures");
|
||||
write_value!(NO_DISCRETIONARY_LIGATURES => "no-discretionary-ligatures");
|
||||
write_value!(HISTORICAL_LIGATURES => "historical-ligatures");
|
||||
write_value!(NO_HISTORICAL_LIGATURES => "no-historical-ligatures");
|
||||
write_value!(CONTEXTUAL => "contextual");
|
||||
write_value!(NO_CONTEXTUAL => "no-contextual");
|
||||
write_value!(VariantLigatures::COMMON_LIGATURES => "common-ligatures");
|
||||
write_value!(VariantLigatures::NO_COMMON_LIGATURES => "no-common-ligatures");
|
||||
write_value!(VariantLigatures::DISCRETIONARY_LIGATURES => "discretionary-ligatures");
|
||||
write_value!(VariantLigatures::NO_DISCRETIONARY_LIGATURES => "no-discretionary-ligatures");
|
||||
write_value!(VariantLigatures::HISTORICAL_LIGATURES => "historical-ligatures");
|
||||
write_value!(VariantLigatures::NO_HISTORICAL_LIGATURES => "no-historical-ligatures");
|
||||
write_value!(VariantLigatures::CONTEXTUAL => "contextual");
|
||||
write_value!(VariantLigatures::NO_CONTEXTUAL => "no-contextual");
|
||||
|
||||
debug_assert!(has_any);
|
||||
Ok(())
|
||||
|
@ -1592,7 +1594,7 @@ macro_rules! exclusive_value {
|
|||
}
|
||||
#[inline]
|
||||
pub fn get_none_specified_value() -> SpecifiedValue {
|
||||
SpecifiedValue::Value(NONE)
|
||||
SpecifiedValue::Value(VariantLigatures::NONE)
|
||||
}
|
||||
|
||||
/// normal | none |
|
||||
|
@ -1604,10 +1606,11 @@ macro_rules! exclusive_value {
|
|||
/// <discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]
|
||||
/// <historical-lig-values> = [ historical-ligatures | no-historical-ligatures ]
|
||||
/// <contextual-alt-values> = [ contextual | no-contextual ]
|
||||
<% common_lig_values = "COMMON_LIGATURES | NO_COMMON_LIGATURES" %>
|
||||
<% discretionary_lig_values = "DISCRETIONARY_LIGATURES | NO_DISCRETIONARY_LIGATURES" %>
|
||||
<% historical_lig_values = "HISTORICAL_LIGATURES | NO_HISTORICAL_LIGATURES" %>
|
||||
<% contextual_alt_values = "CONTEXTUAL | NO_CONTEXTUAL" %>
|
||||
<% common_lig_values = "VariantLigatures::COMMON_LIGATURES | VariantLigatures::NO_COMMON_LIGATURES" %>
|
||||
<% discretionary_lig_values = """VariantLigatures::DISCRETIONARY_LIGATURES |
|
||||
VariantLigatures::NO_DISCRETIONARY_LIGATURES""" %>
|
||||
<% historical_lig_values = "VariantLigatures::HISTORICAL_LIGATURES | VariantLigatures::NO_HISTORICAL_LIGATURES" %>
|
||||
<% contextual_alt_values = "VariantLigatures::CONTEXTUAL | VariantLigatures::NO_CONTEXTUAL" %>
|
||||
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<SpecifiedValue, ParseError<'i>> {
|
||||
let mut result = VariantLigatures::empty();
|
||||
|
@ -1616,27 +1619,29 @@ macro_rules! exclusive_value {
|
|||
return Ok(SpecifiedValue::Value(result))
|
||||
}
|
||||
if input.try(|input| input.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(SpecifiedValue::Value(NONE))
|
||||
return Ok(SpecifiedValue::Value(VariantLigatures::NONE))
|
||||
}
|
||||
|
||||
while let Ok(flag) = input.try(|input| {
|
||||
Ok(match_ignore_ascii_case! { &input.expect_ident().map_err(|_| ())?,
|
||||
"common-ligatures" =>
|
||||
exclusive_value!((result, ${common_lig_values}) => COMMON_LIGATURES),
|
||||
exclusive_value!((result, ${common_lig_values}) => VariantLigatures::COMMON_LIGATURES),
|
||||
"no-common-ligatures" =>
|
||||
exclusive_value!((result, ${common_lig_values}) => NO_COMMON_LIGATURES),
|
||||
exclusive_value!((result, ${common_lig_values}) => VariantLigatures::NO_COMMON_LIGATURES),
|
||||
"discretionary-ligatures" =>
|
||||
exclusive_value!((result, ${discretionary_lig_values}) => DISCRETIONARY_LIGATURES),
|
||||
exclusive_value!((result, ${discretionary_lig_values}) =>
|
||||
VariantLigatures::DISCRETIONARY_LIGATURES),
|
||||
"no-discretionary-ligatures" =>
|
||||
exclusive_value!((result, ${discretionary_lig_values}) => NO_DISCRETIONARY_LIGATURES),
|
||||
exclusive_value!((result, ${discretionary_lig_values}) =>
|
||||
VariantLigatures::NO_DISCRETIONARY_LIGATURES),
|
||||
"historical-ligatures" =>
|
||||
exclusive_value!((result, ${historical_lig_values}) => HISTORICAL_LIGATURES),
|
||||
exclusive_value!((result, ${historical_lig_values}) => VariantLigatures::HISTORICAL_LIGATURES),
|
||||
"no-historical-ligatures" =>
|
||||
exclusive_value!((result, ${historical_lig_values}) => NO_HISTORICAL_LIGATURES),
|
||||
exclusive_value!((result, ${historical_lig_values}) => VariantLigatures::NO_HISTORICAL_LIGATURES),
|
||||
"contextual" =>
|
||||
exclusive_value!((result, ${contextual_alt_values}) => CONTEXTUAL),
|
||||
exclusive_value!((result, ${contextual_alt_values}) => VariantLigatures::CONTEXTUAL),
|
||||
"no-contextual" =>
|
||||
exclusive_value!((result, ${contextual_alt_values}) => NO_CONTEXTUAL),
|
||||
exclusive_value!((result, ${contextual_alt_values}) => VariantLigatures::NO_CONTEXTUAL),
|
||||
_ => return Err(()),
|
||||
})
|
||||
}) {
|
||||
|
@ -1664,16 +1669,16 @@ macro_rules! exclusive_value {
|
|||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf)]
|
||||
pub flags VariantNumeric: u8 {
|
||||
const NORMAL = 0,
|
||||
const LINING_NUMS = 0x01,
|
||||
const OLDSTYLE_NUMS = 0x02,
|
||||
const PROPORTIONAL_NUMS = 0x04,
|
||||
const TABULAR_NUMS = 0x08,
|
||||
const DIAGONAL_FRACTIONS = 0x10,
|
||||
const STACKED_FRACTIONS = 0x20,
|
||||
const SLASHED_ZERO = 0x40,
|
||||
const ORDINAL = 0x80,
|
||||
pub struct VariantNumeric: u8 {
|
||||
const NORMAL = 0;
|
||||
const LINING_NUMS = 0x01;
|
||||
const OLDSTYLE_NUMS = 0x02;
|
||||
const PROPORTIONAL_NUMS = 0x04;
|
||||
const TABULAR_NUMS = 0x08;
|
||||
const DIAGONAL_FRACTIONS = 0x10;
|
||||
const STACKED_FRACTIONS = 0x20;
|
||||
const SLASHED_ZERO = 0x40;
|
||||
const ORDINAL = 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1688,14 +1693,14 @@ macro_rules! exclusive_value {
|
|||
|
||||
|
||||
// servo_bit: gecko_bit
|
||||
<% font_variant_numeric_map = { "LINING_NUMS": "LINING",
|
||||
"OLDSTYLE_NUMS": "OLDSTYLE",
|
||||
"PROPORTIONAL_NUMS": "PROPORTIONAL",
|
||||
"TABULAR_NUMS": "TABULAR",
|
||||
"DIAGONAL_FRACTIONS": "DIAGONAL_FRACTIONS",
|
||||
"STACKED_FRACTIONS": "STACKED_FRACTIONS",
|
||||
"SLASHED_ZERO": "SLASHZERO",
|
||||
"ORDINAL": "ORDINAL" } %>
|
||||
<% font_variant_numeric_map = { "VariantNumeric::LINING_NUMS": "LINING",
|
||||
"VariantNumeric::OLDSTYLE_NUMS": "OLDSTYLE",
|
||||
"VariantNumeric::PROPORTIONAL_NUMS": "PROPORTIONAL",
|
||||
"VariantNumeric::TABULAR_NUMS": "TABULAR",
|
||||
"VariantNumeric::DIAGONAL_FRACTIONS": "DIAGONAL_FRACTIONS",
|
||||
"VariantNumeric::STACKED_FRACTIONS": "STACKED_FRACTIONS",
|
||||
"VariantNumeric::SLASHED_ZERO": "SLASHZERO",
|
||||
"VariantNumeric::ORDINAL": "ORDINAL" } %>
|
||||
|
||||
${helpers.gecko_bitflags_conversion(font_variant_numeric_map, 'NS_FONT_VARIANT_NUMERIC_',
|
||||
'VariantNumeric')}
|
||||
|
@ -1709,7 +1714,7 @@ macro_rules! exclusive_value {
|
|||
let mut has_any = false;
|
||||
|
||||
macro_rules! write_value {
|
||||
($ident:ident => $str:expr) => {
|
||||
($ident:path => $str:expr) => {
|
||||
if self.intersects($ident) {
|
||||
if has_any {
|
||||
dest.write_str(" ")?;
|
||||
|
@ -1720,14 +1725,14 @@ macro_rules! exclusive_value {
|
|||
}
|
||||
}
|
||||
|
||||
write_value!(LINING_NUMS => "lining-nums");
|
||||
write_value!(OLDSTYLE_NUMS => "oldstyle-nums");
|
||||
write_value!(PROPORTIONAL_NUMS => "proportional-nums");
|
||||
write_value!(TABULAR_NUMS => "tabular-nums");
|
||||
write_value!(DIAGONAL_FRACTIONS => "diagonal-fractions");
|
||||
write_value!(STACKED_FRACTIONS => "stacked-fractions");
|
||||
write_value!(SLASHED_ZERO => "slashed-zero");
|
||||
write_value!(ORDINAL => "ordinal");
|
||||
write_value!(VariantNumeric::LINING_NUMS => "lining-nums");
|
||||
write_value!(VariantNumeric::OLDSTYLE_NUMS => "oldstyle-nums");
|
||||
write_value!(VariantNumeric::PROPORTIONAL_NUMS => "proportional-nums");
|
||||
write_value!(VariantNumeric::TABULAR_NUMS => "tabular-nums");
|
||||
write_value!(VariantNumeric::DIAGONAL_FRACTIONS => "diagonal-fractions");
|
||||
write_value!(VariantNumeric::STACKED_FRACTIONS => "stacked-fractions");
|
||||
write_value!(VariantNumeric::SLASHED_ZERO => "slashed-zero");
|
||||
write_value!(VariantNumeric::ORDINAL => "ordinal");
|
||||
|
||||
debug_assert!(has_any);
|
||||
Ok(())
|
||||
|
@ -1755,9 +1760,9 @@ macro_rules! exclusive_value {
|
|||
/// <numeric-figure-values> = [ lining-nums | oldstyle-nums ]
|
||||
/// <numeric-spacing-values> = [ proportional-nums | tabular-nums ]
|
||||
/// <numeric-fraction-values> = [ diagonal-fractions | stacked-fractions ]
|
||||
<% numeric_figure_values = "LINING_NUMS | OLDSTYLE_NUMS" %>
|
||||
<% numeric_spacing_values = "PROPORTIONAL_NUMS | TABULAR_NUMS" %>
|
||||
<% numeric_fraction_values = "DIAGONAL_FRACTIONS | STACKED_FRACTIONS" %>
|
||||
<% numeric_figure_values = "VariantNumeric::LINING_NUMS | VariantNumeric::OLDSTYLE_NUMS" %>
|
||||
<% numeric_spacing_values = "VariantNumeric::PROPORTIONAL_NUMS | VariantNumeric::TABULAR_NUMS" %>
|
||||
<% numeric_fraction_values = "VariantNumeric::DIAGONAL_FRACTIONS | VariantNumeric::STACKED_FRACTIONS" %>
|
||||
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<SpecifiedValue, ParseError<'i>> {
|
||||
let mut result = VariantNumeric::empty();
|
||||
|
@ -1769,21 +1774,21 @@ macro_rules! exclusive_value {
|
|||
while let Ok(flag) = input.try(|input| {
|
||||
Ok(match_ignore_ascii_case! { &input.expect_ident().map_err(|_| ())?,
|
||||
"ordinal" =>
|
||||
exclusive_value!((result, ORDINAL) => ORDINAL),
|
||||
exclusive_value!((result, VariantNumeric::ORDINAL) => VariantNumeric::ORDINAL),
|
||||
"slashed-zero" =>
|
||||
exclusive_value!((result, SLASHED_ZERO) => SLASHED_ZERO),
|
||||
exclusive_value!((result, VariantNumeric::SLASHED_ZERO) => VariantNumeric::SLASHED_ZERO),
|
||||
"lining-nums" =>
|
||||
exclusive_value!((result, ${numeric_figure_values}) => LINING_NUMS),
|
||||
exclusive_value!((result, ${numeric_figure_values}) => VariantNumeric::LINING_NUMS),
|
||||
"oldstyle-nums" =>
|
||||
exclusive_value!((result, ${numeric_figure_values}) => OLDSTYLE_NUMS),
|
||||
exclusive_value!((result, ${numeric_figure_values}) => VariantNumeric::OLDSTYLE_NUMS),
|
||||
"proportional-nums" =>
|
||||
exclusive_value!((result, ${numeric_spacing_values}) => PROPORTIONAL_NUMS),
|
||||
exclusive_value!((result, ${numeric_spacing_values}) => VariantNumeric::PROPORTIONAL_NUMS),
|
||||
"tabular-nums" =>
|
||||
exclusive_value!((result, ${numeric_spacing_values}) => TABULAR_NUMS),
|
||||
exclusive_value!((result, ${numeric_spacing_values}) => VariantNumeric::TABULAR_NUMS),
|
||||
"diagonal-fractions" =>
|
||||
exclusive_value!((result, ${numeric_fraction_values}) => DIAGONAL_FRACTIONS),
|
||||
exclusive_value!((result, ${numeric_fraction_values}) => VariantNumeric::DIAGONAL_FRACTIONS),
|
||||
"stacked-fractions" =>
|
||||
exclusive_value!((result, ${numeric_fraction_values}) => STACKED_FRACTIONS),
|
||||
exclusive_value!((result, ${numeric_fraction_values}) => VariantNumeric::STACKED_FRACTIONS),
|
||||
_ => return Err(()),
|
||||
})
|
||||
}) {
|
||||
|
|
|
@ -35,12 +35,12 @@ ${helpers.single_keyword("unicode-bidi",
|
|||
|
||||
bitflags! {
|
||||
#[derive(MallocSizeOf, ToComputedValue)]
|
||||
pub flags SpecifiedValue: u8 {
|
||||
const NONE = 0,
|
||||
const UNDERLINE = 0x01,
|
||||
const OVERLINE = 0x02,
|
||||
const LINE_THROUGH = 0x04,
|
||||
const BLINK = 0x08,
|
||||
pub struct SpecifiedValue: u8 {
|
||||
const NONE = 0;
|
||||
const UNDERLINE = 0x01;
|
||||
const OVERLINE = 0x02;
|
||||
const LINE_THROUGH = 0x04;
|
||||
const BLINK = 0x08;
|
||||
% if product == "gecko":
|
||||
/// Only set by presentation attributes
|
||||
///
|
||||
|
@ -49,7 +49,7 @@ ${helpers.single_keyword("unicode-bidi",
|
|||
///
|
||||
/// For example, this gives <a href=foo><font color="red">text</font></a>
|
||||
/// a red text decoration
|
||||
const COLOR_OVERRIDE = 0x10,
|
||||
const COLOR_OVERRIDE = 0x10;
|
||||
% endif
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ ${helpers.single_keyword("unicode-bidi",
|
|||
let mut has_any = false;
|
||||
|
||||
macro_rules! write_value {
|
||||
($line:ident => $css:expr) => {
|
||||
($line:path => $css:expr) => {
|
||||
if self.contains($line) {
|
||||
if has_any {
|
||||
dest.write_str(" ")?;
|
||||
|
@ -69,10 +69,10 @@ ${helpers.single_keyword("unicode-bidi",
|
|||
}
|
||||
}
|
||||
}
|
||||
write_value!(UNDERLINE => "underline");
|
||||
write_value!(OVERLINE => "overline");
|
||||
write_value!(LINE_THROUGH => "line-through");
|
||||
write_value!(BLINK => "blink");
|
||||
write_value!(SpecifiedValue::UNDERLINE => "underline");
|
||||
write_value!(SpecifiedValue::OVERLINE => "overline");
|
||||
write_value!(SpecifiedValue::LINE_THROUGH => "line-through");
|
||||
write_value!(SpecifiedValue::BLINK => "blink");
|
||||
if !has_any {
|
||||
dest.write_str("none")?;
|
||||
}
|
||||
|
@ -109,14 +109,17 @@ ${helpers.single_keyword("unicode-bidi",
|
|||
match input.expect_ident() {
|
||||
Ok(ident) => {
|
||||
(match_ignore_ascii_case! { &ident,
|
||||
"underline" => if result.contains(UNDERLINE) { Err(()) }
|
||||
else { empty = false; result.insert(UNDERLINE); Ok(()) },
|
||||
"overline" => if result.contains(OVERLINE) { Err(()) }
|
||||
else { empty = false; result.insert(OVERLINE); Ok(()) },
|
||||
"line-through" => if result.contains(LINE_THROUGH) { Err(()) }
|
||||
else { empty = false; result.insert(LINE_THROUGH); Ok(()) },
|
||||
"blink" => if result.contains(BLINK) { Err(()) }
|
||||
else { empty = false; result.insert(BLINK); Ok(()) },
|
||||
"underline" => if result.contains(SpecifiedValue::UNDERLINE) { Err(()) }
|
||||
else { empty = false; result.insert(SpecifiedValue::UNDERLINE); Ok(()) },
|
||||
"overline" => if result.contains(SpecifiedValue::OVERLINE) { Err(()) }
|
||||
else { empty = false; result.insert(SpecifiedValue::OVERLINE); Ok(()) },
|
||||
"line-through" => if result.contains(SpecifiedValue::LINE_THROUGH) { Err(()) }
|
||||
else {
|
||||
empty = false;
|
||||
result.insert(SpecifiedValue::LINE_THROUGH); Ok(())
|
||||
},
|
||||
"blink" => if result.contains(SpecifiedValue::BLINK) { Err(()) }
|
||||
else { empty = false; result.insert(SpecifiedValue::BLINK); Ok(()) },
|
||||
_ => Err(())
|
||||
}).map_err(|()| {
|
||||
location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone()))
|
||||
|
|
|
@ -38,7 +38,7 @@ use selector_parser::PseudoElement;
|
|||
use selectors::parser::SelectorParseErrorKind;
|
||||
#[cfg(feature = "servo")] use servo_config::prefs::PREFS;
|
||||
use shared_lock::StylesheetGuards;
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError, StyleParseErrorKind};
|
||||
use style_traits::{ParsingMode, ToCss, ParseError, StyleParseErrorKind};
|
||||
use stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
#[cfg(feature = "servo")] use values::Either;
|
||||
use values::generics::text::LineHeight;
|
||||
|
@ -466,23 +466,23 @@ impl CSSWideKeyword {
|
|||
|
||||
bitflags! {
|
||||
/// A set of flags for properties.
|
||||
pub flags PropertyFlags: u8 {
|
||||
pub struct PropertyFlags: u8 {
|
||||
/// This property requires a stacking context.
|
||||
const CREATES_STACKING_CONTEXT = 1 << 0,
|
||||
const CREATES_STACKING_CONTEXT = 1 << 0;
|
||||
/// This property has values that can establish a containing block for
|
||||
/// fixed positioned and absolutely positioned elements.
|
||||
const FIXPOS_CB = 1 << 1,
|
||||
const FIXPOS_CB = 1 << 1;
|
||||
/// This property has values that can establish a containing block for
|
||||
/// absolutely positioned elements.
|
||||
const ABSPOS_CB = 1 << 2,
|
||||
const ABSPOS_CB = 1 << 2;
|
||||
/// This shorthand property is an alias of another property.
|
||||
const SHORTHAND_ALIAS_PROPERTY = 1 << 3,
|
||||
const SHORTHAND_ALIAS_PROPERTY = 1 << 3;
|
||||
/// This longhand property applies to ::first-letter.
|
||||
const APPLIES_TO_FIRST_LETTER = 1 << 4,
|
||||
const APPLIES_TO_FIRST_LETTER = 1 << 4;
|
||||
/// This longhand property applies to ::first-line.
|
||||
const APPLIES_TO_FIRST_LINE = 1 << 5,
|
||||
const APPLIES_TO_FIRST_LINE = 1 << 5;
|
||||
/// This longhand property applies to ::placeholder.
|
||||
const APPLIES_TO_PLACEHOLDER = 1 << 6,
|
||||
const APPLIES_TO_PLACEHOLDER = 1 << 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ impl LonghandId {
|
|||
% for property in data.longhands:
|
||||
LonghandId::${property.camel_case} =>
|
||||
% for flag in property.flags:
|
||||
${flag} |
|
||||
PropertyFlags::${flag} |
|
||||
% endfor
|
||||
PropertyFlags::empty(),
|
||||
% endfor
|
||||
|
@ -880,7 +880,7 @@ impl ShorthandId {
|
|||
% for property in data.shorthands:
|
||||
ShorthandId::${property.camel_case} =>
|
||||
% for flag in property.flags:
|
||||
${flag} |
|
||||
PropertyFlags::${flag} |
|
||||
% endfor
|
||||
PropertyFlags::empty(),
|
||||
% endfor
|
||||
|
@ -974,7 +974,7 @@ impl UnparsedValue {
|
|||
Origin::Author,
|
||||
&self.url_data,
|
||||
None,
|
||||
PARSING_MODE_DEFAULT,
|
||||
ParsingMode::DEFAULT,
|
||||
quirks_mode,
|
||||
);
|
||||
let mut input = ParserInput::new(&css);
|
||||
|
@ -1454,7 +1454,7 @@ impl ToCss for PropertyDeclaration {
|
|||
// Normally, we shouldn't be printing variables here if they came from
|
||||
// shorthands. But we should allow properties that came from shorthand
|
||||
// aliases. That also matches with the Gecko behavior.
|
||||
Some(shorthand) if shorthand.flags().contains(SHORTHAND_ALIAS_PROPERTY) =>
|
||||
Some(shorthand) if shorthand.flags().contains(PropertyFlags::SHORTHAND_ALIAS_PROPERTY) =>
|
||||
dest.write_str(&*with_variables.css)?,
|
||||
None => dest.write_str(&*with_variables.css)?,
|
||||
_ => {},
|
||||
|
@ -1513,7 +1513,7 @@ impl PropertyDeclaration {
|
|||
// should return None here. But we return Some to longhands if they
|
||||
// came from a shorthand alias. Because for example, we should be able to
|
||||
// get -moz-transform's value from transform.
|
||||
if shorthand.flags().contains(SHORTHAND_ALIAS_PROPERTY) {
|
||||
if shorthand.flags().contains(PropertyFlags::SHORTHAND_ALIAS_PROPERTY) {
|
||||
return Some(&*with_variables.css);
|
||||
}
|
||||
None
|
||||
|
@ -1966,19 +1966,19 @@ pub mod style_structs {
|
|||
/// Whether the text decoration has an underline.
|
||||
#[inline]
|
||||
pub fn has_underline(&self) -> bool {
|
||||
self.text_decoration_line.contains(longhands::text_decoration_line::UNDERLINE)
|
||||
self.text_decoration_line.contains(longhands::text_decoration_line::SpecifiedValue::UNDERLINE)
|
||||
}
|
||||
|
||||
/// Whether the text decoration has an overline.
|
||||
#[inline]
|
||||
pub fn has_overline(&self) -> bool {
|
||||
self.text_decoration_line.contains(longhands::text_decoration_line::OVERLINE)
|
||||
self.text_decoration_line.contains(longhands::text_decoration_line::SpecifiedValue::OVERLINE)
|
||||
}
|
||||
|
||||
/// Whether the text decoration has a line through.
|
||||
#[inline]
|
||||
pub fn has_line_through(&self) -> bool {
|
||||
self.text_decoration_line.contains(longhands::text_decoration_line::LINE_THROUGH)
|
||||
self.text_decoration_line.contains(longhands::text_decoration_line::SpecifiedValue::LINE_THROUGH)
|
||||
}
|
||||
% elif style_struct.name == "Box":
|
||||
/// Sets the display property, but without touching
|
||||
|
@ -2115,7 +2115,7 @@ pub struct ComputedValues {
|
|||
impl ComputedValues {
|
||||
/// Whether we're a visited style.
|
||||
pub fn is_style_if_visited(&self) -> bool {
|
||||
self.flags.contains(IS_STYLE_IF_VISITED)
|
||||
self.flags.contains(ComputedValueFlags::IS_STYLE_IF_VISITED)
|
||||
}
|
||||
|
||||
/// Gets a reference to the rule node. Panic if no rule node exists.
|
||||
|
@ -2135,9 +2135,9 @@ impl ComputedValues {
|
|||
|
||||
/// Returns whether we're in a display: none subtree.
|
||||
pub fn is_in_display_none_subtree(&self) -> bool {
|
||||
use properties::computed_value_flags::IS_IN_DISPLAY_NONE_SUBTREE;
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
|
||||
self.flags.contains(IS_IN_DISPLAY_NONE_SUBTREE)
|
||||
self.flags.contains(ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE)
|
||||
}
|
||||
|
||||
/// Gets a reference to the custom properties map (if one exists).
|
||||
|
@ -2469,28 +2469,28 @@ pub fn get_writing_mode(inheritedbox_style: &style_structs::InheritedBox) -> Wri
|
|||
match inheritedbox_style.clone_direction() {
|
||||
computed_values::direction::T::ltr => {},
|
||||
computed_values::direction::T::rtl => {
|
||||
flags.insert(logical_geometry::FLAG_RTL);
|
||||
flags.insert(logical_geometry::WritingMode::RTL);
|
||||
},
|
||||
}
|
||||
match inheritedbox_style.clone_writing_mode() {
|
||||
computed_values::writing_mode::T::horizontal_tb => {},
|
||||
computed_values::writing_mode::T::vertical_rl => {
|
||||
flags.insert(logical_geometry::FLAG_VERTICAL);
|
||||
flags.insert(logical_geometry::WritingMode::VERTICAL);
|
||||
},
|
||||
computed_values::writing_mode::T::vertical_lr => {
|
||||
flags.insert(logical_geometry::FLAG_VERTICAL);
|
||||
flags.insert(logical_geometry::FLAG_VERTICAL_LR);
|
||||
flags.insert(logical_geometry::WritingMode::VERTICAL);
|
||||
flags.insert(logical_geometry::WritingMode::VERTICAL_LR);
|
||||
},
|
||||
% if product == "gecko":
|
||||
computed_values::writing_mode::T::sideways_rl => {
|
||||
flags.insert(logical_geometry::FLAG_VERTICAL);
|
||||
flags.insert(logical_geometry::FLAG_SIDEWAYS);
|
||||
flags.insert(logical_geometry::WritingMode::VERTICAL);
|
||||
flags.insert(logical_geometry::WritingMode::SIDEWAYS);
|
||||
},
|
||||
computed_values::writing_mode::T::sideways_lr => {
|
||||
flags.insert(logical_geometry::FLAG_VERTICAL);
|
||||
flags.insert(logical_geometry::FLAG_VERTICAL_LR);
|
||||
flags.insert(logical_geometry::FLAG_LINE_INVERTED);
|
||||
flags.insert(logical_geometry::FLAG_SIDEWAYS);
|
||||
flags.insert(logical_geometry::WritingMode::VERTICAL);
|
||||
flags.insert(logical_geometry::WritingMode::VERTICAL_LR);
|
||||
flags.insert(logical_geometry::WritingMode::LINE_INVERTED);
|
||||
flags.insert(logical_geometry::WritingMode::SIDEWAYS);
|
||||
},
|
||||
% endif
|
||||
}
|
||||
|
@ -2498,14 +2498,14 @@ pub fn get_writing_mode(inheritedbox_style: &style_structs::InheritedBox) -> Wri
|
|||
// If FLAG_SIDEWAYS is already set, this means writing-mode is either
|
||||
// sideways-rl or sideways-lr, and for both of these values,
|
||||
// text-orientation has no effect.
|
||||
if !flags.intersects(logical_geometry::FLAG_SIDEWAYS) {
|
||||
if !flags.intersects(logical_geometry::WritingMode::SIDEWAYS) {
|
||||
match inheritedbox_style.clone_text_orientation() {
|
||||
computed_values::text_orientation::T::mixed => {},
|
||||
computed_values::text_orientation::T::upright => {
|
||||
flags.insert(logical_geometry::FLAG_UPRIGHT);
|
||||
flags.insert(logical_geometry::WritingMode::UPRIGHT);
|
||||
},
|
||||
computed_values::text_orientation::T::sideways => {
|
||||
flags.insert(logical_geometry::FLAG_SIDEWAYS);
|
||||
flags.insert(logical_geometry::WritingMode::SIDEWAYS);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -2694,14 +2694,14 @@ impl<'a> StyleBuilder<'a> {
|
|||
// 99% sure it should give incorrect behavior for table anonymous box
|
||||
// backgrounds, for example. This code doesn't attempt to make it play
|
||||
// nice with inherited_style_ignoring_first_line.
|
||||
let reset_style = if cascade_flags.contains(INHERIT_ALL) {
|
||||
let reset_style = if cascade_flags.contains(CascadeFlags::INHERIT_ALL) {
|
||||
inherited_style
|
||||
} else {
|
||||
reset_style
|
||||
};
|
||||
|
||||
if cascade_flags.contains(VISITED_DEPENDENT_ONLY) {
|
||||
flags.insert(IS_STYLE_IF_VISITED);
|
||||
if cascade_flags.contains(CascadeFlags::VISITED_DEPENDENT_ONLY) {
|
||||
flags.insert(ComputedValueFlags::IS_STYLE_IF_VISITED);
|
||||
}
|
||||
|
||||
StyleBuilder {
|
||||
|
@ -2729,7 +2729,7 @@ impl<'a> StyleBuilder<'a> {
|
|||
|
||||
/// Whether we're a visited style.
|
||||
pub fn is_style_if_visited(&self) -> bool {
|
||||
self.flags.contains(IS_STYLE_IF_VISITED)
|
||||
self.flags.contains(ComputedValueFlags::IS_STYLE_IF_VISITED)
|
||||
}
|
||||
|
||||
/// Creates a StyleBuilder holding only references to the structs of `s`, in
|
||||
|
@ -2791,16 +2791,16 @@ impl<'a> StyleBuilder<'a> {
|
|||
% endif
|
||||
|
||||
% if not property.style_struct.inherited:
|
||||
self.flags.insert(::properties::computed_value_flags::INHERITS_RESET_STYLE);
|
||||
self.flags.insert(::properties::computed_value_flags::ComputedValueFlags::INHERITS_RESET_STYLE);
|
||||
self.modified_reset = true;
|
||||
% endif
|
||||
|
||||
% if property.ident == "content":
|
||||
self.flags.insert(::properties::computed_value_flags::INHERITS_CONTENT);
|
||||
self.flags.insert(::properties::computed_value_flags::ComputedValueFlags::INHERITS_CONTENT);
|
||||
% endif
|
||||
|
||||
% if property.ident == "display":
|
||||
self.flags.insert(::properties::computed_value_flags::INHERITS_DISPLAY);
|
||||
self.flags.insert(::properties::computed_value_flags::ComputedValueFlags::INHERITS_DISPLAY);
|
||||
% endif
|
||||
|
||||
self.${property.style_struct.ident}.mutate()
|
||||
|
@ -3096,17 +3096,17 @@ static CASCADE_PROPERTY: [CascadePropertyFn; ${len(data.longhands)}] = [
|
|||
|
||||
bitflags! {
|
||||
/// A set of flags to tweak the behavior of the `cascade` function.
|
||||
pub flags CascadeFlags: u8 {
|
||||
pub struct CascadeFlags: u8 {
|
||||
/// Whether to inherit all styles from the parent. If this flag is not
|
||||
/// present, non-inherited styles are reset to their initial values.
|
||||
const INHERIT_ALL = 1,
|
||||
const INHERIT_ALL = 1;
|
||||
|
||||
/// Whether to skip any display style fixup for root element, flex/grid
|
||||
/// item, and ruby descendants.
|
||||
const SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP = 1 << 1,
|
||||
const SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP = 1 << 1;
|
||||
|
||||
/// Whether to only cascade properties that are visited dependent.
|
||||
const VISITED_DEPENDENT_ONLY = 1 << 2,
|
||||
const VISITED_DEPENDENT_ONLY = 1 << 2;
|
||||
|
||||
/// Whether the given element we're styling is the document element,
|
||||
/// that is, matches :root.
|
||||
|
@ -3116,23 +3116,23 @@ bitflags! {
|
|||
///
|
||||
/// This affects some style adjustments, like blockification, and means
|
||||
/// that it may affect global state, like the Device's root font-size.
|
||||
const IS_ROOT_ELEMENT = 1 << 3,
|
||||
const IS_ROOT_ELEMENT = 1 << 3;
|
||||
|
||||
/// Whether to convert display:contents into display:inline. This
|
||||
/// is used by Gecko to prevent display:contents on generated
|
||||
/// content.
|
||||
const PROHIBIT_DISPLAY_CONTENTS = 1 << 4,
|
||||
const PROHIBIT_DISPLAY_CONTENTS = 1 << 4;
|
||||
|
||||
/// Whether we're styling the ::-moz-fieldset-content anonymous box.
|
||||
const IS_FIELDSET_CONTENT = 1 << 5,
|
||||
const IS_FIELDSET_CONTENT = 1 << 5;
|
||||
|
||||
/// Whether we're computing the style of a link, either visited or
|
||||
/// unvisited.
|
||||
const IS_LINK = 1 << 6,
|
||||
const IS_LINK = 1 << 6;
|
||||
|
||||
/// Whether we're computing the style of a link element that happens to
|
||||
/// be visited.
|
||||
const IS_VISITED_LINK = 1 << 7,
|
||||
const IS_VISITED_LINK = 1 << 7;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3277,7 +3277,7 @@ where
|
|||
};
|
||||
|
||||
let mut context = computed::Context {
|
||||
is_root_element: flags.contains(IS_ROOT_ELEMENT),
|
||||
is_root_element: flags.contains(CascadeFlags::IS_ROOT_ELEMENT),
|
||||
// We'd really like to own the rules here to avoid refcount traffic, but
|
||||
// animation's usage of `apply_declarations` make this tricky. See bug
|
||||
// 1375525.
|
||||
|
@ -3354,7 +3354,7 @@ where
|
|||
// Only a few properties are allowed to depend on the visited state
|
||||
// of links. When cascading visited styles, we can save time by
|
||||
// only processing these properties.
|
||||
if flags.contains(VISITED_DEPENDENT_ONLY) &&
|
||||
if flags.contains(CascadeFlags::VISITED_DEPENDENT_ONLY) &&
|
||||
!longhand_id.is_visited_dependent() {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -14,41 +14,41 @@ use std::fmt;
|
|||
|
||||
bitflags! {
|
||||
#[doc = "Individual layout actions that may be necessary after restyling."]
|
||||
pub flags ServoRestyleDamage: u8 {
|
||||
pub struct ServoRestyleDamage: u8 {
|
||||
#[doc = "Repaint the node itself."]
|
||||
#[doc = "Currently unused; need to decide how this propagates."]
|
||||
const REPAINT = 0x01,
|
||||
const REPAINT = 0x01;
|
||||
|
||||
#[doc = "The stacking-context-relative position of this node or its descendants has \
|
||||
changed."]
|
||||
#[doc = "Propagates both up and down the flow tree."]
|
||||
const REPOSITION = 0x02,
|
||||
const REPOSITION = 0x02;
|
||||
|
||||
#[doc = "Recompute the overflow regions (bounding box of object and all descendants)."]
|
||||
#[doc = "Propagates down the flow tree because the computation is bottom-up."]
|
||||
const STORE_OVERFLOW = 0x04,
|
||||
const STORE_OVERFLOW = 0x04;
|
||||
|
||||
#[doc = "Recompute intrinsic inline_sizes (minimum and preferred)."]
|
||||
#[doc = "Propagates down the flow tree because the computation is"]
|
||||
#[doc = "bottom-up."]
|
||||
const BUBBLE_ISIZES = 0x08,
|
||||
const BUBBLE_ISIZES = 0x08;
|
||||
|
||||
#[doc = "Recompute actual inline-sizes and block-sizes, only taking out-of-flow children \
|
||||
into account. \
|
||||
Propagates up the flow tree because the computation is top-down."]
|
||||
const REFLOW_OUT_OF_FLOW = 0x10,
|
||||
const REFLOW_OUT_OF_FLOW = 0x10;
|
||||
|
||||
#[doc = "Recompute actual inline_sizes and block_sizes."]
|
||||
#[doc = "Propagates up the flow tree because the computation is"]
|
||||
#[doc = "top-down."]
|
||||
const REFLOW = 0x20,
|
||||
const REFLOW = 0x20;
|
||||
|
||||
#[doc = "Re-resolve generated content. \
|
||||
Propagates up the flow tree because the computation is inorder."]
|
||||
const RESOLVE_GENERATED_CONTENT = 0x40,
|
||||
const RESOLVE_GENERATED_CONTENT = 0x40;
|
||||
|
||||
#[doc = "The entire flow needs to be reconstructed."]
|
||||
const RECONSTRUCT_FLOW = 0x80
|
||||
const RECONSTRUCT_FLOW = 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,24 +79,28 @@ impl ServoRestyleDamage {
|
|||
/// FIXME(bholley): Do we ever actually need this? Shouldn't
|
||||
/// RECONSTRUCT_FLOW imply everything else?
|
||||
pub fn rebuild_and_reflow() -> ServoRestyleDamage {
|
||||
REPAINT | REPOSITION | STORE_OVERFLOW | BUBBLE_ISIZES | REFLOW_OUT_OF_FLOW | REFLOW |
|
||||
RECONSTRUCT_FLOW
|
||||
ServoRestyleDamage::REPAINT | ServoRestyleDamage::REPOSITION |
|
||||
ServoRestyleDamage::STORE_OVERFLOW | ServoRestyleDamage::BUBBLE_ISIZES |
|
||||
ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::REFLOW |
|
||||
ServoRestyleDamage::RECONSTRUCT_FLOW
|
||||
}
|
||||
|
||||
/// Returns a bitmask indicating that the frame needs to be reconstructed.
|
||||
pub fn reconstruct() -> ServoRestyleDamage {
|
||||
RECONSTRUCT_FLOW
|
||||
ServoRestyleDamage::RECONSTRUCT_FLOW
|
||||
}
|
||||
|
||||
/// Supposing a flow has the given `position` property and this damage,
|
||||
/// returns the damage that we should add to the *parent* of this flow.
|
||||
pub fn damage_for_parent(self, child_is_absolutely_positioned: bool) -> ServoRestyleDamage {
|
||||
if child_is_absolutely_positioned {
|
||||
self & (REPAINT | REPOSITION | STORE_OVERFLOW | REFLOW_OUT_OF_FLOW |
|
||||
RESOLVE_GENERATED_CONTENT)
|
||||
self & (ServoRestyleDamage::REPAINT | ServoRestyleDamage::REPOSITION |
|
||||
ServoRestyleDamage::STORE_OVERFLOW | ServoRestyleDamage::REFLOW_OUT_OF_FLOW |
|
||||
ServoRestyleDamage::RESOLVE_GENERATED_CONTENT)
|
||||
} else {
|
||||
self & (REPAINT | REPOSITION | STORE_OVERFLOW | REFLOW | REFLOW_OUT_OF_FLOW |
|
||||
RESOLVE_GENERATED_CONTENT)
|
||||
self & (ServoRestyleDamage::REPAINT | ServoRestyleDamage::REPOSITION |
|
||||
ServoRestyleDamage::STORE_OVERFLOW | ServoRestyleDamage::REFLOW |
|
||||
ServoRestyleDamage::REFLOW_OUT_OF_FLOW | ServoRestyleDamage::RESOLVE_GENERATED_CONTENT)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,20 +115,20 @@ impl ServoRestyleDamage {
|
|||
// Absolute children are out-of-flow and therefore insulated from changes.
|
||||
//
|
||||
// FIXME(pcwalton): Au contraire, if the containing block dimensions change!
|
||||
self & (REPAINT | REPOSITION)
|
||||
self & (ServoRestyleDamage::REPAINT | ServoRestyleDamage::REPOSITION)
|
||||
}
|
||||
(true, false) => {
|
||||
// Changing the position of an absolutely-positioned block requires us to reflow
|
||||
// its kids.
|
||||
if self.contains(REFLOW_OUT_OF_FLOW) {
|
||||
self | REFLOW
|
||||
if self.contains(ServoRestyleDamage::REFLOW_OUT_OF_FLOW) {
|
||||
self | ServoRestyleDamage::REFLOW
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// TODO(pcwalton): Take floatedness into account.
|
||||
self & (REPAINT | REPOSITION | REFLOW)
|
||||
self & (ServoRestyleDamage::REPAINT | ServoRestyleDamage::REPOSITION | ServoRestyleDamage::REFLOW)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,14 +145,14 @@ impl fmt::Display for ServoRestyleDamage {
|
|||
let mut first_elem = true;
|
||||
|
||||
let to_iter =
|
||||
[ (REPAINT, "Repaint")
|
||||
, (REPOSITION, "Reposition")
|
||||
, (STORE_OVERFLOW, "StoreOverflow")
|
||||
, (BUBBLE_ISIZES, "BubbleISizes")
|
||||
, (REFLOW_OUT_OF_FLOW, "ReflowOutOfFlow")
|
||||
, (REFLOW, "Reflow")
|
||||
, (RESOLVE_GENERATED_CONTENT, "ResolveGeneratedContent")
|
||||
, (RECONSTRUCT_FLOW, "ReconstructFlow")
|
||||
[ (ServoRestyleDamage::REPAINT, "Repaint")
|
||||
, (ServoRestyleDamage::REPOSITION, "Reposition")
|
||||
, (ServoRestyleDamage::STORE_OVERFLOW, "StoreOverflow")
|
||||
, (ServoRestyleDamage::BUBBLE_ISIZES, "BubbleISizes")
|
||||
, (ServoRestyleDamage::REFLOW_OUT_OF_FLOW, "ReflowOutOfFlow")
|
||||
, (ServoRestyleDamage::REFLOW, "Reflow")
|
||||
, (ServoRestyleDamage::RESOLVE_GENERATED_CONTENT, "ResolveGeneratedContent")
|
||||
, (ServoRestyleDamage::RECONSTRUCT_FLOW, "ReconstructFlow")
|
||||
];
|
||||
|
||||
for &(damage, damage_str) in &to_iter {
|
||||
|
@ -172,7 +176,7 @@ impl fmt::Display for ServoRestyleDamage {
|
|||
// breakage on modifications.
|
||||
macro_rules! add_if_not_equal(
|
||||
($old:ident, $new:ident, $damage:ident,
|
||||
[ $($effect:ident),* ], [ $($style_struct_getter:ident.$name:ident),* ]) => ({
|
||||
[ $($effect:path),* ], [ $($style_struct_getter:ident.$name:ident),* ]) => ({
|
||||
if $( ($old.$style_struct_getter().$name != $new.$style_struct_getter().$name) )||* {
|
||||
$damage.insert($($effect)|*);
|
||||
true
|
||||
|
@ -191,8 +195,10 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam
|
|||
// FIXME: Test somehow that every property is included.
|
||||
|
||||
add_if_not_equal!(old, new, damage,
|
||||
[REPAINT, REPOSITION, STORE_OVERFLOW, BUBBLE_ISIZES, REFLOW_OUT_OF_FLOW,
|
||||
REFLOW, RECONSTRUCT_FLOW], [
|
||||
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
|
||||
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
|
||||
ServoRestyleDamage::REFLOW_OUT_OF_FLOW, ServoRestyleDamage::REFLOW,
|
||||
ServoRestyleDamage::RECONSTRUCT_FLOW], [
|
||||
get_box.clear, get_box.float, get_box.display, get_box.position, get_counters.content,
|
||||
get_counters.counter_reset, get_counters.counter_increment,
|
||||
get_list.quotes, get_list.list_style_type,
|
||||
|
@ -211,8 +217,10 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam
|
|||
get_column.column_width, get_column.column_count
|
||||
]) || (new.get_box().display == display::T::inline &&
|
||||
add_if_not_equal!(old, new, damage,
|
||||
[REPAINT, REPOSITION, STORE_OVERFLOW, BUBBLE_ISIZES,
|
||||
REFLOW_OUT_OF_FLOW, REFLOW, RECONSTRUCT_FLOW], [
|
||||
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
|
||||
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
|
||||
ServoRestyleDamage::REFLOW_OUT_OF_FLOW, ServoRestyleDamage::REFLOW,
|
||||
ServoRestyleDamage::RECONSTRUCT_FLOW], [
|
||||
// For inline boxes only, border/padding styles are used in flow construction (to decide
|
||||
// whether to create fragments for empty flows).
|
||||
get_border.border_top_width, get_border.border_right_width,
|
||||
|
@ -220,8 +228,9 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam
|
|||
get_padding.padding_top, get_padding.padding_right,
|
||||
get_padding.padding_bottom, get_padding.padding_left
|
||||
])) || add_if_not_equal!(old, new, damage,
|
||||
[REPAINT, REPOSITION, STORE_OVERFLOW, BUBBLE_ISIZES,
|
||||
REFLOW_OUT_OF_FLOW, REFLOW],
|
||||
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
|
||||
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::BUBBLE_ISIZES,
|
||||
ServoRestyleDamage::REFLOW_OUT_OF_FLOW, ServoRestyleDamage::REFLOW],
|
||||
[get_border.border_top_width, get_border.border_right_width,
|
||||
get_border.border_bottom_width, get_border.border_left_width,
|
||||
get_margin.margin_top, get_margin.margin_right,
|
||||
|
@ -246,14 +255,15 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam
|
|||
get_position.flex_shrink,
|
||||
get_position.align_self
|
||||
]) || add_if_not_equal!(old, new, damage,
|
||||
[REPAINT, REPOSITION, STORE_OVERFLOW, REFLOW_OUT_OF_FLOW], [
|
||||
get_position.top, get_position.left,
|
||||
[ServoRestyleDamage::REPAINT, ServoRestyleDamage::REPOSITION,
|
||||
ServoRestyleDamage::STORE_OVERFLOW, ServoRestyleDamage::REFLOW_OUT_OF_FLOW],
|
||||
[get_position.top, get_position.left,
|
||||
get_position.right, get_position.bottom,
|
||||
get_effects.opacity,
|
||||
get_box.transform, get_box.transform_style, get_box.transform_origin,
|
||||
get_box.perspective, get_box.perspective_origin
|
||||
]) || add_if_not_equal!(old, new, damage,
|
||||
[REPAINT], [
|
||||
[ServoRestyleDamage::REPAINT], [
|
||||
get_color.color, get_background.background_color,
|
||||
get_background.background_image, get_background.background_position_x,
|
||||
get_background.background_position_y, get_background.background_repeat,
|
||||
|
@ -279,7 +289,7 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam
|
|||
// Paint worklets may depend on custom properties,
|
||||
// so if they have changed we should repaint.
|
||||
if old.custom_properties() != new.custom_properties() {
|
||||
damage.insert(REPAINT);
|
||||
damage.insert(ServoRestyleDamage::REPAINT);
|
||||
}
|
||||
|
||||
// If the layer requirements of this flow have changed due to the value
|
||||
|
|
|
@ -328,20 +328,20 @@ impl NonTSPseudoClass {
|
|||
/// Gets a given state flag for this pseudo-class. This is used to do
|
||||
/// selector matching, and it's set from the DOM.
|
||||
pub fn state_flag(&self) -> ElementState {
|
||||
use element_state::*;
|
||||
use element_state::ElementState;
|
||||
use self::NonTSPseudoClass::*;
|
||||
match *self {
|
||||
Active => IN_ACTIVE_STATE,
|
||||
Focus => IN_FOCUS_STATE,
|
||||
Fullscreen => IN_FULLSCREEN_STATE,
|
||||
Hover => IN_HOVER_STATE,
|
||||
Enabled => IN_ENABLED_STATE,
|
||||
Disabled => IN_DISABLED_STATE,
|
||||
Checked => IN_CHECKED_STATE,
|
||||
Indeterminate => IN_INDETERMINATE_STATE,
|
||||
ReadOnly | ReadWrite => IN_READ_WRITE_STATE,
|
||||
PlaceholderShown => IN_PLACEHOLDER_SHOWN_STATE,
|
||||
Target => IN_TARGET_STATE,
|
||||
Active => ElementState::IN_ACTIVE_STATE,
|
||||
Focus => ElementState::IN_FOCUS_STATE,
|
||||
Fullscreen => ElementState::IN_FULLSCREEN_STATE,
|
||||
Hover => ElementState::IN_HOVER_STATE,
|
||||
Enabled => ElementState::IN_ENABLED_STATE,
|
||||
Disabled => ElementState::IN_DISABLED_STATE,
|
||||
Checked => ElementState::IN_CHECKED_STATE,
|
||||
Indeterminate => ElementState::IN_INDETERMINATE_STATE,
|
||||
ReadOnly | ReadWrite => ElementState::IN_READ_WRITE_STATE,
|
||||
PlaceholderShown => ElementState::IN_PLACEHOLDER_SHOWN_STATE,
|
||||
Target => ElementState::IN_TARGET_STATE,
|
||||
|
||||
AnyLink |
|
||||
Lang(_) |
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
//! a computed style needs in order for it to adhere to the CSS spec.
|
||||
|
||||
use app_units::Au;
|
||||
use properties::{self, CascadeFlags, ComputedValues};
|
||||
use properties::{IS_ROOT_ELEMENT, SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP, StyleBuilder};
|
||||
use properties::{self, CascadeFlags, ComputedValues, StyleBuilder};
|
||||
use properties::longhands::display::computed_value::T as display;
|
||||
use properties::longhands::float::computed_value::T as float;
|
||||
use properties::longhands::overflow_x::computed_value::T as overflow;
|
||||
|
@ -68,8 +67,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
}
|
||||
}
|
||||
|
||||
if !flags.contains(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP) {
|
||||
blockify_if!(flags.contains(IS_ROOT_ELEMENT));
|
||||
if !flags.contains(CascadeFlags::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP) {
|
||||
blockify_if!(flags.contains(CascadeFlags::IS_ROOT_ELEMENT));
|
||||
blockify_if!(layout_parent_style.get_box().clone_display().is_item_container());
|
||||
}
|
||||
|
||||
|
@ -84,7 +83,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
|
||||
let display = self.style.get_box().clone_display();
|
||||
let blockified_display =
|
||||
display.equivalent_block_display(flags.contains(IS_ROOT_ELEMENT));
|
||||
display.equivalent_block_display(flags.contains(CascadeFlags::IS_ROOT_ELEMENT));
|
||||
if display != blockified_display {
|
||||
self.style.mutate_box().set_adjusted_display(
|
||||
blockified_display,
|
||||
|
@ -95,17 +94,16 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
|
||||
/// Compute a few common flags for both text and element's style.
|
||||
pub fn set_bits(&mut self) {
|
||||
use properties::computed_value_flags::IS_IN_DISPLAY_NONE_SUBTREE;
|
||||
use properties::computed_value_flags::IS_IN_PSEUDO_ELEMENT_SUBTREE;
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
|
||||
if self.style.inherited_flags().contains(IS_IN_DISPLAY_NONE_SUBTREE) ||
|
||||
if self.style.inherited_flags().contains(ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE) ||
|
||||
self.style.get_box().clone_display() == display::none {
|
||||
self.style.flags.insert(IS_IN_DISPLAY_NONE_SUBTREE);
|
||||
self.style.flags.insert(ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE);
|
||||
}
|
||||
|
||||
if self.style.inherited_flags().contains(IS_IN_PSEUDO_ELEMENT_SUBTREE) ||
|
||||
if self.style.inherited_flags().contains(ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE) ||
|
||||
self.style.is_pseudo_element() {
|
||||
self.style.flags.insert(IS_IN_PSEUDO_ELEMENT_SUBTREE);
|
||||
self.style.flags.insert(ComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +131,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
fn adjust_for_text_combine_upright(&mut self) {
|
||||
use computed_values::text_combine_upright::T as text_combine_upright;
|
||||
use computed_values::writing_mode::T as writing_mode;
|
||||
use properties::computed_value_flags::IS_TEXT_COMBINED;
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
|
||||
let writing_mode =
|
||||
self.style.get_inheritedbox().clone_writing_mode();
|
||||
|
@ -142,7 +140,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
|
||||
if writing_mode != writing_mode::horizontal_tb &&
|
||||
text_combine_upright == text_combine_upright::all {
|
||||
self.style.flags.insert(IS_TEXT_COMBINED);
|
||||
self.style.flags.insert(ComputedValueFlags::IS_TEXT_COMBINED);
|
||||
self.style.mutate_inheritedbox().set_writing_mode(writing_mode::horizontal_tb);
|
||||
}
|
||||
}
|
||||
|
@ -153,10 +151,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// from them.
|
||||
#[cfg(feature = "gecko")]
|
||||
fn adjust_for_text_in_ruby(&mut self) {
|
||||
use properties::computed_value_flags::SHOULD_SUPPRESS_LINEBREAK;
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
let parent_display = self.style.get_parent_box().clone_display();
|
||||
if parent_display.is_ruby_type() {
|
||||
self.style.flags.insert(SHOULD_SUPPRESS_LINEBREAK);
|
||||
self.style.flags.insert(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,14 +188,14 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
|
||||
#[cfg(feature = "gecko")]
|
||||
fn adjust_for_contain(&mut self) {
|
||||
use properties::longhands::contain;
|
||||
use properties::longhands::contain::SpecifiedValue;
|
||||
|
||||
// An element with contain: paint needs to be a formatting context, and
|
||||
// also implies overflow: clip.
|
||||
//
|
||||
// TODO(emilio): This mimics Gecko, but spec links are missing!
|
||||
let contain = self.style.get_box().clone_contain();
|
||||
if !contain.contains(contain::PAINT) {
|
||||
if !contain.contains(SpecifiedValue::PAINT) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -208,7 +206,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
|
||||
|
||||
// When 'contain: paint', update overflow from 'visible' to 'clip'.
|
||||
if self.style.get_box().clone_contain().contains(contain::PAINT) {
|
||||
if self.style.get_box().clone_contain().contains(SpecifiedValue::PAINT) {
|
||||
if self.style.get_box().clone_overflow_x() == overflow::visible {
|
||||
let box_style = self.style.mutate_box();
|
||||
box_style.set_overflow_x(overflow::_moz_hidden_unscrollable);
|
||||
|
@ -321,11 +319,11 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// Native anonymous content converts display:contents into display:inline.
|
||||
#[cfg(feature = "gecko")]
|
||||
fn adjust_for_prohibited_display_contents(&mut self, flags: CascadeFlags) {
|
||||
use properties::PROHIBIT_DISPLAY_CONTENTS;
|
||||
use properties::CascadeFlags;
|
||||
|
||||
// TODO: We should probably convert display:contents into display:none
|
||||
// in some cases too: https://drafts.csswg.org/css-display/#unbox
|
||||
if !flags.contains(PROHIBIT_DISPLAY_CONTENTS) ||
|
||||
if !flags.contains(CascadeFlags::PROHIBIT_DISPLAY_CONTENTS) ||
|
||||
self.style.get_box().clone_display() != display::contents {
|
||||
return;
|
||||
}
|
||||
|
@ -345,8 +343,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
layout_parent_style: &ComputedValues,
|
||||
flags: CascadeFlags,
|
||||
) {
|
||||
use properties::IS_FIELDSET_CONTENT;
|
||||
if !flags.contains(IS_FIELDSET_CONTENT) {
|
||||
use properties::CascadeFlags;
|
||||
if !flags.contains(CascadeFlags::IS_FIELDSET_CONTENT) {
|
||||
return;
|
||||
}
|
||||
debug_assert_eq!(self.style.get_box().clone_display(), display::block);
|
||||
|
@ -394,10 +392,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
&mut self,
|
||||
layout_parent_style: &ComputedValues,
|
||||
) {
|
||||
use properties::computed_value_flags::HAS_TEXT_DECORATION_LINES;
|
||||
if layout_parent_style.flags.contains(HAS_TEXT_DECORATION_LINES) ||
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
if layout_parent_style.flags.contains(ComputedValueFlags::HAS_TEXT_DECORATION_LINES) ||
|
||||
!self.style.get_text().clone_text_decoration_line().is_empty() {
|
||||
self.style.flags.insert(HAS_TEXT_DECORATION_LINES);
|
||||
self.style.flags.insert(ComputedValueFlags::HAS_TEXT_DECORATION_LINES);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,13 +404,13 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
&self,
|
||||
layout_parent_style: &ComputedValues,
|
||||
) -> bool {
|
||||
use properties::computed_value_flags::SHOULD_SUPPRESS_LINEBREAK;
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
// Line break suppression should only be propagated to in-flow children.
|
||||
if self.style.floated() || self.style.out_of_flow_positioned() {
|
||||
return false;
|
||||
}
|
||||
let parent_display = layout_parent_style.get_box().clone_display();
|
||||
if layout_parent_style.flags.contains(SHOULD_SUPPRESS_LINEBREAK) {
|
||||
if layout_parent_style.flags.contains(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK) {
|
||||
// Line break suppression is propagated to any children of
|
||||
// line participants.
|
||||
if parent_display.is_line_participant() {
|
||||
|
@ -448,16 +446,16 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
layout_parent_style: &ComputedValues,
|
||||
flags: CascadeFlags,
|
||||
) {
|
||||
use properties::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
||||
use properties::computed_value_flags::SHOULD_SUPPRESS_LINEBREAK;
|
||||
use properties::CascadeFlags;
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
use properties::longhands::unicode_bidi::computed_value::T as unicode_bidi;
|
||||
|
||||
let self_display = self.style.get_box().clone_display();
|
||||
// Check whether line break should be suppressed for this element.
|
||||
if self.should_suppress_linebreak(layout_parent_style) {
|
||||
self.style.flags.insert(SHOULD_SUPPRESS_LINEBREAK);
|
||||
self.style.flags.insert(ComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK);
|
||||
// Inlinify the display type if allowed.
|
||||
if !flags.contains(SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP) {
|
||||
if !flags.contains(CascadeFlags::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP) {
|
||||
let inline_display = self_display.inlinify();
|
||||
if self_display != inline_display {
|
||||
self.style.mutate_box().set_display(inline_display);
|
||||
|
@ -498,21 +496,21 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// FIXME(emilio): This isn't technically a style adjustment thingie, could
|
||||
/// it move somewhere else?
|
||||
fn adjust_for_visited(&mut self, flags: CascadeFlags) {
|
||||
use properties::{IS_LINK, IS_VISITED_LINK};
|
||||
use properties::computed_value_flags::IS_RELEVANT_LINK_VISITED;
|
||||
use properties::CascadeFlags;
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
|
||||
if !self.style.has_visited_style() {
|
||||
return;
|
||||
}
|
||||
|
||||
let relevant_link_visited = if flags.contains(IS_LINK) {
|
||||
flags.contains(IS_VISITED_LINK)
|
||||
let relevant_link_visited = if flags.contains(CascadeFlags::IS_LINK) {
|
||||
flags.contains(CascadeFlags::IS_VISITED_LINK)
|
||||
} else {
|
||||
self.style.inherited_flags().contains(IS_RELEVANT_LINK_VISITED)
|
||||
self.style.inherited_flags().contains(ComputedValueFlags::IS_RELEVANT_LINK_VISITED)
|
||||
};
|
||||
|
||||
if relevant_link_visited {
|
||||
self.style.flags.insert(IS_RELEVANT_LINK_VISITED);
|
||||
self.style.flags.insert(ComputedValueFlags::IS_RELEVANT_LINK_VISITED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,14 +524,14 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
fn adjust_for_justify_items(&mut self) {
|
||||
use values::specified::align;
|
||||
let justify_items = self.style.get_position().clone_justify_items();
|
||||
if justify_items.specified.0 != align::ALIGN_AUTO {
|
||||
if justify_items.specified.0 != align::AlignFlags::AUTO {
|
||||
return;
|
||||
}
|
||||
|
||||
let parent_justify_items =
|
||||
self.style.get_parent_position().clone_justify_items();
|
||||
|
||||
if !parent_justify_items.computed.0.contains(align::ALIGN_LEGACY) {
|
||||
if !parent_justify_items.computed.0.contains(align::AlignFlags::LEGACY) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue