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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 RenderView::RenderView(Document* document) | 39 RenderView::RenderView(Document* document) |
40 : RenderBlockFlow(document) | 40 : RenderBlockFlow(document) |
41 , m_frameView(document->view()) | 41 , m_frameView(document->view()) |
42 , m_selectionStart(nullptr) | 42 , m_selectionStart(nullptr) |
43 , m_selectionEnd(nullptr) | 43 , m_selectionEnd(nullptr) |
44 , m_selectionStartPos(-1) | 44 , m_selectionStartPos(-1) |
45 , m_selectionEndPos(-1) | 45 , m_selectionEndPos(-1) |
46 , m_layoutState(0) | |
47 , m_renderCounterCount(0) | 46 , m_renderCounterCount(0) |
48 , m_hitTestCount(0) | 47 , m_hitTestCount(0) |
49 { | 48 { |
50 // init RenderObject attributes | 49 // init RenderObject attributes |
51 setInline(false); | 50 setInline(false); |
52 | 51 |
53 m_minPreferredLogicalWidth = 0; | 52 m_minPreferredLogicalWidth = 0; |
54 m_maxPreferredLogicalWidth = 0; | 53 m_maxPreferredLogicalWidth = 0; |
55 | 54 |
56 setPreferredLogicalWidthsDirty(MarkOnlyThis); | 55 setPreferredLogicalWidthsDirty(MarkOnlyThis); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 LayoutUnit RenderView::availableLogicalHeight(AvailableLogicalHeightType heightT
ype) const | 119 LayoutUnit RenderView::availableLogicalHeight(AvailableLogicalHeightType heightT
ype) const |
121 { | 120 { |
122 return RenderBlockFlow::availableLogicalHeight(heightType); | 121 return RenderBlockFlow::availableLogicalHeight(heightType); |
123 } | 122 } |
124 | 123 |
125 bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const | 124 bool RenderView::isChildAllowed(RenderObject* child, RenderStyle*) const |
126 { | 125 { |
127 return child->isBox(); | 126 return child->isBox(); |
128 } | 127 } |
129 | 128 |
130 void RenderView::layoutContent() | |
131 { | |
132 ASSERT(needsLayout()); | |
133 | |
134 RenderBlockFlow::layout(); | |
135 | |
136 #if ENABLE(ASSERT) | |
137 checkLayoutState(); | |
138 #endif | |
139 } | |
140 | |
141 #if ENABLE(ASSERT) | |
142 void RenderView::checkLayoutState() | |
143 { | |
144 ASSERT(!m_layoutState->next()); | |
145 } | |
146 #endif | |
147 | |
148 void RenderView::layout() | 129 void RenderView::layout() |
149 { | 130 { |
150 SubtreeLayoutScope layoutScope(*this); | 131 SubtreeLayoutScope layoutScope(*this); |
151 | 132 |
152 bool relayoutChildren = (!m_frameView || width() != viewWidth() || height()
!= viewHeight()); | 133 bool relayoutChildren = (!m_frameView || width() != viewWidth() || height()
!= viewHeight()); |
153 if (relayoutChildren) { | 134 if (relayoutChildren) { |
154 layoutScope.setChildNeedsLayout(this); | 135 layoutScope.setChildNeedsLayout(this); |
155 for (RenderObject* child = firstChild(); child; child = child->nextSibli
ng()) { | 136 for (RenderObject* child = firstChild(); child; child = child->nextSibli
ng()) { |
156 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight(
)) | 137 if ((child->isBox() && toRenderBox(child)->hasRelativeLogicalHeight(
)) |
157 || child->style()->logicalHeight().isPercent() | 138 || child->style()->logicalHeight().isPercent() |
158 || child->style()->logicalMinHeight().isPercent() | 139 || child->style()->logicalMinHeight().isPercent() |
159 || child->style()->logicalMaxHeight().isPercent()) | 140 || child->style()->logicalMaxHeight().isPercent()) |
160 layoutScope.setChildNeedsLayout(child); | 141 layoutScope.setChildNeedsLayout(child); |
161 } | 142 } |
162 } | 143 } |
163 | 144 |
164 ASSERT(!m_layoutState); | |
165 if (!needsLayout()) | 145 if (!needsLayout()) |
166 return; | 146 return; |
167 | 147 |
168 LayoutState rootLayoutState(*this); | 148 RenderBlockFlow::layout(); |
169 | |
170 layoutContent(); | |
171 | |
172 #if ENABLE(ASSERT) | |
173 checkLayoutState(); | |
174 #endif | |
175 clearNeedsLayout(); | 149 clearNeedsLayout(); |
176 } | 150 } |
177 | 151 |
178 void RenderView::mapLocalToContainer(const RenderLayerModelObject* paintInvalida
tionContainer, TransformState& transformState, MapCoordinatesFlags mode) const | 152 void RenderView::mapLocalToContainer(const RenderLayerModelObject* paintInvalida
tionContainer, TransformState& transformState, MapCoordinatesFlags mode) const |
179 { | 153 { |
180 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor
mFromContainer(0)) { | 154 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor
mFromContainer(0)) { |
181 TransformationMatrix t; | 155 TransformationMatrix t; |
182 getTransformFromContainer(0, LayoutSize(), t); | 156 getTransformFromContainer(0, LayoutSize(), t); |
183 transformState.applyTransform(t); | 157 transformState.applyTransform(t); |
184 } | 158 } |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 int RenderView::viewLogicalHeight() const | 374 int RenderView::viewLogicalHeight() const |
401 { | 375 { |
402 return viewHeight(); | 376 return viewHeight(); |
403 } | 377 } |
404 | 378 |
405 LayoutUnit RenderView::viewLogicalHeightForPercentages() const | 379 LayoutUnit RenderView::viewLogicalHeightForPercentages() const |
406 { | 380 { |
407 return viewLogicalHeight(); | 381 return viewLogicalHeight(); |
408 } | 382 } |
409 | 383 |
410 void RenderView::pushLayoutState(LayoutState& layoutState) | |
411 { | |
412 m_layoutState = &layoutState; | |
413 } | |
414 | |
415 void RenderView::popLayoutState() | |
416 { | |
417 ASSERT(m_layoutState); | |
418 m_layoutState = m_layoutState->next(); | |
419 } | |
420 | |
421 // FIXME(sky): remove | 384 // FIXME(sky): remove |
422 double RenderView::layoutViewportWidth() const | 385 double RenderView::layoutViewportWidth() const |
423 { | 386 { |
424 return viewWidth(); | 387 return viewWidth(); |
425 } | 388 } |
426 | 389 |
427 // FIXME(sky): remove | 390 // FIXME(sky): remove |
428 double RenderView::layoutViewportHeight() const | 391 double RenderView::layoutViewportHeight() const |
429 { | 392 { |
430 return viewHeight(); | 393 return viewHeight(); |
431 } | 394 } |
432 | 395 |
433 void RenderView::addIFrame(RenderIFrame* iframe) | 396 void RenderView::addIFrame(RenderIFrame* iframe) |
434 { | 397 { |
435 m_iframes.add(iframe); | 398 m_iframes.add(iframe); |
436 } | 399 } |
437 | 400 |
438 void RenderView::removeIFrame(RenderIFrame* iframe) | 401 void RenderView::removeIFrame(RenderIFrame* iframe) |
439 { | 402 { |
440 m_iframes.remove(iframe); | 403 m_iframes.remove(iframe); |
441 } | 404 } |
442 | 405 |
443 void RenderView::updateIFramesAfterLayout() | 406 void RenderView::updateIFramesAfterLayout() |
444 { | 407 { |
445 for (auto& iframe: m_iframes) | 408 for (auto& iframe: m_iframes) |
446 iframe->updateWidgetBounds(); | 409 iframe->updateWidgetBounds(); |
447 } | 410 } |
448 | 411 |
449 } // namespace blink | 412 } // namespace blink |
OLD | NEW |