Skip to content

Commit

Permalink
DrawingArea should use a smart pointer to point to WebPage
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=260332

Reviewed by Simon Fraser.

Use CheckedRef<WebPage> instead of WebPage&.

* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplay):
(WebKit::DrawingAreaCoordinatedGraphics::setNeedsDisplayInRect):
(WebKit::DrawingAreaCoordinatedGraphics::forceRepaint):
(WebKit::DrawingAreaCoordinatedGraphics::updatePreferences):
(WebKit::DrawingAreaCoordinatedGraphics::setDeviceScaleFactor):
(WebKit::DrawingAreaCoordinatedGraphics::registerScrollingTree):
(WebKit::DrawingAreaCoordinatedGraphics::unregisterScrollingTree):
(WebKit::DrawingAreaCoordinatedGraphics::activityStateDidChange):
(WebKit::DrawingAreaCoordinatedGraphics::updateGeometry):
(WebKit::DrawingAreaCoordinatedGraphics::adjustTransientZoom):
(WebKit::DrawingAreaCoordinatedGraphics::commitTransientZoom):
(WebKit::DrawingAreaCoordinatedGraphics::suspendPainting):
(WebKit::DrawingAreaCoordinatedGraphics::resumePainting):
(WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode):
(WebKit::DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode):
(WebKit::DrawingAreaCoordinatedGraphics::display):
(WebKit::DrawingAreaCoordinatedGraphics::forceUpdate):
* Source/WebKit/WebProcess/WebPage/DrawingArea.cpp:
(WebKit::DrawingArea::willStartRenderingUpdateDisplay):
(WebKit::DrawingArea::didCompleteRenderingUpdateDisplay):
(WebKit::DrawingArea::didCompleteRenderingFrame):
(WebKit::DrawingArea::mainFrameTiledBacking const):
(WebKit::DrawingArea::prepopulateRectForZoom):
(WebKit::DrawingArea::scaleViewToFitDocumentIfNeeded):
* Source/WebKit/WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::send):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
(WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
(WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView const):
(WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
(WebKit::RemoteLayerTreeDrawingArea::setDeviceScaleFactor):
(WebKit::RemoteLayerTreeDrawingArea::forceRepaint):
(WebKit::RemoteLayerTreeDrawingArea::setViewExposedRect):
(WebKit::RemoteLayerTreeDrawingArea::exposedContentRect const):
(WebKit::RemoteLayerTreeDrawingArea::setExposedContentRect):
(WebKit::RemoteLayerTreeDrawingArea::updateRendering):
(WebKit::RemoteLayerTreeDrawingArea::didCompleteRenderingUpdateDisplay):
(WebKit::RemoteLayerTreeDrawingArea::renderingUpdateFramesPerSecondChanged):
* Source/WebKit/WebProcess/WebPage/mac/RemoteLayerTreeDrawingAreaMac.mm:
(WebKit::RemoteLayerTreeDrawingAreaMac::applyTransientZoomToPage):
(WebKit::RemoteLayerTreeDrawingAreaMac::adjustTransientZoom):
(WebKit::RemoteLayerTreeDrawingAreaMac::commitTransientZoom):
(WebKit::RemoteLayerTreeDrawingAreaMac::willCommitLayerTree):
* Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::registerScrollingTree):
(WebKit::TiledCoreAnimationDrawingArea::unregisterScrollingTree):
(WebKit::TiledCoreAnimationDrawingArea::forceRepaint):
(WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync):
(WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
(WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):
(WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones):
(WebKit::TiledCoreAnimationDrawingArea::addCommitHandlers):
(WebKit::TiledCoreAnimationDrawingArea::updateRendering):
(WebKit::TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacks):
(WebKit::TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacksIfNeeded):
(WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
(WebKit::TiledCoreAnimationDrawingArea::setViewExposedRect):
(WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
(WebKit::TiledCoreAnimationDrawingArea::setDeviceScaleFactor):
(WebKit::TiledCoreAnimationDrawingArea::updateLayerHostingContext):
(WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
(WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView const):
(WebKit::TiledCoreAnimationDrawingArea::layerForTransientZoom const):
(WebKit::TiledCoreAnimationDrawingArea::shadowLayerForTransientZoom const):
(WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToLayers):
(WebKit::TiledCoreAnimationDrawingArea::adjustTransientZoom):
(WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom):
(WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):

Canonical link: https://commits.webkit.org/267261@main
  • Loading branch information
rniwa committed Aug 25, 2023
1 parent 4045ef1 commit 7d2d82a
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void DrawingAreaCoordinatedGraphics::setNeedsDisplay()
return;
}

setNeedsDisplayInRect(m_webPage.bounds());
setNeedsDisplayInRect(m_webPage->bounds());
}

void DrawingAreaCoordinatedGraphics::setNeedsDisplayInRect(const IntRect& rect)
Expand All @@ -100,7 +100,7 @@ void DrawingAreaCoordinatedGraphics::setNeedsDisplayInRect(const IntRect& rect)
}

IntRect dirtyRect = rect;
dirtyRect.intersect(m_webPage.bounds());
dirtyRect.intersect(m_webPage->bounds());
if (dirtyRect.isEmpty())
return;

Expand Down Expand Up @@ -172,7 +172,7 @@ void DrawingAreaCoordinatedGraphics::forceRepaint()

if (!m_layerTreeHost) {
m_isWaitingForDidUpdate = false;
m_dirtyRegion = m_webPage.bounds();
m_dirtyRegion = m_webPage->bounds();
display();
return;
}
Expand All @@ -181,7 +181,7 @@ void DrawingAreaCoordinatedGraphics::forceRepaint()
return;

setNeedsDisplay();
m_webPage.layoutIfNeeded();
Ref { m_webPage.get() }->layoutIfNeeded();
if (!m_layerTreeHost)
return;

Expand Down Expand Up @@ -233,7 +233,7 @@ void DrawingAreaCoordinatedGraphics::setLayerTreeStateIsFrozen(bool isFrozen)

void DrawingAreaCoordinatedGraphics::updatePreferences(const WebPreferencesStore& store)
{
Settings& settings = m_webPage.corePage()->settings();
Settings& settings = m_webPage->corePage()->settings();
#if PLATFORM(WAYLAND)
if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland
&& &PlatformDisplay::sharedDisplayForCompositing() == &PlatformDisplay::sharedDisplay()) {
Expand Down Expand Up @@ -293,7 +293,7 @@ void DrawingAreaCoordinatedGraphics::didChangeViewportAttributes(ViewportAttribu

void DrawingAreaCoordinatedGraphics::setDeviceScaleFactor(float deviceScaleFactor)
{
m_webPage.setDeviceScaleFactor(deviceScaleFactor);
Ref { m_webPage.get() }->setDeviceScaleFactor(deviceScaleFactor);
}

bool DrawingAreaCoordinatedGraphics::supportsAsyncScrolling() const
Expand Down Expand Up @@ -388,7 +388,7 @@ RefPtr<DisplayRefreshMonitor> DrawingAreaCoordinatedGraphics::createDisplayRefre
void DrawingAreaCoordinatedGraphics::activityStateDidChange(OptionSet<ActivityState> changed, ActivityStateChangeID, CompletionHandler<void()>&& completionHandler)
{
if (changed & ActivityState::IsVisible) {
if (m_webPage.isVisible())
if (m_webPage->isVisible())
resumePainting();
else
suspendPainting();
Expand All @@ -407,18 +407,19 @@ void DrawingAreaCoordinatedGraphics::attachViewOverlayGraphicsLayer(WebCore::Fra
void DrawingAreaCoordinatedGraphics::updateGeometry(const IntSize& size, CompletionHandler<void()>&& completionHandler)
{
SetForScope inUpdateGeometry(m_inUpdateGeometry, true);
m_webPage.setSize(size);
m_webPage.layoutIfNeeded();
Ref webPage = m_webPage.get();
webPage->setSize(size);
webPage->layoutIfNeeded();

if (!m_layerTreeHost)
m_dirtyRegion = IntRect(IntPoint(), size);

LayerTreeContext previousLayerTreeContext;
if (m_layerTreeHost) {
previousLayerTreeContext = m_layerTreeHost->layerTreeContext();
m_layerTreeHost->sizeDidChange(m_webPage.size());
m_layerTreeHost->sizeDidChange(webPage->size());
} else if (m_previousLayerTreeHost)
m_previousLayerTreeHost->sizeDidChange(m_webPage.size());
m_previousLayerTreeHost->sizeDidChange(m_webPage->size());

if (m_layerTreeHost) {
auto layerTreeContext = m_layerTreeHost->layerTreeContext();
Expand All @@ -427,8 +428,8 @@ void DrawingAreaCoordinatedGraphics::updateGeometry(const IntSize& size, Complet
send(Messages::DrawingAreaProxy::UpdateAcceleratedCompositingMode(0, layerTreeContext));
} else {
UpdateInfo updateInfo;
updateInfo.viewSize = m_webPage.size();
updateInfo.deviceScaleFactor = m_webPage.corePage()->deviceScaleFactor();
updateInfo.viewSize = webPage->size();
updateInfo.deviceScaleFactor = webPage->corePage()->deviceScaleFactor();
display(updateInfo);
if (!m_layerTreeHost)
send(Messages::DrawingAreaProxy::Update(0, WTFMove(updateInfo)));
Expand Down Expand Up @@ -467,7 +468,7 @@ void DrawingAreaCoordinatedGraphics::displayDidRefresh()
void DrawingAreaCoordinatedGraphics::adjustTransientZoom(double scale, FloatPoint origin)
{
if (!m_transientZoom) {
auto* frameView = m_webPage.localMainFrameView();
RefPtr frameView = m_webPage->localMainFrameView();
if (!frameView)
return;

Expand All @@ -487,7 +488,8 @@ void DrawingAreaCoordinatedGraphics::adjustTransientZoom(double scale, FloatPoin
FloatPoint unscrolledOrigin(origin);
unscrolledOrigin.moveBy(-m_transientZoomInitialOrigin);

m_webPage.scalePage(scale / m_webPage.viewScaleFactor(), roundedIntPoint(-unscrolledOrigin));
Ref webPage = m_webPage.get();
webPage->scalePage(scale / webPage->viewScaleFactor(), roundedIntPoint(-unscrolledOrigin));
}

void DrawingAreaCoordinatedGraphics::commitTransientZoom(double scale, FloatPoint origin)
Expand All @@ -498,7 +500,8 @@ void DrawingAreaCoordinatedGraphics::commitTransientZoom(double scale, FloatPoin
FloatPoint unscrolledOrigin(origin);
unscrolledOrigin.moveBy(-m_transientZoomInitialOrigin);

m_webPage.scalePage(scale / m_webPage.viewScaleFactor(), roundedIntPoint(-unscrolledOrigin));
Ref webPage = m_webPage.get();
webPage->scalePage(scale / webPage->viewScaleFactor(), roundedIntPoint(-unscrolledOrigin));

m_transientZoom = false;
}
Expand Down Expand Up @@ -534,7 +537,7 @@ void DrawingAreaCoordinatedGraphics::suspendPainting()

m_isPaintingSuspended = true;

m_webPage.corePage()->suspendScriptedAnimations();
m_webPage->corePage()->suspendScriptedAnimations();
}

void DrawingAreaCoordinatedGraphics::resumePainting()
Expand All @@ -553,14 +556,14 @@ void DrawingAreaCoordinatedGraphics::resumePainting()
// FIXME: We shouldn't always repaint everything here.
setNeedsDisplay();

m_webPage.corePage()->resumeScriptedAnimations();
m_webPage->corePage()->resumeScriptedAnimations();
}

void DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer)
{
#if PLATFORM(GTK)
if (!m_alwaysUseCompositing) {
m_webPage.corePage()->settings().setForceCompositingMode(true);
m_webPage->corePage()->settings().setForceCompositingMode(true);
m_alwaysUseCompositing = true;
}
#endif
Expand All @@ -572,7 +575,7 @@ void DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode(GraphicsLay
auto changeWindowScreen = [&] {
// In order to ensure that we get a unique DisplayRefreshMonitor per-DrawingArea (necessary because ThreadedDisplayRefreshMonitor
// is driven by the ThreadedCompositor of the drawing area), give each page a unique DisplayID derived from DrawingArea's unique ID.
m_webPage.windowScreenDidChange(m_layerTreeHost->displayID(), std::nullopt);
Ref { m_webPage.get() }->windowScreenDidChange(m_layerTreeHost->displayID(), std::nullopt);
};

ASSERT(!m_layerTreeHost);
Expand Down Expand Up @@ -647,17 +650,18 @@ void DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode()
m_discardPreviousLayerTreeHostTimer.startOneShot(5_s);

// Always use the primary display ID (0) when not in accelerated compositing mode.
m_webPage.windowScreenDidChange(0, std::nullopt);
Ref webPage = m_webPage.get();
webPage->windowScreenDidChange(0, std::nullopt);

m_dirtyRegion = m_webPage.bounds();
m_dirtyRegion = webPage->bounds();

if (m_inUpdateGeometry)
return;

UpdateInfo updateInfo;
if (m_isPaintingSuspended) {
updateInfo.viewSize = m_webPage.size();
updateInfo.deviceScaleFactor = m_webPage.corePage()->deviceScaleFactor();
updateInfo.viewSize = webPage->size();
updateInfo.deviceScaleFactor = webPage->corePage()->deviceScaleFactor();
} else
display(updateInfo);

Expand Down Expand Up @@ -755,9 +759,10 @@ void DrawingAreaCoordinatedGraphics::display(UpdateInfo& updateInfo)
ASSERT(!m_isPaintingSuspended || m_inUpdateGeometry);
ASSERT(!m_layerTreeHost);

m_webPage.updateRendering();
m_webPage.finalizeRenderingUpdate({ });
m_webPage.flushPendingEditorStateUpdate();
Ref webPage = m_webPage.get();
webPage->updateRendering();
webPage->finalizeRenderingUpdate({ });
webPage->flushPendingEditorStateUpdate();

// The layout may have put the page into accelerated compositing mode. If the LayerTreeHost is
// in charge of displaying, we have nothing more to do.
Expand All @@ -767,14 +772,14 @@ void DrawingAreaCoordinatedGraphics::display(UpdateInfo& updateInfo)
if (m_dirtyRegion.isEmpty())
return;

updateInfo.viewSize = m_webPage.size();
updateInfo.deviceScaleFactor = m_webPage.corePage()->deviceScaleFactor();
updateInfo.viewSize = webPage->size();
updateInfo.deviceScaleFactor = webPage->corePage()->deviceScaleFactor();

IntRect bounds = m_dirtyRegion.bounds();
ASSERT(m_webPage.bounds().contains(bounds));
ASSERT(webPage->bounds().contains(bounds));

IntSize bitmapSize = bounds.size();
float deviceScaleFactor = m_webPage.corePage()->deviceScaleFactor();
float deviceScaleFactor = webPage->corePage()->deviceScaleFactor();
bitmapSize.scale(deviceScaleFactor);
auto bitmap = ShareableBitmap::create({ bitmapSize });
if (!bitmap)
Expand Down Expand Up @@ -808,11 +813,11 @@ void DrawingAreaCoordinatedGraphics::display(UpdateInfo& updateInfo)

for (const auto& rect : rects) {
if (graphicsContext)
m_webPage.drawRect(*graphicsContext, rect);
webPage->drawRect(*graphicsContext, rect);
updateInfo.updateRects.append(rect);
}

m_webPage.didUpdateRendering();
webPage->didUpdateRendering();

// Layout can trigger more calls to setNeedsDisplay and we don't want to process them
// until the UI process has painted the update, so we stop the timer here.
Expand All @@ -824,7 +829,7 @@ void DrawingAreaCoordinatedGraphics::forceUpdate()
if (m_isWaitingForDidUpdate || m_layerTreeHost)
return;

m_dirtyRegion = m_webPage.bounds();
m_dirtyRegion = m_webPage->bounds();
display();
}

Expand Down
50 changes: 26 additions & 24 deletions Source/WebKit/WebProcess/WebPage/DrawingArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,17 @@ RefPtr<WebCore::DisplayRefreshMonitor> DrawingArea::createDisplayRefreshMonitor(

void DrawingArea::willStartRenderingUpdateDisplay()
{
m_webPage.willStartRenderingUpdateDisplay();
Ref { m_webPage.get() }->willStartRenderingUpdateDisplay();
}

void DrawingArea::didCompleteRenderingUpdateDisplay()
{
m_webPage.didCompleteRenderingUpdateDisplay();
Ref { m_webPage.get() }->didCompleteRenderingUpdateDisplay();
}

void DrawingArea::didCompleteRenderingFrame()
{
m_webPage.didCompleteRenderingFrame();
Ref { m_webPage.get() }->didCompleteRenderingFrame();
}

bool DrawingArea::supportsGPUProcessRendering(DrawingAreaType type)
Expand Down Expand Up @@ -161,14 +161,15 @@ bool DrawingArea::supportsGPUProcessRendering(DrawingAreaType type)

WebCore::TiledBacking* DrawingArea::mainFrameTiledBacking() const
{
auto* frameView = m_webPage.localMainFrameView();
RefPtr frameView = m_webPage->localMainFrameView();
return frameView ? frameView->tiledBacking() : nullptr;
}

void DrawingArea::prepopulateRectForZoom(double scale, WebCore::FloatPoint origin)
{
double currentPageScale = m_webPage.totalScaleFactor();
auto* frameView = m_webPage.localMainFrameView();
Ref webPage = m_webPage.get();
double currentPageScale = webPage->totalScaleFactor();
auto* frameView = webPage->localMainFrameView();
if (!frameView)
return;

Expand All @@ -189,13 +190,14 @@ void DrawingArea::scaleViewToFitDocumentIfNeeded()
return;

LOG(Resize, "DrawingArea %p scaleViewToFitDocumentIfNeeded", this);
m_webPage.layoutIfNeeded();
Ref webPage = m_webPage.get();
webPage->layoutIfNeeded();

if (!m_webPage.localMainFrameView() || !m_webPage.localMainFrameView()->renderView())
if (!webPage->localMainFrameView() || !webPage->localMainFrameView()->renderView())
return;

int viewWidth = m_webPage.size().width();
int documentWidth = m_webPage.localMainFrameView()->renderView()->unscaledDocumentRect().width();
int viewWidth = webPage->size().width();
int documentWidth = webPage->localMainFrameView()->renderView()->unscaledDocumentRect().width();

bool documentWidthChanged = m_lastDocumentSizeForScaleToFit.width() != documentWidth;
bool viewWidthChanged = m_lastViewSizeForScaleToFit.width() != viewWidth;
Expand All @@ -213,21 +215,21 @@ void DrawingArea::scaleViewToFitDocumentIfNeeded()
// Update the viewScale without doing an extra layout to re-determine the document width.
if (m_isScalingViewToFitDocument) {
if (!documentWidthChanged) {
m_lastViewSizeForScaleToFit = m_webPage.size();
m_lastViewSizeForScaleToFit = webPage->size();
float viewScale = (float)viewWidth / (float)m_lastDocumentSizeForScaleToFit.width();
if (viewScale < minimumViewScale) {
viewScale = minimumViewScale;
documentWidth = std::ceil(viewWidth / viewScale);
}
IntSize fixedLayoutSize(documentWidth, std::ceil((m_webPage.size().height() - m_webPage.corePage()->topContentInset()) / viewScale));
m_webPage.setFixedLayoutSize(fixedLayoutSize);
m_webPage.scaleView(viewScale);
IntSize fixedLayoutSize(documentWidth, std::ceil((webPage->size().height() - webPage->corePage()->topContentInset()) / viewScale));
webPage->setFixedLayoutSize(fixedLayoutSize);
webPage->scaleView(viewScale);

LOG(Resize, " using fixed layout at %dx%d. document width %d unchanged, scaled to %.4f to fit view width %d", fixedLayoutSize.width(), fixedLayoutSize.height(), documentWidth, viewScale, viewWidth);
return;
}

IntSize fixedLayoutSize = m_webPage.fixedLayoutSize();
IntSize fixedLayoutSize = webPage->fixedLayoutSize();
if (documentWidth > fixedLayoutSize.width()) {
LOG(Resize, " page laid out wider than fixed layout width. Not attempting to re-scale");
return;
Expand All @@ -237,14 +239,14 @@ void DrawingArea::scaleViewToFitDocumentIfNeeded()
LOG(Resize, " doing unconstrained layout");

// Lay out at the view size.
m_webPage.setUseFixedLayout(false);
m_webPage.layoutIfNeeded();
webPage->setUseFixedLayout(false);
webPage->layoutIfNeeded();

if (!m_webPage.localMainFrameView() || !m_webPage.localMainFrameView()->renderView())
if (!webPage->localMainFrameView() || !webPage->localMainFrameView()->renderView())
return;

IntSize documentSize = m_webPage.localMainFrameView()->renderView()->unscaledDocumentRect().size();
m_lastViewSizeForScaleToFit = m_webPage.size();
IntSize documentSize = webPage->localMainFrameView()->renderView()->unscaledDocumentRect().size();
m_lastViewSizeForScaleToFit = webPage->size();
m_lastDocumentSizeForScaleToFit = documentSize;

documentWidth = documentSize.width();
Expand All @@ -258,19 +260,19 @@ void DrawingArea::scaleViewToFitDocumentIfNeeded()
if (documentWidth && documentWidth < maximumDocumentWidthForScaling && viewWidth < documentWidth) {
// If the document doesn't fit in the view, scale it down but lay out at the view size.
m_isScalingViewToFitDocument = true;
m_webPage.setUseFixedLayout(true);
webPage->setUseFixedLayout(true);
viewScale = (float)viewWidth / (float)documentWidth;
if (viewScale < minimumViewScale) {
viewScale = minimumViewScale;
documentWidth = std::ceil(viewWidth / viewScale);
}
IntSize fixedLayoutSize(documentWidth, std::ceil((m_webPage.size().height() - m_webPage.corePage()->topContentInset()) / viewScale));
m_webPage.setFixedLayoutSize(fixedLayoutSize);
IntSize fixedLayoutSize(documentWidth, std::ceil((webPage->size().height() - webPage->corePage()->topContentInset()) / viewScale));
webPage->setFixedLayoutSize(fixedLayoutSize);

LOG(Resize, " using fixed layout at %dx%d. document width %d, scaled to %.4f to fit view width %d", fixedLayoutSize.width(), fixedLayoutSize.height(), documentWidth, viewScale, viewWidth);
}

m_webPage.scaleView(viewScale);
webPage->scaleView(viewScale);
}

void DrawingArea::setShouldScaleViewToFitDocument(bool shouldScaleView)
Expand Down
5 changes: 3 additions & 2 deletions Source/WebKit/WebProcess/WebPage/DrawingArea.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,13 @@ class DrawingArea : public IPC::MessageReceiver, public WebCore::DisplayRefreshM

template<typename T> bool send(T&& message)
{
return m_webPage.send(WTFMove(message), m_identifier.toUInt64(), { });
Ref webPage = m_webPage.get();
return webPage->send(WTFMove(message), m_identifier.toUInt64(), { });
}

const DrawingAreaType m_type;
DrawingAreaIdentifier m_identifier;
WebPage& m_webPage;
CheckedRef<WebPage> m_webPage;
WebCore::IntSize m_lastViewSizeForScaleToFit;
WebCore::IntSize m_lastDocumentSizeForScaleToFit;
bool m_isScalingViewToFitDocument { false };
Expand Down
Loading

0 comments on commit 7d2d82a

Please sign in to comment.