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

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

Issue 2782343002: Store local border box property cache outside ObjectPaintProperties (Closed)
Patch Set: Rebase 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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" 80 #include "core/paint/ObjectPaintProperties.h"
81 #include "core/paint/PaintLayer.h" 81 #include "core/paint/PaintLayer.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/instrumentation/tracing/TracedValue.h" 89 #include "platform/instrumentation/tracing/TracedValue.h"
89 #include "wtf/allocator/Partitions.h" 90 #include "wtf/allocator/Partitions.h"
90 #include "wtf/text/StringBuilder.h" 91 #include "wtf/text/StringBuilder.h"
91 #include "wtf/text/WTFString.h" 92 #include "wtf/text/WTFString.h"
92 #ifndef NDEBUG 93 #ifndef NDEBUG
93 #include <stdio.h> 94 #include <stdio.h>
94 #endif 95 #endif
95 96
96 namespace blink { 97 namespace blink {
97 98
(...skipping 3458 matching lines...) Expand 10 before | Expand all | Expand 10 after
3556 LayoutObject::RarePaintData::RarePaintData() {} 3557 LayoutObject::RarePaintData::RarePaintData() {}
3557 3558
3558 LayoutObject::RarePaintData::~RarePaintData() {} 3559 LayoutObject::RarePaintData::~RarePaintData() {}
3559 3560
3560 ObjectPaintProperties& LayoutObject::RarePaintData::ensurePaintProperties() { 3561 ObjectPaintProperties& LayoutObject::RarePaintData::ensurePaintProperties() {
3561 if (!m_paintProperties) 3562 if (!m_paintProperties)
3562 m_paintProperties = ObjectPaintProperties::create(); 3563 m_paintProperties = ObjectPaintProperties::create();
3563 return *m_paintProperties.get(); 3564 return *m_paintProperties.get();
3564 } 3565 }
3565 3566
3567 void LayoutObject::RarePaintData::clearLocalBorderBoxProperties() {
3568 m_localBorderBoxProperties = nullptr;
3569
3570 // The contents properties are based on the border box so we need to clear
3571 // the cached value.
3572 m_contentsProperties = nullptr;
3573 }
3574
3575 void LayoutObject::RarePaintData::setLocalBorderBoxProperties(
3576 PropertyTreeState& state) {
3577 if (!m_localBorderBoxProperties)
3578 m_localBorderBoxProperties = WTF::makeUnique<PropertyTreeState>(state);
3579 else
3580 *m_localBorderBoxProperties = state;
3581
3582 // The contents properties are based on the border box so we need to clear
3583 // the cached value.
3584 m_contentsProperties = nullptr;
3585 }
3586
3587 const PropertyTreeState* LayoutObject::RarePaintData::contentsProperties()
3588 const {
3589 if (!m_contentsProperties) {
3590 if (m_localBorderBoxProperties) {
3591 m_contentsProperties = ObjectPaintProperties::contentsProperties(
3592 m_localBorderBoxProperties.get(), m_paintProperties.get());
3593 }
3594 } else {
3595 #if DCHECK_IS_ON()
3596 // Check that the cached contents properties are valid by checking that they
3597 // do not change if recalculated.
3598 DCHECK(m_localBorderBoxProperties);
3599 std::unique_ptr<PropertyTreeState> oldProperties =
3600 std::move(m_contentsProperties);
3601 m_contentsProperties = ObjectPaintProperties::contentsProperties(
3602 m_localBorderBoxProperties.get(), m_paintProperties.get());
3603 DCHECK(*m_contentsProperties == *oldProperties);
3604 #endif
3605 }
3606 return m_contentsProperties.get();
3607 }
3608
3566 LayoutObject::RarePaintData& LayoutObject::ensureRarePaintData() { 3609 LayoutObject::RarePaintData& LayoutObject::ensureRarePaintData() {
3567 if (!m_rarePaintData) 3610 if (!m_rarePaintData)
3568 m_rarePaintData = WTF::makeUnique<RarePaintData>(); 3611 m_rarePaintData = WTF::makeUnique<RarePaintData>();
3569 return *m_rarePaintData.get(); 3612 return *m_rarePaintData.get();
3570 } 3613 }
3571 3614
3572 LayoutRect LayoutObject::debugRect() const { 3615 LayoutRect LayoutObject::debugRect() const {
3573 LayoutRect rect; 3616 LayoutRect rect;
3574 LayoutBlock* block = containingBlock(); 3617 LayoutBlock* block = containingBlock();
3575 if (block) 3618 if (block)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3631 const blink::LayoutObject* root = object1; 3674 const blink::LayoutObject* root = object1;
3632 while (root->parent()) 3675 while (root->parent())
3633 root = root->parent(); 3676 root = root->parent();
3634 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3677 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3635 } else { 3678 } else {
3636 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3679 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3637 } 3680 }
3638 } 3681 }
3639 3682
3640 #endif 3683 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698