diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index ab7eb59774..fb4eee8f0e 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -9359,6 +9359,12 @@ private: case 0x00A0: aOut.AppendLiteral(" "); break; + case '<': + aOut.AppendLiteral("<"); + break; + case '>': + aOut.AppendLiteral(">"); + break; default: aOut.Append(*c); break; @@ -9500,6 +9506,12 @@ AppendEncodedAttributeValue(nsAutoString* aValue, StringBuilder& aBuilder) case 0x00A0: extraSpaceNeeded += ArrayLength(" ") - 2; break; + case '<': + extraSpaceNeeded += ArrayLength("<") - 2; + break; + case '>': + extraSpaceNeeded += ArrayLength(">") - 2; + break; default: break; } diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index e6ff926906..585c661a5c 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -1546,26 +1546,22 @@ nsObjectLoadingContent::MaybeRewriteYoutubeEmbed(nsIURI* aURI, nsIURI* aBaseURI, } // See if requester is planning on using the JS API. - nsAutoCString uri; - nsresult rv = aURI->GetSpec(uri); + nsAutoCString prePath; + nsresult rv = aURI->GetPrePath(prePath); if (NS_FAILED(rv)) { return; } - if (uri.Find("enablejsapi=1", true, 0, -1) != kNotFound) { - return; - } - // Some YouTube urls have parameters in path components, e.g. // http://youtube.com/embed/7LcUOEP7Brc&start=35. These URLs work with flash, // but break iframe/object embedding. If this situation occurs with rewritten // URLs, convert the parameters to query in order to make the video load // correctly as an iframe. In either case, warn about it in the // developer console. - int32_t ampIndex = uri.FindChar('&', 0); + int32_t ampIndex = path.FindChar('&', 0); bool replaceQuery = false; if (ampIndex != -1) { - int32_t qmIndex = uri.FindChar('?', 0); + int32_t qmIndex = path.FindChar('?', 0); if (qmIndex == -1 || qmIndex > ampIndex) { replaceQuery = true; @@ -1576,20 +1572,22 @@ nsObjectLoadingContent::MaybeRewriteYoutubeEmbed(nsIURI* aURI, nsIURI* aBaseURI, return; } - nsAutoString utf16OldURI = NS_ConvertUTF8toUTF16(uri); + NS_ConvertUTF8toUTF16 utf16OldURI(prePath); + AppendUTF8toUTF16(path, utf16OldURI); // If we need to convert the URL, it means an ampersand comes first. // Use the index we found earlier. if (replaceQuery) { // Replace question marks with ampersands. - uri.ReplaceChar('?', '&'); + path.ReplaceChar('?', '&'); // Replace the first ampersand with a question mark. - uri.SetCharAt('?', ampIndex); + path.SetCharAt('?', ampIndex); } // Switch out video access url formats, which should possibly allow HTML5 // video loading. - uri.ReplaceSubstring(NS_LITERAL_CSTRING("/v/"), - NS_LITERAL_CSTRING("/embed/")); - nsAutoString utf16URI = NS_ConvertUTF8toUTF16(uri); + path.ReplaceSubstring(NS_LITERAL_CSTRING("/v/"), + NS_LITERAL_CSTRING("/embed/")); + NS_ConvertUTF8toUTF16 utf16URI(prePath); + AppendUTF8toUTF16(path, utf16URI); rv = nsContentUtils::NewURIWithDocumentCharset(aOutURI, utf16URI, thisContent->OwnerDoc(), diff --git a/dom/base/nsObjectLoadingContent.h b/dom/base/nsObjectLoadingContent.h index 24f80dd083..37bf83bad4 100644 --- a/dom/base/nsObjectLoadingContent.h +++ b/dom/base/nsObjectLoadingContent.h @@ -572,12 +572,12 @@ class nsObjectLoadingContent : public nsImageLoadingContent * * - is an embed or object node * - has a URL pointing at the youtube.com domain, using "/v/" style video - * path reference, and without enablejsapi=1 in the path + * path reference. * * Having the enablejsapi flag means the document that contains the element * could possibly be manipulating the youtube video elsewhere on the page - * via javascript. We can't rewrite these kinds of elements without possibly - * breaking content, which we want to avoid. + * via javascript. In the context of embed elements, this usage has been + * deprecated by youtube, so we can just rewrite as normal. * * If we can rewrite the URL, we change the "/v/" to "/embed/", and change * our type to eType_Document so that we render similarly to an iframe diff --git a/dom/events/EventDispatcher.cpp b/dom/events/EventDispatcher.cpp index 7b4cc1cecf..96f065ee84 100644 --- a/dom/events/EventDispatcher.cpp +++ b/dom/events/EventDispatcher.cpp @@ -40,7 +40,6 @@ #include "mozilla/dom/ScrollAreaEvent.h" #include "mozilla/dom/SimpleGestureEvent.h" #include "mozilla/dom/StorageEvent.h" -#include "mozilla/dom/SVGZoomEvent.h" #include "mozilla/dom/TimeEvent.h" #include "mozilla/dom/TouchEvent.h" #include "mozilla/dom/TransitionEvent.h" @@ -1047,9 +1046,6 @@ EventDispatcher::CreateEvent(EventTarget* aOwner, case eClipboardEventClass: return NS_NewDOMClipboardEvent(aOwner, aPresContext, aEvent->AsClipboardEvent()); - case eSVGZoomEventClass: - return NS_NewDOMSVGZoomEvent(aOwner, aPresContext, - aEvent->AsSVGZoomEvent()); case eSMILTimeEventClass: return NS_NewDOMTimeEvent(aOwner, aPresContext, aEvent->AsSMILTimeEvent()); @@ -1148,12 +1144,6 @@ EventDispatcher::CreateEvent(EventTarget* aOwner, if (aEventType.LowerCaseEqualsLiteral("svgevents")) { return NS_NewDOMEvent(aOwner, aPresContext, nullptr); } - if (aEventType.LowerCaseEqualsLiteral("svgzoomevent")) { - return NS_NewDOMSVGZoomEvent(aOwner, aPresContext, nullptr); - } - if (aEventType.LowerCaseEqualsLiteral("svgzoomevents")) { - return NS_NewDOMSVGZoomEvent(aOwner, aPresContext, nullptr); - } if (aEventType.LowerCaseEqualsLiteral("timeevent")) { return NS_NewDOMTimeEvent(aOwner, aPresContext, nullptr); } diff --git a/dom/events/EventNameList.h b/dom/events/EventNameList.h index 0a17b5f147..d323345d46 100644 --- a/dom/events/EventNameList.h +++ b/dom/events/EventNameList.h @@ -825,19 +825,6 @@ NON_IDL_EVENT(SVGScroll, EventNameType_None, eBasicEventClass) -NON_IDL_EVENT(SVGZoom, - eSVGZoom, - EventNameType_None, - eSVGZoomEventClass) - -// Only map the ID to the real event name when MESSAGE_TO_EVENT is defined. -#ifndef MESSAGE_TO_EVENT -// This is a bit hackish, but SVG's event names are weird. -NON_IDL_EVENT(zoom, - eSVGZoom, - EventNameType_SVGSVG, - eBasicEventClass) -#endif // Only map the ID to the real event name when MESSAGE_TO_EVENT is defined. #ifndef MESSAGE_TO_EVENT NON_IDL_EVENT(begin, diff --git a/dom/events/test/test_all_synthetic_events.html b/dom/events/test/test_all_synthetic_events.html index 58560fdcef..ce8c3da15f 100644 --- a/dom/events/test/test_all_synthetic_events.html +++ b/dom/events/test/test_all_synthetic_events.html @@ -401,13 +401,6 @@ const kEventConstructors = { }, chromeOnly: true, }, - SVGZoomEvent: { create: function (aName, aProps) { - var e = document.createEvent("svgzoomevent"); - e.initUIEvent(aName, aProps.bubbles, aProps.cancelable, - aProps.view, aProps.detail); - return e; - }, - }, TCPSocketErrorEvent: { create: function(aName, aProps) { return new TCPSocketErrorEvent(aName, aProps); }, diff --git a/dom/svg/SVGSVGElement.cpp b/dom/svg/SVGSVGElement.cpp index fa60979316..48e3444921 100644 --- a/dom/svg/SVGSVGElement.cpp +++ b/dom/svg/SVGSVGElement.cpp @@ -474,7 +474,7 @@ SVGSVGElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv) } //---------------------------------------------------------------------- -// helper methods for implementing SVGZoomEvent: +// helper methods for implementing SetCurrentScale/Translate void SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y) @@ -498,6 +498,8 @@ SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y) // change that caused the event's dispatch, which is *not* necessarily the // same thing as the values of currentScale and currentTranslate prior to // their own last change. + // + // TODO: simplify some of this code since SVGZoomEvent was removed. mPreviousScale = mCurrentScale; mPreviousTranslate = mCurrentTranslate; @@ -510,10 +512,7 @@ SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y) nsCOMPtr presShell = doc->GetShell(); if (presShell && IsRoot()) { nsEventStatus status = nsEventStatus_eIgnore; - if (mPreviousScale != mCurrentScale) { - InternalSVGZoomEvent svgZoomEvent(true, eSVGZoom); - presShell->HandleDOMEventWithTarget(this, &svgZoomEvent, &status); - } else { + if (mPreviousScale == mCurrentScale) { WidgetEvent svgScrollEvent(true, eSVGScroll); presShell->HandleDOMEventWithTarget(this, &svgScrollEvent, &status); } diff --git a/dom/svg/SVGSVGElement.h b/dom/svg/SVGSVGElement.h index 18a2d9764d..a1c2448ce5 100644 --- a/dom/svg/SVGSVGElement.h +++ b/dom/svg/SVGSVGElement.h @@ -131,6 +131,8 @@ public: * For use by zoom controls to allow currentScale, currentTranslate.x and * currentTranslate.y to be set by a single operation that dispatches a * single SVGZoom event (instead of one SVGZoom and two SVGScroll events). + * + * XXX SVGZoomEvent was removed; is this still needed? */ void SetCurrentScaleTranslate(float s, float x, float y); diff --git a/dom/svg/SVGZoomEvent.cpp b/dom/svg/SVGZoomEvent.cpp deleted file mode 100644 index e57c8fa663..0000000000 --- a/dom/svg/SVGZoomEvent.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "DOMSVGPoint.h" -#include "mozilla/ContentEvents.h" -#include "mozilla/dom/Element.h" -#include "mozilla/dom/SVGSVGElement.h" -#include "mozilla/dom/SVGZoomEvent.h" -#include "nsIDocument.h" -#include "nsIPresShell.h" -#include "prtime.h" - -namespace mozilla { -namespace dom { - -//---------------------------------------------------------------------- -// Implementation - -NS_IMPL_CYCLE_COLLECTION_INHERITED(SVGZoomEvent, UIEvent, mPreviousTranslate, mNewTranslate) - -NS_IMPL_ADDREF_INHERITED(SVGZoomEvent, UIEvent) -NS_IMPL_RELEASE_INHERITED(SVGZoomEvent, UIEvent) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGZoomEvent) -NS_INTERFACE_MAP_END_INHERITING(UIEvent) - -SVGZoomEvent::SVGZoomEvent(EventTarget* aOwner, - nsPresContext* aPresContext, - InternalSVGZoomEvent* aEvent) - : UIEvent(aOwner, aPresContext, - aEvent ? aEvent : new InternalSVGZoomEvent(false, eSVGZoom)) - , mPreviousScale(0) - , mNewScale(0) -{ - if (aEvent) { - mEventIsInternal = false; - } - else { - mEventIsInternal = true; - mEvent->mTime = PR_Now(); - } - - // We must store the "Previous" and "New" values before this event is - // dispatched. Reading the values from the root 'svg' element after we've - // been dispatched is not an option since event handler code may change - // currentScale and currentTranslate in response to this event. - nsIPresShell *presShell; - if (mPresContext && (presShell = mPresContext->GetPresShell())) { - nsIDocument *doc = presShell->GetDocument(); - if (doc) { - Element *rootElement = doc->GetRootElement(); - if (rootElement) { - // If the root element isn't an SVG 'svg' element - // (e.g. if this event was created by calling createEvent on a - // non-SVGDocument), then the "New" and "Previous" - // properties will be left null which is probably what we want. - if (rootElement->IsSVGElement(nsGkAtoms::svg)) { - SVGSVGElement *SVGSVGElem = - static_cast(rootElement); - - mNewScale = SVGSVGElem->GetCurrentScale(); - mPreviousScale = SVGSVGElem->GetPreviousScale(); - - const SVGPoint& translate = SVGSVGElem->GetCurrentTranslate(); - mNewTranslate = - new DOMSVGPoint(translate.GetX(), translate.GetY()); - mNewTranslate->SetReadonly(true); - - const SVGPoint& prevTranslate = SVGSVGElem->GetPreviousTranslate(); - mPreviousTranslate = - new DOMSVGPoint(prevTranslate.GetX(), prevTranslate.GetY()); - mPreviousTranslate->SetReadonly(true); - } - } - } - } -} - -SVGZoomEvent::~SVGZoomEvent() -{ -} - -} // namespace dom -} // namespace mozilla - - -//////////////////////////////////////////////////////////////////////// -// Exported creation functions: - -using namespace mozilla; -using namespace mozilla::dom; - -already_AddRefed -NS_NewDOMSVGZoomEvent(EventTarget* aOwner, - nsPresContext* aPresContext, - mozilla::InternalSVGZoomEvent* aEvent) -{ - RefPtr it = new SVGZoomEvent(aOwner, aPresContext, aEvent); - return it.forget(); -} diff --git a/dom/svg/SVGZoomEvent.h b/dom/svg/SVGZoomEvent.h deleted file mode 100644 index a1374e7f83..0000000000 --- a/dom/svg/SVGZoomEvent.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_dom_SVGZoomEvent_h -#define mozilla_dom_SVGZoomEvent_h - -#include "DOMSVGPoint.h" -#include "mozilla/dom/UIEvent.h" -#include "mozilla/dom/SVGZoomEventBinding.h" -#include "mozilla/EventForwards.h" - -class nsPresContext; - -namespace mozilla { - -class nsISVGPoint; - -namespace dom { - -class SVGZoomEvent final : public UIEvent -{ -public: - - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGZoomEvent, UIEvent) - NS_DECL_ISUPPORTS_INHERITED - - SVGZoomEvent(EventTarget* aOwner, nsPresContext* aPresContext, - InternalSVGZoomEvent* aEvent); - - // Forward to base class - NS_FORWARD_TO_UIEVENT - - virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle aGivenProto) override - { - return SVGZoomEventBinding::Wrap(aCx, this, aGivenProto); - } - - float PreviousScale() const - { - return mPreviousScale; - } - - nsISVGPoint* GetPreviousTranslate() const - { - return mPreviousTranslate; - } - - float NewScale() const - { - return mNewScale; - } - - nsISVGPoint* GetNewTranslate() const - { - return mNewTranslate; - } - -private: - ~SVGZoomEvent(); - - float mPreviousScale; - float mNewScale; - RefPtr mPreviousTranslate; - RefPtr mNewTranslate; -}; - -} // namespace dom -} // namespace mozilla - -already_AddRefed -NS_NewDOMSVGZoomEvent(mozilla::dom::EventTarget* aOwner, - nsPresContext* aPresContext, - mozilla::InternalSVGZoomEvent* aEvent); - -#endif // mozilla_dom_SVGZoomEvent_h diff --git a/dom/svg/moz.build b/dom/svg/moz.build index 90b7156315..66e2be5dca 100644 --- a/dom/svg/moz.build +++ b/dom/svg/moz.build @@ -100,7 +100,6 @@ EXPORTS.mozilla.dom += [ 'SVGTSpanElement.h', 'SVGUseElement.h', 'SVGViewElement.h', - 'SVGZoomEvent.h', ] UNIFIED_SOURCES += [ @@ -247,7 +246,6 @@ UNIFIED_SOURCES += [ 'SVGUseElement.cpp', 'SVGViewBoxSMILType.cpp', 'SVGViewElement.cpp', - 'SVGZoomEvent.cpp', ] include('/ipc/chromium/chromium-config.mozbuild') diff --git a/dom/svg/test/mochitest.ini b/dom/svg/test/mochitest.ini index c44776b2ff..ddc0e4b472 100644 --- a/dom/svg/test/mochitest.ini +++ b/dom/svg/test/mochitest.ini @@ -27,7 +27,6 @@ support-files = text-helper-selection.svg text-helper.svg viewport-helper.svg - zoom-helper.svg [test_a_href_01.xhtml] [test_a_href_02.xhtml] @@ -105,5 +104,4 @@ support-files = use-with-hsts-helper.html use-with-hsts-helper.html^headers^ [test_valueAsString.xhtml] [test_valueLeaks.xhtml] [test_viewport.html] -[test_zoom.xhtml] diff --git a/dom/svg/test/test_zoom.xhtml b/dom/svg/test/test_zoom.xhtml deleted file mode 100644 index ce920b29db..0000000000 --- a/dom/svg/test/test_zoom.xhtml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - Test for Bug 547596 - - - - - Mozilla Bug 547596 -

- - - - - - - diff --git a/dom/svg/test/zoom-helper.svg b/dom/svg/test/zoom-helper.svg deleted file mode 100644 index a9e40cdaa8..0000000000 --- a/dom/svg/test/zoom-helper.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index 03101b888c..2fd08910ba 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -1124,8 +1124,6 @@ var interfaceNamesInGlobalScope = "SVGViewElement", // IMPORTANT: Do not change this list without review from a DOM peer! "SVGZoomAndPan", -// IMPORTANT: Do not change this list without review from a DOM peer! - "SVGZoomEvent", // IMPORTANT: Do not change this list without review from a DOM peer! "Text", // IMPORTANT: Do not change this list without review from a DOM peer! diff --git a/dom/webidl/SVGZoomEvent.webidl b/dom/webidl/SVGZoomEvent.webidl deleted file mode 100644 index 044247f3ca..0000000000 --- a/dom/webidl/SVGZoomEvent.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * http://www.w3.org/TR/SVG2/ - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -interface SVGZoomEvent : UIEvent { - // Not implemented - // readonly attribute SVGRect zoomRectScreen; - - [Constant] - readonly attribute float previousScale; - [Constant] - readonly attribute SVGPoint? previousTranslate; - [Constant] - readonly attribute float newScale; - [Constant] - readonly attribute SVGPoint? newTranslate; -}; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index a62d760380..a1b67849b8 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -529,7 +529,6 @@ WEBIDL_FILES = [ 'SVGViewElement.webidl', 'SVGZoomAndPan.webidl', 'SVGZoomAndPanValues.webidl', - 'SVGZoomEvent.webidl', 'SystemUpdate.webidl', 'TCPServerSocket.webidl', 'TCPServerSocketEvent.webidl', diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 4ade7fe051..b0dae69150 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -9337,3 +9337,28 @@ nsLayoutUtils::ComputeGeometryBox(nsIFrame* aFrame, return r; } + +/* static */ nsStyleContext* +nsLayoutUtils::GetNonAnonymousStyleContext(nsIFrame* aFrame) +{ + nsIContent* node = aFrame->GetContent(); + MOZ_ASSERT(node, "No content for the given frame?"); + while (node && node->IsInNativeAnonymousSubtree()) { + node = node->GetParent(); + } + MOZ_ASSERT(node, "Native anonymous element with no originating node?"); + if (nsIFrame* primaryFrame = node->GetPrimaryFrame()) { + return primaryFrame->StyleContext(); + } + // If the element doesn't have primary frame, get the computed style + // from the element directly. + nsPresContext* pc = aFrame->PresContext(); + MOZ_ASSERT(node == pc->Document()->GetRootElement(), + "Root element is the only case for this fallback " + "path to be triggered"); + RefPtr styleContext = + pc->StyleSet()->ResolveStyleFor(node->AsElement(), nullptr); + // Dropping the strong reference is fine because the style should be + // held strongly by the element. + return styleContext.get(); +} diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 6091fb45e4..ea9a026007 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2878,6 +2878,15 @@ public: return ResolveToLength(aGap, aPercentageBasis); } + /** + * Returns the style context associated with the nearest non-native-anonymous + * ancestor of the given frame. + * + * @param aFrame The frame associated with native anonymous content. + * @return The resolved style context of the nearest non-anonymous DOM ancestor. + */ + static nsStyleContext* GetNonAnonymousStyleContext(nsIFrame* aFrame); + private: static uint32_t sFontSizeInflationEmPerLine; static uint32_t sFontSizeInflationMinTwips; diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index f7eeef2f42..53b028837b 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1060,7 +1060,9 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext, // This is only needed for root element because scrollbars of non- // root elements with "scrollbar-width: none" is already suppressed // in ScrollFrameHelper::CreateAnonymousContent. - if (this->StyleUserInterface()->mScrollbarWidth == StyleScrollbarWidth::None) { + nsStyleContext* scrollbarStyle = nsLayoutUtils::GetNonAnonymousStyleContext(this); + auto scrollbarWidth = scrollbarStyle->StyleUIReset()->mScrollbarWidth; + if (scrollbarWidth == StyleScrollbarWidth::None) { state.mVScrollbar = ShowScrollbar::Never; state.mHScrollbar = ShowScrollbar::Never; } @@ -4417,7 +4419,7 @@ ScrollFrameHelper::CreateAnonymousContent( canHaveHorizontal = true; canHaveVertical = true; } else { - if (mOuter->StyleUserInterface()->mScrollbarWidth == StyleScrollbarWidth::None) { + if (mOuter->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::None) { // If scrollbar-width is none, don't generate scrollbars. canHaveHorizontal = false; canHaveVertical = false; @@ -4450,7 +4452,7 @@ ScrollFrameHelper::CreateAnonymousContent( kNameSpaceID_XUL, nsIDOMNode::ELEMENT_NODE); NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY); - StyleScrollbarWidth scrollWidth = mOuter->StyleUserInterface()->mScrollbarWidth; + StyleScrollbarWidth scrollWidth = mOuter->StyleUIReset()->mScrollbarWidth; if (canHaveHorizontal) { RefPtr ni = nodeInfo; diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index 989e45765c..5d88feee26 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -79,6 +79,7 @@ Declaration::Declaration(const Declaration& aCopy) nullptr), mImmutable(false) { + mContainer.mRaw = 0; } Declaration::~Declaration() diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 5b390d769e..04c04fd372 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -324,10 +324,18 @@ FontFaceSet::Load(JSContext* aCx, nsTArray> promises; - nsTArray faces; - FindMatchingFontFaces(aFont, aText, faces, aRv); - if (aRv.Failed()) { - return nullptr; + nsTArray> faces; + { + nsTArray weakFaces; + FindMatchingFontFaces(aFont, aText, weakFaces, aRv); + if (aRv.Failed()) { + return nullptr; + } + if (!faces.AppendElements(weakFaces, fallible) || + !promises.SetCapacity(weakFaces.Length(), fallible)) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } } for (FontFace* f : faces) { @@ -335,10 +343,7 @@ FontFaceSet::Load(JSContext* aCx, if (aRv.Failed()) { return nullptr; } - if (!promises.AppendElement(promise, fallible)) { - aRv.Throw(NS_ERROR_FAILURE); - return nullptr; - } + promises.AppendElement(promise); } return Promise::All(aCx, promises, aRv); diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 141e8e3125..d8920a1c75 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -3723,7 +3723,7 @@ CSS_PROP_DISPLAY( kScrollSnapTypeKTable, CSS_PROP_NO_OFFSET, eStyleAnimType_Discrete) -CSS_PROP_USERINTERFACE( +CSS_PROP_UIRESET( scrollbar-width, scrollbar_width, ScrollbarWidth, diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 33a2836590..357df17662 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -3302,7 +3302,7 @@ nsComputedDOMStyle::DoGetScrollbarWidth() { RefPtr val = new nsROCSSPrimitiveValue; val->SetIdent( - nsCSSProps::ValueToKeywordEnum(StyleUserInterface()->mScrollbarWidth, + nsCSSProps::ValueToKeywordEnum(StyleUIReset()->mScrollbarWidth, nsCSSProps::kScrollbarWidthKTable)); return val.forget(); } diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index d1d14d0f7a..21af533726 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -5377,14 +5377,6 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct, // caret-color: auto, color, inherit setComplexColor(aRuleData->ValueForCaretColor(), &nsStyleUserInterface::mCaretColor); - - // scrollbar-width: auto, thin, none - SetValue(*aRuleData->ValueForScrollbarWidth(), - ui->mScrollbarWidth, - conditions, - SETVAL_ENUMERATED, - parentUI->mScrollbarWidth, - StyleScrollbarWidth::Auto); COMPUTE_END_INHERITED(UserInterface, ui) } @@ -5434,6 +5426,14 @@ nsRuleNode::ComputeUIResetData(void* aStartStruct, parentUI->mWindowShadow, NS_STYLE_WINDOW_SHADOW_DEFAULT); + // scrollbar-width: auto, thin, none + SetValue(*aRuleData->ValueForScrollbarWidth(), + ui->mScrollbarWidth, + conditions, + SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL, + parentUI->mScrollbarWidth, + StyleScrollbarWidth::Auto); + COMPUTE_END_RESET(UIReset, ui) } diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 334a6e99a8..77eb659377 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -547,6 +547,15 @@ nsStyleBorder::CalcDifference(const nsStyleBorder& aNewData) const return nsChangeHint_NeutralChange; } + // mBorderImage* fields are checked only when border-image is not 'none'. + if (mBorderImageSource != aNewData.mBorderImageSource || + mBorderImageRepeatH != aNewData.mBorderImageRepeatH || + mBorderImageRepeatV != aNewData.mBorderImageRepeatV || + mBorderImageSlice != aNewData.mBorderImageSlice || + mBorderImageWidth != aNewData.mBorderImageWidth) { + return nsChangeHint_NeutralChange; + } + return nsChangeHint(0); } @@ -3924,7 +3933,6 @@ nsStyleUserInterface::nsStyleUserInterface(nsPresContext* aContext) , mPointerEvents(NS_STYLE_POINTER_EVENTS_AUTO) , mCursor(NS_STYLE_CURSOR_AUTO) , mCaretColor(StyleComplexColor::Auto()) - , mScrollbarWidth(StyleScrollbarWidth::Auto) { MOZ_COUNT_CTOR(nsStyleUserInterface); } @@ -3937,7 +3945,6 @@ nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource) , mCursor(aSource.mCursor) , mCursorImages(aSource.mCursorImages) , mCaretColor(aSource.mCaretColor) - , mScrollbarWidth(aSource.mScrollbarWidth) { MOZ_COUNT_CTOR(nsStyleUserInterface); } @@ -3989,13 +3996,6 @@ nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aNewData) const if (mCaretColor != aNewData.mCaretColor) { hint |= nsChangeHint_RepaintFrame; } - - if (mScrollbarWidth != aNewData.mScrollbarWidth) { - // For scrollbar-width change, we need some special handling similar - // to overflow properties. Specifically, we may need to reconstruct - // the scrollbar or force reflow of the viewport scrollbar. - hint |= nsChangeHint_ScrollbarChange; - } return hint; } @@ -4010,6 +4010,7 @@ nsStyleUIReset::nsStyleUIReset(nsPresContext* aContext) , mIMEMode(NS_STYLE_IME_MODE_AUTO) , mWindowDragging(StyleWindowDragging::Default) , mWindowShadow(NS_STYLE_WINDOW_SHADOW_DEFAULT) + , mScrollbarWidth(StyleScrollbarWidth::Auto) { MOZ_COUNT_CTOR(nsStyleUIReset); } @@ -4020,6 +4021,7 @@ nsStyleUIReset::nsStyleUIReset(const nsStyleUIReset& aSource) , mIMEMode(aSource.mIMEMode) , mWindowDragging(aSource.mWindowDragging) , mWindowShadow(aSource.mWindowShadow) + , mScrollbarWidth(aSource.mScrollbarWidth) { MOZ_COUNT_CTOR(nsStyleUIReset); } @@ -4032,25 +4034,40 @@ nsStyleUIReset::~nsStyleUIReset() nsChangeHint nsStyleUIReset::CalcDifference(const nsStyleUIReset& aNewData) const { + nsChangeHint hint = nsChangeHint(0); + // ignore mIMEMode if (mForceBrokenImageIcon != aNewData.mForceBrokenImageIcon) { - return nsChangeHint_ReconstructFrame; + hint |= nsChangeHint_ReconstructFrame; } + if (mWindowShadow != aNewData.mWindowShadow) { // We really need just an nsChangeHint_SyncFrameView, except // on an ancestor of the frame, so we get that by doing a // reflow. - return NS_STYLE_HINT_REFLOW; + hint |= NS_STYLE_HINT_REFLOW; } + if (mUserSelect != aNewData.mUserSelect) { - return NS_STYLE_HINT_VISUAL; + hint |= NS_STYLE_HINT_VISUAL; } if (mWindowDragging != aNewData.mWindowDragging) { - return nsChangeHint_SchedulePaint; + hint |= nsChangeHint_SchedulePaint; } - return nsChangeHint(0); + if (mScrollbarWidth != aNewData.mScrollbarWidth) { + // For scrollbar-width change, we need some special handling similar + // to overflow properties. Specifically, we may need to reconstruct + // the scrollbar or force reflow of the viewport scrollbar. + hint |= nsChangeHint_ScrollbarChange; + } + + if (!hint && mIMEMode != aNewData.mIMEMode) { + hint |= nsChangeHint_NeutralChange; + } + + return hint; } //----------------------- diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index b29adafcbe..edecefdf08 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -3252,7 +3252,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset nsChangeHint CalcDifference(const nsStyleUIReset& aNewData) const; static nsChangeHint MaxDifference() { return nsChangeHint_ReconstructFrame | - NS_STYLE_HINT_REFLOW; + NS_STYLE_HINT_REFLOW | + nsChangeHint_NeutralChange; } static nsChangeHint DifferenceAlwaysHandledForDescendants() { // CalcDifference never returns the reflow hints that are sometimes @@ -3267,6 +3268,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset uint8_t mIMEMode; // [reset] mozilla::StyleWindowDragging mWindowDragging; // [reset] uint8_t mWindowShadow; // [reset] + mozilla::StyleScrollbarWidth mScrollbarWidth; // [reset] }; struct nsCursorImage @@ -3344,7 +3346,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUserInterface uint8_t mCursor; // [inherited] See nsStyleConsts.h nsTArray mCursorImages; // [inherited] images and coords mozilla::StyleComplexColor mCaretColor; // [inherited] - mozilla::StyleScrollbarWidth mScrollbarWidth; inline uint8_t GetEffectivePointerEvents(nsIFrame* aFrame) const; }; diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h index 95a51ff4ca..81c9ef99a5 100644 --- a/widget/BasicEvents.h +++ b/widget/BasicEvents.h @@ -312,7 +312,6 @@ private: break; case eTransitionEventClass: case eAnimationEventClass: - case eSVGZoomEventClass: mFlags.mCancelable = false; mFlags.mBubbles = true; break; diff --git a/widget/ContentEvents.h b/widget/ContentEvents.h index 09d4d9928c..34b1116e65 100644 --- a/widget/ContentEvents.h +++ b/widget/ContentEvents.h @@ -312,38 +312,6 @@ public: } }; -/****************************************************************************** - * mozilla::InternalSVGZoomEvent - ******************************************************************************/ - -class InternalSVGZoomEvent : public WidgetGUIEvent -{ -public: - virtual InternalSVGZoomEvent* AsSVGZoomEvent() override { return this; } - - InternalSVGZoomEvent(bool aIsTrusted, EventMessage aMessage) - : WidgetGUIEvent(aIsTrusted, aMessage, nullptr, eSVGZoomEventClass) - { - } - - virtual WidgetEvent* Duplicate() const override - { - MOZ_ASSERT(mClass == eSVGZoomEventClass, - "Duplicate() must be overridden by sub class"); - // Not copying widget, it is a weak reference. - InternalSVGZoomEvent* result = new InternalSVGZoomEvent(false, mMessage); - result->AssignSVGZoomEventData(*this, true); - result->mFlags = mFlags; - return result; - } - - void AssignSVGZoomEventData(const InternalSVGZoomEvent& aEvent, - bool aCopyTargets) - { - AssignGUIEventData(aEvent, aCopyTargets); - } -}; - /****************************************************************************** * mozilla::InternalSMILTimeEvent ******************************************************************************/ diff --git a/widget/EventClassList.h b/widget/EventClassList.h index 9667a72c5b..6582a12e45 100644 --- a/widget/EventClassList.h +++ b/widget/EventClassList.h @@ -49,7 +49,6 @@ NS_EVENT_CLASS(Internal, ClipboardEvent) NS_EVENT_CLASS(Internal, FocusEvent) NS_EVENT_CLASS(Internal, TransitionEvent) NS_EVENT_CLASS(Internal, AnimationEvent) -NS_EVENT_CLASS(Internal, SVGZoomEvent) NS_EVENT_CLASS(Internal, SMILTimeEvent) // MiscEvents.h diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp index 84772c25f4..3250fec5c9 100644 --- a/widget/windows/nsNativeThemeWin.cpp +++ b/widget/windows/nsNativeThemeWin.cpp @@ -1572,7 +1572,9 @@ GetThemeDpiScaleFactor(nsIFrame* aFrame) static bool IsScrollbarWidthThin(nsIFrame* aFrame) { - return aFrame->StyleUserInterface()->mScrollbarWidth == StyleScrollbarWidth::Thin; + nsStyleContext* styleContext = nsLayoutUtils::GetNonAnonymousStyleContext(aFrame); + auto scrollbarWidth = styleContext->StyleUIReset()->mScrollbarWidth; + return scrollbarWidth == StyleScrollbarWidth::Thin; } NS_IMETHODIMP diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index 33c6b6bfaf..901ae833e8 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -1516,6 +1516,22 @@ nsLocalFile::IsExecutable(bool* aResult) // Search for any of the set of executable extensions. static const char* const executableExts[] = { +#ifdef MOZ_WIDGET_COCOA + "afploc", // Can point to other files. + "atloc", // Can point to other files. + "fileloc", // File location files can be used to point to other + // files. + "ftploc", // Can point to other files. + "inetloc", // Shouldn't be able to do the same, but can, due to + // macOS vulnerabilities. + "atloc", // Can point to other files. + "fileloc", // File location files can be used to point to other + // files. + "ftploc", // Can point to other files. + "inetloc", // Shouldn't be able to do the same, but can, due to + // macOS vulnerabilities. + "terminal", // macOS Terminal app configuration files +#endif "air", // Adobe AIR installer "jar" // java application bundle };