| Index: third_party/WebKit/Source/core/frame/VisualViewport.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
|
| index 9ca8b0c5e8bce9d61b99c3eac47a54ddb4c05d35..0d8a2695dfab58ad024be4e2a1a5575eb37d8c8f 100644
|
| --- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
|
| @@ -85,6 +85,27 @@ DEFINE_TRACE(VisualViewport)
|
| ScrollableArea::trace(visitor);
|
| }
|
|
|
| +void VisualViewport::updateLayoutIgnorePendingStylesheets()
|
| +{
|
| + if (!mainFrame())
|
| + return;
|
| +
|
| + Document* document = mainFrame()->document();
|
| + if (!document)
|
| + return;
|
| +
|
| + document->updateLayoutIgnorePendingStylesheets();
|
| + return;
|
| +}
|
| +
|
| +void VisualViewport::dispatchChangedEvent()
|
| +{
|
| + if (RuntimeEnabledFeatures::visualViewportAPIEnabled()) {
|
| + if (Document* document = mainFrame()->document())
|
| + document->dispatchVisualViewportChangedEvent();
|
| + }
|
| +}
|
| +
|
| void VisualViewport::setSize(const IntSize& size)
|
| {
|
| if (m_size == size)
|
| @@ -104,6 +125,8 @@ void VisualViewport::setSize(const IntSize& size)
|
| if (!mainFrame())
|
| return;
|
|
|
| + dispatchChangedEvent();
|
| +
|
| bool autosizerNeedsUpdating = widthDidChange
|
| && mainFrame()->settings()
|
| && mainFrame()->settings()->textAutosizingEnabled();
|
| @@ -189,6 +212,55 @@ void VisualViewport::setScale(float scale)
|
| setScaleAndLocation(scale, m_offset);
|
| }
|
|
|
| +double VisualViewport::scrollLeft()
|
| +{
|
| + updateLayoutIgnorePendingStylesheets();
|
| +
|
| + return visibleRect().x();
|
| +}
|
| +
|
| +double VisualViewport::scrollTop()
|
| +{
|
| + updateLayoutIgnorePendingStylesheets();
|
| +
|
| + return visibleRect().y();
|
| +}
|
| +
|
| +void VisualViewport::setScrollLeft(double x)
|
| +{
|
| + updateLayoutIgnorePendingStylesheets();
|
| +
|
| + setLocation(FloatPoint(x, visibleRect().y()));
|
| +}
|
| +
|
| +void VisualViewport::setScrollTop(double y)
|
| +{
|
| + updateLayoutIgnorePendingStylesheets();
|
| +
|
| + setLocation(FloatPoint(visibleRect().x(), y));
|
| +}
|
| +
|
| +double VisualViewport::clientWidth()
|
| +{
|
| + updateLayoutIgnorePendingStylesheets();
|
| +
|
| + return visibleRect().width();
|
| +}
|
| +
|
| +double VisualViewport::clientHeight()
|
| +{
|
| + updateLayoutIgnorePendingStylesheets();
|
| +
|
| + return visibleRect().height();
|
| +}
|
| +
|
| +double VisualViewport::pageScale()
|
| +{
|
| + updateLayoutIgnorePendingStylesheets();
|
| +
|
| + return m_scale;
|
| +}
|
| +
|
| void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location)
|
| {
|
| if (!mainFrame())
|
| @@ -224,6 +296,8 @@ void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
|
| if (!valuesChanged)
|
| return;
|
|
|
| + dispatchChangedEvent();
|
| +
|
| InspectorInstrumentation::didUpdateLayout(mainFrame());
|
| mainFrame()->loader().saveScrollState();
|
|
|
|
|