mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Implement the body text color quirk in a more straight-forward way.
This avoids grabbing the document when values that inherit from the body, whatever that means, aren't under the body. In that case we'll get a semi-random value, but that's also mishandled by Gecko anyways (and probably Blink, though haven't tested), and doesn't really make much sense.
This commit is contained in:
parent
920585bd74
commit
bd314747da
8 changed files with 76 additions and 22 deletions
|
@ -289,19 +289,7 @@ impl ToComputedValue for Color {
|
|||
}
|
||||
#[cfg(feature = "gecko")]
|
||||
Color::InheritFromBodyQuirk => {
|
||||
use dom::TElement;
|
||||
use gecko::wrapper::GeckoElement;
|
||||
use gecko_bindings::bindings::Gecko_GetBody;
|
||||
let pres_context = context.device().pres_context();
|
||||
let body = unsafe { Gecko_GetBody(pres_context) }.map(GeckoElement);
|
||||
let data = body.as_ref().and_then(|wrap| wrap.borrow_data());
|
||||
if let Some(data) = data {
|
||||
ComputedColor::rgba(data.styles.primary()
|
||||
.get_color()
|
||||
.clone_color())
|
||||
} else {
|
||||
convert_nscolor_to_computedcolor(pres_context.mDefaultColor)
|
||||
}
|
||||
ComputedColor::rgba(context.device().body_text_color())
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue