| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 if (isHTMLOptGroupElement(*this) || isHTMLOptionElement(this)) | 51 if (isHTMLOptGroupElement(*this) || isHTMLOptionElement(this)) |
| 52 return nonLayoutObjectComputedStyle(); | 52 return nonLayoutObjectComputedStyle(); |
| 53 if (hasRareData()) { | 53 if (hasRareData()) { |
| 54 NodeRareData* rareData = this->rareData(); | 54 NodeRareData* rareData = this->rareData(); |
| 55 DCHECK(rareData->isElementRareData()); | 55 DCHECK(rareData->isElementRareData()); |
| 56 return static_cast<ElementRareData*>(rareData)->ensureComputedStyle(); | 56 return static_cast<ElementRareData*>(rareData)->ensureComputedStyle(); |
| 57 } | 57 } |
| 58 return m_data.m_computedStyle; | 58 return m_data.m_computedStyle; |
| 59 } | 59 } |
| 60 | 60 |
| 61 inline void Node::setComputedStyle(PassRefPtr<ComputedStyle> computedStyle) |
| 62 { |
| 63 if (hasRareData()) { |
| 64 if (hasLayoutObject()) { |
| 65 m_data.m_rareData->layoutObject()->setStyleInternal(computedStyle); |
| 66 } else { |
| 67 NodeRareData* rareData = this->rareData(); |
| 68 DCHECK(rareData->isElementRareData()); |
| 69 static_cast<ElementRareData*>(rareData)->setComputedStyle(computedSt
yle); |
| 70 } |
| 71 } else { |
| 72 if (hasLayoutObject()) { |
| 73 m_data.m_layoutObject->setStyleInternal(computedStyle); |
| 74 } else { |
| 75 if (m_data.m_computedStyle) |
| 76 m_data.m_computedStyle->deref(); |
| 77 m_data.m_computedStyle = computedStyle.leakRef(); |
| 78 } |
| 79 } |
| 80 } |
| 81 |
| 61 inline const ComputedStyle* Node::parentComputedStyle() const | 82 inline const ComputedStyle* Node::parentComputedStyle() const |
| 62 { | 83 { |
| 63 if (isSlotOrActiveInsertionPoint()) | 84 if (isSlotOrActiveInsertionPoint()) |
| 64 return 0; | 85 return 0; |
| 65 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*this); | 86 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*this); |
| 66 return parent ? parent->computedStyle() : 0; | 87 return parent ? parent->computedStyle() : 0; |
| 67 } | 88 } |
| 68 | 89 |
| 69 inline const ComputedStyle& Node::computedStyleRef() const | 90 inline const ComputedStyle& Node::computedStyleRef() const |
| 70 { | 91 { |
| 71 const ComputedStyle* style = computedStyle(); | 92 const ComputedStyle* style = computedStyle(); |
| 72 DCHECK(style); | 93 DCHECK(style); |
| 73 return *style; | 94 return *style; |
| 74 } | 95 } |
| 75 | 96 |
| 76 } // namespace blink | 97 } // namespace blink |
| 77 #endif // NodeComputedStyle_h | 98 #endif // NodeComputedStyle_h |
| OLD | NEW |