зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to m-c.
This commit is contained in:
Коммит
b09f53151c
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче