Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: Source/core/rendering/RenderView.h

Issue 377123002: Revert of Divorce PaintInvalidationState from LayoutState (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix conflict Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderText.cpp ('k') | Source/core/rendering/RenderView.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #ifndef RenderView_h 22 #ifndef RenderView_h
23 #define RenderView_h 23 #define RenderView_h
24 24
25 #include "core/frame/FrameView.h" 25 #include "core/frame/FrameView.h"
26 #include "core/rendering/LayoutState.h" 26 #include "core/rendering/LayoutState.h"
27 #include "core/rendering/PaintInvalidationState.h"
28 #include "core/rendering/RenderBlockFlow.h" 27 #include "core/rendering/RenderBlockFlow.h"
29 #include "platform/PODFreeListArena.h" 28 #include "platform/PODFreeListArena.h"
30 #include "platform/scroll/ScrollableArea.h" 29 #include "platform/scroll/ScrollableArea.h"
31 #include "wtf/OwnPtr.h" 30 #include "wtf/OwnPtr.h"
32 31
33 namespace WebCore { 32 namespace WebCore {
34 33
35 class FlowThreadController; 34 class FlowThreadController;
36 class RenderLayerCompositor; 35 class RenderLayerCompositor;
37 class RenderQuote; 36 class RenderQuote;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 { 71 {
73 return style()->isHorizontalWritingMode() ? viewWidth(ExcludeScrollbars) : viewHeight(ExcludeScrollbars); 72 return style()->isHorizontalWritingMode() ? viewWidth(ExcludeScrollbars) : viewHeight(ExcludeScrollbars);
74 } 73 }
75 int viewLogicalHeight() const; 74 int viewLogicalHeight() const;
76 LayoutUnit viewLogicalHeightForPercentages() const; 75 LayoutUnit viewLogicalHeightForPercentages() const;
77 76
78 float zoomFactor() const; 77 float zoomFactor() const;
79 78
80 FrameView* frameView() const { return m_frameView; } 79 FrameView* frameView() const { return m_frameView; }
81 80
82 virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect&, bool fixed = false, const PaintInvalid ationState* = 0) const OVERRIDE; 81 virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect&, bool fixed = false) const OVERRIDE;
83 void repaintViewRectangle(const LayoutRect&) const; 82 void repaintViewRectangle(const LayoutRect&) const;
84 83
85 void repaintViewAndCompositedLayers(); 84 void repaintViewAndCompositedLayers();
86 85
87 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE; 86 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
88 virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) OV ERRIDE; 87 virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) OV ERRIDE;
89 88
90 enum SelectionRepaintMode { RepaintNewXOROld, RepaintNewMinusOld, RepaintNot hing }; 89 enum SelectionRepaintMode { RepaintNewXOROld, RepaintNewMinusOld, RepaintNot hing };
91 void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode = RepaintNewXOROld); 90 void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode = RepaintNewXOROld);
92 void getSelection(RenderObject*& startRenderer, int& startOffset, RenderObje ct*& endRenderer, int& endOffset) const; 91 void getSelection(RenderObject*& startRenderer, int& startOffset, RenderObje ct*& endRenderer, int& endOffset) const;
93 void clearSelection(); 92 void clearSelection();
94 RenderObject* selectionStart() const { return m_selectionStart; } 93 RenderObject* selectionStart() const { return m_selectionStart; }
95 RenderObject* selectionEnd() const { return m_selectionEnd; } 94 RenderObject* selectionEnd() const { return m_selectionEnd; }
96 IntRect selectionBounds(bool clipToVisibleContent = true) const; 95 IntRect selectionBounds(bool clipToVisibleContent = true) const;
97 void selectionStartEnd(int& startPos, int& endPos) const; 96 void selectionStartEnd(int& startPos, int& endPos) const;
98 void repaintSelection() const; 97 void repaintSelection() const;
99 98
100 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO ffset) const OVERRIDE; 99 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO ffset) const OVERRIDE;
101 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRID E; 100 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRID E;
102 101
103 virtual LayoutRect viewRect() const OVERRIDE; 102 virtual LayoutRect viewRect() const OVERRIDE;
104 103
105 bool shouldDoFullRepaintForNextLayout() const; 104 bool shouldDoFullRepaintForNextLayout() const;
106 bool doingFullRepaint() const { return m_frameView->needsFullPaintInvalidati on(); } 105 bool doingFullRepaint() const { return m_frameView->needsFullPaintInvalidati on(); }
107 106
107 // Returns true if layoutState should be used for its cached offset and clip .
108 bool layoutStateCachedOffsetsEnabled() const { return m_layoutState && m_lay outState->cachedOffsetsEnabled(); }
108 LayoutState* layoutState() const { return m_layoutState; } 109 LayoutState* layoutState() const { return m_layoutState; }
109 110
111 bool canMapUsingLayoutStateForContainer(const RenderObject* repaintContainer ) const
112 {
113 // FIXME: LayoutState should be enabled for other repaint containers tha n the RenderView. crbug.com/363834
114 return layoutStateCachedOffsetsEnabled() && (repaintContainer == this);
115 }
116
110 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRID E; 117 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRID E;
111 118
112 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } 119 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; }
113 void setPageLogicalHeight(LayoutUnit height) 120 void setPageLogicalHeight(LayoutUnit height)
114 { 121 {
115 if (m_pageLogicalHeight != height) { 122 if (m_pageLogicalHeight != height) {
116 m_pageLogicalHeight = height; 123 m_pageLogicalHeight = height;
117 m_pageLogicalHeightChanged = true; 124 m_pageLogicalHeightChanged = true;
118 } 125 }
119 } 126 }
(...skipping 30 matching lines...) Expand all
150 157
151 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const OVERRIDE; 158 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const OVERRIDE;
152 159
153 double layoutViewportWidth() const; 160 double layoutViewportWidth() const;
154 double layoutViewportHeight() const; 161 double layoutViewportHeight() const;
155 162
156 void pushLayoutState(LayoutState&); 163 void pushLayoutState(LayoutState&);
157 void popLayoutState(); 164 void popLayoutState();
158 165
159 private: 166 private:
160 virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0, const PaintInvalidationState* = 0) const OVERRIDE; 167 virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const OVERRIDE;
161 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; 168 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE;
162 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE; 169 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE;
163 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE; 170 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE;
164 171
165 virtual void invalidateTreeAfterLayout(const PaintInvalidationState&) OVERRI DE FINAL; 172 virtual void invalidateTreeAfterLayout(const RenderLayerModelObject& paintIn validationContainer) OVERRIDE FINAL;
166 173
167 bool shouldRepaint(const LayoutRect&) const; 174 bool shouldRepaint(const LayoutRect&) const;
168 175
169 bool rootFillsViewportBackground(RenderBox* rootBox) const; 176 bool rootFillsViewportBackground(RenderBox* rootBox) const;
170 177
171 void layoutContent(); 178 void layoutContent();
172 #ifndef NDEBUG 179 #ifndef NDEBUG
173 void checkLayoutState(); 180 void checkLayoutState();
174 #endif 181 #endif
175 182
(...skipping 30 matching lines...) Expand all
206 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView()); 213 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView());
207 214
208 // Suspends the LayoutState cached offset and clipRect optimization. Used under transforms 215 // Suspends the LayoutState cached offset and clipRect optimization. Used under transforms
209 // that cannot be represented by LayoutState (common in SVG) and when manipulati ng the render 216 // that cannot be represented by LayoutState (common in SVG) and when manipulati ng the render
210 // tree during layout in ways that can trigger repaint of a non-child (e.g. when a list item 217 // tree during layout in ways that can trigger repaint of a non-child (e.g. when a list item
211 // moves its list marker around). Note that even when disabled, LayoutState is s till used to 218 // moves its list marker around). Note that even when disabled, LayoutState is s till used to
212 // store layoutDelta. 219 // store layoutDelta.
213 class ForceHorriblySlowRectMapping { 220 class ForceHorriblySlowRectMapping {
214 WTF_MAKE_NONCOPYABLE(ForceHorriblySlowRectMapping); 221 WTF_MAKE_NONCOPYABLE(ForceHorriblySlowRectMapping);
215 public: 222 public:
216 ForceHorriblySlowRectMapping(const PaintInvalidationState* paintInvalidation State) 223 ForceHorriblySlowRectMapping(const RenderObject& root)
217 : m_paintInvalidationState(paintInvalidationState) 224 : m_view(*root.view())
218 , m_didDisable(m_paintInvalidationState && m_paintInvalidationState->cac hedOffsetsEnabled()) 225 , m_didDisable(m_view.layoutState() && m_view.layoutState()->cachedOffse tsEnabled())
219 { 226 {
220 if (m_paintInvalidationState) 227 if (m_view.layoutState())
221 m_paintInvalidationState->m_cachedOffsetsEnabled = false; 228 m_view.layoutState()->m_cachedOffsetsEnabled = false;
229 #if ASSERT_ENABLED
230 m_layoutState = m_view.layoutState();
231 #endif
222 } 232 }
223 233
224 ~ForceHorriblySlowRectMapping() 234 ~ForceHorriblySlowRectMapping()
225 { 235 {
236 ASSERT(m_view.layoutState() == m_layoutState);
226 if (m_didDisable) 237 if (m_didDisable)
227 m_paintInvalidationState->m_cachedOffsetsEnabled = true; 238 m_view.layoutState()->m_cachedOffsetsEnabled = true;
228 } 239 }
229 private: 240 private:
230 const PaintInvalidationState* m_paintInvalidationState; 241 RenderView& m_view;
231 bool m_didDisable; 242 bool m_didDisable;
243 #if ASSERT_ENABLED
244 LayoutState* m_layoutState;
245 #endif
232 }; 246 };
233 247
234 } // namespace WebCore 248 } // namespace WebCore
235 249
236 #endif // RenderView_h 250 #endif // RenderView_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderText.cpp ('k') | Source/core/rendering/RenderView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698