mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/18809
This commit is contained in:
parent
fe16c1d5c3
commit
11c64178d8
142 changed files with 1635 additions and 1685 deletions
|
@ -28,7 +28,7 @@ tinyfiledialogs = "2.5.9"
|
|||
app_units = "0.5"
|
||||
audio-video-metadata = "0.1.4"
|
||||
base64 = "0.6"
|
||||
bitflags = "1.0"
|
||||
bitflags = "0.7"
|
||||
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, CachedConsoleMessage, CachedConsoleMessageTypes};
|
||||
use devtools_traits::{AutoMargins, CONSOLE_API, CachedConsoleMessage, CachedConsoleMessageTypes};
|
||||
use devtools_traits::{ComputedNodeLayout, ConsoleAPI, PageError};
|
||||
use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, TimelineMarker};
|
||||
use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, PAGE_ERROR, 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(CachedConsoleMessageTypes::PAGE_ERROR) {
|
||||
if message_types.contains(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(CachedConsoleMessageTypes::CONSOLE_API) {
|
||||
if message_types.contains(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::{self, ThreadState};
|
||||
use style::thread_state;
|
||||
|
||||
/// 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(ThreadState::SCRIPT));
|
||||
debug_assert!(thread_state::get().contains(thread_state::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::Globals::%s,
|
||||
global: InterfaceObjectMap::%s,
|
||||
}""" % (prototypeChainString, DOMClassTypeId(descriptor), mallocSizeOf, globals_)
|
||||
|
||||
|
||||
|
@ -2445,7 +2445,7 @@ class CGConstructorEnabled(CGAbstractMethod):
|
|||
iface = self.descriptor.interface
|
||||
|
||||
bits = " | ".join(sorted(
|
||||
"InterfaceObjectMap::Globals::" + camel_to_upper_snake(i) for i in iface.exposureSet
|
||||
"InterfaceObjectMap::" + camel_to_upper_snake(i) for i in iface.exposureSet
|
||||
))
|
||||
conditions.append("is_exposed_in(aObj, %s)" % bits)
|
||||
|
||||
|
@ -7092,9 +7092,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 struct Globals: u8 {\n", post="\n}")
|
||||
], "\n")), pre="pub flags 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::ParsingMode;
|
||||
use style_traits::PARSING_MODE_DEFAULT;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSS {
|
||||
|
@ -39,7 +39,7 @@ impl CSS {
|
|||
let context = ParserContext::new_for_cssom(
|
||||
&url,
|
||||
Some(CssRuleType::Style),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks
|
||||
);
|
||||
decl.eval(&context)
|
||||
|
@ -55,7 +55,7 @@ impl CSS {
|
|||
let context = ParserContext::new_for_cssom(
|
||||
&url,
|
||||
Some(CssRuleType::Style),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_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::{ParsingMode, ToCss};
|
||||
use style_traits::{PARSING_MODE_DEFAULT, 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),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_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::{ParsingMode, ToCss};
|
||||
use style_traits::{PARSING_MODE_DEFAULT, 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(), ParsingMode::DEFAULT, quirks_mode);
|
||||
window.css_error_reporter(), PARSING_MODE_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::{ParsingMode, ToCss};
|
||||
use style_traits::{PARSING_MODE_DEFAULT, 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),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
let enabled = cond.eval(&context);
|
||||
let mut guard = self.cssconditionrule.shared_lock().write();
|
||||
|
|
|
@ -42,7 +42,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::{self, ThreadState};
|
||||
use style::thread_state;
|
||||
|
||||
/// 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
|
||||
|
@ -167,7 +167,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(ThreadState::SCRIPT | ThreadState::IN_WORKER);
|
||||
thread_state::initialize(thread_state::SCRIPT | thread_state::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, NodeFlags, LayoutNodeHelpers};
|
||||
use dom::node::{self, CloneChildrenFlag, Node, NodeDamage, window_from_node, IS_IN_DOC, LayoutNodeHelpers};
|
||||
use dom::node::VecPreOrderInsertionHelper;
|
||||
use dom::nodeiterator::NodeIterator;
|
||||
use dom::nodelist::NodeList;
|
||||
|
@ -99,6 +99,7 @@ use hyper_serde::Serde;
|
|||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use js::jsapi::{JSContext, JSRuntime};
|
||||
use js::jsapi::JS_GetRuntime;
|
||||
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;
|
||||
|
@ -129,7 +130,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;
|
||||
use style::invalidation::element::restyle_hints::{RestyleHint, RESTYLE_SELF, RESTYLE_STYLE_ATTRIBUTE};
|
||||
use style::media_queries::{Device, MediaList, MediaType};
|
||||
use style::selector_parser::{RestyleDamage, Snapshot};
|
||||
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard};
|
||||
|
@ -1275,10 +1276,10 @@ impl Document {
|
|||
(&None, &None) => self.window.upcast(),
|
||||
};
|
||||
|
||||
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 ctrl = modifiers.contains(CONTROL);
|
||||
let alt = modifiers.contains(ALT);
|
||||
let shift = modifiers.contains(SHIFT);
|
||||
let meta = modifiers.contains(SUPER);
|
||||
|
||||
let is_composing = false;
|
||||
let is_repeating = state == KeyState::Repeated;
|
||||
|
@ -2018,7 +2019,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(NodeFlags::IS_IN_DOC))
|
||||
.filter(|&(ref k, _)| k.upcast::<Node>().get_flag(IS_IN_DOC))
|
||||
.collect();
|
||||
result
|
||||
}
|
||||
|
@ -2465,11 +2466,11 @@ impl Document {
|
|||
entry.snapshot = Some(Snapshot::new(el.html_element_in_html_document()));
|
||||
}
|
||||
if attr.local_name() == &local_name!("style") {
|
||||
entry.hint.insert(RestyleHint::RESTYLE_STYLE_ATTRIBUTE);
|
||||
entry.hint.insert(RESTYLE_STYLE_ATTRIBUTE);
|
||||
}
|
||||
|
||||
if vtable_for(el.upcast()).attribute_affects_presentational_hints(attr) {
|
||||
entry.hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
entry.hint.insert(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::{ChildrenMutation, LayoutNodeHelpers, Node};
|
||||
use dom::node::{NodeDamage, NodeFlags, UnbindContext};
|
||||
use dom::node::{CLICK_IN_PROGRESS, ChildrenMutation, LayoutNodeHelpers, Node};
|
||||
use dom::node::{NodeDamage, SEQUENTIALLY_FOCUSABLE, UnbindContext};
|
||||
use dom::node::{document_from_node, window_from_node};
|
||||
use dom::nodelist::NodeList;
|
||||
use dom::promise::Promise;
|
||||
|
@ -90,6 +90,7 @@ 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;
|
||||
|
@ -106,8 +107,8 @@ use style::applicable_declarations::ApplicableDeclarationBlock;
|
|||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::context::QuirksMode;
|
||||
use style::dom_apis;
|
||||
use style::element_state::ElementState;
|
||||
use style::invalidation::element::restyle_hints::RestyleHint;
|
||||
use style::element_state::*;
|
||||
use style::invalidation::element::restyle_hints::RESTYLE_SELF;
|
||||
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;
|
||||
|
@ -291,7 +292,7 @@ impl Element {
|
|||
|
||||
// FIXME(bholley): I think we should probably only do this for
|
||||
// NodeStyleDamaged, but I'm preserving existing behavior.
|
||||
restyle.hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
restyle.hint.insert(RESTYLE_SELF);
|
||||
|
||||
if damage == NodeDamage::OtherNodeDamage {
|
||||
restyle.damage = RestyleDamage::rebuild_and_reflow();
|
||||
|
@ -1068,7 +1069,7 @@ impl Element {
|
|||
}
|
||||
// TODO: Check whether the element is being rendered (i.e. not hidden).
|
||||
let node = self.upcast::<Node>();
|
||||
if node.get_flag(NodeFlags::SEQUENTIALLY_FOCUSABLE) {
|
||||
if node.get_flag(SEQUENTIALLY_FOCUSABLE) {
|
||||
return true;
|
||||
}
|
||||
// https://html.spec.whatwg.org/multipage/#specially-focusable
|
||||
|
@ -2486,11 +2487,11 @@ impl VirtualMethods for Element {
|
|||
}
|
||||
|
||||
let flags = self.selector_flags.get();
|
||||
if flags.intersects(ElementSelectorFlags::HAS_SLOW_SELECTOR) {
|
||||
if flags.intersects(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(ElementSelectorFlags::HAS_SLOW_SELECTOR_LATER_SIBLINGS) {
|
||||
if flags.intersects(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>() {
|
||||
|
@ -2499,7 +2500,7 @@ impl VirtualMethods for Element {
|
|||
}
|
||||
}
|
||||
}
|
||||
if flags.intersects(ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR) {
|
||||
if flags.intersects(HAS_EDGE_CHILD_SELECTOR) {
|
||||
if let Some(child) = mutation.modified_edge_element() {
|
||||
child.dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
|
@ -2753,11 +2754,11 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn click_in_progress(&self) -> bool {
|
||||
self.upcast::<Node>().get_flag(NodeFlags::CLICK_IN_PROGRESS)
|
||||
self.upcast::<Node>().get_flag(CLICK_IN_PROGRESS)
|
||||
}
|
||||
|
||||
pub fn set_click_in_progress(&self, click: bool) {
|
||||
self.upcast::<Node>().set_flag(NodeFlags::CLICK_IN_PROGRESS, click)
|
||||
self.upcast::<Node>().set_flag(CLICK_IN_PROGRESS, click)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#nearest-activatable-element
|
||||
|
@ -2857,12 +2858,12 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn active_state(&self) -> bool {
|
||||
self.state.get().contains(ElementState::IN_ACTIVE_STATE)
|
||||
self.state.get().contains(IN_ACTIVE_STATE)
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-selector-active>
|
||||
pub fn set_active_state(&self, value: bool) {
|
||||
self.set_state(ElementState::IN_ACTIVE_STATE, value);
|
||||
self.set_state(IN_ACTIVE_STATE, value);
|
||||
|
||||
if let Some(parent) = self.upcast::<Node>().GetParentElement() {
|
||||
parent.set_active_state(value);
|
||||
|
@ -2870,71 +2871,71 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn focus_state(&self) -> bool {
|
||||
self.state.get().contains(ElementState::IN_FOCUS_STATE)
|
||||
self.state.get().contains(IN_FOCUS_STATE)
|
||||
}
|
||||
|
||||
pub fn set_focus_state(&self, value: bool) {
|
||||
self.set_state(ElementState::IN_FOCUS_STATE, value);
|
||||
self.set_state(IN_FOCUS_STATE, value);
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
|
||||
pub fn hover_state(&self) -> bool {
|
||||
self.state.get().contains(ElementState::IN_HOVER_STATE)
|
||||
self.state.get().contains(IN_HOVER_STATE)
|
||||
}
|
||||
|
||||
pub fn set_hover_state(&self, value: bool) {
|
||||
self.set_state(ElementState::IN_HOVER_STATE, value)
|
||||
self.set_state(IN_HOVER_STATE, value)
|
||||
}
|
||||
|
||||
pub fn enabled_state(&self) -> bool {
|
||||
self.state.get().contains(ElementState::IN_ENABLED_STATE)
|
||||
self.state.get().contains(IN_ENABLED_STATE)
|
||||
}
|
||||
|
||||
pub fn set_enabled_state(&self, value: bool) {
|
||||
self.set_state(ElementState::IN_ENABLED_STATE, value)
|
||||
self.set_state(IN_ENABLED_STATE, value)
|
||||
}
|
||||
|
||||
pub fn disabled_state(&self) -> bool {
|
||||
self.state.get().contains(ElementState::IN_DISABLED_STATE)
|
||||
self.state.get().contains(IN_DISABLED_STATE)
|
||||
}
|
||||
|
||||
pub fn set_disabled_state(&self, value: bool) {
|
||||
self.set_state(ElementState::IN_DISABLED_STATE, value)
|
||||
self.set_state(IN_DISABLED_STATE, value)
|
||||
}
|
||||
|
||||
pub fn read_write_state(&self) -> bool {
|
||||
self.state.get().contains(ElementState::IN_READ_WRITE_STATE)
|
||||
self.state.get().contains(IN_READ_WRITE_STATE)
|
||||
}
|
||||
|
||||
pub fn set_read_write_state(&self, value: bool) {
|
||||
self.set_state(ElementState::IN_READ_WRITE_STATE, value)
|
||||
self.set_state(IN_READ_WRITE_STATE, value)
|
||||
}
|
||||
|
||||
pub fn placeholder_shown_state(&self) -> bool {
|
||||
self.state.get().contains(ElementState::IN_PLACEHOLDER_SHOWN_STATE)
|
||||
self.state.get().contains(IN_PLACEHOLDER_SHOWN_STATE)
|
||||
}
|
||||
|
||||
pub fn set_placeholder_shown_state(&self, value: bool) {
|
||||
if self.placeholder_shown_state() != value {
|
||||
self.set_state(ElementState::IN_PLACEHOLDER_SHOWN_STATE, value);
|
||||
self.set_state(IN_PLACEHOLDER_SHOWN_STATE, value);
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn target_state(&self) -> bool {
|
||||
self.state.get().contains(ElementState::IN_TARGET_STATE)
|
||||
self.state.get().contains(IN_TARGET_STATE)
|
||||
}
|
||||
|
||||
pub fn set_target_state(&self, value: bool) {
|
||||
self.set_state(ElementState::IN_TARGET_STATE, value)
|
||||
self.set_state(IN_TARGET_STATE, value)
|
||||
}
|
||||
|
||||
pub fn fullscreen_state(&self) -> bool {
|
||||
self.state.get().contains(ElementState::IN_FULLSCREEN_STATE)
|
||||
self.state.get().contains(IN_FULLSCREEN_STATE)
|
||||
}
|
||||
|
||||
pub fn set_fullscreen_state(&self, value: bool) {
|
||||
self.set_state(ElementState::IN_FULLSCREEN_STATE, value)
|
||||
self.set_state(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::ElementState;
|
||||
use style::element_state::*;
|
||||
|
||||
#[derive(Clone, Copy, JSTraceable, PartialEq)]
|
||||
#[derive(MallocSizeOf)]
|
||||
|
@ -51,7 +51,7 @@ impl HTMLButtonElement {
|
|||
document: &Document) -> HTMLButtonElement {
|
||||
HTMLButtonElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(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, NodeFlags};
|
||||
use dom::node::{Node, SEQUENTIALLY_FOCUSABLE};
|
||||
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(NodeFlags::SEQUENTIALLY_FOCUSABLE, true);
|
||||
node.set_flag(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(NodeFlags::SEQUENTIALLY_FOCUSABLE, true),
|
||||
=> node.set_flag(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(NodeFlags::SEQUENTIALLY_FOCUSABLE, true);
|
||||
node.set_flag(SEQUENTIALLY_FOCUSABLE, true);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
|
@ -97,9 +97,9 @@ impl HTMLElement {
|
|||
AttrValue::String(ref string) => string == "true",
|
||||
_ => false,
|
||||
};
|
||||
node.set_flag(NodeFlags::SEQUENTIALLY_FOCUSABLE, is_true);
|
||||
node.set_flag(SEQUENTIALLY_FOCUSABLE, is_true);
|
||||
} else {
|
||||
node.set_flag(NodeFlags::SEQUENTIALLY_FOCUSABLE, false);
|
||||
node.set_flag(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::ElementState;
|
||||
use style::element_state::*;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLFieldSetElement {
|
||||
|
@ -33,7 +33,7 @@ impl HTMLFieldSetElement {
|
|||
document: &Document) -> HTMLFieldSetElement {
|
||||
HTMLFieldSetElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(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, NodeFlags, UnbindContext, VecPreOrderInsertionHelper};
|
||||
use dom::node::{Node, PARSER_ASSOCIATED_FORM_OWNER, 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(NodeFlags::PARSER_ASSOCIATED_FORM_OWNER, true);
|
||||
node.set_flag(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(NodeFlags::PARSER_ASSOCIATED_FORM_OWNER);
|
||||
node.set_flag(NodeFlags::PARSER_ASSOCIATED_FORM_OWNER, false);
|
||||
let must_skip_reset = node.get_flag(PARSER_ASSOCIATED_FORM_OWNER);
|
||||
node.set_flag(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)]
|
||||
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;
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -726,16 +726,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 = SandboxAllowance::ALLOW_NOTHING;
|
||||
let mut modes = ALLOW_NOTHING;
|
||||
for token in value.as_tokens() {
|
||||
modes |= match &*token.to_ascii_lowercase() {
|
||||
"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
|
||||
"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
|
||||
};
|
||||
}
|
||||
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::ElementState;
|
||||
use style::element_state::*;
|
||||
use style::str::split_commas;
|
||||
use textinput::{SelectionDirection, TextInput};
|
||||
use textinput::KeyReaction::{DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction};
|
||||
|
@ -137,8 +137,7 @@ impl HTMLInputElement {
|
|||
let chan = document.window().upcast::<GlobalScope>().script_to_constellation_chan().clone();
|
||||
HTMLInputElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE |
|
||||
ElementState::IN_READ_WRITE_STATE,
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE,
|
||||
local_name, prefix, document),
|
||||
input_type: Cell::new(InputType::InputText),
|
||||
placeholder: DomRefCell::new(DOMString::new()),
|
||||
|
@ -281,13 +280,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(ElementState::IN_CHECKED_STATE)
|
||||
self.upcast::<Element>().get_state_for_layout().contains(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(ElementState::IN_INDETERMINATE_STATE)
|
||||
self.upcast::<Element>().get_state_for_layout().contains(IN_INDETERMINATE_STATE)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,7 +336,7 @@ impl HTMLInputElementMethods for HTMLInputElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-checked
|
||||
fn Checked(&self) -> bool {
|
||||
self.upcast::<Element>().state().contains(ElementState::IN_CHECKED_STATE)
|
||||
self.upcast::<Element>().state().contains(IN_CHECKED_STATE)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-checked
|
||||
|
@ -539,12 +538,12 @@ impl HTMLInputElementMethods for HTMLInputElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-indeterminate
|
||||
fn Indeterminate(&self) -> bool {
|
||||
self.upcast::<Element>().state().contains(ElementState::IN_INDETERMINATE_STATE)
|
||||
self.upcast::<Element>().state().contains(IN_INDETERMINATE_STATE)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-indeterminate
|
||||
fn SetIndeterminate(&self, val: bool) {
|
||||
self.upcast::<Element>().set_state(ElementState::IN_INDETERMINATE_STATE, val)
|
||||
self.upcast::<Element>().set_state(IN_INDETERMINATE_STATE, val)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-lfe-labels
|
||||
|
@ -746,7 +745,7 @@ impl HTMLInputElement {
|
|||
}
|
||||
|
||||
fn update_checked_state(&self, checked: bool, dirty: bool) {
|
||||
self.upcast::<Element>().set_state(ElementState::IN_CHECKED_STATE, checked);
|
||||
self.upcast::<Element>().set_state(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::ParsingMode;
|
||||
use style_traits::PARSING_MODE_DEFAULT;
|
||||
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),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_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::ElementState;
|
||||
use style::element_state::*;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLOptGroupElement {
|
||||
|
@ -28,7 +28,7 @@ impl HTMLOptGroupElement {
|
|||
document: &Document) -> HTMLOptGroupElement {
|
||||
HTMLOptGroupElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(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::ElementState;
|
||||
use style::element_state::*;
|
||||
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(ElementState::IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(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::ElementState;
|
||||
use style::element_state::*;
|
||||
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct OptionsFilter;
|
||||
|
@ -73,7 +73,7 @@ impl HTMLSelectElement {
|
|||
document: &Document) -> HTMLSelectElement {
|
||||
HTMLSelectElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE,
|
||||
HTMLElement::new_inherited_with_state(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::ParsingMode;
|
||||
use style_traits::PARSING_MODE_DEFAULT;
|
||||
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),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_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::ElementState;
|
||||
use style::element_state::*;
|
||||
use textinput::{KeyReaction, Lines, SelectionDirection, TextInput};
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -111,8 +111,7 @@ impl HTMLTextAreaElement {
|
|||
let chan = document.window().upcast::<GlobalScope>().script_to_constellation_chan().clone();
|
||||
HTMLTextAreaElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(ElementState::IN_ENABLED_STATE |
|
||||
ElementState::IN_READ_WRITE_STATE,
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE,
|
||||
local_name, prefix, document),
|
||||
placeholder: DomRefCell::new(DOMString::new()),
|
||||
textinput: DomRefCell::new(TextInput::new(
|
||||
|
|
|
@ -15,6 +15,7 @@ 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;
|
||||
|
@ -143,16 +144,16 @@ impl KeyboardEvent {
|
|||
pub fn get_key_modifiers(&self) -> KeyModifiers {
|
||||
let mut result = KeyModifiers::empty();
|
||||
if self.shift.get() {
|
||||
result = result | KeyModifiers::SHIFT;
|
||||
result = result | constellation_msg::SHIFT;
|
||||
}
|
||||
if self.ctrl.get() {
|
||||
result = result | KeyModifiers::CONTROL;
|
||||
result = result | constellation_msg::CONTROL;
|
||||
}
|
||||
if self.alt.get() {
|
||||
result = result | KeyModifiers::ALT;
|
||||
result = result | constellation_msg::ALT;
|
||||
}
|
||||
if self.meta.get() {
|
||||
result = result | KeyModifiers::SUPER;
|
||||
result = result | constellation_msg::SUPER;
|
||||
}
|
||||
result
|
||||
}
|
||||
|
@ -164,7 +165,7 @@ pub fn key_value(ch: Option<char>, key: Key, mods: KeyModifiers) -> Cow<'static,
|
|||
return Cow::from(format!("{}", ch));
|
||||
}
|
||||
|
||||
let shift = mods.contains(KeyModifiers::SHIFT);
|
||||
let shift = mods.contains(constellation_msg::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::{ParsingMode, ToCss};
|
||||
use style_traits::{PARSING_MODE_DEFAULT, 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),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_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),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_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),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_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 struct NodeFlags: u16 {
|
||||
pub flags 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(NodeFlags::IS_IN_DOC, parent_in_doc);
|
||||
node.set_flag(IS_IN_DOC, parent_in_doc);
|
||||
// Out-of-document elements never have the descendants flag set.
|
||||
debug_assert!(!node.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS));
|
||||
debug_assert!(!node.get_flag(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(NodeFlags::IS_IN_DOC | NodeFlags::HAS_DIRTY_DESCENDANTS |
|
||||
NodeFlags::HAS_SNAPSHOT | NodeFlags::HANDLED_SNAPSHOT,
|
||||
node.set_flag(IS_IN_DOC | HAS_DIRTY_DESCENDANTS |
|
||||
HAS_SNAPSHOT | 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(NodeFlags::IS_IN_DOC)
|
||||
self.flags.get().contains(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(NodeFlags::HAS_DIRTY_DESCENDANTS)
|
||||
self.get_flag(HAS_DIRTY_DESCENDANTS)
|
||||
}
|
||||
|
||||
pub fn rev_version(&self) {
|
||||
|
@ -1394,7 +1394,7 @@ impl Node {
|
|||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new_document_node() -> Node {
|
||||
Node::new_(NodeFlags::new() | NodeFlags::IS_IN_DOC, None)
|
||||
Node::new_(NodeFlags::new() | IS_IN_DOC, None)
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
|
|
|
@ -33,7 +33,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, ThreadState};
|
||||
use style::thread_state::{self, IN_WORKER, SCRIPT};
|
||||
|
||||
/// Messages used to control service worker event loop
|
||||
pub enum ServiceWorkerScriptMsg {
|
||||
|
@ -154,7 +154,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(ThreadState::SCRIPT | ThreadState::IN_WORKER);
|
||||
thread_state::initialize(SCRIPT | IN_WORKER);
|
||||
let roots = RootCollection::new();
|
||||
let _stack_roots = ThreadLocalStackRoots::new(&roots);
|
||||
|
||||
|
|
|
@ -28,17 +28,17 @@ pub enum ValidityStatus {
|
|||
}
|
||||
|
||||
bitflags!{
|
||||
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;
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)]
|
||||
struct TextureUnpacking: u8 {
|
||||
const FLIP_Y_AXIS = 0x01;
|
||||
const PREMULTIPLY_ALPHA = 0x02;
|
||||
const CONVERT_COLORSPACE = 0x04;
|
||||
flags TextureUnpacking: u8 {
|
||||
const FLIP_Y_AXIS = 0x01,
|
||||
const PREMULTIPLY_ALPHA = 0x02,
|
||||
const CONVERT_COLORSPACE = 0x04,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ impl WebGLRenderingContext {
|
|||
limits: ctx_data.limits,
|
||||
canvas: Dom::from_ref(canvas),
|
||||
last_error: Cell::new(None),
|
||||
texture_unpacking_settings: Cell::new(TextureUnpacking::CONVERT_COLORSPACE),
|
||||
texture_unpacking_settings: Cell::new(CONVERT_COLORSPACE),
|
||||
texture_unpacking_alignment: Cell::new(4),
|
||||
bound_framebuffer: MutNullableDom::new(None),
|
||||
bound_textures: DomRefCell::new(Default::default()),
|
||||
|
@ -878,7 +878,7 @@ impl WebGLRenderingContext {
|
|||
width: usize,
|
||||
height: usize,
|
||||
unpacking_alignment: usize) -> Vec<u8> {
|
||||
if !self.texture_unpacking_settings.get().contains(TextureUnpacking::FLIP_Y_AXIS) {
|
||||
if !self.texture_unpacking_settings.get().contains(FLIP_Y_AXIS) {
|
||||
return pixels;
|
||||
}
|
||||
|
||||
|
@ -906,7 +906,7 @@ impl WebGLRenderingContext {
|
|||
format: TexFormat,
|
||||
data_type: TexDataType,
|
||||
pixels: Vec<u8>) -> Vec<u8> {
|
||||
if !self.texture_unpacking_settings.get().contains(TextureUnpacking::PREMULTIPLY_ALPHA) {
|
||||
if !self.texture_unpacking_settings.get().contains(PREMULTIPLY_ALPHA) {
|
||||
return pixels;
|
||||
}
|
||||
|
||||
|
@ -990,7 +990,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(TextureUnpacking::PREMULTIPLY_ALPHA);
|
||||
let dest_premultiply = self.texture_unpacking_settings.get().contains(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
|
||||
|
@ -2450,9 +2450,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
match param_name {
|
||||
constants::UNPACK_FLIP_Y_WEBGL => {
|
||||
if param_value != 0 {
|
||||
texture_settings.insert(TextureUnpacking::FLIP_Y_AXIS)
|
||||
texture_settings.insert(FLIP_Y_AXIS)
|
||||
} else {
|
||||
texture_settings.remove(TextureUnpacking::FLIP_Y_AXIS)
|
||||
texture_settings.remove(FLIP_Y_AXIS)
|
||||
}
|
||||
|
||||
self.texture_unpacking_settings.set(texture_settings);
|
||||
|
@ -2460,9 +2460,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
},
|
||||
constants::UNPACK_PREMULTIPLY_ALPHA_WEBGL => {
|
||||
if param_value != 0 {
|
||||
texture_settings.insert(TextureUnpacking::PREMULTIPLY_ALPHA)
|
||||
texture_settings.insert(PREMULTIPLY_ALPHA)
|
||||
} else {
|
||||
texture_settings.remove(TextureUnpacking::PREMULTIPLY_ALPHA)
|
||||
texture_settings.remove(PREMULTIPLY_ALPHA)
|
||||
}
|
||||
|
||||
self.texture_unpacking_settings.set(texture_settings);
|
||||
|
@ -2471,9 +2471,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
constants::UNPACK_COLORSPACE_CONVERSION_WEBGL => {
|
||||
match param_value as u32 {
|
||||
constants::BROWSER_DEFAULT_WEBGL
|
||||
=> texture_settings.insert(TextureUnpacking::CONVERT_COLORSPACE),
|
||||
=> texture_settings.insert(CONVERT_COLORSPACE),
|
||||
constants::NONE
|
||||
=> texture_settings.remove(TextureUnpacking::CONVERT_COLORSPACE),
|
||||
=> texture_settings.remove(CONVERT_COLORSPACE),
|
||||
_ => return self.webgl_error(InvalidEnum),
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,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::ParsingMode;
|
||||
use style_traits::PARSING_MODE_DEFAULT;
|
||||
use task::TaskCanceller;
|
||||
use task_source::dom_manipulation::DOMManipulationTaskSource;
|
||||
use task_source::file_reading::FileReadingTaskSource;
|
||||
|
@ -1016,7 +1016,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),
|
||||
ParsingMode::DEFAULT,
|
||||
PARSING_MODE_DEFAULT,
|
||||
quirks_mode);
|
||||
let media_query_list = media_queries::parse_media_query_list(&context, &mut parser,
|
||||
self.css_error_reporter());
|
||||
|
|
|
@ -63,7 +63,7 @@ use std::sync::mpsc;
|
|||
use std::sync::mpsc::Receiver;
|
||||
use std::sync::mpsc::Sender;
|
||||
use std::thread;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
use style::thread_state;
|
||||
use swapper::Swapper;
|
||||
use swapper::swapper;
|
||||
use task::TaskBox;
|
||||
|
@ -426,7 +426,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(ThreadState::SCRIPT | ThreadState::IN_WORKER);
|
||||
thread_state::initialize(thread_state::SCRIPT | thread_state::IN_WORKER);
|
||||
let roots = RootCollection::new();
|
||||
let _stack_roots = ThreadLocalStackRoots::new(&roots);
|
||||
let mut thread = RootedTraceableBox::new(WorkletThread {
|
||||
|
|
|
@ -140,7 +140,8 @@ 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::NodeFlags;
|
||||
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::{LayoutNodeHelpers, Node};
|
||||
pub use dom::text::Text;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ use std::os;
|
|||
use std::os::raw::c_void;
|
||||
use std::panic::AssertUnwindSafe;
|
||||
use std::ptr;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
use style::thread_state;
|
||||
use task::TaskBox;
|
||||
use time::{Tm, now};
|
||||
|
||||
|
@ -394,8 +394,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(ThreadState::IN_GC),
|
||||
JSGCStatus::JSGC_END => thread_state::exit(ThreadState::IN_GC),
|
||||
JSGCStatus::JSGC_BEGIN => thread_state::enter(thread_state::IN_GC),
|
||||
JSGCStatus::JSGC_END => thread_state::exit(thread_state::IN_GC),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ use std::result::Result;
|
|||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, Select, Sender, channel};
|
||||
use std::thread;
|
||||
use style::thread_state::{self, ThreadState};
|
||||
use style::thread_state;
|
||||
use task_source::dom_manipulation::DOMManipulationTaskSource;
|
||||
use task_source::file_reading::FileReadingTaskSource;
|
||||
use task_source::history_traversal::HistoryTraversalTaskSource;
|
||||
|
@ -544,7 +544,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(ThreadState::SCRIPT);
|
||||
thread_state::initialize(thread_state::SCRIPT);
|
||||
PipelineNamespace::install(state.pipeline_namespace_id);
|
||||
TopLevelBrowsingContextId::install(state.top_level_browsing_context_id);
|
||||
let roots = RootCollection::new();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
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};
|
||||
|
@ -113,12 +114,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(KeyModifiers::SUPER) && !mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT)
|
||||
mods.contains(SUPER) && !mods.contains(CONTROL | ALT)
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
fn is_control_key(mods: KeyModifiers) -> bool {
|
||||
mods.contains(KeyModifiers::CONTROL) && !mods.contains(KeyModifiers::SUPER | KeyModifiers::ALT)
|
||||
mods.contains(CONTROL) && !mods.contains(SUPER | ALT)
|
||||
}
|
||||
|
||||
/// The length in bytes of the first n characters in a UTF-8 string.
|
||||
|
@ -584,36 +585,31 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
printable: Option<char>,
|
||||
key: Key,
|
||||
mods: KeyModifiers) -> KeyReaction {
|
||||
let maybe_select = if mods.contains(KeyModifiers::SHIFT) {
|
||||
Selection::Selected
|
||||
} else {
|
||||
Selection::NotSelected
|
||||
};
|
||||
|
||||
let maybe_select = if mods.contains(SHIFT) { Selection::Selected } else { Selection::NotSelected };
|
||||
match (printable, key) {
|
||||
(_, Key::B) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => {
|
||||
(_, Key::B) if mods.contains(CONTROL | ALT) => {
|
||||
self.adjust_horizontal_by_word(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
(_, Key::F) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => {
|
||||
(_, Key::F) if mods.contains(CONTROL | ALT) => {
|
||||
self.adjust_horizontal_by_word(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
(_, Key::A) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => {
|
||||
(_, Key::A) if mods.contains(CONTROL | ALT) => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
(_, Key::E) if mods.contains(KeyModifiers::CONTROL | KeyModifiers::ALT) => {
|
||||
(_, Key::E) if mods.contains(CONTROL | ALT) => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::A) if mods == KeyModifiers::CONTROL => {
|
||||
(None, Key::A) if mods == CONTROL => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::E) if mods == KeyModifiers::CONTROL => {
|
||||
(None, Key::E) if mods == CONTROL => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
|
@ -645,30 +641,30 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
KeyReaction::DispatchInput
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::Left) if mods.contains(KeyModifiers::SUPER) => {
|
||||
(None, Key::Left) if mods.contains(SUPER) => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::Right) if mods.contains(KeyModifiers::SUPER) => {
|
||||
(None, Key::Right) if mods.contains(SUPER) => {
|
||||
self.adjust_horizontal_to_line_end(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::Up) if mods.contains(KeyModifiers::SUPER) => {
|
||||
(None, Key::Up) if mods.contains(SUPER) => {
|
||||
self.adjust_horizontal_to_limit(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
#[cfg(target_os = "macos")]
|
||||
(None, Key::Down) if mods.contains(KeyModifiers::SUPER) => {
|
||||
(None, Key::Down) if mods.contains(SUPER) => {
|
||||
self.adjust_horizontal_to_limit(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
(None, Key::Left) if mods.contains(KeyModifiers::ALT) => {
|
||||
(None, Key::Left) if mods.contains(ALT) => {
|
||||
self.adjust_horizontal_by_word(Direction::Backward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
(None, Key::Right) if mods.contains(KeyModifiers::ALT) => {
|
||||
(None, Key::Right) if mods.contains(ALT) => {
|
||||
self.adjust_horizontal_by_word(Direction::Forward, maybe_select);
|
||||
KeyReaction::RedrawSelection
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue