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

- Bug 1134252 - Don't crash the content process if RenderFrameParent is not constructed successfully. r=billm. (2564cb0e6a)
- Bug 1180644: Fix crashes after enabling OOP on B2GDroid. r=snorp (d585c571e3)
- Bug 1198674 - null-check mFrameLoader in RenderFrameParent. r=sotaro (86f26b2046)
- Bug 1198674 - Null-check mFrameLoader before calling GetFrom in RenderFrameParent. r=sotaro (33bd495e75)
- Bug 1200778 - Make sure to update the APZCTreeManager associated with a RenderFrameParent when it is dragged to a new window. r=mstange (bf2d25616c)
- Bug 1202703 - Part 1 - CreateRenderingContext can fail. r=mattwoodrow (50de4cd050)
- Bug 1185747 part 1 - Use pref/meta-viewport tag instead of DOMWindowUtils to set the CSS viewport for mochitests. r=tn (62a8c1d460)
- Bug 1147038 - Update some tests to pass on desktop platforms. r=tn (afa54f4dc9)
- Bug 1169666 - Revert reftest sanity flag ordering, fixes failures on OS X. (553743b4ce)
- Bug 1114526. Add reftest. (ef2589e3b8)
- Bug 1192616 - Skip over some reftests which fail on the pandaboards with the new dynamic toolbar implementation due to the screen size being too small. r=gbrown (fd3a0a523c)
- Bug 1185747 part 2 - Remove magical reftest harness properties and use standard meta-viewport tags instead. r=tn (73d2d442d9)
- Bug 1194811 Part 1 - Recompute the zoom constraints if the available screen area changes. r=botond (620dc82022)
- Bug 1194811 Part 2 - Use the content viewer size rather than the composition size of the root frame when computing the CSS viewport. r=botond (089459fcb5)
- Bug 1185747 part 3 - Rip out code to explicitly override the CSS viewport. r=tn (00ea1c7277)
- Bug 1178354 - Ensure we fire a before-first-paint event for printing as well. r=tn (3dfd7f0f76)
- Bug 1152254 - Handle vertical text frames when clipping display list for drag image. r=smontagu (965256a547)
- Bug 1156135. Add runtime testing of graphics features. r=mattwoodrow,mossop (6a8cb24421)
- Refactor the graphics sanity test to support multiple snapshots. (bug 1173117 part 1, r=mattwoodrow) (8a0a78e4d3)
- Add an observer service notification for the first widget paint message. (bug 1173117 part 2, r=roc) (e421003dcd)
- Fix a widget size check bug in nsWindow::CaptureWidgetOnScreen. (bug 1173117 part 3, r=mattwoodrow) (485694c380)
- Add OS snapshotting to the gfx sanity test and report whether or not it matches the compositing test results. (bug 1173117 part 4, r=mattwoodrow,vladan) (38e82d10ad)
- Bug 1191608 - initialize element to null in CanvasRenderingContext2D::DrawImage. r=bas (e26dd8b8ce)
This commit is contained in:
2022-05-23 09:39:58 +08:00
parent e7535dc94b
commit e0e5f031a0
50 changed files with 575 additions and 180 deletions
+58 -40
View File
@@ -785,7 +785,6 @@ PresShell::PresShell()
#endif
mRenderFlags = 0;
mResolution = 1.0;
mViewportOverridden = false;
mScrollPositionClampingScrollPortSizeSet = false;
@@ -807,6 +806,7 @@ PresShell::PresShell()
mPaintingIsFrozen = false;
mHasCSSBackgroundColor = true;
mIsLastChromeOnlyEscapeKeyConsumed = false;
mHasReceivedPaintMessage = false;
}
NS_IMPL_ISUPPORTS(PresShell, nsIPresShell, nsIDocumentObserver,
@@ -1749,6 +1749,12 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
}
}
// If we get here and painting is not suppressed, then we can paint anytime
// and we should fire the before-first-paint notification
if (!mPaintingSuppressed) {
ScheduleBeforeFirstPaint();
}
if (root && root->IsXULElement()) {
mozilla::Telemetry::AccumulateTimeDelta(Telemetry::XUL_INITIAL_FRAME_CONSTRUCTION,
timerStart);
@@ -1771,35 +1777,15 @@ PresShell::AsyncResizeEventCallback(nsITimer* aTimer, void* aPresShell)
static_cast<PresShell*>(aPresShell)->FireResizeEvent();
}
nsresult
PresShell::ResizeReflowOverride(nscoord aWidth, nscoord aHeight)
{
mViewportOverridden = true;
if (mMobileViewportManager) {
// Once the viewport is explicitly overridden, we don't need the
// MobileViewportManager any more (in this presShell at least). Destroying
// it simplifies things because then it can maintain an invariant that any
// time it gets a meta-viewport change (for example) it knows it must
// recompute the CSS viewport and do a reflow. If we didn't destroy it here
// then there would be times where a meta-viewport change would have no
// effect.
mMobileViewportManager->Destroy();
mMobileViewportManager = nullptr;
}
return ResizeReflowIgnoreOverride(aWidth, aHeight);
}
nsresult
PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
{
if (mViewportOverridden) {
// The viewport has been overridden, and this reflow request
// didn't ask to ignore the override. Pretend it didn't happen.
return NS_OK;
if (mZoomConstraintsClient) {
// If we have a ZoomConstraintsClient and the available screen area
// changed, then we might need to disable double-tap-to-zoom, so notify
// the ZCC to update itself.
mZoomConstraintsClient->ScreenSizeChanged();
}
if (mMobileViewportManager) {
// If we have a mobile viewport manager, request a reflow from it. It can
// recompute the final CSS viewport and trigger a call to
@@ -2923,11 +2909,15 @@ PresShell::CreateReferenceRenderingContext()
if (mPresContext->IsScreen()) {
rc = new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
} else {
// We assume the devCtx has positive width and height for this call
// We assume the devCtx has positive width and height for this call.
// However, width and height, may be outside of the reasonable range
// so rc may still be null.
rc = devCtx->CreateRenderingContext();
if (!rc) {
return nullptr;
}
}
MOZ_ASSERT(rc, "shouldn't break promise to return non-null");
return rc.forget();
}
@@ -3764,6 +3754,17 @@ PresShell::CaptureHistoryState(nsILayoutHistoryState** aState)
return NS_OK;
}
void
PresShell::ScheduleBeforeFirstPaint()
{
if (!mDocument->IsResourceDoc()) {
// Notify observers that a new page is about to be drawn. Execute this
// as soon as it is safe to run JS, which is guaranteed to be before we
// go back to the event loop and actually draw the page.
nsContentUtils::AddScriptRunner(new nsBeforeFirstPaintDispatcher(mDocument));
}
}
void
PresShell::UnsuppressAndInvalidate()
{
@@ -3775,12 +3776,7 @@ PresShell::UnsuppressAndInvalidate()
return;
}
if (!mDocument->IsResourceDoc()) {
// Notify observers that a new page is about to be drawn. Execute this
// as soon as it is safe to run JS, which is guaranteed to be before we
// go back to the event loop and actually draw the page.
nsContentUtils::AddScriptRunner(new nsBeforeFirstPaintDispatcher(mDocument));
}
ScheduleBeforeFirstPaint();
mPaintingSuppressed = false;
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
@@ -4775,14 +4771,21 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
frame->GetPointFromOffset(hilightStart, &startPoint);
frame->GetPointFromOffset(hilightEnd, &endPoint);
// the clip rectangle is determined by taking the the start and
// The clip rectangle is determined by taking the the start and
// end points of the range, offset from the reference frame.
// Because of rtl, the end point may be to the left of the
// start point, so x is set to the lowest value
// Because of rtl, the end point may be to the left of (or above,
// in vertical mode) the start point, so x (or y) is set to the
// lower of the values.
nsRect textRect(aBuilder->ToReferenceFrame(frame), frame->GetSize());
nscoord x = std::min(startPoint.x, endPoint.x);
textRect.x += x;
textRect.width = std::max(startPoint.x, endPoint.x) - x;
if (frame->GetWritingMode().IsVertical()) {
nscoord y = std::min(startPoint.y, endPoint.y);
textRect.y += y;
textRect.height = std::max(startPoint.y, endPoint.y) - y;
} else {
nscoord x = std::min(startPoint.x, endPoint.x);
textRect.x += x;
textRect.width = std::max(startPoint.x, endPoint.x) - x;
}
surfaceRect.UnionRect(surfaceRect, textRect);
DisplayItemClip newClip;
@@ -8602,6 +8605,19 @@ PresShell::DidPaintWindow()
// about compositing of popups.
return;
}
if (!mHasReceivedPaintMessage) {
mHasReceivedPaintMessage = true;
nsCOMPtr<nsIObserverService> obsvc = services::GetObserverService();
if (obsvc && mDocument) {
nsPIDOMWindow* window = mDocument->GetWindow();
nsCOMPtr<nsIDOMChromeWindow> chromeWin(do_QueryInterface(window));
if (chromeWin) {
obsvc->NotifyObservers(chromeWin, "widget-first-paint", nullptr);
}
}
}
}
bool
@@ -8951,6 +8967,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
// CreateReferenceRenderingContext can return nullptr
nsRenderingContext rcx(CreateReferenceRenderingContext());
#ifdef DEBUG
@@ -10884,6 +10901,7 @@ nsIPresShell::SyncWindowProperties(nsView* aView)
{
nsIFrame* frame = aView->GetFrame();
if (frame && mPresContext) {
// CreateReferenceRenderingContext can return nullptr
nsRenderingContext rcx(CreateReferenceRenderingContext());
nsContainerFrame::SyncWindowProperties(mPresContext, frame, aView, &rcx, 0);
}