mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Only allow UA widgets as children of media elements
Do not allow pseudo-elements for replaced elements
This commit is contained in:
parent
618f528344
commit
e344203c11
6 changed files with 16 additions and 11 deletions
|
@ -705,11 +705,16 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
// List of absolute descendants, in tree order.
|
||||
let mut abs_descendants = AbsoluteDescendants::new();
|
||||
let mut legalizer = Legalizer::new();
|
||||
if !node.is_replaced_content() ||
|
||||
node.type_id() == Some(LayoutNodeType::Element(LayoutElementType::HTMLMediaElement))
|
||||
{
|
||||
let is_media_element_with_widget = node.type_id() ==
|
||||
Some(LayoutNodeType::Element(LayoutElementType::HTMLMediaElement)) &&
|
||||
node.as_element().unwrap().is_shadow_host();
|
||||
if !node.is_replaced_content() || is_media_element_with_widget {
|
||||
for kid in node.children() {
|
||||
if kid.get_pseudo_element_type() != PseudoElementType::Normal {
|
||||
if node.is_replaced_content() {
|
||||
// Replaced elements don't have pseudo-elements per spec.
|
||||
continue;
|
||||
}
|
||||
self.process(&kid);
|
||||
}
|
||||
|
||||
|
|
|
@ -1397,6 +1397,10 @@ impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
|
|||
.expect("Unstyled layout node?")
|
||||
.borrow()
|
||||
}
|
||||
|
||||
fn is_shadow_host(&self) -> bool {
|
||||
self.element.shadow_root().is_some()
|
||||
}
|
||||
}
|
||||
|
||||
/// This implementation of `::selectors::Element` is used for implementing lazy
|
||||
|
|
|
@ -4581,6 +4581,7 @@ impl DocumentMethods for Document {
|
|||
self.exit_fullscreen()
|
||||
}
|
||||
|
||||
// check-tidy: no specs after this line
|
||||
// Servo only API to get an instance of the controls of a specific
|
||||
// media element matching the given id.
|
||||
fn ServoGetMediaControls(&self, id: DOMString) -> Fallible<DomRoot<ShadowRoot>> {
|
||||
|
|
|
@ -46,8 +46,6 @@ pub struct ShadowRoot {
|
|||
author_styles: DomRefCell<AuthorStyles<StyleSheetInDocument>>,
|
||||
stylesheet_list: MutNullableDom<StyleSheetList>,
|
||||
window: Dom<Window>,
|
||||
/// Whether this ShadowRoot hosts a User Agent widget.
|
||||
is_widget: IsUserAgentWidget,
|
||||
}
|
||||
|
||||
impl ShadowRoot {
|
||||
|
@ -72,7 +70,6 @@ impl ShadowRoot {
|
|||
author_styles: DomRefCell::new(AuthorStyles::new()),
|
||||
stylesheet_list: MutNullableDom::new(None),
|
||||
window: Dom::from_ref(document.window()),
|
||||
is_widget,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,10 +167,6 @@ impl ShadowRoot {
|
|||
root,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn is_user_agent_widget(&self) -> bool {
|
||||
self.is_widget == IsUserAgentWidget::Yes
|
||||
}
|
||||
}
|
||||
|
||||
impl ShadowRootMethods for ShadowRoot {
|
||||
|
|
|
@ -490,4 +490,6 @@ pub trait ThreadSafeLayoutElement:
|
|||
.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_shadow_host(&self) -> bool;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ fn filename(file: Resource) -> &'static str {
|
|||
Resource::ServoCSS => "servo.css",
|
||||
Resource::PresentationalHintsCSS => "presentational-hints.css",
|
||||
Resource::QuirksModeCSS => "quirks-mode.css",
|
||||
Resource::RippyPNG => "rippy.png",
|
||||
Resource::RippyPNG => "rippy.png",
|
||||
Resource::MediaControlsCSS => "media_controls.css",
|
||||
Resource::MediaControlsJS => "media_controls.js",
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue