From 501212bba030b8ae8264c37bf81a7575b3347ca9 Mon Sep 17 00:00:00 2001 From: Oana Pop Rus Date: Sun, 13 Oct 2019 08:02:02 +0000 Subject: [PATCH 1/9] Bug 1580223 - Disable trackingProtectionException test on debug platform for frequent failures. r=gbrown Differential Revision: https://phabricator.services.mozilla.com/D48923 --HG-- extra : moz-landing-system : lando --- .../mozilla/geckoview/test/ContentBlockingControllerTest.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentBlockingControllerTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentBlockingControllerTest.kt index c33ce7e30fb2..ac273218f32b 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentBlockingControllerTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ContentBlockingControllerTest.kt @@ -7,6 +7,7 @@ package org.mozilla.geckoview.test import android.support.test.filters.MediumTest import android.support.test.runner.AndroidJUnit4 import org.hamcrest.Matchers +import org.hamcrest.Matchers.equalTo import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith @@ -15,13 +16,16 @@ import org.mozilla.geckoview.ContentBlockingController import org.mozilla.geckoview.GeckoSession import org.mozilla.geckoview.test.rule.GeckoSessionTestRule import org.mozilla.geckoview.test.util.Callbacks +import org.junit.Assume.assumeThat @RunWith(AndroidJUnit4::class) @MediumTest class ContentBlockingControllerTest : BaseSessionTest() { @GeckoSessionTestRule.Setting(key = GeckoSessionTestRule.Setting.Key.USE_TRACKING_PROTECTION, value = "true") +// disable test on debug for frequently failing #Bug 1580223 @Test fun trackingProtectionException() { + assumeThat(sessionRule.env.isDebugBuild, equalTo(false)) val category = ContentBlocking.AntiTracking.TEST sessionRule.runtime.settings.contentBlocking.setAntiTracking(category) sessionRule.session.loadTestPath(TRACKERS_PATH) From 850ac9c631322ef7a2f1d5110e310593b4645d96 Mon Sep 17 00:00:00 2001 From: Gabriele Svelto Date: Sun, 13 Oct 2019 04:20:45 +0000 Subject: [PATCH 2/9] Bug 1579758 - Block a nightly build of OpenSC which crashes Firefox; r=aklotz Differential Revision: https://phabricator.services.mozilla.com/D48296 --HG-- extra : moz-landing-system : lando --- mozglue/dllservices/WindowsDllBlocklistDefs.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mozglue/dllservices/WindowsDllBlocklistDefs.in b/mozglue/dllservices/WindowsDllBlocklistDefs.in index 67c8217b2cda..9d2173d2625e 100644 --- a/mozglue/dllservices/WindowsDllBlocklistDefs.in +++ b/mozglue/dllservices/WindowsDllBlocklistDefs.in @@ -194,8 +194,8 @@ ALL_PROCESSES += [ # Bug 1268470 - crashes with Kaspersky Lab on Windows 8 DllBlocklistEntry("klsihk64.dll", (14, 0, 456, 0xffff), BLOCK_WIN8_ONLY), - # Bug 1407337, crashes with OpenSC < 0.16.0 - DllBlocklistEntry("onepin-opensc-pkcs11.dll", (0, 15, 0xffff, 0xffff)), + # Bug 1579758, crashes with OpenSC nightly version 0.19.0.448 and lower + DllBlocklistEntry("onepin-opensc-pkcs11.dll", (0, 19, 0, 448)), # Avecto Privilege Guard causes crashes, bug 1385542 DllBlocklistEntry("pghook.dll", ALL_VERSIONS), From 536c1bc0bb5521584eaf3c8620862c0c24a33b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 12 Oct 2019 21:05:16 +0000 Subject: [PATCH 3/9] Bug 1581467 - Fix checks for display: inline{,-block} which don't account for inline list items. r=mats Differential Revision: https://phabricator.services.mozilla.com/D48346 --HG-- extra : moz-landing-system : lando --- dom/base/Element.cpp | 2 +- .../spellcheck/src/mozInlineSpellWordUtil.cpp | 19 +++- gfx/layers/apz/util/DoubleTapToZoom.cpp | 2 +- layout/base/nsCSSFrameConstructor.cpp | 2 +- layout/generic/ReflowInput.cpp | 2 +- layout/generic/nsFrame.cpp | 6 +- layout/generic/nsLineLayout.cpp | 5 +- .../css-grid/grid-abspos-items-016.html | 102 ++++++++++++++++++ layout/reftests/css-grid/reftest.list | 1 + layout/style/nsComputedDOMStyle.cpp | 3 +- layout/style/nsStyleConsts.h | 2 - layout/style/nsStyleStruct.h | 9 ++ .../client-props-inline-list-item.html | 26 +++++ 13 files changed, 162 insertions(+), 19 deletions(-) create mode 100644 layout/reftests/css-grid/grid-abspos-items-016.html create mode 100644 testing/web-platform/tests/css/cssom-view/client-props-inline-list-item.html diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 854844d92e22..0521e6e2f6a8 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -890,7 +890,7 @@ nsRect Element::GetClientAreaRect() { // The display check is OK even though we're not looking at the style // frame, because the style frame only differs from "frame" for tables, // and table wrappers have the same display as the table itself. - (frame->StyleDisplay()->mDisplay != StyleDisplay::Inline || + (!frame->StyleDisplay()->IsInlineFlow() || frame->IsFrameOfType(nsIFrame::eReplaced))) { // Special case code to make client area work even when there isn't // a scroll view, see bug 180552, bug 227567. diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp index a92ff60b0dd8..7b1e71432120 100644 --- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp +++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp @@ -684,17 +684,26 @@ static bool IsBreakElement(nsINode* aNode) { } dom::Element* element = aNode->AsElement(); - - if (element->IsHTMLElement(nsGkAtoms::br)) return true; + if (element->IsHTMLElement(nsGkAtoms::br)) { + return true; + } // If we don't have a frame, we don't consider ourselves a break // element. In particular, words can span us. - if (!element->GetPrimaryFrame()) return false; + nsIFrame* frame = element->GetPrimaryFrame(); + if (!frame) { + return false; + } + auto* disp = frame->StyleDisplay(); // Anything that's not an inline element is a break element. // XXXbz should replaced inlines be break elements, though? - return element->GetPrimaryFrame()->StyleDisplay()->mDisplay != - StyleDisplay::Inline; + // Also should inline-block and such be break elements? + // + // FIXME(emilio): We should teach the spell checker to deal with generated + // content (it doesn't at all), then remove the IsListItem() check, as there + // could be no marker, etc... + return !disp->IsInlineFlow() || disp->IsListItem(); } struct CheckLeavingBreakElementClosure { diff --git a/gfx/layers/apz/util/DoubleTapToZoom.cpp b/gfx/layers/apz/util/DoubleTapToZoom.cpp index c398565dd585..990795290b62 100644 --- a/gfx/layers/apz/util/DoubleTapToZoom.cpp +++ b/gfx/layers/apz/util/DoubleTapToZoom.cpp @@ -66,7 +66,7 @@ static already_AddRefed ElementFromPoint( static bool ShouldZoomToElement(const nsCOMPtr& aElement) { if (nsIFrame* frame = aElement->GetPrimaryFrame()) { - if (frame->GetDisplay() == StyleDisplay::Inline) { + if (frame->StyleDisplay()->IsInlineFlow()) { return false; } } diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index bbd83d480288..c48c97c2385b 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -5656,7 +5656,7 @@ void nsCSSFrameConstructor::AddFrameConstructionItemsInternal( // pseudos. ((bits & FCDATA_IS_TABLE_PART) && (!aParentFrame || // No aParentFrame means inline - aParentFrame->StyleDisplay()->mDisplay == StyleDisplay::Inline)) || + aParentFrame->StyleDisplay()->IsInlineFlow())) || // Things that are inline-outside but aren't inline frames are inline display.IsInlineOutsideStyle() || // Popups that are certainly out of flow. diff --git a/layout/generic/ReflowInput.cpp b/layout/generic/ReflowInput.cpp index e5fbdc8b14d9..b48c27f0c533 100644 --- a/layout/generic/ReflowInput.cpp +++ b/layout/generic/ReflowInput.cpp @@ -1328,7 +1328,7 @@ void ReflowInput::CalculateHypotheticalPosition( // the element had been in the flow nscoord boxISize; bool knowBoxISize = false; - if ((StyleDisplay::Inline == mStyleDisplay->mOriginalDisplay) && + if (mStyleDisplay->IsOriginalDisplayInlineOutside() && !NS_FRAME_IS_REPLACED(mFrameType)) { // For non-replaced inline-level elements the 'inline size' property // doesn't apply, so we don't know what the inline size would have diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 1be3d631a9b2..cb22a52521c7 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -546,8 +546,7 @@ static bool IsFontSizeInflationContainer(nsIFrame* aFrame, nsIContent* content = aFrame->GetContent(); LayoutFrameType frameType = aFrame->Type(); bool isInline = - (nsStyleDisplay::DisplayInside(aFrame->GetDisplay()) == - StyleDisplayInside::Inline || + (nsStyleDisplay::IsInlineFlow(aFrame->GetDisplay()) || RubyUtils::IsRubyBox(frameType) || (aFrame->IsFloating() && frameType == LayoutFrameType::Letter) || // Given multiple frames for the same node, only the @@ -5317,8 +5316,7 @@ static nsIFrame::ContentOffsets OffsetsForSingleFrame(nsIFrame* aFrame, // Figure out whether the offsets should be over, after, or before the frame nsRect rect(nsPoint(0, 0), aFrame->GetSize()); - bool isBlock = nsStyleDisplay::DisplayInside(aFrame->GetDisplay()) != - StyleDisplayInside::Inline; + bool isBlock = !aFrame->StyleDisplay()->IsInlineFlow(); bool isRtl = (aFrame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL); if ((isBlock && rect.y < aPoint.y) || diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 6bcb0e0a28d2..3e10f73c1b57 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -710,8 +710,9 @@ static bool IsPercentageAware(const nsIFrame* aFrame, WritingMode aWM) { // We need to check for frames that shrink-wrap when they're auto // width. const nsStyleDisplay* disp = aFrame->StyleDisplay(); - if (disp->mDisplay == StyleDisplay::InlineBlock || - disp->mDisplay == StyleDisplay::InlineTable || + if ((disp->DisplayOutside() == StyleDisplayOutside::Inline && + (disp->DisplayInside() == StyleDisplayInside::FlowRoot || + disp->DisplayInside() == StyleDisplayInside::Table)) || fType == LayoutFrameType::HTMLButtonControl || fType == LayoutFrameType::GfxButtonControl || fType == LayoutFrameType::FieldSet || diff --git a/layout/reftests/css-grid/grid-abspos-items-016.html b/layout/reftests/css-grid/grid-abspos-items-016.html new file mode 100644 index 000000000000..1d57461b99e9 --- /dev/null +++ b/layout/reftests/css-grid/grid-abspos-items-016.html @@ -0,0 +1,102 @@ + + + + + CSS Grid Test: abs pos static position (ancestor of grid container as abs.pos. CB) + + + + + + + + + + + + diff --git a/layout/reftests/css-grid/reftest.list b/layout/reftests/css-grid/reftest.list index cb468379d644..be0e8cc45ee4 100644 --- a/layout/reftests/css-grid/reftest.list +++ b/layout/reftests/css-grid/reftest.list @@ -30,6 +30,7 @@ fuzzy(0-180,0-3) == grid-abspos-items-002.html grid-abspos-items-002-ref.html # == grid-abspos-items-013.html grid-abspos-items-013-ref.html == grid-abspos-items-014.html grid-abspos-items-014-ref.html random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == grid-abspos-items-015.html grid-abspos-items-015-ref.html # Bug 1392106 +random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == grid-abspos-items-016.html grid-abspos-items-015-ref.html # Bug 1392106 == grid-order-abspos-items-001.html grid-order-abspos-items-001-ref.html == grid-order-placement-auto-001.html grid-order-placement-auto-001-ref.html fuzzy-if(skiaContent,0-1,0-200) == grid-order-placement-definite-001.html grid-order-placement-definite-001-ref.html diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 457ccc9c1db1..ccf718543ba1 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -854,8 +854,7 @@ static nsIFrame* StyleFrame(nsIFrame* aOuterFrame) { static bool IsNonReplacedInline(nsIFrame* aFrame) { // FIXME: this should be IsInlineInsideStyle() since width/height // doesn't apply to ruby boxes. - return aFrame->StyleDisplay()->DisplayInside() == - StyleDisplayInside::Inline && + return aFrame->StyleDisplay()->IsInlineFlow() && !aFrame->IsFrameOfType(nsIFrame::eReplaced); } diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index a0d4f9491241..963c66bd3856 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -40,8 +40,6 @@ enum class StyleDisplay : uint16_t { StyleDisplayFrom(StyleDisplayOutside::None, StyleDisplayInside::Contents), Inline = StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::Inline), - InlineBlock = StyleDisplayFrom(StyleDisplayOutside::Inline, - StyleDisplayInside::FlowRoot), Block = StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::Block), FlowRoot = StyleDisplayFrom(StyleDisplayOutside::Block, diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 2113ad74f48d..9f3ed01a50b8 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1630,6 +1630,15 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay { } bool IsListItem() const { return IsListItem(mDisplay); } + // Whether display is `inline` or `inline list-item`. + static bool IsInlineFlow(mozilla::StyleDisplay aDisplay) { + return DisplayInside(aDisplay) == mozilla::StyleDisplayInside::Inline; + } + + bool IsInlineFlow() const { + return IsInlineFlow(mDisplay); + } + bool IsInlineInsideStyle() const { auto inside = DisplayInside(); return inside == mozilla::StyleDisplayInside::Inline || diff --git a/testing/web-platform/tests/css/cssom-view/client-props-inline-list-item.html b/testing/web-platform/tests/css/cssom-view/client-props-inline-list-item.html new file mode 100644 index 000000000000..725bb787a5e6 --- /dev/null +++ b/testing/web-platform/tests/css/cssom-view/client-props-inline-list-item.html @@ -0,0 +1,26 @@ + +client* returns the same for non-replaced inlines regardless of list-item-ness + + + + + + + +
Foo
+
Foo
+ From 8657ceea273a452bd8c054af02c9424681753e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 13 Oct 2019 09:16:26 +0000 Subject: [PATCH 4/9] Bug 1584859 - Make smooth scrolling conditional on reduced motion settings. r=dbaron We could put this change itself behind a pref too, if we considered that worth it. But probably not so. Differential Revision: https://phabricator.services.mozilla.com/D48010 --HG-- extra : moz-landing-system : lando --- gfx/layers/apz/src/APZInputBridge.cpp | 3 ++- gfx/layers/apz/src/AsyncPanZoomController.cpp | 2 +- layout/base/nsLayoutUtils.cpp | 19 +++++++++++++++++++ layout/base/nsLayoutUtils.h | 9 +++++++++ layout/generic/nsGfxScrollFrame.cpp | 10 +++++----- layout/generic/nsGfxScrollFrame.h | 2 -- modules/libpref/init/StaticPrefList.yaml | 2 ++ widget/cocoa/nsChildView.mm | 3 ++- widget/nsXPLookAndFeel.cpp | 3 +++ 9 files changed, 43 insertions(+), 10 deletions(-) diff --git a/gfx/layers/apz/src/APZInputBridge.cpp b/gfx/layers/apz/src/APZInputBridge.cpp index c5e16b227eda..6eed50916dbb 100644 --- a/gfx/layers/apz/src/APZInputBridge.cpp +++ b/gfx/layers/apz/src/APZInputBridge.cpp @@ -19,6 +19,7 @@ #include "mozilla/TouchEvents.h" // for WidgetTouchEvent #include "mozilla/WheelHandlingHelper.h" // for WheelDeltaHorizontalizer, // WheelDeltaAdjustmentStrategy +#include "nsLayoutUtils.h" // for IsSmoothScrollingEnabled namespace mozilla { namespace layers { @@ -116,7 +117,7 @@ APZEventResult APZInputBridge::ReceiveInputEvent(WidgetInputEvent& aEvent) { if (Maybe action = ActionForWheelEvent(&wheelEvent)) { ScrollWheelInput::ScrollMode scrollMode = ScrollWheelInput::SCROLLMODE_INSTANT; - if (StaticPrefs::general_smoothScroll() && + if (nsLayoutUtils::IsSmoothScrollingEnabled() && ((wheelEvent.mDeltaMode == dom::WheelEvent_Binding::DOM_DELTA_LINE && StaticPrefs::general_smoothScroll_mouseWheel()) || diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 1de5b2a00be3..8e953daa1f2b 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2006,7 +2006,7 @@ nsEventStatus AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent) { MaybeAdjustDestinationForScrollSnapping(aEvent, destination); // If smooth scrolling is disabled, then scroll immediately to the destination - if (!StaticPrefs::general_smoothScroll()) { + if (!nsLayoutUtils::IsSmoothScrollingEnabled()) { CancelAnimation(); ParentLayerPoint startPoint, endPoint; diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 0c913183cd61..2425cf05703b 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -27,6 +27,7 @@ #include "mozilla/StaticPrefs_apz.h" #include "mozilla/StaticPrefs_dom.h" #include "mozilla/StaticPrefs_font.h" +#include "mozilla/StaticPrefs_general.h" #include "mozilla/StaticPrefs_gfx.h" #include "mozilla/StaticPrefs_layers.h" #include "mozilla/StaticPrefs_layout.h" @@ -7976,9 +7977,27 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame, return total; } +RelaxedAtomicBool nsLayoutUtils::gSmoothScrollingEnabled; + +void nsLayoutUtils::RecomputeSmoothScrollingEnabled() { + MOZ_RELEASE_ASSERT(NS_IsMainThread(), + "You don't really want to call into widget " + "off the main thread, do you?"); + gSmoothScrollingEnabled = + StaticPrefs::general_smoothScroll_DoNotUseDirectly() && + !LookAndFeel::GetInt(LookAndFeel::eIntID_PrefersReducedMotion, 0); +} + +static void SmoothScrollPrefChanged(const char*, void*) { + nsLayoutUtils::RecomputeSmoothScrollingEnabled(); +} + /* static */ void nsLayoutUtils::Initialize() { nsComputedDOMStyle::RegisterPrefChangeCallbacks(); + Preferences::RegisterCallbackAndCall( + SmoothScrollPrefChanged, + nsDependentCString(StaticPrefs::GetPrefName_general_smoothScroll())); } /* static */ diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 64b87b6199a1..f3180b25e82a 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2998,7 +2998,16 @@ class nsLayoutUtils { static bool FrameIsMostlyScrolledOutOfViewInCrossProcess( const nsIFrame* aFrame, nscoord aMargin); + static bool IsSmoothScrollingEnabled() { + return gSmoothScrollingEnabled; + } + + static void RecomputeSmoothScrollingEnabled(); + private: + + static mozilla::RelaxedAtomicBool gSmoothScrollingEnabled; + /** * Helper function for LogTestDataForPaint(). */ diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 753c653ae7d4..39e9ac94ddc2 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2026,10 +2026,6 @@ void ScrollFrameHelper::AsyncScroll::InitSmoothScroll( mAnimationPhysics->Update(aTime, aDestination, aCurrentVelocity); } -bool ScrollFrameHelper::IsSmoothScrollingEnabled() { - return StaticPrefs::general_smoothScroll(); -} - class ScrollFrameActivityTracker final : public nsExpirationTracker { public: @@ -2347,7 +2343,7 @@ void ScrollFrameHelper::ScrollToWithOrigin( ? presContext->RefreshDriver()->MostRecentRefresh() : TimeStamp::Now(); bool isSmoothScroll = - aMode == ScrollMode::Smooth && IsSmoothScrollingEnabled(); + aMode == ScrollMode::Smooth && nsLayoutUtils::IsSmoothScrollingEnabled(); nsSize currentVelocity(0, 0); @@ -7188,6 +7184,10 @@ bool ScrollFrameHelper::SmoothScrollVisual( } bool ScrollFrameHelper::IsSmoothScroll(dom::ScrollBehavior aBehavior) const { + if (!nsLayoutUtils::IsSmoothScrollingEnabled()) { + return false; + } + if (aBehavior == dom::ScrollBehavior::Smooth) { return true; } diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 0b124b56fee2..104a028bb823 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -116,8 +116,6 @@ class ScrollFrameHelper : public nsIReflowCallback { void PostScrolledAreaEvent(); void FireScrolledAreaEvent(); - bool IsSmoothScrollingEnabled(); - /** * @note This method might destroy the frame, pres shell and other objects. */ diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 81f4d591d977..f10babb55735 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -2959,10 +2959,12 @@ value: true mirror: always +# Use nsLayoutUtils::SmoothScrollingEnabled() instead. - name: general.smoothScroll type: RelaxedAtomicBool value: true mirror: always + do_not_use_directly: true # This pref and general.smoothScroll.stopDecelerationWeighting determine # the timing function. diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 30d22dd46841..515a98d18444 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -4705,7 +4705,8 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) { geckoChildDeathGrip->DispatchAPZWheelInputEvent(wheelEvent, false); } else { ScrollWheelInput::ScrollMode scrollMode = ScrollWheelInput::SCROLLMODE_INSTANT; - if (StaticPrefs::general_smoothScroll() && StaticPrefs::general_smoothScroll_mouseWheel()) { + if (nsLayoutUtils::IsSmoothScrollingEnabled() && + StaticPrefs::general_smoothScroll_mouseWheel()) { scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH; } ScrollWheelInput wheelEvent(eventIntervalTime, eventTimeStamp, modifiers, scrollMode, diff --git a/widget/nsXPLookAndFeel.cpp b/widget/nsXPLookAndFeel.cpp index 6059143ebdca..9ea82ea43d67 100644 --- a/widget/nsXPLookAndFeel.cpp +++ b/widget/nsXPLookAndFeel.cpp @@ -11,6 +11,7 @@ #include "nsLookAndFeel.h" #include "HeadlessLookAndFeel.h" #include "nsCRT.h" +#include "nsLayoutUtils.h" #include "nsFont.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/Preferences.h" @@ -993,6 +994,8 @@ void nsXPLookAndFeel::RefreshImpl() { for (i = 0; i < uint32_t(ColorID::End); ++i) { InitColorFromPref(i); } + + nsLayoutUtils::RecomputeSmoothScrollingEnabled(); } nsTArray nsXPLookAndFeel::GetIntCacheImpl() { From 725a18fe38c5371e21b016316a63c64d94847432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 12 Oct 2019 16:11:32 +0000 Subject: [PATCH 5/9] Bug 1585778 - Validate the input of nsDocumentViewer::GetContentSize to not violate the precondition of PresShell::ResizeReflow. r=dholbert For huge sizes we may end up with an unconstrained isize. Just avoid sizing the window to that. Differential Revision: https://phabricator.services.mozilla.com/D49062 --HG-- extra : moz-landing-system : lando --- layout/base/nsDocumentViewer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 898b514cf568..e91a6399467d 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -3176,6 +3176,12 @@ nsresult nsDocumentViewer::GetContentSizeInternal(int32_t* aWidth, prefWidth = aMaxWidth; } + // We should never intentionally get here with this sentinel value, but it's + // possible that a document with huge sizes might inadvertently have a + // prefWidth that exactly matches NS_UNCONSTRAINEDSIZE. + // Just bail if that happens. + NS_ENSURE_TRUE(prefWidth != NS_UNCONSTRAINEDSIZE, NS_ERROR_FAILURE); + nsresult rv = presShell->ResizeReflow(prefWidth, aMaxHeight, ResizeReflowOptions::BSizeLimit); NS_ENSURE_SUCCESS(rv, rv); From 39e0d5dc3259c1b1aa17b2fbacd5104bc0e682db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 13 Oct 2019 09:28:09 +0000 Subject: [PATCH 6/9] Bug 1588201 - Fix test_compute_data_with_start_struct.html to avoid leaving properties set around. r=xidorn This is causing problems since leaving a non-default appearance changes margins and borders. This was wallpapered by XBL failing to load a binding and leaving the element without frame as described in the bug. Differential Revision: https://phabricator.services.mozilla.com/D49061 --HG-- extra : moz-landing-system : lando --- .../test_compute_data_with_start_struct.html | 81 +++++++------------ 1 file changed, 29 insertions(+), 52 deletions(-) diff --git a/layout/style/test/test_compute_data_with_start_struct.html b/layout/style/test/test_compute_data_with_start_struct.html index 2e67b6269c68..6970270c9575 100644 --- a/layout/style/test/test_compute_data_with_start_struct.html +++ b/layout/style/test/test_compute_data_with_start_struct.html @@ -33,29 +33,8 @@ * style system code, and property cascading no longer relies on hand * written functions, so this particular failure mode isn't as likely to * happen. - * - * The test works by maintaining one style rule that has every CSS - * property specified, and a second style rule that has different values - * for every property, an element that matches only the first rule (so - * that we'll have a cached struct), and *later* an element that matches - * both rules (for whose computation we'll find the struct cached from - * the first element). (It does this twice, once with the overriding in - * each direction, because one of the cases might match the incorrect - * overwriting.) Then, in the second style rule, it unsets each - * property, one at a time, and checks that the computation works - * correctly. (The reason to want every property set is to hit a case - * where we can store the data in the rule tree... though this isn't - * guaranteed.) */ -function xfail_computecheck(prop, roundnum) { - return false; -} - -function xfail_test(prop, roundnum) { - return false; -} - var gStyleSheet = document.getElementById("stylesheet").sheet; var gRule1 = gStyleSheet.cssRules[gStyleSheet.insertRule("#base, #test {}", gStyleSheet.cssRules.length)]; var gRule2 = gStyleSheet.cssRules[gStyleSheet.insertRule("#test {}", gStyleSheet.cssRules.length)]; @@ -63,46 +42,44 @@ var gRule2 = gStyleSheet.cssRules[gStyleSheet.insertRule("#test {}", gStyleSheet var gBase = getComputedStyle(document.getElementById("base"), ""); var gTest = getComputedStyle(document.getElementById("test"), ""); -function round(lower_set, higher_set, roundnum) { +function test_property(prop, lower_set, higher_set) { + var info = gCSSProperties[prop]; + if (info.subproperties || info.logical) + return; - for (var prop in gCSSProperties) { - var info = gCSSProperties[prop]; - if (info.subproperties || info.logical) - continue; - gRule1.style.setProperty(prop, info[lower_set][0], ""); - gRule2.style.setProperty(prop, info[higher_set][0], ""); + gRule1.style.setProperty(prop, info[lower_set][0]); + gRule2.style.setProperty(prop, info[higher_set][0]); + + if ("prerequisites" in info) { + for (var prereq in info.prerequisites) { + gRule2.style.setProperty(prereq, info.prerequisites[prereq], ""); + } } - for (var prop in gCSSProperties) { - var info = gCSSProperties[prop]; - if (info.subproperties || info.logical) - continue; + gBase.getPropertyValue(prop); + var higher_set_val = gTest.getPropertyValue(prop); + gRule2.style.setProperty(prop, info[lower_set][0], ""); + var lower_set_val = gTest.getPropertyValue(prop); + isnot(higher_set_val, lower_set_val, "initial and other values of " + prop + " are different"); - if ("prerequisites" in info) { - for (var prereq in info.prerequisites) { - gRule2.style.setProperty(prereq, info.prerequisites[prereq], ""); - } - } + gRule2.style.removeProperty(prop); + is(gTest.getPropertyValue(prop), lower_set_val, prop + " is not touched when its value comes from aStartStruct"); - gBase.getPropertyValue(prop); - var higher_set_val = gTest.getPropertyValue(prop); - gRule2.style.setProperty(prop, info[lower_set][0], ""); - var lower_set_val = gTest.getPropertyValue(prop); - (xfail_computecheck(prop, roundnum) ? todo_isnot : isnot)(higher_set_val, lower_set_val, "initial and other values of " + prop + " are different"); - gRule2.style.removeProperty(prop); - (xfail_test(prop, roundnum) ? todo_is : is)(gTest.getPropertyValue(prop), lower_set_val, prop + " is not touched when its value comes from aStartStruct"); - - gRule2.style.setProperty(prop, info[higher_set][0], ""); - if ("prerequisites" in info) { - for (var prereq in info.prerequisites) { - gRule2.style.setProperty(prereq, gCSSProperties[prereq][higher_set][0], ""); - } + gRule1.style.removeProperty(prop); + if ("prerequisites" in info) { + for (var prereq in info.prerequisites) { + gRule2.style.removeProperty(prereq); } } } -round("other_values", "initial_values", 1); -round("initial_values", "other_values", 2); +function round(lower_set, higher_set) { + for (var prop in gCSSProperties) + test_property(prop, lower_set, higher_set); +} + +round("other_values", "initial_values"); +round("initial_values", "other_values"); From e7e8c1f79258417f0898d0bb861b273c8148882f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 13 Oct 2019 09:40:08 +0000 Subject: [PATCH 7/9] Bug 1559077 - Implement Element.part. r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D48707 --HG-- extra : moz-landing-system : lando --- dom/base/Element.cpp | 10 ++++++++++ dom/base/Element.h | 2 ++ dom/base/FragmentOrElement.cpp | 4 ++++ dom/base/FragmentOrElement.h | 5 +++++ dom/webidl/Element.webidl | 4 ++++ ...ation-change-part-name-idl-domtokenlist.html.ini | 4 ---- ...nvalidation-change-part-name-idl-setter.html.ini | 4 ---- .../css/css-shadow-parts/part-name-idl.html.ini | 13 ------------- 8 files changed, 25 insertions(+), 21 deletions(-) delete mode 100644 testing/web-platform/meta/css/css-shadow-parts/invalidation-change-part-name-idl-domtokenlist.html.ini delete mode 100644 testing/web-platform/meta/css/css-shadow-parts/invalidation-change-part-name-idl-setter.html.ini delete mode 100644 testing/web-platform/meta/css/css-shadow-parts/part-name-idl.html.ini diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 0521e6e2f6a8..3ef182b9b361 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -539,6 +539,16 @@ nsDOMTokenList* Element::ClassList() { return slots->mClassList; } +nsDOMTokenList* Element::Part() { + Element::nsDOMSlots* slots = DOMSlots(); + + if (!slots->mPart) { + slots->mPart = new nsDOMTokenList(this, nsGkAtoms::part); + } + + return slots->mPart; +} + void Element::GetAttributeNames(nsTArray& aResult) { uint32_t count = mAttrs.AttrCount(); for (uint32_t i = 0; i < count; ++i) { diff --git a/dom/base/Element.h b/dom/base/Element.h index 58cc122edbc5..5b9933513a72 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -1030,6 +1030,8 @@ class Element : public FragmentOrElement { } nsDOMTokenList* ClassList(); + nsDOMTokenList* Part(); + nsDOMAttributeMap* Attributes() { nsDOMSlots* slots = DOMSlots(); if (!slots->mAttributeMap) { diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index ca412df1f6f3..b5c5c1ca6fb7 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -597,6 +597,9 @@ void FragmentOrElement::nsDOMSlots::Traverse( NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCb, "mSlots->mClassList"); aCb.NoteXPCOMChild(mClassList.get()); + + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCb, "mSlots->mPart"); + aCb.NoteXPCOMChild(mPart.get()); } void FragmentOrElement::nsDOMSlots::Unlink() { @@ -608,6 +611,7 @@ void FragmentOrElement::nsDOMSlots::Unlink() { } mChildrenList = nullptr; mClassList = nullptr; + mPart = nullptr; } size_t FragmentOrElement::nsDOMSlots::SizeOfIncludingThis( diff --git a/dom/base/FragmentOrElement.h b/dom/base/FragmentOrElement.h index e6463a9db7e3..4a2d73528ecc 100644 --- a/dom/base/FragmentOrElement.h +++ b/dom/base/FragmentOrElement.h @@ -247,6 +247,11 @@ class FragmentOrElement : public nsIContent { * An object implementing the .classList property for this element. */ RefPtr mClassList; + + /** + * An object implementing the .part property for this element. + */ + RefPtr mPart; }; /** diff --git a/dom/webidl/Element.webidl b/dom/webidl/Element.webidl index 3154323134e8..01bf7fefacc8 100644 --- a/dom/webidl/Element.webidl +++ b/dom/webidl/Element.webidl @@ -33,6 +33,10 @@ interface Element : Node { [Constant, PutForwards=value] readonly attribute DOMTokenList classList; + // https://drafts.csswg.org/css-shadow-parts/#idl + [SameObject, PutForwards=value, Pref="layout.css.shadow-parts.enabled"] + readonly attribute DOMTokenList part; + [SameObject] readonly attribute NamedNodeMap attributes; [Pure] diff --git a/testing/web-platform/meta/css/css-shadow-parts/invalidation-change-part-name-idl-domtokenlist.html.ini b/testing/web-platform/meta/css/css-shadow-parts/invalidation-change-part-name-idl-domtokenlist.html.ini deleted file mode 100644 index 0e040feabbb8..000000000000 --- a/testing/web-platform/meta/css/css-shadow-parts/invalidation-change-part-name-idl-domtokenlist.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[invalidation-change-part-name-idl-domtokenlist.html] - [Part in selected host changed color via part IDL DOMTokenList attribute.] - expected: FAIL - diff --git a/testing/web-platform/meta/css/css-shadow-parts/invalidation-change-part-name-idl-setter.html.ini b/testing/web-platform/meta/css/css-shadow-parts/invalidation-change-part-name-idl-setter.html.ini deleted file mode 100644 index 86a4234681e1..000000000000 --- a/testing/web-platform/meta/css/css-shadow-parts/invalidation-change-part-name-idl-setter.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[invalidation-change-part-name-idl-setter.html] - [Part in selected host changed color via part IDL attribute setter.] - expected: FAIL - diff --git a/testing/web-platform/meta/css/css-shadow-parts/part-name-idl.html.ini b/testing/web-platform/meta/css/css-shadow-parts/part-name-idl.html.ini deleted file mode 100644 index 3801e8071747..000000000000 --- a/testing/web-platform/meta/css/css-shadow-parts/part-name-idl.html.ini +++ /dev/null @@ -1,13 +0,0 @@ -[part-name-idl.html] - [Access to .part returns an empty DOMTokenList.] - expected: FAIL - - [Changes in DOMTokenList are refected in attribute.] - expected: FAIL - - [DOMTokenList created by access is persisted.] - expected: FAIL - - [Multiple names give a DOMTokenList with multiple entries.] - expected: FAIL - From 5fb0032a5109ef7d922daaf7c123e6c4b96f17ca Mon Sep 17 00:00:00 2001 From: Jorg K Date: Sun, 13 Oct 2019 00:07:50 +0000 Subject: [PATCH 8/9] Bug 1588065 - Fix namespace issues in nsDocShellLoadState.h. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D49063 --HG-- extra : moz-landing-system : lando --- docshell/base/nsDocShellLoadState.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docshell/base/nsDocShellLoadState.h b/docshell/base/nsDocShellLoadState.h index 66ce7503b89f..b5a60b3108aa 100644 --- a/docshell/base/nsDocShellLoadState.h +++ b/docshell/base/nsDocShellLoadState.h @@ -200,14 +200,14 @@ class nsDocShellLoadState final { void SetOriginalURIString(const nsCString& aOriginalURI) { mOriginalURIString.emplace(aOriginalURI); } - const Maybe& GetOriginalURIString() const { + const mozilla::Maybe& GetOriginalURIString() const { return mOriginalURIString; } void SetCancelContentJSEpoch(int32_t aCancelEpoch) { mCancelContentJSEpoch.emplace(aCancelEpoch); } - const Maybe& GetCancelContentJSEpoch() const { + const mozilla::Maybe& GetCancelContentJSEpoch() const { return mCancelContentJSEpoch; } @@ -361,11 +361,11 @@ class nsDocShellLoadState final { // An optional string representation of mURI, before any // fixups were applied, so that we can send it to a search // engine service if needed. - Maybe mOriginalURIString; + mozilla::Maybe mOriginalURIString; // An optional value to pass to nsIDocShell::setCancelJSEpoch // when initiating the load. - Maybe mCancelContentJSEpoch; + mozilla::Maybe mCancelContentJSEpoch; }; #endif /* nsDocShellLoadState_h__ */ From 8a7bc2ad4e9c5e2c231f6259f01eff18f6ff301c Mon Sep 17 00:00:00 2001 From: Oana Pop Rus Date: Sun, 13 Oct 2019 14:06:44 +0300 Subject: [PATCH 9/9] Backed out changeset 77357e0aa88e (bug 1584859) for wpt and mochitest failures. on a CLOSED TREE --- gfx/layers/apz/src/APZInputBridge.cpp | 3 +-- gfx/layers/apz/src/AsyncPanZoomController.cpp | 2 +- layout/base/nsLayoutUtils.cpp | 19 ------------------- layout/base/nsLayoutUtils.h | 9 --------- layout/generic/nsGfxScrollFrame.cpp | 10 +++++----- layout/generic/nsGfxScrollFrame.h | 2 ++ modules/libpref/init/StaticPrefList.yaml | 2 -- widget/cocoa/nsChildView.mm | 3 +-- widget/nsXPLookAndFeel.cpp | 3 --- 9 files changed, 10 insertions(+), 43 deletions(-) diff --git a/gfx/layers/apz/src/APZInputBridge.cpp b/gfx/layers/apz/src/APZInputBridge.cpp index 6eed50916dbb..c5e16b227eda 100644 --- a/gfx/layers/apz/src/APZInputBridge.cpp +++ b/gfx/layers/apz/src/APZInputBridge.cpp @@ -19,7 +19,6 @@ #include "mozilla/TouchEvents.h" // for WidgetTouchEvent #include "mozilla/WheelHandlingHelper.h" // for WheelDeltaHorizontalizer, // WheelDeltaAdjustmentStrategy -#include "nsLayoutUtils.h" // for IsSmoothScrollingEnabled namespace mozilla { namespace layers { @@ -117,7 +116,7 @@ APZEventResult APZInputBridge::ReceiveInputEvent(WidgetInputEvent& aEvent) { if (Maybe action = ActionForWheelEvent(&wheelEvent)) { ScrollWheelInput::ScrollMode scrollMode = ScrollWheelInput::SCROLLMODE_INSTANT; - if (nsLayoutUtils::IsSmoothScrollingEnabled() && + if (StaticPrefs::general_smoothScroll() && ((wheelEvent.mDeltaMode == dom::WheelEvent_Binding::DOM_DELTA_LINE && StaticPrefs::general_smoothScroll_mouseWheel()) || diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 8e953daa1f2b..1de5b2a00be3 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2006,7 +2006,7 @@ nsEventStatus AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent) { MaybeAdjustDestinationForScrollSnapping(aEvent, destination); // If smooth scrolling is disabled, then scroll immediately to the destination - if (!nsLayoutUtils::IsSmoothScrollingEnabled()) { + if (!StaticPrefs::general_smoothScroll()) { CancelAnimation(); ParentLayerPoint startPoint, endPoint; diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 2425cf05703b..0c913183cd61 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -27,7 +27,6 @@ #include "mozilla/StaticPrefs_apz.h" #include "mozilla/StaticPrefs_dom.h" #include "mozilla/StaticPrefs_font.h" -#include "mozilla/StaticPrefs_general.h" #include "mozilla/StaticPrefs_gfx.h" #include "mozilla/StaticPrefs_layers.h" #include "mozilla/StaticPrefs_layout.h" @@ -7977,27 +7976,9 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame, return total; } -RelaxedAtomicBool nsLayoutUtils::gSmoothScrollingEnabled; - -void nsLayoutUtils::RecomputeSmoothScrollingEnabled() { - MOZ_RELEASE_ASSERT(NS_IsMainThread(), - "You don't really want to call into widget " - "off the main thread, do you?"); - gSmoothScrollingEnabled = - StaticPrefs::general_smoothScroll_DoNotUseDirectly() && - !LookAndFeel::GetInt(LookAndFeel::eIntID_PrefersReducedMotion, 0); -} - -static void SmoothScrollPrefChanged(const char*, void*) { - nsLayoutUtils::RecomputeSmoothScrollingEnabled(); -} - /* static */ void nsLayoutUtils::Initialize() { nsComputedDOMStyle::RegisterPrefChangeCallbacks(); - Preferences::RegisterCallbackAndCall( - SmoothScrollPrefChanged, - nsDependentCString(StaticPrefs::GetPrefName_general_smoothScroll())); } /* static */ diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index f3180b25e82a..64b87b6199a1 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2998,16 +2998,7 @@ class nsLayoutUtils { static bool FrameIsMostlyScrolledOutOfViewInCrossProcess( const nsIFrame* aFrame, nscoord aMargin); - static bool IsSmoothScrollingEnabled() { - return gSmoothScrollingEnabled; - } - - static void RecomputeSmoothScrollingEnabled(); - private: - - static mozilla::RelaxedAtomicBool gSmoothScrollingEnabled; - /** * Helper function for LogTestDataForPaint(). */ diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 39e9ac94ddc2..753c653ae7d4 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2026,6 +2026,10 @@ void ScrollFrameHelper::AsyncScroll::InitSmoothScroll( mAnimationPhysics->Update(aTime, aDestination, aCurrentVelocity); } +bool ScrollFrameHelper::IsSmoothScrollingEnabled() { + return StaticPrefs::general_smoothScroll(); +} + class ScrollFrameActivityTracker final : public nsExpirationTracker { public: @@ -2343,7 +2347,7 @@ void ScrollFrameHelper::ScrollToWithOrigin( ? presContext->RefreshDriver()->MostRecentRefresh() : TimeStamp::Now(); bool isSmoothScroll = - aMode == ScrollMode::Smooth && nsLayoutUtils::IsSmoothScrollingEnabled(); + aMode == ScrollMode::Smooth && IsSmoothScrollingEnabled(); nsSize currentVelocity(0, 0); @@ -7184,10 +7188,6 @@ bool ScrollFrameHelper::SmoothScrollVisual( } bool ScrollFrameHelper::IsSmoothScroll(dom::ScrollBehavior aBehavior) const { - if (!nsLayoutUtils::IsSmoothScrollingEnabled()) { - return false; - } - if (aBehavior == dom::ScrollBehavior::Smooth) { return true; } diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 104a028bb823..0b124b56fee2 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -116,6 +116,8 @@ class ScrollFrameHelper : public nsIReflowCallback { void PostScrolledAreaEvent(); void FireScrolledAreaEvent(); + bool IsSmoothScrollingEnabled(); + /** * @note This method might destroy the frame, pres shell and other objects. */ diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index f10babb55735..81f4d591d977 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -2959,12 +2959,10 @@ value: true mirror: always -# Use nsLayoutUtils::SmoothScrollingEnabled() instead. - name: general.smoothScroll type: RelaxedAtomicBool value: true mirror: always - do_not_use_directly: true # This pref and general.smoothScroll.stopDecelerationWeighting determine # the timing function. diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 515a98d18444..30d22dd46841 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -4705,8 +4705,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) { geckoChildDeathGrip->DispatchAPZWheelInputEvent(wheelEvent, false); } else { ScrollWheelInput::ScrollMode scrollMode = ScrollWheelInput::SCROLLMODE_INSTANT; - if (nsLayoutUtils::IsSmoothScrollingEnabled() && - StaticPrefs::general_smoothScroll_mouseWheel()) { + if (StaticPrefs::general_smoothScroll() && StaticPrefs::general_smoothScroll_mouseWheel()) { scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH; } ScrollWheelInput wheelEvent(eventIntervalTime, eventTimeStamp, modifiers, scrollMode, diff --git a/widget/nsXPLookAndFeel.cpp b/widget/nsXPLookAndFeel.cpp index 9ea82ea43d67..6059143ebdca 100644 --- a/widget/nsXPLookAndFeel.cpp +++ b/widget/nsXPLookAndFeel.cpp @@ -11,7 +11,6 @@ #include "nsLookAndFeel.h" #include "HeadlessLookAndFeel.h" #include "nsCRT.h" -#include "nsLayoutUtils.h" #include "nsFont.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/Preferences.h" @@ -994,8 +993,6 @@ void nsXPLookAndFeel::RefreshImpl() { for (i = 0; i < uint32_t(ColorID::End); ++i) { InitColorFromPref(i); } - - nsLayoutUtils::RecomputeSmoothScrollingEnabled(); } nsTArray nsXPLookAndFeel::GetIntCacheImpl() {