| 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) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2008 David Smith (catfish.man@gmail.com) | 5 * (C) 2008 David Smith (catfish.man@gmail.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 return nonLayoutObjectComputedStyle(); | 52 return nonLayoutObjectComputedStyle(); |
| 53 if (hasRareData()) { | 53 if (hasRareData()) { |
| 54 NodeRareData* rareData = this->rareData(); | 54 NodeRareData* rareData = this->rareData(); |
| 55 if (!rareData->isElementRareData()) | 55 if (!rareData->isElementRareData()) |
| 56 return nullptr; | 56 return nullptr; |
| 57 return static_cast<ElementRareData*>(rareData)->computedStyle(); | 57 return static_cast<ElementRareData*>(rareData)->computedStyle(); |
| 58 } | 58 } |
| 59 return m_data.m_computedStyle; | 59 return m_data.m_computedStyle; |
| 60 } | 60 } |
| 61 | 61 |
| 62 inline void Node::setComputedStyle(PassRefPtr<ComputedStyle> computedStyle) |
| 63 { |
| 64 // Note that if the DataUnion is a LayoutObject it is the old LayoutObject w
hich will be detached in reattachLayoutTree. |
| 65 // We don't want to associated the new ComputedStyle with the old LayoutObje
ct. So we don't do anything at this stage. |
| 66 if (hasRareData()) { |
| 67 // If the DataUnion is an ElementRareData - set the ComputedStyle on tha
t ElementRareData. |
| 68 NodeRareData* rareData = this->rareData(); |
| 69 if (rareData->isElementRareData()) |
| 70 static_cast<ElementRareData*>(rareData)->setComputedStyle(computedSt
yle); |
| 71 } else { |
| 72 // If the DataUnion is a ComputedStyle - make it point to the new Comput
edStyle passed in. |
| 73 if (m_data.m_computedStyle) |
| 74 m_data.m_computedStyle->deref(); |
| 75 m_data.m_computedStyle = computedStyle.leakRef(); |
| 76 } |
| 77 } |
| 78 |
| 62 inline const ComputedStyle* Node::parentComputedStyle() const | 79 inline const ComputedStyle* Node::parentComputedStyle() const |
| 63 { | 80 { |
| 64 if (isSlotOrActiveInsertionPoint()) | 81 if (isSlotOrActiveInsertionPoint()) |
| 65 return 0; | 82 return 0; |
| 66 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*this); | 83 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*this); |
| 67 return parent ? parent->computedStyle() : 0; | 84 return parent ? parent->computedStyle() : 0; |
| 68 } | 85 } |
| 69 | 86 |
| 70 inline const ComputedStyle& Node::computedStyleRef() const | 87 inline const ComputedStyle& Node::computedStyleRef() const |
| 71 { | 88 { |
| 72 const ComputedStyle* style = computedStyle(); | 89 const ComputedStyle* style = computedStyle(); |
| 73 DCHECK(style); | 90 DCHECK(style); |
| 74 return *style; | 91 return *style; |
| 75 } | 92 } |
| 76 | 93 |
| 77 } // namespace blink | 94 } // namespace blink |
| 78 #endif // NodeComputedStyle_h | 95 #endif // NodeComputedStyle_h |
| OLD | NEW |