Commit d2792372 authored by bokan's avatar bokan Committed by Commit bot

Check for main frame existence in VisualViewport::setScaleAndLocation.

I missed this null check in setScaleAndLocation. There's some edge cases, likely
during loading, where we might get here without a frame. Also, until we figure
out what to do with VisualViewport for OOPIF we could also have a null
mainFrame.

BUG=543945

Review URL: https://codereview.chromium.org/1431433005

Cr-Commit-Position: refs/heads/master@{#357146}
parent c0e1c5ba
...@@ -195,6 +195,9 @@ void VisualViewport::setScale(float scale) ...@@ -195,6 +195,9 @@ void VisualViewport::setScale(float scale)
void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location) void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location)
{ {
if (!mainFrame())
return;
bool valuesChanged = false; bool valuesChanged = false;
if (scale != m_scale) { if (scale != m_scale) {
...@@ -213,8 +216,8 @@ void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location ...@@ -213,8 +216,8 @@ void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
if (ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordinator()) if (ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordinator())
coordinator->scrollableAreaScrollLayerDidChange(this); coordinator->scrollableAreaScrollLayerDidChange(this);
Document* document = mainFrame()->document(); if (Document* document = mainFrame()->document())
document->enqueueScrollEventForNode(document); document->enqueueScrollEventForNode(document);
mainFrame()->loader().client()->didChangeScrollOffset(); mainFrame()->loader().client()->didChangeScrollOffset();
valuesChanged = true; valuesChanged = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment