stylo: Add support for <table> color quirk

MozReview-Commit-ID: 56IKARwfbhw
This commit is contained in:
Manish Goregaokar 2017-03-26 13:53:34 -07:00 committed by Manish Goregaokar
parent 0392e58a2f
commit 1c23296d8a
No known key found for this signature in database
GPG key ID: 3BBF4D3E2EF79F98
6 changed files with 62 additions and 25 deletions

View file

@ -209,6 +209,24 @@ impl ToComputedValue for specified::Color {
specified::Color::MozHyperlinktext => to_rgba(pres_context.mLinkColor),
specified::Color::MozActiveHyperlinktext => to_rgba(pres_context.mActiveLinkColor),
specified::Color::MozVisitedHyperlinktext => to_rgba(pres_context.mVisitedLinkColor),
specified::Color::InheritFromBodyQuirk => {
use dom::TElement;
use gecko_bindings::bindings::Gecko_GetBody;
use gecko::wrapper::GeckoElement;
let body = unsafe {
Gecko_GetBody(pres_context)
};
if let Some(body) = body {
let wrap = GeckoElement(body);
let borrow = wrap.borrow_data();
borrow.as_ref().unwrap()
.styles().primary.values()
.get_color()
.clone_color()
} else {
to_rgba(pres_context.mDefaultColor)
}
},
}
}
@ -239,13 +257,10 @@ impl ToComputedValue for specified::CSSColor {
#[inline]
fn from_computed_value(computed: &CSSColor) -> Self {
specified::CSSColor {
parsed: match *computed {
CSSColor::RGBA(rgba) => specified::Color::RGBA(rgba),
CSSColor::CurrentColor => specified::Color::CurrentColor,
},
authored: None,
}
(match *computed {
CSSColor::RGBA(rgba) => specified::Color::RGBA(rgba),
CSSColor::CurrentColor => specified::Color::CurrentColor,
}).into()
}
}