Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 } | 387 } |
| 388 virtual void removeChild(LayoutObject*); | 388 virtual void removeChild(LayoutObject*); |
| 389 virtual bool createsAnonymousWrapper() const { return false; } | 389 virtual bool createsAnonymousWrapper() const { return false; } |
| 390 ////////////////////////////////////////// | 390 ////////////////////////////////////////// |
| 391 | 391 |
| 392 // Sets the parent of this object but doesn't add it as a child of the parent. | 392 // Sets the parent of this object but doesn't add it as a child of the parent. |
| 393 void setDangerousOneWayParent(LayoutObject*); | 393 void setDangerousOneWayParent(LayoutObject*); |
| 394 | 394 |
| 395 // For SlimmingPaintInvalidation/SPv2 only. | 395 // For SlimmingPaintInvalidation/SPv2 only. |
| 396 // The ObjectPaintProperties structure holds references to the property tree | 396 // The ObjectPaintProperties structure holds references to the property tree |
| 397 // nodes that are created by the layout object for painting. The property | 397 // nodes that are created by the layout object. The property nodes should only |
| 398 // nodes are only updated during InPrePaint phase of the document lifecycle | 398 // be updated during InPrePaint phase of the document lifecycle. |
| 399 // and shall remain immutable during other phases. | 399 const ObjectPaintProperties* paintProperties() const { |
| 400 const ObjectPaintProperties* paintProperties() const; | 400 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| 401 return m_rarePaintData ? m_rarePaintData->paintProperties() : nullptr; | |
| 402 } | |
| 401 | 403 |
| 402 private: | 404 private: |
| 403 ObjectPaintProperties& ensurePaintProperties(); | 405 // This is for paint-related data that is not needed on all LayoutObjects. |
| 406 // TODO(pdr): Store LayoutBoxModelObject's m_paintLayer in this structure. | |
| 407 // TODO(pdr): Store ObjectPaintProperties::LocalBorderBoxProperties here. | |
| 408 struct CORE_EXPORT RarePaintData { | |
|
Xianzhu
2017/03/30 03:11:18
Nit: This data structure seems like a class more t
pdr.
2017/03/30 18:57:33
Sure, done.
| |
| 409 WTF_MAKE_NONCOPYABLE(RarePaintData); | |
| 410 USING_FAST_MALLOC(RarePaintData); | |
| 411 | |
| 412 public: | |
| 413 RarePaintData(); | |
| 414 ~RarePaintData(); | |
| 415 | |
| 416 ObjectPaintProperties* paintProperties() const { | |
| 417 return m_paintProperties.get(); | |
| 418 } | |
| 419 ObjectPaintProperties& ensurePaintProperties(); | |
| 420 | |
| 421 private: | |
| 422 // Holds references to the paint property nodes created by this object. | |
| 423 std::unique_ptr<ObjectPaintProperties> m_paintProperties; | |
| 424 }; | |
| 425 | |
| 426 RarePaintData& ensureRarePaintData(); | |
| 427 RarePaintData* rarePaintData() { return m_rarePaintData.get(); } | |
| 404 | 428 |
| 405 ////////////////////////////////////////// | 429 ////////////////////////////////////////// |
| 406 // Helper functions. Dangerous to use! | 430 // Helper functions. Dangerous to use! |
| 407 void setPreviousSibling(LayoutObject* previous) { m_previous = previous; } | 431 void setPreviousSibling(LayoutObject* previous) { m_previous = previous; } |
| 408 void setNextSibling(LayoutObject* next) { m_next = next; } | 432 void setNextSibling(LayoutObject* next) { m_next = next; } |
| 409 void setParent(LayoutObject* parent) { | 433 void setParent(LayoutObject* parent) { |
| 410 m_parent = parent; | 434 m_parent = parent; |
| 411 | 435 |
| 412 // Only update if our flow thread state is different from our new parent and | 436 // Only update if our flow thread state is different from our new parent and |
| 413 // if we're not a LayoutFlowThread. | 437 // if we're not a LayoutFlowThread. |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1773 protected: | 1797 protected: |
| 1774 friend class PaintPropertyTreeBuilder; | 1798 friend class PaintPropertyTreeBuilder; |
| 1775 FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest, | 1799 FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest, |
| 1776 canStartAnimationOnCompositorTransformSPv2); | 1800 canStartAnimationOnCompositorTransformSPv2); |
| 1777 FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest, | 1801 FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest, |
| 1778 canStartAnimationOnCompositorEffectSPv2); | 1802 canStartAnimationOnCompositorEffectSPv2); |
| 1779 | 1803 |
| 1780 // The following two functions can be called from PaintPropertyTreeBuilder | 1804 // The following two functions can be called from PaintPropertyTreeBuilder |
| 1781 // only. | 1805 // only. |
| 1782 ObjectPaintProperties& ensurePaintProperties() { | 1806 ObjectPaintProperties& ensurePaintProperties() { |
| 1783 return m_layoutObject.ensurePaintProperties(); | 1807 return m_layoutObject.ensureRarePaintData().ensurePaintProperties(); |
| 1784 } | 1808 } |
| 1785 ObjectPaintProperties* paintProperties() { | 1809 ObjectPaintProperties* paintProperties() { |
| 1786 return const_cast<ObjectPaintProperties*>( | 1810 if (auto* paintData = m_layoutObject.rarePaintData()) |
| 1787 m_layoutObject.paintProperties()); | 1811 return paintData->paintProperties(); |
| 1812 return nullptr; | |
| 1788 } | 1813 } |
| 1789 | 1814 |
| 1790 friend class LayoutObject; | 1815 friend class LayoutObject; |
| 1791 MutableForPainting(const LayoutObject& layoutObject) | 1816 MutableForPainting(const LayoutObject& layoutObject) |
| 1792 : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {} | 1817 : m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {} |
| 1793 | 1818 |
| 1794 LayoutObject& m_layoutObject; | 1819 LayoutObject& m_layoutObject; |
| 1795 }; | 1820 }; |
| 1796 MutableForPainting getMutableForPainting() const { | 1821 MutableForPainting getMutableForPainting() const { |
| 1797 return MutableForPainting(*this); | 1822 return MutableForPainting(*this); |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2549 // adjustVisualRectForCompositedScrolling(). | 2574 // adjustVisualRectForCompositedScrolling(). |
| 2550 LayoutRect m_visualRect; | 2575 LayoutRect m_visualRect; |
| 2551 | 2576 |
| 2552 // This stores the paint offset computed by the latest paint property tree | 2577 // This stores the paint offset computed by the latest paint property tree |
| 2553 // building. It is relative to the containing transform space. It is the same | 2578 // building. It is relative to the containing transform space. It is the same |
| 2554 // offset that will be used to paint the object on SPv2. It's used to detect | 2579 // offset that will be used to paint the object on SPv2. It's used to detect |
| 2555 // paint offset change for paint invalidation on SPv2, and partial paint | 2580 // paint offset change for paint invalidation on SPv2, and partial paint |
| 2556 // property tree update for SlimmingPaintInvalidation on SPv1 and SPv2. | 2581 // property tree update for SlimmingPaintInvalidation on SPv1 and SPv2. |
| 2557 LayoutPoint m_paintOffset; | 2582 LayoutPoint m_paintOffset; |
| 2558 | 2583 |
| 2559 // For SPv2 only. The ObjectPaintProperties structure holds references to the | 2584 std::unique_ptr<RarePaintData> m_rarePaintData; |
| 2560 // property tree nodes that are created by the layout object for painting. | |
| 2561 std::unique_ptr<ObjectPaintProperties> m_paintProperties; | |
| 2562 }; | 2585 }; |
| 2563 | 2586 |
| 2564 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer | 2587 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer |
| 2565 // hit. | 2588 // hit. |
| 2566 class DeprecatedDisableModifyLayoutTreeStructureAsserts { | 2589 class DeprecatedDisableModifyLayoutTreeStructureAsserts { |
| 2567 STACK_ALLOCATED(); | 2590 STACK_ALLOCATED(); |
| 2568 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts); | 2591 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts); |
| 2569 | 2592 |
| 2570 public: | 2593 public: |
| 2571 DeprecatedDisableModifyLayoutTreeStructureAsserts(); | 2594 DeprecatedDisableModifyLayoutTreeStructureAsserts(); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2779 CORE_EXPORT void showLineTree(const blink::LayoutObject*); | 2802 CORE_EXPORT void showLineTree(const blink::LayoutObject*); |
| 2780 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); | 2803 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); |
| 2781 // We don't make object2 an optional parameter so that showLayoutTree | 2804 // We don't make object2 an optional parameter so that showLayoutTree |
| 2782 // can be called from gdb easily. | 2805 // can be called from gdb easily. |
| 2783 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, | 2806 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, |
| 2784 const blink::LayoutObject* object2); | 2807 const blink::LayoutObject* object2); |
| 2785 | 2808 |
| 2786 #endif | 2809 #endif |
| 2787 | 2810 |
| 2788 #endif // LayoutObject_h | 2811 #endif // LayoutObject_h |
| OLD | NEW |