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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return RenderBlockFlow::availableLogicalHeight(heightType); | 112 return RenderBlockFlow::availableLogicalHeight(heightType); |
113 } | 113 } |
114 | 114 |
115 bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const | 115 bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const |
116 { | 116 { |
117 return child->isBox(); | 117 return child->isBox(); |
118 } | 118 } |
119 | 119 |
120 static bool canCenterDialog(const RenderStyle* style) | 120 static bool canCenterDialog(const RenderStyle* style) |
121 { | 121 { |
122 // FIXME: We must center for FixedPosition as well. | 122 return (style->position() == AbsolutePosition || style->position() == FixedP
osition) && style->hasAutoTopAndBottom(); |
123 return style->position() == AbsolutePosition && style->hasAutoTopAndBottom()
; | |
124 } | 123 } |
125 | 124 |
126 void RenderView::positionDialog(RenderBox* box) | 125 void RenderView::positionDialog(RenderBox* box) |
127 { | 126 { |
128 HTMLDialogElement* dialog = toHTMLDialogElement(box->node()); | 127 HTMLDialogElement* dialog = toHTMLDialogElement(box->node()); |
129 if (dialog->centeringMode() == HTMLDialogElement::NotCentered) | 128 if (dialog->centeringMode() == HTMLDialogElement::NotCentered) |
130 return; | 129 return; |
131 if (dialog->centeringMode() == HTMLDialogElement::Centered) { | 130 if (dialog->centeringMode() == HTMLDialogElement::Centered) { |
132 if (canCenterDialog(box->style())) | 131 if (canCenterDialog(box->style())) |
133 box->setY(dialog->centeredPosition()); | 132 box->setY(dialog->centeredPosition()); |
134 return; | 133 return; |
135 } | 134 } |
136 | 135 |
137 ASSERT(dialog->centeringMode() == HTMLDialogElement::NeedsCentering); | 136 ASSERT(dialog->centeringMode() == HTMLDialogElement::NeedsCentering); |
138 if (!canCenterDialog(box->style())) { | 137 if (!canCenterDialog(box->style())) { |
139 dialog->setNotCentered(); | 138 dialog->setNotCentered(); |
140 return; | 139 return; |
141 } | 140 } |
142 FrameView* frameView = document().view(); | 141 FrameView* frameView = document().view(); |
143 int scrollTop = frameView->scrollOffset().height(); | 142 LayoutUnit top = (box->style()->position() == FixedPosition) ? 0 : frameView
->scrollOffset().height(); |
144 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 143 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
145 LayoutUnit top = scrollTop; | |
146 if (box->height() < visibleHeight) | 144 if (box->height() < visibleHeight) |
147 top += (visibleHeight - box->height()) / 2; | 145 top += (visibleHeight - box->height()) / 2; |
148 box->setY(top); | 146 box->setY(top); |
149 dialog->setCentered(top); | 147 dialog->setCentered(top); |
150 } | 148 } |
151 | 149 |
152 void RenderView::positionDialogs() | 150 void RenderView::positionDialogs() |
153 { | 151 { |
154 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | 152 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); |
155 if (!positionedDescendants) | 153 if (!positionedDescendants) |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 return viewWidth(IncludeScrollbars) / scale; | 995 return viewWidth(IncludeScrollbars) / scale; |
998 } | 996 } |
999 | 997 |
1000 double RenderView::layoutViewportHeight() const | 998 double RenderView::layoutViewportHeight() const |
1001 { | 999 { |
1002 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 1000 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
1003 return viewHeight(IncludeScrollbars) / scale; | 1001 return viewHeight(IncludeScrollbars) / scale; |
1004 } | 1002 } |
1005 | 1003 |
1006 } // namespace WebCore | 1004 } // namespace WebCore |
OLD | NEW |