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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayerClipper.h

Issue 1327483003: Add documentation to 2 DeprecatedPaintLayer objects (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed the ASCII art to prevent multi-line comments. Created 5 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. 3 * Copyright (C) 2013 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 private: 101 private:
102 friend class DeprecatedPaintLayerClipper; 102 friend class DeprecatedPaintLayerClipper;
103 103
104 ClipRectsCacheSlot m_cacheSlot; 104 ClipRectsCacheSlot m_cacheSlot;
105 LayoutSize subPixelAccumulation; 105 LayoutSize subPixelAccumulation;
106 ShouldRespectOverflowClip respectOverflowClip; 106 ShouldRespectOverflowClip respectOverflowClip;
107 ShouldRespectOverflowClip respectOverflowClipForViewport; 107 ShouldRespectOverflowClip respectOverflowClipForViewport;
108 }; 108 };
109 109
110 // DeprecatedPaintLayerClipper is responsible for computing and caching clip
111 // rects.
112 //
113 // The main reason for this cache is that we compute the clip rects during
114 // a layout tree walk but need them during a paint tree walk (see example
115 // below for some explanations).
116 //
117 // A lot of complexity in this class come from the difference in inheritance
118 // between 'overflow' and 'clip':
119 // * 'overflow' applies based on the containing blocks chain.
120 // (http://www.w3.org/TR/CSS2/visufx.html#propdef-overflow)
121 // * 'clip' applies to all descendants.
122 // (http://www.w3.org/TR/CSS2/visufx.html#propdef-clip)
123 //
124 // Let's take an example:
125 // <!DOCTYPE html>
126 // <div id="container" style="position: absolute; height: 100px; width: 100px">
127 // <div id="inflow" style="height: 200px; width: 200px;
128 // background-color: purple"></div>
129 // <div id="fixed" style="height: 200px; width: 200px; position: fixed;
130 // background-color: orange"></div>
131 // </div>
132 //
133 // The paint tree looks like:
134 // html
135 // / |
136 // / |
137 // / |
138 // container fixed
139 // |
140 // |
141 // inflow
142 //
143 // If we add "overflow: hidden" to #container, the overflow clip will apply to
144 // #inflow but not to #fixed. That's because #fixed's containing block is above
145 // #container and thus 'overflow' doesn't apply to it. During our tree walk,
146 // #fixed is a child of #container, which is the reason why we keep 3 clip rects
147 // depending on the 'position' of the elements.
148 //
149 // Now instead if we add "clip: rect(0px, 100px, 100px, 0px)" to #container,
150 // the clip will apply to both #inflow and #fixed. That's because 'clip'
151 // applies to any descendant, regardless of containing blocks. Note that
152 // #container and #fixed are siblings in the paint tree but #container does
153 // clip #fixed. This is the reason why we compute the painting clip rects during
154 // a layout tree walk and cache them for painting.
155 //
156 // This class is NOT DEPRECATED, DeprecatedPaintLayer is and we match its
157 // naming.
110 class DeprecatedPaintLayerClipper { 158 class DeprecatedPaintLayerClipper {
111 DISALLOW_ALLOCATION(); 159 DISALLOW_ALLOCATION();
112 WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerClipper); 160 WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerClipper);
113 public: 161 public:
114 explicit DeprecatedPaintLayerClipper(LayoutBoxModelObject&); 162 explicit DeprecatedPaintLayerClipper(LayoutBoxModelObject&);
115 163
116 void clearClipRectsIncludingDescendants(); 164 void clearClipRectsIncludingDescendants();
117 void clearClipRectsIncludingDescendants(ClipRectsCacheSlot); 165 void clearClipRectsIncludingDescendants(ClipRectsCacheSlot);
118 166
119 LayoutRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space. 167 LayoutRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 bool shouldRespectOverflowClip(const ClipRectsContext&) const; 202 bool shouldRespectOverflowClip(const ClipRectsContext&) const;
155 203
156 // FIXME: Could this be a LayoutBox? 204 // FIXME: Could this be a LayoutBox?
157 LayoutBoxModelObject& m_layoutObject; 205 LayoutBoxModelObject& m_layoutObject;
158 mutable OwnPtr<ClipRectsCache> m_cache; 206 mutable OwnPtr<ClipRectsCache> m_cache;
159 }; 207 };
160 208
161 } // namespace blink 209 } // namespace blink
162 210
163 #endif // LayerClipper_h 211 #endif // LayerClipper_h
OLDNEW
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.h ('k') | Source/core/paint/DeprecatedPaintLayerStackingNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698