mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 865806 - Part 1: Continue walking up the frame tree when hitting a transparent frame as we're trying to determine whether a given element's background is dark or not; r=roc
This heuristic improvement gives us correct dark background detection in pdf.js, among other cases. --HG-- extra : rebase_source : 5a8f920da1b63f6452ec709745b2154b6fc17ceb
This commit is contained in:
parent
b64aed8e7c
commit
574b61e8c5
@ -691,8 +691,13 @@ nsNativeTheme::IsDarkBackground(nsIFrame* aFrame)
|
||||
return false;
|
||||
|
||||
nsIFrame* frame = scrollFrame->GetScrolledFrame();
|
||||
nsStyleContext* bgSC;
|
||||
if (nsCSSRendering::FindBackground(frame, &bgSC)) {
|
||||
nsStyleContext* bgSC = nullptr;
|
||||
if (!nsCSSRendering::FindBackground(frame, &bgSC) ||
|
||||
bgSC->StyleBackground()->IsTransparent()) {
|
||||
nsIFrame* backgroundFrame = nsCSSRendering::FindNonTransparentBackgroundFrame(frame, true);
|
||||
nsCSSRendering::FindBackground(backgroundFrame, &bgSC);
|
||||
}
|
||||
if (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 document. This heuristic matches what
|
||||
|
Loading…
Reference in New Issue
Block a user