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

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

Issue 380583003: Revert of Revert of Divorce PaintInvalidationState from LayoutState (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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"
27 #include "core/rendering/RenderBlockFlow.h" 28 #include "core/rendering/RenderBlockFlow.h"
28 #include "platform/PODFreeListArena.h" 29 #include "platform/PODFreeListArena.h"
29 #include "platform/scroll/ScrollableArea.h" 30 #include "platform/scroll/ScrollableArea.h"
30 #include "wtf/OwnPtr.h" 31 #include "wtf/OwnPtr.h"
31 32
32 namespace WebCore { 33 namespace WebCore {
33 34
34 class FlowThreadController; 35 class FlowThreadController;
35 class RenderLayerCompositor; 36 class RenderLayerCompositor;
36 class RenderQuote; 37 class RenderQuote;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 { 72 {
72 return style()->isHorizontalWritingMode() ? viewWidth(ExcludeScrollbars) : viewHeight(ExcludeScrollbars); 73 return style()->isHorizontalWritingMode() ? viewWidth(ExcludeScrollbars) : viewHeight(ExcludeScrollbars);
73 } 74 }
74 int viewLogicalHeight() const; 75 int viewLogicalHeight() const;
75 LayoutUnit viewLogicalHeightForPercentages() const; 76 LayoutUnit viewLogicalHeightForPercentages() const;
76 77
77 float zoomFactor() const; 78 float zoomFactor() const;
78 79
79 FrameView* frameView() const { return m_frameView; } 80 FrameView* frameView() const { return m_frameView; }
80 81
81 virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect&, bool fixed = false) const OVERRIDE; 82 virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect&, bool fixed = false, const PaintInvalid ationState* = 0) const OVERRIDE;
82 void repaintViewRectangle(const LayoutRect&) const; 83 void repaintViewRectangle(const LayoutRect&) const;
83 84
84 void repaintViewAndCompositedLayers(); 85 void repaintViewAndCompositedLayers();
85 86
86 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE; 87 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
87 virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) OV ERRIDE; 88 virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) OV ERRIDE;
88 89
89 enum SelectionRepaintMode { RepaintNewXOROld, RepaintNewMinusOld, RepaintNot hing }; 90 enum SelectionRepaintMode { RepaintNewXOROld, RepaintNewMinusOld, RepaintNot hing };
90 void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode = RepaintNewXOROld); 91 void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode = RepaintNewXOROld);
91 void getSelection(RenderObject*& startRenderer, int& startOffset, RenderObje ct*& endRenderer, int& endOffset) const; 92 void getSelection(RenderObject*& startRenderer, int& startOffset, RenderObje ct*& endRenderer, int& endOffset) const;
92 void clearSelection(); 93 void clearSelection();
93 RenderObject* selectionStart() const { return m_selectionStart; } 94 RenderObject* selectionStart() const { return m_selectionStart; }
94 RenderObject* selectionEnd() const { return m_selectionEnd; } 95 RenderObject* selectionEnd() const { return m_selectionEnd; }
95 IntRect selectionBounds(bool clipToVisibleContent = true) const; 96 IntRect selectionBounds(bool clipToVisibleContent = true) const;
96 void selectionStartEnd(int& startPos, int& endPos) const; 97 void selectionStartEnd(int& startPos, int& endPos) const;
97 void repaintSelection() const; 98 void repaintSelection() const;
98 99
99 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO ffset) const OVERRIDE; 100 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO ffset) const OVERRIDE;
100 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRID E; 101 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRID E;
101 102
102 virtual LayoutRect viewRect() const OVERRIDE; 103 virtual LayoutRect viewRect() const OVERRIDE;
103 104
104 bool shouldDoFullRepaintForNextLayout() const; 105 bool shouldDoFullRepaintForNextLayout() const;
105 bool doingFullRepaint() const { return m_frameView->needsFullPaintInvalidati on(); } 106 bool doingFullRepaint() const { return m_frameView->needsFullPaintInvalidati on(); }
106 107
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(); }
109 LayoutState* layoutState() const { return m_layoutState; } 108 LayoutState* layoutState() const { return m_layoutState; }
110 109
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
117 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRID E; 110 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRID E;
118 111
119 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } 112 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; }
120 void setPageLogicalHeight(LayoutUnit height) 113 void setPageLogicalHeight(LayoutUnit height)
121 { 114 {
122 if (m_pageLogicalHeight != height) { 115 if (m_pageLogicalHeight != height) {
123 m_pageLogicalHeight = height; 116 m_pageLogicalHeight = height;
124 m_pageLogicalHeightChanged = true; 117 m_pageLogicalHeightChanged = true;
125 } 118 }
126 } 119 }
(...skipping 30 matching lines...) Expand all
157 150
158 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const OVERRIDE; 151 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const OVERRIDE;
159 152
160 double layoutViewportWidth() const; 153 double layoutViewportWidth() const;
161 double layoutViewportHeight() const; 154 double layoutViewportHeight() const;
162 155
163 void pushLayoutState(LayoutState&); 156 void pushLayoutState(LayoutState&);
164 void popLayoutState(); 157 void popLayoutState();
165 158
166 private: 159 private:
167 virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const OVERRIDE; 160 virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0, const PaintInvalidationState* = 0) const OVERRIDE;
168 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; 161 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE;
169 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE; 162 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE;
170 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE; 163 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE;
171 164
172 virtual void invalidateTreeAfterLayout(const RenderLayerModelObject& paintIn validationContainer) OVERRIDE FINAL; 165 virtual void invalidateTreeAfterLayout(const PaintInvalidationState&) OVERRI DE FINAL;
173 166
174 bool shouldRepaint(const LayoutRect&) const; 167 bool shouldRepaint(const LayoutRect&) const;
175 168
176 bool rootFillsViewportBackground(RenderBox* rootBox) const; 169 bool rootFillsViewportBackground(RenderBox* rootBox) const;
177 170
178 void layoutContent(); 171 void layoutContent();
179 #ifndef NDEBUG 172 #ifndef NDEBUG
180 void checkLayoutState(); 173 void checkLayoutState();
181 #endif 174 #endif
182 175
(...skipping 30 matching lines...) Expand all
213 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView()); 206 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView());
214 207
215 // Suspends the LayoutState cached offset and clipRect optimization. Used under transforms 208 // Suspends the LayoutState cached offset and clipRect optimization. Used under transforms
216 // that cannot be represented by LayoutState (common in SVG) and when manipulati ng the render 209 // that cannot be represented by LayoutState (common in SVG) and when manipulati ng the render
217 // tree during layout in ways that can trigger repaint of a non-child (e.g. when a list item 210 // tree during layout in ways that can trigger repaint of a non-child (e.g. when a list item
218 // moves its list marker around). Note that even when disabled, LayoutState is s till used to 211 // moves its list marker around). Note that even when disabled, LayoutState is s till used to
219 // store layoutDelta. 212 // store layoutDelta.
220 class ForceHorriblySlowRectMapping { 213 class ForceHorriblySlowRectMapping {
221 WTF_MAKE_NONCOPYABLE(ForceHorriblySlowRectMapping); 214 WTF_MAKE_NONCOPYABLE(ForceHorriblySlowRectMapping);
222 public: 215 public:
223 ForceHorriblySlowRectMapping(const RenderObject& root) 216 ForceHorriblySlowRectMapping(const PaintInvalidationState* paintInvalidation State)
224 : m_view(*root.view()) 217 : m_paintInvalidationState(paintInvalidationState)
225 , m_didDisable(m_view.layoutState() && m_view.layoutState()->cachedOffse tsEnabled()) 218 , m_didDisable(m_paintInvalidationState && m_paintInvalidationState->cac hedOffsetsEnabled())
226 { 219 {
227 if (m_view.layoutState()) 220 if (m_paintInvalidationState)
228 m_view.layoutState()->m_cachedOffsetsEnabled = false; 221 m_paintInvalidationState->m_cachedOffsetsEnabled = false;
229 #if ASSERT_ENABLED
230 m_layoutState = m_view.layoutState();
231 #endif
232 } 222 }
233 223
234 ~ForceHorriblySlowRectMapping() 224 ~ForceHorriblySlowRectMapping()
235 { 225 {
236 ASSERT(m_view.layoutState() == m_layoutState);
237 if (m_didDisable) 226 if (m_didDisable)
238 m_view.layoutState()->m_cachedOffsetsEnabled = true; 227 m_paintInvalidationState->m_cachedOffsetsEnabled = true;
239 } 228 }
240 private: 229 private:
241 RenderView& m_view; 230 const PaintInvalidationState* m_paintInvalidationState;
242 bool m_didDisable; 231 bool m_didDisable;
243 #if ASSERT_ENABLED
244 LayoutState* m_layoutState;
245 #endif
246 }; 232 };
247 233
248 } // namespace WebCore 234 } // namespace WebCore
249 235
250 #endif // RenderView_h 236 #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