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

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

Issue 332543002: Rename Repaint to Paint Invalidation Part 4 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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/dom/Element.cpp ('k') | Source/core/html/HTMLFrameSetElement.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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 // If the embedded SVG document appears the first time, the ownerRenderer ha s already finished 729 // If the embedded SVG document appears the first time, the ownerRenderer ha s already finished
730 // layout without knowing about the existence of the embedded SVG document, because RenderReplaced 730 // layout without knowing about the existence of the embedded SVG document, because RenderReplaced
731 // embeddedContentBox() returns 0, as long as the embedded document isn't lo aded yet. Before 731 // embeddedContentBox() returns 0, as long as the embedded document isn't lo aded yet. Before
732 // bothering to lay out the SVG document, mark the ownerRenderer needing lay out and ask its 732 // bothering to lay out the SVG document, mark the ownerRenderer needing lay out and ask its
733 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere r) carries the 733 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere r) carries the
734 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel y on, when laying 734 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel y on, when laying
735 // out for the first time, or when the RenderSVGRoot size has changed dynami cally (eg. via <script>). 735 // out for the first time, or when the RenderSVGRoot size has changed dynami cally (eg. via <script>).
736 RefPtr<FrameView> frameView = ownerRenderer->frame()->view(); 736 RefPtr<FrameView> frameView = ownerRenderer->frame()->view();
737 737
738 // Mark the owner renderer as needing layout. 738 // Mark the owner renderer as needing layout.
739 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); 739 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
740 740
741 // Synchronously enter layout, to layout the view containing the host object /embed/iframe. 741 // Synchronously enter layout, to layout the view containing the host object /embed/iframe.
742 ASSERT(frameView); 742 ASSERT(frameView);
743 frameView->layout(); 743 frameView->layout();
744 } 744 }
745 745
746 void FrameView::performPreLayoutTasks() 746 void FrameView::performPreLayoutTasks()
747 { 747 {
748 TRACE_EVENT0("webkit", "FrameView::performPreLayoutTasks"); 748 TRACE_EVENT0("webkit", "FrameView::performPreLayoutTasks");
749 lifecycle().advanceTo(DocumentLifecycle::InPreLayout); 749 lifecycle().advanceTo(DocumentLifecycle::InPreLayout);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 949
950 if (oldSize != m_size && !m_firstLayout) { 950 if (oldSize != m_size && !m_firstLayout) {
951 RenderBox* rootRenderer = document->documentElement() ? document ->documentElement()->renderBox() : 0; 951 RenderBox* rootRenderer = document->documentElement() ? document ->documentElement()->renderBox() : 0;
952 RenderBox* bodyRenderer = rootRenderer && document->body() ? doc ument->body()->renderBox() : 0; 952 RenderBox* bodyRenderer = rootRenderer && document->body() ? doc ument->body()->renderBox() : 0;
953 if (bodyRenderer && bodyRenderer->stretchesToViewport()) 953 if (bodyRenderer && bodyRenderer->stretchesToViewport())
954 bodyRenderer->setChildNeedsLayout(); 954 bodyRenderer->setChildNeedsLayout();
955 else if (rootRenderer && rootRenderer->stretchesToViewport()) 955 else if (rootRenderer && rootRenderer->stretchesToViewport())
956 rootRenderer->setChildNeedsLayout(); 956 rootRenderer->setChildNeedsLayout();
957 } 957 }
958 958
959 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForRepaint 959 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation
960 // checks the boolean to disable local paint invalidations. 960 // checks the boolean to disable local paint invalidations.
961 m_doFullPaintInvalidation |= renderView()->shouldDoFullRepaintForNex tLayout(); 961 m_doFullPaintInvalidation |= renderView()->shouldDoFullRepaintForNex tLayout();
962 } 962 }
963 963
964 layer = rootForThisLayout->enclosingLayer(); 964 layer = rootForThisLayout->enclosingLayer();
965 965
966 performLayout(rootForThisLayout, inSubtreeLayout); 966 performLayout(rootForThisLayout, inSubtreeLayout);
967 967
968 m_layoutSubtreeRoot = 0; 968 m_layoutSubtreeRoot = 0;
969 } // Reset m_layoutSchedulingEnabled to its previous value. 969 } // Reset m_layoutSchedulingEnabled to its previous value.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 ASSERT(!m_nestedLayoutCount); 1037 ASSERT(!m_nestedLayoutCount);
1038 1038
1039 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", TRACE_STR_COPY(ro ot->debugName().ascii().data())); 1039 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", TRACE_STR_COPY(ro ot->debugName().ascii().data()));
1040 1040
1041 // FIXME: really, we're in the paint invalidation phase here, and the compos iting queries are legal. 1041 // FIXME: really, we're in the paint invalidation phase here, and the compos iting queries are legal.
1042 // Until those states are fully fledged, I'll just disable the ASSERTS. 1042 // Until those states are fully fledged, I'll just disable the ASSERTS.
1043 DisableCompositingQueryAsserts compositingQueryAssertsDisabler; 1043 DisableCompositingQueryAsserts compositingQueryAssertsDisabler;
1044 1044
1045 RootLayoutStateScope rootLayoutStateScope(*root); 1045 RootLayoutStateScope rootLayoutStateScope(*root);
1046 1046
1047 root->invalidateTreeAfterLayout(*root->containerForRepaint()); 1047 root->invalidateTreeAfterLayout(*root->containerForPaintInvalidation());
1048 1048
1049 // Invalidate the paint of the frameviews scrollbars if needed 1049 // Invalidate the paint of the frameviews scrollbars if needed
1050 if (hasVerticalBarDamage()) 1050 if (hasVerticalBarDamage())
1051 invalidateRect(verticalBarDamage()); 1051 invalidateRect(verticalBarDamage());
1052 if (hasHorizontalBarDamage()) 1052 if (hasHorizontalBarDamage())
1053 invalidateRect(horizontalBarDamage()); 1053 invalidateRect(horizontalBarDamage());
1054 resetScrollbarDamage(); 1054 resetScrollbarDamage();
1055 } 1055 }
1056 1056
1057 DocumentLifecycle& FrameView::lifecycle() const 1057 DocumentLifecycle& FrameView::lifecycle() const
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 return; 1300 return;
1301 1301
1302 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end(); 1302 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje cts->end();
1303 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) { 1303 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained Objects->begin(); it != end; ++it) {
1304 RenderObject* renderer = *it; 1304 RenderObject* renderer = *it;
1305 RenderStyle* style = renderer->style(); 1305 RenderStyle* style = renderer->style();
1306 if (widthChanged) { 1306 if (widthChanged) {
1307 if (style->width().isFixed() && (style->left().isAuto() || style->ri ght().isAuto())) 1307 if (style->width().isFixed() && (style->left().isAuto() || style->ri ght().isAuto()))
1308 renderer->setNeedsPositionedMovementLayout(); 1308 renderer->setNeedsPositionedMovementLayout();
1309 else 1309 else
1310 renderer->setNeedsLayoutAndFullRepaint(); 1310 renderer->setNeedsLayoutAndFullPaintInvalidation();
1311 } 1311 }
1312 if (heightChanged) { 1312 if (heightChanged) {
1313 if (style->height().isFixed() && (style->top().isAuto() || style->bo ttom().isAuto())) 1313 if (style->height().isFixed() && (style->top().isAuto() || style->bo ttom().isAuto()))
1314 renderer->setNeedsPositionedMovementLayout(); 1314 renderer->setNeedsPositionedMovementLayout();
1315 else 1315 else
1316 renderer->setNeedsLayoutAndFullRepaint(); 1316 renderer->setNeedsLayoutAndFullPaintInvalidation();
1317 } 1317 }
1318 } 1318 }
1319 } 1319 }
1320 1320
1321 bool FrameView::shouldPlaceVerticalScrollbarOnLeft() const 1321 bool FrameView::shouldPlaceVerticalScrollbarOnLeft() const
1322 { 1322 {
1323 // FIXME: Mainframe scrollbar placement should respect the embedding applica tion RTL UI policy. 1323 // FIXME: Mainframe scrollbar placement should respect the embedding applica tion RTL UI policy.
1324 // See crbug.com/249860. 1324 // See crbug.com/249860.
1325 if (m_frame->isMainFrame()) 1325 if (m_frame->isMainFrame())
1326 return false; 1326 return false;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 } 1407 }
1408 1408
1409 if (layer->hasAncestorWithFilterOutsets()) { 1409 if (layer->hasAncestorWithFilterOutsets()) {
1410 // If the fixed layer has a blur/drop-shadow filter applied on at le ast one of its parents, we cannot 1410 // If the fixed layer has a blur/drop-shadow filter applied on at le ast one of its parents, we cannot
1411 // scroll using the fast path, otherwise the outsets of the filter w ill be moved around the page. 1411 // scroll using the fast path, otherwise the outsets of the filter w ill be moved around the page.
1412 return false; 1412 return false;
1413 } 1413 }
1414 1414
1415 IntRect updateRect = pixelSnappedIntRect(layer->repainter().repaintRectI ncludingNonCompositingDescendants()); 1415 IntRect updateRect = pixelSnappedIntRect(layer->repainter().repaintRectI ncludingNonCompositingDescendants());
1416 1416
1417 const RenderLayerModelObject* repaintContainer = layer->renderer()->cont ainerForRepaint(); 1417 const RenderLayerModelObject* repaintContainer = layer->renderer()->cont ainerForPaintInvalidation();
1418 if (repaintContainer && !repaintContainer->isRenderView()) { 1418 if (repaintContainer && !repaintContainer->isRenderView()) {
1419 // If the fixed-position layer is contained by a composited layer th at is not its containing block, 1419 // If the fixed-position layer is contained by a composited layer th at is not its containing block,
1420 // then we have to invalidate that enclosing layer, not the RenderVi ew. 1420 // then we have to invalidate that enclosing layer, not the RenderVi ew.
1421 // FIXME: Why do we need to issue this invalidation? Won't the fixed position element just scroll 1421 // FIXME: Why do we need to issue this invalidation? Won't the fixed position element just scroll
1422 // with the enclosing layer. 1422 // with the enclosing layer.
1423 updateRect.moveBy(scrollPosition()); 1423 updateRect.moveBy(scrollPosition());
1424 IntRect previousRect = updateRect; 1424 IntRect previousRect = updateRect;
1425 previousRect.move(scrollDelta); 1425 previousRect.move(scrollDelta);
1426 updateRect.unite(previousRect); 1426 updateRect.unite(previousRect);
1427 layer->renderer()->invalidatePaintUsingContainer(repaintContainer, u pdateRect, InvalidationScroll); 1427 layer->renderer()->invalidatePaintUsingContainer(repaintContainer, u pdateRect, InvalidationScroll);
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after
2926 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri ck to see 2926 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri ck to see
2927 // the state of things before and after the layout 2927 // the state of things before and after the layout
2928 if (RenderView* renderView = this->renderView()) { 2928 if (RenderView* renderView = this->renderView()) {
2929 float pageLogicalWidth = renderView->style()->isHorizontalWritingMode() ? pageSize.width() : pageSize.height(); 2929 float pageLogicalWidth = renderView->style()->isHorizontalWritingMode() ? pageSize.width() : pageSize.height();
2930 float pageLogicalHeight = renderView->style()->isHorizontalWritingMode() ? pageSize.height() : pageSize.width(); 2930 float pageLogicalHeight = renderView->style()->isHorizontalWritingMode() ? pageSize.height() : pageSize.width();
2931 2931
2932 LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogical Width); 2932 LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogical Width);
2933 LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogica lHeight); 2933 LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogica lHeight);
2934 renderView->setLogicalWidth(flooredPageLogicalWidth); 2934 renderView->setLogicalWidth(flooredPageLogicalWidth);
2935 renderView->setPageLogicalHeight(flooredPageLogicalHeight); 2935 renderView->setPageLogicalHeight(flooredPageLogicalHeight);
2936 renderView->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); 2936 renderView->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
2937 forceLayout(); 2937 forceLayout();
2938 2938
2939 // If we don't fit in the given page width, we'll lay out again. If we d on't fit in the 2939 // If we don't fit in the given page width, we'll lay out again. If we d on't fit in the
2940 // page width when shrunk, we will lay out at maximum shrink and clip ex tra content. 2940 // page width when shrunk, we will lay out at maximum shrink and clip ex tra content.
2941 // FIXME: We are assuming a shrink-to-fit printing implementation. A cr opping 2941 // FIXME: We are assuming a shrink-to-fit printing implementation. A cr opping
2942 // implementation should not do this! 2942 // implementation should not do this!
2943 bool horizontalWritingMode = renderView->style()->isHorizontalWritingMod e(); 2943 bool horizontalWritingMode = renderView->style()->isHorizontalWritingMod e();
2944 const LayoutRect& documentRect = renderView->documentRect(); 2944 const LayoutRect& documentRect = renderView->documentRect();
2945 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width( ) : documentRect.height(); 2945 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width( ) : documentRect.height();
2946 if (docLogicalWidth > pageLogicalWidth) { 2946 if (docLogicalWidth > pageLogicalWidth) {
2947 FloatSize expectedPageSize(std::min<float>(documentRect.width().toFl oat(), pageSize.width() * maximumShrinkFactor), std::min<float>(documentRect.hei ght().toFloat(), pageSize.height() * maximumShrinkFactor)); 2947 FloatSize expectedPageSize(std::min<float>(documentRect.width().toFl oat(), pageSize.width() * maximumShrinkFactor), std::min<float>(documentRect.hei ght().toFloat(), pageSize.height() * maximumShrinkFactor));
2948 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi ze(originalPageSize.width(), originalPageSize.height()), expectedPageSize); 2948 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi ze(originalPageSize.width(), originalPageSize.height()), expectedPageSize);
2949 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max PageSize.height(); 2949 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max PageSize.height();
2950 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m axPageSize.width(); 2950 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m axPageSize.width();
2951 2951
2952 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth); 2952 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth);
2953 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight ); 2953 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight );
2954 renderView->setLogicalWidth(flooredPageLogicalWidth); 2954 renderView->setLogicalWidth(flooredPageLogicalWidth);
2955 renderView->setPageLogicalHeight(flooredPageLogicalHeight); 2955 renderView->setPageLogicalHeight(flooredPageLogicalHeight);
2956 renderView->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); 2956 renderView->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidatio n();
2957 forceLayout(); 2957 forceLayout();
2958 2958
2959 const LayoutRect& updatedDocumentRect = renderView->documentRect(); 2959 const LayoutRect& updatedDocumentRect = renderView->documentRect();
2960 LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumen tRect.height() : updatedDocumentRect.width(); 2960 LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumen tRect.height() : updatedDocumentRect.width();
2961 LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRe ct.y() : updatedDocumentRect.x(); 2961 LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRe ct.y() : updatedDocumentRect.x();
2962 LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocument Rect.maxX() : updatedDocumentRect.maxY(); 2962 LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocument Rect.maxX() : updatedDocumentRect.maxY();
2963 LayoutUnit clippedLogicalLeft = 0; 2963 LayoutUnit clippedLogicalLeft = 0;
2964 if (!renderView->style()->isLeftToRightDirection()) 2964 if (!renderView->style()->isLeftToRightDirection())
2965 clippedLogicalLeft = docLogicalRight - pageLogicalWidth; 2965 clippedLogicalLeft = docLogicalRight - pageLogicalWidth;
2966 LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWi dth, docLogicalHeight); 2966 LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWi dth, docLogicalHeight);
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
3273 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3273 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3274 { 3274 {
3275 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3275 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3276 if (AXObjectCache* cache = axObjectCache()) { 3276 if (AXObjectCache* cache = axObjectCache()) {
3277 cache->remove(scrollbar); 3277 cache->remove(scrollbar);
3278 cache->handleScrollbarUpdate(this); 3278 cache->handleScrollbarUpdate(this);
3279 } 3279 }
3280 } 3280 }
3281 3281
3282 } // namespace WebCore 3282 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/HTMLFrameSetElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698