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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/rendering/RenderLayerScrollableArea.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index da1ffa226151929878792d65c96c7e7c2061e4e2..c7514dbb85db28dd68120feb83c066c8e11d8f37 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -65,6 +65,7 @@
#include "core/rendering/RenderScrollbarPart.h"
#include "core/rendering/RenderTheme.h"
#include "core/rendering/RenderView.h"
+#include "core/rendering/RenderWidget.h"
#include "core/rendering/TextAutosizer.h"
#include "core/rendering/style/RenderStyle.h"
#include "core/rendering/svg/RenderSVGRoot.h"
@@ -952,8 +953,7 @@ void FrameView::scheduleOrPerformPostLayoutTasks()
if (!m_inSynchronousPostLayout) {
if (frame().document()->shouldDisplaySeamlesslyWithParent()) {
- if (RenderView* renderView = this->renderView())
- renderView->updateWidgetPositions();
+ updateWidgetPositions();
} else {
m_inSynchronousPostLayout = true;
// Calls resumeScheduledEvents()
@@ -1263,6 +1263,31 @@ RenderBox* FrameView::embeddedContentBox() const
return 0;
}
+
+void FrameView::addWidget(RenderWidget* object)
+{
+ m_widgets.add(object);
+}
+
+void FrameView::removeWidget(RenderWidget* object)
+{
+ m_widgets.remove(object);
+}
+
+void FrameView::updateWidgetPositions()
+{
+ Vector<RefPtr<RenderWidget> > widgets;
+ copyToVector(m_widgets, widgets);
+
+ // Script or plugins could detach the frame so abort processing if that happens.
+
+ for (size_t i = 0; i < widgets.size() && renderView(); ++i)
+ widgets[i]->updateWidgetPosition();
+
+ for (size_t i = 0; i < widgets.size() && renderView(); ++i)
+ widgets[i]->widgetPositionsUpdated();
+}
+
void FrameView::addWidgetToUpdate(RenderEmbeddedObject& object)
{
// Tell the DOM element that it needs a widget update.
@@ -1734,13 +1759,13 @@ void FrameView::scrollPositionChanged()
void FrameView::repaintFixedElementsAfterScrolling()
{
+ RefPtr<FrameView> protect(this);
// For fixed position elements, update widget positions and compositing layers after scrolling,
// but only if we're not inside of layout.
if (!m_nestedLayoutCount && hasViewportConstrainedObjects()) {
- if (RenderView* renderView = this->renderView()) {
- renderView->updateWidgetPositions();
+ updateWidgetPositions();
+ if (RenderView* renderView = this->renderView())
renderView->layer()->updateLayerPositionsAfterDocumentScroll();
- }
}
}
@@ -2300,9 +2325,11 @@ void FrameView::performPostLayoutTasks()
FontFaceSet::didLayout(m_frame->document());
- RenderView* renderView = this->renderView();
- if (renderView)
- renderView->updateWidgetPositions();
+ updateWidgetPositions();
+
+ // Plugins could have torn down the page inside updateWidgetPositions().
+ if (!renderView())
+ return;
if (!m_updateWidgetsTimer.isActive())
m_updateWidgetsTimer.startOneShot(0);
« 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