mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Fix serialization of @namespace rule.
This code comes from: https://hg.mozilla.org/mozilla-central/rev/2418cfba72c33c5623f6fb4c243c5203819c8240 I audited other callers of write_str, they seem ok. Differential Revision: https://phabricator.services.mozilla.com/D54601
This commit is contained in:
parent
7cd59da2a0
commit
d954f516e9
1 changed files with 7 additions and 7 deletions
|
@ -7,8 +7,9 @@
|
|||
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::{Namespace, Prefix};
|
||||
use cssparser::SourceLocation;
|
||||
use cssparser::{self, SourceLocation};
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
|
||||
/// A `@namespace` rule.
|
||||
#[derive(Clone, Debug, PartialEq, ToShmem)]
|
||||
|
@ -27,13 +28,12 @@ impl ToCssWithGuard for NamespaceRule {
|
|||
fn to_css(&self, _guard: &SharedRwLockReadGuard, dest: &mut CssStringWriter) -> fmt::Result {
|
||||
dest.write_str("@namespace ")?;
|
||||
if let Some(ref prefix) = self.prefix {
|
||||
dest.write_str(&*prefix.to_string())?;
|
||||
let prefix = prefix.to_string();
|
||||
cssparser::serialize_identifier(&prefix, dest)?;
|
||||
dest.write_str(" ")?;
|
||||
}
|
||||
|
||||
// FIXME(emilio): Pretty sure this needs some escaping, or something?
|
||||
dest.write_str("url(\"")?;
|
||||
dest.write_str(&*self.url.to_string())?;
|
||||
dest.write_str("\");")
|
||||
dest.write_str("url(")?;
|
||||
self.url.to_string().to_css(&mut CssWriter::new(dest))?;
|
||||
dest.write_str(");")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue