OLD | NEW |
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 Loading... |
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 Loading... |
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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 LayoutUnit LayoutView::ViewLogicalHeightForPercentages() const { | 719 LayoutUnit LayoutView::ViewLogicalHeightForPercentages() const { |
700 if (ShouldUsePrintingLayout()) | 720 if (ShouldUsePrintingLayout()) |
701 return PageLogicalHeight(); | 721 return PageLogicalHeight(); |
702 return LayoutUnit(ViewLogicalHeight()); | 722 return LayoutUnit(ViewLogicalHeight()); |
703 } | 723 } |
704 | 724 |
705 float LayoutView::ZoomFactor() const { | 725 float LayoutView::ZoomFactor() const { |
706 return frame_view_->GetFrame().PageZoomFactor(); | 726 return frame_view_->GetFrame().PageZoomFactor(); |
707 } | 727 } |
708 | 728 |
| 729 void LayoutView::UpdateAfterLayout() { |
| 730 // Unlike every other layer, the root PaintLayer takes its size from the |
| 731 // layout viewport size. The call to AdjustViewSize() will update the |
| 732 // frame's contents size, which will also update the page's minimum scale |
| 733 // factor. The call to ResizeAfterLayout() will calculate the layout viewport |
| 734 // size based on the page minimum scale factor, and then update the FrameView |
| 735 // with the new size. |
| 736 if (HasOverflowClip()) |
| 737 GetScrollableArea()->ClampScrollOffsetAfterOverflowChange(); |
| 738 LocalFrame& frame = GetFrameView()->GetFrame(); |
| 739 if (!GetDocument().Printing()) |
| 740 GetFrameView()->AdjustViewSize(); |
| 741 frame.GetChromeClient().ResizeAfterLayout(&frame); |
| 742 LayoutBlock::UpdateAfterLayout(); |
| 743 } |
| 744 |
709 void LayoutView::UpdateHitTestResult(HitTestResult& result, | 745 void LayoutView::UpdateHitTestResult(HitTestResult& result, |
710 const LayoutPoint& point) { | 746 const LayoutPoint& point) { |
711 if (result.InnerNode()) | 747 if (result.InnerNode()) |
712 return; | 748 return; |
713 | 749 |
714 Node* node = GetDocument().documentElement(); | 750 Node* node = GetDocument().documentElement(); |
715 if (node) { | 751 if (node) { |
716 LayoutPoint adjusted_point = point; | 752 LayoutPoint adjusted_point = point; |
717 OffsetForContents(adjusted_point); | 753 OffsetForContents(adjusted_point); |
718 result.SetNodeAndPosition(node, adjusted_point); | 754 result.SetNodeAndPosition(node, adjusted_point); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 // Frame scroll corner is painted using LayoutView as the display item client. | 848 // Frame scroll corner is painted using LayoutView as the display item client. |
813 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && | 849 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && |
814 (GetFrameView()->HorizontalScrollbar() || | 850 (GetFrameView()->HorizontalScrollbar() || |
815 GetFrameView()->VerticalScrollbar())) | 851 GetFrameView()->VerticalScrollbar())) |
816 return false; | 852 return false; |
817 | 853 |
818 return LayoutBlockFlow::PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); | 854 return LayoutBlockFlow::PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); |
819 } | 855 } |
820 | 856 |
821 } // namespace blink | 857 } // namespace blink |
OLD | NEW |