Chromium Code Reviews| 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 if (!renderView()->style()->isHorizontalWritingMode() || oldSize .width() != m_size.width()) |
| 945 shouldDoFullRepaint = true; | |
| 946 | |
| 946 if (!m_firstLayout) { | 947 if (!m_firstLayout) { |
| 947 RenderBox* rootRenderer = document->documentElement() ? docu ment->documentElement()->renderBox() : 0; | 948 RenderBox* rootRenderer = document->documentElement() ? docu ment->documentElement()->renderBox() : 0; |
| 948 RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0; | 949 RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0; |
| 949 if (bodyRenderer && bodyRenderer->stretchesToViewport()) | 950 if (bodyRenderer && bodyRenderer->stretchesToViewport()) |
| 950 bodyRenderer->setChildNeedsLayout(); | 951 bodyRenderer->setChildNeedsLayout(); |
| 951 else if (rootRenderer && rootRenderer->stretchesToViewport() ) | 952 else if (rootRenderer && rootRenderer->stretchesToViewport() ) |
| 952 rootRenderer->setChildNeedsLayout(); | 953 rootRenderer->setChildNeedsLayout(); |
| 953 } | 954 } |
| 954 } | 955 } |
| 955 } | 956 } |
| 956 | 957 |
| 957 layer = rootForThisLayout->enclosingLayer(); | 958 layer = rootForThisLayout->enclosingLayer(); |
| 958 | 959 |
| 959 // We need to set m_doFullRepaint before triggering layout as RenderObje ct::checkForRepaint | 960 // We need to set m_doFullRepaint before triggering layout as RenderObje ct::checkForRepaint |
| 960 // checks the boolean to disable local repaints. | 961 // checks the boolean to disable local repaints. |
| 961 m_doFullRepaint |= shouldDoFullLayout; | 962 m_doFullRepaint |= shouldDoFullRepaint; |
| 962 | 963 |
| 963 performLayout(rootForThisLayout, inSubtreeLayout); | 964 performLayout(rootForThisLayout, inSubtreeLayout); |
| 964 | 965 |
| 965 m_layoutSubtreeRoot = 0; | 966 m_layoutSubtreeRoot = 0; |
| 966 } // Reset m_layoutSchedulingEnabled to its previous value. | 967 } // Reset m_layoutSchedulingEnabled to its previous value. |
| 967 | 968 |
| 968 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) | 969 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) |
| 969 adjustViewSize(); | 970 adjustViewSize(); |
| 970 | 971 |
| 971 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); | 972 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1739 repaintRect.move(-scrollOffset()); | 1740 repaintRect.move(-scrollOffset()); |
| 1740 m_trackedRepaintRects.append(repaintRect); | 1741 m_trackedRepaintRects.append(repaintRect); |
| 1741 } | 1742 } |
| 1742 | 1743 |
| 1743 ScrollView::repaintContentRectangle(r); | 1744 ScrollView::repaintContentRectangle(r); |
| 1744 } | 1745 } |
| 1745 | 1746 |
| 1746 void FrameView::contentsResized() | 1747 void FrameView::contentsResized() |
| 1747 { | 1748 { |
| 1748 ScrollView::contentsResized(); | 1749 ScrollView::contentsResized(); |
| 1749 setNeedsLayout(); | 1750 if (RenderView* renderView = this->renderView()) |
| 1751 renderView->setNeedsLayout(MarkOnlyThis, 0, false); | |
|
esprehn
2014/03/26 17:46:17
You should not pass MarkOnlyThis. It doesn't reall
Xianzhu
2014/03/26 18:08:39
Done.
| |
| 1750 } | 1752 } |
| 1751 | 1753 |
| 1752 void FrameView::scrollbarExistenceDidChange() | 1754 void FrameView::scrollbarExistenceDidChange() |
| 1753 { | 1755 { |
| 1754 // We check to make sure the view is attached to a frame() as this method ca n | 1756 // We check to make sure the view is attached to a frame() as this method ca n |
| 1755 // be triggered before the view is attached by LocalFrame::createView(...) s etting | 1757 // be triggered before the view is attached by LocalFrame::createView(...) s etting |
| 1756 // various values such as setScrollBarModes(...) for example. An ASSERT is | 1758 // various values such as setScrollBarModes(...) for example. An ASSERT is |
| 1757 // triggered when a view is layout before being attached to a frame(). | 1759 // triggered when a view is layout before being attached to a frame(). |
| 1758 if (!frame().view()) | 1760 if (!frame().view()) |
| 1759 return; | 1761 return; |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3219 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) | 3221 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) |
| 3220 { | 3222 { |
| 3221 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3223 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 3222 if (AXObjectCache* cache = axObjectCache()) { | 3224 if (AXObjectCache* cache = axObjectCache()) { |
| 3223 cache->remove(scrollbar); | 3225 cache->remove(scrollbar); |
| 3224 cache->handleScrollbarUpdate(this); | 3226 cache->handleScrollbarUpdate(this); |
| 3225 } | 3227 } |
| 3226 } | 3228 } |
| 3227 | 3229 |
| 3228 } // namespace WebCore | 3230 } // namespace WebCore |
| OLD | NEW |