Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2025-06-27 23:33:55 +08:00
commit f4d2bf6c3d
32 changed files with 149 additions and 374 deletions

View file

@ -9359,6 +9359,12 @@ private:
case 0x00A0:
aOut.AppendLiteral(" ");
break;
case '<':
aOut.AppendLiteral("&lt;");
break;
case '>':
aOut.AppendLiteral("&gt;");
break;
default:
aOut.Append(*c);
break;
@ -9500,6 +9506,12 @@ AppendEncodedAttributeValue(nsAutoString* aValue, StringBuilder& aBuilder)
case 0x00A0:
extraSpaceNeeded += ArrayLength("&nbsp;") - 2;
break;
case '<':
extraSpaceNeeded += ArrayLength("&lt;") - 2;
break;
case '>':
extraSpaceNeeded += ArrayLength("&gt;") - 2;
break;
default:
break;
}

View file

@ -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(),

View file

@ -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

View file

@ -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);
}

View file

@ -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,

View file

@ -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);
},

View file

@ -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<nsIPresShell> 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);
}

View file

@ -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);

View file

@ -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<SVGSVGElement*>(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<SVGZoomEvent>
NS_NewDOMSVGZoomEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::InternalSVGZoomEvent* aEvent)
{
RefPtr<SVGZoomEvent> it = new SVGZoomEvent(aOwner, aPresContext, aEvent);
return it.forget();
}

View file

@ -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<JSObject*> 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<DOMSVGPoint> mPreviousTranslate;
RefPtr<DOMSVGPoint> mNewTranslate;
};
} // namespace dom
} // namespace mozilla
already_AddRefed<mozilla::dom::SVGZoomEvent>
NS_NewDOMSVGZoomEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::InternalSVGZoomEvent* aEvent);
#endif // mozilla_dom_SVGZoomEvent_h

View file

@ -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')

View file

@ -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]

View file

@ -1,35 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=547596
-->
<head>
<title>Test for Bug 547596</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=547596">Mozilla Bug 547596</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<iframe id="svg" src="zoom-helper.svg"></iframe>
<script>
SimpleTest.waitForExplicitFinish();
function runTests() {
var doc = $("svg").contentWindow.document;
var root = doc.getElementById("root");
root.currentScale *= 2;
}
function zoomHandler(evt) {
ok(true, "zoom handler should be called on zoom");
SimpleTest.finish();
}
window.addEventListener("load", runTests, false);
</script>
</body>
</html>

View file

@ -1,4 +0,0 @@
<?xml version="1.0"?>
<svg id="root" version="1.1" xmlns="http://www.w3.org/2000/svg" onzoom="parent.zoomHandler(evt)">
<rect x="10" y="10" width="10" height="10" fill="green" />
</svg>

Before

Width:  |  Height:  |  Size: 188 B

View file

@ -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!

View file

@ -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;
};

View file

@ -529,7 +529,6 @@ WEBIDL_FILES = [
'SVGViewElement.webidl',
'SVGZoomAndPan.webidl',
'SVGZoomAndPanValues.webidl',
'SVGZoomEvent.webidl',
'SystemUpdate.webidl',
'TCPServerSocket.webidl',
'TCPServerSocketEvent.webidl',

View file

@ -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<nsStyleContext> 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();
}

View file

@ -2878,6 +2878,15 @@ public:
return ResolveToLength<true>(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;

View file

@ -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<NodeInfo> ni = nodeInfo;

View file

@ -79,6 +79,7 @@ Declaration::Declaration(const Declaration& aCopy)
nullptr),
mImmutable(false)
{
mContainer.mRaw = 0;
}
Declaration::~Declaration()

View file

@ -324,10 +324,18 @@ FontFaceSet::Load(JSContext* aCx,
nsTArray<RefPtr<Promise>> promises;
nsTArray<FontFace*> faces;
FindMatchingFontFaces(aFont, aText, faces, aRv);
if (aRv.Failed()) {
return nullptr;
nsTArray<RefPtr<FontFace>> faces;
{
nsTArray<FontFace*> 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);

View file

@ -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,

View file

@ -3302,7 +3302,7 @@ nsComputedDOMStyle::DoGetScrollbarWidth()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(StyleUserInterface()->mScrollbarWidth,
nsCSSProps::ValueToKeywordEnum(StyleUIReset()->mScrollbarWidth,
nsCSSProps::kScrollbarWidthKTable));
return val.forget();
}

View file

@ -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)
}

View file

@ -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;
}
//-----------------------

View file

@ -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<nsCursorImage> mCursorImages; // [inherited] images and coords
mozilla::StyleComplexColor mCaretColor; // [inherited]
mozilla::StyleScrollbarWidth mScrollbarWidth;
inline uint8_t GetEffectivePointerEvents(nsIFrame* aFrame) const;
};

View file

@ -312,7 +312,6 @@ private:
break;
case eTransitionEventClass:
case eAnimationEventClass:
case eSVGZoomEventClass:
mFlags.mCancelable = false;
mFlags.mBubbles = true;
break;

View file

@ -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
******************************************************************************/

View file

@ -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

View file

@ -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

View file

@ -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
};