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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 const HTMLFrameOwnerElement* owner = m_frame->ownerElement(); | 589 const HTMLFrameOwnerElement* owner = m_frame->ownerElement(); |
590 if (owner && (owner->scrollingMode() == ScrollbarAlwaysOff)) { | 590 if (owner && (owner->scrollingMode() == ScrollbarAlwaysOff)) { |
591 hMode = ScrollbarAlwaysOff; | 591 hMode = ScrollbarAlwaysOff; |
592 vMode = ScrollbarAlwaysOff; | 592 vMode = ScrollbarAlwaysOff; |
593 return; | 593 return; |
594 } | 594 } |
595 | 595 |
596 if (m_canHaveScrollbars || strategy == RulesFromWebContentOnly) { | 596 if (m_canHaveScrollbars || strategy == RulesFromWebContentOnly) { |
597 hMode = ScrollbarAuto; | 597 hMode = ScrollbarAuto; |
598 // Seamless documents begin with heights of 0; we special case that here | 598 vMode = ScrollbarAuto; |
599 // to correctly render documents that don't need scrollbars. | |
600 IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size(); | |
601 bool isSeamlessDocument = frame().document() && frame().document()->shou
ldDisplaySeamlesslyWithParent(); | |
602 vMode = (isSeamlessDocument && !fullVisibleSize.height()) ? ScrollbarAlw
aysOff : ScrollbarAuto; | |
603 } else { | 599 } else { |
604 hMode = ScrollbarAlwaysOff; | 600 hMode = ScrollbarAlwaysOff; |
605 vMode = ScrollbarAlwaysOff; | 601 vMode = ScrollbarAlwaysOff; |
606 } | 602 } |
607 | 603 |
608 if (!m_layoutRoot) { | 604 if (!m_layoutRoot) { |
609 Document* document = m_frame->document(); | 605 Document* document = m_frame->document(); |
610 Node* documentElement = document->documentElement(); | 606 Node* documentElement = document->documentElement(); |
611 RenderObject* rootRenderer = documentElement ? documentElement->renderer
() : 0; | 607 RenderObject* rootRenderer = documentElement ? documentElement->renderer
() : 0; |
612 Node* body = document->body(); | 608 Node* body = document->body(); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 frameView->layout(); | 774 frameView->layout(); |
779 } | 775 } |
780 | 776 |
781 void FrameView::performPreLayoutTasks() | 777 void FrameView::performPreLayoutTasks() |
782 { | 778 { |
783 TRACE_EVENT0("webkit", "FrameView::performPreLayoutTasks"); | 779 TRACE_EVENT0("webkit", "FrameView::performPreLayoutTasks"); |
784 | 780 |
785 // Don't schedule more layouts, we're in one. | 781 // Don't schedule more layouts, we're in one. |
786 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, fal
se); | 782 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, fal
se); |
787 | 783 |
788 if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksT
imer.isActive() && !frame().document()->shouldDisplaySeamlesslyWithParent()) { | 784 if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksT
imer.isActive()) { |
789 // This is a new top-level layout. If there are any remaining tasks from
the previous layout, finish them now. | 785 // This is a new top-level layout. If there are any remaining tasks from
the previous layout, finish them now. |
790 m_inSynchronousPostLayout = true; | 786 m_inSynchronousPostLayout = true; |
791 performPostLayoutTasks(); | 787 performPostLayoutTasks(); |
792 m_inSynchronousPostLayout = false; | 788 m_inSynchronousPostLayout = false; |
793 } | 789 } |
794 | 790 |
795 Document* document = m_frame->document(); | 791 Document* document = m_frame->document(); |
796 document->notifyResizeForViewportUnits(); | 792 document->notifyResizeForViewportUnits(); |
797 | 793 |
798 // Viewport-dependent media queries may cause us to need completely differen
t style information. | 794 // Viewport-dependent media queries may cause us to need completely differen
t style information. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 | 860 |
865 void FrameView::scheduleOrPerformPostLayoutTasks() | 861 void FrameView::scheduleOrPerformPostLayoutTasks() |
866 { | 862 { |
867 if (m_postLayoutTasksTimer.isActive()) | 863 if (m_postLayoutTasksTimer.isActive()) |
868 return; | 864 return; |
869 | 865 |
870 // Partial layouts should not happen with synchronous post layouts. | 866 // Partial layouts should not happen with synchronous post layouts. |
871 ASSERT(!(m_inSynchronousPostLayout && partialLayout().isStopping())); | 867 ASSERT(!(m_inSynchronousPostLayout && partialLayout().isStopping())); |
872 | 868 |
873 if (!m_inSynchronousPostLayout) { | 869 if (!m_inSynchronousPostLayout) { |
874 if (frame().document()->shouldDisplaySeamlesslyWithParent()) { | 870 m_inSynchronousPostLayout = true; |
875 updateWidgetPositions(); | 871 // Calls resumeScheduledEvents() |
876 } else { | 872 performPostLayoutTasks(); |
877 m_inSynchronousPostLayout = true; | 873 m_inSynchronousPostLayout = false; |
878 // Calls resumeScheduledEvents() | |
879 performPostLayoutTasks(); | |
880 m_inSynchronousPostLayout = false; | |
881 } | |
882 } | 874 } |
883 | 875 |
884 if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousP
ostLayout || frame().document()->shouldDisplaySeamlesslyWithParent())) { | 876 if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousP
ostLayout)) { |
885 // If we need layout or are already in a synchronous call to postLayoutT
asks(), | 877 // If we need layout or are already in a synchronous call to postLayoutT
asks(), |
886 // defer widget updates and event dispatch until after we return. postLa
youtTasks() | 878 // defer widget updates and event dispatch until after we return. postLa
youtTasks() |
887 // can make us need to update again, and we can get stuck in a nasty cyc
le unless | 879 // can make us need to update again, and we can get stuck in a nasty cyc
le unless |
888 // we call it through the timer here. | 880 // we call it through the timer here. |
889 m_postLayoutTasksTimer.startOneShot(0); | 881 m_postLayoutTasksTimer.startOneShot(0); |
890 if (!partialLayout().isStopping() && needsLayout()) | 882 if (!partialLayout().isStopping() && needsLayout()) |
891 layout(); | 883 layout(); |
892 } | 884 } |
893 } | 885 } |
894 | 886 |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 m_layoutRoot = 0; | 1774 m_layoutRoot = 0; |
1783 } | 1775 } |
1784 if (!m_layoutSchedulingEnabled) | 1776 if (!m_layoutSchedulingEnabled) |
1785 return; | 1777 return; |
1786 if (!needsLayout()) | 1778 if (!needsLayout()) |
1787 return; | 1779 return; |
1788 if (!m_frame->document()->shouldScheduleLayout()) | 1780 if (!m_frame->document()->shouldScheduleLayout()) |
1789 return; | 1781 return; |
1790 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1782 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1791 | 1783 |
1792 // When frame seamless is enabled, the contents of the frame could affect th
e layout of the parent frames. | |
1793 // Also invalidate parent frame starting from the owner element of this fram
e. | |
1794 if (m_frame->ownerRenderer() && m_frame->document()->shouldDisplaySeamlessly
WithParent()) | |
1795 m_frame->ownerRenderer()->setNeedsLayout(); | |
1796 | |
1797 int delay = m_frame->document()->minimumLayoutDelay(); | 1784 int delay = m_frame->document()->minimumLayoutDelay(); |
1798 if (m_layoutTimer.isActive() && m_delayedLayout && !delay) | 1785 if (m_layoutTimer.isActive() && m_delayedLayout && !delay) |
1799 unscheduleRelayout(); | 1786 unscheduleRelayout(); |
1800 if (m_layoutTimer.isActive()) | 1787 if (m_layoutTimer.isActive()) |
1801 return; | 1788 return; |
1802 | 1789 |
1803 m_delayedLayout = delay != 0; | 1790 m_delayedLayout = delay != 0; |
1804 m_layoutTimer.startOneShot(delay * 0.001); | 1791 m_layoutTimer.startOneShot(delay * 0.001); |
1805 } | 1792 } |
1806 | 1793 |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2802 // Grab a copy of the children() set, as it may be mutated by the following
updateLayoutAndStyleIfNeededRecursive | 2789 // Grab a copy of the children() set, as it may be mutated by the following
updateLayoutAndStyleIfNeededRecursive |
2803 // calls, as they can potentially re-enter a layout of the parent frame view
, which may add/remove scrollbars | 2790 // calls, as they can potentially re-enter a layout of the parent frame view
, which may add/remove scrollbars |
2804 // and thus mutates the children() set. | 2791 // and thus mutates the children() set. |
2805 Vector<RefPtr<FrameView> > frameViews; | 2792 Vector<RefPtr<FrameView> > frameViews; |
2806 collectFrameViewChildren(this, frameViews); | 2793 collectFrameViewChildren(this, frameViews); |
2807 | 2794 |
2808 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); | 2795 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); |
2809 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end
; ++it) | 2796 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end
; ++it) |
2810 (*it)->updateLayoutAndStyleIfNeededRecursive(); | 2797 (*it)->updateLayoutAndStyleIfNeededRecursive(); |
2811 | 2798 |
2812 // When seamless is on, child frame can mark parent frame dirty. In such cas
e, child frame | |
2813 // needs to call layout on parent frame recursively. | |
2814 // This assert ensures that parent frames are clean, when child frames finis
hed updating layout and style. | 2799 // This assert ensures that parent frames are clean, when child frames finis
hed updating layout and style. |
2815 ASSERT(!needsLayout()); | 2800 ASSERT(!needsLayout()); |
2816 } | 2801 } |
2817 | 2802 |
2818 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In
tSize& maxSize) | 2803 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In
tSize& maxSize) |
2819 { | 2804 { |
2820 ASSERT(!enable || !minSize.isEmpty()); | 2805 ASSERT(!enable || !minSize.isEmpty()); |
2821 ASSERT(minSize.width() <= maxSize.width()); | 2806 ASSERT(minSize.width() <= maxSize.width()); |
2822 ASSERT(minSize.height() <= maxSize.height()); | 2807 ASSERT(minSize.height() <= maxSize.height()); |
2823 | 2808 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3209 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3194 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
3210 { | 3195 { |
3211 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3196 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
3212 if (AXObjectCache* cache = axObjectCache()) { | 3197 if (AXObjectCache* cache = axObjectCache()) { |
3213 cache->remove(scrollbar); | 3198 cache->remove(scrollbar); |
3214 cache->handleScrollbarUpdate(this); | 3199 cache->handleScrollbarUpdate(this); |
3215 } | 3200 } |
3216 } | 3201 } |
3217 | 3202 |
3218 } // namespace WebCore | 3203 } // namespace WebCore |
OLD | NEW |