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

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 132913002: Harden the machinery around updateWidgetPositions() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add FIXME Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/rendering/RenderLayerScrollableArea.cpp » ('j') | 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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "core/rendering/LayoutIndicator.h" 58 #include "core/rendering/LayoutIndicator.h"
59 #include "core/rendering/RenderCounter.h" 59 #include "core/rendering/RenderCounter.h"
60 #include "core/rendering/RenderEmbeddedObject.h" 60 #include "core/rendering/RenderEmbeddedObject.h"
61 #include "core/rendering/RenderLayer.h" 61 #include "core/rendering/RenderLayer.h"
62 #include "core/rendering/RenderLayerCompositor.h" 62 #include "core/rendering/RenderLayerCompositor.h"
63 #include "core/rendering/RenderPart.h" 63 #include "core/rendering/RenderPart.h"
64 #include "core/rendering/RenderScrollbar.h" 64 #include "core/rendering/RenderScrollbar.h"
65 #include "core/rendering/RenderScrollbarPart.h" 65 #include "core/rendering/RenderScrollbarPart.h"
66 #include "core/rendering/RenderTheme.h" 66 #include "core/rendering/RenderTheme.h"
67 #include "core/rendering/RenderView.h" 67 #include "core/rendering/RenderView.h"
68 #include "core/rendering/RenderWidget.h"
68 #include "core/rendering/TextAutosizer.h" 69 #include "core/rendering/TextAutosizer.h"
69 #include "core/rendering/style/RenderStyle.h" 70 #include "core/rendering/style/RenderStyle.h"
70 #include "core/rendering/svg/RenderSVGRoot.h" 71 #include "core/rendering/svg/RenderSVGRoot.h"
71 #include "core/svg/SVGDocument.h" 72 #include "core/svg/SVGDocument.h"
72 #include "core/svg/SVGSVGElement.h" 73 #include "core/svg/SVGSVGElement.h"
73 #include "platform/TraceEvent.h" 74 #include "platform/TraceEvent.h"
74 #include "platform/fonts/FontCache.h" 75 #include "platform/fonts/FontCache.h"
75 #include "platform/geometry/FloatRect.h" 76 #include "platform/geometry/FloatRect.h"
76 #include "platform/graphics/GraphicsContext.h" 77 #include "platform/graphics/GraphicsContext.h"
77 #include "platform/graphics/GraphicsLayerDebugInfo.h" 78 #include "platform/graphics/GraphicsLayerDebugInfo.h"
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 void FrameView::scheduleOrPerformPostLayoutTasks() 946 void FrameView::scheduleOrPerformPostLayoutTasks()
946 { 947 {
947 if (m_postLayoutTasksTimer.isActive()) 948 if (m_postLayoutTasksTimer.isActive())
948 return; 949 return;
949 950
950 // Partial layouts should not happen with synchronous post layouts. 951 // Partial layouts should not happen with synchronous post layouts.
951 ASSERT(!(m_inSynchronousPostLayout && partialLayout().isStopping())); 952 ASSERT(!(m_inSynchronousPostLayout && partialLayout().isStopping()));
952 953
953 if (!m_inSynchronousPostLayout) { 954 if (!m_inSynchronousPostLayout) {
954 if (frame().document()->shouldDisplaySeamlesslyWithParent()) { 955 if (frame().document()->shouldDisplaySeamlesslyWithParent()) {
955 if (RenderView* renderView = this->renderView()) 956 updateWidgetPositions();
956 renderView->updateWidgetPositions();
957 } else { 957 } else {
958 m_inSynchronousPostLayout = true; 958 m_inSynchronousPostLayout = true;
959 // Calls resumeScheduledEvents() 959 // Calls resumeScheduledEvents()
960 performPostLayoutTasks(); 960 performPostLayoutTasks();
961 m_inSynchronousPostLayout = false; 961 m_inSynchronousPostLayout = false;
962 } 962 }
963 } 963 }
964 964
965 if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousP ostLayout || frame().document()->shouldDisplaySeamlesslyWithParent())) { 965 if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousP ostLayout || frame().document()->shouldDisplaySeamlesslyWithParent())) {
966 // If we need layout or are already in a synchronous call to postLayoutT asks(), 966 // If we need layout or are already in a synchronous call to postLayoutT asks(),
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 if (!firstChild || !firstChild->isBox()) 1256 if (!firstChild || !firstChild->isBox())
1257 return 0; 1257 return 0;
1258 1258
1259 // Curently only embedded SVG documents participate in the size-negotiation logic. 1259 // Curently only embedded SVG documents participate in the size-negotiation logic.
1260 if (firstChild->isSVGRoot()) 1260 if (firstChild->isSVGRoot())
1261 return toRenderBox(firstChild); 1261 return toRenderBox(firstChild);
1262 1262
1263 return 0; 1263 return 0;
1264 } 1264 }
1265 1265
1266
1267 void FrameView::addWidget(RenderWidget* object)
1268 {
1269 m_widgets.add(object);
1270 }
1271
1272 void FrameView::removeWidget(RenderWidget* object)
1273 {
1274 m_widgets.remove(object);
1275 }
1276
1277 void FrameView::updateWidgetPositions()
1278 {
1279 Vector<RefPtr<RenderWidget> > widgets;
1280 copyToVector(m_widgets, widgets);
1281
1282 // Script or plugins could detach the frame so abort processing if that happ ens.
1283
1284 for (size_t i = 0; i < widgets.size() && renderView(); ++i)
1285 widgets[i]->updateWidgetPosition();
1286
1287 for (size_t i = 0; i < widgets.size() && renderView(); ++i)
1288 widgets[i]->widgetPositionsUpdated();
1289 }
1290
1266 void FrameView::addWidgetToUpdate(RenderEmbeddedObject& object) 1291 void FrameView::addWidgetToUpdate(RenderEmbeddedObject& object)
1267 { 1292 {
1268 // Tell the DOM element that it needs a widget update. 1293 // Tell the DOM element that it needs a widget update.
1269 Node* node = object.node(); 1294 Node* node = object.node();
1270 if (node->hasTagName(objectTag) || node->hasTagName(embedTag)) 1295 if (node->hasTagName(objectTag) || node->hasTagName(embedTag))
1271 toHTMLPlugInElement(node)->setNeedsWidgetUpdate(true); 1296 toHTMLPlugInElement(node)->setNeedsWidgetUpdate(true);
1272 1297
1273 m_widgetUpdateSet.add(&object); 1298 m_widgetUpdateSet.add(&object);
1274 } 1299 }
1275 1300
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 } 1752 }
1728 1753
1729 if (m_frame->document() && m_frame->document()->renderer()) { 1754 if (m_frame->document() && m_frame->document()->renderer()) {
1730 ResourceLoadPriorityOptimizer modifier; 1755 ResourceLoadPriorityOptimizer modifier;
1731 m_frame->document()->renderer()->didScroll(modifier); 1756 m_frame->document()->renderer()->didScroll(modifier);
1732 } 1757 }
1733 } 1758 }
1734 1759
1735 void FrameView::repaintFixedElementsAfterScrolling() 1760 void FrameView::repaintFixedElementsAfterScrolling()
1736 { 1761 {
1762 RefPtr<FrameView> protect(this);
1737 // For fixed position elements, update widget positions and compositing laye rs after scrolling, 1763 // For fixed position elements, update widget positions and compositing laye rs after scrolling,
1738 // but only if we're not inside of layout. 1764 // but only if we're not inside of layout.
1739 if (!m_nestedLayoutCount && hasViewportConstrainedObjects()) { 1765 if (!m_nestedLayoutCount && hasViewportConstrainedObjects()) {
1740 if (RenderView* renderView = this->renderView()) { 1766 updateWidgetPositions();
1741 renderView->updateWidgetPositions(); 1767 if (RenderView* renderView = this->renderView())
1742 renderView->layer()->updateLayerPositionsAfterDocumentScroll(); 1768 renderView->layer()->updateLayerPositionsAfterDocumentScroll();
1743 }
1744 } 1769 }
1745 } 1770 }
1746 1771
1747 void FrameView::updateFixedElementsAfterScrolling() 1772 void FrameView::updateFixedElementsAfterScrolling()
1748 { 1773 {
1749 if (m_nestedLayoutCount <= 1 && hasViewportConstrainedObjects()) { 1774 if (m_nestedLayoutCount <= 1 && hasViewportConstrainedObjects()) {
1750 if (RenderView* renderView = this->renderView()) 1775 if (RenderView* renderView = this->renderView())
1751 renderView->compositor()->setNeedsCompositingUpdate(CompositingUpdat eOnScroll); 1776 renderView->compositor()->setNeedsCompositingUpdate(CompositingUpdat eOnScroll);
1752 } 1777 }
1753 } 1778 }
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
2293 if (m_isVisuallyNonEmpty && !m_frame->document()->didLayoutWithPendingSt ylesheets() && m_firstVisuallyNonEmptyLayoutCallbackPending) { 2318 if (m_isVisuallyNonEmpty && !m_frame->document()->didLayoutWithPendingSt ylesheets() && m_firstVisuallyNonEmptyLayoutCallbackPending) {
2294 m_firstVisuallyNonEmptyLayoutCallbackPending = false; 2319 m_firstVisuallyNonEmptyLayoutCallbackPending = false;
2295 // FIXME: This callback is probably not needed, but is currently use d 2320 // FIXME: This callback is probably not needed, but is currently use d
2296 // by android for setting the background color. 2321 // by android for setting the background color.
2297 m_frame->loader().client()->dispatchDidFirstVisuallyNonEmptyLayout() ; 2322 m_frame->loader().client()->dispatchDidFirstVisuallyNonEmptyLayout() ;
2298 } 2323 }
2299 } 2324 }
2300 2325
2301 FontFaceSet::didLayout(m_frame->document()); 2326 FontFaceSet::didLayout(m_frame->document());
2302 2327
2303 RenderView* renderView = this->renderView(); 2328 updateWidgetPositions();
2304 if (renderView) 2329
2305 renderView->updateWidgetPositions(); 2330 // Plugins could have torn down the page inside updateWidgetPositions().
2331 if (!renderView())
2332 return;
2306 2333
2307 if (!m_updateWidgetsTimer.isActive()) 2334 if (!m_updateWidgetsTimer.isActive())
2308 m_updateWidgetsTimer.startOneShot(0); 2335 m_updateWidgetsTimer.startOneShot(0);
2309 2336
2310 if (Page* page = m_frame->page()) { 2337 if (Page* page = m_frame->page()) {
2311 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) 2338 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor())
2312 scrollingCoordinator->notifyLayoutUpdated(); 2339 scrollingCoordinator->notifyLayoutUpdated();
2313 } 2340 }
2314 2341
2315 scrollToAnchor(); 2342 scrollToAnchor();
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
3510 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3537 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3511 { 3538 {
3512 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3539 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3513 if (AXObjectCache* cache = axObjectCache()) { 3540 if (AXObjectCache* cache = axObjectCache()) {
3514 cache->remove(scrollbar); 3541 cache->remove(scrollbar);
3515 cache->handleScrollbarUpdate(this); 3542 cache->handleScrollbarUpdate(this);
3516 } 3543 }
3517 } 3544 }
3518 3545
3519 } // namespace WebCore 3546 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/rendering/RenderLayerScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698