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

Unified Diff: Source/core/page/FrameView.cpp

Issue 14766010: Clarify the size of a document view (a.k.a layout size) that causes FrameView to emit the resize ev… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: patch for review Created 7 years, 7 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: Source/core/page/FrameView.cpp
diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp
index ba2e4e7c21899666a3bf348d98f73748a536113e..cbbbfa367e5919cb998ee982b3f504bbbeddd6c0 100644
--- a/Source/core/page/FrameView.cpp
+++ b/Source/core/page/FrameView.cpp
@@ -131,6 +131,14 @@ static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLay
return flags;
}
+// The spec DOM Level 2 Events states that the resize event occurs when document view size (a.k.a layout size) is changed. Refer to http://www.w3.org/TR/DOM-Level-2-Events/events.html
+// However, showing/hiding scrollbars shouldn't be considered a layout size change. Refer to webkit.org/b/80242
+// viewportSize() is used to compare layout sizes between before and after to emit a resize event.
+static inline IntSize viewportSize(const FrameView* view)
aelias_OOO_until_Jul13 2013/05/29 18:47:28 I suggest not having this static method and just c
+{
+ return view->layoutSize(ScrollView::IncludeScrollbars);
+}
+
Pagination::Mode paginationModeForRenderStyle(RenderStyle* style)
{
EOverflow overflow = style->overflowY();
@@ -986,7 +994,7 @@ void FrameView::layout(bool allowSubtree)
m_firstLayout = false;
m_firstLayoutCallbackPending = true;
- m_lastViewportSize = visibleContentRect(IncludeScrollbars).size();
+ m_lastViewportSize = viewportSize(this);
m_lastZoomFactor = root->style()->zoom();
// Set the initial vMode to AlwaysOn if we're auto.
@@ -2286,8 +2294,7 @@ void FrameView::performPostLayoutTasks()
// Refetch render view since it can be destroyed by updateWidget() call above.
renderView = this->renderView();
if (renderView && !renderView->printing()) {
- IntSize currentSize;
- currentSize = visibleContentRect(IncludeScrollbars).size();
+ IntSize currentSize = viewportSize(this);
float currentZoomFactor = renderView->style()->zoom();
bool resized = !m_firstLayout && (currentSize != m_lastViewportSize || currentZoomFactor != m_lastZoomFactor);
m_lastViewportSize = currentSize;

Powered by Google App Engine
This is Rietveld 408576698