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. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 { | 77 { |
78 } | 78 } |
79 | 79 |
80 bool RenderView::hitTest(const HitTestRequest& request, HitTestResult& result) | 80 bool RenderView::hitTest(const HitTestRequest& request, HitTestResult& result) |
81 { | 81 { |
82 return layer()->hitTest(request, result); | 82 return layer()->hitTest(request, result); |
83 } | 83 } |
84 | 84 |
85 void RenderView::computeLogicalHeight() | 85 void RenderView::computeLogicalHeight() |
86 { | 86 { |
87 if (!printing() && m_frameView) | 87 if (!shouldUsePrintingLayout() && m_frameView) |
88 setLogicalHeight(viewLogicalHeight()); | 88 setLogicalHeight(viewLogicalHeight()); |
89 } | 89 } |
90 | 90 |
91 void RenderView::computeLogicalWidth() | 91 void RenderView::computeLogicalWidth() |
92 { | 92 { |
93 if (!printing() && m_frameView) | 93 if (!shouldUsePrintingLayout() && m_frameView) |
94 setLogicalWidth(viewLogicalWidth()); | 94 setLogicalWidth(viewLogicalWidth()); |
95 } | 95 } |
96 | 96 |
97 void RenderView::computePreferredLogicalWidths() | 97 void RenderView::computePreferredLogicalWidths() |
98 { | 98 { |
99 ASSERT(preferredLogicalWidthsDirty()); | 99 ASSERT(preferredLogicalWidthsDirty()); |
100 | 100 |
101 RenderBlock::computePreferredLogicalWidths(); | 101 RenderBlock::computePreferredLogicalWidths(); |
102 } | 102 } |
103 | 103 |
104 bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const | 104 bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const |
105 { | 105 { |
106 return child->isBox(); | 106 return child->isBox(); |
107 } | 107 } |
108 | 108 |
109 void RenderView::layout() | 109 void RenderView::layout() |
110 { | 110 { |
111 if (!document()->paginated()) | 111 if (!document()->paginated()) |
112 setPageLogicalHeight(0); | 112 setPageLogicalHeight(0); |
113 | 113 |
114 if (printing()) | 114 if (shouldUsePrintingLayout()) |
115 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth()
; | 115 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth()
; |
116 | 116 |
117 // Use calcWidth/Height to get the new width/height, since this will take th
e full page zoom factor into account. | 117 // Use calcWidth/Height to get the new width/height, since this will take th
e full page zoom factor into account. |
118 bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth
() || height() != viewHeight()); | 118 bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width
() != viewWidth() || height() != viewHeight()); |
119 if (relayoutChildren) { | 119 if (relayoutChildren) { |
120 setChildNeedsLayout(true, MarkOnlyThis); | 120 setChildNeedsLayout(true, MarkOnlyThis); |
121 for (RenderObject* child = firstChild(); child; child = child->nextSibli
ng()) { | 121 for (RenderObject* child = firstChild(); child; child = child->nextSibli
ng()) { |
122 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight(
)) | 122 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight(
)) |
123 || child->style()->logicalHeight().isPercent() | 123 || child->style()->logicalHeight().isPercent() |
124 || child->style()->logicalMinHeight().isPercent() | 124 || child->style()->logicalMinHeight().isPercent() |
125 || child->style()->logicalMaxHeight().isPercent()) | 125 || child->style()->logicalMaxHeight().isPercent()) |
126 child->setChildNeedsLayout(true, MarkOnlyThis); | 126 child->setChildNeedsLayout(true, MarkOnlyThis); |
127 } | 127 } |
128 } | 128 } |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 { | 640 { |
641 startPos = m_selectionStartPos; | 641 startPos = m_selectionStartPos; |
642 endPos = m_selectionEndPos; | 642 endPos = m_selectionEndPos; |
643 } | 643 } |
644 | 644 |
645 bool RenderView::printing() const | 645 bool RenderView::printing() const |
646 { | 646 { |
647 return document()->printing(); | 647 return document()->printing(); |
648 } | 648 } |
649 | 649 |
| 650 bool RenderView::shouldUsePrintingLayout() const |
| 651 { |
| 652 if (!printing() || !m_frameView) |
| 653 return false; |
| 654 Frame* frame = m_frameView->frame(); |
| 655 // Only root frame should have special handling for printing. |
| 656 return frame && !frame->tree()->parent(); |
| 657 } |
| 658 |
650 size_t RenderView::getRetainedWidgets(Vector<RenderWidget*>& renderWidgets) | 659 size_t RenderView::getRetainedWidgets(Vector<RenderWidget*>& renderWidgets) |
651 { | 660 { |
652 size_t size = m_widgets.size(); | 661 size_t size = m_widgets.size(); |
653 | 662 |
654 renderWidgets.reserveCapacity(size); | 663 renderWidgets.reserveCapacity(size); |
655 | 664 |
656 RenderWidgetSet::const_iterator end = m_widgets.end(); | 665 RenderWidgetSet::const_iterator end = m_widgets.end(); |
657 for (RenderWidgetSet::const_iterator it = m_widgets.begin(); it != end; ++it
) { | 666 for (RenderWidgetSet::const_iterator it = m_widgets.begin(); it != end; ++it
) { |
658 renderWidgets.uncheckedAppend(*it); | 667 renderWidgets.uncheckedAppend(*it); |
659 (*it)->ref(); | 668 (*it)->ref(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 size_t size = getRetainedWidgets(renderWidgets); | 713 size_t size = getRetainedWidgets(renderWidgets); |
705 | 714 |
706 for (size_t i = 0; i < size; ++i) | 715 for (size_t i = 0; i < size; ++i) |
707 renderWidgets[i]->notifyWidget(notification); | 716 renderWidgets[i]->notifyWidget(notification); |
708 | 717 |
709 releaseWidgets(renderWidgets); | 718 releaseWidgets(renderWidgets); |
710 } | 719 } |
711 | 720 |
712 LayoutRect RenderView::viewRect() const | 721 LayoutRect RenderView::viewRect() const |
713 { | 722 { |
714 if (printing()) | 723 if (shouldUsePrintingLayout()) |
715 return LayoutRect(LayoutPoint(), size()); | 724 return LayoutRect(LayoutPoint(), size()); |
716 if (m_frameView) | 725 if (m_frameView) |
717 return m_frameView->visibleContentRect(); | 726 return m_frameView->visibleContentRect(); |
718 return LayoutRect(); | 727 return LayoutRect(); |
719 } | 728 } |
720 | 729 |
721 | 730 |
722 IntRect RenderView::unscaledDocumentRect() const | 731 IntRect RenderView::unscaledDocumentRect() const |
723 { | 732 { |
724 LayoutRect overflowRect(layoutOverflowRect()); | 733 LayoutRect overflowRect(layoutOverflowRect()); |
(...skipping 19 matching lines...) Expand all Loading... |
744 { | 753 { |
745 IntRect overflowRect(unscaledDocumentRect()); | 754 IntRect overflowRect(unscaledDocumentRect()); |
746 if (hasTransform()) | 755 if (hasTransform()) |
747 overflowRect = layer()->currentTransform().mapRect(overflowRect); | 756 overflowRect = layer()->currentTransform().mapRect(overflowRect); |
748 return overflowRect; | 757 return overflowRect; |
749 } | 758 } |
750 | 759 |
751 int RenderView::viewHeight() const | 760 int RenderView::viewHeight() const |
752 { | 761 { |
753 int height = 0; | 762 int height = 0; |
754 if (!printing() && m_frameView) { | 763 if (!shouldUsePrintingLayout() && m_frameView) { |
755 height = m_frameView->layoutHeight(); | 764 height = m_frameView->layoutHeight(); |
756 height = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom()
* float(height)) : height; | 765 height = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom()
* float(height)) : height; |
757 } | 766 } |
758 return height; | 767 return height; |
759 } | 768 } |
760 | 769 |
761 int RenderView::viewWidth() const | 770 int RenderView::viewWidth() const |
762 { | 771 { |
763 int width = 0; | 772 int width = 0; |
764 if (!printing() && m_frameView) { | 773 if (!shouldUsePrintingLayout() && m_frameView) { |
765 width = m_frameView->layoutWidth(); | 774 width = m_frameView->layoutWidth(); |
766 width = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom() *
float(width)) : width; | 775 width = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom() *
float(width)) : width; |
767 } | 776 } |
768 return width; | 777 return width; |
769 } | 778 } |
770 | 779 |
771 int RenderView::viewLogicalHeight() const | 780 int RenderView::viewLogicalHeight() const |
772 { | 781 { |
773 int height = style()->isHorizontalWritingMode() ? viewHeight() : viewWidth()
; | 782 int height = style()->isHorizontalWritingMode() ? viewHeight() : viewWidth()
; |
774 | 783 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 | 952 |
944 void RenderView::removeFixedPositionedObject(RenderBox* object) | 953 void RenderView::removeFixedPositionedObject(RenderBox* object) |
945 { | 954 { |
946 if (!m_positionedObjects) | 955 if (!m_positionedObjects) |
947 return; | 956 return; |
948 | 957 |
949 m_positionedObjects->remove(object); | 958 m_positionedObjects->remove(object); |
950 } | 959 } |
951 | 960 |
952 } // namespace WebCore | 961 } // namespace WebCore |
OLD | NEW |