| 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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 | 876 |
| 877 Document* document = m_frame->document(); | 877 Document* document = m_frame->document(); |
| 878 bool inSubtreeLayout = isSubtreeLayout(); | 878 bool inSubtreeLayout = isSubtreeLayout(); |
| 879 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderer(); | 879 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderer(); |
| 880 if (!rootForThisLayout) { | 880 if (!rootForThisLayout) { |
| 881 // FIXME: Do we need to set m_size here? | 881 // FIXME: Do we need to set m_size here? |
| 882 ASSERT_NOT_REACHED(); | 882 ASSERT_NOT_REACHED(); |
| 883 return; | 883 return; |
| 884 } | 884 } |
| 885 | 885 |
| 886 bool shouldDoFullLayout = false; | |
| 887 FontCachePurgePreventer fontCachePurgePreventer; | 886 FontCachePurgePreventer fontCachePurgePreventer; |
| 888 RenderLayer* layer; | 887 RenderLayer* layer; |
| 889 { | 888 { |
| 890 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); | 889 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); |
| 891 | 890 |
| 892 m_nestedLayoutCount++; | 891 m_nestedLayoutCount++; |
| 893 if (!inSubtreeLayout) { | 892 if (!inSubtreeLayout) { |
| 894 Document* document = m_frame->document(); | 893 Document* document = m_frame->document(); |
| 895 Node* body = document->body(); | 894 Node* body = document->body(); |
| 896 if (body && body->renderer()) { | 895 if (body && body->renderer()) { |
| 897 if (isHTMLFrameSetElement(*body)) { | 896 if (isHTMLFrameSetElement(*body)) { |
| 898 body->renderer()->setChildNeedsLayout(); | 897 body->renderer()->setChildNeedsLayout(); |
| 899 } else if (isHTMLBodyElement(*body)) { | 898 } else if (isHTMLBodyElement(*body)) { |
| 900 if (!m_firstLayout && m_size.height() != layoutSize().height
() && body->renderer()->enclosingBox()->stretchesToViewport()) | 899 if (!m_firstLayout && m_size.height() != layoutSize().height
() && body->renderer()->enclosingBox()->stretchesToViewport()) |
| 901 body->renderer()->setChildNeedsLayout(); | 900 body->renderer()->setChildNeedsLayout(); |
| 902 } | 901 } |
| 903 } | 902 } |
| 904 } | 903 } |
| 905 updateCounters(); | 904 updateCounters(); |
| 906 autoSizeIfEnabled(); | 905 autoSizeIfEnabled(); |
| 907 | 906 |
| 908 ScrollbarMode hMode; | 907 ScrollbarMode hMode; |
| 909 ScrollbarMode vMode; | 908 ScrollbarMode vMode; |
| 910 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); | 909 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); |
| 911 | 910 |
| 912 shouldDoFullLayout = !inSubtreeLayout && (m_firstLayout || toRenderView(
rootForThisLayout)->document().printing()); | 911 bool shouldDoFullRepaint = !inSubtreeLayout && (m_firstLayout || toRende
rView(rootForThisLayout)->document().printing()); |
| 913 | 912 |
| 914 if (!inSubtreeLayout) { | 913 if (!inSubtreeLayout) { |
| 915 // Now set our scrollbar state for the layout. | 914 // Now set our scrollbar state for the layout. |
| 916 ScrollbarMode currentHMode = horizontalScrollbarMode(); | 915 ScrollbarMode currentHMode = horizontalScrollbarMode(); |
| 917 ScrollbarMode currentVMode = verticalScrollbarMode(); | 916 ScrollbarMode currentVMode = verticalScrollbarMode(); |
| 918 | 917 |
| 919 if (m_firstLayout) { | 918 if (m_firstLayout) { |
| 920 setScrollbarsSuppressed(true); | 919 setScrollbarsSuppressed(true); |
| 921 | 920 |
| 922 m_firstLayout = false; | 921 m_firstLayout = false; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 935 setScrollbarsSuppressed(false, true); | 934 setScrollbarsSuppressed(false, true); |
| 936 } else if (hMode != currentHMode || vMode != currentVMode) { | 935 } else if (hMode != currentHMode || vMode != currentVMode) { |
| 937 setScrollbarModes(hMode, vMode); | 936 setScrollbarModes(hMode, vMode); |
| 938 } | 937 } |
| 939 | 938 |
| 940 LayoutSize oldSize = m_size; | 939 LayoutSize oldSize = m_size; |
| 941 | 940 |
| 942 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); | 941 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); |
| 943 | 942 |
| 944 if (oldSize != m_size) { | 943 if (oldSize != m_size) { |
| 945 shouldDoFullLayout = true; | 944 // It's hard to predict here which of full repaint or per-descen
dant repaint costs less. |
| 945 // For vertical writing mode or width change, it's more likely t
hat per-descendant repaint |
| 946 // eventually turns out to be full repaint but with the cost to
handle layout states and |
| 947 // discrete repaint rects, so marking full repaint here is more
likely to cost less. |
| 948 // For height only changes, per-descendant repaint is more likel
y to avoid unnecessary |
| 949 // full repaints. |
| 950 if (!renderView()->style()->isHorizontalWritingMode() || oldSize
.width() != m_size.width()) |
| 951 shouldDoFullRepaint = true; |
| 952 |
| 946 if (!m_firstLayout) { | 953 if (!m_firstLayout) { |
| 947 RenderBox* rootRenderer = document->documentElement() ? docu
ment->documentElement()->renderBox() : 0; | 954 RenderBox* rootRenderer = document->documentElement() ? docu
ment->documentElement()->renderBox() : 0; |
| 948 RenderBox* bodyRenderer = rootRenderer && document->body() ?
document->body()->renderBox() : 0; | 955 RenderBox* bodyRenderer = rootRenderer && document->body() ?
document->body()->renderBox() : 0; |
| 949 if (bodyRenderer && bodyRenderer->stretchesToViewport()) | 956 if (bodyRenderer && bodyRenderer->stretchesToViewport()) |
| 950 bodyRenderer->setChildNeedsLayout(); | 957 bodyRenderer->setChildNeedsLayout(); |
| 951 else if (rootRenderer && rootRenderer->stretchesToViewport()
) | 958 else if (rootRenderer && rootRenderer->stretchesToViewport()
) |
| 952 rootRenderer->setChildNeedsLayout(); | 959 rootRenderer->setChildNeedsLayout(); |
| 953 } | 960 } |
| 954 } | 961 } |
| 955 } | 962 } |
| 956 | 963 |
| 957 layer = rootForThisLayout->enclosingLayer(); | 964 layer = rootForThisLayout->enclosingLayer(); |
| 958 | 965 |
| 959 // We need to set m_doFullRepaint before triggering layout as RenderObje
ct::checkForRepaint | 966 // We need to set m_doFullRepaint before triggering layout as RenderObje
ct::checkForRepaint |
| 960 // checks the boolean to disable local repaints. | 967 // checks the boolean to disable local repaints. |
| 961 m_doFullRepaint |= shouldDoFullLayout; | 968 m_doFullRepaint |= shouldDoFullRepaint; |
| 962 | 969 |
| 963 performLayout(rootForThisLayout, inSubtreeLayout); | 970 performLayout(rootForThisLayout, inSubtreeLayout); |
| 964 | 971 |
| 965 m_layoutSubtreeRoot = 0; | 972 m_layoutSubtreeRoot = 0; |
| 966 } // Reset m_layoutSchedulingEnabled to its previous value. | 973 } // Reset m_layoutSchedulingEnabled to its previous value. |
| 967 | 974 |
| 968 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin
g()) | 975 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin
g()) |
| 969 adjustViewSize(); | 976 adjustViewSize(); |
| 970 | 977 |
| 971 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos
itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); | 978 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos
itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 repaintRect.move(-scrollOffset()); | 1770 repaintRect.move(-scrollOffset()); |
| 1764 m_trackedRepaintRects.append(repaintRect); | 1771 m_trackedRepaintRects.append(repaintRect); |
| 1765 } | 1772 } |
| 1766 | 1773 |
| 1767 ScrollView::repaintContentRectangle(r); | 1774 ScrollView::repaintContentRectangle(r); |
| 1768 } | 1775 } |
| 1769 | 1776 |
| 1770 void FrameView::contentsResized() | 1777 void FrameView::contentsResized() |
| 1771 { | 1778 { |
| 1772 ScrollView::contentsResized(); | 1779 ScrollView::contentsResized(); |
| 1773 setNeedsLayout(); | 1780 if (RenderView* renderView = this->renderView()) { |
| 1781 // Don't directly repaint layer in setNeedsLayout. We'll handle repaint
in layout(). |
| 1782 renderView->setNeedsLayout(MarkContainingBlockChain, 0, DontRepaintLayer
); |
| 1783 } |
| 1774 } | 1784 } |
| 1775 | 1785 |
| 1776 void FrameView::scrollbarExistenceDidChange() | 1786 void FrameView::scrollbarExistenceDidChange() |
| 1777 { | 1787 { |
| 1778 // We check to make sure the view is attached to a frame() as this method ca
n | 1788 // We check to make sure the view is attached to a frame() as this method ca
n |
| 1779 // be triggered before the view is attached by LocalFrame::createView(...) s
etting | 1789 // be triggered before the view is attached by LocalFrame::createView(...) s
etting |
| 1780 // various values such as setScrollBarModes(...) for example. An ASSERT is | 1790 // various values such as setScrollBarModes(...) for example. An ASSERT is |
| 1781 // triggered when a view is layout before being attached to a frame(). | 1791 // triggered when a view is layout before being attached to a frame(). |
| 1782 if (!frame().view()) | 1792 if (!frame().view()) |
| 1783 return; | 1793 return; |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3243 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3253 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
| 3244 { | 3254 { |
| 3245 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3255 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 3246 if (AXObjectCache* cache = axObjectCache()) { | 3256 if (AXObjectCache* cache = axObjectCache()) { |
| 3247 cache->remove(scrollbar); | 3257 cache->remove(scrollbar); |
| 3248 cache->handleScrollbarUpdate(this); | 3258 cache->handleScrollbarUpdate(this); |
| 3249 } | 3259 } |
| 3250 } | 3260 } |
| 3251 | 3261 |
| 3252 } // namespace WebCore | 3262 } // namespace WebCore |
| OLD | NEW |