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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 795 |
796 // Viewport-dependent or device-dependent media queries may cause us to need
completely different style information. | 796 // Viewport-dependent or device-dependent media queries may cause us to need
completely different style information. |
797 if (!document->styleResolver() | 797 if (!document->styleResolver() |
798 || (wasResized && document->styleResolver()->mediaQueryAffectedByViewpor
tChange()) | 798 || (wasResized && document->styleResolver()->mediaQueryAffectedByViewpor
tChange()) |
799 || (wasResized && m_frame->settings() && m_frame->settings()->resizeIsDe
viceSizeChange() && document->styleResolver()->mediaQueryAffectedByDeviceChange(
))) { | 799 || (wasResized && m_frame->settings() && m_frame->settings()->resizeIsDe
viceSizeChange() && document->styleResolver()->mediaQueryAffectedByDeviceChange(
))) { |
800 document->mediaQueryAffectingValueChanged(); | 800 document->mediaQueryAffectingValueChanged(); |
801 } else if (wasResized) { | 801 } else if (wasResized) { |
802 document->evaluateMediaQueryList(); | 802 document->evaluateMediaQueryList(); |
803 } | 803 } |
804 | 804 |
805 document->updateLayoutTree(); | 805 document->updateStyleAndLayoutTree(); |
806 lifecycle().advanceTo(DocumentLifecycle::StyleClean); | 806 lifecycle().advanceTo(DocumentLifecycle::StyleClean); |
807 | 807 |
808 if (m_frame->isMainFrame() && !m_viewportScrollableArea) { | 808 if (m_frame->isMainFrame() && !m_viewportScrollableArea) { |
809 ScrollableArea& visualViewport = m_frame->host()->visualViewport(); | 809 ScrollableArea& visualViewport = m_frame->host()->visualViewport(); |
810 ScrollableArea* layoutViewport = layoutViewportScrollableArea(); | 810 ScrollableArea* layoutViewport = layoutViewportScrollableArea(); |
811 ASSERT(layoutViewport); | 811 ASSERT(layoutViewport); |
812 m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *la
youtViewport); | 812 m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *la
youtViewport); |
813 } | 813 } |
814 | 814 |
815 if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) | 815 if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 return false; | 1510 return false; |
1511 | 1511 |
1512 if (behavior == UrlFragmentScroll) | 1512 if (behavior == UrlFragmentScroll) |
1513 setFragmentAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame-
>document()); | 1513 setFragmentAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame-
>document()); |
1514 | 1514 |
1515 // If the anchor accepts keyboard focus and fragment scrolling is allowed, | 1515 // If the anchor accepts keyboard focus and fragment scrolling is allowed, |
1516 // move focus there to aid users relying on keyboard navigation. | 1516 // move focus there to aid users relying on keyboard navigation. |
1517 // If anchorNode is not focusable or fragment scrolling is not allowed, | 1517 // If anchorNode is not focusable or fragment scrolling is not allowed, |
1518 // clear focus, which matches the behavior of other browsers. | 1518 // clear focus, which matches the behavior of other browsers. |
1519 if (anchorNode) { | 1519 if (anchorNode) { |
1520 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 1520 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
1521 if (behavior == UrlFragmentScroll && anchorNode->isFocusable()) { | 1521 if (behavior == UrlFragmentScroll && anchorNode->isFocusable()) { |
1522 anchorNode->focus(); | 1522 anchorNode->focus(); |
1523 } else { | 1523 } else { |
1524 if (behavior == UrlFragmentScroll) | 1524 if (behavior == UrlFragmentScroll) |
1525 m_frame->document()->setSequentialFocusNavigationStartingPoint(a
nchorNode); | 1525 m_frame->document()->setSequentialFocusNavigationStartingPoint(a
nchorNode); |
1526 m_frame->document()->clearFocusedElement(); | 1526 m_frame->document()->clearFocusedElement(); |
1527 } | 1527 } |
1528 } | 1528 } |
1529 return true; | 1529 return true; |
1530 } | 1530 } |
1531 | 1531 |
1532 void FrameView::setFragmentAnchor(Node* anchorNode) | 1532 void FrameView::setFragmentAnchor(Node* anchorNode) |
1533 { | 1533 { |
1534 ASSERT(anchorNode); | 1534 ASSERT(anchorNode); |
1535 m_fragmentAnchor = anchorNode; | 1535 m_fragmentAnchor = anchorNode; |
1536 | 1536 |
1537 // We need to update the layout tree before scrolling. | 1537 // We need to update the layout tree before scrolling. |
1538 m_frame->document()->updateLayoutTree(); | 1538 m_frame->document()->updateStyleAndLayoutTree(); |
1539 | 1539 |
1540 // If layout is needed, we will scroll in performPostLayoutTasks. Otherwise,
scroll immediately. | 1540 // If layout is needed, we will scroll in performPostLayoutTasks. Otherwise,
scroll immediately. |
1541 LayoutView* layoutView = this->layoutView(); | 1541 LayoutView* layoutView = this->layoutView(); |
1542 if (layoutView && layoutView->needsLayout()) | 1542 if (layoutView && layoutView->needsLayout()) |
1543 layout(); | 1543 layout(); |
1544 else | 1544 else |
1545 scrollToFragmentAnchor(); | 1545 scrollToFragmentAnchor(); |
1546 } | 1546 } |
1547 | 1547 |
1548 void FrameView::clearFragmentAnchor() | 1548 void FrameView::clearFragmentAnchor() |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 | 2578 |
2579 // We have to crawl our entire subtree looking for any FrameViews that need | 2579 // We have to crawl our entire subtree looking for any FrameViews that need |
2580 // layout and make sure they are up to date. | 2580 // layout and make sure they are up to date. |
2581 // Mac actually tests for intersection with the dirty region and tries not t
o | 2581 // Mac actually tests for intersection with the dirty region and tries not t
o |
2582 // update layout for frames that are outside the dirty region. Not only doe
s this seem | 2582 // update layout for frames that are outside the dirty region. Not only doe
s this seem |
2583 // pointless (since those frames will have set a zero timer to layout anyway
), but | 2583 // pointless (since those frames will have set a zero timer to layout anyway
), but |
2584 // it is also incorrect, since if two frames overlap, the first could be exc
luded from the dirty | 2584 // it is also incorrect, since if two frames overlap, the first could be exc
luded from the dirty |
2585 // region but then become included later by the second frame adding rects to
the dirty region | 2585 // region but then become included later by the second frame adding rects to
the dirty region |
2586 // when it lays out. | 2586 // when it lays out. |
2587 | 2587 |
2588 m_frame->document()->updateLayoutTree(); | 2588 m_frame->document()->updateStyleAndLayoutTree(); |
2589 | 2589 |
2590 if (needsLayout()) | 2590 if (needsLayout()) |
2591 layout(); | 2591 layout(); |
2592 | 2592 |
2593 RELEASE_ASSERT(!needsLayout()); | 2593 RELEASE_ASSERT(!needsLayout()); |
2594 | 2594 |
2595 // WebView plugins need to update regardless of whether the LayoutEmbeddedOb
ject | 2595 // WebView plugins need to update regardless of whether the LayoutEmbeddedOb
ject |
2596 // that owns them needed layout. | 2596 // that owns them needed layout. |
2597 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews.
We | 2597 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews.
We |
2598 // should have a way to only run these other Documents to the same lifecycle
stage | 2598 // should have a way to only run these other Documents to the same lifecycle
stage |
(...skipping 17 matching lines...) Expand all Loading... |
2616 } | 2616 } |
2617 | 2617 |
2618 for (const auto& frameView : frameViews) | 2618 for (const auto& frameView : frameViews) |
2619 frameView->updateStyleAndLayoutIfNeededRecursiveInternal(); | 2619 frameView->updateStyleAndLayoutIfNeededRecursiveInternal(); |
2620 | 2620 |
2621 RELEASE_ASSERT(!needsLayout()); | 2621 RELEASE_ASSERT(!needsLayout()); |
2622 | 2622 |
2623 // When SVG filters are invalidated using Document::scheduleSVGFilterLayerUp
dateHack() they may trigger an | 2623 // When SVG filters are invalidated using Document::scheduleSVGFilterLayerUp
dateHack() they may trigger an |
2624 // extra style recalc. See PaintLayer::filterNeedsPaintInvalidation(). | 2624 // extra style recalc. See PaintLayer::filterNeedsPaintInvalidation(). |
2625 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { | 2625 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { |
2626 m_frame->document()->updateLayoutTree(); | 2626 m_frame->document()->updateStyleAndLayoutTree(); |
2627 | 2627 |
2628 if (needsLayout()) | 2628 if (needsLayout()) |
2629 layout(); | 2629 layout(); |
2630 } | 2630 } |
2631 | 2631 |
2632 // These asserts ensure that parent frames are clean, when child frames fini
shed updating layout and style. | 2632 // These asserts ensure that parent frames are clean, when child frames fini
shed updating layout and style. |
2633 RELEASE_ASSERT(!needsLayout()); | 2633 RELEASE_ASSERT(!needsLayout()); |
2634 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); | 2634 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); |
2635 #if ENABLE(ASSERT) | 2635 #if ENABLE(ASSERT) |
2636 m_frame->document()->layoutView()->assertLaidOut(); | 2636 m_frame->document()->layoutView()->assertLaidOut(); |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4107 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); | 4107 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); |
4108 } | 4108 } |
4109 | 4109 |
4110 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4110 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4111 { | 4111 { |
4112 ASSERT(layoutView()); | 4112 ASSERT(layoutView()); |
4113 return *layoutView(); | 4113 return *layoutView(); |
4114 } | 4114 } |
4115 | 4115 |
4116 } // namespace blink | 4116 } // namespace blink |
OLD | NEW |