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

Side by Side Diff: sky/engine/core/rendering/RenderLayer.h

Issue 945693002: Move hit testing out of RenderLayer into RenderBox. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: add to test case Created 5 years, 10 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
« no previous file with comments | « sky/engine/core/rendering/RenderBox.cpp ('k') | sky/engine/core/rendering/RenderLayer.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) 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 TransformationMatrix renderableTransform() const; 181 TransformationMatrix renderableTransform() const;
182 182
183 // Get the perspective transform, which is applied to transformed sublayers. 183 // Get the perspective transform, which is applied to transformed sublayers.
184 // Returns true if the layer has a -webkit-perspective. 184 // Returns true if the layer has a -webkit-perspective.
185 // Note that this transform has the perspective-origin baked in. 185 // Note that this transform has the perspective-origin baked in.
186 TransformationMatrix perspectiveTransform() const; 186 TransformationMatrix perspectiveTransform() const;
187 FloatPoint perspectiveOrigin() const; 187 FloatPoint perspectiveOrigin() const;
188 bool preserves3D() const { return renderer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; } 188 bool preserves3D() const { return renderer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; }
189 bool has3DTransform() const { return m_transform && !m_transform->isAffine() ; } 189 bool has3DTransform() const { return m_transform && !m_transform->isAffine() ; }
190 190
191 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan t; }
192 // Both updates the status, and returns true if descendants of this have 3d.
193 bool update3DTransformedDescendantStatus();
194
191 // FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959 195 // FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959
192 bool shouldPreserve3D() const { return renderer()->style()->transformStyle3D () == TransformStyle3DPreserve3D; } 196 bool shouldPreserve3D() const { return renderer()->style()->transformStyle3D () == TransformStyle3DPreserve3D; }
193 197
194 bool hasFilter() const { return renderer()->hasFilter(); } 198 bool hasFilter() const { return renderer()->hasFilter(); }
195 199
196 void* operator new(size_t); 200 void* operator new(size_t);
197 // Only safe to call from RenderLayerModelObject::destroyLayer() 201 // Only safe to call from RenderLayerModelObject::destroyLayer()
198 void operator delete(void*); 202 void operator delete(void*);
199 203
200 bool paintsWithTransform() const; 204 bool paintsWithTransform() const;
(...skipping 13 matching lines...) Expand all
214 { 218 {
215 if (hasFilterInfo()) 219 if (hasFilterInfo())
216 RenderLayerFilterInfo::removeFilterInfoForRenderLayer(this); 220 RenderLayerFilterInfo::removeFilterInfoForRenderLayer(this);
217 } 221 }
218 222
219 bool hasFilterInfo() const { return m_hasFilterInfo; } 223 bool hasFilterInfo() const { return m_hasFilterInfo; }
220 void setHasFilterInfo(bool hasFilterInfo) { m_hasFilterInfo = hasFilterInfo; } 224 void setHasFilterInfo(bool hasFilterInfo) { m_hasFilterInfo = hasFilterInfo; }
221 225
222 void updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle) ; 226 void updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle) ;
223 227
224 Node* enclosingElement() const;
225
226 RenderLayerClipper& clipper() { return m_clipper; } 228 RenderLayerClipper& clipper() { return m_clipper; }
227 const RenderLayerClipper& clipper() const { return m_clipper; } 229 const RenderLayerClipper& clipper() const { return m_clipper; }
228 230
229 inline bool isPositionedContainer() const 231 inline bool isPositionedContainer() const
230 { 232 {
231 // FIXME: This is not in sync with containingBlock. 233 // FIXME: This is not in sync with containingBlock.
232 RenderLayerModelObject* layerRenderer = renderer(); 234 RenderLayerModelObject* layerRenderer = renderer();
233 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); 235 return isRootLayer() || layerRenderer->isPositioned() || hasTransform();
234 } 236 }
235 237
236 void updateOrRemoveFilterEffectRenderer(); 238 void updateOrRemoveFilterEffectRenderer();
237 void updateSelfPaintingLayer(); 239 void updateSelfPaintingLayer();
238 240
239 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius); 241 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
240 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&); 242 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&);
241 243
242 bool hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
243 const LayoutRect& hitTestRect, const HitTestLocation&,
244 const HitTestingTransformState* transformState = 0, double * zOffset = 0);
245
246 private: 244 private:
247 // TODO(ojan): Get rid of this. These are basically layer-tree-only paint ph ases. 245 // TODO(ojan): Get rid of this. These are basically layer-tree-only paint ph ases.
248 enum PaintLayerFlags { 246 enum PaintLayerFlags {
249 PaintContent, 247 PaintContent,
250 }; 248 };
251 249
252 // Bounding box in the coordinates of this layer. 250 // Bounding box in the coordinates of this layer.
253 LayoutRect logicalBoundingBox() const; 251 LayoutRect logicalBoundingBox() const;
254 252
255 void setAncestorChainHasSelfPaintingLayerDescendant(); 253 void setAncestorChainHasSelfPaintingLayerDescendant();
256 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 254 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
257 255
258 void setNextSibling(RenderLayer* next) { m_next = next; } 256 void setNextSibling(RenderLayer* next) { m_next = next; }
259 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } 257 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; }
260 void setFirstChild(RenderLayer* first) { m_first = first; } 258 void setFirstChild(RenderLayer* first) { m_first = first; }
261 void setLastChild(RenderLayer* last) { m_last = last; } 259 void setLastChild(RenderLayer* last) { m_last = last; }
262 260
263 void updateHasSelfPaintingLayerDescendant() const; 261 void updateHasSelfPaintingLayerDescendant() const;
264 262
265 bool hasSelfPaintingLayerDescendant() const 263 bool hasSelfPaintingLayerDescendant() const
266 { 264 {
267 if (m_hasSelfPaintingLayerDescendantDirty) 265 if (m_hasSelfPaintingLayerDescendantDirty)
268 updateHasSelfPaintingLayerDescendant(); 266 updateHasSelfPaintingLayerDescendant();
269 ASSERT(!m_hasSelfPaintingLayerDescendantDirty); 267 ASSERT(!m_hasSelfPaintingLayerDescendantDirty);
270 return m_hasSelfPaintingLayerDescendant; 268 return m_hasSelfPaintingLayerDescendant;
271 } 269 }
272 270
273 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende rBox(renderer())->location() : LayoutPoint(); } 271 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende rBox(renderer())->location() : LayoutPoint(); }
274 272
275 bool hitTestChildren(ChildrenIteration, RenderLayer* rootLayer, const HitTes tRequest&, HitTestResult&,
276 const LayoutRect& hitTestRect, const HitTestLocation&,
277 const HitTestingTransformState* transformState, double* zOffsetForDescendants, double* zOffset,
278 const HitTestingTransformState* unflattenedTransformSta te, bool depthSortDescendants);
279
280 PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
281 const LayoutRect& hitTestRect, const HitTestLocation &,
282 const HitTestingTransformState* containerTransformSt ate,
283 const LayoutPoint& translationOffset = LayoutPoint() ) const;
284
285 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect & layerBounds, const HitTestLocation&) const;
286
287 bool shouldBeSelfPaintingLayer() const; 273 bool shouldBeSelfPaintingLayer() const;
288 274
289 // FIXME: We should only create the stacking node if needed. 275 // FIXME: We should only create the stacking node if needed.
290 bool requiresStackingNode() const { return true; } 276 bool requiresStackingNode() const { return true; }
291 void updateStackingNode(); 277 void updateStackingNode();
292 278
293 void updateTransform(const RenderStyle* oldStyle, RenderStyle* newStyle); 279 void updateTransform(const RenderStyle* oldStyle, RenderStyle* newStyle);
294 280
295 void dirty3DTransformedDescendantStatus(); 281 void dirty3DTransformedDescendantStatus();
296 // Both updates the status, and returns true if descendants of this have 3d.
297 bool update3DTransformedDescendantStatus();
298 282
299 void updateOrRemoveFilterClients(); 283 void updateOrRemoveFilterClients();
300 284
301 LayoutRect paintingExtent(const RenderLayer* rootLayer, const LayoutRect& pa intDirtyRect, const LayoutSize& subPixelAccumulation); 285 LayoutRect paintingExtent(const RenderLayer* rootLayer, const LayoutRect& pa intDirtyRect, const LayoutSize& subPixelAccumulation);
302 286
303 LayerType m_layerType; 287 LayerType m_layerType;
304 288
305 // Self-painting layer is an optimization where we avoid the heavy RenderLay er painting 289 // Self-painting layer is an optimization where we avoid the heavy RenderLay er painting
306 // machinery for a RenderLayer allocated only to handle the overflow clip ca se. 290 // machinery for a RenderLayer allocated only to handle the overflow clip ca se.
307 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov erflow-only concept. 291 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov erflow-only concept.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 331
348 } // namespace blink 332 } // namespace blink
349 333
350 #ifndef NDEBUG 334 #ifndef NDEBUG
351 // Outside the WebCore namespace for ease of invocation from gdb. 335 // Outside the WebCore namespace for ease of invocation from gdb.
352 void showLayerTree(const blink::RenderLayer*); 336 void showLayerTree(const blink::RenderLayer*);
353 void showLayerTree(const blink::RenderObject*); 337 void showLayerTree(const blink::RenderObject*);
354 #endif 338 #endif
355 339
356 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ 340 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBox.cpp ('k') | sky/engine/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698