Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: third_party/WebKit/Source/core/frame/VisualViewport.cpp

Issue 2096783004: Seperate visualviewportchanged event into scroll and resize events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix crash + tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 85c73df4a0db2517f8a404a18985d24c889f91ff..e2df524c5b30e79aab837bc13b00b5901bc64831 100644
--- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp
+++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
@@ -96,13 +96,22 @@ void VisualViewport::updateStyleAndLayoutIgnorePendingStylesheets()
document->updateStyleAndLayoutIgnorePendingStylesheets();
}
-void VisualViewport::enqueueChangedEvent()
+void VisualViewport::enqueueScrollEvent()
{
if (!RuntimeEnabledFeatures::visualViewportAPIEnabled())
return;
if (Document* document = mainFrame()->document())
- document->enqueueVisualViewportChangedEvent();
+ document->enqueueVisualViewportScrollEvent();
+}
+
+void VisualViewport::enqueueResizeEvent()
+{
+ if (!RuntimeEnabledFeatures::visualViewportAPIEnabled())
+ return;
+
+ if (Document* document = mainFrame()->document())
+ document->enqueueVisualViewportResizeEvent();
}
void VisualViewport::setSize(const IntSize& size)
@@ -124,7 +133,7 @@ void VisualViewport::setSize(const IntSize& size)
if (!mainFrame())
return;
- enqueueChangedEvent();
+ enqueueResizeEvent();
bool autosizerNeedsUpdating = widthDidChange
&& mainFrame()->settings()
@@ -291,6 +300,7 @@ void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
m_scale = scale;
valuesChanged = true;
frameHost().chromeClient().pageScaleFactorChanged();
+ enqueueResizeEvent();
}
FloatPoint clampedOffset(clampOffsetToBoundaries(location));
@@ -308,6 +318,8 @@ void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
document->enqueueScrollEventForNode(document);
}
+ enqueueScrollEvent();
+
mainFrame()->loader().client()->didChangeScrollOffset();
valuesChanged = true;
}
@@ -315,8 +327,6 @@ void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
if (!valuesChanged)
return;
- enqueueChangedEvent();
-
InspectorInstrumentation::didUpdateLayout(mainFrame());
mainFrame()->loader().saveScrollState();
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.h ('k') | third_party/WebKit/Source/core/frame/VisualViewport.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698