| 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) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 || (renderer.isRenderBlock() && toRenderBlock(renderer).shapeInsideI
nfo()) | 225 || (renderer.isRenderBlock() && toRenderBlock(renderer).shapeInsideI
nfo()) |
| 226 || (m_layoutState->shapeInsideInfo() && renderer.isRenderBlock() &&
!toRenderBlock(renderer).allowsShapeInsideInfoSharing(&m_layoutState->shapeInsid
eInfo()->owner())) | 226 || (m_layoutState->shapeInsideInfo() && renderer.isRenderBlock() &&
!toRenderBlock(renderer).allowsShapeInsideInfoSharing(&m_layoutState->shapeInsid
eInfo()->owner())) |
| 227 ) { | 227 ) { |
| 228 pushLayoutStateForCurrentFlowThread(renderer); | 228 pushLayoutStateForCurrentFlowThread(renderer); |
| 229 m_layoutState = new LayoutState(m_layoutState, renderer, offset, pag
eHeight, pageHeightChanged, colInfo); | 229 m_layoutState = new LayoutState(m_layoutState, renderer, offset, pag
eHeight, pageHeightChanged, colInfo); |
| 230 return true; | 230 return true; |
| 231 } | 231 } |
| 232 return false; | 232 return false; |
| 233 } | 233 } |
| 234 | 234 |
| 235 void layoutContent(const LayoutState&); | 235 void layoutContent(); |
| 236 #ifndef NDEBUG | 236 #ifndef NDEBUG |
| 237 void checkLayoutState(const LayoutState&); | 237 void checkLayoutState(); |
| 238 #endif | 238 #endif |
| 239 | 239 |
| 240 void positionDialog(RenderBox*); | 240 void positionDialog(RenderBox*); |
| 241 void positionDialogs(); | 241 void positionDialogs(); |
| 242 | 242 |
| 243 void pushLayoutStateForCurrentFlowThread(const RenderObject&); | 243 void pushLayoutStateForCurrentFlowThread(const RenderObject&); |
| 244 void popLayoutStateForCurrentFlowThread(); | 244 void popLayoutStateForCurrentFlowThread(); |
| 245 | 245 |
| 246 friend class LayoutStateMaintainer; | 246 friend class LayoutStateMaintainer; |
| 247 friend class LayoutStateDisabler; | 247 friend class LayoutStateDisabler; |
| 248 friend class RootLayoutStateScope; |
| 248 | 249 |
| 249 bool shouldUsePrintingLayout() const; | 250 bool shouldUsePrintingLayout() const; |
| 250 | 251 |
| 251 FrameView* m_frameView; | 252 FrameView* m_frameView; |
| 252 | 253 |
| 253 RenderObject* m_selectionStart; | 254 RenderObject* m_selectionStart; |
| 254 RenderObject* m_selectionEnd; | 255 RenderObject* m_selectionEnd; |
| 255 | 256 |
| 256 int m_selectionStartPos; | 257 int m_selectionStartPos; |
| 257 int m_selectionEndPos; | 258 int m_selectionEndPos; |
| 258 | 259 |
| 259 int m_maximalOutlineSize; // Used to apply a fudge factor to dirty-rect chec
ks on blocks/tables. | 260 int m_maximalOutlineSize; // Used to apply a fudge factor to dirty-rect chec
ks on blocks/tables. |
| 260 int m_oldMaximalOutlineSize; // The fudge factor from the previous layout. | 261 int m_oldMaximalOutlineSize; // The fudge factor from the previous layout. |
| 261 | 262 |
| 262 LayoutUnit m_pageLogicalHeight; | 263 LayoutUnit m_pageLogicalHeight; |
| 263 bool m_pageLogicalHeightChanged; | 264 bool m_pageLogicalHeightChanged; |
| 264 LayoutState* m_layoutState; | 265 LayoutState* m_layoutState; |
| 265 unsigned m_layoutStateDisableCount; | 266 unsigned m_layoutStateDisableCount; |
| 266 OwnPtr<RenderLayerCompositor> m_compositor; | 267 OwnPtr<RenderLayerCompositor> m_compositor; |
| 267 OwnPtr<FlowThreadController> m_flowThreadController; | 268 OwnPtr<FlowThreadController> m_flowThreadController; |
| 268 RefPtr<IntervalArena> m_intervalArena; | 269 RefPtr<IntervalArena> m_intervalArena; |
| 269 | 270 |
| 270 RenderQuote* m_renderQuoteHead; | 271 RenderQuote* m_renderQuoteHead; |
| 271 unsigned m_renderCounterCount; | 272 unsigned m_renderCounterCount; |
| 272 }; | 273 }; |
| 273 | 274 |
| 274 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView()); | 275 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView()); |
| 275 | 276 |
| 277 class RootLayoutStateScope { |
| 278 public: |
| 279 explicit RootLayoutStateScope(RenderView& view) |
| 280 : m_view(view) |
| 281 { |
| 282 ASSERT(!m_view.m_layoutState); |
| 283 initializeLayoutState(); |
| 284 m_view.m_layoutState = &m_rootLayoutState; |
| 285 } |
| 286 |
| 287 ~RootLayoutStateScope() |
| 288 { |
| 289 ASSERT(m_view.m_layoutState == &m_rootLayoutState); |
| 290 m_view.m_layoutState = 0; |
| 291 } |
| 292 private: |
| 293 void initializeLayoutState(); |
| 294 RenderView& m_view; |
| 295 LayoutState m_rootLayoutState; |
| 296 }; |
| 297 |
| 276 // Stack-based class to assist with LayoutState push/pop | 298 // Stack-based class to assist with LayoutState push/pop |
| 277 class LayoutStateMaintainer { | 299 class LayoutStateMaintainer { |
| 278 WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer); | 300 WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer); |
| 279 public: | 301 public: |
| 280 // ctor to push now | 302 // ctor to push now |
| 281 explicit LayoutStateMaintainer(RenderBox& root, const LayoutSize& offset, La
youtUnit pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0
) | 303 explicit LayoutStateMaintainer(RenderBox& root, const LayoutSize& offset, La
youtUnit pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0
) |
| 282 : m_view(*root.view()) | 304 : m_view(*root.view()) |
| 283 , m_disabled(root.shouldDisableLayoutState()) | 305 , m_disabled(root.shouldDisableLayoutState()) |
| 284 , m_didStart(false) | 306 , m_didStart(false) |
| 285 , m_didEnd(false) | 307 , m_didEnd(false) |
| 286 , m_didCreateLayoutState(false) | 308 , m_didCreateLayoutState(false) |
| 287 { | 309 { |
| 288 push(root, offset, pageHeight, pageHeightChanged, colInfo); | 310 push(root, offset, pageHeight, pageHeightChanged, colInfo); |
| 289 } | 311 } |
| 290 | 312 |
| 291 // ctor to maybe push later | 313 // ctor to maybe push later |
| 292 explicit LayoutStateMaintainer(RenderBox& root) | 314 explicit LayoutStateMaintainer(RenderBox& root) |
| 293 : m_view(*root.view()) | 315 : m_view(*root.view()) |
| 294 , m_disabled(false) | 316 , m_disabled(false) |
| 295 , m_didStart(false) | 317 , m_didStart(false) |
| 296 , m_didEnd(false) | 318 , m_didEnd(false) |
| 297 , m_didCreateLayoutState(false) | 319 , m_didCreateLayoutState(false) |
| 298 { | 320 { |
| 299 } | 321 } |
| 300 | 322 |
| 301 ~LayoutStateMaintainer() | 323 ~LayoutStateMaintainer() |
| 302 { | 324 { |
| 325 if (m_didStart) |
| 326 pop(); |
| 303 ASSERT(m_didStart == m_didEnd); // if this fires, it means that someon
e did a push(), but forgot to pop(). | 327 ASSERT(m_didStart == m_didEnd); // if this fires, it means that someon
e did a push(), but forgot to pop(). |
| 304 } | 328 } |
| 305 | 329 |
| 306 void push(RenderBox& root, const LayoutSize& offset, LayoutUnit pageHeight =
0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0) | 330 void push(RenderBox& root, const LayoutSize& offset, LayoutUnit pageHeight =
0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0) |
| 307 { | 331 { |
| 308 ASSERT(!m_didStart); | 332 ASSERT(!m_didStart); |
| 309 // We push state even if disabled, because we still need to store layout
Delta | 333 // We push state even if disabled, because we still need to store layout
Delta |
| 310 m_didCreateLayoutState = m_view.pushLayoutState(root, offset, pageHeight
, pageHeightChanged, colInfo); | 334 m_didCreateLayoutState = m_view.pushLayoutState(root, offset, pageHeight
, pageHeightChanged, colInfo); |
| 311 if (m_disabled && m_didCreateLayoutState) | 335 if (m_disabled && m_didCreateLayoutState) |
| 312 m_view.disableLayoutState(); | 336 m_view.disableLayoutState(); |
| 313 m_didStart = true; | 337 m_didStart = true; |
| 314 } | 338 } |
| 315 | 339 |
| 316 void pop() | |
| 317 { | |
| 318 if (m_didStart) { | |
| 319 ASSERT(!m_didEnd); | |
| 320 if (m_didCreateLayoutState) { | |
| 321 m_view.popLayoutState(); | |
| 322 if (m_disabled) | |
| 323 m_view.enableLayoutState(); | |
| 324 } | |
| 325 | |
| 326 m_didEnd = true; | |
| 327 } | |
| 328 } | |
| 329 | |
| 330 bool didPush() const { return m_didStart; } | 340 bool didPush() const { return m_didStart; } |
| 331 | 341 |
| 332 private: | 342 private: |
| 343 void pop() |
| 344 { |
| 345 ASSERT(m_didStart && !m_didEnd); |
| 346 if (m_didCreateLayoutState) { |
| 347 m_view.popLayoutState(); |
| 348 if (m_disabled) |
| 349 m_view.enableLayoutState(); |
| 350 } |
| 351 |
| 352 m_didEnd = true; |
| 353 } |
| 354 |
| 333 RenderView& m_view; | 355 RenderView& m_view; |
| 334 bool m_disabled : 1; // true if the offset and clip part of layoutSta
te is disabled | 356 bool m_disabled : 1; // true if the offset and clip part of layoutSta
te is disabled |
| 335 bool m_didStart : 1; // true if we did a push or disable | 357 bool m_didStart : 1; // true if we did a push or disable |
| 336 bool m_didEnd : 1; // true if we popped or re-enabled | 358 bool m_didEnd : 1; // true if we popped or re-enabled |
| 337 bool m_didCreateLayoutState : 1; // true if we actually made a layout state. | 359 bool m_didCreateLayoutState : 1; // true if we actually made a layout state. |
| 338 }; | 360 }; |
| 339 | 361 |
| 340 class LayoutStateDisabler { | 362 class LayoutStateDisabler { |
| 341 WTF_MAKE_NONCOPYABLE(LayoutStateDisabler); | 363 WTF_MAKE_NONCOPYABLE(LayoutStateDisabler); |
| 342 public: | 364 public: |
| 343 LayoutStateDisabler(const RenderBox& root) | 365 LayoutStateDisabler(const RenderBox& root) |
| 344 : m_view(*root.view()) | 366 : m_view(*root.view()) |
| 345 { | 367 { |
| 346 m_view.disableLayoutState(); | 368 m_view.disableLayoutState(); |
| 347 } | 369 } |
| 348 | 370 |
| 349 ~LayoutStateDisabler() | 371 ~LayoutStateDisabler() |
| 350 { | 372 { |
| 351 m_view.enableLayoutState(); | 373 m_view.enableLayoutState(); |
| 352 } | 374 } |
| 353 private: | 375 private: |
| 354 RenderView& m_view; | 376 RenderView& m_view; |
| 355 }; | 377 }; |
| 356 | 378 |
| 357 } // namespace WebCore | 379 } // namespace WebCore |
| 358 | 380 |
| 359 #endif // RenderView_h | 381 #endif // RenderView_h |
| OLD | NEW |