Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 926193003: Move rendering/RenderBox to layout/LayoutBox. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/frame/FrameViewAutoSizeInfo.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 { 768 {
769 return onlyDuringLayout && layoutPending() ? nullptr : m_layoutSubtreeRoot; 769 return onlyDuringLayout && layoutPending() ? nullptr : m_layoutSubtreeRoot;
770 } 770 }
771 771
772 inline void FrameView::forceLayoutParentViewIfNeeded() 772 inline void FrameView::forceLayoutParentViewIfNeeded()
773 { 773 {
774 LayoutPart* ownerRenderer = m_frame->ownerRenderer(); 774 LayoutPart* ownerRenderer = m_frame->ownerRenderer();
775 if (!ownerRenderer || !ownerRenderer->frame()) 775 if (!ownerRenderer || !ownerRenderer->frame())
776 return; 776 return;
777 777
778 RenderBox* contentBox = embeddedContentBox(); 778 LayoutBox* contentBox = embeddedContentBox();
779 if (!contentBox) 779 if (!contentBox)
780 return; 780 return;
781 781
782 LayoutSVGRoot* svgRoot = toLayoutSVGRoot(contentBox); 782 LayoutSVGRoot* svgRoot = toLayoutSVGRoot(contentBox);
783 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) 783 if (svgRoot->everHadLayout() && !svgRoot->needsLayout())
784 return; 784 return;
785 785
786 // If the embedded SVG document appears the first time, the ownerRenderer ha s already finished 786 // If the embedded SVG document appears the first time, the ownerRenderer ha s already finished
787 // layout without knowing about the existence of the embedded SVG document, because LayoutReplaced 787 // layout without knowing about the existence of the embedded SVG document, because LayoutReplaced
788 // embeddedContentBox() returns 0, as long as the embedded document isn't lo aded yet. Before 788 // embeddedContentBox() returns 0, as long as the embedded document isn't lo aded yet. Before
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 } 992 }
993 993
994 if (needsScrollbarReconstruction()) 994 if (needsScrollbarReconstruction())
995 updateScrollbars(scrollOffsetDouble()); 995 updateScrollbars(scrollOffsetDouble());
996 996
997 LayoutSize oldSize = m_size; 997 LayoutSize oldSize = m_size;
998 998
999 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); 999 m_size = LayoutSize(layoutSize().width(), layoutSize().height());
1000 1000
1001 if (oldSize != m_size && !m_firstLayout) { 1001 if (oldSize != m_size && !m_firstLayout) {
1002 RenderBox* rootRenderer = document->documentElement() ? document ->documentElement()->renderBox() : 0; 1002 LayoutBox* rootRenderer = document->documentElement() ? document ->documentElement()->layoutBox() : 0;
1003 RenderBox* bodyRenderer = rootRenderer && document->body() ? doc ument->body()->renderBox() : 0; 1003 LayoutBox* bodyRenderer = rootRenderer && document->body() ? doc ument->body()->layoutBox() : 0;
1004 if (bodyRenderer && bodyRenderer->stretchesToViewport()) 1004 if (bodyRenderer && bodyRenderer->stretchesToViewport())
1005 bodyRenderer->setChildNeedsLayout(); 1005 bodyRenderer->setChildNeedsLayout();
1006 else if (rootRenderer && rootRenderer->stretchesToViewport()) 1006 else if (rootRenderer && rootRenderer->stretchesToViewport())
1007 rootRenderer->setChildNeedsLayout(); 1007 rootRenderer->setChildNeedsLayout();
1008 } 1008 }
1009 1009
1010 // We need to set m_doFullPaintInvalidation before triggering layout as LayoutObject::checkForPaintInvalidation 1010 // We need to set m_doFullPaintInvalidation before triggering layout as LayoutObject::checkForPaintInvalidation
1011 // checks the boolean to disable local paint invalidations. 1011 // checks the boolean to disable local paint invalidations.
1012 m_doFullPaintInvalidation |= renderView()->shouldDoFullPaintInvalida tionForNextLayout(); 1012 m_doFullPaintInvalidation |= renderView()->shouldDoFullPaintInvalida tionForNextLayout();
1013 } 1013 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 debugInfo.currentLayoutRects().clear(); 1128 debugInfo.currentLayoutRects().clear();
1129 for (LayoutObject* renderer = layoutRoot; renderer; renderer = renderer->nex tInPreOrder()) { 1129 for (LayoutObject* renderer = layoutRoot; renderer; renderer = renderer->nex tInPreOrder()) {
1130 if (renderer->layoutDidGetCalledSinceLastFrame()) { 1130 if (renderer->layoutDidGetCalledSinceLastFrame()) {
1131 FloatQuad quad = renderer->localToAbsoluteQuad(FloatQuad(renderer->p reviousPaintInvalidationRect())); 1131 FloatQuad quad = renderer->localToAbsoluteQuad(FloatQuad(renderer->p reviousPaintInvalidationRect()));
1132 LayoutRect rect = quad.enclosingBoundingBox(); 1132 LayoutRect rect = quad.enclosingBoundingBox();
1133 debugInfo.currentLayoutRects().append(rect); 1133 debugInfo.currentLayoutRects().append(rect);
1134 } 1134 }
1135 } 1135 }
1136 } 1136 }
1137 1137
1138 RenderBox* FrameView::embeddedContentBox() const 1138 LayoutBox* FrameView::embeddedContentBox() const
1139 { 1139 {
1140 RenderView* renderView = this->renderView(); 1140 RenderView* renderView = this->renderView();
1141 if (!renderView) 1141 if (!renderView)
1142 return nullptr; 1142 return nullptr;
1143 1143
1144 LayoutObject* firstChild = renderView->firstChild(); 1144 LayoutObject* firstChild = renderView->firstChild();
1145 if (!firstChild || !firstChild->isBox()) 1145 if (!firstChild || !firstChild->isBox())
1146 return nullptr; 1146 return nullptr;
1147 1147
1148 // Curently only embedded SVG documents participate in the size-negotiation logic. 1148 // Curently only embedded SVG documents participate in the size-negotiation logic.
1149 if (firstChild->isSVGRoot()) 1149 if (firstChild->isSVGRoot())
1150 return toRenderBox(firstChild); 1150 return toLayoutBox(firstChild);
1151 1151
1152 return nullptr; 1152 return nullptr;
1153 } 1153 }
1154 1154
1155 1155
1156 void FrameView::addPart(LayoutPart* object) 1156 void FrameView::addPart(LayoutPart* object)
1157 { 1157 {
1158 m_parts.add(object); 1158 m_parts.add(object);
1159 } 1159 }
1160 1160
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 // layout in that case. 1906 // layout in that case.
1907 1907
1908 RenderView* renderView = this->renderView(); 1908 RenderView* renderView = this->renderView();
1909 return layoutPending() 1909 return layoutPending()
1910 || (renderView && renderView->needsLayout()) 1910 || (renderView && renderView->needsLayout())
1911 || isSubtreeLayout(); 1911 || isSubtreeLayout();
1912 } 1912 }
1913 1913
1914 void FrameView::setNeedsLayout() 1914 void FrameView::setNeedsLayout()
1915 { 1915 {
1916 RenderBox* box = embeddedContentBox(); 1916 LayoutBox* box = embeddedContentBox();
1917 // It's illegal to ask for layout changes during the layout compositing or p aint invalidation step. 1917 // It's illegal to ask for layout changes during the layout compositing or p aint invalidation step.
1918 // FIXME: the third conditional is a hack to support embedded SVG. See Frame View::forceLayoutParentViewIfNeeded and crbug.com/442939 1918 // FIXME: the third conditional is a hack to support embedded SVG. See Frame View::forceLayoutParentViewIfNeeded and crbug.com/442939
1919 RELEASE_ASSERT(!m_frame->document() || m_frame->document()->lifecycle().stat eAllowsLayoutInvalidation() || (box && box->isSVGRoot())); 1919 RELEASE_ASSERT(!m_frame->document() || m_frame->document()->lifecycle().stat eAllowsLayoutInvalidation() || (box && box->isSVGRoot()));
1920 1920
1921 if (RenderView* renderView = this->renderView()) 1921 if (RenderView* renderView = this->renderView())
1922 renderView->setNeedsLayout(); 1922 renderView->setNeedsLayout();
1923 } 1923 }
1924 1924
1925 bool FrameView::isTransparent() const 1925 bool FrameView::isTransparent() const
1926 { 1926 {
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 { 2434 {
2435 return m_frame->settings() && m_frame->settings()->scrollAnimatorEnabled(); 2435 return m_frame->settings() && m_frame->settings()->scrollAnimatorEnabled();
2436 } 2436 }
2437 2437
2438 void FrameView::updateAnnotatedRegions() 2438 void FrameView::updateAnnotatedRegions()
2439 { 2439 {
2440 Document* document = m_frame->document(); 2440 Document* document = m_frame->document();
2441 if (!document->hasAnnotatedRegions()) 2441 if (!document->hasAnnotatedRegions())
2442 return; 2442 return;
2443 Vector<AnnotatedRegionValue> newRegions; 2443 Vector<AnnotatedRegionValue> newRegions;
2444 document->renderBox()->collectAnnotatedRegions(newRegions); 2444 document->layoutBox()->collectAnnotatedRegions(newRegions);
2445 if (newRegions == document->annotatedRegions()) 2445 if (newRegions == document->annotatedRegions())
2446 return; 2446 return;
2447 document->setAnnotatedRegions(newRegions); 2447 document->setAnnotatedRegions(newRegions);
2448 if (Page* page = m_frame->page()) 2448 if (Page* page = m_frame->page())
2449 page->chrome().client().annotatedRegionsChanged(); 2449 page->chrome().client().annotatedRegionsChanged();
2450 } 2450 }
2451 2451
2452 void FrameView::updateScrollCorner() 2452 void FrameView::updateScrollCorner()
2453 { 2453 {
2454 RefPtr<LayoutStyle> cornerStyle; 2454 RefPtr<LayoutStyle> cornerStyle;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 TextStream ts; 2893 TextStream ts;
2894 if (!m_trackedPaintInvalidationRects.isEmpty()) { 2894 if (!m_trackedPaintInvalidationRects.isEmpty()) {
2895 ts << "(repaint rects\n"; 2895 ts << "(repaint rects\n";
2896 for (size_t i = 0; i < m_trackedPaintInvalidationRects.size(); ++i) 2896 for (size_t i = 0; i < m_trackedPaintInvalidationRects.size(); ++i)
2897 ts << " (rect " << m_trackedPaintInvalidationRects[i].x() << " " << m_trackedPaintInvalidationRects[i].y() << " " << m_trackedPaintInvalidationRect s[i].width() << " " << m_trackedPaintInvalidationRects[i].height() << ")\n"; 2897 ts << " (rect " << m_trackedPaintInvalidationRects[i].x() << " " << m_trackedPaintInvalidationRects[i].y() << " " << m_trackedPaintInvalidationRect s[i].width() << " " << m_trackedPaintInvalidationRects[i].height() << ")\n";
2898 ts << ")\n"; 2898 ts << ")\n";
2899 } 2899 }
2900 return ts.release(); 2900 return ts.release();
2901 } 2901 }
2902 2902
2903 void FrameView::addResizerArea(RenderBox& resizerBox) 2903 void FrameView::addResizerArea(LayoutBox& resizerBox)
2904 { 2904 {
2905 if (!m_resizerAreas) 2905 if (!m_resizerAreas)
2906 m_resizerAreas = adoptPtr(new ResizerAreaSet); 2906 m_resizerAreas = adoptPtr(new ResizerAreaSet);
2907 m_resizerAreas->add(&resizerBox); 2907 m_resizerAreas->add(&resizerBox);
2908 } 2908 }
2909 2909
2910 void FrameView::removeResizerArea(RenderBox& resizerBox) 2910 void FrameView::removeResizerArea(LayoutBox& resizerBox)
2911 { 2911 {
2912 if (!m_resizerAreas) 2912 if (!m_resizerAreas)
2913 return; 2913 return;
2914 2914
2915 ResizerAreaSet::iterator it = m_resizerAreas->find(&resizerBox); 2915 ResizerAreaSet::iterator it = m_resizerAreas->find(&resizerBox);
2916 if (it != m_resizerAreas->end()) 2916 if (it != m_resizerAreas->end())
2917 m_resizerAreas->remove(it); 2917 m_resizerAreas->remove(it);
2918 } 2918 }
2919 2919
2920 void FrameView::addScrollableArea(ScrollableArea* scrollableArea) 2920 void FrameView::addScrollableArea(ScrollableArea* scrollableArea)
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
4074 { 4074 {
4075 Settings* settings = frame().settings(); 4075 Settings* settings = frame().settings();
4076 if (!settings || !settings->rootLayerScrolls()) 4076 if (!settings || !settings->rootLayerScrolls())
4077 return this; 4077 return this;
4078 4078
4079 RenderView* renderView = this->renderView(); 4079 RenderView* renderView = this->renderView();
4080 return renderView ? renderView->scrollableArea() : nullptr; 4080 return renderView ? renderView->scrollableArea() : nullptr;
4081 } 4081 }
4082 4082
4083 } // namespace blink 4083 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/frame/FrameViewAutoSizeInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698