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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 void FrameView::setContentsSize(const IntSize& size) | 506 void FrameView::setContentsSize(const IntSize& size) |
507 { | 507 { |
508 if (size == contentsSize()) | 508 if (size == contentsSize()) |
509 return; | 509 return; |
510 | 510 |
511 m_deferSetNeedsLayouts++; | 511 m_deferSetNeedsLayouts++; |
512 | 512 |
513 ScrollView::setContentsSize(size); | 513 ScrollView::setContentsSize(size); |
514 ScrollView::contentsResized(); | 514 ScrollView::contentsResized(); |
515 | 515 |
516 Page* page = frame() ? frame()->page() : 0; | 516 Page* page = frame().page(); |
517 if (!page) | 517 if (!page) |
518 return; | 518 return; |
519 | 519 |
520 updateScrollableAreaSet(); | 520 updateScrollableAreaSet(); |
521 | 521 |
522 page->chrome().contentsSizeChanged(frame(), size); // Notify only. | 522 page->chrome().contentsSizeChanged(m_frame.get(), size); // Notify only. |
523 | 523 |
524 m_deferSetNeedsLayouts--; | 524 m_deferSetNeedsLayouts--; |
525 | 525 |
526 if (!m_deferSetNeedsLayouts) | 526 if (!m_deferSetNeedsLayouts) |
527 m_setNeedsLayoutWasDeferred = false; // FIXME: Find a way to make the de
ferred layout actually happen. | 527 m_setNeedsLayoutWasDeferred = false; // FIXME: Find a way to make the de
ferred layout actually happen. |
528 } | 528 } |
529 | 529 |
530 void FrameView::adjustViewSize() | 530 void FrameView::adjustViewSize() |
531 { | 531 { |
532 RenderView* renderView = this->renderView(); | 532 RenderView* renderView = this->renderView(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 hMode = ScrollbarAlwaysOff; | 630 hMode = ScrollbarAlwaysOff; |
631 vMode = ScrollbarAlwaysOff; | 631 vMode = ScrollbarAlwaysOff; |
632 return; | 632 return; |
633 } | 633 } |
634 | 634 |
635 if (m_canHaveScrollbars || strategy == RulesFromWebContentOnly) { | 635 if (m_canHaveScrollbars || strategy == RulesFromWebContentOnly) { |
636 hMode = ScrollbarAuto; | 636 hMode = ScrollbarAuto; |
637 // Seamless documents begin with heights of 0; we special case that here | 637 // Seamless documents begin with heights of 0; we special case that here |
638 // to correctly render documents that don't need scrollbars. | 638 // to correctly render documents that don't need scrollbars. |
639 IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size(); | 639 IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size(); |
640 bool isSeamlessDocument = frame() && frame()->document() && frame()->doc
ument()->shouldDisplaySeamlesslyWithParent(); | 640 bool isSeamlessDocument = frame().document() && frame().document()->shou
ldDisplaySeamlesslyWithParent(); |
641 vMode = (isSeamlessDocument && !fullVisibleSize.height()) ? ScrollbarAlw
aysOff : ScrollbarAuto; | 641 vMode = (isSeamlessDocument && !fullVisibleSize.height()) ? ScrollbarAlw
aysOff : ScrollbarAuto; |
642 } else { | 642 } else { |
643 hMode = ScrollbarAlwaysOff; | 643 hMode = ScrollbarAlwaysOff; |
644 vMode = ScrollbarAlwaysOff; | 644 vMode = ScrollbarAlwaysOff; |
645 } | 645 } |
646 | 646 |
647 if (!m_layoutRoot) { | 647 if (!m_layoutRoot) { |
648 Document* document = m_frame->document(); | 648 Document* document = m_frame->document(); |
649 Node* documentElement = document->documentElement(); | 649 Node* documentElement = document->documentElement(); |
650 RenderObject* rootRenderer = documentElement ? documentElement->renderer
() : 0; | 650 RenderObject* rootRenderer = documentElement ? documentElement->renderer
() : 0; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. | 824 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. |
825 ASSERT(frameView); | 825 ASSERT(frameView); |
826 frameView->layout(); | 826 frameView->layout(); |
827 } | 827 } |
828 | 828 |
829 void FrameView::performPreLayoutTasks() | 829 void FrameView::performPreLayoutTasks() |
830 { | 830 { |
831 // Don't schedule more layouts, we're in one. | 831 // Don't schedule more layouts, we're in one. |
832 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, fal
se); | 832 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, fal
se); |
833 | 833 |
834 if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksT
imer.isActive() && !frame()->document()->shouldDisplaySeamlesslyWithParent()) { | 834 if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksT
imer.isActive() && !frame().document()->shouldDisplaySeamlesslyWithParent()) { |
835 // This is a new top-level layout. If there are any remaining tasks from
the previous layout, finish them now. | 835 // This is a new top-level layout. If there are any remaining tasks from
the previous layout, finish them now. |
836 m_inSynchronousPostLayout = true; | 836 m_inSynchronousPostLayout = true; |
837 performPostLayoutTasks(); | 837 performPostLayoutTasks(); |
838 m_inSynchronousPostLayout = false; | 838 m_inSynchronousPostLayout = false; |
839 } | 839 } |
840 | 840 |
841 // Viewport-dependent media queries may cause us to need completely differen
t style information. | 841 // Viewport-dependent media queries may cause us to need completely differen
t style information. |
842 Document* document = m_frame->document(); | 842 Document* document = m_frame->document(); |
843 if (!document->styleResolverIfExists() || document->styleResolverIfExists()-
>affectedByViewportChange()) { | 843 if (!document->styleResolverIfExists() || document->styleResolverIfExists()-
>affectedByViewportChange()) { |
844 document->styleResolverChanged(RecalcStyleDeferred); | 844 document->styleResolverChanged(RecalcStyleDeferred); |
(...skipping 27 matching lines...) Expand all Loading... |
872 view->pushLayoutState(rootForThisLayout); | 872 view->pushLayoutState(rootForThisLayout); |
873 } | 873 } |
874 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootForThisLayo
ut->view() : 0); | 874 LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootForThisLayo
ut->view() : 0); |
875 | 875 |
876 m_inLayout = true; | 876 m_inLayout = true; |
877 beginDeferredRepaints(); | 877 beginDeferredRepaints(); |
878 forceLayoutParentViewIfNeeded(); | 878 forceLayoutParentViewIfNeeded(); |
879 | 879 |
880 rootForThisLayout->layout(); // THIS IS WHERE LAYOUT ACTUALLY HAPPENS. | 880 rootForThisLayout->layout(); // THIS IS WHERE LAYOUT ACTUALLY HAPPENS. |
881 | 881 |
882 bool autosized = frame()->document()->textAutosizer()->processSubtree(rootFo
rThisLayout); | 882 bool autosized = frame().document()->textAutosizer()->processSubtree(rootFor
ThisLayout); |
883 if (autosized && rootForThisLayout->needsLayout()) { | 883 if (autosized && rootForThisLayout->needsLayout()) { |
884 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); | 884 TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing"); |
885 rootForThisLayout->layout(); | 885 rootForThisLayout->layout(); |
886 } | 886 } |
887 | 887 |
888 endDeferredRepaints(); | 888 endDeferredRepaints(); |
889 m_inLayout = false; | 889 m_inLayout = false; |
890 | 890 |
891 if (inSubtreeLayout) | 891 if (inSubtreeLayout) |
892 rootForThisLayout->view()->popLayoutState(rootForThisLayout); | 892 rootForThisLayout->view()->popLayoutState(rootForThisLayout); |
893 } | 893 } |
894 | 894 |
895 void FrameView::scheduleOrPerformPostLayoutTasks() | 895 void FrameView::scheduleOrPerformPostLayoutTasks() |
896 { | 896 { |
897 if (m_postLayoutTasksTimer.isActive()) { | 897 if (m_postLayoutTasksTimer.isActive()) { |
898 m_actionScheduler->resume(); | 898 m_actionScheduler->resume(); |
899 return; | 899 return; |
900 } | 900 } |
901 | 901 |
902 if (!m_inSynchronousPostLayout) { | 902 if (!m_inSynchronousPostLayout) { |
903 if (frame()->document()->shouldDisplaySeamlesslyWithParent()) { | 903 if (frame().document()->shouldDisplaySeamlesslyWithParent()) { |
904 if (RenderView* renderView = this->renderView()) | 904 if (RenderView* renderView = this->renderView()) |
905 renderView->updateWidgetPositions(); | 905 renderView->updateWidgetPositions(); |
906 } else { | 906 } else { |
907 m_inSynchronousPostLayout = true; | 907 m_inSynchronousPostLayout = true; |
908 // Calls resumeScheduledEvents() | 908 // Calls resumeScheduledEvents() |
909 performPostLayoutTasks(); | 909 performPostLayoutTasks(); |
910 m_inSynchronousPostLayout = false; | 910 m_inSynchronousPostLayout = false; |
911 } | 911 } |
912 } | 912 } |
913 | 913 |
914 if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousP
ostLayout || frame()->document()->shouldDisplaySeamlesslyWithParent())) { | 914 if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousP
ostLayout || frame().document()->shouldDisplaySeamlesslyWithParent())) { |
915 // If we need layout or are already in a synchronous call to postLayoutT
asks(), | 915 // If we need layout or are already in a synchronous call to postLayoutT
asks(), |
916 // defer widget updates and event dispatch until after we return. postLa
youtTasks() | 916 // defer widget updates and event dispatch until after we return. postLa
youtTasks() |
917 // can make us need to update again, and we can get stuck in a nasty cyc
le unless | 917 // can make us need to update again, and we can get stuck in a nasty cyc
le unless |
918 // we call it through the timer here. | 918 // we call it through the timer here. |
919 m_postLayoutTasksTimer.startOneShot(0); | 919 m_postLayoutTasksTimer.startOneShot(0); |
920 if (needsLayout()) { | 920 if (needsLayout()) { |
921 m_actionScheduler->pause(); | 921 m_actionScheduler->pause(); |
922 layout(); | 922 layout(); |
923 } | 923 } |
924 } | 924 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 // Post-layout assert that nobody was re-marked as needing layout during lay
out. | 1090 // Post-layout assert that nobody was re-marked as needing layout during lay
out. |
1091 for (RenderObject* renderer = document->renderer(); renderer; renderer = ren
derer->nextInPreOrder()) | 1091 for (RenderObject* renderer = document->renderer(); renderer; renderer = ren
derer->nextInPreOrder()) |
1092 ASSERT(!renderer->needsLayout()); | 1092 ASSERT(!renderer->needsLayout()); |
1093 #endif | 1093 #endif |
1094 | 1094 |
1095 // FIXME: It should be not possible to remove the FrameView from the frame/p
age during layout | 1095 // FIXME: It should be not possible to remove the FrameView from the frame/p
age during layout |
1096 // however m_inLayout is not set for most of this function, so none of our R
ELEASE_ASSERTS | 1096 // however m_inLayout is not set for most of this function, so none of our R
ELEASE_ASSERTS |
1097 // in Frame/Page will fire. One of the post-layout tasks is disconnecting th
e Frame from | 1097 // in Frame/Page will fire. One of the post-layout tasks is disconnecting th
e Frame from |
1098 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht
ml | 1098 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht
ml |
1099 // necessitating this check here. | 1099 // necessitating this check here. |
1100 ASSERT(frame()); | |
1101 // ASSERT(frame()->page()); | 1100 // ASSERT(frame()->page()); |
1102 if (frame() && frame()->page()) | 1101 if (frame().page()) |
1103 frame()->page()->chrome().client().layoutUpdated(frame()); | 1102 frame().page()->chrome().client().layoutUpdated(m_frame.get()); |
1104 } | 1103 } |
1105 | 1104 |
1106 RenderBox* FrameView::embeddedContentBox() const | 1105 RenderBox* FrameView::embeddedContentBox() const |
1107 { | 1106 { |
1108 RenderView* renderView = this->renderView(); | 1107 RenderView* renderView = this->renderView(); |
1109 if (!renderView) | 1108 if (!renderView) |
1110 return 0; | 1109 return 0; |
1111 | 1110 |
1112 RenderObject* firstChild = renderView->firstChild(); | 1111 RenderObject* firstChild = renderView->firstChild(); |
1113 if (!firstChild || !firstChild->isBox()) | 1112 if (!firstChild || !firstChild->isBox()) |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje
cts->end(); | 1547 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje
cts->end(); |
1549 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained
Objects->begin(); it != end; ++it) { | 1548 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained
Objects->begin(); it != end; ++it) { |
1550 RenderObject* renderer = *it; | 1549 RenderObject* renderer = *it; |
1551 renderer->setNeedsLayout(); | 1550 renderer->setNeedsLayout(); |
1552 } | 1551 } |
1553 } | 1552 } |
1554 | 1553 |
1555 | 1554 |
1556 void FrameView::scrollPositionChanged() | 1555 void FrameView::scrollPositionChanged() |
1557 { | 1556 { |
1558 frame()->eventHandler()->sendScrollEvent(); | 1557 m_frame->eventHandler()->sendScrollEvent(); |
1559 frame()->eventHandler()->dispatchFakeMouseMoveEventSoon(); | 1558 m_frame->eventHandler()->dispatchFakeMouseMoveEventSoon(); |
1560 | 1559 |
1561 if (RenderView* renderView = this->renderView()) { | 1560 if (RenderView* renderView = this->renderView()) { |
1562 if (renderView->usesCompositing()) | 1561 if (renderView->usesCompositing()) |
1563 renderView->compositor()->frameViewDidScroll(); | 1562 renderView->compositor()->frameViewDidScroll(); |
1564 } | 1563 } |
1565 } | 1564 } |
1566 | 1565 |
1567 void FrameView::repaintFixedElementsAfterScrolling() | 1566 void FrameView::repaintFixedElementsAfterScrolling() |
1568 { | 1567 { |
1569 // For fixed position elements, update widget positions and compositing laye
rs after scrolling, | 1568 // For fixed position elements, update widget positions and compositing laye
rs after scrolling, |
1570 // but only if we're not inside of layout. | 1569 // but only if we're not inside of layout. |
1571 if (!m_nestedLayoutCount && hasViewportConstrainedObjects()) { | 1570 if (!m_nestedLayoutCount && hasViewportConstrainedObjects()) { |
1572 if (RenderView* renderView = this->renderView()) { | 1571 if (RenderView* renderView = this->renderView()) { |
1573 renderView->updateWidgetPositions(); | 1572 renderView->updateWidgetPositions(); |
1574 renderView->layer()->updateLayerPositionsAfterDocumentScroll(); | 1573 renderView->layer()->updateLayerPositionsAfterDocumentScroll(); |
1575 } | 1574 } |
1576 } | 1575 } |
1577 } | 1576 } |
1578 | 1577 |
1579 void FrameView::updateFixedElementsAfterScrolling() | 1578 void FrameView::updateFixedElementsAfterScrolling() |
1580 { | 1579 { |
1581 if (m_nestedLayoutCount <= 1 && hasViewportConstrainedObjects()) { | 1580 if (m_nestedLayoutCount <= 1 && hasViewportConstrainedObjects()) { |
1582 if (RenderView* renderView = this->renderView()) | 1581 if (RenderView* renderView = this->renderView()) |
1583 renderView->compositor()->updateCompositingLayers(CompositingUpdateO
nScroll); | 1582 renderView->compositor()->updateCompositingLayers(CompositingUpdateO
nScroll); |
1584 } | 1583 } |
1585 } | 1584 } |
1586 | 1585 |
1587 bool FrameView::shouldRubberBandInDirection(ScrollDirection direction) const | 1586 bool FrameView::shouldRubberBandInDirection(ScrollDirection direction) const |
1588 { | 1587 { |
1589 Page* page = frame() ? frame()->page() : 0; | 1588 Page* page = frame().page(); |
1590 if (!page) | 1589 if (!page) |
1591 return ScrollView::shouldRubberBandInDirection(direction); | 1590 return ScrollView::shouldRubberBandInDirection(direction); |
1592 return page->chrome().client().shouldRubberBandInDirection(direction); | 1591 return page->chrome().client().shouldRubberBandInDirection(direction); |
1593 } | 1592 } |
1594 | 1593 |
1595 bool FrameView::isRubberBandInProgress() const | 1594 bool FrameView::isRubberBandInProgress() const |
1596 { | 1595 { |
1597 if (scrollbarsSuppressed()) | 1596 if (scrollbarsSuppressed()) |
1598 return false; | 1597 return false; |
1599 | 1598 |
1600 // If the main thread updates the scroll position for this FrameView, we sho
uld return | 1599 // If the main thread updates the scroll position for this FrameView, we sho
uld return |
1601 // ScrollAnimator::isRubberBandInProgress(). | 1600 // ScrollAnimator::isRubberBandInProgress(). |
1602 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) | 1601 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) |
1603 return scrollAnimator->isRubberBandInProgress(); | 1602 return scrollAnimator->isRubberBandInProgress(); |
1604 | 1603 |
1605 return false; | 1604 return false; |
1606 } | 1605 } |
1607 | 1606 |
1608 bool FrameView::requestScrollPositionUpdate(const IntPoint& position) | 1607 bool FrameView::requestScrollPositionUpdate(const IntPoint& position) |
1609 { | 1608 { |
1610 return false; | 1609 return false; |
1611 } | 1610 } |
1612 | 1611 |
1613 HostWindow* FrameView::hostWindow() const | 1612 HostWindow* FrameView::hostWindow() const |
1614 { | 1613 { |
1615 Page* page = frame() ? frame()->page() : 0; | 1614 Page* page = frame().page(); |
1616 if (!page) | 1615 if (!page) |
1617 return 0; | 1616 return 0; |
1618 return &page->chrome(); | 1617 return &page->chrome(); |
1619 } | 1618 } |
1620 | 1619 |
1621 const unsigned cRepaintRectUnionThreshold = 25; | 1620 const unsigned cRepaintRectUnionThreshold = 25; |
1622 | 1621 |
1623 void FrameView::repaintContentRectangle(const IntRect& r) | 1622 void FrameView::repaintContentRectangle(const IntRect& r) |
1624 { | 1623 { |
1625 ASSERT(!m_frame->ownerElement()); | 1624 ASSERT(!m_frame->ownerElement()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1667 ScrollView::contentsResized(); | 1666 ScrollView::contentsResized(); |
1668 setNeedsLayout(); | 1667 setNeedsLayout(); |
1669 } | 1668 } |
1670 | 1669 |
1671 void FrameView::visibleContentsResized() | 1670 void FrameView::visibleContentsResized() |
1672 { | 1671 { |
1673 // We check to make sure the view is attached to a frame() as this method ca
n | 1672 // We check to make sure the view is attached to a frame() as this method ca
n |
1674 // be triggered before the view is attached by Frame::createView(...) settin
g | 1673 // be triggered before the view is attached by Frame::createView(...) settin
g |
1675 // various values such as setScrollBarModes(...) for example. An ASSERT is | 1674 // various values such as setScrollBarModes(...) for example. An ASSERT is |
1676 // triggered when a view is layout before being attached to a frame(). | 1675 // triggered when a view is layout before being attached to a frame(). |
1677 if (!frame()->view()) | 1676 if (!frame().view()) |
1678 return; | 1677 return; |
1679 | 1678 |
1680 if (!useFixedLayout() && needsLayout()) | 1679 if (!useFixedLayout() && needsLayout()) |
1681 layout(); | 1680 layout(); |
1682 | 1681 |
1683 if (RenderView* renderView = this->renderView()) { | 1682 if (RenderView* renderView = this->renderView()) { |
1684 if (renderView->usesCompositing()) | 1683 if (renderView->usesCompositing()) |
1685 renderView->compositor()->frameViewDidChangeSize(); | 1684 renderView->compositor()->frameViewDidChangeSize(); |
1686 } | 1685 } |
1687 } | 1686 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 if (!m_layoutSchedulingEnabled) | 1847 if (!m_layoutSchedulingEnabled) |
1849 return; | 1848 return; |
1850 if (!needsLayout()) | 1849 if (!needsLayout()) |
1851 return; | 1850 return; |
1852 if (!m_frame->document()->shouldScheduleLayout()) | 1851 if (!m_frame->document()->shouldScheduleLayout()) |
1853 return; | 1852 return; |
1854 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1853 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1855 | 1854 |
1856 // When frame seamless is enabled, the contents of the frame could affect th
e layout of the parent frames. | 1855 // When frame seamless is enabled, the contents of the frame could affect th
e layout of the parent frames. |
1857 // Also invalidate parent frame starting from the owner element of this fram
e. | 1856 // Also invalidate parent frame starting from the owner element of this fram
e. |
1858 if (m_frame->ownerRenderer() && frame()->document()->shouldDisplaySeamlessly
WithParent()) | 1857 if (m_frame->ownerRenderer() && m_frame->document()->shouldDisplaySeamlessly
WithParent()) |
1859 m_frame->ownerRenderer()->setNeedsLayout(); | 1858 m_frame->ownerRenderer()->setNeedsLayout(); |
1860 | 1859 |
1861 int delay = m_frame->document()->minimumLayoutDelay(); | 1860 int delay = m_frame->document()->minimumLayoutDelay(); |
1862 if (m_layoutTimer.isActive() && m_delayedLayout && !delay) | 1861 if (m_layoutTimer.isActive() && m_delayedLayout && !delay) |
1863 unscheduleRelayout(); | 1862 unscheduleRelayout(); |
1864 if (m_layoutTimer.isActive()) | 1863 if (m_layoutTimer.isActive()) |
1865 return; | 1864 return; |
1866 | 1865 |
1867 m_delayedLayout = delay != 0; | 1866 m_delayedLayout = delay != 0; |
1868 m_layoutTimer.startOneShot(delay * 0.001); | 1867 m_layoutTimer.startOneShot(delay * 0.001); |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 void FrameView::autoSizeIfEnabled() | 2252 void FrameView::autoSizeIfEnabled() |
2254 { | 2253 { |
2255 if (!m_shouldAutoSize) | 2254 if (!m_shouldAutoSize) |
2256 return; | 2255 return; |
2257 | 2256 |
2258 if (m_inAutoSize) | 2257 if (m_inAutoSize) |
2259 return; | 2258 return; |
2260 | 2259 |
2261 TemporaryChange<bool> changeInAutoSize(m_inAutoSize, true); | 2260 TemporaryChange<bool> changeInAutoSize(m_inAutoSize, true); |
2262 | 2261 |
2263 Document* document = frame()->document(); | 2262 Document* document = frame().document(); |
2264 if (!document) | 2263 if (!document) |
2265 return; | 2264 return; |
2266 | 2265 |
2267 RenderView* documentView = document->renderView(); | 2266 RenderView* documentView = document->renderView(); |
2268 Element* documentElement = document->documentElement(); | 2267 Element* documentElement = document->documentElement(); |
2269 if (!documentView || !documentElement) | 2268 if (!documentView || !documentElement) |
2270 return; | 2269 return; |
2271 | 2270 |
2272 RenderBox* documentRenderBox = documentElement->renderBox(); | 2271 RenderBox* documentRenderBox = documentElement->renderBox(); |
2273 if (!documentRenderBox) | 2272 if (!documentRenderBox) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 newSize.setHeight(m_maxAutoSize.height()); | 2326 newSize.setHeight(m_maxAutoSize.height()); |
2328 verticalScrollbarMode = ScrollbarAlwaysOn; | 2327 verticalScrollbarMode = ScrollbarAlwaysOn; |
2329 } | 2328 } |
2330 | 2329 |
2331 if (newSize == size) | 2330 if (newSize == size) |
2332 continue; | 2331 continue; |
2333 | 2332 |
2334 // While loading only allow the size to increase (to avoid twitching dur
ing intermediate smaller states) | 2333 // While loading only allow the size to increase (to avoid twitching dur
ing intermediate smaller states) |
2335 // unless autoresize has just been turned on or the maximum size is smal
ler than the current size. | 2334 // unless autoresize has just been turned on or the maximum size is smal
ler than the current size. |
2336 if (m_didRunAutosize && size.height() <= m_maxAutoSize.height() && size.
width() <= m_maxAutoSize.width() | 2335 if (m_didRunAutosize && size.height() <= m_maxAutoSize.height() && size.
width() <= m_maxAutoSize.width() |
2337 && !frame()->document()->loadEventFinished() && (newSize.height() <
size.height() || newSize.width() < size.width())) | 2336 && !m_frame->document()->loadEventFinished() && (newSize.height() <
size.height() || newSize.width() < size.width())) |
2338 break; | 2337 break; |
2339 | 2338 |
2340 resize(newSize.width(), newSize.height()); | 2339 resize(newSize.width(), newSize.height()); |
2341 // Force the scrollbar state to avoid the scrollbar code adding them and
causing them to be needed. For example, | 2340 // Force the scrollbar state to avoid the scrollbar code adding them and
causing them to be needed. For example, |
2342 // a vertical scrollbar may cause text to wrap and thus increase the hei
ght (which is the only reason the scollbar is needed). | 2341 // a vertical scrollbar may cause text to wrap and thus increase the hei
ght (which is the only reason the scollbar is needed). |
2343 setVerticalScrollbarLock(false); | 2342 setVerticalScrollbarLock(false); |
2344 setHorizontalScrollbarLock(false); | 2343 setHorizontalScrollbarLock(false); |
2345 setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, t
rue); | 2344 setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, t
rue); |
2346 } | 2345 } |
2347 m_didRunAutosize = true; | 2346 m_didRunAutosize = true; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2434 if (clipToLayerContents) | 2433 if (clipToLayerContents) |
2435 clipRect = pixelSnappedIntRect(enclosingLayer->childrenClipRect()); | 2434 clipRect = pixelSnappedIntRect(enclosingLayer->childrenClipRect()); |
2436 else | 2435 else |
2437 clipRect = pixelSnappedIntRect(enclosingLayer->selfClipRect()); | 2436 clipRect = pixelSnappedIntRect(enclosingLayer->selfClipRect()); |
2438 clipRect = contentsToWindow(clipRect); | 2437 clipRect = contentsToWindow(clipRect); |
2439 return intersection(clipRect, windowClipRect()); | 2438 return intersection(clipRect, windowClipRect()); |
2440 } | 2439 } |
2441 | 2440 |
2442 bool FrameView::isActive() const | 2441 bool FrameView::isActive() const |
2443 { | 2442 { |
2444 Page* page = frame()->page(); | 2443 Page* page = frame().page(); |
2445 return page && page->focusController().isActive(); | 2444 return page && page->focusController().isActive(); |
2446 } | 2445 } |
2447 | 2446 |
2448 void FrameView::scrollTo(const IntSize& newOffset) | 2447 void FrameView::scrollTo(const IntSize& newOffset) |
2449 { | 2448 { |
2450 LayoutSize offset = scrollOffset(); | 2449 LayoutSize offset = scrollOffset(); |
2451 ScrollView::scrollTo(newOffset); | 2450 ScrollView::scrollTo(newOffset); |
2452 if (offset != scrollOffset()) | 2451 if (offset != scrollOffset()) |
2453 scrollPositionChanged(); | 2452 scrollPositionChanged(); |
2454 frame()->loader()->client()->didChangeScrollOffset(); | 2453 frame().loader()->client()->didChangeScrollOffset(); |
2455 } | 2454 } |
2456 | 2455 |
2457 void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec
t) | 2456 void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec
t) |
2458 { | 2457 { |
2459 // Add in our offset within the FrameView. | 2458 // Add in our offset within the FrameView. |
2460 IntRect dirtyRect = rect; | 2459 IntRect dirtyRect = rect; |
2461 dirtyRect.moveBy(scrollbar->location()); | 2460 dirtyRect.moveBy(scrollbar->location()); |
2462 invalidateRect(dirtyRect); | 2461 invalidateRect(dirtyRect); |
2463 } | 2462 } |
2464 | 2463 |
2465 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const | 2464 void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const |
2466 { | 2465 { |
2467 tickmarks = frame()->document()->markers()->renderedRectsForMarkers(Document
Marker::TextMatch); | 2466 tickmarks = frame().document()->markers()->renderedRectsForMarkers(DocumentM
arker::TextMatch); |
2468 } | 2467 } |
2469 | 2468 |
2470 IntRect FrameView::windowResizerRect() const | 2469 IntRect FrameView::windowResizerRect() const |
2471 { | 2470 { |
2472 Page* page = frame() ? frame()->page() : 0; | 2471 Page* page = frame().page(); |
2473 if (!page) | 2472 if (!page) |
2474 return IntRect(); | 2473 return IntRect(); |
2475 return page->chrome().windowResizerRect(); | 2474 return page->chrome().windowResizerRect(); |
2476 } | 2475 } |
2477 | 2476 |
2478 void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor) | 2477 void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor) |
2479 { | 2478 { |
2480 if (m_visibleContentScaleFactor == visibleContentScaleFactor) | 2479 if (m_visibleContentScaleFactor == visibleContentScaleFactor) |
2481 return; | 2480 return; |
2482 | 2481 |
(...skipping 10 matching lines...) Expand all Loading... |
2493 } | 2492 } |
2494 | 2493 |
2495 ScrollableArea* FrameView::enclosingScrollableArea() const | 2494 ScrollableArea* FrameView::enclosingScrollableArea() const |
2496 { | 2495 { |
2497 // FIXME: Walk up the frame tree and look for a scrollable parent frame or R
enderLayer. | 2496 // FIXME: Walk up the frame tree and look for a scrollable parent frame or R
enderLayer. |
2498 return 0; | 2497 return 0; |
2499 } | 2498 } |
2500 | 2499 |
2501 IntRect FrameView::scrollableAreaBoundingBox() const | 2500 IntRect FrameView::scrollableAreaBoundingBox() const |
2502 { | 2501 { |
2503 RenderPart* ownerRenderer = frame()->ownerRenderer(); | 2502 RenderPart* ownerRenderer = frame().ownerRenderer(); |
2504 if (!ownerRenderer) | 2503 if (!ownerRenderer) |
2505 return frameRect(); | 2504 return frameRect(); |
2506 | 2505 |
2507 return ownerRenderer->absoluteContentQuad().enclosingBoundingBox(); | 2506 return ownerRenderer->absoluteContentQuad().enclosingBoundingBox(); |
2508 } | 2507 } |
2509 | 2508 |
2510 bool FrameView::isScrollable() | 2509 bool FrameView::isScrollable() |
2511 { | 2510 { |
2512 // Check for: | 2511 // Check for: |
2513 // 1) If there an actual overflow. | 2512 // 1) If there an actual overflow. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2701 ScrollView::paintScrollbar(context, bar, rect); | 2700 ScrollView::paintScrollbar(context, bar, rect); |
2702 } | 2701 } |
2703 | 2702 |
2704 StyleColor FrameView::documentBackgroundColor() const | 2703 StyleColor FrameView::documentBackgroundColor() const |
2705 { | 2704 { |
2706 // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background c
olor of | 2705 // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background c
olor of |
2707 // the document and the body against the base background color of the frame
view. | 2706 // the document and the body against the base background color of the frame
view. |
2708 // Background images are unfortunately impractical to include. | 2707 // Background images are unfortunately impractical to include. |
2709 | 2708 |
2710 // Return invalid Color objects whenever there is insufficient information. | 2709 // Return invalid Color objects whenever there is insufficient information. |
2711 if (!frame()->document()) | 2710 if (!frame().document()) |
2712 return Color(); | 2711 return Color(); |
2713 | 2712 |
2714 Element* htmlElement = frame()->document()->documentElement(); | 2713 Element* htmlElement = frame().document()->documentElement(); |
2715 Element* bodyElement = frame()->document()->body(); | 2714 Element* bodyElement = frame().document()->body(); |
2716 | 2715 |
2717 // Start with invalid colors. | 2716 // Start with invalid colors. |
2718 StyleColor htmlBackgroundColor; | 2717 StyleColor htmlBackgroundColor; |
2719 StyleColor bodyBackgroundColor; | 2718 StyleColor bodyBackgroundColor; |
2720 if (htmlElement && htmlElement->renderer()) | 2719 if (htmlElement && htmlElement->renderer()) |
2721 htmlBackgroundColor = htmlElement->renderer()->resolveStyleColor(CSSProp
ertyBackgroundColor); | 2720 htmlBackgroundColor = htmlElement->renderer()->resolveStyleColor(CSSProp
ertyBackgroundColor); |
2722 if (bodyElement && bodyElement->renderer()) | 2721 if (bodyElement && bodyElement->renderer()) |
2723 bodyBackgroundColor = bodyElement->renderer()->resolveStyleColor(CSSProp
ertyBackgroundColor); | 2722 bodyBackgroundColor = bodyElement->renderer()->resolveStyleColor(CSSProp
ertyBackgroundColor); |
2724 | 2723 |
2725 if (!bodyBackgroundColor.isValid()) { | 2724 if (!bodyBackgroundColor.isValid()) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2804 void FrameView::setWasScrolledByUser(bool wasScrolledByUser) | 2803 void FrameView::setWasScrolledByUser(bool wasScrolledByUser) |
2805 { | 2804 { |
2806 if (m_inProgrammaticScroll) | 2805 if (m_inProgrammaticScroll) |
2807 return; | 2806 return; |
2808 m_maintainScrollPositionAnchor = 0; | 2807 m_maintainScrollPositionAnchor = 0; |
2809 m_wasScrolledByUser = wasScrolledByUser; | 2808 m_wasScrolledByUser = wasScrolledByUser; |
2810 } | 2809 } |
2811 | 2810 |
2812 void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) | 2811 void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) |
2813 { | 2812 { |
2814 if (!frame()) | |
2815 return; | |
2816 | |
2817 Document* document = m_frame->document(); | 2813 Document* document = m_frame->document(); |
2818 | 2814 |
2819 #ifndef NDEBUG | 2815 #ifndef NDEBUG |
2820 bool fillWithRed; | 2816 bool fillWithRed; |
2821 if (document->printing()) | 2817 if (document->printing()) |
2822 fillWithRed = false; // Printing, don't fill with red (can't remember wh
y). | 2818 fillWithRed = false; // Printing, don't fill with red (can't remember wh
y). |
2823 else if (m_frame->ownerElement()) | 2819 else if (m_frame->ownerElement()) |
2824 fillWithRed = false; // Subframe, don't fill with red. | 2820 fillWithRed = false; // Subframe, don't fill with red. |
2825 else if (isTransparent()) | 2821 else if (isTransparent()) |
2826 fillWithRed = false; // Transparent, don't fill with red. | 2822 fillWithRed = false; // Transparent, don't fill with red. |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3336 { | 3332 { |
3337 RenderView* renderView = this->renderView(); | 3333 RenderView* renderView = this->renderView(); |
3338 if (!renderView) | 3334 if (!renderView) |
3339 return false; | 3335 return false; |
3340 | 3336 |
3341 return renderView->style()->isFlippedBlocksWritingMode(); | 3337 return renderView->style()->isFlippedBlocksWritingMode(); |
3342 } | 3338 } |
3343 | 3339 |
3344 AXObjectCache* FrameView::axObjectCache() const | 3340 AXObjectCache* FrameView::axObjectCache() const |
3345 { | 3341 { |
3346 if (frame() && frame()->document()) | 3342 if (frame().document()) |
3347 return frame()->document()->existingAXObjectCache(); | 3343 return frame().document()->existingAXObjectCache(); |
3348 return 0; | 3344 return 0; |
3349 } | 3345 } |
3350 | 3346 |
3351 } // namespace WebCore | 3347 } // namespace WebCore |
OLD | NEW |