Bug 1545342 - part 3: Move remaining public enum of nsIPresShell to mozilla namespace in mozilla/PresShellForwards.h and make them enum class r=smaug

This patch moves remaining public `enum` of `nsIPresShell` to `mozilla`
namespace in `mozilla/PresShellForwards.h` and make them `enum class`es.

Additionally, some methods which use the moving `enum`s from `nsIPresShell`
to `PresShell`.

Differential Revision: https://phabricator.services.mozilla.com/D28607

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2019-04-25 05:04:23 +00:00
Родитель 3622509485
Коммит 2933c032e7
22 изменённых файлов: 256 добавлений и 216 удалений

Просмотреть файл

@ -10511,8 +10511,8 @@ void Document::CleanupFullscreenState() {
// Restore the zoom level that was in place prior to entering fullscreen.
if (PresShell* presShell = GetPresShell()) {
if (presShell->GetMobileViewportManager()) {
presShell->SetResolutionAndScaleTo(
mSavedResolution, nsIPresShell::ChangeOrigin::eMainThread);
presShell->SetResolutionAndScaleTo(mSavedResolution,
ResolutionChangeOrigin::MainThread);
}
}
@ -10910,7 +10910,7 @@ bool Document::ApplyFullscreen(UniquePtr<FullscreenRequest> aRequest) {
child->mSavedResolution = presShell->GetResolution();
presShell->SetResolutionAndScaleTo(
manager->ComputeIntrinsicResolution(),
nsIPresShell::ChangeOrigin::eMainThread);
ResolutionChangeOrigin::MainThread);
}
}

Просмотреть файл

@ -383,7 +383,7 @@ nsDOMWindowUtils::UpdateLayerTree() {
nsAutoScriptBlocker scriptBlocker;
presShell->Paint(
view, view->GetBounds(),
nsIPresShell::PAINT_LAYERS | nsIPresShell::PAINT_SYNC_DECODE_IMAGES);
PaintFlags::PaintLayers | PaintFlags::PaintSyncDecodeImages);
presShell->GetLayerManager()->WaitOnTransactionProcessed();
}
}
@ -568,7 +568,7 @@ nsDOMWindowUtils::SetResolutionAndScaleTo(float aResolution) {
}
presShell->SetResolutionAndScaleTo(aResolution,
nsIPresShell::ChangeOrigin::eMainThread);
ResolutionChangeOrigin::MainThread);
return NS_OK;
}

Просмотреть файл

@ -4666,24 +4666,25 @@ void CanvasRenderingContext2D::DrawWindow(nsGlobalWindowInner& aWindow,
nsPresContext::CSSPixelsToAppUnits((float)aY),
nsPresContext::CSSPixelsToAppUnits((float)aW),
nsPresContext::CSSPixelsToAppUnits((float)aH));
uint32_t renderDocFlags = (nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING |
nsIPresShell::RENDER_DOCUMENT_RELATIVE);
RenderDocumentFlags renderDocFlags =
(RenderDocumentFlags::IgnoreViewportScrolling |
RenderDocumentFlags::DocumentRelative);
if (aFlags & CanvasRenderingContext2D_Binding::DRAWWINDOW_DRAW_CARET) {
renderDocFlags |= nsIPresShell::RENDER_CARET;
renderDocFlags |= RenderDocumentFlags::DrawCaret;
}
if (aFlags & CanvasRenderingContext2D_Binding::DRAWWINDOW_DRAW_VIEW) {
renderDocFlags &= ~(nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING |
nsIPresShell::RENDER_DOCUMENT_RELATIVE);
renderDocFlags &= ~(RenderDocumentFlags::IgnoreViewportScrolling |
RenderDocumentFlags::DocumentRelative);
}
if (aFlags & CanvasRenderingContext2D_Binding::DRAWWINDOW_USE_WIDGET_LAYERS) {
renderDocFlags |= nsIPresShell::RENDER_USE_WIDGET_LAYERS;
renderDocFlags |= RenderDocumentFlags::UseWidgetLayers;
}
if (aFlags &
CanvasRenderingContext2D_Binding::DRAWWINDOW_ASYNC_DECODE_IMAGES) {
renderDocFlags |= nsIPresShell::RENDER_ASYNC_DECODE_IMAGES;
renderDocFlags |= RenderDocumentFlags::AsyncDecodeImages;
}
if (aFlags & CanvasRenderingContext2D_Binding::DRAWWINDOW_DO_NOT_FLUSH) {
renderDocFlags |= nsIPresShell::RENDER_DRAWWINDOW_NOT_FLUSHING;
renderDocFlags |= RenderDocumentFlags::DrawWindowNotFlushing;
}
// gfxContext-over-Azure may modify the DrawTarget's transform, so

Просмотреть файл

@ -5690,7 +5690,7 @@ nsresult EventStateManager::DoContentCommandScrollEvent(
aEvent->mSucceeded = true;
nsIScrollableFrame* sf =
presShell->GetScrollableFrameToScroll(nsIPresShell::eEither);
presShell->GetScrollableFrameToScroll(ScrollableDirection::Either);
aEvent->mIsEnabled =
sf ? (aEvent->mScroll.mIsHorizontal ? WheelHandlingUtils::CanScrollOn(
sf, aEvent->mScroll.mAmount, 0)

Просмотреть файл

@ -2496,7 +2496,7 @@ mozilla::ipc::IPCResult BrowserChild::RecvRenderLayers(
} else {
RefPtr<nsViewManager> vm = presShell->GetViewManager();
if (nsView* view = vm->GetRootView()) {
presShell->Paint(view, view->GetBounds(), nsIPresShell::PAINT_LAYERS);
presShell->Paint(view, view->GetBounds(), PaintFlags::PaintLayers);
}
}
presShell->SuppressDisplayport(false);

Просмотреть файл

@ -352,10 +352,10 @@ void MediaEngineTabVideoSource::Draw() {
(((float)size.height) / mViewportHeight)));
nscolor bgColor = NS_RGB(255, 255, 255);
uint32_t renderDocFlags =
mScrollWithPage ? 0
: (nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING |
nsIPresShell::RENDER_DOCUMENT_RELATIVE);
RenderDocumentFlags renderDocFlags =
mScrollWithPage ? RenderDocumentFlags::None
: (RenderDocumentFlags::IgnoreViewportScrolling |
RenderDocumentFlags::DocumentRelative);
nsRect r(nsPresContext::CSSPixelsToAppUnits((float)mViewportOffsetX),
nsPresContext::CSSPixelsToAppUnits((float)mViewportOffsetY),
nsPresContext::CSSPixelsToAppUnits((float)mViewportWidth),

Просмотреть файл

@ -99,7 +99,8 @@ PaintFragment PaintFragment::Record(nsIDocShell* aDocShell,
RefPtr<gfxContext> thebes = gfxContext::CreateOrNull(dt);
thebes->SetMatrix(Matrix::Scaling(aScale, aScale));
RefPtr<PresShell> presShell = presContext->PresShell();
Unused << presShell->RenderDocument(r, 0, aBackgroundColor, thebes);
Unused << presShell->RenderDocument(r, RenderDocumentFlags::None,
aBackgroundColor, thebes);
}
ByteBuf recording = ByteBuf((uint8_t*)recorder->mOutputStream.mData,

Просмотреть файл

@ -209,10 +209,10 @@ FocusTarget::FocusTarget(PresShell* aRootPresShell,
// for this scroll target
nsIScrollableFrame* horizontal =
presShell->GetScrollableFrameToScrollForContent(
selectedContent.get(), nsIPresShell::eHorizontal);
selectedContent.get(), ScrollableDirection::Horizontal);
nsIScrollableFrame* vertical =
presShell->GetScrollableFrameToScrollForContent(selectedContent.get(),
nsIPresShell::eVertical);
presShell->GetScrollableFrameToScrollForContent(
selectedContent.get(), ScrollableDirection::Vertical);
// We might have the globally focused element for scrolling. Gather a ViewID
// for the horizontal and vertical scroll targets of this element.

Просмотреть файл

@ -337,7 +337,7 @@ void APZCCallbackHelper::UpdateRootFrame(const RepaintRequest& aRequest) {
presShellResolution =
aRequest.GetPresShellResolution() * aRequest.GetAsyncZoom().scale;
presShell->SetResolutionAndScaleTo(presShellResolution,
nsIPresShell::ChangeOrigin::eApz);
ResolutionChangeOrigin::Apz);
}
// Do this as late as possible since scrolling can flush layout. It also

Просмотреть файл

@ -1241,7 +1241,8 @@ void gfxUtils::WriteAsPNG(nsIPresShell* aShell, const char* aFile) {
RefPtr<gfxContext> context = gfxContext::CreateOrNull(dt);
MOZ_ASSERT(context); // already checked the draw target above
aShell->RenderDocument(r, 0, NS_RGB(255, 255, 0), context);
aShell->RenderDocument(r, RenderDocumentFlags::None, NS_RGB(255, 255, 0),
context);
WriteAsPNG(dt.get(), aFile);
}

Просмотреть файл

@ -297,9 +297,10 @@ bool SVGDrawingCallback::operator()(gfxContext* aContext,
nsRect svgRect(0, 0, presContext->DevPixelsToAppUnits(mViewportSize.width),
presContext->DevPixelsToAppUnits(mViewportSize.height));
uint32_t renderDocFlags = nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING;
RenderDocumentFlags renderDocFlags =
RenderDocumentFlags::IgnoreViewportScrolling;
if (!(mImageFlags & imgIContainer::FLAG_SYNC_DECODE)) {
renderDocFlags |= nsIPresShell::RENDER_ASYNC_DECODE_IMAGES;
renderDocFlags |= RenderDocumentFlags::AsyncDecodeImages;
}
presShell->RenderDocument(svgRect, renderDocFlags,

Просмотреть файл

@ -127,7 +127,7 @@ bool GeckoMVMContext::AllowZoomingForDocument() const {
void GeckoMVMContext::SetResolutionAndScaleTo(float aResolution) {
MOZ_ASSERT(mPresShell);
mPresShell->SetResolutionAndScaleTo(aResolution,
nsIPresShell::ChangeOrigin::eMainThread);
ResolutionChangeOrigin::MainThread);
}
void GeckoMVMContext::SetVisualViewportSize(const CSSSize& aSize) {

Просмотреть файл

@ -2250,7 +2250,8 @@ NS_IMETHODIMP
PresShell::PageMove(bool aForward, bool aExtend) {
nsIFrame* frame = nullptr;
if (!aExtend) {
frame = do_QueryFrame(GetScrollableFrameToScroll(nsIPresShell::eVertical));
frame = do_QueryFrame(
GetScrollableFrameToScroll(ScrollableDirection::Vertical));
// If there is no scrollable frame, get the frame to move caret instead.
}
if (!frame) {
@ -2273,7 +2274,7 @@ PresShell::PageMove(bool aForward, bool aExtend) {
NS_IMETHODIMP
PresShell::ScrollPage(bool aForward) {
nsIScrollableFrame* scrollFrame =
GetScrollableFrameToScroll(nsIPresShell::eVertical);
GetScrollableFrameToScroll(ScrollableDirection::Vertical);
if (scrollFrame) {
scrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1),
nsIScrollableFrame::PAGES, ScrollMode::eSmooth,
@ -2286,7 +2287,7 @@ PresShell::ScrollPage(bool aForward) {
NS_IMETHODIMP
PresShell::ScrollLine(bool aForward) {
nsIScrollableFrame* scrollFrame =
GetScrollableFrameToScroll(nsIPresShell::eVertical);
GetScrollableFrameToScroll(ScrollableDirection::Vertical);
if (scrollFrame) {
int32_t lineCount =
Preferences::GetInt("toolkit.scrollbox.verticalScrollDistance",
@ -2302,7 +2303,7 @@ PresShell::ScrollLine(bool aForward) {
NS_IMETHODIMP
PresShell::ScrollCharacter(bool aRight) {
nsIScrollableFrame* scrollFrame =
GetScrollableFrameToScroll(nsIPresShell::eHorizontal);
GetScrollableFrameToScroll(ScrollableDirection::Horizontal);
if (scrollFrame) {
int32_t h =
Preferences::GetInt("toolkit.scrollbox.horizontalScrollDistance",
@ -2318,7 +2319,7 @@ PresShell::ScrollCharacter(bool aRight) {
NS_IMETHODIMP
PresShell::CompleteScroll(bool aForward) {
nsIScrollableFrame* scrollFrame =
GetScrollableFrameToScroll(nsIPresShell::eVertical);
GetScrollableFrameToScroll(ScrollableDirection::Vertical);
if (scrollFrame) {
scrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1),
nsIScrollableFrame::WHOLE, ScrollMode::eSmooth,
@ -2768,18 +2769,19 @@ already_AddRefed<nsIContent> nsIPresShell::GetSelectedContentForScrolling()
}
nsIScrollableFrame* nsIPresShell::GetNearestScrollableFrame(
nsIFrame* aFrame, nsIPresShell::ScrollDirection aDirection) {
if (aDirection == nsIPresShell::eEither) {
nsIFrame* aFrame, ScrollableDirection aDirection) {
if (aDirection == ScrollableDirection::Either) {
return nsLayoutUtils::GetNearestScrollableFrame(aFrame);
}
return nsLayoutUtils::GetNearestScrollableFrameForDirection(
aFrame, aDirection == eVertical ? nsLayoutUtils::eVertical
: nsLayoutUtils::eHorizontal);
aFrame, aDirection == ScrollableDirection::Vertical
? nsLayoutUtils::eVertical
: nsLayoutUtils::eHorizontal);
}
nsIScrollableFrame* nsIPresShell::GetScrollableFrameToScrollForContent(
nsIContent* aContent, nsIPresShell::ScrollDirection aDirection) {
nsIContent* aContent, ScrollableDirection aDirection) {
nsIScrollableFrame* scrollFrame = nullptr;
if (aContent) {
nsIFrame* startFrame = aContent->GetPrimaryFrame();
@ -2803,7 +2805,7 @@ nsIScrollableFrame* nsIPresShell::GetScrollableFrameToScrollForContent(
}
nsIScrollableFrame* nsIPresShell::GetScrollableFrameToScroll(
nsIPresShell::ScrollDirection aDirection) {
ScrollableDirection aDirection) {
nsCOMPtr<nsIContent> content = GetContentForScrolling();
return GetScrollableFrameToScrollForContent(content.get(), aDirection);
}
@ -3665,7 +3667,7 @@ void PresShell::ScheduleViewManagerFlush(PaintType aType) {
return;
}
if (aType == PAINT_DELAYED_COMPRESS) {
if (aType == PaintType::DelayedCompress) {
// Delay paint for 1 second.
static const uint32_t kPaintDelayPeriod = 1000;
if (!mDelayedPaintTimer) {
@ -4421,10 +4423,12 @@ void PresShell::ReconstructFrames() {
nsCSSFrameConstructor::InsertionKind::Sync);
}
nsresult PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
nsresult PresShell::RenderDocument(const nsRect& aRect,
RenderDocumentFlags aFlags,
nscolor aBackgroundColor,
gfxContext* aThebesContext) {
NS_ENSURE_TRUE(!(aFlags & RENDER_IS_UNTRUSTED), NS_ERROR_NOT_IMPLEMENTED);
NS_ENSURE_TRUE(!(aFlags & RenderDocumentFlags::IsUntrusted),
NS_ERROR_NOT_IMPLEMENTED);
nsRootPresContext* rootPresContext = mPresContext->GetRootPresContext();
if (rootPresContext) {
@ -4482,10 +4486,10 @@ nsresult PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
if (aThebesContext->CurrentMatrix().HasNonIntegerTranslation()) {
flags |= PaintFrameFlags::PAINT_IN_TRANSFORM;
}
if (!(aFlags & RENDER_ASYNC_DECODE_IMAGES)) {
if (!(aFlags & RenderDocumentFlags::AsyncDecodeImages)) {
flags |= PaintFrameFlags::PAINT_SYNC_DECODE_IMAGES;
}
if (aFlags & RENDER_USE_WIDGET_LAYERS) {
if (aFlags & RenderDocumentFlags::UseWidgetLayers) {
// We only support using widget layers on display root's with widgets.
nsView* view = rootFrame->GetView();
if (view && view->GetWidget() &&
@ -4499,20 +4503,20 @@ nsresult PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
}
}
}
if (!(aFlags & RENDER_CARET)) {
if (!(aFlags & RenderDocumentFlags::DrawCaret)) {
wouldFlushRetainedLayers = true;
flags |= PaintFrameFlags::PAINT_HIDE_CARET;
}
if (aFlags & RENDER_IGNORE_VIEWPORT_SCROLLING) {
if (aFlags & RenderDocumentFlags::IgnoreViewportScrolling) {
wouldFlushRetainedLayers = !IgnoringViewportScrolling();
mRenderFlags =
ChangeFlag(mRenderFlags, true, STATE_IGNORING_VIEWPORT_SCROLLING);
}
if (aFlags & RENDER_DRAWWINDOW_NOT_FLUSHING) {
if (aFlags & RenderDocumentFlags::DrawWindowNotFlushing) {
mRenderFlags =
ChangeFlag(mRenderFlags, true, STATE_DRAWWINDOW_NOT_FLUSHING);
}
if (aFlags & RENDER_DOCUMENT_RELATIVE) {
if (aFlags & RenderDocumentFlags::DocumentRelative) {
// XXX be smarter about this ... drawWindow might want a rect
// that's "pretty close" to what our retained layer tree covers.
// In that case, it wouldn't disturb normal rendering too much,
@ -4762,7 +4766,7 @@ already_AddRefed<SourceSurface> PresShell::PaintRangePaintInfo(
const nsTArray<UniquePtr<RangePaintInfo>>& aItems, Selection* aSelection,
const Maybe<CSSIntRegion>& aRegion, nsRect aArea,
const LayoutDeviceIntPoint aPoint, LayoutDeviceIntRect* aScreenRect,
uint32_t aFlags) {
RenderImageFlags aFlags) {
nsPresContext* pc = GetPresContext();
if (!pc || aArea.width == 0 || aArea.height == 0) return nullptr;
@ -4779,11 +4783,11 @@ already_AddRefed<SourceSurface> PresShell::PaintRangePaintInfo(
pc->DeviceContext()->GetClientRect(maxSize);
// check if the image should be resized
bool resize = aFlags & RENDER_AUTO_SCALE;
bool resize = !!(aFlags & RenderImageFlags::AutoScale);
if (resize) {
// check if image-resizing-algorithm should be used
if (aFlags & RENDER_IS_IMAGE) {
if (aFlags & RenderImageFlags::IsImage) {
// get max screensize
nscoord maxWidth = pc->AppUnitsToDevPixels(maxSize.width);
nscoord maxHeight = pc->AppUnitsToDevPixels(maxSize.height);
@ -4909,7 +4913,7 @@ already_AddRefed<SourceSurface> PresShell::PaintRangePaintInfo(
already_AddRefed<SourceSurface> PresShell::RenderNode(
nsINode* aNode, const Maybe<CSSIntRegion>& aRegion,
const LayoutDeviceIntPoint aPoint, LayoutDeviceIntRect* aScreenRect,
uint32_t aFlags) {
RenderImageFlags aFlags) {
// area will hold the size of the surface needed to draw the node, measured
// from the root frame.
nsRect area;
@ -4955,7 +4959,7 @@ already_AddRefed<SourceSurface> PresShell::RenderNode(
already_AddRefed<SourceSurface> PresShell::RenderSelection(
Selection* aSelection, const LayoutDeviceIntPoint aPoint,
LayoutDeviceIntRect* aScreenRect, uint32_t aFlags) {
LayoutDeviceIntRect* aScreenRect, RenderImageFlags aFlags) {
// area will hold the size of the surface needed to draw the selection,
// measured from the root frame.
nsRect area;
@ -5017,7 +5021,8 @@ static bool AddCanvasBackgroundColor(const nsDisplayList& aList,
void PresShell::AddCanvasBackgroundColorItem(
nsDisplayListBuilder& aBuilder, nsDisplayList& aList, nsIFrame* aFrame,
const nsRect& aBounds, nscolor aBackstopColor, uint32_t aFlags) {
const nsRect& aBounds, nscolor aBackstopColor,
AddCanvasBackgroundColorFlags aFlags) {
if (aBounds.IsEmpty()) {
return;
}
@ -5027,7 +5032,7 @@ void PresShell::AddCanvasBackgroundColorItem(
// (sub)tree we are painting is a canvas frame that should cover us in all
// cases (it will usually be a viewport frame when we have a canvas frame in
// the (sub)tree).
if (!(aFlags & nsIPresShell::FORCE_DRAW) &&
if (!(aFlags & AddCanvasBackgroundColorFlags::ForceDraw) &&
!nsCSSRendering::IsCanvasFrame(aFrame)) {
return;
}
@ -5041,7 +5046,8 @@ void PresShell::AddCanvasBackgroundColorItem(
// by making nsDisplayCanvasBackground paint it.
// If we're only adding an unscrolled item, then pretend that we've
// already done it.
bool addedScrollingBackgroundColor = (aFlags & APPEND_UNSCROLLED_ONLY);
bool addedScrollingBackgroundColor =
!!(aFlags & AddCanvasBackgroundColorFlags::AppendUnscrolledOnly);
if (!aFrame->GetParent() && !addedScrollingBackgroundColor) {
nsIScrollableFrame* sf =
aFrame->PresShell()->GetRootScrollFrameAsScrollable();
@ -5061,7 +5067,7 @@ void PresShell::AddCanvasBackgroundColorItem(
// We can only do that if the color is opaque.
bool forceUnscrolledItem =
nsLayoutUtils::UsesAsyncScrolling(aFrame) && NS_GET_A(bgcolor) == 255;
if ((aFlags & ADD_FOR_SUBDOC) &&
if ((aFlags & AddCanvasBackgroundColorFlags::AddForSubDocument) &&
gfxPrefs::LayoutUseContainersForRootFrames()) {
// If we're using ContainerLayers for a subdoc, then any items we add here
// will still be scrolled (since we're inside the container at this point),
@ -5191,7 +5197,7 @@ void PresShell::SetIgnoreViewportScrolling(bool aIgnore) {
}
nsresult PresShell::SetResolutionAndScaleTo(float aResolution,
ChangeOrigin aOrigin) {
ResolutionChangeOrigin aOrigin) {
if (!(aResolution > 0.0)) {
return NS_ERROR_ILLEGAL_VALUE;
}
@ -5205,7 +5211,7 @@ nsresult PresShell::SetResolutionAndScaleTo(float aResolution,
if (mMobileViewportManager) {
mMobileViewportManager->ResolutionUpdated();
}
if (aOrigin == ChangeOrigin::eApz) {
if (aOrigin == ResolutionChangeOrigin::Apz) {
mResolutionUpdatedByApz = true;
} else {
mResolutionUpdated = true;
@ -5895,21 +5901,21 @@ void PresShell::RemoveFrameFromApproximatelyVisibleList(nsIFrame* aFrame) {
class nsAutoNotifyDidPaint {
public:
nsAutoNotifyDidPaint(PresShell* aShell, uint32_t aFlags)
nsAutoNotifyDidPaint(PresShell* aShell, PaintFlags aFlags)
: mShell(aShell), mFlags(aFlags) {}
~nsAutoNotifyDidPaint() {
if (mFlags & nsIPresShell::PAINT_COMPOSITE) {
if (!!(mFlags & PaintFlags::PaintComposite)) {
mShell->GetPresContext()->NotifyDidPaintForSubtree();
}
}
private:
PresShell* mShell;
uint32_t mFlags;
PaintFlags mFlags;
};
void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
uint32_t aFlags) {
PaintFlags aFlags) {
nsCString url;
nsIURI* uri = mDocument->GetDocumentURI();
Document* contentRoot = GetPrimaryContentDocument();
@ -5927,7 +5933,7 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
// assert there. However, we don't rely on this assertion on Android because
// we don't paint while JS is running.
#if !defined(MOZ_WIDGET_ANDROID)
if (!(aFlags & nsIPresShell::PAINT_COMPOSITE)) {
if (!(aFlags & PaintFlags::PaintComposite)) {
// We need to allow content JS when the flag is set since we may trigger
// MozAfterPaint events in content in those cases.
nojs.emplace(dom::danger::GetJSContext());
@ -5987,14 +5993,14 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
// and b) below we don't want to clear NS_FRAME_UPDATE_LAYER_TREE,
// that will cause us to forget to update the real layer manager!
if (!(aFlags & PAINT_LAYERS)) {
if (!(aFlags & PaintFlags::PaintLayers)) {
if (layerManager->EndEmptyTransaction()) {
return;
}
NS_WARNING("Must complete empty transaction when compositing!");
}
if (!(aFlags & PAINT_SYNC_DECODE_IMAGES) &&
if (!(aFlags & PaintFlags::PaintSyncDecodeImages) &&
!(frame->GetStateBits() & NS_FRAME_UPDATE_LAYER_TREE) &&
!mNextPaintCompressed) {
NotifySubDocInvalidationFunc computeInvalidFunc =
@ -6016,8 +6022,9 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
MaybeSetupTransactionIdAllocator(layerManager, presContext);
if (layerManager->EndEmptyTransaction(
(aFlags & PAINT_COMPOSITE) ? LayerManager::END_DEFAULT
: LayerManager::END_NO_COMPOSITE)) {
(aFlags & PaintFlags::PaintComposite)
? LayerManager::END_DEFAULT
: LayerManager::END_NO_COMPOSITE)) {
nsIntRegion invalid;
bool areaOverflowed = false;
if (props) {
@ -6059,10 +6066,10 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
nscolor bgcolor = ComputeBackstopColor(aViewToPaint);
PaintFrameFlags flags = PaintFrameFlags::PAINT_WIDGET_LAYERS |
PaintFrameFlags::PAINT_EXISTING_TRANSACTION;
if (!(aFlags & PAINT_COMPOSITE)) {
if (!(aFlags & PaintFlags::PaintComposite)) {
flags |= PaintFrameFlags::PAINT_NO_COMPOSITE;
}
if (aFlags & PAINT_SYNC_DECODE_IMAGES) {
if (aFlags & PaintFlags::PaintSyncDecodeImages) {
flags |= PaintFrameFlags::PAINT_SYNC_DECODE_IMAGES;
}
if (mNextPaintCompressed) {
@ -6115,7 +6122,7 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
}
MaybeSetupTransactionIdAllocator(layerManager, presContext);
layerManager->EndTransaction(nullptr, nullptr,
(aFlags & PAINT_COMPOSITE)
(aFlags & PaintFlags::PaintComposite)
? LayerManager::END_DEFAULT
: LayerManager::END_NO_COMPOSITE);
}

Просмотреть файл

@ -140,7 +140,7 @@ class PresShell final : public nsIPresShell,
void Thaw() override;
void FireOrClearDelayedEvents(bool aFireEvents) override;
nsresult RenderDocument(const nsRect& aRect, uint32_t aFlags,
nsresult RenderDocument(const nsRect& aRect, RenderDocumentFlags aFlags,
nscolor aBackgroundColor,
gfxContext* aThebesContext) override;
@ -148,11 +148,11 @@ class PresShell final : public nsIPresShell,
const Maybe<CSSIntRegion>& aRegion,
const LayoutDeviceIntPoint aPoint,
LayoutDeviceIntRect* aScreenRect,
uint32_t aFlags) override;
RenderImageFlags aFlags) override;
already_AddRefed<SourceSurface> RenderSelection(
dom::Selection* aSelection, const LayoutDeviceIntPoint aPoint,
LayoutDeviceIntRect* aScreenRect, uint32_t aFlags) override;
LayoutDeviceIntRect* aScreenRect, RenderImageFlags aFlags) override;
already_AddRefed<nsPIDOMWindowOuter> GetRootWindow() override;
@ -165,8 +165,26 @@ class PresShell final : public nsIPresShell,
void SetIgnoreViewportScrolling(bool aIgnore) override;
/**
* Set a "resolution" for the document, which if not 1.0 will
* allocate more or fewer pixels for rescalable content by a factor
* of |resolution| in both dimensions. Return NS_OK iff the
* resolution bounds are sane, and the resolution of this was
* actually updated.
*
* Also increase the scale of the content by the same amount
* (that's the "AndScaleTo" part).
*
* The resolution defaults to 1.0.
*
* |aOrigin| specifies who originated the resolution change. For changes
* sent by APZ, pass ResolutionChangeOrigin::Apz. For changes sent by
* the main thread, use pass ResolutionChangeOrigin::MainThread (similar
* to the |aOrigin| parameter of nsIScrollableFrame::ScrollToCSSPixels()).
*/
nsresult SetResolutionAndScaleTo(float aResolution,
ChangeOrigin aOrigin) override;
ResolutionChangeOrigin aOrigin);
float GetCumulativeResolution() override;
float GetCumulativeNonRootScaleResolution() override;
void SetRestoreResolution(float aResolution,
@ -190,7 +208,8 @@ class PresShell final : public nsIPresShell,
// nsIViewObserver interface
void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
uint32_t aFlags) override;
PaintFlags aFlags);
MOZ_CAN_RUN_SCRIPT nsresult HandleEvent(nsIFrame* aFrameForPresShell,
WidgetGUIEvent* aEvent,
bool aDontRetargetEvents,
@ -203,7 +222,7 @@ class PresShell final : public nsIPresShell,
nsEventStatus* aStatus) override;
bool ShouldIgnoreInvalidation() override;
/**
* Notify that we're going to call Paint with PAINT_LAYERS
* Notify that we're going to call Paint with PaintFlags::PaintLayers
* on the pres shell for a widget (which might not be this one, since
* WillPaint is called on all presshells in the same toplevel window as the
* painted widget). This is issued at a time when it's safe to modify
@ -212,7 +231,17 @@ class PresShell final : public nsIPresShell,
MOZ_CAN_RUN_SCRIPT void WillPaint();
void WillPaintWindow() override;
void DidPaintWindow() override;
void ScheduleViewManagerFlush(PaintType aType = PAINT_DEFAULT) override;
/**
* Ensures that the refresh driver is running, and schedules a view
* manager flush on the next tick.
*
* @param aType PaintType::DelayedCompress : Schedule a paint to be executed
* after a delay, and put FrameLayerBuilder in 'compressed' mode that avoids
* short cut optimizations.
*/
void ScheduleViewManagerFlush(PaintType aType = PaintType::Default);
void ClearMouseCaptureOnView(nsView* aView) override;
bool IsVisible() override;
void SuppressDisplayport(bool aEnabled) override;
@ -293,10 +322,32 @@ class PresShell final : public nsIPresShell,
void UpdateCanvasBackground() override;
/**
* Add a solid color item to the bottom of aList with frame aFrame and bounds
* aBounds. Checks first if this needs to be done by checking if aFrame is a
* canvas frame (if the AddCanvasBackgroundColorFlags::ForceDraw is passed
* then this check is skipped). aBackstopColor is composed behind the
* background color of the canvas, it is transparent by default.
*
* We attempt to make the background color part of the scrolled canvas (to
* reduce transparent layers), and if async scrolling is enabled (and the
* background is opaque) then we add a second, unscrolled item to handle the
* checkerboarding case.
*
* AddCanvasBackgroundColorFlags::AddSubDocument should be specified when
* calling this for a subdocument, and LayoutUseContainersForRootFrame might
* cause the whole list to be scrolled. In that case the second unscrolled
* item will be elided.
*
* AddCanvasBackgroundColorFlags::AppendUnscrolledOnly only attempts to add
* the unscrolled item, so that we can add it manually after
* LayoutUseContainersForRootFrame has built the scrolling ContainerLayer.
*/
void AddCanvasBackgroundColorItem(
nsDisplayListBuilder& aBuilder, nsDisplayList& aList, nsIFrame* aFrame,
const nsRect& aBounds, nscolor aBackstopColor = NS_RGBA(0, 0, 0, 0),
uint32_t aFlags = 0) override;
AddCanvasBackgroundColorFlags aFlags =
AddCanvasBackgroundColorFlags::None);
void AddPrintPreviewBackgroundItem(nsDisplayListBuilder& aBuilder,
nsDisplayList& aList, nsIFrame* aFrame,
@ -538,14 +589,14 @@ class PresShell final : public nsIPresShell,
* aPoint - reference point, typically the mouse position
* aScreenRect - [out] set to the area of the screen the painted area should
* be displayed at
* aFlags - set RENDER_AUTO_SCALE to scale down large images, but it must not
* be set if a custom image was specified
* aFlags - set RenderImageFlags::AutoScale to scale down large images, but
* it must not be set if a custom image was specified
*/
already_AddRefed<SourceSurface> PaintRangePaintInfo(
const nsTArray<UniquePtr<RangePaintInfo>>& aItems,
dom::Selection* aSelection, const Maybe<CSSIntRegion>& aRegion,
nsRect aArea, const LayoutDeviceIntPoint aPoint,
LayoutDeviceIntRect* aScreenRect, uint32_t aFlags);
LayoutDeviceIntRect* aScreenRect, RenderImageFlags aFlags);
// Hide a view if it is a popup
void HideViewIfPopup(nsView* aView);

Просмотреть файл

@ -107,6 +107,63 @@ enum class ScrollFlags {
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ScrollFlags)
enum class ScrollableDirection { Horizontal, Vertical, Either };
// See comment at declaration of RenderDocument() for the detail.
enum class RenderDocumentFlags {
None = 0,
IsUntrusted = 1 << 0,
IgnoreViewportScrolling = 1 << 1,
DrawCaret = 1 << 2,
UseWidgetLayers = 1 << 3,
AsyncDecodeImages = 1 << 4,
DocumentRelative = 1 << 5,
DrawWindowNotFlushing = 1 << 6,
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderDocumentFlags)
// See comment at declaration of RenderSelection() for the detail.
enum class RenderImageFlags {
None = 0,
IsImage = 1 << 0,
AutoScale = 1 << 1,
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderImageFlags)
enum class ResolutionChangeOrigin : uint8_t {
Apz,
MainThread,
};
// See comment at declaration of AddCanvasBackgroundColorItem() for the detail.
enum class AddCanvasBackgroundColorFlags {
None = 0,
ForceDraw = 1 << 0,
AddForSubDocument = 1 << 1,
AppendUnscrolledOnly = 1 << 2,
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(AddCanvasBackgroundColorFlags)
enum class PaintFlags {
None = 0,
/* Update the layer tree and paint PaintedLayers. If this is not specified,
* we may still have to do it if the layer tree lost PaintedLayer contents
* we need for compositing. */
PaintLayers = 1 << 0,
/* Composite layers to the window. */
PaintComposite = 1 << 1,
/* Sync-decode images. */
PaintSyncDecodeImages = 1 << 2,
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(PaintFlags)
// See comment at declaration of ScheduleViewManagerFlush() for the detail.
enum class PaintType { Default, DelayedCompress };
#ifdef DEBUG
enum class VerifyReflowFlags {

Просмотреть файл

@ -385,9 +385,8 @@ class nsIPresShell : public nsStubDocumentObserver {
* aDirection is eEither. Otherwise, this returns a nearest frame that is
* scrollable in the specified direction.
*/
enum ScrollDirection { eHorizontal, eVertical, eEither };
nsIScrollableFrame* GetScrollableFrameToScrollForContent(
nsIContent* aContent, ScrollDirection aDirection);
nsIContent* aContent, mozilla::ScrollableDirection aDirection);
/**
* Gets nearest scrollable frame from current focused content or DOM
@ -396,7 +395,8 @@ class nsIPresShell : public nsStubDocumentObserver {
* eEither. Otherwise, this returns a nearest frame that is scrollable in
* the specified direction.
*/
nsIScrollableFrame* GetScrollableFrameToScroll(ScrollDirection aDirection);
nsIScrollableFrame* GetScrollableFrameToScroll(
mozilla::ScrollableDirection aDirection);
/**
* Gets nearest ancestor scrollable frame from aFrame. The frame is
@ -404,8 +404,8 @@ class nsIPresShell : public nsStubDocumentObserver {
* aDirection is eEither. Otherwise, this returns a nearest frame that is
* scrollable in the specified direction.
*/
nsIScrollableFrame* GetNearestScrollableFrame(nsIFrame* aFrame,
ScrollDirection aDirection);
nsIScrollableFrame* GetNearestScrollableFrame(
nsIFrame* aFrame, mozilla::ScrollableDirection aDirection);
/**
* Returns the page sequence frame associated with the frame hierarchy.
@ -984,49 +984,40 @@ class nsIPresShell : public nsStubDocumentObserver {
* or in the root scrolled frame's coordinate system
* (if aIgnoreViewportScrolling is true). The coordinates are in appunits.
* @param aFlags see below;
* set RENDER_IS_UNTRUSTED if the contents may be passed to malicious
* agents. E.g. we might choose not to paint the contents of sensitive widgets
* such as the file name in a file upload widget, and we might choose not
* to paint themes.
* set RENDER_IGNORE_VIEWPORT_SCROLLING to ignore
* clipping and scrollbar painting due to scrolling in the viewport
* set RENDER_CARET to draw the caret if one would be visible
* (by default the caret is never drawn)
* set RENDER_USE_LAYER_MANAGER to force rendering to go through
* the layer manager for the window. This may be unexpectedly slow
* set RenderDocumentFlags::IsUntrusted if the contents may be passed to
* malicious agents. E.g. we might choose not to paint the contents of
* sensitive widgets such as the file name in a file upload widget, and we
* might choose not to paint themes.
* set RenderDocumentFlags::IgnoreViewportScrolling to ignore clipping and
* scrollbar painting due to scrolling in the viewport
* set RenderDocumentFlags::DrawCaret to draw the caret if one would be
* visible (by default the caret is never drawn)
* set RenderDocumentFlags::UseWidgetLayers to force rendering to go
* through the layer manager for the window. This may be unexpectedly slow
* (if the layer manager must read back data from the GPU) or low-quality
* (if the layer manager reads back pixel data and scales it
* instead of rendering using the appropriate scaling). It may also
* slow everything down if the area rendered does not correspond to the
* normal visible area of the window.
* set RENDER_ASYNC_DECODE_IMAGES to avoid having images synchronously
* decoded during rendering.
* set RenderDocumentFlags::AsyncDecodeImages to avoid having images
* synchronously decoded during rendering.
* (by default images decode synchronously with RenderDocument)
* set RENDER_DOCUMENT_RELATIVE to render the document as if there has been
* no scrolling and interpret |aRect| relative to the document instead of the
* CSS viewport. Only considered if RENDER_IGNORE_VIEWPORT_SCROLLING is set
* or the document is in ignore viewport scrolling mode
* set RenderDocumentFlags::DocumentRelative to render the document as if
* there has been no scrolling and interpret |aRect| relative to the document
* instead of the CSS viewport. Only considered if
* RenderDocumentFlags::IgnoreViewportScrolling is set or the document is in
* ignore viewport scrolling mode
* (nsIPresShell::SetIgnoreViewportScrolling/IgnoringViewportScrolling).
* @param aBackgroundColor a background color to render onto
* @param aRenderedContext the gfxContext to render to. We render so that
* one CSS pixel in the source document is rendered to one unit in the current
* transform.
*/
enum {
RENDER_IS_UNTRUSTED = 0x01,
RENDER_IGNORE_VIEWPORT_SCROLLING = 0x02,
RENDER_CARET = 0x04,
RENDER_USE_WIDGET_LAYERS = 0x08,
RENDER_ASYNC_DECODE_IMAGES = 0x10,
RENDER_DOCUMENT_RELATIVE = 0x20,
RENDER_DRAWWINDOW_NOT_FLUSHING = 0x40
};
virtual nsresult RenderDocument(const nsRect& aRect, uint32_t aFlags,
virtual nsresult RenderDocument(const nsRect& aRect,
mozilla::RenderDocumentFlags aFlags,
nscolor aBackgroundColor,
gfxContext* aRenderedContext) = 0;
enum { RENDER_IS_IMAGE = 0x100, RENDER_AUTO_SCALE = 0x80 };
/**
* Renders a node aNode to a surface and returns it. The aRegion may be used
* to clip the rendering. This region is measured in CSS pixels from the
@ -1036,7 +1027,8 @@ class nsIPresShell : public nsStubDocumentObserver {
virtual already_AddRefed<mozilla::gfx::SourceSurface> RenderNode(
nsINode* aNode, const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
const mozilla::LayoutDeviceIntPoint aPoint,
mozilla::LayoutDeviceIntRect* aScreenRect, uint32_t aFlags) = 0;
mozilla::LayoutDeviceIntRect* aScreenRect,
mozilla::RenderImageFlags aFlags) = 0;
/**
* Renders a selection to a surface and returns it. This method is primarily
@ -1045,8 +1037,8 @@ class nsIPresShell : public nsStubDocumentObserver {
* aScreenRect will be filled in with the bounding rectangle of the
* selection area on screen.
*
* If the area of the selection is large and the RENDER_AUTO_SCALE flag is
* set, the image will be scaled down. The argument aPoint is used in this
* If the area of the selection is large and the RenderImageFlags::AutoScale
* is set, the image will be scaled down. The argument aPoint is used in this
* case as a reference point when determining the new screen rectangle after
* scaling. Typically, this will be the mouse position, so that the screen
* rectangle is positioned such that the mouse is over the same point in the
@ -1057,7 +1049,8 @@ class nsIPresShell : public nsStubDocumentObserver {
virtual already_AddRefed<mozilla::gfx::SourceSurface> RenderSelection(
mozilla::dom::Selection* aSelection,
const mozilla::LayoutDeviceIntPoint aPoint,
mozilla::LayoutDeviceIntRect* aScreenRect, uint32_t aFlags) = 0;
mozilla::LayoutDeviceIntRect* aScreenRect,
mozilla::RenderImageFlags aFlags) = 0;
void AddAutoWeakFrame(AutoWeakFrame* aWeakFrame);
void AddWeakFrame(WeakFrame* aWeakFrame);
@ -1094,36 +1087,6 @@ class nsIPresShell : public nsStubDocumentObserver {
*/
virtual void UpdateCanvasBackground() = 0;
/**
* Add a solid color item to the bottom of aList with frame aFrame and bounds
* aBounds. Checks first if this needs to be done by checking if aFrame is a
* canvas frame (if the FORCE_DRAW flag is passed then this check is skipped).
* aBackstopColor is composed behind the background color of the canvas, it is
* transparent by default.
*
* We attempt to make the background color part of the scrolled canvas (to
* reduce transparent layers), and if async scrolling is enabled (and the
* background is opaque) then we add a second, unscrolled item to handle the
* checkerboarding case.
*
* ADD_FOR_SUBDOC should be specified when calling this for a subdocument, and
* LayoutUseContainersForRootFrame might cause the whole list to be scrolled.
* In that case the second unscrolled item will be elided.
*
* APPEND_UNSCROLLED_ONLY only attempts to add the unscrolled item, so that
* we can add it manually after LayoutUseContainersForRootFrame has built the
* scrolling ContainerLayer.
*/
enum {
FORCE_DRAW = 0x01,
ADD_FOR_SUBDOC = 0x02,
APPEND_UNSCROLLED_ONLY = 0x04,
};
virtual void AddCanvasBackgroundColorItem(
nsDisplayListBuilder& aBuilder, nsDisplayList& aList, nsIFrame* aFrame,
const nsRect& aBounds, nscolor aBackstopColor = NS_RGBA(0, 0, 0, 0),
uint32_t aFlags = 0) = 0;
/**
* Add a solid color item to the bottom of aList with frame aFrame and
* bounds aBounds representing the dark grey background behind the page of a
@ -1221,29 +1184,6 @@ class nsIPresShell : public nsStubDocumentObserver {
return mRenderFlags & STATE_IGNORING_VIEWPORT_SCROLLING;
}
/**
* Set a "resolution" for the document, which if not 1.0 will
* allocate more or fewer pixels for rescalable content by a factor
* of |resolution| in both dimensions. Return NS_OK iff the
* resolution bounds are sane, and the resolution of this was
* actually updated.
*
* Also increase the scale of the content by the same amount
* (that's the "AndScaleTo" part).
*
* The resolution defaults to 1.0.
*
* |aOrigin| specifies who originated the resolution change. For changes
* sent by APZ, pass ChangeOrigin::eApz. For changes sent by the main thread,
* use pass ChangeOrigin::eMainThread (similar to the |aOrigin| parameter of
* nsIScrollableFrame::ScrollToCSSPixels()).
*/
enum class ChangeOrigin : uint8_t {
eApz,
eMainThread,
};
virtual nsresult SetResolutionAndScaleTo(float aResolution,
ChangeOrigin aOrigin) = 0;
float GetResolution() const { return mResolution.valueOr(1.0); }
virtual float GetCumulativeResolution() = 0;
@ -1299,18 +1239,6 @@ class nsIPresShell : public nsStubDocumentObserver {
*/
virtual void SynthesizeMouseMove(bool aFromScroll) = 0;
enum PaintFlags {
/* Update the layer tree and paint PaintedLayers. If this is not specified,
* we may still have to do it if the layer tree lost PaintedLayer contents
* we need for compositing. */
PAINT_LAYERS = 0x01,
/* Composite layers to the window. */
PAINT_COMPOSITE = 0x02,
/* Sync-decode images. */
PAINT_SYNC_DECODE_IMAGES = 0x04
};
virtual void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
uint32_t aFlags) = 0;
MOZ_CAN_RUN_SCRIPT
virtual nsresult HandleEvent(nsIFrame* aFrame,
mozilla::WidgetGUIEvent* aEvent,
@ -1318,28 +1246,18 @@ class nsIPresShell : public nsStubDocumentObserver {
nsEventStatus* aEventStatus) = 0;
virtual bool ShouldIgnoreInvalidation() = 0;
/**
* Notify that we're going to call Paint with PAINT_COMPOSITE.
* Notify that we're going to call Paint with PaintFlags::PaintComposite.
* Fires on the presshell for the painted widget.
* This is issued at a time when it's safe to modify widget geometry.
*/
virtual void WillPaintWindow() = 0;
/**
* Notify that we called Paint with PAINT_COMPOSITE.
* Notify that we called Paint with PaintFlags::PaintComposite.
* Fires on the presshell for the painted widget.
* This is issued at a time when it's safe to modify widget geometry.
*/
virtual void DidPaintWindow() = 0;
/**
* Ensures that the refresh driver is running, and schedules a view
* manager flush on the next tick.
*
* @param aType PAINT_DELAYED_COMPRESS : Schedule a paint to be executed after
* a delay, and put FrameLayerBuilder in 'compressed' mode that avoids short
* cut optimizations.
*/
enum PaintType { PAINT_DEFAULT, PAINT_DELAYED_COMPRESS };
virtual void ScheduleViewManagerFlush(PaintType aType = PAINT_DEFAULT) = 0;
virtual void ClearMouseCaptureOnView(nsView* aView) = 0;
virtual bool IsVisible() = 0;
MOZ_CAN_RUN_SCRIPT

Просмотреть файл

@ -6863,9 +6863,8 @@ static void SchedulePaintInternal(
}
pres->PresShell()->ScheduleViewManagerFlush(
aType == nsIFrame::PAINT_DELAYED_COMPRESS
? nsIPresShell::PAINT_DELAYED_COMPRESS
: nsIPresShell::PAINT_DEFAULT);
aType == nsIFrame::PAINT_DELAYED_COMPRESS ? PaintType::DelayedCompress
: PaintType::Default);
if (aType == nsIFrame::PAINT_DELAYED_COMPRESS) {
return;

Просмотреть файл

@ -6489,7 +6489,7 @@ void ScrollFrameHelper::RestoreState(PresState* aState) {
if (mIsRoot) {
mOuter->PresShell()->SetResolutionAndScaleTo(
aState->resolution(), nsIPresShell::ChangeOrigin::eMainThread);
aState->resolution(), ResolutionChangeOrigin::MainThread);
}
}

Просмотреть файл

@ -519,8 +519,9 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// happens after we've built the list so that
// AddCanvasBackgroundColorItem can monkey with the contents if
// necessary.
uint32_t flags =
nsIPresShell::FORCE_DRAW | nsIPresShell::ADD_FOR_SUBDOC;
AddCanvasBackgroundColorFlags flags =
AddCanvasBackgroundColorFlags::ForceDraw |
AddCanvasBackgroundColorFlags::AddForSubDocument;
presShell->AddCanvasBackgroundColorItem(
*aBuilder, childItems, frame, bounds, NS_RGBA(0, 0, 0, 0), flags);
}
@ -595,8 +596,9 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// Add the canvas background color to the bottom of the list. This
// happens after we've built the list so that AddCanvasBackgroundColorItem
// can monkey with the contents if necessary.
uint32_t flags =
nsIPresShell::FORCE_DRAW | nsIPresShell::APPEND_UNSCROLLED_ONLY;
AddCanvasBackgroundColorFlags flags =
AddCanvasBackgroundColorFlags::ForceDraw |
AddCanvasBackgroundColorFlags::AppendUnscrolledOnly;
presShell->AddCanvasBackgroundColorItem(*aBuilder, childItems, this, bounds,
NS_RGBA(0, 0, 0, 0), flags);
}

Просмотреть файл

@ -332,7 +332,7 @@ void nsViewManager::Refresh(nsView* aView,
printf_stderr("--COMPOSITE-- %p\n", mPresShell);
}
#endif
uint32_t paintFlags = nsIPresShell::PAINT_COMPOSITE;
PaintFlags paintFlags = PaintFlags::PaintComposite;
LayerManager* manager = widget->GetLayerManager();
if (!manager->NeedsWidgetInvalidation()) {
manager->FlushRendering();
@ -459,7 +459,7 @@ void nsViewManager::ProcessPendingUpdatesPaint(nsIWidget* aWidget) {
}
#endif
mPresShell->Paint(view, nsRegion(), nsIPresShell::PAINT_LAYERS);
mPresShell->Paint(view, nsRegion(), PaintFlags::PaintLayers);
view->SetForcedRepaint(false);
#ifdef MOZ_DUMP_PAINTING

Просмотреть файл

@ -159,10 +159,10 @@ class ThumbnailHelper final
nsPresContext::CSSPixelsToAppUnits(aPageRect.y),
nsPresContext::CSSPixelsToAppUnits(aPageRect.width),
nsPresContext::CSSPixelsToAppUnits(aPageRect.height));
const uint32_t renderDocFlags =
nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING |
nsIPresShell::RENDER_DOCUMENT_RELATIVE |
nsIPresShell::RENDER_DRAWWINDOW_NOT_FLUSHING;
const RenderDocumentFlags renderDocFlags =
RenderDocumentFlags::IgnoreViewportScrolling |
RenderDocumentFlags::DocumentRelative |
RenderDocumentFlags::DrawWindowNotFlushing;
const nscolor bgColor = NS_RGB(255, 255, 255);
if (NS_FAILED(presShell->RenderDocument(drawRect, renderDocFlags, bgColor,

Просмотреть файл

@ -620,7 +620,7 @@ nsresult nsBaseDragService::DrawDrag(nsINode* aDOMNode,
LayoutDeviceIntPoint pnt(aScreenDragRect->TopLeft());
*aSurface = presShell->RenderSelection(
mSelection, pnt, aScreenDragRect,
mImage ? 0 : nsIPresShell::RENDER_AUTO_SCALE);
mImage ? RenderImageFlags::None : RenderImageFlags::AutoScale);
return NS_OK;
}
@ -655,11 +655,12 @@ nsresult nsBaseDragService::DrawDrag(nsINode* aDOMNode,
if (!mDragPopup) {
// otherwise, just draw the node
uint32_t renderFlags = mImage ? 0 : nsIPresShell::RENDER_AUTO_SCALE;
if (renderFlags) {
RenderImageFlags renderFlags =
mImage ? RenderImageFlags::None : RenderImageFlags::AutoScale;
if (renderFlags != RenderImageFlags::None) {
// check if the dragged node itself is an img element
if (dragNode->NodeName().LowerCaseEqualsLiteral("img")) {
renderFlags = renderFlags | nsIPresShell::RENDER_IS_IMAGE;
renderFlags = renderFlags | RenderImageFlags::IsImage;
} else {
nsINodeList* childList = dragNode->ChildNodes();
uint32_t length = childList->Length();
@ -668,8 +669,9 @@ nsresult nsBaseDragService::DrawDrag(nsINode* aDOMNode,
for (uint32_t count = 0; count < length; ++count) {
if (childList->Item(count)->NodeName().LowerCaseEqualsLiteral(
"img")) {
// if the dragnode contains an image, set RENDER_IS_IMAGE flag
renderFlags = renderFlags | nsIPresShell::RENDER_IS_IMAGE;
// if the dragnode contains an image, set RenderImageFlags::IsImage
// flag
renderFlags = renderFlags | RenderImageFlags::IsImage;
break;
}
}