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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 return false; | 1507 return false; |
1508 | 1508 |
1509 if (behavior == UrlFragmentScroll) | 1509 if (behavior == UrlFragmentScroll) |
1510 setFragmentAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame-
>document()); | 1510 setFragmentAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame-
>document()); |
1511 | 1511 |
1512 // If the anchor accepts keyboard focus and fragment scrolling is allowed, | 1512 // If the anchor accepts keyboard focus and fragment scrolling is allowed, |
1513 // move focus there to aid users relying on keyboard navigation. | 1513 // move focus there to aid users relying on keyboard navigation. |
1514 // If anchorNode is not focusable or fragment scrolling is not allowed, | 1514 // If anchorNode is not focusable or fragment scrolling is not allowed, |
1515 // clear focus, which matches the behavior of other browsers. | 1515 // clear focus, which matches the behavior of other browsers. |
1516 if (anchorNode) { | 1516 if (anchorNode) { |
1517 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 1517 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
1518 if (behavior == UrlFragmentScroll && anchorNode->isFocusable()) { | 1518 if (behavior == UrlFragmentScroll && anchorNode->isFocusable()) { |
1519 anchorNode->focus(); | 1519 anchorNode->focus(); |
1520 } else { | 1520 } else { |
1521 if (behavior == UrlFragmentScroll) | 1521 if (behavior == UrlFragmentScroll) |
1522 m_frame->document()->setSequentialFocusNavigationStartingPoint(a
nchorNode); | 1522 m_frame->document()->setSequentialFocusNavigationStartingPoint(a
nchorNode); |
1523 m_frame->document()->clearFocusedElement(); | 1523 m_frame->document()->clearFocusedElement(); |
1524 } | 1524 } |
1525 } | 1525 } |
1526 return true; | 1526 return true; |
1527 } | 1527 } |
1528 | 1528 |
1529 void FrameView::setFragmentAnchor(Node* anchorNode) | 1529 void FrameView::setFragmentAnchor(Node* anchorNode) |
1530 { | 1530 { |
1531 ASSERT(anchorNode); | 1531 ASSERT(anchorNode); |
1532 m_fragmentAnchor = anchorNode; | 1532 m_fragmentAnchor = anchorNode; |
1533 | 1533 |
1534 // We need to update the layout tree before scrolling. | 1534 // We need to update the layout tree before scrolling. |
1535 m_frame->document()->updateLayoutTree(); | 1535 m_frame->document()->updateStyleAndLayoutTree(); |
1536 | 1536 |
1537 // If layout is needed, we will scroll in performPostLayoutTasks. Otherwise,
scroll immediately. | 1537 // If layout is needed, we will scroll in performPostLayoutTasks. Otherwise,
scroll immediately. |
1538 LayoutView* layoutView = this->layoutView(); | 1538 LayoutView* layoutView = this->layoutView(); |
1539 if (layoutView && layoutView->needsLayout()) | 1539 if (layoutView && layoutView->needsLayout()) |
1540 layout(); | 1540 layout(); |
1541 else | 1541 else |
1542 scrollToFragmentAnchor(); | 1542 scrollToFragmentAnchor(); |
1543 } | 1543 } |
1544 | 1544 |
1545 void FrameView::clearFragmentAnchor() | 1545 void FrameView::clearFragmentAnchor() |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 | 2575 |
2576 // We have to crawl our entire subtree looking for any FrameViews that need | 2576 // We have to crawl our entire subtree looking for any FrameViews that need |
2577 // layout and make sure they are up to date. | 2577 // layout and make sure they are up to date. |
2578 // Mac actually tests for intersection with the dirty region and tries not t
o | 2578 // Mac actually tests for intersection with the dirty region and tries not t
o |
2579 // update layout for frames that are outside the dirty region. Not only doe
s this seem | 2579 // update layout for frames that are outside the dirty region. Not only doe
s this seem |
2580 // pointless (since those frames will have set a zero timer to layout anyway
), but | 2580 // pointless (since those frames will have set a zero timer to layout anyway
), but |
2581 // it is also incorrect, since if two frames overlap, the first could be exc
luded from the dirty | 2581 // it is also incorrect, since if two frames overlap, the first could be exc
luded from the dirty |
2582 // region but then become included later by the second frame adding rects to
the dirty region | 2582 // region but then become included later by the second frame adding rects to
the dirty region |
2583 // when it lays out. | 2583 // when it lays out. |
2584 | 2584 |
2585 m_frame->document()->updateLayoutTree(); | 2585 m_frame->document()->updateStyleAndLayoutTree(); |
2586 | 2586 |
2587 if (needsLayout()) | 2587 if (needsLayout()) |
2588 layout(); | 2588 layout(); |
2589 | 2589 |
2590 RELEASE_ASSERT(!needsLayout()); | 2590 RELEASE_ASSERT(!needsLayout()); |
2591 | 2591 |
2592 // WebView plugins need to update regardless of whether the LayoutEmbeddedOb
ject | 2592 // WebView plugins need to update regardless of whether the LayoutEmbeddedOb
ject |
2593 // that owns them needed layout. | 2593 // that owns them needed layout. |
2594 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews.
We | 2594 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews.
We |
2595 // should have a way to only run these other Documents to the same lifecycle
stage | 2595 // should have a way to only run these other Documents to the same lifecycle
stage |
(...skipping 17 matching lines...) Expand all Loading... |
2613 } | 2613 } |
2614 | 2614 |
2615 for (const auto& frameView : frameViews) | 2615 for (const auto& frameView : frameViews) |
2616 frameView->updateStyleAndLayoutIfNeededRecursiveInternal(); | 2616 frameView->updateStyleAndLayoutIfNeededRecursiveInternal(); |
2617 | 2617 |
2618 RELEASE_ASSERT(!needsLayout()); | 2618 RELEASE_ASSERT(!needsLayout()); |
2619 | 2619 |
2620 // When SVG filters are invalidated using Document::scheduleSVGFilterLayerUp
dateHack() they may trigger an | 2620 // When SVG filters are invalidated using Document::scheduleSVGFilterLayerUp
dateHack() they may trigger an |
2621 // extra style recalc. See PaintLayer::filterNeedsPaintInvalidation(). | 2621 // extra style recalc. See PaintLayer::filterNeedsPaintInvalidation(). |
2622 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { | 2622 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { |
2623 m_frame->document()->updateLayoutTree(); | 2623 m_frame->document()->updateStyleAndLayoutTree(); |
2624 | 2624 |
2625 if (needsLayout()) | 2625 if (needsLayout()) |
2626 layout(); | 2626 layout(); |
2627 } | 2627 } |
2628 | 2628 |
2629 // These asserts ensure that parent frames are clean, when child frames fini
shed updating layout and style. | 2629 // These asserts ensure that parent frames are clean, when child frames fini
shed updating layout and style. |
2630 RELEASE_ASSERT(!needsLayout()); | 2630 RELEASE_ASSERT(!needsLayout()); |
2631 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); | 2631 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); |
2632 #if ENABLE(ASSERT) | 2632 #if ENABLE(ASSERT) |
2633 m_frame->document()->layoutView()->assertLaidOut(); | 2633 m_frame->document()->layoutView()->assertLaidOut(); |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4104 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); | 4104 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); |
4105 } | 4105 } |
4106 | 4106 |
4107 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4107 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4108 { | 4108 { |
4109 ASSERT(layoutView()); | 4109 ASSERT(layoutView()); |
4110 return *layoutView(); | 4110 return *layoutView(); |
4111 } | 4111 } |
4112 | 4112 |
4113 } // namespace blink | 4113 } // namespace blink |
OLD | NEW |