| OLD | NEW |
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 * version of this file under any of the LGPL, the MPL or the GPL. | 42 * version of this file under any of the LGPL, the MPL or the GPL. |
| 43 */ | 43 */ |
| 44 | 44 |
| 45 #ifndef SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ | 45 #ifndef SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ |
| 46 #define SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ | 46 #define SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ |
| 47 | 47 |
| 48 #include "sky/engine/core/rendering/LayerPaintingInfo.h" | 48 #include "sky/engine/core/rendering/LayerPaintingInfo.h" |
| 49 #include "sky/engine/core/rendering/RenderBox.h" | 49 #include "sky/engine/core/rendering/RenderBox.h" |
| 50 #include "sky/engine/core/rendering/RenderLayerClipper.h" | 50 #include "sky/engine/core/rendering/RenderLayerClipper.h" |
| 51 #include "sky/engine/core/rendering/RenderLayerFilterInfo.h" | 51 #include "sky/engine/core/rendering/RenderLayerFilterInfo.h" |
| 52 #include "sky/engine/core/rendering/RenderLayerScrollableArea.h" | |
| 53 #include "sky/engine/core/rendering/RenderLayerStackingNode.h" | 52 #include "sky/engine/core/rendering/RenderLayerStackingNode.h" |
| 54 #include "sky/engine/core/rendering/RenderLayerStackingNodeIterator.h" | 53 #include "sky/engine/core/rendering/RenderLayerStackingNodeIterator.h" |
| 55 #include "sky/engine/public/platform/WebBlendMode.h" | 54 #include "sky/engine/public/platform/WebBlendMode.h" |
| 56 #include "sky/engine/wtf/OwnPtr.h" | 55 #include "sky/engine/wtf/OwnPtr.h" |
| 57 | 56 |
| 58 namespace blink { | 57 namespace blink { |
| 59 | 58 |
| 60 class FilterEffectRenderer; | 59 class FilterEffectRenderer; |
| 61 class FilterOperations; | 60 class FilterOperations; |
| 62 class HitTestRequest; | 61 class HitTestRequest; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 207 |
| 209 // FIXME: reflections should force transform-style to be flat in the style:
https://bugs.webkit.org/show_bug.cgi?id=106959 | 208 // FIXME: reflections should force transform-style to be flat in the style:
https://bugs.webkit.org/show_bug.cgi?id=106959 |
| 210 bool shouldPreserve3D() const { return renderer()->style()->transformStyle3D
() == TransformStyle3DPreserve3D; } | 209 bool shouldPreserve3D() const { return renderer()->style()->transformStyle3D
() == TransformStyle3DPreserve3D; } |
| 211 | 210 |
| 212 bool hasFilter() const { return renderer()->hasFilter(); } | 211 bool hasFilter() const { return renderer()->hasFilter(); } |
| 213 | 212 |
| 214 void* operator new(size_t); | 213 void* operator new(size_t); |
| 215 // Only safe to call from RenderLayerModelObject::destroyLayer() | 214 // Only safe to call from RenderLayerModelObject::destroyLayer() |
| 216 void operator delete(void*); | 215 void operator delete(void*); |
| 217 | 216 |
| 218 bool needsCompositedScrolling() const { return m_scrollableArea && m_scrolla
bleArea->needsCompositedScrolling(); } | |
| 219 | |
| 220 bool paintsWithTransform() const; | 217 bool paintsWithTransform() const; |
| 221 | 218 |
| 222 bool containsDirtyOverlayScrollbars() const { return m_containsDirtyOverlayS
crollbars; } | 219 bool containsDirtyOverlayScrollbars() const { return m_containsDirtyOverlayS
crollbars; } |
| 223 void setContainsDirtyOverlayScrollbars(bool dirtyScrollbars) { m_containsDir
tyOverlayScrollbars = dirtyScrollbars; } | 220 void setContainsDirtyOverlayScrollbars(bool dirtyScrollbars) { m_containsDir
tyOverlayScrollbars = dirtyScrollbars; } |
| 224 | 221 |
| 225 FilterOperations computeFilterOperations(const RenderStyle*); | 222 FilterOperations computeFilterOperations(const RenderStyle*); |
| 226 bool paintsWithFilters() const; | 223 bool paintsWithFilters() const; |
| 227 bool requiresFullLayerImageForFilters() const; | 224 bool requiresFullLayerImageForFilters() const; |
| 228 FilterEffectRenderer* filterRenderer() const | 225 FilterEffectRenderer* filterRenderer() const |
| 229 { | 226 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 241 | 238 |
| 242 bool hasFilterInfo() const { return m_hasFilterInfo; } | 239 bool hasFilterInfo() const { return m_hasFilterInfo; } |
| 243 void setHasFilterInfo(bool hasFilterInfo) { m_hasFilterInfo = hasFilterInfo;
} | 240 void setHasFilterInfo(bool hasFilterInfo) { m_hasFilterInfo = hasFilterInfo;
} |
| 244 | 241 |
| 245 void updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle)
; | 242 void updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle)
; |
| 246 | 243 |
| 247 Node* enclosingElement() const; | 244 Node* enclosingElement() const; |
| 248 | 245 |
| 249 bool scrollsWithRespectTo(const RenderLayer*) const; | 246 bool scrollsWithRespectTo(const RenderLayer*) const; |
| 250 | 247 |
| 251 // FIXME: This should probably return a ScrollableArea but a lot of internal
methods are mistakenly exposed. | |
| 252 RenderLayerScrollableArea* scrollableArea() const { return m_scrollableArea.
get(); } | |
| 253 RenderLayerClipper& clipper() { return m_clipper; } | 248 RenderLayerClipper& clipper() { return m_clipper; } |
| 254 const RenderLayerClipper& clipper() const { return m_clipper; } | 249 const RenderLayerClipper& clipper() const { return m_clipper; } |
| 255 | 250 |
| 256 inline bool isPositionedContainer() const | 251 inline bool isPositionedContainer() const |
| 257 { | 252 { |
| 258 // FIXME: This is not in sync with containingBlock. | 253 // FIXME: This is not in sync with containingBlock. |
| 259 RenderLayerModelObject* layerRenderer = renderer(); | 254 RenderLayerModelObject* layerRenderer = renderer(); |
| 260 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); | 255 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); |
| 261 } | 256 } |
| 262 | 257 |
| 263 bool scrollsOverflow() const; | |
| 264 | |
| 265 class AncestorDependentCompositingInputs { | 258 class AncestorDependentCompositingInputs { |
| 266 public: | 259 public: |
| 267 AncestorDependentCompositingInputs() | 260 AncestorDependentCompositingInputs() |
| 268 : opacityAncestor(0) | 261 : opacityAncestor(0) |
| 269 , transformAncestor(0) | 262 , transformAncestor(0) |
| 270 , filterAncestor(0) | 263 , filterAncestor(0) |
| 271 , clippingContainer(0) | 264 , clippingContainer(0) |
| 272 , ancestorScrollingLayer(0) | 265 , ancestorScrollingLayer(0) |
| 273 , scrollParent(0) | 266 , scrollParent(0) |
| 274 , clipParent(0) | 267 , clipParent(0) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 bool hasCompositingDescendant() const { return m_hasCompositingDescendant; } | 349 bool hasCompositingDescendant() const { return m_hasCompositingDescendant; } |
| 357 void setHasCompositingDescendant(bool); | 350 void setHasCompositingDescendant(bool); |
| 358 | 351 |
| 359 void updateOrRemoveFilterEffectRenderer(); | 352 void updateOrRemoveFilterEffectRenderer(); |
| 360 | 353 |
| 361 void updateSelfPaintingLayer(); | 354 void updateSelfPaintingLayer(); |
| 362 | 355 |
| 363 RenderLayer* enclosingTransformedAncestor() const; | 356 RenderLayer* enclosingTransformedAncestor() const; |
| 364 LayoutPoint computeOffsetFromTransformedAncestor() const; | 357 LayoutPoint computeOffsetFromTransformedAncestor() const; |
| 365 | 358 |
| 366 void didUpdateNeedsCompositedScrolling(); | |
| 367 | |
| 368 private: | 359 private: |
| 369 // TODO(ojan): Get rid of this. These are basically layer-tree-only paint ph
ases. | 360 // TODO(ojan): Get rid of this. These are basically layer-tree-only paint ph
ases. |
| 370 enum PaintLayerFlags { | 361 enum PaintLayerFlags { |
| 371 PaintContent, | 362 PaintContent, |
| 372 PaintOverlayScrollbars, | 363 PaintOverlayScrollbars, |
| 373 }; | 364 }; |
| 374 | 365 |
| 375 // Bounding box in the coordinates of this layer. | 366 // Bounding box in the coordinates of this layer. |
| 376 LayoutRect logicalBoundingBox() const; | 367 LayoutRect logicalBoundingBox() const; |
| 377 | 368 |
| 378 bool hasOverflowControls() const; | |
| 379 | |
| 380 void setAncestorChainHasSelfPaintingLayerDescendant(); | 369 void setAncestorChainHasSelfPaintingLayerDescendant(); |
| 381 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 370 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 382 | 371 |
| 383 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&,
BorderRadiusClippingRule = IncludeSelfForBorderRadius); | 372 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&,
BorderRadiusClippingRule = IncludeSelfForBorderRadius); |
| 384 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C
lipRect&); | 373 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C
lipRect&); |
| 385 | 374 |
| 386 void setNextSibling(RenderLayer* next) { m_next = next; } | 375 void setNextSibling(RenderLayer* next) { m_next = next; } |
| 387 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } | 376 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } |
| 388 void setFirstChild(RenderLayer* first) { m_first = first; } | 377 void setFirstChild(RenderLayer* first) { m_first = first; } |
| 389 void setLastChild(RenderLayer* last) { m_last = last; } | 378 void setLastChild(RenderLayer* last) { m_last = last; } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 410 | 399 |
| 411 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const LayerPa
intingInfo&, PaintLayerFlags); | 400 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const LayerPa
intingInfo&, PaintLayerFlags); |
| 412 | 401 |
| 413 void paintForeground(GraphicsContext*, GraphicsContext* transparencyLayerCon
text, | 402 void paintForeground(GraphicsContext*, GraphicsContext* transparencyLayerCon
text, |
| 414 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con
st LayerPaintingInfo&, RenderObject* paintingRootForRenderer, | 403 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con
st LayerPaintingInfo&, RenderObject* paintingRootForRenderer, |
| 415 LayoutPoint& layerLocation, ClipRect& layerForegroundRect); | 404 LayoutPoint& layerLocation, ClipRect& layerForegroundRect); |
| 416 void paintForegroundWithPhase(PaintPhase, GraphicsContext*, const LayerPaint
ingInfo&, RenderObject* paintingRootForRenderer, | 405 void paintForegroundWithPhase(PaintPhase, GraphicsContext*, const LayerPaint
ingInfo&, RenderObject* paintingRootForRenderer, |
| 417 LayoutPoint& layerLocation, ClipRect& layerForegroundRect); | 406 LayoutPoint& layerLocation, ClipRect& layerForegroundRect); |
| 418 void paintOutline(GraphicsContext*, const LayerPaintingInfo&, RenderObject*
paintingRootForRenderer, | 407 void paintOutline(GraphicsContext*, const LayerPaintingInfo&, RenderObject*
paintingRootForRenderer, |
| 419 LayoutPoint& layerLocation, ClipRect& layerOutlineRect); | 408 LayoutPoint& layerLocation, ClipRect& layerOutlineRect); |
| 420 void paintOverflowControls(GraphicsContext*, const LayerPaintingInfo&, | |
| 421 LayoutPoint& layerLocation, ClipRect& layerBackgroundRect); | |
| 422 void paintMask(GraphicsContext*, const LayerPaintingInfo&, RenderObject* pai
ntingRootForRenderer, | 409 void paintMask(GraphicsContext*, const LayerPaintingInfo&, RenderObject* pai
ntingRootForRenderer, |
| 423 LayoutPoint& layerLocation, ClipRect& layerBackgroundRect); | 410 LayoutPoint& layerLocation, ClipRect& layerBackgroundRect); |
| 424 | 411 |
| 425 RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLaye
r, const HitTestRequest& request, HitTestResult& result, | 412 RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLaye
r, const HitTestRequest& request, HitTestResult& result, |
| 426 const LayoutRect& hitTestRect, const HitTestLocati
on&, bool appliedTransform, | 413 const LayoutRect& hitTestRect, const HitTestLocati
on&, bool appliedTransform, |
| 427 const HitTestingTransformState* transformState = 0
, double* zOffset = 0); | 414 const HitTestingTransformState* transformState = 0
, double* zOffset = 0); |
| 428 RenderLayer* hitTestLayerByApplyingTransform(RenderLayer* rootLayer, RenderL
ayer* containerLayer, const HitTestRequest&, HitTestResult&, | 415 RenderLayer* hitTestLayerByApplyingTransform(RenderLayer* rootLayer, RenderL
ayer* containerLayer, const HitTestRequest&, HitTestResult&, |
| 429 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT
ransformState* = 0, double* zOffset = 0, | 416 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT
ransformState* = 0, double* zOffset = 0, |
| 430 const LayoutPoint& translationOffset = LayoutPoint()); | 417 const LayoutPoint& translationOffset = LayoutPoint()); |
| 431 RenderLayer* hitTestChildren(ChildrenIteration, RenderLayer* rootLayer, cons
t HitTestRequest&, HitTestResult&, | 418 RenderLayer* hitTestChildren(ChildrenIteration, RenderLayer* rootLayer, cons
t HitTestRequest&, HitTestResult&, |
| 432 const LayoutRect& hitTestRect, const HitTestLocatio
n&, | 419 const LayoutRect& hitTestRect, const HitTestLocatio
n&, |
| 433 const HitTestingTransformState* transformState, dou
ble* zOffsetForDescendants, double* zOffset, | 420 const HitTestingTransformState* transformState, dou
ble* zOffsetForDescendants, double* zOffset, |
| 434 const HitTestingTransformState* unflattenedTransfor
mState, bool depthSortDescendants); | 421 const HitTestingTransformState* unflattenedTransfor
mState, bool depthSortDescendants); |
| 435 | 422 |
| 436 PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer*
rootLayer, RenderLayer* containerLayer, | 423 PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer*
rootLayer, RenderLayer* containerLayer, |
| 437 const LayoutRect& hitTestRect, const HitTestLocation
&, | 424 const LayoutRect& hitTestRect, const HitTestLocation
&, |
| 438 const HitTestingTransformState* containerTransformSt
ate, | 425 const HitTestingTransformState* containerTransformSt
ate, |
| 439 const LayoutPoint& translationOffset = LayoutPoint()
) const; | 426 const LayoutPoint& translationOffset = LayoutPoint()
) const; |
| 440 | 427 |
| 441 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect
& layerBounds, const HitTestLocation&, HitTestFilter) const; | 428 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect
& layerBounds, const HitTestLocation&, HitTestFilter) const; |
| 442 | 429 |
| 443 bool shouldBeSelfPaintingLayer() const; | 430 bool shouldBeSelfPaintingLayer() const; |
| 444 | 431 |
| 445 // FIXME: We should only create the stacking node if needed. | 432 // FIXME: We should only create the stacking node if needed. |
| 446 bool requiresStackingNode() const { return true; } | 433 bool requiresStackingNode() const { return true; } |
| 447 void updateStackingNode(); | 434 void updateStackingNode(); |
| 448 | 435 |
| 449 // FIXME: We could lazily allocate our ScrollableArea based on style propert
ies ('overflow', ...) | |
| 450 // but for now, we are always allocating it for RenderBox as it's safer. | |
| 451 bool requiresScrollableArea() const { return renderBox(); } | |
| 452 void updateScrollableArea(); | |
| 453 | |
| 454 void updateTransform(const RenderStyle* oldStyle, RenderStyle* newStyle); | 436 void updateTransform(const RenderStyle* oldStyle, RenderStyle* newStyle); |
| 455 | 437 |
| 456 void dirty3DTransformedDescendantStatus(); | 438 void dirty3DTransformedDescendantStatus(); |
| 457 // Both updates the status, and returns true if descendants of this have 3d. | 439 // Both updates the status, and returns true if descendants of this have 3d. |
| 458 bool update3DTransformedDescendantStatus(); | 440 bool update3DTransformedDescendantStatus(); |
| 459 | 441 |
| 460 void updateOrRemoveFilterClients(); | 442 void updateOrRemoveFilterClients(); |
| 461 | 443 |
| 462 LayoutRect paintingExtent(const RenderLayer* rootLayer, const LayoutRect& pa
intDirtyRect, const LayoutSize& subPixelAccumulation); | 444 LayoutRect paintingExtent(const RenderLayer* rootLayer, const LayoutRect& pa
intDirtyRect, const LayoutSize& subPixelAccumulation); |
| 463 | 445 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 | 490 |
| 509 // Cached normal flow values for absolute positioned elements with static le
ft/top values. | 491 // Cached normal flow values for absolute positioned elements with static le
ft/top values. |
| 510 LayoutUnit m_staticInlinePosition; | 492 LayoutUnit m_staticInlinePosition; |
| 511 LayoutUnit m_staticBlockPosition; | 493 LayoutUnit m_staticBlockPosition; |
| 512 | 494 |
| 513 OwnPtr<TransformationMatrix> m_transform; | 495 OwnPtr<TransformationMatrix> m_transform; |
| 514 | 496 |
| 515 DescendantDependentCompositingInputs m_descendantDependentCompositingInputs; | 497 DescendantDependentCompositingInputs m_descendantDependentCompositingInputs; |
| 516 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; | 498 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; |
| 517 | 499 |
| 518 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; | |
| 519 | |
| 520 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? | 500 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? |
| 521 OwnPtr<RenderLayerStackingNode> m_stackingNode; | 501 OwnPtr<RenderLayerStackingNode> m_stackingNode; |
| 522 | 502 |
| 523 LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of a c
omposited layer's composited bounds compared to absolute coordinates. | 503 LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of a c
omposited layer's composited bounds compared to absolute coordinates. |
| 524 }; | 504 }; |
| 525 | 505 |
| 526 } // namespace blink | 506 } // namespace blink |
| 527 | 507 |
| 528 #ifndef NDEBUG | 508 #ifndef NDEBUG |
| 529 // Outside the WebCore namespace for ease of invocation from gdb. | 509 // Outside the WebCore namespace for ease of invocation from gdb. |
| 530 void showLayerTree(const blink::RenderLayer*); | 510 void showLayerTree(const blink::RenderLayer*); |
| 531 void showLayerTree(const blink::RenderObject*); | 511 void showLayerTree(const blink::RenderObject*); |
| 532 #endif | 512 #endif |
| 533 | 513 |
| 534 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ | 514 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ |
| OLD | NEW |