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 11 matching lines...) Expand all Loading... |
22 #include "core/rendering/RenderView.h" | 22 #include "core/rendering/RenderView.h" |
23 | 23 |
24 #include "RuntimeEnabledFeatures.h" | 24 #include "RuntimeEnabledFeatures.h" |
25 #include "core/dom/Document.h" | 25 #include "core/dom/Document.h" |
26 #include "core/dom/Element.h" | 26 #include "core/dom/Element.h" |
27 #include "core/html/HTMLDialogElement.h" | 27 #include "core/html/HTMLDialogElement.h" |
28 #include "core/html/HTMLFrameOwnerElement.h" | 28 #include "core/html/HTMLFrameOwnerElement.h" |
29 #include "core/html/HTMLIFrameElement.h" | 29 #include "core/html/HTMLIFrameElement.h" |
30 #include "core/frame/Frame.h" | 30 #include "core/frame/Frame.h" |
31 #include "core/page/Page.h" | 31 #include "core/page/Page.h" |
32 #include "core/rendering/ColumnInfo.h" | |
33 #include "core/rendering/CompositedLayerMapping.h" | 32 #include "core/rendering/CompositedLayerMapping.h" |
34 #include "core/rendering/FlowThreadController.h" | 33 #include "core/rendering/FlowThreadController.h" |
35 #include "core/rendering/GraphicsContextAnnotator.h" | 34 #include "core/rendering/GraphicsContextAnnotator.h" |
36 #include "core/rendering/HitTestResult.h" | 35 #include "core/rendering/HitTestResult.h" |
37 #include "core/rendering/LayoutRectRecorder.h" | 36 #include "core/rendering/LayoutRectRecorder.h" |
38 #include "core/rendering/RenderFlowThread.h" | 37 #include "core/rendering/RenderFlowThread.h" |
39 #include "core/rendering/RenderGeometryMap.h" | 38 #include "core/rendering/RenderGeometryMap.h" |
40 #include "core/rendering/RenderLayer.h" | 39 #include "core/rendering/RenderLayer.h" |
41 #include "core/rendering/RenderLayerCompositor.h" | 40 #include "core/rendering/RenderLayerCompositor.h" |
42 #include "core/rendering/RenderSelectionInfo.h" | 41 #include "core/rendering/RenderSelectionInfo.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 { | 96 { |
98 computedValues.m_extent = (!shouldUsePrintingLayout() && m_frameView) ? Layo
utUnit(viewLogicalHeight()) : logicalHeight; | 97 computedValues.m_extent = (!shouldUsePrintingLayout() && m_frameView) ? Layo
utUnit(viewLogicalHeight()) : logicalHeight; |
99 } | 98 } |
100 | 99 |
101 void RenderView::updateLogicalWidth() | 100 void RenderView::updateLogicalWidth() |
102 { | 101 { |
103 if (!shouldUsePrintingLayout() && m_frameView) | 102 if (!shouldUsePrintingLayout() && m_frameView) |
104 setLogicalWidth(viewLogicalWidth()); | 103 setLogicalWidth(viewLogicalWidth()); |
105 } | 104 } |
106 | 105 |
107 LayoutUnit RenderView::availableLogicalHeight(AvailableLogicalHeightType heightT
ype) const | |
108 { | |
109 // If we have columns, then the available logical height is reduced to the c
olumn height. | |
110 if (hasColumns()) | |
111 return columnInfo()->columnHeight(); | |
112 return RenderBlock::availableLogicalHeight(heightType); | |
113 } | |
114 | |
115 bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const | 106 bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const |
116 { | 107 { |
117 return child->isBox(); | 108 return child->isBox(); |
118 } | 109 } |
119 | 110 |
120 static bool dialogNeedsCentering(const RenderStyle* style) | 111 static bool dialogNeedsCentering(const RenderStyle* style) |
121 { | 112 { |
122 return style->position() == AbsolutePosition && style->hasAutoTopAndBottom()
; | 113 return style->position() == AbsolutePosition && style->hasAutoTopAndBottom()
; |
123 } | 114 } |
124 | 115 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 381 } |
391 | 382 |
392 bool RenderView::requiresColumns(int desiredColumnCount) const | 383 bool RenderView::requiresColumns(int desiredColumnCount) const |
393 { | 384 { |
394 if (m_frameView) | 385 if (m_frameView) |
395 return m_frameView->pagination().mode != Pagination::Unpaginated; | 386 return m_frameView->pagination().mode != Pagination::Unpaginated; |
396 | 387 |
397 return RenderBlock::requiresColumns(desiredColumnCount); | 388 return RenderBlock::requiresColumns(desiredColumnCount); |
398 } | 389 } |
399 | 390 |
400 void RenderView::calcColumnWidth() | |
401 { | |
402 int columnWidth = contentLogicalWidth(); | |
403 if (m_frameView && style()->hasInlineColumnAxis()) { | |
404 if (int pageLength = m_frameView->pagination().pageLength) | |
405 columnWidth = pageLength; | |
406 } | |
407 setDesiredColumnCountAndWidth(1, columnWidth); | |
408 } | |
409 | |
410 ColumnInfo::PaginationUnit RenderView::paginationUnit() const | |
411 { | |
412 if (m_frameView) | |
413 return m_frameView->pagination().behavesLikeColumns ? ColumnInfo::Column
: ColumnInfo::Page; | |
414 | |
415 return ColumnInfo::Page; | |
416 } | |
417 | |
418 void RenderView::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 391 void RenderView::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
419 { | 392 { |
420 // If we ever require layout but receive a paint anyway, something has gone
horribly wrong. | 393 // If we ever require layout but receive a paint anyway, something has gone
horribly wrong. |
421 ASSERT(!needsLayout()); | 394 ASSERT(!needsLayout()); |
422 // RenderViews should never be called to paint with an offset not on device
pixels. | 395 // RenderViews should never be called to paint with an offset not on device
pixels. |
423 ASSERT(LayoutPoint(IntPoint(paintOffset.x(), paintOffset.y())) == paintOffse
t); | 396 ASSERT(LayoutPoint(IntPoint(paintOffset.x(), paintOffset.y())) == paintOffse
t); |
424 | 397 |
425 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); | 398 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); |
426 | 399 |
427 // This avoids painting garbage between columns if there is a column gap. | 400 // This avoids painting garbage between columns if there is a column gap. |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 RenderObject* rootObject = document().documentElement() ? document().documen
tElement()->renderer() : 0; | 887 RenderObject* rootObject = document().documentElement() ? document().documen
tElement()->renderer() : 0; |
915 if (!rootObject) | 888 if (!rootObject) |
916 return false; | 889 return false; |
917 | 890 |
918 RenderObject* rootRenderer = rootObject->rendererForRootBackground(); | 891 RenderObject* rootRenderer = rootObject->rendererForRootBackground(); |
919 return rootRenderer->hasEntirelyFixedBackground(); | 892 return rootRenderer->hasEntirelyFixedBackground(); |
920 } | 893 } |
921 | 894 |
922 LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const | 895 LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const |
923 { | 896 { |
924 if (!hasColumns()) | 897 return unscaledDocumentRect(); |
925 return unscaledDocumentRect(); | |
926 | |
927 ColumnInfo* columnInfo = this->columnInfo(); | |
928 LayoutRect backgroundRect(0, 0, columnInfo->desiredColumnWidth(), columnInfo
->columnHeight() * columnInfo->columnCount()); | |
929 if (!isHorizontalWritingMode()) | |
930 backgroundRect = backgroundRect.transposedRect(); | |
931 backgroundRenderer->flipForWritingMode(backgroundRect); | |
932 | |
933 return backgroundRect; | |
934 } | 898 } |
935 | 899 |
936 IntRect RenderView::documentRect() const | 900 IntRect RenderView::documentRect() const |
937 { | 901 { |
938 FloatRect overflowRect(unscaledDocumentRect()); | 902 FloatRect overflowRect(unscaledDocumentRect()); |
939 if (hasTransform()) | 903 if (hasTransform()) |
940 overflowRect = layer()->currentTransform().mapRect(overflowRect); | 904 overflowRect = layer()->currentTransform().mapRect(overflowRect); |
941 return IntRect(overflowRect); | 905 return IntRect(overflowRect); |
942 } | 906 } |
943 | 907 |
(...skipping 10 matching lines...) Expand all Loading... |
954 { | 918 { |
955 int width = 0; | 919 int width = 0; |
956 if (!shouldUsePrintingLayout() && m_frameView) | 920 if (!shouldUsePrintingLayout() && m_frameView) |
957 width = m_frameView->layoutSize(scrollbarInclusion).width(); | 921 width = m_frameView->layoutSize(scrollbarInclusion).width(); |
958 | 922 |
959 return width; | 923 return width; |
960 } | 924 } |
961 | 925 |
962 int RenderView::viewLogicalHeight(ScrollableArea::IncludeScrollbarsInRect scroll
barInclusion) const | 926 int RenderView::viewLogicalHeight(ScrollableArea::IncludeScrollbarsInRect scroll
barInclusion) const |
963 { | 927 { |
964 int height = style()->isHorizontalWritingMode() ? viewHeight(scrollbarInclus
ion) : viewWidth(scrollbarInclusion); | 928 return style()->isHorizontalWritingMode() ? viewHeight(scrollbarInclusion) :
viewWidth(scrollbarInclusion); |
965 | |
966 if (hasColumns() && !style()->hasInlineColumnAxis()) { | |
967 if (int pageLength = m_frameView->pagination().pageLength) | |
968 height = pageLength; | |
969 } | |
970 | |
971 return height; | |
972 } | 929 } |
973 | 930 |
974 float RenderView::zoomFactor() const | 931 float RenderView::zoomFactor() const |
975 { | 932 { |
976 return m_frameView->frame().pageZoomFactor(); | 933 return m_frameView->frame().pageZoomFactor(); |
977 } | 934 } |
978 | 935 |
979 void RenderView::pushLayoutState(RenderObject* root) | 936 void RenderView::pushLayoutState(RenderObject* root) |
980 { | 937 { |
981 ASSERT(m_layoutStateDisableCount == 0); | 938 ASSERT(m_layoutStateDisableCount == 0); |
982 ASSERT(m_layoutState == 0); | 939 ASSERT(m_layoutState == 0); |
983 | 940 |
984 pushLayoutStateForCurrentFlowThread(root); | 941 pushLayoutStateForCurrentFlowThread(root); |
985 m_layoutState = new LayoutState(root); | 942 m_layoutState = new LayoutState(root); |
986 } | 943 } |
987 | 944 |
988 bool RenderView::shouldDisableLayoutStateForSubtree(RenderObject* renderer) cons
t | 945 bool RenderView::shouldDisableLayoutStateForSubtree(RenderObject* renderer) cons
t |
989 { | 946 { |
990 RenderObject* o = renderer; | 947 RenderObject* o = renderer; |
991 while (o) { | 948 while (o) { |
992 if (o->hasColumns() || o->hasTransform() || o->hasReflection()) | 949 if (o->hasTransform() || o->hasReflection()) |
993 return true; | 950 return true; |
994 o = o->container(); | 951 o = o->container(); |
995 } | 952 } |
996 return false; | 953 return false; |
997 } | 954 } |
998 | 955 |
999 void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& p
oint) | 956 void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& p
oint) |
1000 { | 957 { |
1001 if (result.innerNode()) | 958 if (result.innerNode()) |
1002 return; | 959 return; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 return viewWidth(ScrollableArea::IncludeScrollbars) / scale; | 1061 return viewWidth(ScrollableArea::IncludeScrollbars) / scale; |
1105 } | 1062 } |
1106 | 1063 |
1107 double RenderView::layoutViewportHeight() const | 1064 double RenderView::layoutViewportHeight() const |
1108 { | 1065 { |
1109 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 1066 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
1110 return viewHeight(ScrollableArea::IncludeScrollbars) / scale; | 1067 return viewHeight(ScrollableArea::IncludeScrollbars) / scale; |
1111 } | 1068 } |
1112 | 1069 |
1113 } // namespace WebCore | 1070 } // namespace WebCore |
OLD | NEW |