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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2802593004: Move RarePaintData to its own file (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 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) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 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 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "core/layout/LayoutTableRow.h" 70 #include "core/layout/LayoutTableRow.h"
71 #include "core/layout/LayoutTheme.h" 71 #include "core/layout/LayoutTheme.h"
72 #include "core/layout/LayoutView.h" 72 #include "core/layout/LayoutView.h"
73 #include "core/layout/PaintInvalidationState.h" 73 #include "core/layout/PaintInvalidationState.h"
74 #include "core/layout/api/LayoutAPIShim.h" 74 #include "core/layout/api/LayoutAPIShim.h"
75 #include "core/layout/api/LayoutPartItem.h" 75 #include "core/layout/api/LayoutPartItem.h"
76 #include "core/layout/ng/layout_ng_block_flow.h" 76 #include "core/layout/ng/layout_ng_block_flow.h"
77 #include "core/page/AutoscrollController.h" 77 #include "core/page/AutoscrollController.h"
78 #include "core/page/Page.h" 78 #include "core/page/Page.h"
79 #include "core/paint/ObjectPaintInvalidator.h" 79 #include "core/paint/ObjectPaintInvalidator.h"
80 #include "core/paint/ObjectPaintProperties.h"
81 #include "core/paint/PaintLayer.h" 80 #include "core/paint/PaintLayer.h"
81 #include "core/paint/RarePaintData.h"
82 #include "core/style/ContentData.h" 82 #include "core/style/ContentData.h"
83 #include "core/style/CursorData.h" 83 #include "core/style/CursorData.h"
84 #include "platform/InstanceCounters.h" 84 #include "platform/InstanceCounters.h"
85 #include "platform/RuntimeEnabledFeatures.h" 85 #include "platform/RuntimeEnabledFeatures.h"
86 #include "platform/geometry/TransformState.h" 86 #include "platform/geometry/TransformState.h"
87 #include "platform/graphics/GraphicsLayer.h" 87 #include "platform/graphics/GraphicsLayer.h"
88 #include "platform/graphics/paint/PropertyTreeState.h" 88 #include "platform/graphics/paint/PropertyTreeState.h"
89 #include "platform/instrumentation/tracing/TracedValue.h" 89 #include "platform/instrumentation/tracing/TracedValue.h"
90 #include "wtf/allocator/Partitions.h" 90 #include "wtf/allocator/Partitions.h"
91 #include "wtf/text/StringBuilder.h" 91 #include "wtf/text/StringBuilder.h"
(...skipping 3458 matching lines...) Expand 10 before | Expand all | Expand 10 after
3550 isBackgroundAttachmentFixedObject) 3550 isBackgroundAttachmentFixedObject)
3551 return; 3551 return;
3552 m_bitfields.setIsBackgroundAttachmentFixedObject( 3552 m_bitfields.setIsBackgroundAttachmentFixedObject(
3553 isBackgroundAttachmentFixedObject); 3553 isBackgroundAttachmentFixedObject);
3554 if (isBackgroundAttachmentFixedObject) 3554 if (isBackgroundAttachmentFixedObject)
3555 frameView()->addBackgroundAttachmentFixedObject(this); 3555 frameView()->addBackgroundAttachmentFixedObject(this);
3556 else 3556 else
3557 frameView()->removeBackgroundAttachmentFixedObject(this); 3557 frameView()->removeBackgroundAttachmentFixedObject(this);
3558 } 3558 }
3559 3559
3560 LayoutObject::RarePaintData::RarePaintData() {} 3560 RarePaintData& LayoutObject::ensureRarePaintData() {
3561
3562 LayoutObject::RarePaintData::~RarePaintData() {}
3563
3564 ObjectPaintProperties& LayoutObject::RarePaintData::ensurePaintProperties() {
3565 if (!m_paintProperties)
3566 m_paintProperties = ObjectPaintProperties::create();
3567 return *m_paintProperties.get();
3568 }
3569
3570 void LayoutObject::RarePaintData::clearLocalBorderBoxProperties() {
3571 m_localBorderBoxProperties = nullptr;
3572
3573 // The contents properties are based on the border box so we need to clear
3574 // the cached value.
3575 m_contentsProperties = nullptr;
3576 }
3577
3578 void LayoutObject::RarePaintData::setLocalBorderBoxProperties(
3579 PropertyTreeState& state) {
3580 if (!m_localBorderBoxProperties)
3581 m_localBorderBoxProperties = WTF::makeUnique<PropertyTreeState>(state);
3582 else
3583 *m_localBorderBoxProperties = state;
3584
3585 // The contents properties are based on the border box so we need to clear
3586 // the cached value.
3587 m_contentsProperties = nullptr;
3588 }
3589
3590 const PropertyTreeState* LayoutObject::RarePaintData::contentsProperties()
3591 const {
3592 if (!m_contentsProperties) {
3593 if (m_localBorderBoxProperties) {
3594 m_contentsProperties = ObjectPaintProperties::contentsProperties(
3595 m_localBorderBoxProperties.get(), m_paintProperties.get());
3596 }
3597 } else {
3598 #if DCHECK_IS_ON()
3599 // Check that the cached contents properties are valid by checking that they
3600 // do not change if recalculated.
3601 DCHECK(m_localBorderBoxProperties);
3602 std::unique_ptr<PropertyTreeState> oldProperties =
3603 std::move(m_contentsProperties);
3604 m_contentsProperties = ObjectPaintProperties::contentsProperties(
3605 m_localBorderBoxProperties.get(), m_paintProperties.get());
3606 DCHECK(*m_contentsProperties == *oldProperties);
3607 #endif
3608 }
3609 return m_contentsProperties.get();
3610 }
3611
3612 LayoutObject::RarePaintData& LayoutObject::ensureRarePaintData() {
3613 if (!m_rarePaintData) 3561 if (!m_rarePaintData)
3614 m_rarePaintData = WTF::makeUnique<RarePaintData>(); 3562 m_rarePaintData = WTF::makeUnique<RarePaintData>();
3615 return *m_rarePaintData.get(); 3563 return *m_rarePaintData.get();
3616 } 3564 }
3617 3565
3618 LayoutRect LayoutObject::debugRect() const { 3566 LayoutRect LayoutObject::debugRect() const {
3619 LayoutRect rect; 3567 LayoutRect rect;
3620 LayoutBlock* block = containingBlock(); 3568 LayoutBlock* block = containingBlock();
3621 if (block) 3569 if (block)
3622 block->adjustChildDebugRect(rect); 3570 block->adjustChildDebugRect(rect);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3677 const blink::LayoutObject* root = object1; 3625 const blink::LayoutObject* root = object1;
3678 while (root->parent()) 3626 while (root->parent())
3679 root = root->parent(); 3627 root = root->parent();
3680 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3628 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3681 } else { 3629 } else {
3682 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3630 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3683 } 3631 }
3684 } 3632 }
3685 3633
3686 #endif 3634 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/paint/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698