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) {} | |
| 3556 | 3560 |
| 3557 ObjectPaintProperties& LayoutObject::RarePaintData::ensurePaintProperties() { | 3561 ObjectPaintProperties& LayoutObject::RarePaintData::ensurePaintProperties() { |
| 3558 if (!m_paintProperties) | 3562 if (!m_paintProperties) |
| 3559 m_paintProperties = ObjectPaintProperties::create(); | 3563 m_paintProperties = ObjectPaintProperties::create(); |
| 3560 return *m_paintProperties.get(); | 3564 return *m_paintProperties.get(); |
| 3561 } | 3565 } |
| 3562 | 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( | |
|
pdr.
2017/03/30 00:13:47
I don't like how this patch puts paint logic in La
| |
| 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 | |
| 3563 LayoutObject::RarePaintData& LayoutObject::ensureRarePaintData() { | 3609 LayoutObject::RarePaintData& LayoutObject::ensureRarePaintData() { |
| 3564 if (!m_rarePaintData) | 3610 if (!m_rarePaintData) |
| 3565 m_rarePaintData = WTF::makeUnique<RarePaintData>(); | 3611 m_rarePaintData = WTF::makeUnique<RarePaintData>(); |
| 3566 return *m_rarePaintData.get(); | 3612 return *m_rarePaintData.get(); |
| 3567 } | 3613 } |
| 3568 | 3614 |
| 3569 LayoutRect LayoutObject::debugRect() const { | 3615 LayoutRect LayoutObject::debugRect() const { |
| 3570 LayoutRect rect; | 3616 LayoutRect rect; |
| 3571 LayoutBlock* block = containingBlock(); | 3617 LayoutBlock* block = containingBlock(); |
| 3572 if (block) | 3618 if (block) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3628 const blink::LayoutObject* root = object1; | 3674 const blink::LayoutObject* root = object1; |
| 3629 while (root->parent()) | 3675 while (root->parent()) |
| 3630 root = root->parent(); | 3676 root = root->parent(); |
| 3631 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3677 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3632 } else { | 3678 } else { |
| 3633 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3679 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
| 3634 } | 3680 } |
| 3635 } | 3681 } |
| 3636 | 3682 |
| 3637 #endif | 3683 #endif |
| OLD | NEW |