| 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 2521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2532 if (!m_needsUpdateWidgetPositions) | 2532 if (!m_needsUpdateWidgetPositions) |
| 2533 return; | 2533 return; |
| 2534 | 2534 |
| 2535 m_needsUpdateWidgetPositions = false; | 2535 m_needsUpdateWidgetPositions = false; |
| 2536 | 2536 |
| 2537 updateWidgetPositions(); | 2537 updateWidgetPositions(); |
| 2538 } | 2538 } |
| 2539 | 2539 |
| 2540 void FrameView::updateLayoutAndStyleForPainting() | 2540 void FrameView::updateLayoutAndStyleForPainting() |
| 2541 { | 2541 { |
| 2542 LocalFrame* startFrame = &frame(); |
| 2543 while (startFrame != page()->mainFrame() && startFrame->tree().parent()->isL
ocalFrame()) { |
| 2544 startFrame = toLocalFrame(startFrame->tree().parent()); |
| 2545 } |
| 2546 startFrame->view()->updateLayoutAndStyleForPaintingInternal(); |
| 2547 } |
| 2548 |
| 2549 void FrameView::updateLayoutAndStyleForPaintingInternal() |
| 2550 { |
| 2551 // This must be called from the root frame, since it recurses down, not up.
Otherwise the lifecycles of the frames might be out of sync. |
| 2552 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
| 2553 |
| 2542 // Updating layout can run script, which can tear down the FrameView. | 2554 // Updating layout can run script, which can tear down the FrameView. |
| 2543 RefPtrWillBeRawPtr<FrameView> protector(this); | 2555 RefPtrWillBeRawPtr<FrameView> protector(this); |
| 2544 | 2556 |
| 2545 updateLayoutAndStyleIfNeededRecursive(); | 2557 updateLayoutAndStyleIfNeededRecursive(); |
| 2546 | 2558 |
| 2547 LayoutView* view = layoutView(); | 2559 LayoutView* view = layoutView(); |
| 2548 if (view) { | 2560 if (view) { |
| 2549 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateLayerTreeEvent:
:data(m_frame.get())); | 2561 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateLayerTreeEvent:
:data(m_frame.get())); |
| 2550 | 2562 |
| 2551 view->compositor()->updateIfNeededRecursive(); | 2563 view->compositor()->updateIfNeededRecursive(); |
| 2552 | 2564 |
| 2553 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) | 2565 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) |
| 2554 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | 2566 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
| 2555 | 2567 |
| 2556 updateCompositedSelectionIfNeeded(); | 2568 updateCompositedSelectionIfNeeded(); |
| 2557 | 2569 |
| 2558 scrollContentsIfNeededRecursive(); | 2570 scrollContentsIfNeededRecursive(); |
| 2559 | 2571 |
| 2560 invalidateTreeIfNeededRecursive(); | 2572 invalidateTreeIfNeededRecursive(); |
| 2561 | 2573 |
| 2562 ASSERT(!view->hasPendingSelection()); | 2574 ASSERT(!view->hasPendingSelection()); |
| 2563 } | 2575 } |
| 2564 | 2576 |
| 2565 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); | 2577 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); |
| 2566 } | 2578 } |
| 2567 | 2579 |
| 2568 void FrameView::updateLayoutAndStyleIfNeededRecursive() | 2580 void FrameView::updateLayoutAndStyleIfNeededRecursive() |
| 2569 { | 2581 { |
| 2570 // We have to crawl our entire tree looking for any FrameViews that need | 2582 // We have to crawl our entire subtree looking for any FrameViews that need |
| 2571 // layout and make sure they are up to date. | 2583 // layout and make sure they are up to date. |
| 2572 // Mac actually tests for intersection with the dirty region and tries not t
o | 2584 // Mac actually tests for intersection with the dirty region and tries not t
o |
| 2573 // update layout for frames that are outside the dirty region. Not only doe
s this seem | 2585 // update layout for frames that are outside the dirty region. Not only doe
s this seem |
| 2574 // pointless (since those frames will have set a zero timer to layout anyway
), but | 2586 // pointless (since those frames will have set a zero timer to layout anyway
), but |
| 2575 // it is also incorrect, since if two frames overlap, the first could be exc
luded from the dirty | 2587 // it is also incorrect, since if two frames overlap, the first could be exc
luded from the dirty |
| 2576 // region but then become included later by the second frame adding rects to
the dirty region | 2588 // region but then become included later by the second frame adding rects to
the dirty region |
| 2577 // when it lays out. | 2589 // when it lays out. |
| 2578 | 2590 |
| 2579 m_frame->document()->updateLayoutTreeIfNeeded(); | 2591 m_frame->document()->updateLayoutTreeIfNeeded(); |
| 2580 | 2592 |
| (...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4014 LayoutObject* FrameView::viewportLayoutObject() | 4026 LayoutObject* FrameView::viewportLayoutObject() |
| 4015 { | 4027 { |
| 4016 if (Document* document = frame().document()) { | 4028 if (Document* document = frame().document()) { |
| 4017 if (Element* element = document->viewportDefiningElement()) | 4029 if (Element* element = document->viewportDefiningElement()) |
| 4018 return element->layoutObject(); | 4030 return element->layoutObject(); |
| 4019 } | 4031 } |
| 4020 return nullptr; | 4032 return nullptr; |
| 4021 } | 4033 } |
| 4022 | 4034 |
| 4023 } // namespace blink | 4035 } // namespace blink |
| OLD | NEW |