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

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

Issue 2737713002: Rename updateWidgets to updatePlugins (Closed)
Patch Set: Rename updateWidgets to updatePlugins Created 3 years, 9 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
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } while (false) 147 } while (false)
148 148
149 namespace blink { 149 namespace blink {
150 150
151 // A4 Portrait dimensions in pixels 151 // A4 Portrait dimensions in pixels
152 const int kA4PortraitPageWidth = 595; 152 const int kA4PortraitPageWidth = 595;
153 const int kA4PortraitPageHeight = 842; 153 const int kA4PortraitPageHeight = 842;
154 154
155 using namespace HTMLNames; 155 using namespace HTMLNames;
156 156
157 // The maximum number of updateWidgets iterations that should be done before 157 // The maximum number of updatePlugins iterations that should be done before
158 // returning. 158 // returning.
159 static const unsigned maxUpdateWidgetsIterations = 2; 159 static const unsigned maxUpdatePluginsIterations = 2;
160 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; 160 static const double resourcePriorityUpdateDelayAfterScroll = 0.250;
161 161
162 static bool s_initialTrackAllPaintInvalidations = false; 162 static bool s_initialTrackAllPaintInvalidations = false;
163 163
164 FrameView::FrameView(LocalFrame& frame) 164 FrameView::FrameView(LocalFrame& frame)
165 : m_frame(frame), 165 : m_frame(frame),
166 m_displayMode(WebDisplayModeBrowser), 166 m_displayMode(WebDisplayModeBrowser),
167 m_canHaveScrollbars(true), 167 m_canHaveScrollbars(true),
168 m_hasPendingLayout(false), 168 m_hasPendingLayout(false),
169 m_inSynchronousPostLayout(false), 169 m_inSynchronousPostLayout(false),
170 m_postLayoutTasksTimer( 170 m_postLayoutTasksTimer(
171 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), 171 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame),
172 this, 172 this,
173 &FrameView::postLayoutTimerFired), 173 &FrameView::postLayoutTimerFired),
174 m_updateWidgetsTimer( 174 m_updatePluginsTimer(
175 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), 175 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame),
176 this, 176 this,
177 &FrameView::updateWidgetsTimerFired), 177 &FrameView::updatePluginsTimerFired),
178 m_isTransparent(false), 178 m_isTransparent(false),
179 m_baseBackgroundColor(Color::white), 179 m_baseBackgroundColor(Color::white),
180 m_mediaType(MediaTypeNames::screen), 180 m_mediaType(MediaTypeNames::screen),
181 m_safeToPropagateScrollToParent(true), 181 m_safeToPropagateScrollToParent(true),
182 m_scrollCorner(nullptr), 182 m_scrollCorner(nullptr),
183 m_stickyPositionObjectCount(0), 183 m_stickyPositionObjectCount(0),
184 m_inputEventsScaleFactorForEmulation(1), 184 m_inputEventsScaleFactorForEmulation(1),
185 m_layoutSizeFixedToFrameSize(true), 185 m_layoutSizeFixedToFrameSize(true),
186 m_didScrollTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), 186 m_didScrollTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame),
187 this, 187 this,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // properly. 254 // properly.
255 if (RuntimeEnabledFeatures:: 255 if (RuntimeEnabledFeatures::
256 renderingPipelineThrottlingLoadingIframesEnabled()) 256 renderingPipelineThrottlingLoadingIframesEnabled())
257 m_lifecycleUpdatesThrottled = !frame().isMainFrame(); 257 m_lifecycleUpdatesThrottled = !frame().isMainFrame();
258 m_hasPendingLayout = false; 258 m_hasPendingLayout = false;
259 m_layoutSchedulingEnabled = true; 259 m_layoutSchedulingEnabled = true;
260 m_inSynchronousPostLayout = false; 260 m_inSynchronousPostLayout = false;
261 m_layoutCount = 0; 261 m_layoutCount = 0;
262 m_nestedLayoutCount = 0; 262 m_nestedLayoutCount = 0;
263 m_postLayoutTasksTimer.stop(); 263 m_postLayoutTasksTimer.stop();
264 m_updateWidgetsTimer.stop(); 264 m_updatePluginsTimer.stop();
265 m_firstLayout = true; 265 m_firstLayout = true;
266 m_safeToPropagateScrollToParent = true; 266 m_safeToPropagateScrollToParent = true;
267 m_lastViewportSize = IntSize(); 267 m_lastViewportSize = IntSize();
268 m_lastZoomFactor = 1.0f; 268 m_lastZoomFactor = 1.0f;
269 m_trackedObjectPaintInvalidations = WTF::wrapUnique( 269 m_trackedObjectPaintInvalidations = WTF::wrapUnique(
270 s_initialTrackAllPaintInvalidations ? new Vector<ObjectPaintInvalidation> 270 s_initialTrackAllPaintInvalidations ? new Vector<ObjectPaintInvalidation>
271 : nullptr); 271 : nullptr);
272 m_visuallyNonEmptyCharacterCount = 0; 272 m_visuallyNonEmptyCharacterCount = 0;
273 m_visuallyNonEmptyPixelCount = 0; 273 m_visuallyNonEmptyPixelCount = 0;
274 m_isVisuallyNonEmpty = false; 274 m_isVisuallyNonEmpty = false;
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 } 1489 }
1490 } 1490 }
1491 } 1491 }
1492 1492
1493 void FrameView::addPartToUpdate(LayoutEmbeddedObject& object) { 1493 void FrameView::addPartToUpdate(LayoutEmbeddedObject& object) {
1494 ASSERT(isInPerformLayout()); 1494 ASSERT(isInPerformLayout());
1495 // Tell the DOM element that it needs a FrameViewBase update. 1495 // Tell the DOM element that it needs a FrameViewBase update.
1496 Node* node = object.node(); 1496 Node* node = object.node();
1497 ASSERT(node); 1497 ASSERT(node);
1498 if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node)) 1498 if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node))
1499 toHTMLPlugInElement(node)->setNeedsWidgetUpdate(true); 1499 toHTMLPlugInElement(node)->setNeedsPluginUpdate(true);
1500 1500
1501 m_partUpdateSet.insert(&object); 1501 m_partUpdateSet.insert(&object);
1502 } 1502 }
1503 1503
1504 void FrameView::setDisplayMode(WebDisplayMode mode) { 1504 void FrameView::setDisplayMode(WebDisplayMode mode) {
1505 if (mode == m_displayMode) 1505 if (mode == m_displayMode)
1506 return; 1506 return;
1507 1507
1508 m_displayMode = mode; 1508 m_displayMode = mode;
1509 1509
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
2405 cache->handleScrolledToAnchor(anchorNode); 2405 cache->handleScrolledToAnchor(anchorNode);
2406 } 2406 }
2407 2407
2408 // The fragment anchor should only be maintained while the frame is still 2408 // The fragment anchor should only be maintained while the frame is still
2409 // loading. If the frame is done loading, clear the anchor now. Otherwise, 2409 // loading. If the frame is done loading, clear the anchor now. Otherwise,
2410 // restore it since it may have been cleared during scrollRectToVisible. 2410 // restore it since it may have been cleared during scrollRectToVisible.
2411 m_fragmentAnchor = 2411 m_fragmentAnchor =
2412 m_frame->document()->isLoadCompleted() ? nullptr : anchorNode; 2412 m_frame->document()->isLoadCompleted() ? nullptr : anchorNode;
2413 } 2413 }
2414 2414
2415 bool FrameView::updateWidgets() { 2415 bool FrameView::updatePlugins() {
2416 // This is always called from updateWidgetsTimerFired. 2416 // This is always called from updatePluginsTimerFired.
2417 // m_updateWidgetsTimer should only be scheduled if we have FrameViewBases to 2417 // m_updatePluginsTimer should only be scheduled if we have FrameViewBases to
2418 // update. Thus I believe we can stop checking isEmpty here, and just ASSERT 2418 // update. Thus I believe we can stop checking isEmpty here, and just ASSERT
2419 // isEmpty: 2419 // isEmpty:
2420 // FIXME: This assert has been temporarily removed due to 2420 // FIXME: This assert has been temporarily removed due to
2421 // https://crbug.com/430344 2421 // https://crbug.com/430344
2422 if (m_nestedLayoutCount > 1 || m_partUpdateSet.isEmpty()) 2422 if (m_nestedLayoutCount > 1 || m_partUpdateSet.isEmpty())
2423 return true; 2423 return true;
2424 2424
2425 // Need to swap because script will run inside the below loop and invalidate 2425 // Need to swap because script will run inside the below loop and invalidate
2426 // the iterator. 2426 // the iterator.
2427 EmbeddedObjectSet objects; 2427 EmbeddedObjectSet objects;
2428 objects.swap(m_partUpdateSet); 2428 objects.swap(m_partUpdateSet);
2429 2429
2430 for (const auto& embeddedObject : objects) { 2430 for (const auto& embeddedObject : objects) {
2431 LayoutEmbeddedObject& object = *embeddedObject; 2431 LayoutEmbeddedObject& object = *embeddedObject;
2432 HTMLPlugInElement* element = toHTMLPlugInElement(object.node()); 2432 HTMLPlugInElement* element = toHTMLPlugInElement(object.node());
2433 2433
2434 // The object may have already been destroyed (thus node cleared), 2434 // The object may have already been destroyed (thus node cleared),
2435 // but FrameView holds a manual ref, so it won't have been deleted. 2435 // but FrameView holds a manual ref, so it won't have been deleted.
2436 if (!element) 2436 if (!element)
2437 continue; 2437 continue;
2438 2438
2439 // No need to update if it's already crashed or known to be missing. 2439 // No need to update if it's already crashed or known to be missing.
2440 if (object.showsUnavailablePluginIndicator()) 2440 if (object.showsUnavailablePluginIndicator())
2441 continue; 2441 continue;
2442 2442
2443 if (element->needsWidgetUpdate()) 2443 if (element->needsPluginUpdate())
2444 element->updateWidget(); 2444 element->updatePlugin();
2445 object.updateGeometry(); 2445 object.updateGeometry();
2446 2446
2447 // Prevent plugins from causing infinite updates of themselves. 2447 // Prevent plugins from causing infinite updates of themselves.
2448 // FIXME: Do we really need to prevent this? 2448 // FIXME: Do we really need to prevent this?
2449 m_partUpdateSet.erase(&object); 2449 m_partUpdateSet.erase(&object);
2450 } 2450 }
2451 2451
2452 return m_partUpdateSet.isEmpty(); 2452 return m_partUpdateSet.isEmpty();
2453 } 2453 }
2454 2454
2455 void FrameView::updateWidgetsTimerFired(TimerBase*) { 2455 void FrameView::updatePluginsTimerFired(TimerBase*) {
2456 ASSERT(!isInPerformLayout()); 2456 ASSERT(!isInPerformLayout());
2457 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { 2457 for (unsigned i = 0; i < maxUpdatePluginsIterations; ++i) {
2458 if (updateWidgets()) 2458 if (updatePlugins())
2459 return; 2459 return;
2460 } 2460 }
2461 } 2461 }
2462 2462
2463 void FrameView::flushAnyPendingPostLayoutTasks() { 2463 void FrameView::flushAnyPendingPostLayoutTasks() {
2464 ASSERT(!isInPerformLayout()); 2464 ASSERT(!isInPerformLayout());
2465 if (m_postLayoutTasksTimer.isActive()) 2465 if (m_postLayoutTasksTimer.isActive())
2466 performPostLayoutTasks(); 2466 performPostLayoutTasks();
2467 if (m_updateWidgetsTimer.isActive()) { 2467 if (m_updatePluginsTimer.isActive()) {
2468 m_updateWidgetsTimer.stop(); 2468 m_updatePluginsTimer.stop();
2469 updateWidgetsTimerFired(nullptr); 2469 updatePluginsTimerFired(nullptr);
2470 } 2470 }
2471 } 2471 }
2472 2472
2473 void FrameView::scheduleUpdateWidgetsIfNecessary() { 2473 void FrameView::scheduleUpdatePluginsIfNecessary() {
2474 ASSERT(!isInPerformLayout()); 2474 ASSERT(!isInPerformLayout());
2475 if (m_updateWidgetsTimer.isActive() || m_partUpdateSet.isEmpty()) 2475 if (m_updatePluginsTimer.isActive() || m_partUpdateSet.isEmpty())
2476 return; 2476 return;
2477 m_updateWidgetsTimer.startOneShot(0, BLINK_FROM_HERE); 2477 m_updatePluginsTimer.startOneShot(0, BLINK_FROM_HERE);
2478 } 2478 }
2479 2479
2480 void FrameView::performPostLayoutTasks() { 2480 void FrameView::performPostLayoutTasks() {
2481 // FIXME: We can reach here, even when the page is not active! 2481 // FIXME: We can reach here, even when the page is not active!
2482 // http/tests/inspector/elements/html-link-import.html and many other 2482 // http/tests/inspector/elements/html-link-import.html and many other
2483 // tests hit that case. 2483 // tests hit that case.
2484 // We should ASSERT(isActive()); or at least return early if we can! 2484 // We should ASSERT(isActive()); or at least return early if we can!
2485 2485
2486 // Always called before or after performLayout(), part of the highest-level 2486 // Always called before or after performLayout(), part of the highest-level
2487 // layout() call. 2487 // layout() call.
(...skipping 12 matching lines...) Expand all
2500 // localFrameRoot() is discouraged but will change when cursor update 2500 // localFrameRoot() is discouraged but will change when cursor update
2501 // scheduling is moved from EventHandler to PageEventHandler. 2501 // scheduling is moved from EventHandler to PageEventHandler.
2502 frame().localFrameRoot()->eventHandler().scheduleCursorUpdate(); 2502 frame().localFrameRoot()->eventHandler().scheduleCursorUpdate();
2503 2503
2504 updateGeometries(); 2504 updateGeometries();
2505 2505
2506 // Plugins could have torn down the page inside updateGeometries(). 2506 // Plugins could have torn down the page inside updateGeometries().
2507 if (layoutViewItem().isNull()) 2507 if (layoutViewItem().isNull())
2508 return; 2508 return;
2509 2509
2510 scheduleUpdateWidgetsIfNecessary(); 2510 scheduleUpdatePluginsIfNecessary();
2511 2511
2512 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) 2512 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
2513 scrollingCoordinator->notifyGeometryChanged(); 2513 scrollingCoordinator->notifyGeometryChanged();
2514 2514
2515 scrollToFragmentAnchor(); 2515 scrollToFragmentAnchor();
2516 sendResizeEventIfNeeded(); 2516 sendResizeEventIfNeeded();
2517 } 2517 }
2518 2518
2519 bool FrameView::wasViewportResized() { 2519 bool FrameView::wasViewportResized() {
2520 ASSERT(m_frame); 2520 ASSERT(m_frame);
(...skipping 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after
5253 void FrameView::setAnimationHost( 5253 void FrameView::setAnimationHost(
5254 std::unique_ptr<CompositorAnimationHost> host) { 5254 std::unique_ptr<CompositorAnimationHost> host) {
5255 m_animationHost = std::move(host); 5255 m_animationHost = std::move(host);
5256 } 5256 }
5257 5257
5258 LayoutUnit FrameView::caretWidth() const { 5258 LayoutUnit FrameView::caretWidth() const {
5259 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); 5259 return LayoutUnit(getHostWindow()->windowToViewportScalar(1));
5260 } 5260 }
5261 5261
5262 } // namespace blink 5262 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/html/HTMLEmbedElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698