mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
stylo: Handle text-zoom for scriptminsize
This commit is contained in:
parent
16d46eaf7a
commit
613012d9fb
1 changed files with 9 additions and 6 deletions
|
@ -2241,8 +2241,8 @@ fn static_assert() {
|
||||||
pub fn apply_font_size(&mut self, v: longhands::font_size::computed_value::T,
|
pub fn apply_font_size(&mut self, v: longhands::font_size::computed_value::T,
|
||||||
parent: &Self,
|
parent: &Self,
|
||||||
device: &Device) -> Option<Au> {
|
device: &Device) -> Option<Au> {
|
||||||
let (adjusted_size, adjusted_unconstrained_size)
|
let (adjusted_size, adjusted_unconstrained_size) =
|
||||||
= self.calculate_script_level_size(parent);
|
self.calculate_script_level_size(parent, device);
|
||||||
// In this case, we have been unaffected by scriptminsize, ignore it
|
// In this case, we have been unaffected by scriptminsize, ignore it
|
||||||
if parent.gecko.mSize == parent.gecko.mScriptUnconstrainedSize &&
|
if parent.gecko.mSize == parent.gecko.mScriptUnconstrainedSize &&
|
||||||
adjusted_size == adjusted_unconstrained_size {
|
adjusted_size == adjusted_unconstrained_size {
|
||||||
|
@ -2321,7 +2321,7 @@ fn static_assert() {
|
||||||
/// will be set to the value of that unit computed against the parent
|
/// will be set to the value of that unit computed against the parent
|
||||||
/// unconstrained size, whereas the font size will be set computing against
|
/// unconstrained size, whereas the font size will be set computing against
|
||||||
/// the parent font size.
|
/// the parent font size.
|
||||||
pub fn calculate_script_level_size(&self, parent: &Self) -> (Au, Au) {
|
pub fn calculate_script_level_size(&self, parent: &Self, device: &Device) -> (Au, Au) {
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
let delta = self.gecko.mScriptLevel - parent.gecko.mScriptLevel;
|
let delta = self.gecko.mScriptLevel - parent.gecko.mScriptLevel;
|
||||||
|
@ -2333,8 +2333,11 @@ fn static_assert() {
|
||||||
return (parent_size, parent_unconstrained_size)
|
return (parent_size, parent_unconstrained_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// XXXManishearth this should also handle text zoom
|
|
||||||
let min = Au(parent.gecko.mScriptMinSize);
|
let mut min = Au(parent.gecko.mScriptMinSize);
|
||||||
|
if self.gecko.mAllowZoom {
|
||||||
|
min = device.zoom_text(min);
|
||||||
|
}
|
||||||
|
|
||||||
let scale = (parent.gecko.mScriptSizeMultiplier as f32).powi(delta as i32);
|
let scale = (parent.gecko.mScriptSizeMultiplier as f32).powi(delta as i32);
|
||||||
|
|
||||||
|
@ -2371,7 +2374,7 @@ fn static_assert() {
|
||||||
kw_inherited_size: Option<Au>,
|
kw_inherited_size: Option<Au>,
|
||||||
device: &Device) -> bool {
|
device: &Device) -> bool {
|
||||||
let (adjusted_size, adjusted_unconstrained_size)
|
let (adjusted_size, adjusted_unconstrained_size)
|
||||||
= self.calculate_script_level_size(parent);
|
= self.calculate_script_level_size(parent, device);
|
||||||
if adjusted_size.0 != parent.gecko.mSize ||
|
if adjusted_size.0 != parent.gecko.mSize ||
|
||||||
adjusted_unconstrained_size.0 != parent.gecko.mScriptUnconstrainedSize {
|
adjusted_unconstrained_size.0 != parent.gecko.mScriptUnconstrainedSize {
|
||||||
// This is incorrect. When there is both a keyword size being inherited
|
// This is incorrect. When there is both a keyword size being inherited
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue