| OLD | NEW |
| 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 Loading... |
| 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 updateFrameViewBases iterations that should be done |
| 158 // returning. | 158 // before returning. |
| 159 static const unsigned maxUpdateWidgetsIterations = 2; | 159 static const unsigned maxUpdateFrameViewBasesIterations = 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_updateFrameViewBasesTimer( |
| 175 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), | 175 TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame), |
| 176 this, | 176 this, |
| 177 &FrameView::updateWidgetsTimerFired), | 177 &FrameView::updateFrameViewBasesTimerFired), |
| 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, |
| 188 &FrameView::didScrollTimerFired), | 188 &FrameView::didScrollTimerFired), |
| 189 m_needsUpdateWidgetGeometries(false), | 189 m_needsUpdateGeometries(false), |
| 190 m_horizontalScrollbarMode(ScrollbarAuto), | 190 m_horizontalScrollbarMode(ScrollbarAuto), |
| 191 m_verticalScrollbarMode(ScrollbarAuto), | 191 m_verticalScrollbarMode(ScrollbarAuto), |
| 192 m_horizontalScrollbarLock(false), | 192 m_horizontalScrollbarLock(false), |
| 193 m_verticalScrollbarLock(false), | 193 m_verticalScrollbarLock(false), |
| 194 m_scrollbarsSuppressed(false), | 194 m_scrollbarsSuppressed(false), |
| 195 m_inUpdateScrollbars(false), | 195 m_inUpdateScrollbars(false), |
| 196 m_frameTimingRequestsDirty(true), | 196 m_frameTimingRequestsDirty(true), |
| 197 m_hiddenForThrottling(false), | 197 m_hiddenForThrottling(false), |
| 198 m_subtreeThrottled(false), | 198 m_subtreeThrottled(false), |
| 199 m_lifecycleUpdatesThrottled(false), | 199 m_lifecycleUpdatesThrottled(false), |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_updateFrameViewBasesTimer.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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 updateScrollbarGeometry(); | 483 updateScrollbarGeometry(); |
| 484 updateScrollCorner(); | 484 updateScrollCorner(); |
| 485 positionScrollbarLayers(); | 485 positionScrollbarLayers(); |
| 486 } | 486 } |
| 487 } | 487 } |
| 488 | 488 |
| 489 void FrameView::invalidateAllCustomScrollbarsOnActiveChanged() { | 489 void FrameView::invalidateAllCustomScrollbarsOnActiveChanged() { |
| 490 bool usesWindowInactiveSelector = | 490 bool usesWindowInactiveSelector = |
| 491 m_frame->document()->styleEngine().usesWindowInactiveSelector(); | 491 m_frame->document()->styleEngine().usesWindowInactiveSelector(); |
| 492 | 492 |
| 493 const ChildrenWidgetSet* viewChildren = children(); | 493 const ChildrenFrameViewBaseSet* viewChildren = children(); |
| 494 for (const Member<FrameViewBase>& child : *viewChildren) { | 494 for (const Member<FrameViewBase>& child : *viewChildren) { |
| 495 FrameViewBase* frameViewBase = child.get(); | 495 FrameViewBase* frameViewBase = child.get(); |
| 496 if (frameViewBase->isFrameView()) { | 496 if (frameViewBase->isFrameView()) { |
| 497 toFrameView(frameViewBase) | 497 toFrameView(frameViewBase) |
| 498 ->invalidateAllCustomScrollbarsOnActiveChanged(); | 498 ->invalidateAllCustomScrollbarsOnActiveChanged(); |
| 499 } else if (usesWindowInactiveSelector && frameViewBase->isScrollbar() && | 499 } else if (usesWindowInactiveSelector && frameViewBase->isScrollbar() && |
| 500 toScrollbar(frameViewBase)->isCustomScrollbar()) { | 500 toScrollbar(frameViewBase)->isCustomScrollbar()) { |
| 501 toScrollbar(frameViewBase)->styleChanged(); | 501 toScrollbar(frameViewBase)->styleChanged(); |
| 502 } | 502 } |
| 503 } | 503 } |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 void FrameView::addPart(LayoutPart* object) { | 1458 void FrameView::addPart(LayoutPart* object) { |
| 1459 m_parts.insert(object); | 1459 m_parts.insert(object); |
| 1460 } | 1460 } |
| 1461 | 1461 |
| 1462 void FrameView::removePart(LayoutPart* object) { | 1462 void FrameView::removePart(LayoutPart* object) { |
| 1463 m_parts.erase(object); | 1463 m_parts.erase(object); |
| 1464 } | 1464 } |
| 1465 | 1465 |
| 1466 void FrameView::updateWidgetGeometries() { | 1466 void FrameView::updateGeometries() { |
| 1467 Vector<RefPtr<LayoutPart>> parts; | 1467 Vector<RefPtr<LayoutPart>> parts; |
| 1468 copyToVector(m_parts, parts); | 1468 copyToVector(m_parts, parts); |
| 1469 | 1469 |
| 1470 for (auto part : parts) { | 1470 for (auto part : parts) { |
| 1471 // Script or plugins could detach the frame so abort processing if that | 1471 // Script or plugins could detach the frame so abort processing if that |
| 1472 // happens. | 1472 // happens. |
| 1473 if (layoutViewItem().isNull()) | 1473 if (layoutViewItem().isNull()) |
| 1474 break; | 1474 break; |
| 1475 | 1475 |
| 1476 if (FrameViewBase* frameViewBase = part->widget()) { | 1476 if (FrameViewBase* frameViewBase = part->widget()) { |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1995 DisableCompositingQueryAsserts disabler; | 1995 DisableCompositingQueryAsserts disabler; |
| 1996 layer->updateLayerPositionsAfterOverflowScroll(); | 1996 layer->updateLayerPositionsAfterOverflowScroll(); |
| 1997 layoutObject->setMayNeedPaintInvalidationSubtree(); | 1997 layoutObject->setMayNeedPaintInvalidationSubtree(); |
| 1998 } | 1998 } |
| 1999 } | 1999 } |
| 2000 | 2000 |
| 2001 // If there fixed position elements, scrolling may cause compositing layers to | 2001 // If there fixed position elements, scrolling may cause compositing layers to |
| 2002 // change. Update FrameViewBase and layer positions after scrolling, but only | 2002 // change. Update FrameViewBase and layer positions after scrolling, but only |
| 2003 // if we're not inside of layout. | 2003 // if we're not inside of layout. |
| 2004 if (!m_nestedLayoutCount) { | 2004 if (!m_nestedLayoutCount) { |
| 2005 updateWidgetGeometries(); | 2005 updateGeometries(); |
| 2006 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 2006 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
| 2007 if (!layoutViewItem.isNull()) | 2007 if (!layoutViewItem.isNull()) |
| 2008 layoutViewItem.layer()->setNeedsCompositingInputsUpdate(); | 2008 layoutViewItem.layer()->setNeedsCompositingInputsUpdate(); |
| 2009 } | 2009 } |
| 2010 } | 2010 } |
| 2011 | 2011 |
| 2012 bool FrameView::computeCompositedSelection(LocalFrame& frame, | 2012 bool FrameView::computeCompositedSelection(LocalFrame& frame, |
| 2013 CompositedSelection& selection) { | 2013 CompositedSelection& selection) { |
| 2014 if (!frame.view() || frame.view()->shouldThrottleRendering()) | 2014 if (!frame.view() || frame.view()->shouldThrottleRendering()) |
| 2015 return false; | 2015 return false; |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2402 cache->handleScrolledToAnchor(anchorNode); | 2402 cache->handleScrolledToAnchor(anchorNode); |
| 2403 } | 2403 } |
| 2404 | 2404 |
| 2405 // The fragment anchor should only be maintained while the frame is still | 2405 // The fragment anchor should only be maintained while the frame is still |
| 2406 // loading. If the frame is done loading, clear the anchor now. Otherwise, | 2406 // loading. If the frame is done loading, clear the anchor now. Otherwise, |
| 2407 // restore it since it may have been cleared during scrollRectToVisible. | 2407 // restore it since it may have been cleared during scrollRectToVisible. |
| 2408 m_fragmentAnchor = | 2408 m_fragmentAnchor = |
| 2409 m_frame->document()->isLoadCompleted() ? nullptr : anchorNode; | 2409 m_frame->document()->isLoadCompleted() ? nullptr : anchorNode; |
| 2410 } | 2410 } |
| 2411 | 2411 |
| 2412 bool FrameView::updateWidgets() { | 2412 bool FrameView::updateFrameViewBases() { |
| 2413 // This is always called from updateWidgetsTimerFired. | 2413 // This is always called from updateFrameViewBasesTimerFired. |
| 2414 // m_updateWidgetsTimer should only be scheduled if we have FrameViewBases to | 2414 // m_updateFrameViewBasesTimer should only be scheduled if we have |
| 2415 // update. Thus I believe we can stop checking isEmpty here, and just ASSERT | 2415 // FrameViewBases to update. Thus I believe we can stop checking isEmpty here, |
| 2416 // isEmpty: | 2416 // and just ASSERT isEmpty: |
| 2417 // FIXME: This assert has been temporarily removed due to | 2417 // FIXME: This assert has been temporarily removed due to |
| 2418 // https://crbug.com/430344 | 2418 // https://crbug.com/430344 |
| 2419 if (m_nestedLayoutCount > 1 || m_partUpdateSet.isEmpty()) | 2419 if (m_nestedLayoutCount > 1 || m_partUpdateSet.isEmpty()) |
| 2420 return true; | 2420 return true; |
| 2421 | 2421 |
| 2422 // Need to swap because script will run inside the below loop and invalidate | 2422 // Need to swap because script will run inside the below loop and invalidate |
| 2423 // the iterator. | 2423 // the iterator. |
| 2424 EmbeddedObjectSet objects; | 2424 EmbeddedObjectSet objects; |
| 2425 objects.swap(m_partUpdateSet); | 2425 objects.swap(m_partUpdateSet); |
| 2426 | 2426 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2442 object.updateWidgetGeometry(); | 2442 object.updateWidgetGeometry(); |
| 2443 | 2443 |
| 2444 // Prevent plugins from causing infinite updates of themselves. | 2444 // Prevent plugins from causing infinite updates of themselves. |
| 2445 // FIXME: Do we really need to prevent this? | 2445 // FIXME: Do we really need to prevent this? |
| 2446 m_partUpdateSet.erase(&object); | 2446 m_partUpdateSet.erase(&object); |
| 2447 } | 2447 } |
| 2448 | 2448 |
| 2449 return m_partUpdateSet.isEmpty(); | 2449 return m_partUpdateSet.isEmpty(); |
| 2450 } | 2450 } |
| 2451 | 2451 |
| 2452 void FrameView::updateWidgetsTimerFired(TimerBase*) { | 2452 void FrameView::updateFrameViewBasesTimerFired(TimerBase*) { |
| 2453 ASSERT(!isInPerformLayout()); | 2453 ASSERT(!isInPerformLayout()); |
| 2454 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { | 2454 for (unsigned i = 0; i < maxUpdateFrameViewBasesIterations; ++i) { |
| 2455 if (updateWidgets()) | 2455 if (updateFrameViewBases()) |
| 2456 return; | 2456 return; |
| 2457 } | 2457 } |
| 2458 } | 2458 } |
| 2459 | 2459 |
| 2460 void FrameView::flushAnyPendingPostLayoutTasks() { | 2460 void FrameView::flushAnyPendingPostLayoutTasks() { |
| 2461 ASSERT(!isInPerformLayout()); | 2461 ASSERT(!isInPerformLayout()); |
| 2462 if (m_postLayoutTasksTimer.isActive()) | 2462 if (m_postLayoutTasksTimer.isActive()) |
| 2463 performPostLayoutTasks(); | 2463 performPostLayoutTasks(); |
| 2464 if (m_updateWidgetsTimer.isActive()) { | 2464 if (m_updateFrameViewBasesTimer.isActive()) { |
| 2465 m_updateWidgetsTimer.stop(); | 2465 m_updateFrameViewBasesTimer.stop(); |
| 2466 updateWidgetsTimerFired(nullptr); | 2466 updateFrameViewBasesTimerFired(nullptr); |
| 2467 } | 2467 } |
| 2468 } | 2468 } |
| 2469 | 2469 |
| 2470 void FrameView::scheduleUpdateWidgetsIfNecessary() { | 2470 void FrameView::scheduleUpdateFrameViewBasesIfNecessary() { |
| 2471 ASSERT(!isInPerformLayout()); | 2471 ASSERT(!isInPerformLayout()); |
| 2472 if (m_updateWidgetsTimer.isActive() || m_partUpdateSet.isEmpty()) | 2472 if (m_updateFrameViewBasesTimer.isActive() || m_partUpdateSet.isEmpty()) |
| 2473 return; | 2473 return; |
| 2474 m_updateWidgetsTimer.startOneShot(0, BLINK_FROM_HERE); | 2474 m_updateFrameViewBasesTimer.startOneShot(0, BLINK_FROM_HERE); |
| 2475 } | 2475 } |
| 2476 | 2476 |
| 2477 void FrameView::performPostLayoutTasks() { | 2477 void FrameView::performPostLayoutTasks() { |
| 2478 // FIXME: We can reach here, even when the page is not active! | 2478 // FIXME: We can reach here, even when the page is not active! |
| 2479 // http/tests/inspector/elements/html-link-import.html and many other | 2479 // http/tests/inspector/elements/html-link-import.html and many other |
| 2480 // tests hit that case. | 2480 // tests hit that case. |
| 2481 // We should ASSERT(isActive()); or at least return early if we can! | 2481 // We should ASSERT(isActive()); or at least return early if we can! |
| 2482 | 2482 |
| 2483 // Always called before or after performLayout(), part of the highest-level | 2483 // Always called before or after performLayout(), part of the highest-level |
| 2484 // layout() call. | 2484 // layout() call. |
| 2485 ASSERT(!isInPerformLayout()); | 2485 ASSERT(!isInPerformLayout()); |
| 2486 TRACE_EVENT0("blink,benchmark", "FrameView::performPostLayoutTasks"); | 2486 TRACE_EVENT0("blink,benchmark", "FrameView::performPostLayoutTasks"); |
| 2487 | 2487 |
| 2488 m_postLayoutTasksTimer.stop(); | 2488 m_postLayoutTasksTimer.stop(); |
| 2489 | 2489 |
| 2490 m_frame->selection().didLayout(); | 2490 m_frame->selection().didLayout(); |
| 2491 | 2491 |
| 2492 ASSERT(m_frame->document()); | 2492 ASSERT(m_frame->document()); |
| 2493 | 2493 |
| 2494 FontFaceSet::didLayout(*m_frame->document()); | 2494 FontFaceSet::didLayout(*m_frame->document()); |
| 2495 // Cursor update scheduling is done by the local root, which is the main frame | 2495 // Cursor update scheduling is done by the local root, which is the main frame |
| 2496 // if there are no RemoteFrame ancestors in the frame tree. Use of | 2496 // if there are no RemoteFrame ancestors in the frame tree. Use of |
| 2497 // localFrameRoot() is discouraged but will change when cursor update | 2497 // localFrameRoot() is discouraged but will change when cursor update |
| 2498 // scheduling is moved from EventHandler to PageEventHandler. | 2498 // scheduling is moved from EventHandler to PageEventHandler. |
| 2499 frame().localFrameRoot()->eventHandler().scheduleCursorUpdate(); | 2499 frame().localFrameRoot()->eventHandler().scheduleCursorUpdate(); |
| 2500 | 2500 |
| 2501 updateWidgetGeometries(); | 2501 updateGeometries(); |
| 2502 | 2502 |
| 2503 // Plugins could have torn down the page inside updateWidgetGeometries(). | 2503 // Plugins could have torn down the page inside |
| 2504 // updateGeometries(). |
| 2504 if (layoutViewItem().isNull()) | 2505 if (layoutViewItem().isNull()) |
| 2505 return; | 2506 return; |
| 2506 | 2507 |
| 2507 scheduleUpdateWidgetsIfNecessary(); | 2508 scheduleUpdateFrameViewBasesIfNecessary(); |
| 2508 | 2509 |
| 2509 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) | 2510 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) |
| 2510 scrollingCoordinator->notifyGeometryChanged(); | 2511 scrollingCoordinator->notifyGeometryChanged(); |
| 2511 | 2512 |
| 2512 scrollToFragmentAnchor(); | 2513 scrollToFragmentAnchor(); |
| 2513 sendResizeEventIfNeeded(); | 2514 sendResizeEventIfNeeded(); |
| 2514 } | 2515 } |
| 2515 | 2516 |
| 2516 bool FrameView::wasViewportResized() { | 2517 bool FrameView::wasViewportResized() { |
| 2517 ASSERT(m_frame); | 2518 ASSERT(m_frame); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2849 | 2850 |
| 2850 if (hasHorizontalScrollbar != shouldHaveHorizontalScrollbar || | 2851 if (hasHorizontalScrollbar != shouldHaveHorizontalScrollbar || |
| 2851 hasVerticalScrollbar != shouldHaveVerticalScrollbar) { | 2852 hasVerticalScrollbar != shouldHaveVerticalScrollbar) { |
| 2852 scrollbarExistenceDidChange(); | 2853 scrollbarExistenceDidChange(); |
| 2853 | 2854 |
| 2854 if (!visualViewportSuppliesScrollbars()) | 2855 if (!visualViewportSuppliesScrollbars()) |
| 2855 updateScrollbarGeometry(); | 2856 updateScrollbarGeometry(); |
| 2856 } | 2857 } |
| 2857 } | 2858 } |
| 2858 | 2859 |
| 2859 void FrameView::updateWidgetGeometriesIfNeeded() { | 2860 void FrameView::updateGeometriesIfNeeded() { |
| 2860 if (!m_needsUpdateWidgetGeometries) | 2861 if (!m_needsUpdateGeometries) |
| 2861 return; | 2862 return; |
| 2862 | 2863 |
| 2863 m_needsUpdateWidgetGeometries = false; | 2864 m_needsUpdateGeometries = false; |
| 2864 | 2865 |
| 2865 updateWidgetGeometries(); | 2866 updateGeometries(); |
| 2866 } | 2867 } |
| 2867 | 2868 |
| 2868 GeometryMapper& FrameView::geometryMapper() { | 2869 GeometryMapper& FrameView::geometryMapper() { |
| 2869 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | 2870 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| 2870 DCHECK(lifecycle().state() >= DocumentLifecycle::InPrePaint); | 2871 DCHECK(lifecycle().state() >= DocumentLifecycle::InPrePaint); |
| 2871 | 2872 |
| 2872 if (m_frame->isLocalRoot()) { | 2873 if (m_frame->isLocalRoot()) { |
| 2873 if (!m_geometryMapper) | 2874 if (!m_geometryMapper) |
| 2874 m_geometryMapper = GeometryMapper::create(); | 2875 m_geometryMapper = GeometryMapper::create(); |
| 2875 return *m_geometryMapper.get(); | 2876 return *m_geometryMapper.get(); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3300 if (needsLayout()) | 3301 if (needsLayout()) |
| 3301 layout(); | 3302 layout(); |
| 3302 | 3303 |
| 3303 checkDoesNotNeedLayout(); | 3304 checkDoesNotNeedLayout(); |
| 3304 | 3305 |
| 3305 // WebView plugins need to update regardless of whether the | 3306 // WebView plugins need to update regardless of whether the |
| 3306 // LayoutEmbeddedObject that owns them needed layout. | 3307 // LayoutEmbeddedObject that owns them needed layout. |
| 3307 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews. | 3308 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews. |
| 3308 // We should have a way to only run these other Documents to the same | 3309 // We should have a way to only run these other Documents to the same |
| 3309 // lifecycle stage as this frame. | 3310 // lifecycle stage as this frame. |
| 3310 const ChildrenWidgetSet* viewChildren = children(); | 3311 const ChildrenFrameViewBaseSet* viewChildren = children(); |
| 3311 for (const Member<FrameViewBase>& child : *viewChildren) { | 3312 for (const Member<FrameViewBase>& child : *viewChildren) { |
| 3312 if ((*child).isPluginContainer()) | 3313 if ((*child).isPluginContainer()) |
| 3313 toPluginView(child.get())->updateAllLifecyclePhases(); | 3314 toPluginView(child.get())->updateAllLifecyclePhases(); |
| 3314 } | 3315 } |
| 3315 checkDoesNotNeedLayout(); | 3316 checkDoesNotNeedLayout(); |
| 3316 | 3317 |
| 3317 // FIXME: Calling layout() shouldn't trigger script execution or have any | 3318 // FIXME: Calling layout() shouldn't trigger script execution or have any |
| 3318 // observable effects on the frame tree but we're not quite there yet. | 3319 // observable effects on the frame tree but we're not quite there yet. |
| 3319 HeapVector<Member<FrameView>> frameViews; | 3320 HeapVector<Member<FrameView>> frameViews; |
| 3320 for (Frame* child = m_frame->tree().firstChild(); child; | 3321 for (Frame* child = m_frame->tree().firstChild(); child; |
| 3321 child = child->tree().nextSibling()) { | 3322 child = child->tree().nextSibling()) { |
| 3322 if (!child->isLocalFrame()) | 3323 if (!child->isLocalFrame()) |
| 3323 continue; | 3324 continue; |
| 3324 if (FrameView* view = toLocalFrame(child)->view()) | 3325 if (FrameView* view = toLocalFrame(child)->view()) |
| 3325 frameViews.push_back(view); | 3326 frameViews.push_back(view); |
| 3326 } | 3327 } |
| 3327 | 3328 |
| 3328 for (const auto& frameView : frameViews) | 3329 for (const auto& frameView : frameViews) |
| 3329 frameView->updateStyleAndLayoutIfNeededRecursiveInternal(); | 3330 frameView->updateStyleAndLayoutIfNeededRecursiveInternal(); |
| 3330 | 3331 |
| 3331 // These asserts ensure that parent frames are clean, when child frames | 3332 // These asserts ensure that parent frames are clean, when child frames |
| 3332 // finished updating layout and style. | 3333 // finished updating layout and style. |
| 3333 checkDoesNotNeedLayout(); | 3334 checkDoesNotNeedLayout(); |
| 3334 #if DCHECK_IS_ON() | 3335 #if DCHECK_IS_ON() |
| 3335 m_frame->document()->layoutView()->assertLaidOut(); | 3336 m_frame->document()->layoutView()->assertLaidOut(); |
| 3336 #endif | 3337 #endif |
| 3337 | 3338 |
| 3338 updateWidgetGeometriesIfNeeded(); | 3339 updateGeometriesIfNeeded(); |
| 3339 | 3340 |
| 3340 if (lifecycle().state() < DocumentLifecycle::LayoutClean) | 3341 if (lifecycle().state() < DocumentLifecycle::LayoutClean) |
| 3341 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); | 3342 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); |
| 3342 | 3343 |
| 3343 // Ensure that we become visually non-empty eventually. | 3344 // Ensure that we become visually non-empty eventually. |
| 3344 // TODO(esprehn): This should check isRenderingReady() instead. | 3345 // TODO(esprehn): This should check isRenderingReady() instead. |
| 3345 if (frame().document()->hasFinishedParsing() && | 3346 if (frame().document()->hasFinishedParsing() && |
| 3346 frame().loader().stateMachine()->committedFirstRealDocumentLoad()) | 3347 frame().loader().stateMachine()->committedFirstRealDocumentLoad()) |
| 3347 m_isVisuallyNonEmpty = true; | 3348 m_isVisuallyNonEmpty = true; |
| 3348 | 3349 |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5250 void FrameView::setAnimationHost( | 5251 void FrameView::setAnimationHost( |
| 5251 std::unique_ptr<CompositorAnimationHost> host) { | 5252 std::unique_ptr<CompositorAnimationHost> host) { |
| 5252 m_animationHost = std::move(host); | 5253 m_animationHost = std::move(host); |
| 5253 } | 5254 } |
| 5254 | 5255 |
| 5255 LayoutUnit FrameView::caretWidth() const { | 5256 LayoutUnit FrameView::caretWidth() const { |
| 5256 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); | 5257 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); |
| 5257 } | 5258 } |
| 5258 | 5259 |
| 5259 } // namespace blink | 5260 } // namespace blink |
| OLD | NEW |