mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
stylo: Disable text-zoom for <svg:text>
This commit is contained in:
parent
fb107d8cd5
commit
0e3f7d782b
5 changed files with 94 additions and 1 deletions
|
@ -191,6 +191,10 @@ impl Device {
|
|||
pub fn zoom_text(&self, size: Au) -> Au {
|
||||
size.scale_by(self.pres_context().mEffectiveTextZoom)
|
||||
}
|
||||
/// Un-apply text zoom (see nsStyleFont::UnzoomText).
|
||||
pub fn unzoom_text(&self, size: Au) -> Au {
|
||||
size.scale_by(1. / self.pres_context().mEffectiveTextZoom)
|
||||
}
|
||||
}
|
||||
|
||||
/// A expression for gecko contains a reference to the media feature, the value
|
||||
|
|
|
@ -1402,6 +1402,7 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
|
|||
where V: Push<ApplicableDeclarationBlock>,
|
||||
{
|
||||
use properties::longhands::_x_lang::SpecifiedValue as SpecifiedLang;
|
||||
use properties::longhands::_x_text_zoom::SpecifiedValue as SpecifiedZoom;
|
||||
use properties::longhands::color::SpecifiedValue as SpecifiedColor;
|
||||
use properties::longhands::text_align::SpecifiedValue as SpecifiedTextAlign;
|
||||
use values::specified::color::Color;
|
||||
|
@ -1433,6 +1434,15 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
|
|||
let arc = Arc::new(global_style_data.shared_lock.wrap(pdb));
|
||||
ApplicableDeclarationBlock::from_declarations(arc, ServoCascadeLevel::PresHints)
|
||||
};
|
||||
static ref SVG_TEXT_DISABLE_ZOOM_RULE: ApplicableDeclarationBlock = {
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let pdb = PropertyDeclarationBlock::with_one(
|
||||
PropertyDeclaration::XTextZoom(SpecifiedZoom(false)),
|
||||
Importance::Normal
|
||||
);
|
||||
let arc = Arc::new(global_style_data.shared_lock.wrap(pdb));
|
||||
ApplicableDeclarationBlock::from_declarations(arc, ServoCascadeLevel::PresHints)
|
||||
};
|
||||
};
|
||||
|
||||
let ns = self.get_namespace();
|
||||
|
@ -1445,6 +1455,11 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
|
|||
hints.push(TABLE_COLOR_RULE.clone());
|
||||
}
|
||||
}
|
||||
if ns == &*Namespace(atom!("http://www.w3.org/2000/svg")) {
|
||||
if self.get_local_name().as_ptr() == atom!("text").as_ptr() {
|
||||
hints.push(SVG_TEXT_DISABLE_ZOOM_RULE.clone());
|
||||
}
|
||||
}
|
||||
let declarations = unsafe { Gecko_GetHTMLPresentationAttrDeclarationBlock(self.0) };
|
||||
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
|
||||
declarations.and_then(|s| s.as_arc_opt());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue