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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 void RenderView::checkLayoutState(const LayoutState& state) | 185 void RenderView::checkLayoutState(const LayoutState& state) |
186 { | 186 { |
187 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { | 187 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { |
188 ASSERT(layoutDeltaMatches(LayoutSize())); | 188 ASSERT(layoutDeltaMatches(LayoutSize())); |
189 } | 189 } |
190 ASSERT(!m_layoutStateDisableCount); | 190 ASSERT(!m_layoutStateDisableCount); |
191 ASSERT(m_layoutState == &state); | 191 ASSERT(m_layoutState == &state); |
192 } | 192 } |
193 #endif | 193 #endif |
194 | 194 |
195 static RenderBox* enclosingSeamlessRenderer(const Document& doc) | |
196 { | |
197 Element* ownerElement = doc.seamlessParentIFrame(); | |
198 if (!ownerElement) | |
199 return 0; | |
200 return ownerElement->renderBox(); | |
201 } | |
202 | |
203 void RenderView::addChild(RenderObject* newChild, RenderObject* beforeChild) | 195 void RenderView::addChild(RenderObject* newChild, RenderObject* beforeChild) |
eseidel
2014/01/25 02:07:04
This whole method can be removed.
| |
204 { | 196 { |
205 // Seamless iframes are considered part of an enclosing render flow thread f rom the parent document. This is necessary for them to look | |
206 // up regions in the parent document during layout. | |
207 if (newChild && !newChild->isRenderFlowThread()) { | |
208 RenderBox* seamlessBox = enclosingSeamlessRenderer(document()); | |
209 if (seamlessBox && seamlessBox->flowThreadContainingBlock()) | |
210 newChild->setFlowThreadState(seamlessBox->flowThreadState()); | |
211 } | |
212 RenderBlock::addChild(newChild, beforeChild); | 197 RenderBlock::addChild(newChild, beforeChild); |
213 } | 198 } |
214 | 199 |
215 bool RenderView::initializeLayoutState(LayoutState& state) | 200 void RenderView::initializeLayoutState(LayoutState& state) |
216 { | 201 { |
217 bool isSeamlessAncestorInFlowThread = false; | |
218 | |
219 // FIXME: May be better to push a clip and avoid issuing offscreen repaints. | 202 // FIXME: May be better to push a clip and avoid issuing offscreen repaints. |
220 state.m_clipped = false; | 203 state.m_clipped = false; |
221 | 204 state.m_pageLogicalHeight = m_pageLogicalHeight; |
222 // Check the writing mode of the seamless ancestor. It has to match our docu ment's writing mode, or we won't inherit any | 205 state.m_pageLogicalHeightChanged = m_pageLogicalHeightChanged; |
223 // pagination information. | |
224 RenderBox* seamlessAncestor = enclosingSeamlessRenderer(document()); | |
225 LayoutState* seamlessLayoutState = seamlessAncestor ? seamlessAncestor->view ()->layoutState() : 0; | |
226 bool shouldInheritPagination = seamlessLayoutState && !m_pageLogicalHeight & & seamlessAncestor->style()->writingMode() == style()->writingMode(); | |
227 | |
228 state.m_pageLogicalHeight = shouldInheritPagination ? seamlessLayoutState->m _pageLogicalHeight : m_pageLogicalHeight; | |
229 state.m_pageLogicalHeightChanged = shouldInheritPagination ? seamlessLayoutS tate->m_pageLogicalHeightChanged : m_pageLogicalHeightChanged; | |
230 state.m_isPaginated = state.m_pageLogicalHeight; | 206 state.m_isPaginated = state.m_pageLogicalHeight; |
231 if (state.m_isPaginated && shouldInheritPagination) { | |
232 // Set up the correct pagination offset. We can use a negative offset in order to push the top of the RenderView into its correct place | |
233 // on a page. We can take the iframe's offset from the logical top of th e first page and make the negative into the pagination offset within the child | |
234 // view. | |
235 bool isFlipped = seamlessAncestor->style()->isFlippedBlocksWritingMode() ; | |
236 LayoutSize layoutOffset = seamlessLayoutState->layoutOffset(); | |
237 LayoutSize iFrameOffset(layoutOffset.width() + seamlessAncestor->x() + ( !isFlipped ? seamlessAncestor->borderLeft() + seamlessAncestor->paddingLeft() : | |
238 seamlessAncestor->borderRight() + seamlessAncestor->paddingRight()), | |
239 layoutOffset.height() + seamlessAncestor->y() + (!isFlipped ? seamle ssAncestor->borderTop() + seamlessAncestor->paddingTop() : | |
240 seamlessAncestor->borderBottom() + seamlessAncestor->paddingBottom() )); | |
241 | |
242 LayoutSize offsetDelta = seamlessLayoutState->m_pageOffset - iFrameOffse t; | |
243 state.m_pageOffset = offsetDelta; | |
244 | |
245 // Set the current render flow thread to point to our ancestor. This wil l allow the seamless document to locate the correct | |
246 // regions when doing a layout. | |
247 if (seamlessAncestor->flowThreadContainingBlock()) { | |
248 flowThreadController()->setCurrentRenderFlowThread(seamlessAncestor- >view()->flowThreadController()->currentRenderFlowThread()); | |
249 isSeamlessAncestorInFlowThread = true; | |
250 } | |
251 } | |
252 | |
253 // FIXME: We need to make line grids and exclusions work with seamless ifram es as well here. Basically all layout state information needs | |
254 // to propagate here and not just pagination information. | |
255 return isSeamlessAncestorInFlowThread; | |
256 } | 207 } |
257 | 208 |
258 // The algorithm below assumes this is a full layout. In case there are previous ly computed values for regions, supplemental steps are taken | 209 // The algorithm below assumes this is a full layout. In case there are previous ly computed values for regions, supplemental steps are taken |
259 // to ensure the results are the same as those obtained from a full layout (i.e. the auto-height regions from all the flows are marked as needing | 210 // to ensure the results are the same as those obtained from a full layout (i.e. the auto-height regions from all the flows are marked as needing |
260 // layout). | 211 // layout). |
261 // 1. The flows are laid out from the outer flow to the inner flow. This success fully computes the outer non-auto-height regions size so the | 212 // 1. The flows are laid out from the outer flow to the inner flow. This success fully computes the outer non-auto-height regions size so the |
262 // inner flows have the necessary information to correctly fragment the content. | 213 // inner flows have the necessary information to correctly fragment the content. |
263 // 2. The flows are laid out from the inner flow to the outer flow. After an inn er flow is laid out it goes into the constrained layout phase | 214 // 2. The flows are laid out from the inner flow to the outer flow. After an inn er flow is laid out it goes into the constrained layout phase |
264 // and marks the auto-height regions they need layout. This means the outer flow s will relayout if they depend on regions with auto-height regions | 215 // and marks the auto-height regions they need layout. This means the outer flow s will relayout if they depend on regions with auto-height regions |
265 // belonging to inner flows. This step will correctly set the computedAutoHeight for the auto-height regions. It's possible for non-auto-height | 216 // belonging to inner flows. This step will correctly set the computedAutoHeight for the auto-height regions. It's possible for non-auto-height |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 | 277 |
327 if (document().svgExtensions()) | 278 if (document().svgExtensions()) |
328 document().accessSVGExtensions()->invalidateSVGRootsWithRelativeLeng thDescendents(&layoutScope); | 279 document().accessSVGExtensions()->invalidateSVGRootsWithRelativeLeng thDescendents(&layoutScope); |
329 } | 280 } |
330 | 281 |
331 ASSERT(!m_layoutState); | 282 ASSERT(!m_layoutState); |
332 if (!needsLayout()) | 283 if (!needsLayout()) |
333 return; | 284 return; |
334 | 285 |
335 LayoutState state; | 286 LayoutState state; |
336 bool isSeamlessAncestorInFlowThread = initializeLayoutState(state); | 287 initializeLayoutState(state); |
337 | 288 |
338 m_pageLogicalHeightChanged = false; | 289 m_pageLogicalHeightChanged = false; |
339 m_layoutState = &state; | 290 m_layoutState = &state; |
340 | 291 |
341 if (checkTwoPassLayoutForAutoHeightRegions()) | 292 if (checkTwoPassLayoutForAutoHeightRegions()) |
342 layoutContentInAutoLogicalHeightRegions(state); | 293 layoutContentInAutoLogicalHeightRegions(state); |
343 else | 294 else |
344 layoutContent(state); | 295 layoutContent(state); |
345 | 296 |
346 if (m_frameView->partialLayout().isStopping()) { | 297 if (m_frameView->partialLayout().isStopping()) { |
347 m_layoutState = 0; | 298 m_layoutState = 0; |
348 return; | 299 return; |
349 } | 300 } |
350 | 301 |
351 #ifndef NDEBUG | 302 #ifndef NDEBUG |
352 checkLayoutState(state); | 303 checkLayoutState(state); |
353 #endif | 304 #endif |
354 m_layoutState = 0; | 305 m_layoutState = 0; |
355 clearNeedsLayout(); | 306 clearNeedsLayout(); |
356 | |
357 if (isSeamlessAncestorInFlowThread) | |
358 flowThreadController()->setCurrentRenderFlowThread(0); | |
359 } | 307 } |
360 | 308 |
361 void RenderView::mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) c onst | 309 void RenderView::mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) c onst |
362 { | 310 { |
363 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed)); | 311 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed)); |
364 | 312 |
365 if (!repaintContainer && mode & UseTransforms && shouldUseTransformFromConta iner(0)) { | 313 if (!repaintContainer && mode & UseTransforms && shouldUseTransformFromConta iner(0)) { |
366 TransformationMatrix t; | 314 TransformationMatrix t; |
367 getTransformFromContainer(0, LayoutSize(), t); | 315 getTransformFromContainer(0, LayoutSize(), t); |
368 transformState.applyTransform(t); | 316 transformState.applyTransform(t); |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1156 return viewWidth(ScrollableArea::IncludeScrollbars) / scale; | 1104 return viewWidth(ScrollableArea::IncludeScrollbars) / scale; |
1157 } | 1105 } |
1158 | 1106 |
1159 double RenderView::layoutViewportHeight() const | 1107 double RenderView::layoutViewportHeight() const |
1160 { | 1108 { |
1161 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 1109 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
1162 return viewHeight(ScrollableArea::IncludeScrollbars) / scale; | 1110 return viewHeight(ScrollableArea::IncludeScrollbars) / scale; |
1163 } | 1111 } |
1164 | 1112 |
1165 } // namespace WebCore | 1113 } // namespace WebCore |
OLD | NEW |