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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutView.cpp

Issue 2816873002: Update PaintLayer size during layout, not after.
Patch Set: s/UpdateICBAndViewportSize/ResizeFrameView/ Created 3 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 19 matching lines...) Expand all
30 #include "core/frame/Settings.h" 30 #include "core/frame/Settings.h"
31 #include "core/html/HTMLIFrameElement.h" 31 #include "core/html/HTMLIFrameElement.h"
32 #include "core/layout/HitTestResult.h" 32 #include "core/layout/HitTestResult.h"
33 #include "core/layout/LayoutGeometryMap.h" 33 #include "core/layout/LayoutGeometryMap.h"
34 #include "core/layout/LayoutPart.h" 34 #include "core/layout/LayoutPart.h"
35 #include "core/layout/ViewFragmentationContext.h" 35 #include "core/layout/ViewFragmentationContext.h"
36 #include "core/layout/api/LayoutAPIShim.h" 36 #include "core/layout/api/LayoutAPIShim.h"
37 #include "core/layout/api/LayoutPartItem.h" 37 #include "core/layout/api/LayoutPartItem.h"
38 #include "core/layout/api/LayoutViewItem.h" 38 #include "core/layout/api/LayoutViewItem.h"
39 #include "core/layout/compositing/PaintLayerCompositor.h" 39 #include "core/layout/compositing/PaintLayerCompositor.h"
40 #include "core/page/ChromeClient.h"
40 #include "core/page/Page.h" 41 #include "core/page/Page.h"
41 #include "core/paint/PaintLayer.h" 42 #include "core/paint/PaintLayer.h"
42 #include "core/paint/ViewPaintInvalidator.h" 43 #include "core/paint/ViewPaintInvalidator.h"
43 #include "core/paint/ViewPainter.h" 44 #include "core/paint/ViewPainter.h"
44 #include "core/svg/SVGDocumentExtensions.h" 45 #include "core/svg/SVGDocumentExtensions.h"
45 #include "platform/Histogram.h" 46 #include "platform/Histogram.h"
46 #include "platform/RuntimeEnabledFeatures.h" 47 #include "platform/RuntimeEnabledFeatures.h"
47 #include "platform/geometry/FloatQuad.h" 48 #include "platform/geometry/FloatQuad.h"
48 #include "platform/geometry/TransformState.h" 49 #include "platform/geometry/TransformState.h"
49 #include "platform/graphics/paint/PaintController.h" 50 #include "platform/graphics/paint/PaintController.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 272 }
272 273
273 SubtreeLayoutScope layout_scope(*this); 274 SubtreeLayoutScope layout_scope(*this);
274 275
275 // Use calcWidth/Height to get the new width/height, since this will take the 276 // Use calcWidth/Height to get the new width/height, since this will take the
276 // full page zoom factor into account. 277 // full page zoom factor into account.
277 bool relayout_children = 278 bool relayout_children =
278 !ShouldUsePrintingLayout() && 279 !ShouldUsePrintingLayout() &&
279 (!frame_view_ || LogicalWidth() != ViewLogicalWidthForBoxSizing() || 280 (!frame_view_ || LogicalWidth() != ViewLogicalWidthForBoxSizing() ||
280 LogicalHeight() != ViewLogicalHeightForBoxSizing()); 281 LogicalHeight() != ViewLogicalHeightForBoxSizing());
282
283 if (!relayout_children && GetDocument().IsSVGDocument()) {
284 for (LayoutObject* child = FirstChild(); child;
285 child = child->NextSibling()) {
286 if (!child->IsSVGRoot())
287 continue;
288 const Length& child_height = child->Style()->LogicalHeight();
289 if (!child_height.IsPercentOrCalc())
290 continue;
291 if (ToLayoutBox(child)->LogicalHeight() !=
292 ValueForLength(child_height,
293 AvailableLogicalHeightUsing(
294 child_height, kExcludeMarginBorderPadding))) {
295 relayout_children = true;
296 layout_scope.SetChildNeedsLayout(child);
297 }
298 }
299 }
300
281 if (relayout_children) { 301 if (relayout_children) {
282 layout_scope.SetChildNeedsLayout(this); 302 layout_scope.SetChildNeedsLayout(this);
283 for (LayoutObject* child = FirstChild(); child; 303 for (LayoutObject* child = FirstChild(); child;
284 child = child->NextSibling()) { 304 child = child->NextSibling()) {
285 if (child->IsSVGRoot()) 305 if (child->IsSVGRoot())
286 continue; 306 continue;
287 307
288 if ((child->IsBox() && ToLayoutBox(child)->HasRelativeLogicalHeight()) || 308 if ((child->IsBox() && ToLayoutBox(child)->HasRelativeLogicalHeight()) ||
289 child->Style()->LogicalHeight().IsPercentOrCalc() || 309 child->Style()->LogicalHeight().IsPercentOrCalc() ||
290 child->Style()->LogicalMinHeight().IsPercentOrCalc() || 310 child->Style()->LogicalMinHeight().IsPercentOrCalc() ||
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 LayoutUnit LayoutView::ViewLogicalHeightForPercentages() const { 714 LayoutUnit LayoutView::ViewLogicalHeightForPercentages() const {
695 if (ShouldUsePrintingLayout()) 715 if (ShouldUsePrintingLayout())
696 return PageLogicalHeight(); 716 return PageLogicalHeight();
697 return LayoutUnit(ViewLogicalHeight()); 717 return LayoutUnit(ViewLogicalHeight());
698 } 718 }
699 719
700 float LayoutView::ZoomFactor() const { 720 float LayoutView::ZoomFactor() const {
701 return frame_view_->GetFrame().PageZoomFactor(); 721 return frame_view_->GetFrame().PageZoomFactor();
702 } 722 }
703 723
724 void LayoutView::UpdateAfterLayout() {
725 // Unlike every other layer, the root PaintLayer takes its size from the
726 // layout viewport size. The call to AdjustViewSize() will update the
727 // frame's contents size, which will also update the page's minimum scale
728 // factor. The call to ResizeAfterLayout() will calculate the layout viewport
729 // size based on the page minimum scale factor, and then update the FrameView
730 // with the new size.
731 if (HasOverflowClip())
732 GetScrollableArea()->ClampScrollOffsetAfterOverflowChange();
733 LocalFrame& frame = GetFrameView()->GetFrame();
734 if (!GetDocument().Printing())
735 GetFrameView()->AdjustViewSize();
736 frame.GetChromeClient().ResizeAfterLayout(&frame);
737 LayoutBlock::UpdateAfterLayout();
738 }
739
704 void LayoutView::UpdateHitTestResult(HitTestResult& result, 740 void LayoutView::UpdateHitTestResult(HitTestResult& result,
705 const LayoutPoint& point) { 741 const LayoutPoint& point) {
706 if (result.InnerNode()) 742 if (result.InnerNode())
707 return; 743 return;
708 744
709 Node* node = GetDocument().documentElement(); 745 Node* node = GetDocument().documentElement();
710 if (node) { 746 if (node) {
711 LayoutPoint adjusted_point = point; 747 LayoutPoint adjusted_point = point;
712 OffsetForContents(adjusted_point); 748 OffsetForContents(adjusted_point);
713 result.SetNodeAndPosition(node, adjusted_point); 749 result.SetNodeAndPosition(node, adjusted_point);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 // Frame scroll corner is painted using LayoutView as the display item client. 843 // Frame scroll corner is painted using LayoutView as the display item client.
808 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && 844 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
809 (GetFrameView()->HorizontalScrollbar() || 845 (GetFrameView()->HorizontalScrollbar() ||
810 GetFrameView()->VerticalScrollbar())) 846 GetFrameView()->VerticalScrollbar()))
811 return false; 847 return false;
812 848
813 return LayoutBlockFlow::PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); 849 return LayoutBlockFlow::PaintedOutputOfObjectHasNoEffectRegardlessOfSize();
814 } 850 }
815 851
816 } // namespace blink 852 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutView.h ('k') | third_party/WebKit/Source/core/paint/BoxPaintInvalidatorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698