mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #29748 - Loirooriol:sync, r=mrobinson
Backport several style changes from Gecko <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
2426a38a4d
101 changed files with 2063 additions and 1553 deletions
|
@ -20,11 +20,10 @@ use servo_arc::Arc;
|
|||
use servo_atoms::Atom;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use style::context::QuirksMode;
|
||||
use style::invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
||||
use style::media_queries::MediaList;
|
||||
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard};
|
||||
use style::stylesheets::{CssRule, Origin, Stylesheet};
|
||||
use style::stylesheets::{Stylesheet, StylesheetContents};
|
||||
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||
#[unrooted_must_root_lint::must_root]
|
||||
|
@ -48,19 +47,11 @@ impl PartialEq for StyleSheetInDocument {
|
|||
|
||||
impl ToMediaListKey for StyleSheetInDocument {
|
||||
fn to_media_list_key(&self) -> MediaListKey {
|
||||
self.sheet.to_media_list_key()
|
||||
self.sheet.contents.to_media_list_key()
|
||||
}
|
||||
}
|
||||
|
||||
impl ::style::stylesheets::StylesheetInDocument for StyleSheetInDocument {
|
||||
fn origin(&self, guard: &SharedRwLockReadGuard) -> Origin {
|
||||
self.sheet.origin(guard)
|
||||
}
|
||||
|
||||
fn quirks_mode(&self, guard: &SharedRwLockReadGuard) -> QuirksMode {
|
||||
self.sheet.quirks_mode(guard)
|
||||
}
|
||||
|
||||
fn enabled(&self) -> bool {
|
||||
self.sheet.enabled()
|
||||
}
|
||||
|
@ -69,8 +60,8 @@ impl ::style::stylesheets::StylesheetInDocument for StyleSheetInDocument {
|
|||
self.sheet.media(guard)
|
||||
}
|
||||
|
||||
fn rules<'a, 'b: 'a>(&'a self, guard: &'b SharedRwLockReadGuard) -> &'a [CssRule] {
|
||||
self.sheet.rules(guard)
|
||||
fn contents(&self) -> &StylesheetContents {
|
||||
self.sheet.contents()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3525,11 +3525,11 @@ impl Element {
|
|||
}
|
||||
|
||||
pub fn read_write_state(&self) -> bool {
|
||||
self.state.get().contains(ElementState::IN_READ_WRITE_STATE)
|
||||
self.state.get().contains(ElementState::IN_READWRITE_STATE)
|
||||
}
|
||||
|
||||
pub fn set_read_write_state(&self, value: bool) {
|
||||
self.set_state(ElementState::IN_READ_WRITE_STATE, value)
|
||||
self.set_state(ElementState::IN_READWRITE_STATE, value)
|
||||
}
|
||||
|
||||
pub fn placeholder_shown_state(&self) -> bool {
|
||||
|
|
|
@ -297,7 +297,7 @@ impl HTMLInputElement {
|
|||
.clone();
|
||||
HTMLInputElement {
|
||||
htmlelement: HTMLElement::new_inherited_with_state(
|
||||
ElementState::IN_ENABLED_STATE | ElementState::IN_READ_WRITE_STATE,
|
||||
ElementState::IN_ENABLED_STATE | ElementState::IN_READWRITE_STATE,
|
||||
local_name,
|
||||
prefix,
|
||||
document,
|
||||
|
|
|
@ -148,7 +148,7 @@ impl HTMLTextAreaElement {
|
|||
.clone();
|
||||
HTMLTextAreaElement {
|
||||
htmlelement: HTMLElement::new_inherited_with_state(
|
||||
ElementState::IN_ENABLED_STATE | ElementState::IN_READ_WRITE_STATE,
|
||||
ElementState::IN_ENABLED_STATE | ElementState::IN_READWRITE_STATE,
|
||||
local_name,
|
||||
prefix,
|
||||
document,
|
||||
|
|
|
@ -19,15 +19,13 @@ use crate::dom::stylesheetlist::{StyleSheetList, StyleSheetListOwner};
|
|||
use crate::dom::window::Window;
|
||||
use crate::stylesheet_set::StylesheetSetRef;
|
||||
use dom_struct::dom_struct;
|
||||
use selectors::context::QuirksMode;
|
||||
use servo_arc::Arc;
|
||||
use servo_atoms::Atom;
|
||||
use style::author_styles::AuthorStyles;
|
||||
use style::dom::TElement;
|
||||
use style::media_queries::Device;
|
||||
use style::shared_lock::SharedRwLockReadGuard;
|
||||
use style::stylesheets::Stylesheet;
|
||||
use style::stylist::CascadeData;
|
||||
use style::stylist::{CascadeData, Stylist};
|
||||
|
||||
/// Whether a shadow root hosts an User Agent widget.
|
||||
#[derive(JSTraceable, MallocSizeOf, PartialEq)]
|
||||
|
@ -245,8 +243,7 @@ pub trait LayoutShadowRootHelpers<'dom> {
|
|||
fn get_style_data_for_layout(self) -> &'dom CascadeData;
|
||||
unsafe fn flush_stylesheets<E: TElement>(
|
||||
self,
|
||||
device: &Device,
|
||||
quirks_mode: QuirksMode,
|
||||
stylist: &mut Stylist,
|
||||
guard: &SharedRwLockReadGuard,
|
||||
);
|
||||
}
|
||||
|
@ -277,13 +274,12 @@ impl<'dom> LayoutShadowRootHelpers<'dom> for LayoutDom<'dom, ShadowRoot> {
|
|||
#[allow(unsafe_code)]
|
||||
unsafe fn flush_stylesheets<E: TElement>(
|
||||
self,
|
||||
device: &Device,
|
||||
quirks_mode: QuirksMode,
|
||||
stylist: &mut Stylist,
|
||||
guard: &SharedRwLockReadGuard,
|
||||
) {
|
||||
let author_styles = self.unsafe_get().author_styles.borrow_mut_for_layout();
|
||||
if author_styles.stylesheets.dirty() {
|
||||
author_styles.flush::<E>(device, quirks_mode, guard);
|
||||
author_styles.flush::<E>(stylist, guard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ use script_layout_interface::wrapper_traits::LayoutDataTrait;
|
|||
use selectors::matching::QuirksMode;
|
||||
use std::marker::PhantomData;
|
||||
use style::dom::{TDocument, TNode};
|
||||
use style::media_queries::Device;
|
||||
use style::shared_lock::{
|
||||
SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard as StyleSharedRwLockReadGuard,
|
||||
};
|
||||
use style::stylist::Stylist;
|
||||
|
||||
// A wrapper around documents that ensures ayout can only ever access safe properties.
|
||||
pub struct ServoLayoutDocument<'dom, LayoutDataType: LayoutDataTrait> {
|
||||
|
@ -90,8 +90,7 @@ impl<'ld, LayoutDataType: LayoutDataTrait> ServoLayoutDocument<'ld, LayoutDataTy
|
|||
|
||||
pub fn flush_shadow_roots_stylesheets(
|
||||
&self,
|
||||
device: &Device,
|
||||
quirks_mode: QuirksMode,
|
||||
stylist: &mut Stylist,
|
||||
guard: &StyleSharedRwLockReadGuard,
|
||||
) {
|
||||
unsafe {
|
||||
|
@ -100,7 +99,7 @@ impl<'ld, LayoutDataType: LayoutDataTrait> ServoLayoutDocument<'ld, LayoutDataTy
|
|||
}
|
||||
self.document.flush_shadow_roots_stylesheets();
|
||||
for shadow_root in self.shadow_roots() {
|
||||
shadow_root.flush_stylesheets(device, quirks_mode, guard);
|
||||
shadow_root.flush_stylesheets(stylist, guard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,11 @@ use crate::dom::shadowroot::{LayoutShadowRootHelpers, ShadowRoot};
|
|||
use crate::layout_dom::ServoLayoutElement;
|
||||
use crate::layout_dom::ServoLayoutNode;
|
||||
use script_layout_interface::wrapper_traits::LayoutDataTrait;
|
||||
use selectors::matching::QuirksMode;
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
use style::dom::TShadowRoot;
|
||||
use style::media_queries::Device;
|
||||
use style::shared_lock::SharedRwLockReadGuard as StyleSharedRwLockReadGuard;
|
||||
use style::stylist::CascadeData;
|
||||
use style::stylist::{CascadeData, Stylist};
|
||||
|
||||
pub struct ServoShadowRoot<'dom, LayoutDataType: LayoutDataTrait> {
|
||||
/// The wrapped private DOM ShadowRoot.
|
||||
|
@ -74,11 +72,10 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ServoShadowRoot<'dom, LayoutDataType
|
|||
|
||||
pub unsafe fn flush_stylesheets(
|
||||
&self,
|
||||
device: &Device,
|
||||
quirks_mode: QuirksMode,
|
||||
stylist: &mut Stylist,
|
||||
guard: &StyleSharedRwLockReadGuard,
|
||||
) {
|
||||
self.shadow_root
|
||||
.flush_stylesheets::<ServoLayoutElement<LayoutDataType>>(device, quirks_mode, guard)
|
||||
.flush_stylesheets::<ServoLayoutElement<LayoutDataType>>(stylist, guard)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue