mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to inbound.
This commit is contained in:
commit
5465c5b995
@ -682,17 +682,20 @@ nsNativeTheme::IsRangeHorizontal(nsIFrame* aFrame)
|
||||
bool
|
||||
nsNativeTheme::IsDarkBackground(nsIFrame* aFrame)
|
||||
{
|
||||
nsIScrollableFrame* scrollFrame = aFrame->GetScrollTargetFrame();
|
||||
nsIScrollableFrame* scrollFrame = nullptr;
|
||||
while (!scrollFrame && aFrame) {
|
||||
aFrame = aFrame->GetParent();
|
||||
scrollFrame = aFrame->GetScrollTargetFrame();
|
||||
aFrame = aFrame->GetParent();
|
||||
}
|
||||
if (!scrollFrame)
|
||||
return false;
|
||||
|
||||
nsIFrame* frame = scrollFrame->GetScrolledFrame();
|
||||
nsStyleContext* bgSC;
|
||||
if (nsCSSRendering::FindBackground(frame, &bgSC)) {
|
||||
nscolor bgColor = bgSC->StyleBackground()->mBackgroundColor;
|
||||
// Consider the background color dark if the sum of the r, g and b values is
|
||||
// less than 384 in a semi-transparent docement. This heuristic matches what
|
||||
// less than 384 in a semi-transparent document. This heuristic matches what
|
||||
// WebKit does, and we can improve it later if needed.
|
||||
return NS_GET_A(bgColor) > 127 &&
|
||||
NS_GET_R(bgColor) + NS_GET_G(bgColor) + NS_GET_B(bgColor) < 384;
|
||||
|
Loading…
Reference in New Issue
Block a user