import changes from `dev' branch of rmottola/Arctic-Fox:

- fix restore button on MacOS 10.6 fullscreen (08151078bd)
- Bug 1216580 - Make background-position:fixed clip stealing work with display items that create their own layer. r=mattwoodrow (7760c8ddd8)
- Bug 1222661 - Replace ToUntyped(obj) calls with obj.ToUnknown*(). r=nical (76e36824f0)
- Bug 1223310 (part 1) - Pass a LayoutDeviceIntPoint instead of an nsIntPoint to InitEvent(). r=kats. (ea95207afe)
- Bug 1223310 (part 2) - Use LayoutDeviceIntRect for bounds-related functions in nsIWidget. r=kats. (4993cccff8)
- Bug 1218552 - Fix GTK drag-and-drop coordinate scaling on HiDPI displays (r=karlt) (d03cf04136)
- fix preprocessing (2f4c1a1c94)
- Bug 1205923: Make VectorImage::GetWidth/GetHeight set outparam to 0 (not -1) on failure, to accomodate callers that don't check error codes. r=seth (487de31340)
- Bug 1212954 - Make BaseSize::IsEmpty return true for negative sizes to avoid NS_ERROR in VectorImage::GetFrameAtSize when root svg doesn't have intrinsic width or height. r=roc (402b154f56)
- fix ordering (ac8483c966)
- Bug 1216056 - Always sent OpRemoveTextureAsync as pending async Messages r=nica (66c9ee8708)
- Bug 121976 - Add a destruction handshake to PCompositable so as to avoid races between messages and the protocol. r=sotaro (636a669e44)
- Bug 1209724 - Cancel ImageBridge proxy functions if they are called too late. r=sotao (5bf81453ef)
- Bug 1221371 - Switch chromium IPC code to use mozilla::Tuple (r=jld,cpearce,kats) (eebcd419e9)
- Bug 1221371 - Remove unused Chromium callback code (r=jld) (3f2e882485)
- Bug 1221368 - Change MakeTuple to decay the types of its arguments (r=froydnj) (bed635f565)
- Bug 1181303. Set composition time earlier so that computing invalid regions works properly. r=mattwoodrow (7a3e41cd96)
- Bug 1150552 - Fix partial present bug with FPS counter. r=mattwoodrow (6e6ae92909)
- Bug 1216287 - Properly invalidate the debug overlay. r=mattwoodrow (60d4f3451a)
- Compute the compositor's damage region before composites, rather than layers updates. (bug 1217560, r=mattwoodrow) (6efcac085b)
- Bug 1216248 - Recomposite when the window overlay changes. r=mattwoodrow (8a8c5ccd07)
- Bug 1224021 - Support fractional async scroll offsets in the reftest harness. r=tn (353f75d3aa)
- Bug 1121072 - Always notify when layers cleared (r=dvander) (aa6ffc67e2)
- Bug 1224403 (part 1) - Make Configuration::mBounds a LayoutDeviceIntRect. r=kats. (7617b9da7e)
- Bug 1224403 (part 2) - Split GetClientOffset() into typed and untyped versions. r=kats. (06916479b1)
- Bug 1224403 (part 3) - Make mNonClientOffset a LayoutDeviceIntMargin. r=kats. (76efba1fb6)
- Bug 1224403 (part 4) - Make {Get,Set}NonClientMargins() return/take aLayoutDeviceIntMargin. r=kats. (99cfc2fdbc)
- Bug 1224403 (part 5) - Make OnDefaultButtonLoaded() return/take a LayoutDeviceIntMargin. r=kats (c402452f97)
- Bug 1224403 (part 6) - Remove one WidgetToScreenOffsetUntyped() call. r=kats. (8e4485a404)
- Bug 1224403 (part 7) - Use LayoutDeviceIntMargin more in IMMHandler. r=kats. (6b5e9124fc)
- Bug 1224403 (part 8) - Use LayoutDeviceIntMargin more in HyperTextAccessible. r=kats. (5bc1a04cc7)
- Bug 1224403 (part 9) - Remove GetRestoredBoundsUntyped(). r=kats. (20e2b28335)
- Bug 1224403 (part 10) - Make nsScreenGonk::GetNaturalBoundsUntyped() typed. r=kats. (9d19986f22)
- Bug 1224403 (part 11) - Remove a GetBoundsUntyped() call. r=kats. (58ce962157)
- Bug 1214267 - Followup to fix missing propagation of 'fixedPositionSides' to the compositor, and add it to the layers dump. r=mattwoodrow (7dc122eb62)
- Use compositor clip rects, not client clip rects, when computing the compositor's backbuffer damage region. (bug 1189159, r=mattwoodrow) (b70d71b1b7)
- Bug 1210784 - Layer tree invalidation with Preserves3D. r=roc (8a7bfa1a22)
- Bug 1166165 - Check if the timestamp is null to prevent assertion. r=nical (189a8d42d0)
- Bug 1137004 - Changed the location of the counter so when it is used in a maximized window it is no longer cut off, and added a little left padding. r=mattwoodrow (140d294445)
- Bug 1222661 - Replace FromUntyped(obj) calls with FromUnknown*(obj). r=nical (b399ccef2e)
- Bug 1216506. Properly initialize min inset box shadow color to black. r=mstange (335259200c)
- Bug 1223690 - Remove implicit Rect conversions. r=jrmuizel. (5aef25158f)
- Bug 1056356 - Allow calling NewRunnableMethod() with a const pointer to the callee object. r=froydnj (145279b91c)
- Bug 1209649. Part 2: Reftest to test box shadows and border radii. r=mstange (9405ccfe23)
- Bug 1211363. Part 2: reftest with int border radius. r=mstange (9edb37635e)
- Bug 1216200. Inset box shadow reftest with negative spread value. r=mstange (8350478107)
- Bug 1211264. Fallback to render dest rect with outer box shadows on non-int transforms. r=mstange (a244775d24)
- Bug 1216200. Correct for negative spread values with inset box shadows. r=mstange (4851e9c792)
- cleanup (1f78332ad8)
- Bug 1213970 - Enable APZ on iOS r=kats (1d170e32e3)
- Bug 1217939 - part 1 - remove nsContentUtils::GetViewportInfo; r=smaug (8c25236851)
- Bug 1217939 - part 2 - move nsContentUtils::GetSelectionBoundingRect to nsLayoutUtils; r=smaug (6beb37157c)
- Bug 1146713 - Don't export NO_PKG_FILES (fix ssltunnel in b2g); r=glandium (a21152c79c)
- Bug 1222323 - Avoid passing extra defines to the compiler from config.mk. r=gps (2d1076d513)
- Bug 1222321 - Avoid the duplication of OS_CPPFLAGS on the compiler command line. r=gps (cf762f1644)
- Bug 1210687 - Separate out jar.mn parsing in a separate class. r=gps (d54cc5576b)
- Bug 1219147 - Use addEntriesToListFile in mozbuild.jar.JarMaker.updateManifest. r=mshal (3cd74ff478)
- Bug 1208160 - Show information when Xcode requires accepting license agreement; r=gps (352bb43d73)
- Bug 1174524 - Make objdir path comparison case-insensitive on Windows. r=mshal (6f74f10845)
- Bug 1158898 - Cache config.guess output; r=mshal (a7b01184fa)
- Bug 1187245 - Make .mozconfig.mk environment variables available to mach valgrind-test. r=gps (2033642ceb)
This commit is contained in:
2022-12-20 12:06:53 +08:00
parent b3a39d0398
commit a7ea204c19
177 changed files with 1889 additions and 1461 deletions
+1 -1
View File
@@ -535,7 +535,7 @@ Accessible::ChildAtPoint(int32_t aX, int32_t aY,
nsIWidget* rootWidget = rootFrame->GetView()->GetNearestWidget(nullptr);
NS_ENSURE_TRUE(rootWidget, nullptr);
nsIntRect rootRect;
LayoutDeviceIntRect rootRect;
rootWidget->GetScreenBounds(rootRect);
WidgetMouseEvent dummyEvent(true, eMouseMove, rootWidget,
+8 -8
View File
@@ -1285,34 +1285,34 @@ HyperTextAccessible::CaretLineNumber()
return lineNumber;
}
nsIntRect
LayoutDeviceIntRect
HyperTextAccessible::GetCaretRect(nsIWidget** aWidget)
{
*aWidget = nullptr;
RefPtr<nsCaret> caret = mDoc->PresShell()->GetCaret();
NS_ENSURE_TRUE(caret, nsIntRect());
NS_ENSURE_TRUE(caret, LayoutDeviceIntRect());
bool isVisible = caret->IsVisible();
if (!isVisible)
return nsIntRect();
return LayoutDeviceIntRect();
nsRect rect;
nsIFrame* frame = caret->GetGeometry(&rect);
if (!frame || rect.IsEmpty())
return nsIntRect();
return LayoutDeviceIntRect();
nsPoint offset;
// Offset from widget origin to the frame origin, which includes chrome
// on the widget.
*aWidget = frame->GetNearestWidget(offset);
NS_ENSURE_TRUE(*aWidget, nsIntRect());
NS_ENSURE_TRUE(*aWidget, LayoutDeviceIntRect());
rect.MoveBy(offset);
nsIntRect caretRect;
caretRect = rect.ToOutsidePixels(frame->PresContext()->AppUnitsPerDevPixel());
LayoutDeviceIntRect caretRect = LayoutDeviceIntRect::FromUnknownRect(
rect.ToOutsidePixels(frame->PresContext()->AppUnitsPerDevPixel()));
// ((content screen origin) - (content offset in the widget)) = widget origin on the screen
caretRect.MoveBy((*aWidget)->WidgetToScreenOffsetUntyped() - (*aWidget)->GetClientOffset());
caretRect.MoveBy((*aWidget)->WidgetToScreenOffset() - (*aWidget)->GetClientOffset());
// Correct for character size, so that caret always matches the size of
// the character. This is important for font size transitions, and is
+1 -1
View File
@@ -331,7 +331,7 @@ public:
* @param [out] the widget containing the caret
* @return the caret rect
*/
nsIntRect GetCaretRect(nsIWidget** aWidget);
mozilla::LayoutDeviceIntRect GetCaretRect(nsIWidget** aWidget);
/**
* Return selected regions count within the accessible.
+1 -1
View File
@@ -1378,7 +1378,7 @@ AccessibleWrap::UpdateSystemCaretFor(Accessible* aAccessible)
return;
nsIWidget* widget = nullptr;
nsIntRect caretRect = text->GetCaretRect(&widget);
LayoutDeviceIntRect caretRect = text->GetCaretRect(&widget);
HWND caretWnd;
if (caretRect.IsEmpty() || !(caretWnd = (HWND)widget->GetNativeData(NS_NATIVE_WINDOW))) {
return;
+1 -1
View File
@@ -2,7 +2,7 @@
* 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/. */
const Cu = Components.utils;
var Cu = Components.utils;
Cu.import("resource://services-common/utils.js");
Cu.import("resource://services-sync/main.js");
+1 -1
View File
@@ -81,7 +81,7 @@ browser.jar:
content/browser/pageinfo/security.js (content/pageinfo/security.js)
#ifdef MOZ_SERVICES_SYNC
content/browser/sync/aboutSyncTabs.xul (content/sync/aboutSyncTabs.xul)
content/browser/sync/aboutSyncTabs.js (content/sync/aboutSyncTabs.js)
* content/browser/sync/aboutSyncTabs.js (content/sync/aboutSyncTabs.js)
content/browser/sync/aboutSyncTabs.css (content/sync/aboutSyncTabs.css)
content/browser/sync/aboutSyncTabs-bindings.xml (content/sync/aboutSyncTabs-bindings.xml)
content/browser/sync/setup.xul (content/sync/setup.xul)
+1 -1
View File
@@ -11,6 +11,7 @@ DIRS += [
'downloads',
'feeds',
'fuel',
'migration',
'places',
'preferences',
'privatebrowsing',
@@ -18,7 +19,6 @@ DIRS += [
'sessionstore',
'shell',
'selfsupport',
'migration',
]
if CONFIG['MOZ_BROWSER_STATUSBAR']:
-3
View File
@@ -937,9 +937,6 @@ toolbar[iconsize="small"] #webrtc-status-button {
.urlbar-icon {
cursor: pointer;
padding: 0 3px;
/* 16x16 icon with border-box sizing */
width: 22px;
height: 16px;
}
#urlbar-search-splitter {
-3
View File
@@ -913,9 +913,6 @@ html|*.urlbar-input:-moz-lwtheme::-moz-placeholder,
.urlbar-icon {
padding: 0 3px;
/* 16x16 icon with border-box sizing */
width: 22px;
height: 16px;
}
.searchbar-engine-button,
-3
View File
@@ -1340,9 +1340,6 @@ html|*.urlbar-input:-moz-lwtheme::-moz-placeholder,
.urlbar-icon {
padding: 0 3px;
/* 16x16 icon with border-box sizing */
width: 22px;
height: 16px;
}
.searchbar-engine-button,
+2
View File
@@ -92,6 +92,8 @@ class MachCommands(MachCommandBase):
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['XPCOM_DEBUG_BREAK'] = 'warn'
env.update(self.extra_environment_variables)
outputHandler = OutputHandler()
kp_kwargs = {'processOutputLine': [outputHandler]}
+4 -6
View File
@@ -115,7 +115,7 @@ FINAL_TARGET ?= $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)$(DIS
FINAL_TARGET_FROZEN := '$(FINAL_TARGET)'
ifdef XPI_NAME
DEFINES += -DXPI_NAME=$(XPI_NAME)
ACDEFINES += -DXPI_NAME=$(XPI_NAME)
endif
# The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
@@ -430,8 +430,8 @@ OS_COMPILE_CMMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
endif
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS) $(CFLAGS) $(MOZBUILD_CFLAGS)
COMPILE_CXXFLAGS = $(if $(DISABLE_STL_WRAPPING),,$(STL_FLAGS)) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS) $(CXXFLAGS) $(MOZBUILD_CXXFLAGS)
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS) $(CFLAGS) $(MOZBUILD_CFLAGS)
COMPILE_CXXFLAGS = $(if $(DISABLE_STL_WRAPPING),,$(STL_FLAGS)) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS) $(CXXFLAGS) $(MOZBUILD_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS)
ASFLAGS += $(MOZBUILD_ASFLAGS)
@@ -551,7 +551,7 @@ sysinstall_cmd = install_cmd
# overridden by the command line. (Besides, AB_CD is prettier).
AB_CD = $(MOZ_UI_LOCALE)
# Many locales directories want this definition.
DEFINES += -DAB_CD=$(AB_CD)
ACDEFINES += -DAB_CD=$(AB_CD)
ifndef L10NBASEDIR
L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
@@ -681,7 +681,5 @@ export CL_INCLUDES_PREFIX
# non-English systems.
export NONASCII
DEFINES += -DNO_NSPR_10_SUPPORT
# Freeze the values specified by moz.build to catch them if they fail.
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES) $(_DEPRECATED_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
+1 -1
View File
@@ -13,7 +13,7 @@ include $(topsrcdir)/config/config.mk
XPI_NAME = test_jar_mn
DEFINES += \
ACDEFINES += \
-DAB_CD=ab-X-stuff \
$(NULL)
+6 -48
View File
@@ -3657,7 +3657,6 @@ MOZ_DISABLE_PARENTAL_CONTROLS=1
ENABLE_SYSTEM_EXTENSION_DIRS=1
MOZ_BRANDING_DIRECTORY=
MOZ_OFFICIAL_BRANDING=
MC_OFFICIAL=1
MOZ_FEEDS=1
MOZ_AUTH_EXTENSION=1
MOZ_RAW=
@@ -4426,42 +4425,14 @@ MOZ_ARG_ENABLE_STRING(ui-locale,
MOZ_UI_LOCALE=$enableval )
AC_SUBST(MOZ_UI_LOCALE)
dnl ========================================================
dnl = Vendor override
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(official-vendor,
[ --disable-official-vendor Disable the use of official vendor.],
MC_OFFICIAL=,
MC_OFFICIAL=1)
dnl ========================================================
dnl = Trademarked Branding
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(official-branding,
[ --enable-official-branding
Enable official branding
Do not distribute builds with
--enable-official-branding unless you have
permission to use the name/logo per
http://www.palemoon.org/redist.shtml .],
[
AC_SUBST(MOZ_OFFICIAL_BRANDING)
if test -n "$MOZ_OFFICIAL_BRANDING"; then
if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
else
MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
MOZ_OFFICIAL_BRANDING=1
MC_OFFICIAL=1
AC_DEFINE(MOZ_OFFICIAL_BRANDING)
fi
], MOZ_OFFICIAL_BRANDING=)
AC_SUBST(MC_OFFICIAL)
if test -n "$MC_OFFICIAL"; then
AC_DEFINE(MC_OFFICIAL)
fi
AC_SUBST(MOZ_OFFICIAL_BRANDING)
if test -n "$MOZ_OFFICIAL_BRANDING"; then
AC_DEFINE(MOZ_OFFICIAL_BRANDING)
fi
MOZ_ARG_WITH_STRING(branding,
@@ -4481,22 +4452,6 @@ fi
AC_SUBST(MOZ_BRANDING_DIRECTORY)
dnl ========================================================
dnl = Private Build
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(private-build,
[ --enable-private-build Enable private builds
This allows you to build with official
branding for personal use only using any
build time configuration.],
MC_PRIVATE_BUILD=1,
MC_PRIVATE_BUILD=)
AC_SUBST(MC_PRIVATE_BUILD)
if test -n "$MC_PRIVATE_BUILD"; then
AC_DEFINE(MC_PRIVATE_BUILD)
fi
dnl ========================================================
dnl = Distribution ID
dnl ========================================================
@@ -8746,6 +8701,9 @@ if test -z "$JS_SHARED_LIBRARY"; then
fi
AC_SUBST(JS_SHARED_LIBRARY)
# Avoid using obsolete NSPR features
AC_DEFINE(NO_NSPR_10_SUPPORT)
MOZ_CREATE_CONFIG_STATUS()
if test "$COMPILE_ENVIRONMENT"; then
+1 -1
View File
@@ -5758,7 +5758,7 @@ nsDocShell::GetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aWidth,
{
if (mParentWidget) {
// ensure size is up-to-date if window has changed resolution
nsIntRect r;
LayoutDeviceIntRect r;
mParentWidget->GetClientBounds(r);
SetPositionAndSize(mBounds.x, mBounds.y, r.width, r.height, false);
}
-40
View File
@@ -5322,14 +5322,6 @@ static void ProcessViewportToken(nsIDocument *aDocument,
#define IS_SEPARATOR(c) ((c == '=') || (c == ',') || (c == ';') || \
(c == '\t') || (c == '\n') || (c == '\r'))
/* static */
nsViewportInfo
nsContentUtils::GetViewportInfo(nsIDocument *aDocument,
const ScreenIntSize& aDisplaySize)
{
return aDocument->GetViewportInfo(aDisplaySize);
}
/* static */
nsresult
nsContentUtils::ProcessViewportInfo(nsIDocument *aDocument,
@@ -6996,38 +6988,6 @@ nsContentUtils::GetSelectionInTextControl(Selection* aSelection,
aOutEndOffset = std::max(anchorOffset, focusOffset);
}
/* static */
nsRect
nsContentUtils::GetSelectionBoundingRect(Selection* aSel)
{
nsRect res;
// Bounding client rect may be empty after calling GetBoundingClientRect
// when range is collapsed. So we get caret's rect when range is
// collapsed.
if (aSel->IsCollapsed()) {
nsIFrame* frame = nsCaret::GetGeometry(aSel, &res);
if (frame) {
nsIFrame* relativeTo =
nsLayoutUtils::GetContainingBlockForClientRect(frame);
res = nsLayoutUtils::TransformFrameRectToAncestor(frame, res, relativeTo);
}
} else {
int32_t rangeCount = aSel->RangeCount();
nsLayoutUtils::RectAccumulator accumulator;
for (int32_t idx = 0; idx < rangeCount; ++idx) {
nsRange* range = aSel->GetRangeAt(idx);
nsRange::CollectClientRects(&accumulator, range,
range->GetStartParent(), range->StartOffset(),
range->GetEndParent(), range->EndOffset(),
true, false);
}
res = accumulator.mResultRect.IsEmpty() ? accumulator.mFirstRect :
accumulator.mResultRect;
}
return res;
}
nsIEditor*
nsContentUtils::GetHTMLEditor(nsPresContext* aPresContext)
-26
View File
@@ -1690,24 +1690,6 @@ public:
*/
static void RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable);
/**
* Retrieve information about the viewport as a data structure.
* This will return information in the viewport META data section
* of the document. This can be used in lieu of ProcessViewportInfo(),
* which places the viewport information in the document header instead
* of returning it directly.
*
* @param aDisplayWidth width of the on-screen display area for this
* document, in device pixels.
* @param aDisplayHeight height of the on-screen display area for this
* document, in device pixels.
*
* NOTE: If the site is optimized for mobile (via the doctype), this
* will return viewport information that specifies default information.
*/
static nsViewportInfo GetViewportInfo(nsIDocument* aDocument,
const mozilla::ScreenIntSize& aDisplaySize);
// Call EnterMicroTask when you're entering JS execution.
// Usually the best way to do this is to use nsAutoMicroTask.
static void EnterMicroTask();
@@ -2366,14 +2348,6 @@ public:
int32_t& aOutStartOffset,
int32_t& aOutEndOffset);
/**
* Takes a selection, and return selection's bounding rect which is relative
* to root frame.
*
* @param aSel Selection to check
*/
static nsRect GetSelectionBoundingRect(mozilla::dom::Selection* aSel);
/**
* Takes a frame for anonymous content within a text control (<input> or
* <textarea>), and returns an offset in the text content, adjusted for a
+5 -7
View File
@@ -308,7 +308,7 @@ nsDOMWindowUtils::GetViewportInfo(uint32_t aDisplayWidth,
nsIDocument* doc = GetDocument();
NS_ENSURE_STATE(doc);
nsViewportInfo info = nsContentUtils::GetViewportInfo(doc, ScreenIntSize(aDisplayWidth, aDisplayHeight));
nsViewportInfo info = doc->GetViewportInfo(ScreenIntSize(aDisplayWidth, aDisplayHeight));
*aDefaultZoom = info.GetDefaultZoom().scale;
*aAllowZoom = info.IsZoomAllowed();
*aMinZoom = info.GetMinZoom().scale;
@@ -1954,16 +1954,14 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
nsIFrame* popupFrame =
nsLayoutUtils::GetPopupFrameForEventCoordinates(presContext->GetRootPresContext(), &dummyEvent);
nsIntRect widgetBounds;
LayoutDeviceIntRect widgetBounds;
nsresult rv = widget->GetClientBounds(widgetBounds);
NS_ENSURE_SUCCESS(rv, rv);
widgetBounds.MoveTo(0, 0);
// There is no popup frame at the point and the point isn't in our widget,
// we cannot process this request.
NS_ENSURE_TRUE(popupFrame ||
widgetBounds.Contains(LayoutDeviceIntPoint::ToUntyped(pt)),
NS_ERROR_FAILURE);
NS_ENSURE_TRUE(popupFrame || widgetBounds.Contains(pt), NS_ERROR_FAILURE);
// Fire the event on the widget at the point
if (popupFrame) {
@@ -2455,7 +2453,7 @@ nsDOMWindowUtils::GetAsyncPanZoomEnabled(bool *aResult)
NS_IMETHODIMP
nsDOMWindowUtils::SetAsyncScrollOffset(nsIDOMNode* aNode,
int32_t aX, int32_t aY)
float aX, float aY)
{
nsCOMPtr<Element> element = do_QueryInterface(aNode);
if (!element) {
@@ -3736,7 +3734,7 @@ nsDOMWindowUtils::SetChromeMargin(int32_t aTop,
nsCOMPtr<nsIWidget> widget;
baseWindow->GetMainWidget(getter_AddRefs(widget));
if (widget) {
nsIntMargin margins(aTop, aRight, aBottom, aLeft);
LayoutDeviceIntMargin margins(aTop, aRight, aBottom, aLeft);
return widget->SetNonClientMargins(margins);
}
}
+3 -2
View File
@@ -13899,7 +13899,8 @@ nsGlobalWindow::NotifyDefaultButtonLoaded(Element& aDefaultButton,
aError.Throw(NS_ERROR_FAILURE);
return;
}
nsIntRect buttonRect = frame->GetScreenRect();
LayoutDeviceIntRect buttonRect =
LayoutDeviceIntRect::FromUnknownRect(frame->GetScreenRect());
// Get the widget rect in screen coordinates.
nsIWidget *widget = GetNearestWidget();
@@ -13907,7 +13908,7 @@ nsGlobalWindow::NotifyDefaultButtonLoaded(Element& aDefaultButton,
aError.Throw(NS_ERROR_FAILURE);
return;
}
nsIntRect widgetRect;
LayoutDeviceIntRect widgetRect;
aError = widget->GetScreenBounds(widgetRect);
if (aError.Failed()) {
return;
+13
View File
@@ -758,6 +758,19 @@ public:
mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aRv);
/**
* Retrieve information about the viewport as a data structure.
* This will return information in the viewport META data section
* of the document. This can be used in lieu of ProcessViewportInfo(),
* which places the viewport information in the document header instead
* of returning it directly.
*
* @param aDisplaySize size of the on-screen display area for this
* document, in device pixels.
*
* NOTE: If the site is optimized for mobile (via the doctype), this
* will return viewport information that specifies default information.
*/
virtual nsViewportInfo GetViewportInfo(const mozilla::ScreenIntSize& aDisplaySize) = 0;
/**
+2 -2
View File
@@ -19,7 +19,7 @@ static const mozilla::CSSIntSize kViewportMaxSize(10000, 10000);
/**
* Information retrieved from the <meta name="viewport"> tag. See
* nsContentUtils::GetViewportInfo for more information on this functionality.
* nsIDocument::GetViewportInfo for more information on this functionality.
*/
class MOZ_STACK_CLASS nsViewportInfo
{
@@ -68,7 +68,7 @@ class MOZ_STACK_CLASS nsViewportInfo
/**
* Constrain the viewport calculations from the
* nsContentUtils::GetViewportInfo() function in order to always return
* nsIDocument::GetViewportInfo() function in order to always return
* sane minimum/maximum values.
*/
void ConstrainViewportValues();
+4 -4
View File
@@ -214,7 +214,7 @@ ContentEventHandler::QueryContentRect(nsIContent* aContent,
resultRect.UnionRect(resultRect, frameRect);
}
aEvent->mReply.mRect = LayoutDevicePixel::FromUntyped(
aEvent->mReply.mRect = LayoutDeviceIntRect::FromUnknownRect(
resultRect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()));
aEvent->mSucceeded = true;
@@ -1081,7 +1081,7 @@ ContentEventHandler::OnQueryTextRect(WidgetQueryContentEvent* aEvent)
} else {
rect.UnionRect(rect, frameRect);
}
aEvent->mReply.mRect = LayoutDevicePixel::FromUntyped(
aEvent->mReply.mRect = LayoutDeviceIntRect::FromUnknownRect(
rect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()));
aEvent->mReply.mWritingMode = lastFrame->GetWritingMode();
aEvent->mSucceeded = true;
@@ -1129,7 +1129,7 @@ ContentEventHandler::OnQueryCaretRect(WidgetQueryContentEvent* aEvent)
NS_ENSURE_SUCCESS(rv, rv);
nscoord appUnitsPerDevPixel =
caretFrame->PresContext()->AppUnitsPerDevPixel();
aEvent->mReply.mRect = LayoutDevicePixel::FromUntyped(
aEvent->mReply.mRect = LayoutDeviceIntRect::FromUnknownRect(
caretRect.ToOutsidePixels(appUnitsPerDevPixel));
aEvent->mReply.mWritingMode = caretFrame->GetWritingMode();
aEvent->mReply.mOffset = aEvent->mInput.mOffset;
@@ -1189,7 +1189,7 @@ ContentEventHandler::OnQueryCaretRect(WidgetQueryContentEvent* aEvent)
rv = ConvertToRootRelativeOffset(frame, rect);
NS_ENSURE_SUCCESS(rv, rv);
aEvent->mReply.mRect = LayoutDevicePixel::FromUntyped(
aEvent->mReply.mRect = LayoutDeviceIntRect::FromUnknownRect(
rect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()));
// If the caret rect is empty, let's make it non-empty rect.
if (!aEvent->mReply.mRect.width) {
+1 -1
View File
@@ -4133,7 +4133,7 @@ GetWindowInnerRectCenter(nsPIDOMWindow* aWindow,
int32_t innerHeight = 0;
aWindow->GetInnerHeight(&innerHeight);
nsIntRect screen;
LayoutDeviceIntRect screen;
aWidget->GetScreenBounds(screen);
int32_t cssScreenX = aContext->DevPixelsToIntCSSPixels(screen.x);
+2 -2
View File
@@ -660,9 +660,9 @@ IMEContentObserver::OnMouseButtonEvent(nsPresContext* aPresContext,
notification.mMouseButtonEventData.mEventMessage = aMouseEvent->mMessage;
notification.mMouseButtonEventData.mOffset = charAtPt.mReply.mOffset;
notification.mMouseButtonEventData.mCursorPos.Set(
LayoutDeviceIntPoint::ToUntyped(charAtPt.refPoint));
charAtPt.refPoint.ToUnknownPoint());
notification.mMouseButtonEventData.mCharRect.Set(
LayoutDevicePixel::ToUntyped(charAtPt.mReply.mRect));
charAtPt.mReply.mRect.ToUnknownRect());
notification.mMouseButtonEventData.mButton = aMouseEvent->button;
notification.mMouseButtonEventData.mButtons = aMouseEvent->buttons;
notification.mMouseButtonEventData.mModifiers = aMouseEvent->modifiers;
+2 -2
View File
@@ -338,8 +338,8 @@ WheelTransaction::GetScreenPoint(WidgetGUIEvent* aEvent)
{
NS_ASSERTION(aEvent, "aEvent is null");
NS_ASSERTION(aEvent->widget, "aEvent-widget is null");
return LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint +
aEvent->widget->WidgetToScreenOffset());
return (aEvent->refPoint + aEvent->widget->WidgetToScreenOffset())
.ToUnknownPoint();
}
/* static */ uint32_t
+2 -2
View File
@@ -49,7 +49,7 @@ interface nsIJSRAIIHelper;
interface nsIContentPermissionRequest;
interface nsIObserver;
[scriptable, uuid(a30a95ac-3b95-4251-88dc-8efa89ba9f9c)]
[scriptable, uuid(3f3f2bf4-d411-44b2-b2f7-dee5948c4763)]
interface nsIDOMWindowUtils : nsISupports {
/**
@@ -1424,7 +1424,7 @@ interface nsIDOMWindowUtils : nsISupports {
* with that offset if async scrolling is enabled, and then the offset
* will be removed. Only call this while test-controlled refreshes is enabled.
*/
void setAsyncScrollOffset(in nsIDOMNode aNode, in int32_t aX, in int32_t aY);
void setAsyncScrollOffset(in nsIDOMNode aNode, in float aX, in float aY);
/**
* Set async zoom value. aRootElement should be the document element of our
+2 -2
View File
@@ -61,7 +61,7 @@ GMPDecryptorChild::CallOnGMPThread(MethodType aMethod, ParamType&&... aParams)
// Use const reference when we have to.
auto m = &GMPDecryptorChild::CallMethod<
decltype(aMethod), typename AddConstReference<ParamType>::Type...>;
auto t = NewRunnableMethod(this, m, aMethod, aParams...);
auto t = NewRunnableMethod(this, m, aMethod, Forward<ParamType>(aParams)...);
mPlugin->GMPMessageLoop()->PostTask(FROM_HERE, t);
}
}
@@ -116,7 +116,7 @@ GMPDecryptorChild::SessionMessage(const char* aSessionId,
msg.AppendElements(aMessage, aMessageLength);
CALL_ON_GMP_THREAD(SendSessionMessage,
nsAutoCString(aSessionId, aSessionIdLength),
aMessageType, msg);
aMessageType, Move(msg));
}
void
+2 -2
View File
@@ -828,7 +828,7 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
// Window size is tab size + chrome size.
nsIntRect tabContentBounds;
NS_ENSURE_SUCCESS(puppetWidget->GetBounds(tabContentBounds), false);
NS_ENSURE_SUCCESS(puppetWidget->GetBoundsUntyped(tabContentBounds), false);
tabContentBounds.ScaleInverseRoundOut(scaleFactor);
int32_t windowH = tabContentBounds.height + int(chromeSize.y);
@@ -934,7 +934,7 @@ NPBool nsPluginInstanceOwner::ConvertPointNoPuppet(nsIWidget *widget,
screen->GetRect(&screenX, &screenY, &screenWidth, &screenHeight);
screenHeight /= scaleFactor;
nsIntRect windowScreenBounds;
LayoutDeviceIntRect windowScreenBounds;
NS_ENSURE_SUCCESS(widget->GetScreenBounds(windowScreenBounds), false);
windowScreenBounds.ScaleInverseRoundOut(scaleFactor);
int32_t windowX = windowScreenBounds.x;
+1 -1
View File
@@ -2771,7 +2771,7 @@ PluginInstanceChild::RecvAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
mCurrentAsyncSetWindowTask =
NewRunnableMethod<PluginInstanceChild,
void (PluginInstanceChild::*)(const gfxSurfaceType&, const NPRemoteWindow&, bool),
gfxSurfaceType, NPRemoteWindow, bool>
const gfxSurfaceType&, const NPRemoteWindow&, bool>
(this, &PluginInstanceChild::DoAsyncSetWindow,
aSurfaceType, aWindow, true);
MessageLoop::current()->PostTask(FROM_HERE, mCurrentAsyncSetWindowTask);
+5 -3
View File
@@ -2004,7 +2004,7 @@ public:
explicit MarginSetter(nsIWidget* aWidget) :
mWidget(aWidget), mMargin(-1, -1, -1, -1)
{}
MarginSetter(nsIWidget *aWidget, const nsIntMargin& aMargin) :
MarginSetter(nsIWidget *aWidget, const LayoutDeviceIntMargin& aMargin) :
mWidget(aWidget), mMargin(aMargin)
{}
@@ -2018,7 +2018,7 @@ public:
private:
nsCOMPtr<nsIWidget> mWidget;
nsIntMargin mMargin;
LayoutDeviceIntMargin mMargin;
};
void
@@ -2043,7 +2043,9 @@ nsXULElement::SetChromeMargins(const nsAttrValue* aValue)
gotMargins = nsContentUtils::ParseIntMarginValue(tmp, margins);
}
if (gotMargins) {
nsContentUtils::AddScriptRunner(new MarginSetter(mainWidget, margins));
nsContentUtils::AddScriptRunner(
new MarginSetter(
mainWidget, LayoutDeviceIntMargin::FromUnknownMargin(margins)));
}
}
+1 -1
View File
@@ -1370,7 +1370,7 @@ nsWebBrowser::GetPositionAndSize(int32_t* aX, int32_t* aY,
*aCY = mInitInfo->cy;
}
} else if (mInternalWidget) {
nsIntRect bounds;
LayoutDeviceIntRect bounds;
NS_ENSURE_SUCCESS(mInternalWidget->GetBounds(bounds), NS_ERROR_FAILURE);
if (aX) {
+1 -1
View File
@@ -27,7 +27,7 @@ struct BaseSize {
void SizeTo(T aWidth, T aHeight) { width = aWidth; height = aHeight; }
bool IsEmpty() const {
return width == 0 || height == 0;
return width <= 0 || height <= 0;
}
bool IsSquare() const {
+21 -2
View File
@@ -33,6 +33,19 @@ struct IntMarginTyped:
IntMarginTyped() : Super() {}
IntMarginTyped(int32_t aTop, int32_t aRight, int32_t aBottom, int32_t aLeft) :
Super(aTop, aRight, aBottom, aLeft) {}
// XXX When all of the code is ported, the following functions to convert
// to and from unknown types should be removed.
static IntMarginTyped<units> FromUnknownMargin(const IntMarginTyped<UnknownUnits>& aMargin) {
return IntMarginTyped<units>(aMargin.top, aMargin.right,
aMargin.bottom, aMargin.left);
}
IntMarginTyped<UnknownUnits> ToUnknownMargin() const {
return IntMarginTyped<UnknownUnits>(this->top, this->right,
this->bottom, this->left);
}
};
typedef IntMarginTyped<UnknownUnits> IntMargin;
@@ -84,8 +97,8 @@ struct IntRectTyped :
void RoundIn() {}
void RoundOut() {}
// XXX When all of the code is ported, the following functions to convert to and from
// unknown types should be removed.
// XXX When all of the code is ported, the following functions to convert
// to and from unknown types should be removed.
static IntRectTyped<units> FromUnknownRect(const IntRectTyped<UnknownUnits>& rect) {
return IntRectTyped<units>(rect.x, rect.y, rect.width, rect.height);
@@ -230,6 +243,12 @@ IntRectTyped<units> RoundedOut(const RectTyped<units>& aRect)
int32_t(copy.height));
}
template<class units>
RectTyped<units> IntRectToRect(const IntRectTyped<units>& aRect)
{
return RectTyped<units>(aRect.x, aRect.y, aRect.width, aRect.height);
}
} // namespace gfx
} // namespace mozilla
+3 -2
View File
@@ -66,11 +66,12 @@ Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
while (const gfx::IntRect* rect = screenIter.Next())
{
DrawDiagnostics(aFlags | DiagnosticFlags::REGION_RECT,
ToRect(*rect), aClipRect, aTransform, aFlashCounter);
IntRectToRect(*rect), aClipRect, aTransform,
aFlashCounter);
}
}
DrawDiagnostics(aFlags, ToRect(aVisibleRegion.GetBounds()),
DrawDiagnostics(aFlags, IntRectToRect(aVisibleRegion.GetBounds()),
aClipRect, aTransform, aFlashCounter);
}
+139
View File
@@ -0,0 +1,139 @@
/* -*- Mode: C++; tab-width: 20; 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_LAYERS_IPDLACTOR_H
#define MOZILLA_LAYERS_IPDLACTOR_H
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/unused.h"
namespace mozilla {
namespace layers {
/// A base class to facilitate the deallocation of IPDL actors.
///
/// This class implements a simple deallocation protocol that avoids races
/// between async messages and actor destruction. The priniple is that the
/// child side is always the one that tells the parent that the actor pair is
/// going to be destroyed through the async Destroy message, and the parent
/// side always sends the __delete__ message.
/// Once ChildActor::Destroy has been called it is invalid to send any other
/// IPDL message from the child, although the child might receive messages
/// from the parent that were sent before the parent received the Destroy
/// message. Always check the result of ChildActor::Destroy before sending
/// anything.
///
/// The actual IPDL protocol must have the following messages:
///
/// child:
/// async __delete__();
/// parent:
/// async Destroy();
/// sync DestroySynchronously();
///
template<typename Protocol>
class ChildActor : public Protocol
{
public:
ChildActor() : mDestroyed(false) {}
~ChildActor() { MOZ_ASSERT(mDestroyed); }
/// Check the return of CanSend before sending any message!
bool CanSend() const { return !mDestroyed; }
/// The normal way to destroy the actor.
///
/// This will asynchronously send a Destroy message to the parent actor, whom
/// will send the delete message.
void Destroy()
{
MOZ_ASSERT(!mDestroyed);
if (!mDestroyed) {
mDestroyed = true;
DestroyManagees();
this->SendDestroy();
}
}
/// The ugly and slow way to destroy the actor.
///
/// This will block until the Parent actor has handled the Destroy message,
/// and then start the asynchronous handshake (and destruction will already
/// be done on the parent side, when the async part happens).
void DestroySynchronously()
{
MOZ_PERFORMANCE_WARNING("gfx", "IPDL actor requires synchronous deallocation");
MOZ_ASSERT(!mDestroyed);
if (!mDestroyed) {
DestroyManagees();
mDestroyed = true;
this->SendDestroySync();
this->SendDestroy();
}
}
/// Override this if the protocol manages other protocols, and destroy the
/// managees from there
virtual void DestroyManagees() {}
private:
bool mDestroyed;
};
/// A base class to facilitate the deallocation of IPDL actors.
///
/// Implements the parent side of the simple deallocation handshake.
/// Override the Destroy method rather than the ActorDestroy method.
template<typename Protocol>
class ParentActor : public Protocol
{
public:
ParentActor() : mDestroyed(false) {}
~ParentActor() { MOZ_ASSERT(mDestroyed); }
bool CanSend() const { return !mDestroyed; }
// Override this rather than ActorDestroy
virtual void Destroy() {}
virtual bool RecvDestroy() override
{
if (!mDestroyed) {
Destroy();
mDestroyed = true;
}
Unused << Protocol::Send__delete__(this);
return true;
}
virtual bool RecvDestroySync() override
{
if (!mDestroyed) {
Destroy();
mDestroyed = true;
}
return true;
}
typedef ipc::IProtocolManager<ipc::IProtocol>::ActorDestroyReason Why;
virtual void ActorDestroy(Why) override
{
if (!mDestroyed) {
Destroy();
mDestroyed = true;
}
}
private:
bool mDestroyed;
};
} // namespace
} // namespace
#endif
+2 -2
View File
@@ -76,8 +76,8 @@ static gfxFloat RecoverZDepth(const Matrix4x4& aTransform, const gfxPoint& aPoin
* unsolved without changing our rendering code.
*/
static LayerSortOrder CompareDepth(Layer* aOne, Layer* aTwo) {
gfxRect ourRect = aOne->GetEffectiveVisibleRegion().GetBounds();
gfxRect otherRect = aTwo->GetEffectiveVisibleRegion().GetBounds();
gfxRect ourRect = ThebesRect(aOne->GetEffectiveVisibleRegion().GetBounds());
gfxRect otherRect = ThebesRect(aTwo->GetEffectiveVisibleRegion().GetBounds());
MOZ_ASSERT(aOne->GetParent() && aOne->GetParent()->Extend3DContext() &&
aTwo->GetParent() && aTwo->GetParent()->Extend3DContext());
+52 -15
View File
@@ -33,6 +33,34 @@ namespace layers {
struct LayerPropertiesBase;
UniquePtr<LayerPropertiesBase> CloneLayerTreePropertiesInternal(Layer* aRoot, bool aIsMask = false);
/**
* Get accumulated transform of from the context creating layer to the
* given layer.
*/
static Matrix4x4
GetTransformIn3DContext(Layer* aLayer) {
Matrix4x4 transform = aLayer->GetLocalTransform();
for (Layer* layer = aLayer->GetParent();
layer && layer->Extend3DContext();
layer = layer->GetParent()) {
transform = transform * layer->GetLocalTransform();
}
return transform;
}
/**
* Get a transform for the given layer depending on extending 3D
* context.
*
* @return local transform for layers not participating 3D rendering
* context, or the accmulated transform in the context for else.
*/
static Matrix4x4
GetTransformForInvalidation(Layer* aLayer) {
return (!aLayer->Is3DContextLeaf() && !aLayer->Extend3DContext() ?
aLayer->GetLocalTransform() : GetTransformIn3DContext(aLayer));
}
static IntRect
TransformRect(const IntRect& aRect, const Matrix4x4& aTransform)
{
@@ -110,7 +138,7 @@ struct LayerPropertiesBase : public LayerProperties
, mPostXScale(aLayer->GetPostXScale())
, mPostYScale(aLayer->GetPostYScale())
, mOpacity(aLayer->GetLocalOpacity())
, mUseClipRect(!!aLayer->GetClipRect())
, mUseClipRect(!!aLayer->GetEffectiveClipRect())
{
MOZ_COUNT_CTOR(LayerPropertiesBase);
if (aLayer->GetMaskLayer()) {
@@ -121,9 +149,9 @@ struct LayerPropertiesBase : public LayerProperties
mAncestorMaskLayers.AppendElement(CloneLayerTreePropertiesInternal(maskLayer, true));
}
if (mUseClipRect) {
mClipRect = *aLayer->GetClipRect();
mClipRect = *aLayer->GetEffectiveClipRect();
}
mTransform = aLayer->GetLocalTransform();
mTransform = GetTransformForInvalidation(aLayer);
}
LayerPropertiesBase()
: mLayer(nullptr)
@@ -145,10 +173,10 @@ struct LayerPropertiesBase : public LayerProperties
nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback,
bool& aGeometryChanged)
{
bool transformChanged = !mTransform.FuzzyEqualsMultiplicative(mLayer->GetLocalTransform()) ||
mLayer->GetPostXScale() != mPostXScale ||
mLayer->GetPostYScale() != mPostYScale;
const Maybe<ParentLayerIntRect>& otherClip = mLayer->GetClipRect();
bool transformChanged = !mTransform.FuzzyEqualsMultiplicative(GetTransformForInvalidation(mLayer)) ||
mLayer->GetPostXScale() != mPostXScale ||
mLayer->GetPostYScale() != mPostYScale;
const Maybe<ParentLayerIntRect>& otherClip = mLayer->GetEffectiveClipRect();
nsIntRegion result;
bool ancestorMaskChanged = mAncestorMaskLayers.Length() != mLayer->GetAncestorMaskLayerCount();
@@ -196,7 +224,7 @@ struct LayerPropertiesBase : public LayerProperties
if (!mClipRect.IsEqualInterior(*otherClip)) {
aGeometryChanged = true;
nsIntRegion tmp;
tmp.Xor(ParentLayerIntRect::ToUntyped(mClipRect), ParentLayerIntRect::ToUntyped(*otherClip));
tmp.Xor(mClipRect.ToUnknownRect(), otherClip->ToUnknownRect());
AddRegion(result, tmp);
}
}
@@ -207,7 +235,8 @@ struct LayerPropertiesBase : public LayerProperties
IntRect NewTransformedBounds()
{
return TransformRect(mLayer->GetVisibleRegion().GetBounds(), mLayer->GetLocalTransform());
return TransformRect(mLayer->GetVisibleRegion().GetBounds(),
GetTransformForInvalidation(mLayer));
}
IntRect OldTransformedBounds()
@@ -250,15 +279,16 @@ struct ContainerLayerProperties : public LayerPropertiesBase
bool& aGeometryChanged)
{
ContainerLayer* container = mLayer->AsContainerLayer();
nsIntRegion result;
nsIntRegion invalidOfLayer; // Invalid regions of this layer.
nsIntRegion result; // Invliad regions for children only.
bool childrenChanged = false;
if (mPreXScale != container->GetPreXScale() ||
mPreYScale != container->GetPreYScale()) {
aGeometryChanged = true;
result = OldTransformedBounds();
AddRegion(result, NewTransformedBounds());
invalidOfLayer = OldTransformedBounds();
AddRegion(invalidOfLayer, NewTransformedBounds());
childrenChanged = true;
// Can't bail out early, we need to update the child container layers
@@ -317,7 +347,8 @@ struct ContainerLayerProperties : public LayerPropertiesBase
}
if (invalidateChildsCurrentArea) {
aGeometryChanged = true;
AddTransformedRegion(result, child->GetVisibleRegion(), child->GetLocalTransform());
AddTransformedRegion(result, child->GetVisibleRegion(),
GetTransformForInvalidation(child));
if (aCallback) {
NotifySubdocumentInvalidationRecursive(child, aCallback);
} else {
@@ -342,7 +373,13 @@ struct ContainerLayerProperties : public LayerPropertiesBase
container->SetChildrenChanged(true);
}
result.Transform(mLayer->GetLocalTransform());
if (!mLayer->Extend3DContext()) {
// |result| contains invalid regions only of children.
result.Transform(GetTransformForInvalidation(mLayer));
}
// else, effective transforms have applied on children.
result.OrWith(invalidOfLayer);
return result;
}
@@ -446,7 +483,7 @@ struct ImageLayerProperties : public LayerPropertiesBase
size = host->GetImageSize();
}
IntRect rect(0, 0, size.width, size.height);
return TransformRect(rect, mLayer->GetLocalTransform());
return TransformRect(rect, GetTransformForInvalidation(mLayer));
}
return NewTransformedBounds();
}
+3 -2
View File
@@ -1030,7 +1030,7 @@ Layer::GetVisibleRegionRelativeToRootLayer(nsIntRegion& aResult,
// If the parent layer clips its lower layers, clip the visible region
// we're accumulating.
if (layer->GetEffectiveClipRect()) {
aResult.AndWith(ParentLayerIntRect::ToUntyped(*layer->GetEffectiveClipRect()));
aResult.AndWith(layer->GetEffectiveClipRect()->ToUnknownRect());
}
// Now we need to walk across the list of siblings for this parent layer,
@@ -1916,8 +1916,9 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
}
if (GetIsFixedPosition()) {
LayerPoint anchor = GetFixedPositionAnchor();
aStream << nsPrintfCString(" [isFixedPosition scrollId=%lld anchor=%s%s]",
aStream << nsPrintfCString(" [isFixedPosition scrollId=%lld sides=0x%x anchor=%s%s]",
GetFixedPositionScrollContainerId(),
GetFixedPositionSides(),
ToString(anchor).c_str(),
IsClipFixed() ? "" : " scrollingClip").get();
}
+4 -2
View File
@@ -1622,7 +1622,9 @@ public:
* marked as needed to be recomposited.
*/
const nsIntRegion& GetInvalidRegion() { return mInvalidRegion; }
const void SetInvalidRegion(const nsIntRegion& aRect) { mInvalidRegion = aRect; }
const void AddInvalidRegion(const nsIntRegion& aRegion) {
mInvalidRegion.Or(mInvalidRegion, aRegion);
}
/**
* Mark the entirety of the layer's visible region as being invalid.
@@ -2070,7 +2072,7 @@ public:
RenderTargetIntRect GetIntermediateSurfaceRect()
{
NS_ASSERTION(mUseIntermediateSurface, "Must have intermediate surface");
return RenderTargetPixel::FromUntyped(mVisibleRegion.GetBounds());
return RenderTargetIntRect::FromUnknownRect(mVisibleRegion.GetBounds());
}
/**
+3 -3
View File
@@ -109,7 +109,7 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
aOperator == CompositionOp::OP_SOURCE) {
aOperator = CompositionOp::OP_OVER;
if (snapshot->GetFormat() == SurfaceFormat::B8G8R8A8) {
aTarget->ClearRect(ToRect(fillRect));
aTarget->ClearRect(IntRectToRect(fillRect));
}
}
@@ -119,7 +119,7 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
// We also need this clip in the case where we have a mask, since the mask surface
// might cover more than fillRect, but we only want to touch the pixels inside
// fillRect.
aTarget->PushClipRect(gfx::ToRect(fillRect));
aTarget->PushClipRect(IntRectToRect(fillRect));
if (aMask) {
Matrix oldTransform = aTarget->GetTransform();
@@ -149,7 +149,7 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
#else
DrawSurfaceOptions options;
#endif
aTarget->DrawSurface(snapshot, ToRect(fillRect),
aTarget->DrawSurface(snapshot, IntRectToRect(fillRect),
GetSourceRectangle(aXSide, aYSide),
options,
DrawOptions(aOpacity, aOperator));
+1 -1
View File
@@ -308,7 +308,7 @@ GetEventRegions(const LayerMetricsWrapper& aLayer)
{
if (aLayer.IsScrollInfoLayer()) {
ParentLayerIntRect compositionBounds(RoundedToInt(aLayer.Metrics().GetCompositionBounds()));
nsIntRegion hitRegion(ParentLayerIntRect::ToUntyped(compositionBounds));
nsIntRegion hitRegion(compositionBounds.ToUnknownRect());
EventRegions eventRegions(hitRegion);
eventRegions.mDispatchToContentHitRegion = eventRegions.mHitRegion;
return eventRegions;
@@ -1928,7 +1928,7 @@ protected:
// case of a scrollable frame with the event regions and clip. This lets
// us exercise the hit-testing code in APZCTreeManager
EventRegions er = aLayer->GetEventRegions();
IntRect scrollRect = LayerIntRect::ToUntyped(RoundedToInt(aScrollableRect * metrics.LayersPixelsPerCSSPixel()));
IntRect scrollRect = RoundedToInt(aScrollableRect * metrics.LayersPixelsPerCSSPixel()).ToUnknownRect();
er.mHitRegion = nsIntRegion(IntRect(layerBound.TopLeft(), scrollRect.Size()));
aLayer->SetEventRegions(er);
}
+1 -1
View File
@@ -587,7 +587,7 @@ BasicCompositor::EndFrame()
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
// We're still clipped to mInvalidRegion, so just fill the bounds.
mRenderTarget->mDrawTarget->FillRect(ToRect(mInvalidRegion.GetBounds()),
mRenderTarget->mDrawTarget->FillRect(IntRectToRect(mInvalidRegion.GetBounds()),
ColorPattern(Color(r, g, b, 0.2f)));
}
+1 -1
View File
@@ -125,7 +125,7 @@ BasicContainerLayer::ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect)
childRegion.MoveBy(int32_t(childTransform._31), int32_t(childTransform._32));
childRegion.And(childRegion, rect);
if (l->GetClipRect()) {
childRegion.And(childRegion, ParentLayerIntRect::ToUntyped(*l->GetClipRect()) + offset);
childRegion.And(childRegion, l->GetClipRect()->ToUnknownRect() + offset);
}
nsIntRegion intersection;
intersection.And(covered, childRegion);
+3 -3
View File
@@ -324,7 +324,7 @@ MarkLayersHidden(Layer* aLayer, const IntRect& aClipRect,
{
const Maybe<ParentLayerIntRect>& clipRect = aLayer->GetEffectiveClipRect();
if (clipRect) {
IntRect cr = ParentLayerIntRect::ToUntyped(*clipRect);
IntRect cr = clipRect->ToUnknownRect();
// clipRect is in the container's coordinate system. Get it into the
// global coordinate system.
if (aLayer->GetParent()) {
@@ -404,7 +404,7 @@ ApplyDoubleBuffering(Layer* aLayer, const IntRect& aVisibleRect)
{
const Maybe<ParentLayerIntRect>& clipRect = aLayer->GetEffectiveClipRect();
if (clipRect) {
IntRect cr = ParentLayerIntRect::ToUntyped(*clipRect);
IntRect cr = clipRect->ToUnknownRect();
// clipRect is in the container's coordinate system. Get it into the
// global coordinate system.
if (aLayer->GetParent()) {
@@ -1014,7 +1014,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
#endif
Matrix4x4 effectiveTransform = aLayer->GetEffectiveTransform();
RefPtr<gfxASurface> result =
Transform3D(untransformedDT->Snapshot(), aTarget, bounds,
Transform3D(untransformedDT->Snapshot(), aTarget, ThebesRect(bounds),
effectiveTransform, destRect);
if (result) {
+3 -3
View File
@@ -203,7 +203,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
hal::GetCurrentScreenConfiguration(&currentConfig);
orientation = currentConfig.orientation();
}
IntRect targetBounds = mWidget->GetNaturalBounds();
IntRect targetBounds = mWidget->GetNaturalBoundsUntyped();
targetBounds.x = targetBounds.y = 0;
mForwarder->BeginTransaction(targetBounds, mTargetRotation, orientation);
@@ -215,7 +215,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
//
// Desktop does not support async zoom yet, so we ignore this for those
// platforms.
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_UIKIT)
if (mWidget && mWidget->GetOwningTabChild()) {
mCompositorMightResample = AsyncPanZoomEnabled();
}
@@ -492,7 +492,7 @@ ClientLayerManager::MakeSnapshotIfRequired()
// when there's a rotation. Instead we rotate the result
// when drawing into dt
IntRect outerBounds;
mWidget->GetBounds(outerBounds);
mWidget->GetBoundsUntyped(outerBounds);
IntRect bounds = ToOutsideIntRect(mShadowTarget->GetClipExtents());
if (mTargetRotation) {
@@ -310,7 +310,7 @@ ClientTiledPaintedLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion,
nsIntRegion oldValidRegion = mContentClient->GetTiledBuffer()->GetValidRegion();
oldValidRegion.And(oldValidRegion, aVisibleRegion);
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
oldValidRegion.And(oldValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
oldValidRegion.And(oldValidRegion, mPaintData.mCriticalDisplayPort.ToUnknownRect());
}
TILING_LOG("TILING %p: Progressive update with old valid region %s\n", this, Stringify(oldValidRegion).c_str());
@@ -323,7 +323,7 @@ ClientTiledPaintedLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion,
mValidRegion = aVisibleRegion;
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
mValidRegion.And(mValidRegion, mPaintData.mCriticalDisplayPort.ToUnknownRect());
}
TILING_LOG("TILING %p: Non-progressive paint invalid region %s\n", this, Stringify(aInvalidRegion).c_str());
@@ -344,7 +344,7 @@ ClientTiledPaintedLayer::RenderLowPrecision(nsIntRegion& aInvalidRegion,
{
// Render the low precision buffer, if the visible region is larger than the
// critical display port.
if (!nsIntRegion(LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)).Contains(aVisibleRegion)) {
if (!nsIntRegion(mPaintData.mCriticalDisplayPort.ToUnknownRect()).Contains(aVisibleRegion)) {
nsIntRegion oldValidRegion = mContentClient->GetLowPrecisionTiledBuffer()->GetValidRegion();
oldValidRegion.And(oldValidRegion, aVisibleRegion);
@@ -491,15 +491,15 @@ ClientTiledPaintedLayer::RenderLayer()
// only draw stuff inside the critical displayport on the first update.
mValidRegion.And(mValidRegion, neededRegion);
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
mValidRegion.And(mValidRegion, mPaintData.mCriticalDisplayPort.ToUnknownRect());
invalidRegion.And(invalidRegion, mPaintData.mCriticalDisplayPort.ToUnknownRect());
}
TILING_LOG("TILING %p: First-transaction valid region %s\n", this, Stringify(mValidRegion).c_str());
TILING_LOG("TILING %p: First-transaction invalid region %s\n", this, Stringify(invalidRegion).c_str());
} else {
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
invalidRegion.And(invalidRegion, mPaintData.mCriticalDisplayPort.ToUnknownRect());
}
TILING_LOG("TILING %p: Repeat-transaction invalid region %s\n", this, Stringify(invalidRegion).c_str());
}
+13 -8
View File
@@ -17,6 +17,7 @@
#include "mozilla/layers/TextureD3D9.h"
#endif
#include "gfxUtils.h"
#include "IPDLActor.h"
namespace mozilla {
namespace layers {
@@ -29,7 +30,7 @@ using namespace mozilla::gfx;
*
* CompositableChild is owned by a CompositableClient.
*/
class CompositableChild : public PCompositableChild
class CompositableChild : public ChildActor<PCompositableChild>
, public AsyncTransactionTrackersHolder
{
public:
@@ -128,7 +129,6 @@ CompositableClient::CompositableClient(CompositableForwarder* aForwarder,
: mCompositableChild(nullptr)
, mForwarder(aForwarder)
, mTextureFlags(aTextureFlags)
, mDestroyed(false)
{
MOZ_COUNT_CTOR(CompositableClient);
}
@@ -160,6 +160,7 @@ CompositableClient::GetIPDLActor() const
bool
CompositableClient::Connect(ImageContainer* aImageContainer)
{
MOZ_ASSERT(!mCompositableChild);
if (!GetForwarder() || GetIPDLActor()) {
return false;
}
@@ -167,20 +168,24 @@ CompositableClient::Connect(ImageContainer* aImageContainer)
return true;
}
bool
CompositableClient::IsConnected() const
{
return mCompositableChild && mCompositableChild->CanSend();
}
void
CompositableClient::Destroy()
{
mDestroyed = true;
if (!mCompositableChild) {
if (!IsConnected()) {
return;
}
// Send pending AsyncMessages before deleting CompositableChild.
// They might have dependency to the mCompositableChild.
mForwarder->SendPendingAsyncMessges();
// Delete CompositableChild.
// Destroy CompositableChild.
mCompositableChild->mCompositableClient = nullptr;
PCompositableChild::Send__delete__(mCompositableChild);
mCompositableChild->Destroy();
mCompositableChild = nullptr;
}
@@ -279,7 +284,7 @@ CompositableClient::DumpTextureClient(std::stringstream& aStream,
AutoRemoveTexture::~AutoRemoveTexture()
{
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
if (mCompositable && mTexture && mCompositable->GetForwarder()) {
if (mCompositable && mTexture && mCompositable->IsConnected()) {
// remove old buffer from CompositableHost
RefPtr<AsyncTransactionWaiter> waiter = new AsyncTransactionWaiter();
RefPtr<AsyncTransactionTracker> tracker =
+1 -2
View File
@@ -156,7 +156,7 @@ public:
void Destroy();
bool IsDestroyed() { return mDestroyed; }
bool IsConnected() const;
PCompositableChild* GetIPDLActor() const;
@@ -238,7 +238,6 @@ protected:
// Some layers may want to enforce some flags to all their textures
// (like disallowing tiling)
TextureFlags mTextureFlags;
bool mDestroyed;
RefPtr<TextureClientRecycleAllocator> mTextureClientRecycler;
friend class CompositableChild;
@@ -114,7 +114,6 @@ protected:
{
MOZ_COUNT_DTOR(SingleTiledContentClient);
mDestroyed = true;
mTiledBuffer->ReleaseTiles();
}
+8 -10
View File
@@ -25,6 +25,7 @@
#include "nsPrintfCString.h" // for nsPrintfCString
#include "LayersLogging.h" // for AppendToString
#include "gfxUtils.h" // for gfxUtils::GetAsLZ4Base64Str
#include "IPDLActor.h"
#ifdef XP_WIN
#include "mozilla/layers/TextureD3D9.h"
@@ -87,7 +88,7 @@ struct ReleaseKeepAlive : public nsRunnable
* TextureClient's data until the compositor side confirmed that it is safe to
* deallocte or recycle the it.
*/
class TextureChild final : public PTextureChild
class TextureChild final : public ChildActor<PTextureChild>
{
~TextureChild()
{
@@ -126,6 +127,7 @@ public:
mWaitForRecycle = mDestroyed ? nullptr : mTextureClient;
}
RECYCLE_LOG("[CLIENT] Wait for recycle %p\n", mWaitForRecycle.get());
MOZ_ASSERT(CanSend());
SendClientRecycle();
}
@@ -614,15 +616,11 @@ void TextureClient::ForceRemove(bool sync)
}
if (mValid && mActor) {
FinalizeOnIPDLThread();
if (sync || GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
MOZ_PERFORMANCE_WARNING("gfx", "TextureClient/Host pair requires synchronous deallocation");
if (mActor->IPCOpen()) {
mActor->SendClearTextureHostSync();
mActor->SendRemoveTexture();
}
} else {
if (mActor->IPCOpen()) {
mActor->SendRemoveTexture();
if (mActor->CanSend()) {
if (sync || GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
mActor->DestroySynchronously();
} else {
mActor->Destroy();
}
}
}
+2 -2
View File
@@ -1507,13 +1507,13 @@ ClientMultiTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& a
// make the progressive paint more visible to the user while scrolling.
// On B2G uploads are cheaper and we value coherency more, especially outside
// the browser, so we always use the entire user-visible area.
IntRect coherentUpdateRect(LayerIntRect::ToUntyped(RoundedOut(
IntRect coherentUpdateRect(RoundedOut(
#ifdef MOZ_WIDGET_ANDROID
transformedCompositionBounds->Intersect(aPaintData->mCompositionBounds)
#else
*transformedCompositionBounds
#endif
)));
).ToUnknownRect());
TILING_LOG("TILING %p: Progressive update final coherency rect %s\n", mPaintedLayer, Stringify(coherentUpdateRect).c_str());
+2 -3
View File
@@ -648,9 +648,8 @@ protected:
~MultiTiledContentClient()
{
MOZ_COUNT_DTOR(MultiTiledContentClient);
mDestroyed = true;
mTiledBuffer.DiscardBuffers();
mTiledBuffer.DiscardBuffers();
mLowPrecisionTiledBuffer.DiscardBuffers();
}
@@ -14,7 +14,7 @@
#include "mozilla/layers/Effects.h" // for EffectChain
#include "mozilla/mozalloc.h" // for operator delete
#include "nsAString.h"
#include "mozilla/RefPtr.h" // for nsRefPtr
#include "mozilla/RefPtr.h" // for nsRefPtr
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsString.h" // for nsAutoCString
#include "gfxVR.h"
+4 -3
View File
@@ -14,11 +14,12 @@
#include "mozilla/layers/ImageContainerParent.h"
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
#include "mozilla/layers/TextureHost.h" // for TextureHost, etc
#include "mozilla/RefPtr.h" // for nsRefPtr
#include "mozilla/RefPtr.h" // for nsRefPtr
#include "nsDebug.h" // for NS_WARNING
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "gfxPlatform.h" // for gfxPlatform
#include "mozilla/layers/PCompositableParent.h"
#include "IPDLActor.h"
namespace mozilla {
@@ -36,7 +37,7 @@ class Compositor;
* by either the CompositableChild's deletion, or by the IPDL communication
* going down.
*/
class CompositableParent : public PCompositableParent
class CompositableParent : public ParentActor<PCompositableParent>
{
public:
CompositableParent(CompositableParentManager* aMgr,
@@ -62,7 +63,7 @@ public:
CompositableMap::Erase(mHost->GetAsyncID());
}
virtual void ActorDestroy(ActorDestroyReason why) override
virtual void Destroy() override
{
if (mHost) {
mHost->Detach(nullptr, CompositableHost::FORCE_DETACH);
@@ -226,9 +226,11 @@ ContainerRenderVR(ContainerT* aContainer,
// proper bounds here (visible region bounds are 0,0,0,0)
// and I'm not sure if this is the bounds we want anyway.
if (layer->GetType() == Layer::TYPE_CANVAS) {
layerBounds = ToRect(static_cast<CanvasLayer*>(layer)->GetBounds());
layerBounds =
IntRectToRect(static_cast<CanvasLayer*>(layer)->GetBounds());
} else {
layerBounds = ToRect(layer->GetEffectiveVisibleRegion().GetBounds());
layerBounds =
IntRectToRect(layer->GetEffectiveVisibleRegion().GetBounds());
}
const gfx::Matrix4x4 childTransform = layer->GetEffectiveTransform();
layerBounds = childTransform.TransformBounds(layerBounds);
@@ -410,7 +412,7 @@ ContainerPrepare(ContainerT* aContainer,
surface = CreateOrRecycleTarget(aContainer, aManager);
MOZ_PERFORMANCE_WARNING("gfx", "[%p] Container layer requires intermediate surface rendering\n", aContainer);
RenderIntermediate(aContainer, aManager, RenderTargetPixel::ToUntyped(aClipRect), surface);
RenderIntermediate(aContainer, aManager, aClipRect.ToUnknownRect(), surface);
aContainer->SetChildrenChanged(false);
}
@@ -562,7 +564,7 @@ RenderLayers(ContainerT* aContainer,
layerToRender->SetClearRect(gfx::IntRect(0, 0, 0, 0));
}
} else {
layerToRender->RenderLayer(RenderTargetPixel::ToUntyped(clipRect));
layerToRender->RenderLayer(clipRect.ToUnknownRect());
}
if (gfxPrefs::UniformityInfo()) {
@@ -670,7 +672,7 @@ RenderIntermediate(ContainerT* aContainer,
compositor->SetRenderTarget(surface);
// pre-render all of the layers into our temporary
RenderLayers(aContainer, aManager, RenderTargetPixel::FromUntyped(aClipRect));
RenderLayers(aContainer, aManager, RenderTargetIntRect::FromUnknownRect(aClipRect));
// Unbind the current surface and rebind the previous one.
compositor->SetRenderTarget(previousTarget);
}
@@ -726,7 +728,7 @@ ContainerRender(ContainerT* aContainer,
container->GetEffectiveTransform());
});
} else {
RenderLayers(aContainer, aManager, RenderTargetPixel::FromUntyped(aClipRect));
RenderLayers(aContainer, aManager, RenderTargetIntRect::FromUnknownRect(aClipRect));
}
aContainer->mPrepared = nullptr;
+117 -57
View File
@@ -44,7 +44,7 @@
#include "ipc/ShadowLayerUtils.h"
#include "mozilla/mozalloc.h" // for operator new, etc
#include "nsAppRunner.h"
#include "mozilla/RefPtr.h" // for nsRefPtr
#include "mozilla/RefPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_WARNING, NS_RUNTIMEABORT, etc
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
@@ -121,6 +121,7 @@ LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor)
, mDebugOverlayWantsNextFrame(false)
, mGeometryChanged(true)
, mLastFrameMissedHWC(false)
, mWindowOverlayChanged(false)
{
mTextRenderer = new TextRenderer(aCompositor);
MOZ_ASSERT(aCompositor);
@@ -148,6 +149,7 @@ LayerManagerComposite::Destroy()
RootLayer()->Destroy();
}
mRoot = nullptr;
mClonedLayerTreeProperties = nullptr;
mDestroyed = true;
}
}
@@ -175,8 +177,6 @@ LayerManagerComposite::BeginTransaction()
}
mIsCompositorReady = true;
mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot());
}
void
@@ -247,7 +247,7 @@ LayerManagerComposite::ApplyOcclusionCulling(Layer* aLayer, nsIntRegion& aOpaque
localOpaque.MoveBy(transform2d._31, transform2d._32);
const Maybe<ParentLayerIntRect>& clip = aLayer->GetEffectiveClipRect();
if (clip) {
localOpaque.And(localOpaque, ParentLayerIntRect::ToUntyped(*clip));
localOpaque.And(localOpaque, clip->ToUnknownRect());
}
aOpaqueRegion.Or(aOpaqueRegion, localOpaque);
}
@@ -277,41 +277,16 @@ LayerManagerComposite::EndTransaction(const TimeStamp& aTimeStamp,
return;
}
if (mRoot && mClonedLayerTreeProperties) {
MOZ_ASSERT(!mTarget);
nsIntRegion invalid =
mClonedLayerTreeProperties->ComputeDifferences(mRoot, nullptr, &mGeometryChanged);
mClonedLayerTreeProperties = nullptr;
// Set composition timestamp here because we need it in
// ComputeEffectiveTransforms (so the correct video frame size is picked) and
// also to compute invalid regions properly.
mCompositor->SetCompositionTime(aTimeStamp);
mInvalidRegion.Or(mInvalidRegion, invalid);
} else if (!mTarget) {
mInvalidRegion.Or(mInvalidRegion, mRenderBounds);
}
if (mInvalidRegion.IsEmpty() && !mTarget) {
// Composition requested, but nothing has changed. Don't do any work.
return;
}
if (mRoot && !(aFlags & END_NO_IMMEDIATE_REDRAW)) {
if (mRoot && !(aFlags & END_NO_IMMEDIATE_REDRAW)) {
MOZ_ASSERT(!aTimeStamp.IsNull());
// Set composition timestamp here because we need it in
// ComputeEffectiveTransforms (so the correct video frame size is picked)
mCompositor->SetCompositionTime(aTimeStamp);
// The results of our drawing always go directly into a pixel buffer,
// so we don't need to pass any global transform here.
mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4());
nsIntRegion opaque;
ApplyOcclusionCulling(mRoot, opaque);
Render();
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
RenderToPresentationSurface();
#endif
mGeometryChanged = false;
UpdateAndRender();
} else {
// Modified layer tree
// Modified the layer tree.
mGeometryChanged = true;
}
@@ -324,6 +299,78 @@ LayerManagerComposite::EndTransaction(const TimeStamp& aTimeStamp,
#endif
}
void
LayerManagerComposite::UpdateAndRender()
{
nsIntRegion invalid;
bool didEffectiveTransforms = false;
if (mClonedLayerTreeProperties) {
// Effective transforms are needed by ComputeDifferences().
mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4());
didEffectiveTransforms = true;
// We need to compute layer tree differences even if we're not going to
// immediately use the resulting damage area, since ComputeDifferences
// is also responsible for invalidates intermediate surfaces in
// ContainerLayers.
nsIntRegion changed = mClonedLayerTreeProperties->ComputeDifferences(mRoot, nullptr, &mGeometryChanged);
if (mTarget) {
// Since we're composing to an external target, we're not going to use
// the damage region from layers changes - we want to composite
// everything in the target bounds. Instead we accumulate the layers
// damage region for the next window composite.
mInvalidRegion.Or(mInvalidRegion, changed);
} else {
invalid = Move(changed);
}
}
if (mTarget) {
invalid.Or(invalid, mTargetBounds);
} else {
// If we didn't have a previous layer tree, invalidate the entire render
// area.
if (!mClonedLayerTreeProperties) {
invalid.Or(invalid, mRenderBounds);
}
// Add any additional invalid rects from the window manager or previous
// damage computed during ComposeToTarget().
invalid.Or(invalid, mInvalidRegion);
mInvalidRegion.SetEmpty();
}
// Update cached layer tree information.
mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot());
if (invalid.IsEmpty() && !mWindowOverlayChanged) {
// Composition requested, but nothing has changed. Don't do any work.
return;
}
// We don't want our debug overlay to cause more frames to happen
// so we will invalidate after we've decided if something changed.
InvalidateDebugOverlay(mRenderBounds);
if (!didEffectiveTransforms) {
// The results of our drawing always go directly into a pixel buffer,
// so we don't need to pass any global transform here.
mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4());
}
nsIntRegion opaque;
ApplyOcclusionCulling(mRoot, opaque);
Render(invalid);
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
RenderToPresentationSurface();
#endif
mGeometryChanged = false;
mWindowOverlayChanged = false;
}
already_AddRefed<DrawTarget>
LayerManagerComposite::CreateOptimalMaskDrawTarget(const IntSize &aSize)
{
@@ -391,6 +438,26 @@ LayerManagerComposite::RootLayer() const
#include "qrcode_table.h"
#endif
void
LayerManagerComposite::InvalidateDebugOverlay(const IntRect& aBounds)
{
bool drawFps = gfxPrefs::LayersDrawFPS();
bool drawFrameCounter = gfxPrefs::DrawFrameCounter();
bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
if (drawFps || drawFrameCounter) {
AddInvalidRegion(nsIntRect(0, 0, 256, 256));
}
if (drawFrameColorBars) {
AddInvalidRegion(nsIntRect(0, 0, 10, aBounds.height));
}
if (drawFrameColorBars) {
AddInvalidRegion(nsIntRect(0, 0, 10, aBounds.height));
}
}
static uint16_t sFrameCount = 0;
void
LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds)
@@ -411,7 +478,7 @@ LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds)
// Draw a translation delay warning overlay
int width;
int border;
if ((now - mWarnTime).ToMilliseconds() < kVisualWarningDuration) {
if (!mWarnTime.IsNull() && (now - mWarnTime).ToMilliseconds() < kVisualWarningDuration) {
EffectChain effects;
// Black blorder
@@ -444,7 +511,7 @@ LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds)
#endif
float fillRatio = mCompositor->GetFillRatio();
mFPS->DrawFPS(now, drawFrameColorBars ? 10 : 0, 0, unsigned(fillRatio), mCompositor);
mFPS->DrawFPS(now, drawFrameColorBars ? 10 : 1, 2, unsigned(fillRatio), mCompositor);
if (mUnusedApzTransformWarning) {
// If we have an unused APZ transform on this composite, draw a 20x20 red box
@@ -457,6 +524,8 @@ LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds)
mUnusedApzTransformWarning = false;
SetDebugOverlayWantsNextFrame(true);
}
// Each frame is invalidate by the previous frame for simplicity
} else {
mFPS = nullptr;
}
@@ -471,6 +540,7 @@ LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds)
effects,
1.0,
gfx::Matrix4x4());
}
#ifdef MOZ_PROFILING
@@ -513,6 +583,7 @@ LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds)
}
}
}
}
#endif
@@ -611,7 +682,7 @@ LayerManagerComposite::PopGroupForLayerEffects(RefPtr<CompositingRenderTarget> a
}
void
LayerManagerComposite::Render()
LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion)
{
PROFILER_LABEL("LayerManagerComposite", "Render",
js::ProfileEntry::Category::GRAPHICS);
@@ -671,8 +742,6 @@ LayerManagerComposite::Render()
}
}
mCompositor->EndFrameForExternalComposition(Matrix());
// Reset the invalid region as compositing is done
mInvalidRegion.SetEmpty();
mLastFrameMissedHWC = false;
return;
} else if (!mTarget && !haveLayerEffects) {
@@ -688,15 +757,6 @@ LayerManagerComposite::Render()
}
}
nsIntRegion invalid;
if (mTarget) {
invalid = mTargetBounds;
} else {
invalid = mInvalidRegion;
// Reset the invalid region now that we've begun compositing.
mInvalidRegion.SetEmpty();
}
ParentLayerIntRect clipRect;
Rect bounds(mRenderBounds.x, mRenderBounds.y, mRenderBounds.width, mRenderBounds.height);
Rect actualBounds;
@@ -706,10 +766,10 @@ LayerManagerComposite::Render()
if (mRoot->GetClipRect()) {
clipRect = *mRoot->GetClipRect();
Rect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
mCompositor->BeginFrame(invalid, &rect, bounds, nullptr, &actualBounds);
mCompositor->BeginFrame(aInvalidRegion, &rect, bounds, nullptr, &actualBounds);
} else {
gfx::Rect rect;
mCompositor->BeginFrame(invalid, nullptr, bounds, &rect, &actualBounds);
mCompositor->BeginFrame(aInvalidRegion, nullptr, bounds, &rect, &actualBounds);
clipRect = ParentLayerIntRect(rect.x, rect.y, rect.width, rect.height);
}
@@ -733,7 +793,7 @@ LayerManagerComposite::Render()
// Render our layers.
RootLayer()->Prepare(ViewAs<RenderTargetPixel>(clipRect, PixelCastJustification::RenderTargetIsParentLayerForRoot));
RootLayer()->RenderLayer(ParentLayerIntRect::ToUntyped(clipRect));
RootLayer()->RenderLayer(clipRect.ToUnknownRect());
if (!mRegionToClear.IsEmpty()) {
nsIntRegionRectIterator iter(mRegionToClear);
@@ -745,7 +805,7 @@ LayerManagerComposite::Render()
if (mTwoPassTmpTarget) {
MOZ_ASSERT(haveLayerEffects);
PopGroupForLayerEffects(previousTarget, ParentLayerIntRect::ToUntyped(clipRect),
PopGroupForLayerEffects(previousTarget, clipRect.ToUnknownRect(),
grayscaleVal, invertVal, contrastVal);
}
@@ -916,7 +976,7 @@ LayerManagerComposite::RenderToPresentationSurface()
}
GLContext* gl = compositor->gl();
GLContextEGL* egl = GLContextEGL::Cast(gl);
const IntSize windowSize = mirrorScreen->GetNaturalBounds().Size();
const IntSize windowSize = mirrorScreen->GetNaturalBounds().Size().ToUnknownSize();
#endif
if ((windowSize.width <= 0) || (windowSize.height <= 0)) {
@@ -978,7 +1038,7 @@ LayerManagerComposite::RenderToPresentationSurface()
const IntRect clipRect = IntRect(0, 0, actualWidth, actualHeight);
RootLayer()->Prepare(RenderTargetPixel::FromUntyped(clipRect));
RootLayer()->Prepare(RenderTargetIntRect::FromUnknownRect(clipRect));
RootLayer()->RenderLayer(clipRect);
mCompositor->EndFrame();
@@ -1008,7 +1068,7 @@ SubtractTransformedRegion(nsIntRegion& aRegion,
// subtract it from the screen region.
nsIntRegionRectIterator it(aRegionToSubtract);
while (const IntRect* rect = it.Next()) {
Rect incompleteRect = aTransform.TransformAndClipBounds(ToRect(*rect),
Rect incompleteRect = aTransform.TransformAndClipBounds(IntRectToRect(*rect),
Rect::MaxIntRect());
aRegion.Sub(aRegion, IntRect(incompleteRect.x,
incompleteRect.y,
+18 -1
View File
@@ -279,6 +279,11 @@ public:
aNotifications->AppendElements(Move(mImageCompositeNotifications));
}
// Indicate that we need to composite even if nothing in our layers has
// changed, so that the widget can draw something different in its window
// overlay.
void SetWindowOverlayChanged() { mWindowOverlayChanged = true; }
private:
/** Region we're clipping our current drawing to. */
nsIntRegion mClippingRegion;
@@ -298,14 +303,24 @@ private:
nsIntRegion& aLowPrecisionScreenRegion,
const gfx::Matrix4x4& aTransform);
/**
* Update the invalid region and render it.
*/
void UpdateAndRender();
/**
* Render the current layer tree to the active target.
*/
void Render();
void Render(const nsIntRegion& aInvalidRegion);
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
void RenderToPresentationSurface();
#endif
/**
* We need to know our invalid region before we're ready to render.
*/
void InvalidateDebugOverlay(const gfx::IntRect& aBounds);
/**
* Render debug overlays such as the FPS/FrameCounter above the frame.
*/
@@ -347,6 +362,8 @@ private:
// Testing property. If hardware composer is supported, this will return
// true if the last frame was deemed 'too complicated' to be rendered.
bool mLastFrameMissedHWC;
bool mWindowOverlayChanged;
};
/**
+4 -38
View File
@@ -26,6 +26,7 @@
#include "../opengl/CompositorOGL.h"
#include "gfxPrefs.h"
#include "gfxUtils.h"
#include "IPDLActor.h"
#ifdef MOZ_ENABLE_D3D10_LAYER
#include "../d3d11/CompositorD3D11.h"
@@ -61,7 +62,7 @@ namespace layers {
* TextureParent is the host-side IPDL glue between TextureClient and TextureHost.
* It is an IPDL actor just like LayerParent, CompositableParent, etc.
*/
class TextureParent : public PTextureParent
class TextureParent : public ParentActor<PTextureParent>
{
public:
explicit TextureParent(CompositableParentManager* aManager);
@@ -76,17 +77,11 @@ public:
virtual bool RecvClientRecycle() override;
virtual bool RecvClearTextureHostSync() override;
virtual bool RecvRemoveTexture() override;
virtual bool RecvRecycleTexture(const TextureFlags& aTextureFlags) override;
TextureHost* GetTextureHost() { return mTextureHost; }
void ActorDestroy(ActorDestroyReason why) override;
void ClearTextureHost();
virtual void Destroy() override;
CompositableParentManager* mCompositableManager;
RefPtr<TextureHost> mWaitForClientRecycle;
@@ -816,37 +811,8 @@ TextureParent::Init(const SurfaceDescriptor& aSharedData,
return !!mTextureHost;
}
bool
TextureParent::RecvRemoveTexture()
{
return PTextureParent::Send__delete__(this);
}
bool
TextureParent::RecvClearTextureHostSync()
{
ClearTextureHost();
return true;
}
void
TextureParent::ActorDestroy(ActorDestroyReason why)
{
switch (why) {
case AncestorDeletion:
case Deletion:
case NormalShutdown:
case AbnormalShutdown:
break;
case FailedConstructor:
NS_RUNTIMEABORT("FailedConstructor isn't possible in PTexture");
}
ClearTextureHost();
}
void
TextureParent::ClearTextureHost()
TextureParent::Destroy()
{
if (!mTextureHost) {
return;
+1 -1
View File
@@ -1191,7 +1191,7 @@ void
CompositorD3D11::EnsureSize()
{
IntRect rect;
mWidget->GetClientBounds(rect);
mWidget->GetClientBoundsUntyped(rect);
mSize = rect.Size();
}
+1 -1
View File
@@ -704,7 +704,7 @@ void
CompositorD3D9::EnsureSize()
{
IntRect rect;
mWidget->GetClientBounds(rect);
mWidget->GetClientBoundsUntyped(rect);
mSize = rect.Size();
}
+1
View File
@@ -430,5 +430,6 @@ void CompositorBench(Compositor* aCompositor, const gfx::Rect& aScreenRect)
} // namespace layers
} // namespace mozilla
#endif
+32 -10
View File
@@ -114,6 +114,7 @@ ImageBridgeChild::UseTextures(CompositableClient* aCompositable,
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->GetIPDLActor());
MOZ_ASSERT(aCompositable->IsConnected());
nsAutoTArray<TimedTexture,4> textures;
@@ -143,7 +144,7 @@ ImageBridgeChild::UseComponentAlphaTextures(CompositableClient* aCompositable,
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aTextureOnWhite);
MOZ_ASSERT(aTextureOnBlack);
MOZ_ASSERT(aCompositable->GetIPDLActor());
MOZ_ASSERT(aCompositable->IsConnected());
MOZ_ASSERT(aTextureOnWhite->GetIPDLActor());
MOZ_ASSERT(aTextureOnBlack->GetIPDLActor());
MOZ_ASSERT(aTextureOnBlack->GetSize() == aTextureOnWhite->GetSize());
@@ -159,6 +160,7 @@ ImageBridgeChild::UseOverlaySource(CompositableClient* aCompositable,
const nsIntRect& aPictureRect)
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->IsConnected());
mTxn->AddEdit(OpUseOverlaySource(nullptr, aCompositable->GetIPDLActor(),
aOverlay, aPictureRect));
}
@@ -366,7 +368,7 @@ static void ReleaseImageClientNow(ImageClient* aClient,
if (aClient) {
aClient->Release();
}
if (aChild) {
if (aChild && ImageBridgeChild::IsCreated()) {
aChild->SendAsyncDelete();
}
}
@@ -456,8 +458,13 @@ void ImageBridgeChild::DispatchReleaseTextureClient(TextureClient* aClient)
NewRunnableFunction(&ReleaseTextureClientNow, aClient));
}
static void UpdateImageClientNow(ImageClient* aClient, ImageContainer* aContainer)
static void UpdateImageClientNow(ImageClient* aClient, RefPtr<ImageContainer>&& aContainer)
{
if (!ImageBridgeChild::IsCreated()) {
NS_WARNING("Something is holding on to graphics resources after the shutdown"
"of the graphics subsystem!");
return;
}
MOZ_ASSERT(aClient);
MOZ_ASSERT(aContainer);
sImageBridgeChildSingleton->BeginTransaction();
@@ -469,6 +476,11 @@ static void UpdateImageClientNow(ImageClient* aClient, ImageContainer* aContaine
void ImageBridgeChild::DispatchImageClientUpdate(ImageClient* aClient,
ImageContainer* aContainer)
{
if (!ImageBridgeChild::IsCreated()) {
NS_WARNING("Something is holding on to graphics resources after the shutdown"
"of the graphics subsystem!");
return;
}
if (!aClient || !aContainer || !IsCreated()) {
return;
}
@@ -479,10 +491,7 @@ void ImageBridgeChild::DispatchImageClientUpdate(ImageClient* aClient,
}
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
FROM_HERE,
NewRunnableFunction<
void (*)(ImageClient*, ImageContainer*),
ImageClient*,
RefPtr<ImageContainer> >(&UpdateImageClientNow, aClient, aContainer));
NewRunnableFunction(&UpdateImageClientNow, aClient, RefPtr<ImageContainer>(aContainer)));
}
static void UpdateAsyncCanvasRendererSync(AsyncCanvasRenderer* aWrapper,
@@ -531,8 +540,19 @@ void ImageBridgeChild::UpdateAsyncCanvasRendererNow(AsyncCanvasRenderer* aWrappe
}
static void FlushAllImagesSync(ImageClient* aClient, ImageContainer* aContainer,
AsyncTransactionWaiter* aWaiter)
RefPtr<AsyncTransactionWaiter>&& aWaiter)
{
if (!ImageBridgeChild::IsCreated()) {
// How sad. If we get into this branch it means that the ImageBridge
// got destroyed between the time we ImageBridgeChild::FlushAllImage
// was called on some thread, and the time this function was proxied
// to the ImageBridge thread. ImageBridge gets destroyed way to late
// in the shutdown of gecko for this to be happening for a good reason.
NS_WARNING("Something is holding on to graphics resources after the shutdown"
"of the graphics subsystem!");
aWaiter->DecrementWaitCount();
return;
}
MOZ_ASSERT(aClient);
sImageBridgeChildSingleton->BeginTransaction();
if (aContainer) {
@@ -1074,7 +1094,8 @@ ImageBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositabl
MOZ_ASSERT(!mShuttingDown);
MOZ_ASSERT(aTexture);
MOZ_ASSERT(aTexture->IsSharedWithCompositor());
if (!aTexture || !aTexture->IsSharedWithCompositor()) {
MOZ_ASSERT(aCompositable->IsConnected());
if (!aTexture || !aTexture->IsSharedWithCompositor() || !aCompositable->IsConnected()) {
return;
}
if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
@@ -1096,7 +1117,8 @@ ImageBridgeChild::RemoveTextureFromCompositableAsync(AsyncTransactionTracker* aA
MOZ_ASSERT(!mShuttingDown);
MOZ_ASSERT(aTexture);
MOZ_ASSERT(aTexture->IsSharedWithCompositor());
if (!aTexture || !aTexture->IsSharedWithCompositor()) {
MOZ_ASSERT(aCompositable->IsConnected());
if (!aTexture || !aTexture->IsSharedWithCompositor() || !aCompositable->IsConnected()) {
return;
}
mTxn->AddNoSwapEdit(OpRemoveTextureAsync(CompositableClient::GetTrackersHolderId(aCompositable->GetIPDLActor()),
+10 -4
View File
@@ -346,10 +346,13 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
layer->SetMaskLayer(nullptr);
}
layer->SetAnimations(common.animations());
layer->SetInvalidRegion(common.invalidRegion());
layer->SetFrameMetrics(common.metrics());
layer->SetDisplayListLog(common.displayListLog().get());
// The updated invalid region is added to the existing one, since we can
// update multiple times before the next composite.
layer->AddInvalidRegion(common.invalidRegion());
nsTArray<RefPtr<Layer>> maskLayers;
for (size_t i = 0; i < common.ancestorMaskLayersParent().Length(); i++) {
Layer* maskLayer = cast(common.ancestorMaskLayersParent().ElementAt(i))->AsLayer();
@@ -457,6 +460,10 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
edit.get_OpSetDiagnosticTypes().diagnostics());
break;
}
case Edit::TOpWindowOverlayChanged: {
mLayerManager->SetWindowOverlayChanged();
break;
}
// Tree ops
case Edit::TOpSetRoot: {
MOZ_LAYERS_LOG(("[ParentSide] SetRoot"));
@@ -774,7 +781,7 @@ GetAPZCForViewID(Layer* aLayer, FrameMetrics::ViewID aScrollID)
bool
LayerTransactionParent::RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aScrollID,
const int32_t& aX, const int32_t& aY)
const float& aX, const float& aY)
{
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
return false;
@@ -881,9 +888,8 @@ LayerTransactionParent::RecvClearCachedResources()
// context, it's just a subtree root. We need to scope the clear
// of resources to exactly that subtree, so we specify it here.
mLayerManager->ClearCachedResources(mRoot);
mShadowLayersManager->NotifyClearCachedResources(this);
}
mShadowLayersManager->NotifyClearCachedResources(this);
return true;
}
+1 -1
View File
@@ -132,7 +132,7 @@ protected:
MaybeTransform* aTransform)
override;
virtual bool RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aId,
const int32_t& aX, const int32_t& aY) override;
const float& aX, const float& aY) override;
virtual bool RecvSetAsyncZoom(const FrameMetrics::ViewID& aId,
const float& aValue) override;
virtual bool RecvFlushApzRepaints() override;
+2
View File
@@ -300,6 +300,7 @@ struct OpRepositionChild { PLayer container; PLayer childLayer; PLayer after; }
struct OpRaiseToTopChild { PLayer container; PLayer childLayer; };
struct OpSetDiagnosticTypes { DiagnosticTypes diagnostics; };
struct OpWindowOverlayChanged { };
struct ShmemSection {
Shmem shmem;
@@ -458,6 +459,7 @@ union Edit {
OpSetLayerAttributes;
OpSetDiagnosticTypes;
OpWindowOverlayChanged;
OpSetRoot;
OpInsertAfter;
+12 -2
View File
@@ -15,9 +15,19 @@ namespace layers {
async protocol PCompositable
{
manager PImageBridge or PLayerTransaction;
parent:
child:
async __delete__();
parent:
/**
* Asynchronously tell the compositor side to remove the texture.
*/
async Destroy();
/**
* Never used (needed for ParentActor).
*/
async DestroySync();
};
} // namespace
} // namespace
+1 -1
View File
@@ -90,7 +90,7 @@ parent:
// The next time the layer tree is composited, add this async scroll offset in
// CSS pixels for the given ViewID.
// Useful for testing rendering of async scrolling.
sync SetAsyncScrollOffset(ViewID id, int32_t x, int32_t y);
sync SetAsyncScrollOffset(ViewID id, float x, float y);
// The next time the layer tree is composited, include this async zoom in
// for the given ViewID.
+4 -4
View File
@@ -32,14 +32,14 @@ parent:
async ClientRecycle();
/**
* Synchronously tell the TextureChild to clear TextureHost.
* Asynchronously tell the compositor side to remove the texture.
*/
sync ClearTextureHostSync();
async Destroy();
/**
* Asynchronously tell the Compositor side to remove the texture.
* Synchronously tell the compositor side to remove the texture.
*/
async RemoveTexture();
sync DestroySync();
async RecycleTexture(TextureFlags aTextureFlags);
};
+35 -20
View File
@@ -332,8 +332,8 @@ void
ShadowLayerForwarder::UseTiledLayerBuffer(CompositableClient* aCompositable,
const SurfaceDescriptorTiles& aTileLayerDescriptor)
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->GetIPDLActor());
MOZ_ASSERT(aCompositable && aCompositable->IsConnected());
mTxn->AddNoSwapPaint(OpUseTiledLayerBuffer(nullptr, aCompositable->GetIPDLActor(),
aTileLayerDescriptor));
}
@@ -344,7 +344,9 @@ ShadowLayerForwarder::UpdateTextureRegion(CompositableClient* aCompositable,
const nsIntRegion& aUpdatedRegion)
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->GetIPDLActor());
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->IsConnected());
mTxn->AddPaint(OpPaintTextureRegion(nullptr, aCompositable->GetIPDLActor(),
aThebesBufferData,
aUpdatedRegion));
@@ -354,8 +356,7 @@ void
ShadowLayerForwarder::UseTextures(CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures)
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->GetIPDLActor());
MOZ_ASSERT(aCompositable && aCompositable->IsConnected());
nsAutoTArray<TimedTexture,4> textures;
@@ -386,12 +387,14 @@ ShadowLayerForwarder::UseComponentAlphaTextures(CompositableClient* aCompositabl
TextureClient* aTextureOnWhite)
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->IsConnected());
MOZ_ASSERT(aTextureOnWhite);
MOZ_ASSERT(aTextureOnBlack);
MOZ_ASSERT(aCompositable->GetIPDLActor());
MOZ_ASSERT(aTextureOnBlack->GetIPDLActor());
MOZ_ASSERT(aTextureOnWhite->GetIPDLActor());
MOZ_ASSERT(aTextureOnBlack->GetSize() == aTextureOnWhite->GetSize());
mTxn->AddEdit(OpUseComponentAlphaTextures(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTextureOnBlack->GetIPDLActor(),
nullptr, aTextureOnWhite->GetIPDLActor()));
@@ -404,6 +407,8 @@ ShadowLayerForwarder::UseOverlaySource(CompositableClient* aCompositable,
const nsIntRect& aPictureRect)
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->IsConnected());
mTxn->AddEdit(OpUseOverlaySource(nullptr, aCompositable->GetIPDLActor(),
aOverlay, aPictureRect));
}
@@ -415,8 +420,13 @@ ShadowLayerForwarder::RemoveTextureFromCompositable(CompositableClient* aComposi
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aTexture);
MOZ_ASSERT(aCompositable->GetIPDLActor());
MOZ_ASSERT(aCompositable->IsConnected());
MOZ_ASSERT(aTexture->GetIPDLActor());
if (!aCompositable->IsConnected() || !aTexture->GetIPDLActor()) {
// We don't have an actor anymore, don't try to use it!
return;
}
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor()));
if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
@@ -431,23 +441,25 @@ ShadowLayerForwarder::RemoveTextureFromCompositableAsync(AsyncTransactionTracker
CompositableClient* aCompositable,
TextureClient* aTexture)
{
if (mTxn->Opened() && !aCompositable->IsDestroyed()) {
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aTexture);
MOZ_ASSERT(aCompositable->IsConnected());
MOZ_ASSERT(aTexture->GetIPDLActor());
#ifdef MOZ_WIDGET_GONK
mPendingAsyncMessages.push_back(OpRemoveTextureAsync(CompositableClient::GetTrackersHolderId(aCompositable->GetIPDLActor()),
aAsyncTransactionTracker->GetId(),
nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor()));
#else
if (mTxn->Opened() && aCompositable->IsConnected()) {
mTxn->AddEdit(OpRemoveTextureAsync(CompositableClient::GetTrackersHolderId(aCompositable->GetIPDLActor()),
aAsyncTransactionTracker->GetId(),
nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor()));
} else {
// If the function is called outside of transaction,
// OpRemoveTextureAsync message is stored as pending message.
#ifdef MOZ_WIDGET_GONK
mPendingAsyncMessages.push_back(OpRemoveTextureAsync(CompositableClient::GetTrackersHolderId(aCompositable->GetIPDLActor()),
aAsyncTransactionTracker->GetId(),
nullptr, aCompositable->GetIPDLActor(),
nullptr, aTexture->GetIPDLActor()));
#else
NS_RUNTIMEABORT("not reached");
#endif
}
#endif
CompositableClient::HoldUntilComplete(aCompositable->GetIPDLActor(),
aAsyncTransactionTracker);
}
@@ -501,7 +513,7 @@ ShadowLayerForwarder::StorePluginWidgetConfigurations(const nsTArray<nsIWidget::
const nsIWidget::Configuration& configuration = aConfigurations[idx];
mPluginWindowData.AppendElement(PluginWindowData(configuration.mWindowID,
configuration.mClipRegion,
configuration.mBounds,
configuration.mBounds.ToUnknownRect(),
configuration.mVisible));
}
}
@@ -532,10 +544,13 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
mDiagnosticTypes = diagnostics;
mTxn->AddEdit(OpSetDiagnosticTypes(diagnostics));
}
if (mWindowOverlayChanged) {
mTxn->AddEdit(OpWindowOverlayChanged());
}
AutoTxnEnd _(mTxn);
if (mTxn->Empty() && !mTxn->RotationChanged() && !mWindowOverlayChanged) {
if (mTxn->Empty() && !mTxn->RotationChanged()) {
MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?) and no rotation event, skipping Update()"));
return true;
}
@@ -583,6 +598,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
if (mutant->GetIsFixedPosition()) {
common.fixedPositionScrollContainerId() = mutant->GetFixedPositionScrollContainerId();
common.fixedPositionAnchor() = mutant->GetFixedPositionAnchor();
common.fixedPositionSides() = mutant->GetFixedPositionSides();
common.isClipFixed() = mutant->IsClipFixed();
}
common.isStickyPosition() = mutant->GetIsStickyPosition();
@@ -631,7 +647,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
AutoInfallibleTArray<Edit, 10> cset;
size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size();
MOZ_ASSERT(nCsets > 0 || mWindowOverlayChanged || mTxn->RotationChanged(), "should have bailed by now");
MOZ_ASSERT(nCsets > 0 || mTxn->RotationChanged(), "should have bailed by now");
cset.SetCapacity(nCsets);
if (!mTxn->mCset.empty()) {
@@ -800,7 +816,6 @@ void ShadowLayerForwarder::Attach(CompositableClient* aCompositable,
{
MOZ_ASSERT(aLayer);
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->GetIPDLActor());
mTxn->AddEdit(OpAttachCompositable(nullptr, Shadow(aLayer),
nullptr, aCompositable->GetIPDLActor()));
}
+2 -2
View File
@@ -1389,9 +1389,9 @@ CompositorOGL::EndFrame()
#ifdef MOZ_DUMP_PAINTING
if (gfxEnv::DumpCompositorTextures()) {
IntRect rect;
LayoutDeviceIntRect rect;
if (mUseExternalSurfaceSize) {
rect = IntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
rect = LayoutDeviceIntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
} else {
mWidget->GetBounds(rect);
}
+2 -2
View File
@@ -844,12 +844,12 @@ public:
return Super::operator=(mozilla::Move(aRegion));
}
static IntRegionTyped FromUntyped(const IntRegionTyped<UnknownUnits>& aRegion)
static IntRegionTyped FromUnknownRegion(const IntRegionTyped<UnknownUnits>& aRegion)
{
return IntRegionTyped(aRegion.Impl());
}
private:
// This is deliberately private, so calling code uses FromUntyped().
// This is deliberately private, so calling code uses FromUnknownRegion().
explicit IntRegionTyped(const nsRegion& aRegion) : Super(aRegion) {}
};
+4 -2
View File
@@ -33,11 +33,13 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD GetClientBounds(IntRect &aRect) override {
NS_IMETHOD GetClientBoundsUntyped(IntRect &aRect) override {
aRect = IntRect(0, 0, gCompWidth, gCompHeight);
return NS_OK;
}
NS_IMETHOD GetBounds(IntRect &aRect) override { return GetClientBounds(aRect); }
NS_IMETHOD GetBoundsUntyped(IntRect &aRect) override {
return GetClientBoundsUntyped(aRect);
}
void* GetNativeData(uint32_t aDataType) override {
if (aDataType == NS_NATIVE_OPENGL_CONTEXT) {
+5 -5
View File
@@ -29,11 +29,6 @@ inline RectDouble ToRectDouble(const gfxRect &aRect)
return RectDouble(aRect.x, aRect.y, aRect.width, aRect.height);
}
inline Rect ToRect(const IntRect &aRect)
{
return Rect(aRect.x, aRect.y, aRect.width, aRect.height);
}
inline Matrix ToMatrix(const gfxMatrix &aMatrix)
{
return Matrix(Float(aMatrix._11), Float(aMatrix._12), Float(aMatrix._21),
@@ -76,6 +71,11 @@ inline gfxRect ThebesRect(const Rect &aRect)
return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
inline gfxRect ThebesRect(const IntRect &aRect)
{
return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
inline gfxRect ThebesRect(const RectDouble &aRect)
{
return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
+56 -21
View File
@@ -449,18 +449,15 @@ CacheBlur(DrawTarget& aDT,
// Blurs a small surface and creates the mask.
static already_AddRefed<SourceSurface>
CreateBlurMask(const IntSize& aRectSize,
CreateBlurMask(const IntSize& aMinSize,
RectCornerRadii* aCornerRadii,
IntSize aBlurRadius,
IntMargin& aExtendDestBy,
IntMargin& aSliceBorder,
DrawTarget& aDestDrawTarget)
{
IntMargin slice;
gfxAlphaBoxBlur blur;
IntSize minSize =
ComputeMinSizeForShadowShape(aCornerRadii, aBlurRadius, slice, aRectSize);
IntRect minRect(IntPoint(), minSize);
IntRect minRect(IntPoint(), aMinSize);
gfxContext* blurCtx = blur.Init(ThebesRect(Rect(minRect)), IntSize(),
aBlurRadius, nullptr, nullptr);
@@ -488,7 +485,7 @@ CreateBlurMask(const IntSize& aRectSize,
IntRect expandedMinRect(topLeft, result->GetSize());
aExtendDestBy = expandedMinRect - minRect;
aSliceBorder = slice + aExtendDestBy;
aSliceBorder += aExtendDestBy;
MOZ_ASSERT(aSliceBorder.LeftRight() <= expandedMinRect.width);
MOZ_ASSERT(aSliceBorder.TopBottom() <= expandedMinRect.height);
@@ -513,14 +510,15 @@ CreateBoxShadow(SourceSurface* aBlurMask, const Color& aShadowColor)
return boxShadowDT->Snapshot();
}
static SourceSurface*
static already_AddRefed<SourceSurface>
GetBlur(DrawTarget& aDT,
const IntSize& aRectSize,
const IntSize& aBlurRadius,
RectCornerRadii* aCornerRadii,
const Color& aShadowColor,
IntMargin& aExtendDestBy,
IntMargin& aSlice)
IntMargin& aSlice,
gfxContext* aDestinationCtx)
{
if (!gBlurCache) {
gBlurCache = new BlurCache();
@@ -529,18 +527,28 @@ GetBlur(DrawTarget& aDT,
IntSize minSize =
ComputeMinSizeForShadowShape(aCornerRadii, aBlurRadius, aSlice, aRectSize);
// We can get seams using the min size rect when drawing to the destination rect
// if we have a non-pixel aligned destination transformation. In those cases,
// fallback to just rendering the destination rect.
Matrix destMatrix = ToMatrix(aDestinationCtx->CurrentMatrix());
bool useDestRect = !destMatrix.IsRectilinear() || destMatrix.HasNonIntegerTranslation();
if (useDestRect) {
minSize = aRectSize;
}
BlurCacheData* cached = gBlurCache->Lookup(minSize, aBlurRadius,
aCornerRadii, aShadowColor,
aDT.GetBackendType());
if (cached) {
if (cached && !useDestRect) {
// See CreateBlurMask() for these values
aExtendDestBy = cached->mExtendDest;
aSlice = aSlice + aExtendDestBy;
return cached->mBlur;
RefPtr<SourceSurface> blur = cached->mBlur;
return blur.forget();
}
RefPtr<SourceSurface> blurMask =
CreateBlurMask(aRectSize, aCornerRadii, aBlurRadius, aExtendDestBy, aSlice, aDT);
CreateBlurMask(minSize, aCornerRadii, aBlurRadius, aExtendDestBy, aSlice, aDT);
if (!blurMask) {
return nullptr;
@@ -551,8 +559,13 @@ GetBlur(DrawTarget& aDT,
return nullptr;
}
CacheBlur(aDT, minSize, aBlurRadius, aCornerRadii, aShadowColor, aExtendDestBy, boxShadow);
return boxShadow;
if (useDestRect) {
// Since we're just going to paint the actual rect to the destination
aSlice.SizeTo(0, 0, 0, 0);
} else {
CacheBlur(aDT, minSize, aBlurRadius, aCornerRadii, aShadowColor, aExtendDestBy, boxShadow);
}
return boxShadow.forget();
}
void
@@ -698,7 +711,8 @@ gfxAlphaBoxBlur::BlurRectangle(gfxContext* aDestinationCtx,
RefPtr<SourceSurface> boxShadow = GetBlur(destDrawTarget,
rect.Size(), blurRadius,
aCornerRadii, aShadowColor,
extendDestBy, slice);
extendDestBy, slice,
aDestinationCtx);
if (!boxShadow) {
return;
}
@@ -815,8 +829,27 @@ ComputeRectsForInsetBoxShadow(IntSize aBlurRadius,
ceil(cornerWidth) + rectBufferSize.width);
aOutPathMargins = innerMargin;
IntSize minInnerSize(innerMargin.LeftRight() + 1,
innerMargin.TopBottom() + 1);
// If we have a negative spread radius, we would not have enough
// size to actually do the blur. So the min size must be the abs() of the blur
// and spread radius.
IntSize minBlurSize(std::abs(aSpreadRadius.width) + std::abs(aBlurRadius.width),
std::abs(aSpreadRadius.height) + std::abs(aBlurRadius.height));
IntMargin minInnerMargins = IntMargin(ceil(cornerHeight) + minBlurSize.height,
ceil(cornerWidth) + minBlurSize.width,
ceil(cornerHeight) + minBlurSize.height,
ceil(cornerWidth) + minBlurSize.width);
IntSize minInnerSize(minInnerMargins.LeftRight() + 1,
minInnerMargins.TopBottom() + 1);
if (aShadowClipRect.height < minInnerSize.height) {
minInnerSize.height = aShadowClipRect.height;
}
if (aShadowClipRect.width < minInnerSize.width) {
minInnerSize.width = aShadowClipRect.width;
}
// Then expand the outer rect based on the size between the inner/outer rects
IntSize minOuterSize(minInnerSize);
@@ -922,18 +955,20 @@ gfxAlphaBoxBlur::GetInsetBlur(IntMargin& aExtendDestBy,
// When rendering inset box shadows, we respect the spread radius by changing
// the shape of the unblurred shadow, and can pass a spread radius of zero here.
IntSize zeroSpread(0, 0);
gfxContext* minGfxContext = Init(ThebesRect(ToRect(outerRect)),
gfxContext* minGfxContext = Init(ThebesRect(outerRect),
zeroSpread, aBlurRadius, nullptr, nullptr);
if (!minGfxContext) {
return nullptr;
}
DrawTarget* minDrawTarget = minGfxContext->GetDrawTarget();
RefPtr<Path> maskPath = GetBoxShadowInsetPath(minDrawTarget, ToRect(outerRect),
ToRect(innerRect), aHasBorderRadius,
aInnerClipRadii);
RefPtr<Path> maskPath =
GetBoxShadowInsetPath(minDrawTarget, IntRectToRect(outerRect),
IntRectToRect(innerRect), aHasBorderRadius,
aInnerClipRadii);
minGfxContext->SetColor(aShadowColor);
Color black(0.f, 0.f, 0.f, 1.f);
minGfxContext->SetColor(black);
minGfxContext->SetPath(maskPath);
minGfxContext->Fill();
-2
View File
@@ -71,8 +71,6 @@ struct gfxRect :
Super(aPos, aSize) {}
gfxRect(gfxFloat aX, gfxFloat aY, gfxFloat aWidth, gfxFloat aHeight) :
Super(aX, aY, aWidth, aHeight) {}
MOZ_IMPLICIT gfxRect(const mozilla::gfx::IntRect& aRect) :
Super(aRect.x, aRect.y, aRect.width, aRect.height) {}
/**
* Return true if all components of this rect are within
+32 -14
View File
@@ -497,14 +497,23 @@ NS_IMETHODIMP
VectorImage::GetWidth(int32_t* aWidth)
{
if (mError || !mIsFullyLoaded) {
*aWidth = -1;
} else {
SVGSVGElement* rootElem = mSVGDocumentWrapper->GetRootSVGElem();
MOZ_ASSERT(rootElem, "Should have a root SVG elem, since we finished "
"loading without errors");
*aWidth = rootElem->GetIntrinsicWidth();
// XXXdholbert Technically we should leave outparam untouched when we
// fail. But since many callers don't check for failure, we set it to 0 on
// failure, for sane/predictable results.
*aWidth = 0;
return NS_ERROR_FAILURE;
}
return *aWidth >= 0 ? NS_OK : NS_ERROR_FAILURE;
SVGSVGElement* rootElem = mSVGDocumentWrapper->GetRootSVGElem();
MOZ_ASSERT(rootElem, "Should have a root SVG elem, since we finished "
"loading without errors");
int32_t rootElemWidth = rootElem->GetIntrinsicWidth();
if (rootElemWidth < 0) {
*aWidth = 0;
return NS_ERROR_FAILURE;
}
*aWidth = rootElemWidth;
return NS_OK;
}
//******************************************************************************
@@ -561,14 +570,23 @@ NS_IMETHODIMP
VectorImage::GetHeight(int32_t* aHeight)
{
if (mError || !mIsFullyLoaded) {
*aHeight = -1;
} else {
SVGSVGElement* rootElem = mSVGDocumentWrapper->GetRootSVGElem();
MOZ_ASSERT(rootElem, "Should have a root SVG elem, since we finished "
"loading without errors");
*aHeight = rootElem->GetIntrinsicHeight();
// XXXdholbert Technically we should leave outparam untouched when we
// fail. But since many callers don't check for failure, we set it to 0 on
// failure, for sane/predictable results.
*aHeight = 0;
return NS_ERROR_FAILURE;
}
return *aHeight >= 0 ? NS_OK : NS_ERROR_FAILURE;
SVGSVGElement* rootElem = mSVGDocumentWrapper->GetRootSVGElem();
MOZ_ASSERT(rootElem, "Should have a root SVG elem, since we finished "
"loading without errors");
int32_t rootElemHeight = rootElem->GetIntrinsicHeight();
if (rootElemHeight < 0) {
*aHeight = 0;
return NS_ERROR_FAILURE;
}
*aHeight = rootElemHeight;
return NS_OK;
}
//******************************************************************************
+1 -1
View File
@@ -304,7 +304,7 @@ imgFrame::InitWithDrawable(gfxDrawable* aDrawable,
nsIntRect imageRect(0, 0, mSize.width, mSize.height);
RefPtr<gfxContext> ctx = new gfxContext(target);
gfxUtils::DrawPixelSnapped(ctx, aDrawable, mSize,
ImageRegion::Create(imageRect),
ImageRegion::Create(ThebesRect(imageRect)),
mFormat, aFilter, aImageFlags);
if (canUseDataSurface && !mImageSurface) {
+36
View File
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html class="reftest-wait">
<body>
</body>
<script>
function createImage(loadHandler) {
var newImage = new Image;
newImage.id = "thepreviewimage";
newImage.setAttribute("src", "unsized-svg.svg");
if (loadHandler) {
newImage.onload = loadHandler;
}
// Query width & height, and display them in document:
physWidth = newImage.width;
physHeight = newImage.height;
document.documentElement.innerHTML +=
physWidth + " x " + physHeight + "<br>";
}
function part2() {
// Load image again:
createImage();
// End the crashtest.
document.documentElement.removeAttribute("class");
}
function startTest() {
// Trigger image load, and call part2() when it's loaded:
createImage(part2);
}
startTest();
</script>
</html>
+16
View File
@@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<filter id="f">
<!-- the image data is
<svg xmlns="http://www.w3.org/2000/svg" width="-5" height="1%" />
-->
<feImage xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSItNSIgaGVpZ2h0
PSIxJSIgLz4K" />
</filter>
</defs>
<rect width="1" height="1" filter="url(#f)" />
</svg>

After

Width:  |  Height:  |  Size: 464 B

+3
View File
@@ -53,6 +53,9 @@ load invalid-disposal-method-1.gif
load invalid-disposal-method-2.gif
load invalid-disposal-method-3.gif
load 1205923-1.html
load 1212954-1.svg
# Ensure we handle ICO directory entries which specify the wrong size for the
# contained resource.
load invalid_ico_height.ico
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg"></svg>

After

Width:  |  Height:  |  Size: 47 B

+85 -393
View File
@@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +10,50 @@
#include "base/revocable_store.h"
#include "base/tracked.h"
#include "base/tuple.h"
#include "mozilla/IndexSequence.h"
#include "mozilla/Tuple.h"
// Helper functions so that we can call a function a pass it arguments that come
// from a Tuple.
namespace details {
// Call the given method on the given object. Arguments are passed by move
// semantics from the given tuple. If the tuple has length N, the sequence must
// be IndexSequence<0, 1, ..., N-1>.
template<size_t... Indices, class ObjT, class Method, typename... Args>
void CallMethod(mozilla::IndexSequence<Indices...>, ObjT* obj, Method method,
mozilla::Tuple<Args...>& arg)
{
(obj->*method)(mozilla::Move(mozilla::Get<Indices>(arg))...);
}
// Same as above, but call a function.
template<size_t... Indices, typename Function, typename... Args>
void CallFunction(mozilla::IndexSequence<Indices...>, Function function,
mozilla::Tuple<Args...>& arg)
{
(*function)(mozilla::Move(mozilla::Get<Indices>(arg))...);
}
} // namespace details
// Call a method on the given object. Arguments are passed by move semantics
// from the given tuple.
template<class ObjT, class Method, typename... Args>
void DispatchTupleToMethod(ObjT* obj, Method method, mozilla::Tuple<Args...>& arg)
{
details::CallMethod(typename mozilla::IndexSequenceFor<Args...>::Type(),
obj, method, arg);
}
// Same as above, but call a function.
template<typename Function, typename... Args>
void DispatchTupleToFunction(Function function, mozilla::Tuple<Args...>& arg)
{
details::CallFunction(typename mozilla::IndexSequenceFor<Args...>::Type(),
function, arg);
}
// Task ------------------------------------------------------------------------
//
@@ -110,75 +155,14 @@ class ScopedRunnableMethodFactory : public RevocableStore {
public:
explicit ScopedRunnableMethodFactory(T* object) : object_(object) { }
template <class Method>
inline Task* NewRunnableMethod(Method method) {
typedef typename ScopedTaskFactory<RunnableMethod<
Method, Tuple0> >::TaskWrapper TaskWrapper;
template <class Method, typename... Elements>
inline Task* NewRunnableMethod(Method method, Elements&&... elements) {
typedef mozilla::Tuple<typename mozilla::Decay<Elements>::Type...> ArgsTuple;
typedef RunnableMethod<Method, ArgsTuple> Runnable;
typedef typename ScopedTaskFactory<Runnable>::TaskWrapper TaskWrapper;
TaskWrapper* task = new TaskWrapper(this);
task->Init(object_, method, base::MakeTuple());
return task;
}
template <class Method, class A>
inline Task* NewRunnableMethod(Method method, const A& a) {
typedef typename ScopedTaskFactory<RunnableMethod<
Method, Tuple1<A> > >::TaskWrapper TaskWrapper;
TaskWrapper* task = new TaskWrapper(this);
task->Init(object_, method, base::MakeTuple(a));
return task;
}
template <class Method, class A, class B>
inline Task* NewRunnableMethod(Method method, const A& a, const B& b) {
typedef typename ScopedTaskFactory<RunnableMethod<
Method, Tuple2<A, B> > >::TaskWrapper TaskWrapper;
TaskWrapper* task = new TaskWrapper(this);
task->Init(object_, method, base::MakeTuple(a, b));
return task;
}
template <class Method, class A, class B, class C>
inline Task* NewRunnableMethod(Method method,
const A& a,
const B& b,
const C& c) {
typedef typename ScopedTaskFactory<RunnableMethod<
Method, Tuple3<A, B, C> > >::TaskWrapper TaskWrapper;
TaskWrapper* task = new TaskWrapper(this);
task->Init(object_, method, base::MakeTuple(a, b, c));
return task;
}
template <class Method, class A, class B, class C, class D>
inline Task* NewRunnableMethod(Method method,
const A& a,
const B& b,
const C& c,
const D& d) {
typedef typename ScopedTaskFactory<RunnableMethod<
Method, Tuple4<A, B, C, D> > >::TaskWrapper TaskWrapper;
TaskWrapper* task = new TaskWrapper(this);
task->Init(object_, method, base::MakeTuple(a, b, c, d));
return task;
}
template <class Method, class A, class B, class C, class D, class E>
inline Task* NewRunnableMethod(Method method,
const A& a,
const B& b,
const C& c,
const D& d,
const E& e) {
typedef typename ScopedTaskFactory<RunnableMethod<
Method, Tuple5<A, B, C, D, E> > >::TaskWrapper TaskWrapper;
TaskWrapper* task = new TaskWrapper(this);
task->Init(object_, method, base::MakeTuple(a, b, c, d, e));
task->Init(object_, method, mozilla::MakeTuple(mozilla::Forward<Elements>(elements)...));
return task;
}
@@ -188,13 +172,13 @@ class ScopedRunnableMethodFactory : public RevocableStore {
public:
RunnableMethod() { }
void Init(T* obj, Method meth, const Params& params) {
void Init(T* obj, Method meth, Params&& params) {
obj_ = obj;
meth_ = meth;
params_ = params;
params_ = mozilla::Forward<Params>(params);
}
virtual void Run() { DispatchToMethod(obj_, meth_, params_); }
virtual void Run() { DispatchTupleToMethod(obj_, meth_, params_); }
private:
T* MOZ_UNSAFE_REF("The validity of this pointer must be enforced by "
@@ -267,6 +251,19 @@ struct RunnableMethodTraits {
}
};
// This allows using the NewRunnableMethod() functions with a const pointer
// to the callee object. See the similar support in nsRefPtr for a rationale
// of why this is reasonable.
template <class T>
struct RunnableMethodTraits<const T> {
static void RetainCallee(const T* obj) {
const_cast<T*>(obj)->AddRef();
}
static void ReleaseCallee(const T* obj) {
const_cast<T*>(obj)->Release();
}
};
// RunnableMethod and RunnableFunction -----------------------------------------
//
// Runnable methods are a type of task that call a function on an object when
@@ -297,8 +294,8 @@ template <class T, class Method, class Params>
class RunnableMethod : public CancelableTask,
public RunnableMethodTraits<T> {
public:
RunnableMethod(T* obj, Method meth, const Params& params)
: obj_(obj), meth_(meth), params_(params) {
RunnableMethod(T* obj, Method meth, Params&& params)
: obj_(obj), meth_(meth), params_(mozilla::Forward<Params>(params)) {
this->RetainCallee(obj_);
}
~RunnableMethod() {
@@ -307,7 +304,7 @@ class RunnableMethod : public CancelableTask,
virtual void Run() {
if (obj_)
DispatchToMethod(obj_, meth_, params_);
DispatchTupleToMethod(obj_, meth_, params_);
}
virtual void Cancel() {
@@ -318,7 +315,7 @@ class RunnableMethod : public CancelableTask,
void ReleaseCallee() {
if (obj_) {
RunnableMethodTraits<T>::ReleaseCallee(obj_);
obj_ = NULL;
obj_ = nullptr;
}
}
@@ -329,78 +326,11 @@ class RunnableMethod : public CancelableTask,
Params params_;
};
template <class T, class Method>
inline CancelableTask* NewRunnableMethod(T* object, Method method) {
return new RunnableMethod<T, Method, Tuple0>(object, method, base::MakeTuple());
}
template <class T, class Method, class A>
inline CancelableTask* NewRunnableMethod(T* object, Method method, const A& a) {
return new RunnableMethod<T, Method, Tuple1<A> >(object,
method,
base::MakeTuple(a));
}
template <class T, class Method, class A, class B>
inline CancelableTask* NewRunnableMethod(T* object, Method method,
const A& a, const B& b) {
return new RunnableMethod<T, Method, Tuple2<A, B> >(object, method,
base::MakeTuple(a, b));
}
template <class T, class Method, class A, class B, class C>
inline CancelableTask* NewRunnableMethod(T* object, Method method,
const A& a, const B& b, const C& c) {
return new RunnableMethod<T, Method, Tuple3<A, B, C> >(object, method,
base::MakeTuple(a, b, c));
}
template <class T, class Method, class A, class B, class C, class D>
inline CancelableTask* NewRunnableMethod(T* object, Method method,
const A& a, const B& b,
const C& c, const D& d) {
return new RunnableMethod<T, Method, Tuple4<A, B, C, D> >(object, method,
base::MakeTuple(a, b,
c, d));
}
template <class T, class Method, class A, class B, class C, class D, class E>
inline CancelableTask* NewRunnableMethod(T* object, Method method,
const A& a, const B& b,
const C& c, const D& d, const E& e) {
return new RunnableMethod<T,
Method,
Tuple5<A, B, C, D, E> >(object,
method,
base::MakeTuple(a, b, c, d, e));
}
template <class T, class Method, class A, class B, class C, class D, class E,
class F>
inline CancelableTask* NewRunnableMethod(T* object, Method method,
const A& a, const B& b,
const C& c, const D& d, const E& e,
const F& f) {
return new RunnableMethod<T,
Method,
Tuple6<A, B, C, D, E, F> >(object,
method,
base::MakeTuple(a, b, c, d, e,
f));
}
template <class T, class Method, class A, class B, class C, class D, class E,
class F, class G>
inline CancelableTask* NewRunnableMethod(T* object, Method method,
const A& a, const B& b,
const C& c, const D& d, const E& e,
const F& f, const G& g) {
return new RunnableMethod<T,
Method,
Tuple7<A, B, C, D, E, F, G> >(object,
method,
base::MakeTuple(a, b, c, d,
e, f, g));
template <class T, class Method, typename... Args>
inline CancelableTask* NewRunnableMethod(T* object, Method method, Args&&... args) {
typedef mozilla::Tuple<typename mozilla::Decay<Args>::Type...> ArgsTuple;
return new RunnableMethod<T, Method, ArgsTuple>(
object, method, mozilla::MakeTuple(mozilla::Forward<Args>(args)...));
}
// RunnableFunction and NewRunnableFunction implementation ---------------------
@@ -408,8 +338,8 @@ inline CancelableTask* NewRunnableMethod(T* object, Method method,
template <class Function, class Params>
class RunnableFunction : public CancelableTask {
public:
RunnableFunction(Function function, const Params& params)
: function_(function), params_(params) {
RunnableFunction(Function function, Params&& params)
: function_(function), params_(mozilla::Forward<Params>(params)) {
}
~RunnableFunction() {
@@ -417,260 +347,22 @@ class RunnableFunction : public CancelableTask {
virtual void Run() {
if (function_)
DispatchToFunction(function_, params_);
DispatchTupleToFunction(function_, params_);
}
virtual void Cancel() {
function_ = NULL;
function_ = nullptr;
}
private:
Function function_;
Params params_;
};
template <class Function>
inline CancelableTask* NewRunnableFunction(Function function) {
return new RunnableFunction<Function, Tuple0>(function, base::MakeTuple());
template <class Function, typename... Args>
inline CancelableTask* NewRunnableFunction(Function function, Args&&... args) {
typedef mozilla::Tuple<typename mozilla::Decay<Args>::Type...> ArgsTuple;
return new RunnableFunction<Function, ArgsTuple>(
function, mozilla::MakeTuple(mozilla::Forward<Args>(args)...));
}
template <class Function, class A>
inline CancelableTask* NewRunnableFunction(Function function, const A& a) {
return new RunnableFunction<Function, Tuple1<A> >(function, base::MakeTuple(a));
}
template <class Function, class A, class B>
inline CancelableTask* NewRunnableFunction(Function function,
const A& a, const B& b) {
return new RunnableFunction<Function, Tuple2<A, B> >(function,
base::MakeTuple(a, b));
}
template <class Function, class A, class B, class C>
inline CancelableTask* NewRunnableFunction(Function function,
const A& a, const B& b,
const C& c) {
return new RunnableFunction<Function, Tuple3<A, B, C> >(function,
base::MakeTuple(a, b, c));
}
template <class Function, class A, class B, class C, class D>
inline CancelableTask* NewRunnableFunction(Function function,
const A& a, const B& b,
const C& c, const D& d) {
return new RunnableFunction<Function, Tuple4<A, B, C, D> >(function,
base::MakeTuple(a, b,
c, d));
}
template <class Function, class A, class B, class C, class D, class E>
inline CancelableTask* NewRunnableFunction(Function function,
const A& a, const B& b,
const C& c, const D& d,
const E& e) {
return new RunnableFunction<Function, Tuple5<A, B, C, D, E> >(function,
base::MakeTuple(a, b,
c, d,
e));
}
// Callback --------------------------------------------------------------------
//
// A Callback is like a Task but with unbound parameters. It is basically an
// object-oriented function pointer.
//
// Callbacks are designed to work with Tuples. A set of helper functions and
// classes is provided to hide the Tuple details from the consumer. Client
// code will generally work with the CallbackRunner base class, which merely
// provides a Run method and is returned by the New* functions. This allows
// users to not care which type of class implements the callback, only that it
// has a certain number and type of arguments.
//
// The implementation of this is done by CallbackImpl, which inherits
// CallbackStorage to store the data. This allows the storage of the data
// (requiring the class type T) to be hidden from users, who will want to call
// this regardless of the implementor's type T.
//
// Note that callbacks currently have no facility for cancelling or abandoning
// them. We currently handle this at a higher level for cases where this is
// necessary. The pointer in a callback must remain valid until the callback
// is made.
//
// Like Task, the callback executor is responsible for deleting the callback
// pointer once the callback has executed.
//
// Example client usage:
// void Object::DoStuff(int, string);
// Callback2<int, string>::Type* callback =
// NewCallback(obj, &Object::DoStuff);
// callback->Run(5, string("hello"));
// delete callback;
// or, equivalently, using tuples directly:
// CallbackRunner<Tuple2<int, string> >* callback =
// NewCallback(obj, &Object::DoStuff);
// callback->RunWithParams(base::MakeTuple(5, string("hello")));
// Base for all Callbacks that handles storage of the pointers.
template <class T, typename Method>
class CallbackStorage {
public:
CallbackStorage(T* obj, Method meth) : obj_(obj), meth_(meth) {
}
protected:
T* MOZ_UNSAFE_REF("The validity of this pointer must be enforced by "
"external factors.") obj_;
Method meth_;
};
// Interface that is exposed to the consumer, that does the actual calling
// of the method.
template <typename Params>
class CallbackRunner {
public:
typedef Params TupleType;
virtual ~CallbackRunner() {}
virtual void RunWithParams(const Params& params) = 0;
// Convenience functions so callers don't have to deal with Tuples.
inline void Run() {
RunWithParams(Tuple0());
}
template <typename Arg1>
inline void Run(const Arg1& a) {
RunWithParams(Params(a));
}
template <typename Arg1, typename Arg2>
inline void Run(const Arg1& a, const Arg2& b) {
RunWithParams(Params(a, b));
}
template <typename Arg1, typename Arg2, typename Arg3>
inline void Run(const Arg1& a, const Arg2& b, const Arg3& c) {
RunWithParams(Params(a, b, c));
}
template <typename Arg1, typename Arg2, typename Arg3, typename Arg4>
inline void Run(const Arg1& a, const Arg2& b, const Arg3& c, const Arg4& d) {
RunWithParams(Params(a, b, c, d));
}
template <typename Arg1, typename Arg2, typename Arg3,
typename Arg4, typename Arg5>
inline void Run(const Arg1& a, const Arg2& b, const Arg3& c,
const Arg4& d, const Arg5& e) {
RunWithParams(Params(a, b, c, d, e));
}
};
template <class T, typename Method, typename Params>
class CallbackImpl : public CallbackStorage<T, Method>,
public CallbackRunner<Params> {
public:
CallbackImpl(T* obj, Method meth) : CallbackStorage<T, Method>(obj, meth) {
}
virtual void RunWithParams(const Params& params) {
// use "this->" to force C++ to look inside our templatized base class; see
// Effective C++, 3rd Ed, item 43, p210 for details.
DispatchToMethod(this->obj_, this->meth_, params);
}
};
// 0-arg implementation
struct Callback0 {
typedef CallbackRunner<Tuple0> Type;
};
template <class T>
typename Callback0::Type* NewCallback(T* object, void (T::*method)()) {
return new CallbackImpl<T, void (T::*)(), Tuple0 >(object, method);
}
// 1-arg implementation
template <typename Arg1>
struct Callback1 {
typedef CallbackRunner<Tuple1<Arg1> > Type;
};
template <class T, typename Arg1>
typename Callback1<Arg1>::Type* NewCallback(T* object,
void (T::*method)(Arg1)) {
return new CallbackImpl<T, void (T::*)(Arg1), Tuple1<Arg1> >(object, method);
}
// 2-arg implementation
template <typename Arg1, typename Arg2>
struct Callback2 {
typedef CallbackRunner<Tuple2<Arg1, Arg2> > Type;
};
template <class T, typename Arg1, typename Arg2>
typename Callback2<Arg1, Arg2>::Type* NewCallback(
T* object,
void (T::*method)(Arg1, Arg2)) {
return new CallbackImpl<T, void (T::*)(Arg1, Arg2),
Tuple2<Arg1, Arg2> >(object, method);
}
// 3-arg implementation
template <typename Arg1, typename Arg2, typename Arg3>
struct Callback3 {
typedef CallbackRunner<Tuple3<Arg1, Arg2, Arg3> > Type;
};
template <class T, typename Arg1, typename Arg2, typename Arg3>
typename Callback3<Arg1, Arg2, Arg3>::Type* NewCallback(
T* object,
void (T::*method)(Arg1, Arg2, Arg3)) {
return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3),
Tuple3<Arg1, Arg2, Arg3> >(object, method);
}
// 4-arg implementation
template <typename Arg1, typename Arg2, typename Arg3, typename Arg4>
struct Callback4 {
typedef CallbackRunner<Tuple4<Arg1, Arg2, Arg3, Arg4> > Type;
};
template <class T, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
typename Callback4<Arg1, Arg2, Arg3, Arg4>::Type* NewCallback(
T* object,
void (T::*method)(Arg1, Arg2, Arg3, Arg4)) {
return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3, Arg4),
Tuple4<Arg1, Arg2, Arg3, Arg4> >(object, method);
}
// 5-arg implementation
template <typename Arg1, typename Arg2, typename Arg3,
typename Arg4, typename Arg5>
struct Callback5 {
typedef CallbackRunner<Tuple5<Arg1, Arg2, Arg3, Arg4, Arg5> > Type;
};
template <class T, typename Arg1, typename Arg2,
typename Arg3, typename Arg4, typename Arg5>
typename Callback5<Arg1, Arg2, Arg3, Arg4, Arg5>::Type* NewCallback(
T* object,
void (T::*method)(Arg1, Arg2, Arg3, Arg4, Arg5)) {
return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3, Arg4, Arg5),
Tuple5<Arg1, Arg2, Arg3, Arg4, Arg5> >(object, method);
}
// An UnboundMethod is a wrapper for a method where the actual object is
// provided at Run dispatch time.
template <class T, class Method, class Params>
class UnboundMethod {
public:
UnboundMethod(Method m, Params p) : m_(m), p_(p) {}
void Run(T* obj) const {
DispatchToMethod(obj, m_, p_);
}
private:
Method m_;
Params p_;
};
#endif // BASE_TASK_H_
@@ -12,7 +12,6 @@
#include "base/file_path.h"
#include "base/string_util.h"
#include "base/string16.h"
#include "base/tuple.h"
#include "base/time.h"
#if defined(OS_POSIX)
+3
View File
@@ -3854,6 +3854,9 @@ fi
MOZ_SUBCONFIGURE_FFI()
MOZ_SUBCONFIGURE_JEMALLOC()
# Avoid using obsolete NSPR features
AC_DEFINE(NO_NSPR_10_SUPPORT)
dnl Spit out some output
dnl ========================================================
MOZ_CREATE_CONFIG_STATUS()
+2 -3
View File
@@ -42,12 +42,11 @@ using mozilla::UniquePtr;
struct KeywordInfo {
const char* chars; // C string with keyword text
TokenKind tokentype;
JSVersion version;
};
static const KeywordInfo keywords[] = {
#define KEYWORD_INFO(keyword, name, type, version) \
{js_##keyword##_str, type, version},
#define KEYWORD_INFO(keyword, name, type) \
{js_##keyword##_str, type},
FOR_EACH_JAVASCRIPT_KEYWORD(KEYWORD_INFO)
#undef KEYWORD_INFO
};
+1 -1
View File
@@ -14,7 +14,7 @@
#include "vm/Keywords.h"
static const char * const keyword_list[] = {
#define KEYWORD_STRING(keyword, name, type, version) #keyword,
#define KEYWORD_STRING(keyword, name, type) #keyword,
FOR_EACH_JAVASCRIPT_KEYWORD(KEYWORD_STRING)
#undef KEYWORD_STRING
};
+45 -45
View File
@@ -10,58 +10,58 @@
#define vm_Keywords_h
#define FOR_EACH_JAVASCRIPT_KEYWORD(macro) \
macro(false, false_, TOK_FALSE, JSVERSION_DEFAULT) \
macro(true, true_, TOK_TRUE, JSVERSION_DEFAULT) \
macro(null, null, TOK_NULL, JSVERSION_DEFAULT) \
macro(false, false_, TOK_FALSE) \
macro(true, true_, TOK_TRUE) \
macro(null, null, TOK_NULL) \
/* Keywords. */ \
macro(break, break_, TOK_BREAK, JSVERSION_DEFAULT) \
macro(case, case_, TOK_CASE, JSVERSION_DEFAULT) \
macro(catch, catch_, TOK_CATCH, JSVERSION_DEFAULT) \
macro(const, const_, TOK_CONST, JSVERSION_DEFAULT) \
macro(continue, continue_, TOK_CONTINUE, JSVERSION_DEFAULT) \
macro(debugger, debugger, TOK_DEBUGGER, JSVERSION_DEFAULT) \
macro(default, default_, TOK_DEFAULT, JSVERSION_DEFAULT) \
macro(delete, delete_, TOK_DELETE, JSVERSION_DEFAULT) \
macro(do, do_, TOK_DO, JSVERSION_DEFAULT) \
macro(else, else_, TOK_ELSE, JSVERSION_DEFAULT) \
macro(finally, finally_, TOK_FINALLY, JSVERSION_DEFAULT) \
macro(for, for_, TOK_FOR, JSVERSION_DEFAULT) \
macro(function, function, TOK_FUNCTION, JSVERSION_DEFAULT) \
macro(if, if_, TOK_IF, JSVERSION_DEFAULT) \
macro(in, in, TOK_IN, JSVERSION_DEFAULT) \
macro(instanceof, instanceof, TOK_INSTANCEOF, JSVERSION_DEFAULT) \
macro(new, new_, TOK_NEW, JSVERSION_DEFAULT) \
macro(return, return_, TOK_RETURN, JSVERSION_DEFAULT) \
macro(switch, switch_, TOK_SWITCH, JSVERSION_DEFAULT) \
macro(this, this_, TOK_THIS, JSVERSION_DEFAULT) \
macro(throw, throw_, TOK_THROW, JSVERSION_DEFAULT) \
macro(try, try_, TOK_TRY, JSVERSION_DEFAULT) \
macro(typeof, typeof, TOK_TYPEOF, JSVERSION_DEFAULT) \
macro(var, var, TOK_VAR, JSVERSION_DEFAULT) \
macro(void, void_, TOK_VOID, JSVERSION_DEFAULT) \
macro(while, while_, TOK_WHILE, JSVERSION_DEFAULT) \
macro(with, with, TOK_WITH, JSVERSION_DEFAULT) \
macro(import, import, TOK_IMPORT, JSVERSION_DEFAULT) \
macro(export, export, TOK_EXPORT, JSVERSION_DEFAULT) \
macro(class, class_, TOK_CLASS, JSVERSION_DEFAULT) \
macro(extends, extends, TOK_EXTENDS, JSVERSION_DEFAULT) \
macro(super, super, TOK_SUPER, JSVERSION_DEFAULT) \
macro(break, break_, TOK_BREAK) \
macro(case, case_, TOK_CASE) \
macro(catch, catch_, TOK_CATCH) \
macro(const, const_, TOK_CONST) \
macro(continue, continue_, TOK_CONTINUE) \
macro(debugger, debugger, TOK_DEBUGGER) \
macro(default, default_, TOK_DEFAULT) \
macro(delete, delete_, TOK_DELETE) \
macro(do, do_, TOK_DO) \
macro(else, else_, TOK_ELSE) \
macro(finally, finally_, TOK_FINALLY) \
macro(for, for_, TOK_FOR) \
macro(function, function, TOK_FUNCTION) \
macro(if, if_, TOK_IF) \
macro(in, in, TOK_IN) \
macro(instanceof, instanceof, TOK_INSTANCEOF) \
macro(new, new_, TOK_NEW) \
macro(return, return_, TOK_RETURN) \
macro(switch, switch_, TOK_SWITCH) \
macro(this, this_, TOK_THIS) \
macro(throw, throw_, TOK_THROW) \
macro(try, try_, TOK_TRY) \
macro(typeof, typeof, TOK_TYPEOF) \
macro(var, var, TOK_VAR) \
macro(void, void_, TOK_VOID) \
macro(while, while_, TOK_WHILE) \
macro(with, with, TOK_WITH) \
macro(import, import, TOK_IMPORT) \
macro(export, export, TOK_EXPORT) \
macro(class, class_, TOK_CLASS) \
macro(extends, extends, TOK_EXTENDS) \
macro(super, super, TOK_SUPER) \
/* Reserved keywords. */ \
macro(enum, enum_, TOK_RESERVED, JSVERSION_DEFAULT) \
macro(enum, enum_, TOK_RESERVED) \
/* Future reserved keywords, but only in strict mode. */ \
macro(implements, implements, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
macro(interface, interface, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
macro(package, package, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
macro(private, private_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
macro(protected, protected_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
macro(public, public_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
macro(static, static_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
macro(implements, implements, TOK_STRICT_RESERVED) \
macro(interface, interface, TOK_STRICT_RESERVED) \
macro(package, package, TOK_STRICT_RESERVED) \
macro(private, private_, TOK_STRICT_RESERVED) \
macro(protected, protected_, TOK_STRICT_RESERVED) \
macro(public, public_, TOK_STRICT_RESERVED) \
macro(static, static_, TOK_STRICT_RESERVED) \
/* \
* Yield is a token inside function*. Outside of a function*, it is a \
* future reserved keyword in strict mode, but a keyword in JS1.7 even \
* when strict. Punt logic to parser. \
*/ \
macro(yield, yield, TOK_YIELD, JSVERSION_DEFAULT) \
macro(let, let, TOK_LET, JSVERSION_DEFAULT)
macro(yield, yield, TOK_YIELD) \
macro(let, let, TOK_LET)
#endif /* vm_Keywords_h */
+1 -1
View File
@@ -1000,7 +1000,7 @@ AccessibleCaretManager::DispatchCaretStateChangedEvent(CaretChangedReason aReaso
}
RefPtr<DOMRect> domRect = new DOMRect(ToSupports(doc));
nsRect rect = nsContentUtils::GetSelectionBoundingRect(sel);
nsRect rect = nsLayoutUtils::GetSelectionBoundingRect(sel);
nsIFrame* commonAncestorFrame = nullptr;
nsIFrame* rootFrame = mPresShell->GetRootFrame();
+21 -14
View File
@@ -3964,7 +3964,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
itemContent.IntersectRect(itemContent, itemClip.GetClipRect());
clipRect = ViewAs<ParentLayerPixel>(ScaleToNearestPixels(itemClip.GetClipRect()));
if (!prerenderedTransform) {
itemDrawRect.IntersectRect(itemDrawRect, ParentLayerIntRect::ToUntyped(clipRect));
itemDrawRect.IntersectRect(itemDrawRect, clipRect.ToUnknownRect());
}
clipRect.MoveBy(ViewAs<ParentLayerPixel>(mParameters.mOffset));
}
@@ -4045,9 +4045,14 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
nscolor uniformColor = NS_RGBA(0,0,0,0);
nscolor* uniformColorPtr = !mayDrawOutOfOrder ? &uniformColor : nullptr;
nsIntRect clipRectUntyped;
nsIntRect* clipPtr = itemClip.HasClip() ? &clipRectUntyped : nullptr;
if (clipPtr) {
clipRectUntyped = ParentLayerIntRect::ToUntyped(clipRect);
const DisplayItemClip& layerClip = shouldFixToViewport ? fixedToViewportClip : itemClip;
ParentLayerIntRect layerClipRect;
nsIntRect* clipPtr = nullptr;
if (layerClip.HasClip()) {
layerClipRect = ViewAs<ParentLayerPixel>(
ScaleToNearestPixels(layerClip.GetClipRect()) + mParameters.mOffset);
clipRectUntyped = layerClipRect.ToUnknownRect();
clipPtr = &clipRectUntyped;
}
if (animatedGeometryRoot == item->Frame() &&
animatedGeometryRoot != mBuilder->RootReferenceFrame()) {
@@ -4119,20 +4124,20 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
NS_ASSERTION(ownLayer->Manager() == mManager, "Wrong manager");
NS_ASSERTION(!ownLayer->HasUserData(&gLayerManagerUserData),
"We shouldn't have a FrameLayerBuilder-managed layer here!");
NS_ASSERTION(itemClip.HasClip() ||
itemClip.GetRoundedRectCount() == 0,
NS_ASSERTION(layerClip.HasClip() ||
layerClip.GetRoundedRectCount() == 0,
"If we have rounded rects, we must have a clip rect");
// It has its own layer. Update that layer's clip and visible rects.
if (itemClip.HasClip()) {
ownLayer->SetClipRect(Some(clipRect));
if (layerClip.HasClip()) {
ownLayer->SetClipRect(Some(layerClipRect));
} else {
ownLayer->SetClipRect(Nothing());
}
// rounded rectangle clipping using mask layers
// (must be done after visible rect is set on layer)
if (itemClip.IsRectClippedByRoundedCorner(itemContent)) {
SetupMaskLayer(ownLayer, itemClip, itemVisibleRect);
if (layerClip.IsRectClippedByRoundedCorner(itemContent)) {
SetupMaskLayer(ownLayer, layerClip, itemVisibleRect);
}
ContainerLayer* oldContainer = ownLayer->GetParent();
@@ -4175,7 +4180,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
newLayerEntry->mVisibleRegion = itemVisibleRect;
}
newLayerEntry->mOpaqueRegion = ComputeOpaqueRect(item,
animatedGeometryRoot, fixedPosFrame, itemClip, aList,
animatedGeometryRoot, fixedPosFrame, layerClip, aList,
&newLayerEntry->mHideAllLayersBelow,
&newLayerEntry->mOpaqueForAnimatedGeometryRootParent);
} else {
@@ -4514,6 +4519,8 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
nsIntPoint offset = GetLastPaintOffset(layer) - GetTranslationForPaintedLayer(layer);
props->MoveBy(-offset);
// Effective transforms are needed by ComputeDifferences().
tmpLayer->ComputeEffectiveTransforms(Matrix4x4());
nsIntRegion invalid = props->ComputeDifferences(tmpLayer, nullptr);
if (aLayerState == LAYER_SVG_EFFECTS) {
invalid = nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(aItem->Frame(),
@@ -4879,7 +4886,7 @@ ContainerState::PostprocessRetainedLayers(nsIntRegion* aOpaqueRegionForContainer
} else if (!e->mLayer->IsScrollbarContainer()) {
const Maybe<ParentLayerIntRect>& clipRect = GetStationaryClipInContainer(e->mLayer);
if (clipRect && opaqueRegionForContainer >= 0 &&
opaqueRegions[opaqueRegionForContainer].mOpaqueRegion.Contains(ParentLayerIntRect::ToUntyped(*clipRect))) {
opaqueRegions[opaqueRegionForContainer].mOpaqueRegion.Contains(clipRect->ToUnknownRect())) {
e->mVisibleRegion.SetEmpty();
} else if (data) {
e->mVisibleRegion.Sub(e->mVisibleRegion, data->mOpaqueRegion);
@@ -4921,7 +4928,7 @@ ContainerState::PostprocessRetainedLayers(nsIntRegion* aOpaqueRegionForContainer
nsIntRegion clippedOpaque = e->mOpaqueRegion;
Maybe<ParentLayerIntRect> clipRect = e->mLayer->GetCombinedClipRect();
if (clipRect) {
clippedOpaque.AndWith(ParentLayerIntRect::ToUntyped(*clipRect));
clippedOpaque.AndWith(clipRect->ToUnknownRect());
}
if (e->mLayer->GetIsFixedPosition() && !e->mLayer->IsClipFixed()) {
// The clip can move asynchronously, so we can't rely on opaque parts
@@ -5870,7 +5877,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
while (const nsIntRect* iterRect = it.Next()) {
gfxContextAutoSaveRestore save(aContext);
aContext->NewPath();
aContext->Rectangle(*iterRect);
aContext->Rectangle(ThebesRect(*iterRect));
aContext->Clip();
DrawForcedBackgroundColor(aDrawTarget, aLayer,
+1 -1
View File
@@ -107,7 +107,7 @@ struct ContainerLayerParameters {
nsIntPoint mOffset;
LayerIntPoint Offset() const {
return LayerIntPoint::FromUntyped(mOffset);
return LayerIntPoint::FromUnknownPoint(mOffset);
}
nscolor mBackgroundColor;
+1 -2
View File
@@ -262,8 +262,7 @@ MobileViewportManager::RefreshViewportSize(bool aForceAdjustResolution)
ScreenIntSize displaySize = ViewAs<ScreenPixel>(
mDisplaySize, PixelCastJustification::LayoutDeviceIsScreenForBounds);
nsViewportInfo viewportInfo = nsContentUtils::GetViewportInfo(
mDocument, displaySize);
nsViewportInfo viewportInfo = mDocument->GetViewportInfo(displaySize);
CSSSize viewport = viewportInfo.GetSize();
MVM_LOG("%p: Computed CSS viewport %s\n", this, Stringify(viewport).c_str());
+2 -2
View File
@@ -504,7 +504,7 @@ SelectionCarets::UpdateSelectionCarets()
nsIFrame* commonAncestorFrame =
nsLayoutUtils::FindNearestCommonAncestorFrame(startFrame, endFrame);
nsRect selectionRectInRootFrame = nsContentUtils::GetSelectionBoundingRect(selection);
nsRect selectionRectInRootFrame = nsLayoutUtils::GetSelectionBoundingRect(selection);
nsRect selectionRectInCommonAncestorFrame = selectionRectInRootFrame;
nsLayoutUtils::TransformRect(rootFrame, commonAncestorFrame,
selectionRectInCommonAncestorFrame);
@@ -1075,7 +1075,7 @@ SelectionCarets::DispatchSelectionStateChangedEvent(Selection* aSelection,
if (aSelection) {
// XXX: Do we need to flush layout?
mPresShell->FlushPendingNotifications(Flush_Layout);
nsRect rect = nsContentUtils::GetSelectionBoundingRect(aSelection);
nsRect rect = nsLayoutUtils::GetSelectionBoundingRect(aSelection);
RefPtr<DOMRect>domRect = new DOMRect(ToSupports(doc));
domRect->SetLayoutRect(rect);
+1 -1
View File
@@ -1141,7 +1141,7 @@ TouchCaret::DispatchTapEvent()
// XXX: Do we need to flush layout?
presShell->FlushPendingNotifications(Flush_Layout);
nsRect rect = nsContentUtils::GetSelectionBoundingRect(sel);
nsRect rect = nsLayoutUtils::GetSelectionBoundingRect(sel);
RefPtr<dom::DOMRect>domRect = new dom::DOMRect(ToSupports(doc));
domRect->SetLayoutRect(rect);
+2 -56
View File
@@ -235,22 +235,6 @@ struct CSSPixel {
* 2) the "widget scale" (see nsIWidget::GetDefaultScale)
*/
struct LayoutDevicePixel {
static LayoutDeviceIntPoint FromUntyped(const nsIntPoint& aPoint) {
return LayoutDeviceIntPoint(aPoint.x, aPoint.y);
}
static nsIntPoint ToUntyped(const LayoutDeviceIntPoint& aPoint) {
return nsIntPoint(aPoint.x, aPoint.y);
}
static LayoutDeviceIntRect FromUntyped(const nsIntRect& aRect) {
return LayoutDeviceIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static nsIntRect ToUntyped(const LayoutDeviceIntRect& aRect) {
return nsIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static LayoutDeviceRect FromAppUnits(const nsRect& aRect, nscoord aAppUnitsPerDevPixel) {
return LayoutDeviceRect(NSAppUnitsToFloatPixels(aRect.x, float(aAppUnitsPerDevPixel)),
NSAppUnitsToFloatPixels(aRect.y, float(aAppUnitsPerDevPixel)),
@@ -276,11 +260,11 @@ struct LayoutDevicePixel {
}
static LayoutDeviceIntPoint FromAppUnitsToNearest(const nsPoint& aPoint, nscoord aAppUnitsPerDevPixel) {
return FromUntyped(aPoint.ToNearestPixels(aAppUnitsPerDevPixel));
return LayoutDeviceIntPoint::FromUnknownPoint(aPoint.ToNearestPixels(aAppUnitsPerDevPixel));
}
static LayoutDeviceIntRect FromAppUnitsToNearest(const nsRect& aRect, nscoord aAppUnitsPerDevPixel) {
return FromUntyped(aRect.ToNearestPixels(aAppUnitsPerDevPixel));
return LayoutDeviceIntRect::FromUnknownRect(aRect.ToNearestPixels(aAppUnitsPerDevPixel));
}
static LayoutDeviceIntSize FromAppUnitsRounded(const nsSize& aSize, nscoord aAppUnitsPerDevPixel) {
@@ -322,14 +306,6 @@ struct LayoutDevicePixel {
* 4) rasterizing at a different scale in the presence of some CSS transforms
*/
struct LayerPixel {
static nsIntRect ToUntyped(const LayerIntRect& aRect) {
return nsIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static nsIntPoint ToUntyped(const LayerIntPoint& aPoint) {
return nsIntPoint(aPoint.x, aPoint.y);
}
static gfx::IntRect ToUnknown(const LayerIntRect& aRect) {
return gfx::IntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
@@ -337,14 +313,6 @@ struct LayerPixel {
static gfx::Rect ToUnknown(const LayerRect& aRect) {
return gfx::Rect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static LayerIntRect FromUntyped(const nsIntRect& aRect) {
return LayerIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static LayerIntPoint FromUntyped(const nsIntPoint& aPoint) {
return LayerIntPoint(aPoint.x, aPoint.y);
}
};
/*
@@ -355,14 +323,6 @@ struct LayerPixel {
* have RenderTargetPixel == LayerPixel.
*/
struct RenderTargetPixel {
static nsIntPoint ToUntyped(const RenderTargetIntPoint& aPoint) {
return nsIntPoint(aPoint.x, aPoint.y);
}
static nsIntRect ToUntyped(const RenderTargetIntRect& aRect) {
return nsIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static gfx::IntRect ToUnknown(const RenderTargetIntRect& aRect) {
return gfx::IntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
@@ -374,10 +334,6 @@ struct RenderTargetPixel {
static RenderTargetRect FromUnknown(const gfx::Rect& aRect) {
return RenderTargetRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static RenderTargetIntRect FromUntyped(const nsIntRect& aRect) {
return RenderTargetIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
};
/*
@@ -390,13 +346,6 @@ struct RenderTargetPixel {
* generally be represented in ScreenPixel units.
*/
struct ScreenPixel {
static nsIntSize ToUntyped(const ScreenIntSize& aSize) {
return nsIntSize(aSize.width, aSize.height);
}
static ScreenIntPoint FromUntyped(const nsIntPoint& aPoint) {
return ScreenIntPoint(aPoint.x, aPoint.y);
}
};
/* The layer coordinates of the parent frame.
@@ -412,9 +361,6 @@ struct ScreenPixel {
* to get a picture of how the various coordinate systems relate to each other.
*/
struct ParentLayerPixel {
static nsIntRect ToUntyped(const ParentLayerIntRect& aRect) {
return nsIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
};
// Operators to apply ScaleFactors directly to Coords, Points, Rects, Sizes and Margins
+2 -3
View File
@@ -46,7 +46,7 @@ static nsIWidget*
GetWidget(nsIPresShell* aShell)
{
if (nsIFrame* rootFrame = aShell->GetRootFrame()) {
#ifdef MOZ_WIDGET_ANDROID
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_UIKIT)
return rootFrame->GetNearestWidget();
#else
if (nsView* view = rootFrame->GetView()) {
@@ -197,8 +197,7 @@ ZoomConstraintsClient::RefreshZoomConstraints()
return;
}
nsViewportInfo viewportInfo = nsContentUtils::GetViewportInfo(
mDocument,
nsViewportInfo viewportInfo = mDocument->GetViewportInfo(
ViewAs<ScreenPixel>(screenSize, PixelCastJustification::LayoutDeviceIsScreenForBounds));
mozilla::layers::ZoomConstraints zoomConstraints =
+2 -2
View File
@@ -1183,9 +1183,9 @@ nsDisplayListBuilder::AdjustWindowDraggingRegion(nsIFrame* aFrame)
if (transformedDevPixelBorderBox.ToIntRect(&transformedDevPixelBorderBoxInt)) {
const nsStyleUserInterface* styleUI = aFrame->StyleUserInterface();
if (styleUI->mWindowDragging == NS_STYLE_WINDOW_DRAGGING_DRAG) {
mWindowDraggingRegion.OrWith(LayoutDevicePixel::ToUntyped(transformedDevPixelBorderBoxInt));
mWindowDraggingRegion.OrWith(transformedDevPixelBorderBoxInt.ToUnknownRect());
} else {
mWindowDraggingRegion.SubOut(LayoutDevicePixel::ToUntyped(transformedDevPixelBorderBoxInt));
mWindowDraggingRegion.SubOut(transformedDevPixelBorderBoxInt.ToUnknownRect());
}
}
}
+45 -32
View File
@@ -25,6 +25,7 @@
#include "nsGkAtoms.h"
#include "nsHtml5Atoms.h"
#include "nsIAtom.h"
#include "nsCaret.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSAnonBoxes.h"
#include "nsCSSColorUtils.h"
@@ -2747,7 +2748,7 @@ nsLayoutUtils::GetLayerTransformForFrame(nsIFrame* aFrame,
nsDisplayListBuilder builder(root, nsDisplayListBuilder::OTHER,
false/*don't build caret*/);
nsDisplayList list;
nsDisplayList list;
nsDisplayTransform* item =
new (&builder) nsDisplayTransform(&builder, aFrame, &list, nsRect());
@@ -2871,9 +2872,9 @@ static LayoutDeviceIntPoint GetWidgetOffset(nsIWidget* aWidget, nsIWidget*& aRoo
if (!parent) {
break;
}
nsIntRect bounds;
LayoutDeviceIntRect bounds;
aWidget->GetBounds(bounds);
offset += LayoutDeviceIntPoint::FromUntyped(bounds.TopLeft());
offset += bounds.TopLeft();
aWidget = parent;
}
aRootWidget = aWidget;
@@ -3329,7 +3330,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
// For the viewport frame in print preview/page layout we want to paint
// the grey background behind the page, not the canvas color.
if (frameType == nsGkAtoms::viewportFrame &&
if (frameType == nsGkAtoms::viewportFrame &&
nsLayoutUtils::NeedsPrintPreviewBackground(presContext)) {
nsRect bounds = nsRect(builder.ToReferenceFrame(aFrame),
aFrame->GetSize());
@@ -4930,7 +4931,7 @@ nsLayoutUtils::ComputeISizeValue(
nscoord result;
if (aCoord.IsCoordPercentCalcUnit()) {
result = nsRuleNode::ComputeCoordPercentCalc(aCoord,
result = nsRuleNode::ComputeCoordPercentCalc(aCoord,
aContainingBlockISize);
// The result of a calc() expression might be less than 0; we
// should clamp at runtime (below). (Percentages and coords that
@@ -5973,7 +5974,7 @@ nsLayoutUtils::CalculateContentBEnd(WritingMode aWM, nsIFrame* aFrame)
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
if (!skip.Contains(lists.CurrentID())) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
nscoord offset =
@@ -7812,7 +7813,7 @@ nsLayoutUtils::FontSizeInflationEnabled(nsPresContext *aPresContext)
}
/* static */ nsRect
nsLayoutUtils::GetBoxShadowRectForFrame(nsIFrame* aFrame,
nsLayoutUtils::GetBoxShadowRectForFrame(nsIFrame* aFrame,
const nsSize& aFrameSize)
{
nsCSSShadowArray* boxShadows = aFrame->StyleBorder()->mBoxShadow;
@@ -7834,7 +7835,7 @@ nsLayoutUtils::GetBoxShadowRectForFrame(nsIFrame* aFrame,
nsRect frameRect = nativeTheme ?
aFrame->GetVisualOverflowRectRelativeToSelf() :
nsRect(nsPoint(0, 0), aFrameSize);
nsRect shadows;
int32_t A2D = aFrame->PresContext()->AppUnitsPerDevPixel();
for (uint32_t i = 0; i < boxShadows->Length(); ++i) {
@@ -7942,7 +7943,7 @@ nsLayoutUtils::GetContentViewerSize(nsPresContext* aPresContext,
nsIntRect bounds;
cv->GetBounds(bounds);
aOutSize = LayoutDeviceIntRect::FromUntyped(bounds).Size();
aOutSize = LayoutDeviceIntRect::FromUnknownRect(bounds).Size();
return true;
}
@@ -7958,16 +7959,7 @@ UpdateCompositionBoundsForRCDRSF(ParentLayerRect& aCompBounds,
return false;
}
// On Android, we need to do things a bit differently to get things
// right (see bug 983208, bug 988882). We use the bounds of the nearest
// widget, but clamp the height to the frame bounds height. This clamping
// is done to get correct results for a page where the page is sized to
// the screen and thus the dynamic toolbar never disappears. In such a
// case, we want the composition bounds to exclude the toolbar height,
// but the widget bounds includes it. We don't currently have a good way
// of knowing about the toolbar height, but clamping to the frame bounds
// height gives the correct answer in the cases we care about.
#ifdef MOZ_WIDGET_ANDROID
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_UIKIT)
nsIWidget* widget = rootFrame->GetNearestWidget();
#else
nsView* view = rootFrame->GetView();
@@ -7976,18 +7968,9 @@ UpdateCompositionBoundsForRCDRSF(ParentLayerRect& aCompBounds,
if (widget) {
nsIntRect widgetBounds;
widget->GetBounds(widgetBounds);
widget->GetBoundsUntyped(widgetBounds);
widgetBounds.MoveTo(0, 0);
aCompBounds = ParentLayerRect(ViewAs<ParentLayerPixel>(widgetBounds));
#ifdef MOZ_WIDGET_ANDROID
ParentLayerRect frameBounds =
LayoutDeviceRect::FromAppUnits(aFrameBounds, aPresContext->AppUnitsPerDevPixel())
* aCumulativeResolution
* LayerToParentLayerScale(1.0);
if (frameBounds.height < aCompBounds.height) {
aCompBounds.height = frameBounds.height;
}
#endif
return true;
}
@@ -8110,7 +8093,7 @@ nsLayoutUtils::CalculateRootCompositionSize(nsIFrame* aFrame,
} else {
nsIWidget* widget = aFrame->GetNearestWidget();
nsIntRect widgetBounds;
widget->GetBounds(widgetBounds);
widget->GetBoundsUntyped(widgetBounds);
rootCompositionSize = ScreenSize(ViewAs<ScreenPixel>(widgetBounds.Size()));
}
@@ -8278,7 +8261,6 @@ Rect NSRectToSnappedRect(const nsRect& aRect, double aAppUnitsPerPixel,
MaybeSnapToDevicePixels(rect, aSnapDT, true);
return rect;
}
// Similar to a snapped rect, except an axis is left unsnapped if the snapping
// process results in a length of 0.
Rect NSRectToNonEmptySnappedRect(const nsRect& aRect, double aAppUnitsPerPixel,
@@ -8310,7 +8292,7 @@ void StrokeLineWithSnapping(const nsPoint& aP1, const nsPoint& aP2,
namespace layout {
void
MaybeSetupTransactionIdAllocator(layers::LayerManager* aManager, nsView* aView)
{
@@ -8794,3 +8776,34 @@ nsLayoutUtils::AppendFrameTextContent(nsIFrame* aFrame, nsAString& aResult)
}
}
}
/* static */
nsRect
nsLayoutUtils::GetSelectionBoundingRect(Selection* aSel)
{
nsRect res;
// Bounding client rect may be empty after calling GetBoundingClientRect
// when range is collapsed. So we get caret's rect when range is
// collapsed.
if (aSel->IsCollapsed()) {
nsIFrame* frame = nsCaret::GetGeometry(aSel, &res);
if (frame) {
nsIFrame* relativeTo = GetContainingBlockForClientRect(frame);
res = TransformFrameRectToAncestor(frame, res, relativeTo);
}
} else {
int32_t rangeCount = aSel->RangeCount();
RectAccumulator accumulator;
for (int32_t idx = 0; idx < rangeCount; ++idx) {
nsRange* range = aSel->GetRangeAt(idx);
nsRange::CollectClientRects(&accumulator, range,
range->GetStartParent(), range->StartOffset(),
range->GetEndParent(), range->EndOffset(),
true, false);
}
res = accumulator.mResultRect.IsEmpty() ? accumulator.mFirstRect :
accumulator.mResultRect;
}
return res;
}
+8
View File
@@ -72,6 +72,7 @@ class Element;
class HTMLImageElement;
class HTMLCanvasElement;
class HTMLVideoElement;
class Selection;
} // namespace dom
namespace gfx {
struct RectCornerRadii;
@@ -2767,6 +2768,13 @@ public:
*/
static void AppendFrameTextContent(nsIFrame* aFrame, nsAString& aResult);
/**
* Takes a selection, and returns selection's bounding rect which is relative
* to its root frame.
*
* @param aSel Selection to check
*/
static nsRect GetSelectionBoundingRect(mozilla::dom::Selection* aSel);
private:
static uint32_t sFontSizeInflationEmPerLine;
static uint32_t sFontSizeInflationMinTwips;
+2 -2
View File
@@ -3078,11 +3078,11 @@ SortConfigurations(nsTArray<nsIWidget::Configuration>* aConfigurations)
if (i == j)
continue;
nsIntRect bounds;
pluginsToMove[j].mChild->GetBounds(bounds);
pluginsToMove[j].mChild->GetBoundsUntyped(bounds);
nsAutoTArray<nsIntRect,1> clipRects;
pluginsToMove[j].mChild->GetWindowClipRegion(&clipRects);
if (HasOverlap(bounds.TopLeft(), clipRects,
config->mBounds.TopLeft(),
config->mBounds.ToUnknownRect().TopLeft(),
config->mClipRegion)) {
foundOverlap = true;
break;

Some files were not shown because too many files have changed in this diff Show More