diff --git a/editor/libeditor/crashtests/crashtests.list b/editor/libeditor/crashtests/crashtests.list index 9a59044dea..d5da383c5f 100644 --- a/editor/libeditor/crashtests/crashtests.list +++ b/editor/libeditor/crashtests/crashtests.list @@ -20,7 +20,7 @@ load 448329-3.html load 456727-1.html load 456727-2.html load 459613.html -needs-focus asserts(0-1) load 467647-1.html # bug 414178 +needs-focus load 467647-1.html load 475132-1.xhtml load 499844-1.html load 503709-1.xhtml @@ -39,7 +39,7 @@ load 643786-1.html load 682650-1.html load 713427-1.html load 713427-2.xhtml -asserts(0-1) load 716456-1.html +load 716456-1.html load 759748.html load 761861.html load 762183.html diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index 820c945aba..3e6375e42d 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -7,7 +7,7 @@ load 56746-1.html load 89101-1.html load 89358-1.html load 90205-1.html -skip-if((OSX==1007||OSX==1008)&&browserIsRemote) load 99776-1.html # Bug 849747 +skip-if(cocoaWidget&&browserIsRemote) load 99776-1.html # Bug 849747 load 118931-1.html load 121533-1.html load 123049-1.html @@ -21,7 +21,7 @@ load 143862-2.html load 147320-1.html load 148245-1.html load 149014-1.html -skip load 150431-1.html # slow test +load 150431-1.html load 176915-1.html load 191272-1.html load 199696-1.html @@ -153,7 +153,7 @@ load 374297-2.html load 376223-1.xhtml asserts(0-99) load 378325-1.html # bug 531589 load 378682.html -asserts(0-3) load 379105-1.xhtml # bug 570215, bug 479160 +load 379105-1.xhtml load 379419-1.xhtml load 379768-1.html load 379799-1.html @@ -364,7 +364,7 @@ load 576649-1.html load 579655.html load 580494-1.html load 580834-1.xhtml -asserts(0-13) load 589787.html # bug 574889 +load 589787.html load 595039-1.html load 597924-1.html load 606432-1.html @@ -420,12 +420,12 @@ load 772306.html load 788360.html load 793848.html load 795646.html -skip-if(1) load 802902.html # bug 901752 +skip load 802902.html # bug 901752 load 806056-1.html load 806056-2.html load 812665.html load 813372-1.html -asserts(0-4) load 817219.html # bug 623436 +load 817219.html load 818454.html asserts-if(gtkWidget,0-1) load 822865.html # bug 540078 load 824862.html @@ -445,7 +445,7 @@ load 876221.html load 897852.html asserts-if(Android,2) asserts-if(!Android,4-6) load 898913.html # bug 847368 pref(layers.acceleration.disabled,true) pref(layers.force-active,true) load 919434.html -pref(layout.css.sticky.enabled,true) load 926728.html +load 926728.html load 930381.html load 931450.html load 931460-1.html diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index 6919c8de1e..9e988a590c 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -346,7 +346,7 @@ load 478170-1.html load 478185-1.html asserts-if(!Android,0-1) load 479938-1.html # Bug 575011 load 480345-1.html -skip-if(Android) load 481921.html +load 481921.html load 489462-1.html load 489477.html load 489480-1.xhtml @@ -363,7 +363,7 @@ load 496742.html load 499138.html load 499862-1.html load 499857-1.html -asserts-if(winWidget,0-3) load 499885-1.xhtml +asserts-if(winWidget&&!(/^Windows\x20NT\x205\.1/.test(http.oscpu)),3) load 499885-1.xhtml # Bug 1220265 load 501535-1.html load 503961-1.xhtml load 503961-2.html @@ -423,7 +423,7 @@ load 586973-1.html load 589002-1.html load 590404.html load 591141.html -asserts(0-1) load 592118.html +load 592118.html load 594808-1.html load 595435-1.xhtml load 595740-1.html @@ -456,7 +456,7 @@ load text-overflow-form-elements.html load text-overflow-iframe.html load text-overflow-bug666751-1.html load text-overflow-bug666751-2.html -asserts(0-1) load text-overflow-bug670564.xhtml +load text-overflow-bug670564.xhtml load text-overflow-bug671796.xhtml load 667025.html load 673770.html # bug 569193 and bug 459597 @@ -472,8 +472,8 @@ load 700031.xhtml load 718516.html load 723108.html load 724235.html -skip-if(OSX=1010&&isDebugBuild) load 724978.xhtml -skip-if(OSX=1010&&isDebugBuild) load 730559.html +load 724978.xhtml +load 730559.html load first-letter-638937.html load first-letter-638937-2.html load 734777.html @@ -493,7 +493,7 @@ load 769303-2.html load 769120.html load 777838.html load 783228.html -skip-if(Android) load 784600.html +load 784600.html load 785555.html load 786740-1.html asserts(0-4) test-pref(font.size.inflation.emPerLine,15) load 791601.xhtml # 3 counts of bug 871327, 1 bug 367185 @@ -545,15 +545,15 @@ asserts-if(Android,0-4) asserts-if(!Android,1-4) load 876074-1.html # bug 876749 load 885009-1.html load 893496-1.html load 893523.html -asserts(0-3) load 898871.html # bug 479160 -test-pref(layout.css.sticky.enabled,true) load 914891.html -test-pref(layout.css.sticky.enabled,true) load 915475.xhtml +asserts-if(cocoaWidget,0-3) load 898871.html # bug 479160 +load 914891.html +load 915475.xhtml load 927558.html load 943509-1.html asserts(3-8) load 944909-1.html load 946167-1.html load 947158.html -test-pref(layout.css.sticky.enabled,true) load 949932.html +load 949932.html load 970710.html load 973701-1.xhtml load 973701-2.xhtml @@ -583,11 +583,6 @@ load 1134531.html load 1134667.html load 1137723-1.html load 1137723-2.html -# The tests for bug 1137723 above causes delayed assertions too, -# the next 3 lines can be removed once that is fixed. -asserts(0-3) load 1134667.html -asserts(0-3) load 1134667.html -asserts(0-3) load 1134667.html load 1146103.html load 1146107.html load 1146114.html diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index dcf5679c19..fbd5c68eff 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2092,6 +2092,12 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition, nsRect range = aRange ? *aRange : nsRect(aScrollPosition, nsSize(0, 0)); + if (aMode != nsIScrollableFrame::SMOOTH_MSD) { + // If we get a non-smooth-scroll, reset the cached APZ scroll destination, + // so that we know to process the next smooth-scroll destined for APZ. + mApzSmoothScrollDestination = Nothing(); + } + if (aMode == nsIScrollableFrame::INSTANT) { // Asynchronous scrolling is not allowed, so we'll kill any existing // async-scrolling process and do an instant scroll. @@ -2121,10 +2127,31 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition, } if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter)) { + if (mApzSmoothScrollDestination == Some(mDestination) && + mScrollGeneration == sScrollGenerationCounter) { + // If we already sent APZ a smooth-scroll request to this + // destination with this generation (i.e. it was the last request + // we sent), then don't send another one because it is redundant. + // This is to avoid a scenario where pages do repeated scrollBy + // calls, incrementing the generation counter, and blocking APZ from + // syncing the scroll offset back to the main thread. + // Note that if we get two smooth-scroll requests to the same + // destination with some other scroll in between, + // mApzSmoothScrollDestination will get reset to Nothing() and so + // we shouldn't have the problem where this check discards a + // legitimate smooth-scroll. + // Note: if there are two separate scrollframes both getting smooth + // scrolled at the same time, sScrollGenerationCounter can get + // incremented and this early-exit won't get taken. Bug 1231177 is + // on file for this. + return; + } + // The animation will be handled in the compositor, pass the // information needed to start the animation and skip the main-thread // animation for this scroll. mLastSmoothScrollOrigin = aOrigin; + mApzSmoothScrollDestination = Some(mDestination); mScrollGeneration = ++sScrollGenerationCounter; if (!nsLayoutUtils::GetDisplayPort(mOuter->GetContent())) { @@ -4187,18 +4214,30 @@ void ScrollFrameHelper::CurPosAttributeChanged(nsIContent* aContent) /* ============= Scroll events ========== */ -NS_IMETHODIMP -ScrollFrameHelper::ScrollEvent::Run() +ScrollFrameHelper::ScrollEvent::ScrollEvent(ScrollFrameHelper* aHelper) + : mHelper(aHelper) { - if (mHelper) - mHelper->FireScrollEvent(); - return NS_OK; + mDriver = mHelper->mOuter->PresContext()->RefreshDriver(); + mDriver->AddRefreshObserver(this, Flush_Style); +} + +ScrollFrameHelper::ScrollEvent::~ScrollEvent() +{ + mDriver->RemoveRefreshObserver(this, Flush_Style); + mDriver = nullptr; +} + +void +ScrollFrameHelper::ScrollEvent::WillRefresh(mozilla::TimeStamp aTime) +{ + mHelper->FireScrollEvent(); } void ScrollFrameHelper::FireScrollEvent() { - mScrollEvent.Forget(); + MOZ_ASSERT(mScrollEvent); + mScrollEvent = nullptr; ActiveLayerTracker::SetCurrentScrollHandlerFrame(mOuter); WidgetGUIEvent event(true, eScroll, nullptr); @@ -4224,14 +4263,11 @@ ScrollFrameHelper::FireScrollEvent() void ScrollFrameHelper::PostScrollEvent() { - if (mScrollEvent.IsPending()) + if (mScrollEvent) return; - nsRootPresContext* rpc = mOuter->PresContext()->GetRootPresContext(); - if (!rpc) - return; + // The ScrollEvent constructor registers itself with the refresh driver. mScrollEvent = new ScrollEvent(this); - rpc->AddWillPaintObserver(mScrollEvent.get()); } NS_IMETHODIMP diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 4c3093ef25..2075921b8a 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -19,6 +19,7 @@ #include "nsIReflowCallback.h" #include "nsBoxLayoutState.h" #include "nsQueryFrame.h" +#include "nsRefreshDriver.h" #include "nsExpirationTracker.h" #include "TextOverflow.h" #include "ScrollVelocityQueue.h" @@ -101,13 +102,16 @@ public: bool IsSmoothScrollingEnabled(); - class ScrollEvent : public nsRunnable { + class ScrollEvent : public nsARefreshObserver { public: - NS_DECL_NSIRUNNABLE - explicit ScrollEvent(ScrollFrameHelper *helper) : mHelper(helper) {} - void Revoke() { mHelper = nullptr; } + NS_INLINE_DECL_REFCOUNTING(ScrollEvent, override) + explicit ScrollEvent(ScrollFrameHelper *helper); + void WillRefresh(mozilla::TimeStamp aTime) override; + protected: + virtual ~ScrollEvent(); private: ScrollFrameHelper *mHelper; + RefPtr mDriver; }; class AsyncScrollPortEvent : public nsRunnable { @@ -417,7 +421,7 @@ public: nsCOMPtr mScrollCornerContent; nsCOMPtr mResizerContent; - nsRevocableEventPtr mScrollEvent; + RefPtr mScrollEvent; nsRevocableEventPtr mAsyncScrollPortEvent; nsRevocableEventPtr mScrolledAreaEvent; nsIFrame* mHScrollbarBox; @@ -432,6 +436,7 @@ public: nsTArray mListeners; nsIAtom* mLastScrollOrigin; nsIAtom* mLastSmoothScrollOrigin; + Maybe mApzSmoothScrollDestination; uint32_t mScrollGeneration; nsRect mScrollPort; // Where we're currently scrolling to, if we're scrolling asynchronously. diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp index ba588ac5db..1411e250ab 100644 --- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -1927,28 +1927,31 @@ nsGridContainerFrame::Tracks::Initialize( explicitGridOffset + aFunctions.mMinSizingFunctions.Length()); MOZ_ASSERT(aFunctions.mMinSizingFunctions.Length() == aFunctions.mMaxSizingFunctions.Length()); + // First we initialize the implicit tracks before the explicit grid starts. uint32_t i = 0; - for (; i < explicitGridOffset; ++i) { + uint32_t sentinel = std::min(explicitGridOffset, mSizes.Length()); + for (; i < sentinel; ++i) { mSizes[i].Initialize(percentageBasis, aFunctions.mAutoMinSizing, aFunctions.mAutoMaxSizing); } - uint32_t j = 0; - for (uint32_t len = aFunctions.mMinSizingFunctions.Length(); j < len; ++j) { - mSizes[i + j].Initialize(percentageBasis, - aFunctions.mMinSizingFunctions[j], - aFunctions.mMaxSizingFunctions[j]); + // Now initialize the explicit grid tracks. + sentinel = std::min(i + aFunctions.mMinSizingFunctions.Length(), + mSizes.Length()); + for (uint32_t j = 0; i < sentinel; ++i, ++j) { + mSizes[i].Initialize(percentageBasis, + aFunctions.mMinSizingFunctions[j], + aFunctions.mMaxSizingFunctions[j]); } - i += j; - for (; i < mSizes.Length(); ++i) { + // Finally, initialize the implicit tracks that comes after the explicit grid. + sentinel = mSizes.Length(); + for (; i < sentinel; ++i) { mSizes[i].Initialize(percentageBasis, aFunctions.mAutoMinSizing, aFunctions.mAutoMaxSizing); } mGridGap = aGridGap; - // XXX allow negative values? pending outcome of www-style thread: - // https://lists.w3.org/Archives/Public/www-style/2015Oct/0028.html MOZ_ASSERT(mGridGap >= nscoord(0), "negative grid gap"); } diff --git a/layout/style/crashtests/1223688-1.html b/layout/style/crashtests/1223688-1.html new file mode 100644 index 0000000000..70f9d85795 --- /dev/null +++ b/layout/style/crashtests/1223688-1.html @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/layout/style/crashtests/1223694-1.html b/layout/style/crashtests/1223694-1.html new file mode 100644 index 0000000000..c4589884f7 --- /dev/null +++ b/layout/style/crashtests/1223694-1.html @@ -0,0 +1,17 @@ + + + + + + + + diff --git a/layout/style/crashtests/1226400-1.html b/layout/style/crashtests/1226400-1.html new file mode 100644 index 0000000000..dea15642c7 --- /dev/null +++ b/layout/style/crashtests/1226400-1.html @@ -0,0 +1,55 @@ + + + +FontFaceSet::Load crasher + + + + + + + +

This may crash on load...

+ + + + diff --git a/layout/style/crashtests/1227501-1.html b/layout/style/crashtests/1227501-1.html new file mode 100644 index 0000000000..03383813d0 --- /dev/null +++ b/layout/style/crashtests/1227501-1.html @@ -0,0 +1,8 @@ + + + + + + diff --git a/layout/style/crashtests/crashtests.list b/layout/style/crashtests/crashtests.list index c0c958893e..1fde46fd86 100644 --- a/layout/style/crashtests/crashtests.list +++ b/layout/style/crashtests/crashtests.list @@ -26,7 +26,7 @@ load 431705-1.xul load 432561-1.html load 437170-1.html load 437532-1.html -skip load 439184-1.html # skip until we figure out how to test this +load 439184-1.html load 444237-1.html load 444848-1.html load 447776-1.html @@ -102,7 +102,7 @@ load 927734-1.html load 930270-1.html load 930270-2.html load 945048-1.html -pref(layers.offmainthreadcomposition.async-animations,true) load 972199-1.html +load 972199-1.html load 989965-1.html load 992333-1.html pref(dom.webcomponents.enabled,true) load 1017798-1.html @@ -122,6 +122,10 @@ load 1167782-1.html load 1186768-1.xhtml load 1200568-1.html load 1206105-1.html +load 1223688-1.html +load 1223694-1.html +load 1226400-1.html +load 1227501-1.html load border-image-visited-link.html load font-face-truncated-src.html load large_border_image_width.html diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 9762731ae7..f77568daca 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -442,6 +442,31 @@ protected: bool mOriginalValue; }; + /** + * RAII class to set aParser->mInSupportsCondition to true and restore it + * to false later. + */ + class MOZ_RAII nsAutoInSupportsCondition + { + public: + explicit nsAutoInSupportsCondition(CSSParserImpl* aParser) + : mParser(aParser) + { + MOZ_ASSERT(!aParser->mInSupportsCondition, + "nsAutoInSupportsCondition is not designed to be used " + "re-entrantly"); + mParser->mInSupportsCondition = true; + } + + ~nsAutoInSupportsCondition() + { + mParser->mInSupportsCondition = false; + } + + private: + CSSParserImpl* const mParser; + }; + // the caller must hold on to aString until parsing is done void InitScanner(nsCSSScanner& aScanner, css::ErrorReporter& aReporter, @@ -4338,7 +4363,7 @@ CSSParserImpl::ParseSupportsRule(RuleAppendFunc aAppendFunc, void* aProcessData) bool CSSParserImpl::ParseSupportsCondition(bool& aConditionMet) { - mInSupportsCondition = true; + nsAutoInSupportsCondition aisc(this); if (!GetToken(true)) { REPORT_UNEXPECTED_EOF(PESupportsConditionStartEOF2); @@ -4356,7 +4381,6 @@ CSSParserImpl::ParseSupportsCondition(bool& aConditionMet) bool result = ParseSupportsConditionInParens(aConditionMet) && ParseSupportsConditionTerms(aConditionMet) && !mScanner->SeenBadToken(); - mInSupportsCondition = false; return result; } @@ -4364,12 +4388,10 @@ CSSParserImpl::ParseSupportsCondition(bool& aConditionMet) mToken.mIdent.LowerCaseEqualsLiteral("not")) { bool result = ParseSupportsConditionNegation(aConditionMet) && !mScanner->SeenBadToken(); - mInSupportsCondition = false; return result; } REPORT_UNEXPECTED_TOKEN(PESupportsConditionExpectedStart); - mInSupportsCondition = false; return false; } diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 2a264b22c3..63165fef68 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -1482,7 +1482,8 @@ CSS_PROP_DISPLAY( contain, Contain, CSS_PROPERTY_PARSE_VALUE | - CSS_PROPERTY_VALUE_PARSER_FUNCTION, + CSS_PROPERTY_VALUE_PARSER_FUNCTION | + CSS_PROPERTY_FIXPOS_CB, "layout.css.contain.enabled", // Does not affect parsing, but is needed for tab completion in devtools: VARIANT_HK | VARIANT_NONE, @@ -3027,7 +3028,8 @@ CSS_PROP_DISPLAY( Position, CSS_PROPERTY_PARSE_VALUE | // For position: sticky/fixed - CSS_PROPERTY_CREATES_STACKING_CONTEXT, + CSS_PROPERTY_CREATES_STACKING_CONTEXT | + CSS_PROPERTY_ABSPOS_CB, "", VARIANT_HK, kPositionKTable, @@ -3386,7 +3388,8 @@ CSS_PROP_DISPLAY( CSS_PROPERTY_PARSE_FUNCTION | CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH | CSS_PROPERTY_CREATES_STACKING_CONTEXT | - CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR, + CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR | + CSS_PROPERTY_FIXPOS_CB, "", 0, nullptr, @@ -3431,7 +3434,8 @@ CSS_PROP_DISPLAY( perspective, Perspective, CSS_PROPERTY_PARSE_VALUE | - CSS_PROPERTY_CREATES_STACKING_CONTEXT, + CSS_PROPERTY_CREATES_STACKING_CONTEXT | + CSS_PROPERTY_FIXPOS_CB, "", VARIANT_NONE | VARIANT_INHERIT | VARIANT_LENGTH | VARIANT_POSITIVE_DIMENSION, nullptr, @@ -3442,7 +3446,8 @@ CSS_PROP_DISPLAY( transform_style, TransformStyle, CSS_PROPERTY_PARSE_VALUE | - CSS_PROPERTY_CREATES_STACKING_CONTEXT, + CSS_PROPERTY_CREATES_STACKING_CONTEXT | + CSS_PROPERTY_FIXPOS_CB, "", VARIANT_HK, kTransformStyleKTable, @@ -3970,7 +3975,8 @@ CSS_PROP_SVGRESET( filter, Filter, CSS_PROPERTY_PARSE_FUNCTION | - CSS_PROPERTY_CREATES_STACKING_CONTEXT, + CSS_PROPERTY_CREATES_STACKING_CONTEXT | + CSS_PROPERTY_FIXPOS_CB, "", 0, nullptr, diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 3f52c87bf7..87f65f1ee6 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -255,6 +255,22 @@ static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK & // CSS_PROP_LIST_EXCLUDE_INTERNAL section of nsCSSPropList.h. #define CSS_PROPERTY_INTERNAL (1<<28) +// This property has values that can establish a containing block for +// fixed positioned and absolutely positioned elements. +// This should be set for any properties that can cause an element to be +// such a containing block, as implemented in +// nsStyleDisplay::IsFixedPosContainingBlock. +#define CSS_PROPERTY_FIXPOS_CB (1<<29) + +// This property has values that can establish a containing block for +// absolutely positioned elements. +// This should be set for any properties that can cause an element to be +// such a containing block, as implemented in +// nsStyleDisplay::IsAbsPosContainingBlock. +// It does not need to be set for properties that also have +// CSS_PROPERTY_FIXPOS_CB set. +#define CSS_PROPERTY_ABSPOS_CB (1<<30) + /** * Types of animatable values. */ diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index b40038a81a..2acafa2fa3 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -4115,6 +4115,11 @@ AncestorFilter::AssertHasAllAncestors(Element *aElement) const void TreeMatchContext::AssertHasAllStyleScopes(Element* aElement) const { + if (aElement->IsInNativeAnonymousSubtree()) { + // Document style sheets are never applied to native anonymous content, + // so it's not possible for them to be in a