Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 3447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3545 isBackgroundAttachmentFixedObject) | 3546 isBackgroundAttachmentFixedObject) |
| 3546 return; | 3547 return; |
| 3547 m_bitfields.setIsBackgroundAttachmentFixedObject( | 3548 m_bitfields.setIsBackgroundAttachmentFixedObject( |
| 3548 isBackgroundAttachmentFixedObject); | 3549 isBackgroundAttachmentFixedObject); |
| 3549 if (isBackgroundAttachmentFixedObject) | 3550 if (isBackgroundAttachmentFixedObject) |
| 3550 frameView()->addBackgroundAttachmentFixedObject(this); | 3551 frameView()->addBackgroundAttachmentFixedObject(this); |
| 3551 else | 3552 else |
| 3552 frameView()->removeBackgroundAttachmentFixedObject(this); | 3553 frameView()->removeBackgroundAttachmentFixedObject(this); |
| 3553 } | 3554 } |
| 3554 | 3555 |
| 3555 LayoutObject::RarePaintData::RarePaintData() : m_paintProperties(nullptr) {} | 3556 LayoutObject::RarePaintData::RarePaintData() |
| 3557 : m_paintProperties(nullptr), | |
| 3558 m_localBorderBoxProperties(nullptr), | |
| 3559 m_contentsProperties(nullptr) {} | |
|
Xianzhu
2017/03/30 00:41:11
Nit: omit this to use default constructor of uniqu
| |
| 3556 | 3560 |
| 3557 LayoutObject::RarePaintData::~RarePaintData() {} | 3561 LayoutObject::RarePaintData::~RarePaintData() {} |
| 3558 | 3562 |
| 3559 ObjectPaintProperties& LayoutObject::RarePaintData::ensurePaintProperties() { | 3563 ObjectPaintProperties& LayoutObject::RarePaintData::ensurePaintProperties() { |
| 3560 if (!m_paintProperties) | 3564 if (!m_paintProperties) |
| 3561 m_paintProperties = ObjectPaintProperties::create(); | 3565 m_paintProperties = ObjectPaintProperties::create(); |
| 3562 return *m_paintProperties.get(); | 3566 return *m_paintProperties.get(); |
| 3563 } | 3567 } |
| 3564 | 3568 |
| 3569 void LayoutObject::RarePaintData::clearLocalBorderBoxProperties() { | |
| 3570 m_localBorderBoxProperties = nullptr; | |
| 3571 | |
| 3572 // The contents properties are based on the border box so we need to clear | |
| 3573 // the cached value. | |
| 3574 m_contentsProperties = nullptr; | |
| 3575 } | |
| 3576 | |
| 3577 void LayoutObject::RarePaintData::setLocalBorderBoxProperties( | |
| 3578 PropertyTreeState& state) { | |
| 3579 if (!m_localBorderBoxProperties) | |
| 3580 m_localBorderBoxProperties = WTF::makeUnique<PropertyTreeState>(state); | |
| 3581 else | |
| 3582 *m_localBorderBoxProperties = state; | |
| 3583 | |
| 3584 // The contents properties are based on the border box so we need to clear | |
| 3585 // the cached value. | |
| 3586 m_contentsProperties = nullptr; | |
| 3587 } | |
| 3588 | |
| 3589 const PropertyTreeState* LayoutObject::RarePaintData::contentsProperties() | |
| 3590 const { | |
| 3591 if (!m_contentsProperties) { | |
| 3592 if (m_localBorderBoxProperties) { | |
| 3593 m_contentsProperties = ObjectPaintProperties::contentsProperties( | |
| 3594 m_localBorderBoxProperties.get(), m_paintProperties.get()); | |
| 3595 } | |
| 3596 } else { | |
| 3597 #if DCHECK_IS_ON() | |
| 3598 // Check that the cached contents properties are valid by checking that they | |
| 3599 // do not change if recalculated. | |
| 3600 DCHECK(m_localBorderBoxProperties); | |
| 3601 std::unique_ptr<PropertyTreeState> oldProperties = | |
| 3602 std::move(m_contentsProperties); | |
| 3603 m_contentsProperties = ObjectPaintProperties::contentsProperties( | |
| 3604 m_localBorderBoxProperties.get(), m_paintProperties.get()); | |
| 3605 DCHECK(*m_contentsProperties == *oldProperties); | |
| 3606 #endif | |
| 3607 } | |
| 3608 return m_contentsProperties.get(); | |
| 3609 } | |
| 3610 | |
| 3565 LayoutObject::RarePaintData& LayoutObject::ensureRarePaintData() { | 3611 LayoutObject::RarePaintData& LayoutObject::ensureRarePaintData() { |
| 3566 if (!m_rarePaintData) | 3612 if (!m_rarePaintData) |
| 3567 m_rarePaintData = WTF::makeUnique<RarePaintData>(); | 3613 m_rarePaintData = WTF::makeUnique<RarePaintData>(); |
| 3568 return *m_rarePaintData.get(); | 3614 return *m_rarePaintData.get(); |
| 3569 } | 3615 } |
| 3570 | 3616 |
| 3571 LayoutRect LayoutObject::debugRect() const { | 3617 LayoutRect LayoutObject::debugRect() const { |
| 3572 LayoutRect rect; | 3618 LayoutRect rect; |
| 3573 LayoutBlock* block = containingBlock(); | 3619 LayoutBlock* block = containingBlock(); |
| 3574 if (block) | 3620 if (block) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3630 const blink::LayoutObject* root = object1; | 3676 const blink::LayoutObject* root = object1; |
| 3631 while (root->parent()) | 3677 while (root->parent()) |
| 3632 root = root->parent(); | 3678 root = root->parent(); |
| 3633 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3679 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3634 } else { | 3680 } else { |
| 3635 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3681 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
| 3636 } | 3682 } |
| 3637 } | 3683 } |
| 3638 | 3684 |
| 3639 #endif | 3685 #endif |
| OLD | NEW |