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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 | 887 |
888 Document* document = m_frame->document(); | 888 Document* document = m_frame->document(); |
889 bool inSubtreeLayout = isSubtreeLayout(); | 889 bool inSubtreeLayout = isSubtreeLayout(); |
890 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderer(); | 890 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderer(); |
891 if (!rootForThisLayout) { | 891 if (!rootForThisLayout) { |
892 // FIXME: Do we need to set m_size here? | 892 // FIXME: Do we need to set m_size here? |
893 ASSERT_NOT_REACHED(); | 893 ASSERT_NOT_REACHED(); |
894 return; | 894 return; |
895 } | 895 } |
896 | 896 |
897 bool shouldDoFullLayout = false; | |
898 FontCachePurgePreventer fontCachePurgePreventer; | 897 FontCachePurgePreventer fontCachePurgePreventer; |
899 RenderLayer* layer; | 898 RenderLayer* layer; |
900 { | 899 { |
901 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); | 900 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); |
902 | 901 |
903 m_nestedLayoutCount++; | 902 m_nestedLayoutCount++; |
904 if (!inSubtreeLayout) { | 903 if (!inSubtreeLayout) { |
905 Document* document = m_frame->document(); | 904 Document* document = m_frame->document(); |
906 Node* body = document->body(); | 905 Node* body = document->body(); |
907 if (body && body->renderer()) { | 906 if (body && body->renderer()) { |
908 if (isHTMLFrameSetElement(*body)) { | 907 if (isHTMLFrameSetElement(*body)) { |
909 body->renderer()->setChildNeedsLayout(); | 908 body->renderer()->setChildNeedsLayout(); |
910 } else if (isHTMLBodyElement(*body)) { | 909 } else if (isHTMLBodyElement(*body)) { |
911 if (!m_firstLayout && m_size.height() != layoutSize().height
() && body->renderer()->enclosingBox()->stretchesToViewport()) | 910 if (!m_firstLayout && m_size.height() != layoutSize().height
() && body->renderer()->enclosingBox()->stretchesToViewport()) |
912 body->renderer()->setChildNeedsLayout(); | 911 body->renderer()->setChildNeedsLayout(); |
913 } | 912 } |
914 } | 913 } |
915 } | 914 } |
916 updateCounters(); | 915 updateCounters(); |
917 autoSizeIfEnabled(); | 916 autoSizeIfEnabled(); |
918 | 917 |
919 ScrollbarMode hMode; | 918 ScrollbarMode hMode; |
920 ScrollbarMode vMode; | 919 ScrollbarMode vMode; |
921 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); | 920 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); |
922 | 921 |
923 shouldDoFullLayout = !inSubtreeLayout && (m_firstLayout || toRenderView(
rootForThisLayout)->document().printing()); | |
924 | |
925 if (!inSubtreeLayout) { | 922 if (!inSubtreeLayout) { |
926 // Now set our scrollbar state for the layout. | 923 // Now set our scrollbar state for the layout. |
927 ScrollbarMode currentHMode = horizontalScrollbarMode(); | 924 ScrollbarMode currentHMode = horizontalScrollbarMode(); |
928 ScrollbarMode currentVMode = verticalScrollbarMode(); | 925 ScrollbarMode currentVMode = verticalScrollbarMode(); |
929 | 926 |
930 if (m_firstLayout) { | 927 if (m_firstLayout) { |
931 setScrollbarsSuppressed(true); | 928 setScrollbarsSuppressed(true); |
932 | 929 |
| 930 m_doFullRepaint = true; |
933 m_firstLayout = false; | 931 m_firstLayout = false; |
934 m_firstLayoutCallbackPending = true; | 932 m_firstLayoutCallbackPending = true; |
935 m_lastViewportSize = layoutSize(IncludeScrollbars); | 933 m_lastViewportSize = layoutSize(IncludeScrollbars); |
936 m_lastZoomFactor = rootForThisLayout->style()->zoom(); | 934 m_lastZoomFactor = rootForThisLayout->style()->zoom(); |
937 | 935 |
938 // Set the initial vMode to AlwaysOn if we're auto. | 936 // Set the initial vMode to AlwaysOn if we're auto. |
939 if (vMode == ScrollbarAuto) | 937 if (vMode == ScrollbarAuto) |
940 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes
a vertical scrollbar to appear. | 938 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes
a vertical scrollbar to appear. |
941 // Set the initial hMode to AlwaysOff if we're auto. | 939 // Set the initial hMode to AlwaysOff if we're auto. |
942 if (hMode == ScrollbarAuto) | 940 if (hMode == ScrollbarAuto) |
943 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus
es a horizontal scrollbar to disappear. | 941 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus
es a horizontal scrollbar to disappear. |
944 | 942 |
945 setScrollbarModes(hMode, vMode); | 943 setScrollbarModes(hMode, vMode); |
946 setScrollbarsSuppressed(false, true); | 944 setScrollbarsSuppressed(false, true); |
947 } else if (hMode != currentHMode || vMode != currentVMode) { | 945 } else if (hMode != currentHMode || vMode != currentVMode) { |
948 setScrollbarModes(hMode, vMode); | 946 setScrollbarModes(hMode, vMode); |
949 } | 947 } |
950 | 948 |
951 LayoutSize oldSize = m_size; | 949 LayoutSize oldSize = m_size; |
952 | 950 |
953 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); | 951 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); |
954 | 952 |
955 if (oldSize != m_size) { | 953 if (oldSize != m_size && !m_firstLayout) { |
956 shouldDoFullLayout = true; | 954 RenderBox* rootRenderer = document->documentElement() ? document
->documentElement()->renderBox() : 0; |
957 if (!m_firstLayout) { | 955 RenderBox* bodyRenderer = rootRenderer && document->body() ? doc
ument->body()->renderBox() : 0; |
958 RenderBox* rootRenderer = document->documentElement() ? docu
ment->documentElement()->renderBox() : 0; | 956 if (bodyRenderer && bodyRenderer->stretchesToViewport()) |
959 RenderBox* bodyRenderer = rootRenderer && document->body() ?
document->body()->renderBox() : 0; | 957 bodyRenderer->setChildNeedsLayout(); |
960 if (bodyRenderer && bodyRenderer->stretchesToViewport()) | 958 else if (rootRenderer && rootRenderer->stretchesToViewport()) |
961 bodyRenderer->setChildNeedsLayout(); | 959 rootRenderer->setChildNeedsLayout(); |
962 else if (rootRenderer && rootRenderer->stretchesToViewport()
) | |
963 rootRenderer->setChildNeedsLayout(); | |
964 } | |
965 } | 960 } |
| 961 |
| 962 // We need to set m_doFullRepaint before triggering layout as Render
Object::checkForRepaint |
| 963 // checks the boolean to disable local repaints. |
| 964 m_doFullRepaint |= renderView()->shouldDoFullRepaintForNextLayout(); |
966 } | 965 } |
967 | 966 |
968 layer = rootForThisLayout->enclosingLayer(); | 967 layer = rootForThisLayout->enclosingLayer(); |
969 | 968 |
970 // We need to set m_doFullRepaint before triggering layout as RenderObje
ct::checkForRepaint | |
971 // checks the boolean to disable local repaints. | |
972 m_doFullRepaint |= shouldDoFullLayout; | |
973 | |
974 performLayout(rootForThisLayout, inSubtreeLayout); | 969 performLayout(rootForThisLayout, inSubtreeLayout); |
975 | 970 |
976 m_layoutSubtreeRoot = 0; | 971 m_layoutSubtreeRoot = 0; |
977 } // Reset m_layoutSchedulingEnabled to its previous value. | 972 } // Reset m_layoutSchedulingEnabled to its previous value. |
978 | 973 |
979 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin
g()) | 974 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin
g()) |
980 adjustViewSize(); | 975 adjustViewSize(); |
981 | 976 |
982 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos
itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); | 977 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos
itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); |
983 renderView()->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter
Layout); | 978 renderView()->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter
Layout); |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 | 1923 |
1929 RenderView* renderView = this->renderView(); | 1924 RenderView* renderView = this->renderView(); |
1930 return layoutPending() | 1925 return layoutPending() |
1931 || (renderView && renderView->needsLayout()) | 1926 || (renderView && renderView->needsLayout()) |
1932 || isSubtreeLayout(); | 1927 || isSubtreeLayout(); |
1933 } | 1928 } |
1934 | 1929 |
1935 void FrameView::setNeedsLayout() | 1930 void FrameView::setNeedsLayout() |
1936 { | 1931 { |
1937 if (RenderView* renderView = this->renderView()) | 1932 if (RenderView* renderView = this->renderView()) |
1938 renderView->setNeedsLayoutAndFullRepaint(); | 1933 renderView->setNeedsLayout(); |
1939 } | 1934 } |
1940 | 1935 |
1941 bool FrameView::isTransparent() const | 1936 bool FrameView::isTransparent() const |
1942 { | 1937 { |
1943 return m_isTransparent; | 1938 return m_isTransparent; |
1944 } | 1939 } |
1945 | 1940 |
1946 void FrameView::setTransparent(bool isTransparent) | 1941 void FrameView::setTransparent(bool isTransparent) |
1947 { | 1942 { |
1948 m_isTransparent = isTransparent; | 1943 m_isTransparent = isTransparent; |
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3286 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3281 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
3287 { | 3282 { |
3288 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3283 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
3289 if (AXObjectCache* cache = axObjectCache()) { | 3284 if (AXObjectCache* cache = axObjectCache()) { |
3290 cache->remove(scrollbar); | 3285 cache->remove(scrollbar); |
3291 cache->handleScrollbarUpdate(this); | 3286 cache->handleScrollbarUpdate(this); |
3292 } | 3287 } |
3293 } | 3288 } |
3294 | 3289 |
3295 } // namespace WebCore | 3290 } // namespace WebCore |
OLD | NEW |