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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 2842343002: Perform layout when viewport size is queried. (Closed)
Patch Set: Nit Created 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/viewport/read-viewport-size-in-iframe-causes-layout.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "core/page/Page.h" 76 #include "core/page/Page.h"
77 #include "core/page/WindowFeatures.h" 77 #include "core/page/WindowFeatures.h"
78 #include "core/page/scrolling/ScrollingCoordinator.h" 78 #include "core/page/scrolling/ScrollingCoordinator.h"
79 #include "core/probe/CoreProbes.h" 79 #include "core/probe/CoreProbes.h"
80 #include "core/timing/DOMWindowPerformance.h" 80 #include "core/timing/DOMWindowPerformance.h"
81 #include "core/timing/Performance.h" 81 #include "core/timing/Performance.h"
82 #include "platform/EventDispatchForbiddenScope.h" 82 #include "platform/EventDispatchForbiddenScope.h"
83 #include "platform/Histogram.h" 83 #include "platform/Histogram.h"
84 #include "platform/WebFrameScheduler.h" 84 #include "platform/WebFrameScheduler.h"
85 #include "platform/loader/fetch/ResourceFetcher.h" 85 #include "platform/loader/fetch/ResourceFetcher.h"
86 #include "platform/scroll/ScrollbarTheme.h"
86 #include "platform/weborigin/SecurityOrigin.h" 87 #include "platform/weborigin/SecurityOrigin.h"
87 #include "platform/weborigin/Suborigin.h" 88 #include "platform/weborigin/Suborigin.h"
88 #include "public/platform/Platform.h" 89 #include "public/platform/Platform.h"
89 #include "public/platform/WebScreenInfo.h" 90 #include "public/platform/WebScreenInfo.h"
90 #include "public/platform/site_engagement.mojom-blink.h" 91 #include "public/platform/site_engagement.mojom-blink.h"
91 92
92 #include <memory> 93 #include <memory>
93 94
94 namespace blink { 95 namespace blink {
95 96
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 return FloatSize(); 969 return FloatSize();
969 970
970 FrameView* view = GetFrame()->View(); 971 FrameView* view = GetFrame()->View();
971 if (!view) 972 if (!view)
972 return FloatSize(); 973 return FloatSize();
973 974
974 Page* page = GetFrame()->GetPage(); 975 Page* page = GetFrame()->GetPage();
975 if (!page) 976 if (!page)
976 return FloatSize(); 977 return FloatSize();
977 978
978 // The main frame's viewport size depends on the page scale. Since the 979 // The main frame's viewport size depends on the page scale. If viewport is
979 // initial page scale depends on the content width and is set after a 980 // enabled, the initial page scale depends on the content width and is set
980 // layout, perform one now so queries during page load will use the up to 981 // after a layout, perform one now so queries during page load will use the
981 // date viewport. 982 // up to date viewport.
982 if (page->GetSettings().GetViewportEnabled() && GetFrame()->IsMainFrame()) 983 bool affectedByScale =
984 page->GetSettings().GetViewportEnabled() && GetFrame()->IsMainFrame();
985 bool affectedByScrollbars =
986 scrollbar_inclusion == kExcludeScrollbars &&
987 !ScrollbarTheme::GetTheme().UsesOverlayScrollbars();
988
989 if (affectedByScale || affectedByScrollbars)
983 document()->UpdateStyleAndLayoutIgnorePendingStylesheets(); 990 document()->UpdateStyleAndLayoutIgnorePendingStylesheets();
984 991
985 // FIXME: This is potentially too much work. We really only need to know the 992 // FIXME: This is potentially too much work. We really only need to know the
986 // dimensions of the parent frame's layoutObject. 993 // dimensions of the parent frame's layoutObject.
987 if (Frame* parent = GetFrame()->Tree().Parent()) { 994 if (Frame* parent = GetFrame()->Tree().Parent()) {
988 if (parent && parent->IsLocalFrame()) 995 if (parent && parent->IsLocalFrame())
989 ToLocalFrame(parent) 996 ToLocalFrame(parent)
990 ->GetDocument() 997 ->GetDocument()
991 ->UpdateStyleAndLayoutIgnorePendingStylesheets(); 998 ->UpdateStyleAndLayoutIgnorePendingStylesheets();
992 } 999 }
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 DOMWindow::Trace(visitor); 1691 DOMWindow::Trace(visitor);
1685 Supplementable<LocalDOMWindow>::Trace(visitor); 1692 Supplementable<LocalDOMWindow>::Trace(visitor);
1686 } 1693 }
1687 1694
1688 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) { 1695 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) {
1689 visitor->TraceWrappers(custom_elements_); 1696 visitor->TraceWrappers(custom_elements_);
1690 DOMWindow::TraceWrappers(visitor); 1697 DOMWindow::TraceWrappers(visitor);
1691 } 1698 }
1692 1699
1693 } // namespace blink 1700 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/viewport/read-viewport-size-in-iframe-causes-layout.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698