| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRID
E; | 102 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRID
E; |
| 103 | 103 |
| 104 virtual LayoutRect viewRect() const OVERRIDE; | 104 virtual LayoutRect viewRect() const OVERRIDE; |
| 105 | 105 |
| 106 // layoutDelta is used transiently during layout to store how far an object
has moved from its | 106 // layoutDelta is used transiently during layout to store how far an object
has moved from its |
| 107 // last layout location, in order to repaint correctly. | 107 // last layout location, in order to repaint correctly. |
| 108 // If we're doing a full repaint m_layoutState will be 0, but in that case l
ayoutDelta doesn't matter. | 108 // If we're doing a full repaint m_layoutState will be 0, but in that case l
ayoutDelta doesn't matter. |
| 109 LayoutSize layoutDelta() const | 109 LayoutSize layoutDelta() const |
| 110 { | 110 { |
| 111 ASSERT(!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); | 111 ASSERT(!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); |
| 112 return m_layoutState ? m_layoutState->m_layoutDelta : LayoutSize(); | 112 return m_layoutState ? m_layoutState->layoutDelta() : LayoutSize(); |
| 113 } | 113 } |
| 114 void addLayoutDelta(const LayoutSize& delta) | 114 void addLayoutDelta(const LayoutSize& delta) |
| 115 { | 115 { |
| 116 ASSERT(!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); | 116 ASSERT(!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); |
| 117 if (m_layoutState) { | 117 if (m_layoutState) |
| 118 m_layoutState->m_layoutDelta += delta; | 118 m_layoutState->addLayoutDelta(delta); |
| 119 #if !ASSERT_DISABLED | |
| 120 m_layoutState->m_layoutDeltaXSaturated |= m_layoutState->m_layoutDel
ta.width() == LayoutUnit::max() || m_layoutState->m_layoutDelta.width() == Layou
tUnit::min(); | |
| 121 m_layoutState->m_layoutDeltaYSaturated |= m_layoutState->m_layoutDel
ta.height() == LayoutUnit::max() || m_layoutState->m_layoutDelta.height() == Lay
outUnit::min(); | |
| 122 #endif | |
| 123 } | |
| 124 } | 119 } |
| 125 | 120 |
| 126 #if !ASSERT_DISABLED | 121 #if !ASSERT_DISABLED |
| 127 bool layoutDeltaMatches(const LayoutSize& delta) | 122 bool layoutDeltaMatches(const LayoutSize& delta) |
| 128 { | 123 { |
| 129 ASSERT(!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); | 124 ASSERT(!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); |
| 130 if (!m_layoutState) | 125 if (!m_layoutState) |
| 131 return false; | 126 return false; |
| 132 return (delta.width() == m_layoutState->m_layoutDelta.width() || m_layou
tState->m_layoutDeltaXSaturated) && (delta.height() == m_layoutState->m_layoutDe
lta.height() || m_layoutState->m_layoutDeltaYSaturated); | 127 return (delta.width() == m_layoutState->layoutDelta().width() || m_layou
tState->layoutDeltaXSaturated()) && (delta.height() == m_layoutState->layoutDelt
a().height() || m_layoutState->layoutDeltaYSaturated()); |
| 133 } | 128 } |
| 134 #endif | 129 #endif |
| 135 | 130 |
| 136 bool doingFullRepaint() const { return m_frameView->needsFullRepaint(); } | 131 bool doingFullRepaint() const { return m_frameView->needsFullRepaint(); } |
| 137 | 132 |
| 138 // Subtree push | 133 // Subtree push |
| 139 void pushLayoutState(RenderObject&); | 134 void pushLayoutState(RenderObject&); |
| 140 | 135 |
| 141 void popLayoutState() | 136 void popLayoutState() |
| 142 { | 137 { |
| 143 LayoutState* state = m_layoutState; | 138 LayoutState* state = m_layoutState; |
| 144 m_layoutState = state->m_next; | 139 m_layoutState = state->next(); |
| 145 delete state; | 140 delete state; |
| 146 popLayoutStateForCurrentFlowThread(); | 141 popLayoutStateForCurrentFlowThread(); |
| 147 } | 142 } |
| 148 | 143 |
| 149 bool shouldDisableLayoutStateForSubtree(RenderObject&) const; | 144 bool shouldDisableLayoutStateForSubtree(RenderObject&) const; |
| 150 | 145 |
| 151 // Returns true if layoutState should be used for its cached offset and clip
. | 146 // Returns true if layoutState should be used for its cached offset and clip
. |
| 152 bool layoutStateEnabled() const { return m_layoutStateDisableCount == 0 && m
_layoutState; } | 147 bool layoutStateEnabled() const { return m_layoutStateDisableCount == 0 && m
_layoutState; } |
| 153 LayoutState* layoutState() const { return m_layoutState; } | 148 LayoutState* layoutState() const { return m_layoutState; } |
| 154 | 149 |
| 155 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRID
E; | 150 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRID
E; |
| 156 | 151 |
| 157 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } | 152 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } |
| 158 void setPageLogicalHeight(LayoutUnit height) | 153 void setPageLogicalHeight(LayoutUnit height) |
| 159 { | 154 { |
| 160 if (m_pageLogicalHeight != height) { | 155 if (m_pageLogicalHeight != height) { |
| 161 m_pageLogicalHeight = height; | 156 m_pageLogicalHeight = height; |
| 162 m_pageLogicalHeightChanged = true; | 157 m_pageLogicalHeightChanged = true; |
| 163 } | 158 } |
| 164 } | 159 } |
| 160 bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; } |
| 165 | 161 |
| 166 // Notification that this view moved into or out of a native window. | 162 // Notification that this view moved into or out of a native window. |
| 167 void setIsInWindow(bool); | 163 void setIsInWindow(bool); |
| 168 | 164 |
| 169 RenderLayerCompositor* compositor(); | 165 RenderLayerCompositor* compositor(); |
| 170 bool usesCompositing() const; | 166 bool usesCompositing() const; |
| 171 | 167 |
| 172 IntRect unscaledDocumentRect() const; | 168 IntRect unscaledDocumentRect() const; |
| 173 LayoutRect backgroundRect(RenderBox* backgroundRenderer) const; | 169 LayoutRect backgroundRect(RenderBox* backgroundRenderer) const; |
| 174 | 170 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 void enableLayoutState() { ASSERT(m_layoutStateDisableCount > 0); m_layoutSt
ateDisableCount--; } | 202 void enableLayoutState() { ASSERT(m_layoutStateDisableCount > 0); m_layoutSt
ateDisableCount--; } |
| 207 | 203 |
| 208 OutlineRects& outlineRects() { return m_outlineRects; } | 204 OutlineRects& outlineRects() { return m_outlineRects; } |
| 209 | 205 |
| 210 private: | 206 private: |
| 211 virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContai
ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed =
0) const OVERRIDE; | 207 virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContai
ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed =
0) const OVERRIDE; |
| 212 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj
ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; | 208 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj
ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; |
| 213 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c
onst OVERRIDE; | 209 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c
onst OVERRIDE; |
| 214 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint&
layerOffset) const OVERRIDE; | 210 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint&
layerOffset) const OVERRIDE; |
| 215 | 211 |
| 216 void initializeLayoutState(LayoutState&); | |
| 217 | |
| 218 bool shouldRepaint(const LayoutRect&) const; | 212 bool shouldRepaint(const LayoutRect&) const; |
| 219 | 213 |
| 220 bool rootFillsViewportBackground(RenderBox* rootBox) const; | 214 bool rootFillsViewportBackground(RenderBox* rootBox) const; |
| 221 | 215 |
| 222 // These functions may only be accessed by LayoutStateMaintainer. | 216 // These functions may only be accessed by LayoutStateMaintainer. |
| 223 bool pushLayoutState(RenderBox& renderer, const LayoutSize& offset, LayoutUn
it pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0) | 217 bool pushLayoutState(RenderBox& renderer, const LayoutSize& offset, LayoutUn
it pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0) |
| 224 { | 218 { |
| 225 // We push LayoutState even if layoutState is disabled because it stores
layoutDelta too. | 219 // We push LayoutState even if layoutState is disabled because it stores
layoutDelta too. |
| 226 if (!doingFullRepaint() || m_layoutState->isPaginated() || renderer.hasC
olumns() || renderer.flowThreadContainingBlock() | 220 if (!doingFullRepaint() || m_layoutState->isPaginated() || renderer.hasC
olumns() || renderer.flowThreadContainingBlock() |
| 227 || (renderer.isRenderBlock() && toRenderBlock(renderer).shapeInsideI
nfo()) | 221 || (renderer.isRenderBlock() && toRenderBlock(renderer).shapeInsideI
nfo()) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 266 |
| 273 OutlineRects m_outlineRects; | 267 OutlineRects m_outlineRects; |
| 274 }; | 268 }; |
| 275 | 269 |
| 276 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView()); | 270 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView()); |
| 277 | 271 |
| 278 class RootLayoutStateScope { | 272 class RootLayoutStateScope { |
| 279 public: | 273 public: |
| 280 explicit RootLayoutStateScope(RenderView& view) | 274 explicit RootLayoutStateScope(RenderView& view) |
| 281 : m_view(view) | 275 : m_view(view) |
| 276 , m_rootLayoutState(view.pageLogicalHeight(), view.pageLogicalHeightChan
ged()) |
| 282 { | 277 { |
| 283 ASSERT(!m_view.m_layoutState); | 278 ASSERT(!m_view.m_layoutState); |
| 284 initializeLayoutState(); | |
| 285 m_view.m_layoutState = &m_rootLayoutState; | 279 m_view.m_layoutState = &m_rootLayoutState; |
| 286 } | 280 } |
| 287 | 281 |
| 288 ~RootLayoutStateScope() | 282 ~RootLayoutStateScope() |
| 289 { | 283 { |
| 290 ASSERT(m_view.m_layoutState == &m_rootLayoutState); | 284 ASSERT(m_view.m_layoutState == &m_rootLayoutState); |
| 291 m_view.m_layoutState = 0; | 285 m_view.m_layoutState = 0; |
| 292 } | 286 } |
| 293 private: | 287 private: |
| 294 void initializeLayoutState(); | |
| 295 RenderView& m_view; | 288 RenderView& m_view; |
| 296 LayoutState m_rootLayoutState; | 289 LayoutState m_rootLayoutState; |
| 297 }; | 290 }; |
| 298 | 291 |
| 299 // Stack-based class to assist with LayoutState push/pop | 292 // Stack-based class to assist with LayoutState push/pop |
| 300 class LayoutStateMaintainer { | 293 class LayoutStateMaintainer { |
| 301 WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer); | 294 WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer); |
| 302 public: | 295 public: |
| 303 // ctor to push now | 296 // ctor to push now |
| 304 explicit LayoutStateMaintainer(RenderBox& root, const LayoutSize& offset, La
youtUnit pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0
) | 297 explicit LayoutStateMaintainer(RenderBox& root, const LayoutSize& offset, La
youtUnit pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0
) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 { | 366 { |
| 374 m_view.enableLayoutState(); | 367 m_view.enableLayoutState(); |
| 375 } | 368 } |
| 376 private: | 369 private: |
| 377 RenderView& m_view; | 370 RenderView& m_view; |
| 378 }; | 371 }; |
| 379 | 372 |
| 380 } // namespace WebCore | 373 } // namespace WebCore |
| 381 | 374 |
| 382 #endif // RenderView_h | 375 #endif // RenderView_h |
| OLD | NEW |