From 96dfb2e6dfe677c3b79d6fc5710057a848007db1 Mon Sep 17 00:00:00 2001 From: JustOff Date: Thu, 21 Mar 2019 21:45:08 +0200 Subject: The result of adding any percentage factor to a size that is zero should also be zero --- layout/base/nsLayoutUtils.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'layout/base') diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 63253fd10..0a82dbf6a 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1439,13 +1439,14 @@ public: /** * This function increases an initial intrinsic size, 'aCurrent', according * to the given 'aPercent', such that the size-increase makes up exactly - * 'aPercent' percent of the returned value. If 'aPercent' is less than - * or equal to zero the original 'aCurrent' value is returned. If 'aPercent' - * is greater than or equal to 1.0 the value nscoord_MAX is returned. + * 'aPercent' percent of the returned value. If 'aPercent' or 'aCurrent' are + * less than or equal to zero the original 'aCurrent' value is returned. + * If 'aPercent' is greater than or equal to 1.0 the value nscoord_MAX is + * returned. */ static nscoord AddPercents(nscoord aCurrent, float aPercent) { - if (aPercent > 0.0f) { + if (aPercent > 0.0f && aCurrent > 0) { return MOZ_UNLIKELY(aPercent >= 1.0f) ? nscoord_MAX : NSToCoordRound(float(aCurrent) / (1.0f - aPercent)); } -- cgit v1.2.3 From 5ea1d913c2072f14be550c628ed71c1b91d700c0 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sat, 23 Mar 2019 10:20:01 +0100 Subject: Grab caching capturing content with local variable. --- layout/base/nsPresShell.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'layout/base') diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 969ebc962..5dfbb8dba 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -7296,11 +7296,11 @@ PresShell::HandleEvent(nsIFrame* aFrame, return NS_OK; } - nsIContent* capturingContent = ((aEvent->mClass == ePointerEventClass || - aEvent->mClass == eWheelEventClass || - aEvent->HasMouseEventMessage()) - ? GetCapturingContent() - : nullptr); + nsCOMPtr capturingContent = ((aEvent->mClass == ePointerEventClass || + aEvent->mClass == eWheelEventClass || + aEvent->HasMouseEventMessage()) + ? GetCapturingContent() + : nullptr); nsCOMPtr retargetEventDoc; if (!aDontRetargetEvents) { -- cgit v1.2.3