Chromium Code Reviews| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 namespace WebCore { | 85 namespace WebCore { |
| 86 | 86 |
| 87 using namespace HTMLNames; | 87 using namespace HTMLNames; |
| 88 | 88 |
| 89 double FrameView::s_currentFrameTimeStamp = 0.0; | 89 double FrameView::s_currentFrameTimeStamp = 0.0; |
| 90 bool FrameView::s_inPaintContents = false; | 90 bool FrameView::s_inPaintContents = false; |
| 91 | 91 |
| 92 | 92 |
| 93 // REPAINT_THROTTLING now chooses default values for throttling parameters. | 93 // REPAINT_THROTTLING now chooses default values for throttling parameters. |
| 94 // Should be removed when applications start using runtime configuration. | 94 // Should be removed when applications start using runtime configuration. |
| 95 #if ENABLE(REPAINT_THROTTLING) | 95 #if ENABLE(REPAINT_THROTTLING) |
|
Inactive
2014/01/16 02:13:03
Do we want to keep this? This define is only used
| |
| 96 // Normal delay | 96 // Normal delay |
| 97 double FrameView::s_normalDeferredRepaintDelay = 0.016; | 97 static const double s_normalDeferredRepaintDelay = 0.016; |
| 98 // Negative value would mean that first few repaints happen without a delay | 98 // Negative value would mean that first few repaints happen without a delay |
| 99 double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0; | 99 static const double s_initialDeferredRepaintDelayDuringLoading = 0; |
| 100 // The delay grows on each repaint to this maximum value | 100 // The delay grows on each repaint to this maximum value |
| 101 double FrameView::s_maxDeferredRepaintDelayDuringLoading = 2.5; | 101 static const double s_maxDeferredRepaintDelayDuringLoading = 2.5; |
| 102 // On each repaint the delay increses by this amount | 102 // On each repaint the delay increses by this amount |
| 103 double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0.5; | 103 static const double s_deferredRepaintDelayIncrementDuringLoading = 0.5; |
| 104 #else | 104 #else |
| 105 // FIXME: Repaint throttling could be good to have on all platform. | 105 // FIXME: Repaint throttling could be good to have on all platform. |
| 106 // The balance between CPU use and repaint frequency will need some tuning for d esktop. | 106 // The balance between CPU use and repaint frequency will need some tuning for d esktop. |
| 107 // More hooks may be needed to reset the delay on things like GIF and CSS animat ions. | 107 // More hooks may be needed to reset the delay on things like GIF and CSS animat ions. |
| 108 double FrameView::s_normalDeferredRepaintDelay = 0; | 108 static const double s_normalDeferredRepaintDelay = 0; |
| 109 double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0; | 109 static const double s_initialDeferredRepaintDelayDuringLoading = 0; |
| 110 double FrameView::s_maxDeferredRepaintDelayDuringLoading = 0; | 110 static const double s_maxDeferredRepaintDelayDuringLoading = 0; |
| 111 double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0; | 111 static const double s_deferredRepaintDelayIncrementDuringLoading = 0; |
| 112 #endif | 112 #endif |
| 113 | 113 |
| 114 // The maximum number of updateWidgets iterations that should be done before ret urning. | 114 // The maximum number of updateWidgets iterations that should be done before ret urning. |
| 115 static const unsigned maxUpdateWidgetsIterations = 2; | 115 static const unsigned maxUpdateWidgetsIterations = 2; |
| 116 | 116 |
| 117 static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLay er* layer, bool isRelayoutingSubtree, bool didFullRepaint) | 117 static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLay er* layer, bool isRelayoutingSubtree, bool didFullRepaint) |
| 118 { | 118 { |
| 119 RenderLayer::UpdateLayerPositionsFlags flags = RenderLayer::defaultFlags; | 119 RenderLayer::UpdateLayerPositionsFlags flags = RenderLayer::defaultFlags; |
| 120 | 120 |
| 121 if (didFullRepaint) { | 121 if (didFullRepaint) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 RenderPart* renderer = m_frame->ownerRenderer(); | 233 RenderPart* renderer = m_frame->ownerRenderer(); |
| 234 if (renderer && renderer->widget() == this) | 234 if (renderer && renderer->widget() == this) |
| 235 renderer->setWidget(0); | 235 renderer->setWidget(0); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void FrameView::reset() | 238 void FrameView::reset() |
| 239 { | 239 { |
| 240 m_cannotBlitToWindow = false; | 240 m_cannotBlitToWindow = false; |
| 241 m_isOverlapped = false; | 241 m_isOverlapped = false; |
| 242 m_contentIsOpaque = false; | 242 m_contentIsOpaque = false; |
| 243 m_borderX = 30; | |
| 244 m_borderY = 30; | |
| 245 m_layoutTimer.stop(); | 243 m_layoutTimer.stop(); |
| 246 m_layoutRoot = 0; | 244 m_layoutRoot = 0; |
| 247 m_delayedLayout = false; | 245 m_delayedLayout = false; |
| 248 m_doFullRepaint = true; | 246 m_doFullRepaint = true; |
| 249 m_layoutSchedulingEnabled = true; | 247 m_layoutSchedulingEnabled = true; |
| 250 m_inLayout = false; | 248 m_inLayout = false; |
| 251 m_doingPreLayoutStyleUpdate = false; | 249 m_doingPreLayoutStyleUpdate = false; |
| 252 m_inSynchronousPostLayout = false; | 250 m_inSynchronousPostLayout = false; |
| 253 m_layoutCount = 0; | 251 m_layoutCount = 0; |
| 254 m_nestedLayoutCount = 0; | 252 m_nestedLayoutCount = 0; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 { | 436 { |
| 439 return frame().contentRenderer(); | 437 return frame().contentRenderer(); |
| 440 } | 438 } |
| 441 | 439 |
| 442 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars) | 440 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars) |
| 443 { | 441 { |
| 444 m_canHaveScrollbars = canHaveScrollbars; | 442 m_canHaveScrollbars = canHaveScrollbars; |
| 445 ScrollView::setCanHaveScrollbars(canHaveScrollbars); | 443 ScrollView::setCanHaveScrollbars(canHaveScrollbars); |
| 446 } | 444 } |
| 447 | 445 |
| 448 void FrameView::updateCanHaveScrollbars() | |
| 449 { | |
| 450 ScrollbarMode hMode; | |
| 451 ScrollbarMode vMode; | |
| 452 scrollbarModes(hMode, vMode); | |
| 453 if (hMode == ScrollbarAlwaysOff && vMode == ScrollbarAlwaysOff) | |
| 454 setCanHaveScrollbars(false); | |
| 455 else | |
| 456 setCanHaveScrollbars(true); | |
| 457 } | |
| 458 | |
| 459 bool FrameView::shouldUseCustomScrollbars(Element*& customScrollbarElement, Fram e*& customScrollbarFrame) | 446 bool FrameView::shouldUseCustomScrollbars(Element*& customScrollbarElement, Fram e*& customScrollbarFrame) |
| 460 { | 447 { |
| 461 customScrollbarElement = 0; | 448 customScrollbarElement = 0; |
| 462 customScrollbarFrame = 0; | 449 customScrollbarFrame = 0; |
| 463 | 450 |
| 464 if (Settings* settings = m_frame->settings()) { | 451 if (Settings* settings = m_frame->settings()) { |
| 465 if (!settings->allowCustomScrollbarInMainFrame() && isMainFrame()) | 452 if (!settings->allowCustomScrollbarInMainFrame() && isMainFrame()) |
| 466 return false; | 453 return false; |
| 467 } | 454 } |
| 468 | 455 |
| (...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1533 // Note that this gets called at painting time. | 1520 // Note that this gets called at painting time. |
| 1534 void FrameView::setIsOverlapped(bool isOverlapped) | 1521 void FrameView::setIsOverlapped(bool isOverlapped) |
| 1535 { | 1522 { |
| 1536 if (isOverlapped == m_isOverlapped) | 1523 if (isOverlapped == m_isOverlapped) |
| 1537 return; | 1524 return; |
| 1538 | 1525 |
| 1539 m_isOverlapped = isOverlapped; | 1526 m_isOverlapped = isOverlapped; |
| 1540 updateCanBlitOnScrollRecursively(); | 1527 updateCanBlitOnScrollRecursively(); |
| 1541 } | 1528 } |
| 1542 | 1529 |
| 1543 bool FrameView::isOverlappedIncludingAncestors() const | |
| 1544 { | |
| 1545 if (isOverlapped()) | |
| 1546 return true; | |
| 1547 | |
| 1548 if (FrameView* parentView = parentFrameView()) { | |
| 1549 if (parentView->isOverlapped()) | |
| 1550 return true; | |
| 1551 } | |
| 1552 | |
| 1553 return false; | |
| 1554 } | |
| 1555 | |
| 1556 void FrameView::setContentIsOpaque(bool contentIsOpaque) | 1530 void FrameView::setContentIsOpaque(bool contentIsOpaque) |
| 1557 { | 1531 { |
| 1558 if (contentIsOpaque == m_contentIsOpaque) | 1532 if (contentIsOpaque == m_contentIsOpaque) |
| 1559 return; | 1533 return; |
| 1560 | 1534 |
| 1561 m_contentIsOpaque = contentIsOpaque; | 1535 m_contentIsOpaque = contentIsOpaque; |
| 1562 updateCanBlitOnScrollRecursively(); | 1536 updateCanBlitOnScrollRecursively(); |
| 1563 } | 1537 } |
| 1564 | 1538 |
| 1565 void FrameView::restoreScrollbar() | 1539 void FrameView::restoreScrollbar() |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2628 | 2602 |
| 2629 void FrameView::scrollbarStyleChanged(int newStyle, bool forceUpdate) | 2603 void FrameView::scrollbarStyleChanged(int newStyle, bool forceUpdate) |
| 2630 { | 2604 { |
| 2631 if (!isMainFrame()) | 2605 if (!isMainFrame()) |
| 2632 return; | 2606 return; |
| 2633 | 2607 |
| 2634 if (forceUpdate) | 2608 if (forceUpdate) |
| 2635 ScrollView::scrollbarStyleChanged(newStyle, forceUpdate); | 2609 ScrollView::scrollbarStyleChanged(newStyle, forceUpdate); |
| 2636 } | 2610 } |
| 2637 | 2611 |
| 2638 void FrameView::setAnimatorsAreActive() | |
| 2639 { | |
| 2640 Page* page = m_frame->page(); | |
| 2641 if (!page) | |
| 2642 return; | |
| 2643 | |
| 2644 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) | |
| 2645 scrollAnimator->setIsActive(); | |
| 2646 | |
| 2647 if (!m_scrollableAreas) | |
| 2648 return; | |
| 2649 | |
| 2650 for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin( ), end = m_scrollableAreas->end(); it != end; ++it) { | |
| 2651 ScrollableArea* scrollableArea = *it; | |
| 2652 | |
| 2653 ASSERT(scrollableArea->scrollbarsCanBeActive()); | |
| 2654 scrollableArea->scrollAnimator()->setIsActive(); | |
| 2655 } | |
| 2656 } | |
| 2657 | |
| 2658 void FrameView::notifyPageThatContentAreaWillPaint() const | 2612 void FrameView::notifyPageThatContentAreaWillPaint() const |
| 2659 { | 2613 { |
| 2660 Page* page = m_frame->page(); | 2614 Page* page = m_frame->page(); |
| 2661 if (!page) | 2615 if (!page) |
| 2662 return; | 2616 return; |
| 2663 | 2617 |
| 2664 contentAreaWillPaint(); | 2618 contentAreaWillPaint(); |
| 2665 | 2619 |
| 2666 if (!m_scrollableAreas) | 2620 if (!m_scrollableAreas) |
| 2667 return; | 2621 return; |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3257 -renderer->borderTop() - renderer->paddingTop()); | 3211 -renderer->borderTop() - renderer->paddingTop()); |
| 3258 return point; | 3212 return point; |
| 3259 } | 3213 } |
| 3260 | 3214 |
| 3261 return Widget::convertFromContainingView(parentPoint); | 3215 return Widget::convertFromContainingView(parentPoint); |
| 3262 } | 3216 } |
| 3263 | 3217 |
| 3264 return parentPoint; | 3218 return parentPoint; |
| 3265 } | 3219 } |
| 3266 | 3220 |
| 3267 // Normal delay | |
| 3268 void FrameView::setRepaintThrottlingDeferredRepaintDelay(double p) | |
| 3269 { | |
| 3270 s_normalDeferredRepaintDelay = p; | |
| 3271 } | |
| 3272 | |
| 3273 // Negative value would mean that first few repaints happen without a delay | |
| 3274 void FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(do uble p) | |
| 3275 { | |
| 3276 s_initialDeferredRepaintDelayDuringLoading = p; | |
| 3277 } | |
| 3278 | |
| 3279 // The delay grows on each repaint to this maximum value | |
| 3280 void FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p) | |
| 3281 { | |
| 3282 s_maxDeferredRepaintDelayDuringLoading = p; | |
| 3283 } | |
| 3284 | |
| 3285 // On each repaint the delay increases by this amount | |
| 3286 void FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(d ouble p) | |
| 3287 { | |
| 3288 s_deferredRepaintDelayIncrementDuringLoading = p; | |
| 3289 } | |
| 3290 | |
| 3291 void FrameView::setTracksRepaints(bool trackRepaints) | 3221 void FrameView::setTracksRepaints(bool trackRepaints) |
| 3292 { | 3222 { |
| 3293 if (trackRepaints == m_isTrackingRepaints) | 3223 if (trackRepaints == m_isTrackingRepaints) |
| 3294 return; | 3224 return; |
| 3295 | 3225 |
| 3296 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav erseNext()) { | 3226 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav erseNext()) { |
| 3297 if (RenderView* renderView = frame->contentRenderer()) | 3227 if (RenderView* renderView = frame->contentRenderer()) |
| 3298 renderView->compositor()->setTracksRepaints(trackRepaints); | 3228 renderView->compositor()->setTracksRepaints(trackRepaints); |
| 3299 } | 3229 } |
| 3300 | 3230 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3456 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) | 3386 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) |
| 3457 { | 3387 { |
| 3458 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3388 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 3459 if (AXObjectCache* cache = axObjectCache()) { | 3389 if (AXObjectCache* cache = axObjectCache()) { |
| 3460 cache->remove(scrollbar); | 3390 cache->remove(scrollbar); |
| 3461 cache->handleScrollbarUpdate(this); | 3391 cache->handleScrollbarUpdate(this); |
| 3462 } | 3392 } |
| 3463 } | 3393 } |
| 3464 | 3394 |
| 3465 } // namespace WebCore | 3395 } // namespace WebCore |
| OLD | NEW |