| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 inline const ComputedStyle* Node::computedStyle() const { | 37 inline const ComputedStyle* Node::computedStyle() const { |
| 38 return mutableComputedStyle(); | 38 return mutableComputedStyle(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 inline ComputedStyle* Node::mutableComputedStyle() const { | 41 inline ComputedStyle* Node::mutableComputedStyle() const { |
| 42 if (LayoutObject* layoutObject = this->layoutObject()) | 42 if (LayoutObject* layoutObject = this->layoutObject()) |
| 43 return layoutObject->mutableStyle(); | 43 return layoutObject->mutableStyle(); |
| 44 // <option> and <optgroup> can be styled even if they don't get layout objects
, | 44 // <option> and <optgroup> can be styled even if they don't get layout |
| 45 // so they store their style internally and return it through nonLayoutObjectC
omputedStyle(). | 45 // objects, so they store their style internally and return it through |
| 46 // We check here explicitly to avoid the virtual call in the common case. | 46 // nonLayoutObjectComputedStyle(). We check here explicitly to avoid the |
| 47 // virtual call in the common case. |
| 47 if (isHTMLOptGroupElement(*this) || isHTMLOptionElement(this)) | 48 if (isHTMLOptGroupElement(*this) || isHTMLOptionElement(this)) |
| 48 return nonLayoutObjectComputedStyle(); | 49 return nonLayoutObjectComputedStyle(); |
| 49 return 0; | 50 return 0; |
| 50 } | 51 } |
| 51 | 52 |
| 52 inline const ComputedStyle* Node::parentComputedStyle() const { | 53 inline const ComputedStyle* Node::parentComputedStyle() const { |
| 53 if (isSlotOrActiveInsertionPoint()) | 54 if (isSlotOrActiveInsertionPoint()) |
| 54 return 0; | 55 return 0; |
| 55 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*this); | 56 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*this); |
| 56 return parent ? parent->computedStyle() : 0; | 57 return parent ? parent->computedStyle() : 0; |
| 57 } | 58 } |
| 58 | 59 |
| 59 inline const ComputedStyle& Node::computedStyleRef() const { | 60 inline const ComputedStyle& Node::computedStyleRef() const { |
| 60 const ComputedStyle* style = computedStyle(); | 61 const ComputedStyle* style = computedStyle(); |
| 61 DCHECK(style); | 62 DCHECK(style); |
| 62 return *style; | 63 return *style; |
| 63 } | 64 } |
| 64 | 65 |
| 65 } // namespace blink | 66 } // namespace blink |
| 66 #endif // NodeComputedStyle_h | 67 #endif // NodeComputedStyle_h |
| OLD | NEW |