From d1cf343ec6f63533f292ec5a81e2a30fb412feaf Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Tue, 21 May 2013 16:27:31 +0200 Subject: [PATCH 1/2] Bug 874391 - Missing nullchecks in nsNativeTheme::IsDarkBackground(nsIFrame*), r=roc --HG-- extra : rebase_source : e9161f3fbce9b53e4c74314cc94fb9556f7a9548 --- widget/xpwidgets/nsNativeTheme.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/widget/xpwidgets/nsNativeTheme.cpp b/widget/xpwidgets/nsNativeTheme.cpp index 3ea6e4808b7..ece8748e567 100644 --- a/widget/xpwidgets/nsNativeTheme.cpp +++ b/widget/xpwidgets/nsNativeTheme.cpp @@ -682,11 +682,14 @@ 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)) { From 423c99257319387aca1f3ee7ecaf53773259b813 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 21 May 2013 11:04:16 -0400 Subject: [PATCH 2/2] Bug 865806 follow-up: fix a typo DONTBUILD because this is a comment change. --HG-- extra : transplant_source : %7D%C6%13%95%CE%3C%01U%CB7%E8%CF%E3%14%87%14%05%C8G%FD --- widget/xpwidgets/nsNativeTheme.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/xpwidgets/nsNativeTheme.cpp b/widget/xpwidgets/nsNativeTheme.cpp index ece8748e567..b0a6185e8a7 100644 --- a/widget/xpwidgets/nsNativeTheme.cpp +++ b/widget/xpwidgets/nsNativeTheme.cpp @@ -695,7 +695,7 @@ nsNativeTheme::IsDarkBackground(nsIFrame* aFrame) 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;