mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Embed user agent stylesheets and media control resouces in libservo (#36803)
Embed user agent stylesheets and media control resouces in libservo as decided in https://github.com/servo/servo/pull/36788#issuecomment-2845332210 Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
parent
7e2d2ed0ce
commit
3db0194e5a
11 changed files with 26 additions and 73 deletions
|
@ -16,7 +16,6 @@ use base::Epoch;
|
|||
use base::id::{PipelineId, WebViewId};
|
||||
use compositing_traits::CrossProcessCompositorApi;
|
||||
use constellation_traits::ScrollState;
|
||||
use embedder_traits::resources::{self, Resource};
|
||||
use embedder_traits::{UntrustedNodeAddress, ViewportDetails};
|
||||
use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect, Size2D as UntypedSize2D};
|
||||
use euclid::{Point2D, Scale, Size2D, Vector2D};
|
||||
|
@ -100,6 +99,18 @@ thread_local!(static SEEN_POINTERS: LazyCell<RefCell<HashSet<*const c_void>>> =
|
|||
LazyCell::new(|| RefCell::new(HashSet::new()))
|
||||
});
|
||||
|
||||
/// A CSS file to style the user agent stylesheet.
|
||||
static USER_AGENT_CSS: &[u8] = include_bytes!("./stylesheets/user-agent.css");
|
||||
|
||||
/// A CSS file to style the Servo browser.
|
||||
static SERVO_CSS: &[u8] = include_bytes!("./stylesheets/servo.css");
|
||||
|
||||
/// A CSS file to style the presentational hints.
|
||||
static PRESENTATIONAL_HINTS_CSS: &[u8] = include_bytes!("./stylesheets/presentational-hints.css");
|
||||
|
||||
/// A CSS file to style the quirks mode.
|
||||
static QUIRKS_MODE_CSS: &[u8] = include_bytes!("./stylesheets/quirks-mode.css");
|
||||
|
||||
/// Information needed by layout.
|
||||
pub struct LayoutThread {
|
||||
/// The ID of the pipeline that we belong to.
|
||||
|
@ -983,20 +994,12 @@ fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
|
|||
// FIXME: presentational-hints.css should be at author origin with zero specificity.
|
||||
// (Does it make a difference?)
|
||||
let mut user_or_user_agent_stylesheets = vec![
|
||||
parse_ua_stylesheet(
|
||||
shared_lock,
|
||||
"user-agent.css",
|
||||
&resources::read_bytes(Resource::UserAgentCSS),
|
||||
)?,
|
||||
parse_ua_stylesheet(
|
||||
shared_lock,
|
||||
"servo.css",
|
||||
&resources::read_bytes(Resource::ServoCSS),
|
||||
)?,
|
||||
parse_ua_stylesheet(shared_lock, "user-agent.css", USER_AGENT_CSS)?,
|
||||
parse_ua_stylesheet(shared_lock, "servo.css", SERVO_CSS)?,
|
||||
parse_ua_stylesheet(
|
||||
shared_lock,
|
||||
"presentational-hints.css",
|
||||
&resources::read_bytes(Resource::PresentationalHintsCSS),
|
||||
PRESENTATIONAL_HINTS_CSS,
|
||||
)?,
|
||||
];
|
||||
|
||||
|
@ -1017,11 +1020,8 @@ fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
|
|||
)));
|
||||
}
|
||||
|
||||
let quirks_mode_stylesheet = parse_ua_stylesheet(
|
||||
shared_lock,
|
||||
"quirks-mode.css",
|
||||
&resources::read_bytes(Resource::QuirksModeCSS),
|
||||
)?;
|
||||
let quirks_mode_stylesheet =
|
||||
parse_ua_stylesheet(shared_lock, "quirks-mode.css", QUIRKS_MODE_CSS)?;
|
||||
|
||||
Ok(UserAgentStylesheets {
|
||||
shared_lock: shared_lock.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue