| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // The balance between CPU use and repaint frequency will need some tuning for d
esktop. | 105 // The balance between CPU use and repaint frequency will need some tuning for d
esktop. |
| 106 // More hooks may be needed to reset the delay on things like GIF and CSS animat
ions. | 106 // More hooks may be needed to reset the delay on things like GIF and CSS animat
ions. |
| 107 double FrameView::s_normalDeferredRepaintDelay = 0; | 107 double FrameView::s_normalDeferredRepaintDelay = 0; |
| 108 double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0; | 108 double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0; |
| 109 double FrameView::s_maxDeferredRepaintDelayDuringLoading = 0; | 109 double FrameView::s_maxDeferredRepaintDelayDuringLoading = 0; |
| 110 double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0; | 110 double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0; |
| 111 #endif | 111 #endif |
| 112 | 112 |
| 113 // The maximum number of updateWidgets iterations that should be done before ret
urning. | 113 // The maximum number of updateWidgets iterations that should be done before ret
urning. |
| 114 static const unsigned maxUpdateWidgetsIterations = 2; | 114 static const unsigned maxUpdateWidgetsIterations = 2; |
| 115 static const double resourcePriorityUpdateDelayAfterScroll = 0.250; |
| 115 | 116 |
| 116 static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLay
er* layer, bool isRelayoutingSubtree, bool didFullRepaint) | 117 static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLay
er* layer, bool isRelayoutingSubtree, bool didFullRepaint) |
| 117 { | 118 { |
| 118 RenderLayer::UpdateLayerPositionsFlags flags = RenderLayer::defaultFlags; | 119 RenderLayer::UpdateLayerPositionsFlags flags = RenderLayer::defaultFlags; |
| 119 | 120 |
| 120 if (didFullRepaint) { | 121 if (didFullRepaint) { |
| 121 flags &= ~RenderLayer::CheckForRepaint; | 122 flags &= ~RenderLayer::CheckForRepaint; |
| 122 flags |= RenderLayer::NeedsFullRepaintInBacking; | 123 flags |= RenderLayer::NeedsFullRepaintInBacking; |
| 123 } | 124 } |
| 124 if (isRelayoutingSubtree && layer->isPaginated()) | 125 if (isRelayoutingSubtree && layer->isPaginated()) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 , m_shouldUpdateWhileOffscreen(true) | 187 , m_shouldUpdateWhileOffscreen(true) |
| 187 , m_scrollCorner(0) | 188 , m_scrollCorner(0) |
| 188 , m_shouldAutoSize(false) | 189 , m_shouldAutoSize(false) |
| 189 , m_inAutoSize(false) | 190 , m_inAutoSize(false) |
| 190 , m_didRunAutosize(false) | 191 , m_didRunAutosize(false) |
| 191 , m_hasSoftwareFilters(false) | 192 , m_hasSoftwareFilters(false) |
| 192 , m_visibleContentScaleFactor(1) | 193 , m_visibleContentScaleFactor(1) |
| 193 , m_inputEventsScaleFactorForEmulation(1) | 194 , m_inputEventsScaleFactorForEmulation(1) |
| 194 , m_partialLayout() | 195 , m_partialLayout() |
| 195 , m_layoutSizeFixedToFrameSize(true) | 196 , m_layoutSizeFixedToFrameSize(true) |
| 197 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) |
| 196 { | 198 { |
| 197 ASSERT(m_frame); | 199 ASSERT(m_frame); |
| 198 init(); | 200 init(); |
| 199 | 201 |
| 200 if (!isMainFrame()) | 202 if (!isMainFrame()) |
| 201 return; | 203 return; |
| 202 | 204 |
| 203 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); | 205 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); |
| 204 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); | 206 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); |
| 205 } | 207 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 219 | 221 |
| 220 view->show(); | 222 view->show(); |
| 221 return view.release(); | 223 return view.release(); |
| 222 } | 224 } |
| 223 | 225 |
| 224 FrameView::~FrameView() | 226 FrameView::~FrameView() |
| 225 { | 227 { |
| 226 if (m_postLayoutTasksTimer.isActive()) | 228 if (m_postLayoutTasksTimer.isActive()) |
| 227 m_postLayoutTasksTimer.stop(); | 229 m_postLayoutTasksTimer.stop(); |
| 228 | 230 |
| 231 if (m_didScrollTimer.isActive()) |
| 232 m_didScrollTimer.stop(); |
| 233 |
| 229 removeFromAXObjectCache(); | 234 removeFromAXObjectCache(); |
| 230 resetScrollbars(); | 235 resetScrollbars(); |
| 231 | 236 |
| 232 // Custom scrollbars should already be destroyed at this point | 237 // Custom scrollbars should already be destroyed at this point |
| 233 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar()
); | 238 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar()
); |
| 234 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar()); | 239 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar()); |
| 235 | 240 |
| 236 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we
lose the connection to the HostWindow. | 241 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we
lose the connection to the HostWindow. |
| 237 setHasVerticalScrollbar(false); | 242 setHasVerticalScrollbar(false); |
| 238 | 243 |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 | 918 |
| 914 // Text Autosizing requires two-pass layout which is incompatible with p
artial layout. | 919 // Text Autosizing requires two-pass layout which is incompatible with p
artial layout. |
| 915 // If enabled, only do partial layout for the second layout. | 920 // If enabled, only do partial layout for the second layout. |
| 916 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing. | 921 // FIXME (crbug.com/256657): Do not do two layouts for text autosizing. |
| 917 PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->se
ttings() && m_frame->settings()->textAutosizingEnabled()); | 922 PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->se
ttings() && m_frame->settings()->textAutosizingEnabled()); |
| 918 | 923 |
| 919 LayoutIndicator layoutIndicator; | 924 LayoutIndicator layoutIndicator; |
| 920 rootForThisLayout->layout(); | 925 rootForThisLayout->layout(); |
| 921 gatherDebugLayoutRects(rootForThisLayout); | 926 gatherDebugLayoutRects(rootForThisLayout); |
| 922 | 927 |
| 923 ResourceLoadPriorityOptimizer modifier; | 928 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl
lImageResourcePriorities(); |
| 924 rootForThisLayout->didLayout(modifier); | |
| 925 } | 929 } |
| 926 | 930 |
| 927 TextAutosizer* textAutosizer = frame().document()->textAutosizer(); | 931 TextAutosizer* textAutosizer = frame().document()->textAutosizer(); |
| 928 bool autosized = textAutosizer && textAutosizer->processSubtree(rootForThisL
ayout); | 932 bool autosized = textAutosizer && textAutosizer->processSubtree(rootForThisL
ayout); |
| 929 if (autosized && rootForThisLayout->needsLayout()) { | 933 if (autosized && rootForThisLayout->needsLayout()) { |
| 930 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); | 934 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); |
| 931 LayoutIndicator layoutIndicator; | 935 LayoutIndicator layoutIndicator; |
| 932 rootForThisLayout->layout(); | 936 rootForThisLayout->layout(); |
| 933 gatherDebugLayoutRects(rootForThisLayout); | 937 gatherDebugLayoutRects(rootForThisLayout); |
| 934 | |
| 935 ResourceLoadPriorityOptimizer modifier; | |
| 936 rootForThisLayout->didLayout(modifier); | |
| 937 } | 938 } |
| 938 | 939 |
| 939 m_inLayout = false; | 940 m_inLayout = false; |
| 940 | 941 |
| 941 if (inSubtreeLayout) | 942 if (inSubtreeLayout) |
| 942 rootForThisLayout->view()->popLayoutState(rootForThisLayout); | 943 rootForThisLayout->view()->popLayoutState(rootForThisLayout); |
| 943 } | 944 } |
| 944 | 945 |
| 945 void FrameView::scheduleOrPerformPostLayoutTasks() | 946 void FrameView::scheduleOrPerformPostLayoutTasks() |
| 946 { | 947 { |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 Document* document = m_frame->document(); | 1720 Document* document = m_frame->document(); |
| 1720 document->enqueueScrollEventForNode(document); | 1721 document->enqueueScrollEventForNode(document); |
| 1721 | 1722 |
| 1722 m_frame->eventHandler().dispatchFakeMouseMoveEventSoon(); | 1723 m_frame->eventHandler().dispatchFakeMouseMoveEventSoon(); |
| 1723 | 1724 |
| 1724 if (RenderView* renderView = document->renderView()) { | 1725 if (RenderView* renderView = document->renderView()) { |
| 1725 if (renderView->usesCompositing()) | 1726 if (renderView->usesCompositing()) |
| 1726 renderView->compositor()->frameViewDidScroll(); | 1727 renderView->compositor()->frameViewDidScroll(); |
| 1727 } | 1728 } |
| 1728 | 1729 |
| 1730 if (m_didScrollTimer.isActive()) |
| 1731 m_didScrollTimer.stop(); |
| 1732 m_didScrollTimer.startOneShot(resourcePriorityUpdateDelayAfterScroll); |
| 1733 } |
| 1734 |
| 1735 void FrameView::didScrollTimerFired(Timer<FrameView>*) |
| 1736 { |
| 1729 if (m_frame->document() && m_frame->document()->renderer()) { | 1737 if (m_frame->document() && m_frame->document()->renderer()) { |
| 1730 ResourceLoadPriorityOptimizer modifier; | 1738 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl
lImageResourcePriorities(); |
| 1731 m_frame->document()->renderer()->didScroll(modifier); | |
| 1732 } | 1739 } |
| 1733 } | 1740 } |
| 1734 | 1741 |
| 1735 void FrameView::repaintFixedElementsAfterScrolling() | 1742 void FrameView::repaintFixedElementsAfterScrolling() |
| 1736 { | 1743 { |
| 1737 // For fixed position elements, update widget positions and compositing laye
rs after scrolling, | 1744 // For fixed position elements, update widget positions and compositing laye
rs after scrolling, |
| 1738 // but only if we're not inside of layout. | 1745 // but only if we're not inside of layout. |
| 1739 if (!m_nestedLayoutCount && hasViewportConstrainedObjects()) { | 1746 if (!m_nestedLayoutCount && hasViewportConstrainedObjects()) { |
| 1740 if (RenderView* renderView = this->renderView()) { | 1747 if (RenderView* renderView = this->renderView()) { |
| 1741 renderView->updateWidgetPositions(); | 1748 renderView->updateWidgetPositions(); |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3510 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3517 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
| 3511 { | 3518 { |
| 3512 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3519 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 3513 if (AXObjectCache* cache = axObjectCache()) { | 3520 if (AXObjectCache* cache = axObjectCache()) { |
| 3514 cache->remove(scrollbar); | 3521 cache->remove(scrollbar); |
| 3515 cache->handleScrollbarUpdate(this); | 3522 cache->handleScrollbarUpdate(this); |
| 3516 } | 3523 } |
| 3517 } | 3524 } |
| 3518 | 3525 |
| 3519 } // namespace WebCore | 3526 } // namespace WebCore |
| OLD | NEW |