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 21 matching lines...) Expand all Loading... |
32 #include "core/html/HTMLOptGroupElement.h" | 32 #include "core/html/HTMLOptGroupElement.h" |
33 #include "core/layout/LayoutObject.h" | 33 #include "core/layout/LayoutObject.h" |
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 (needsReattachLayoutTree()) |
| 43 return document().getStyleReattachData(*this).computedStyle.get(); |
| 44 |
42 if (LayoutObject* layoutObject = this->layoutObject()) | 45 if (LayoutObject* layoutObject = this->layoutObject()) |
43 return layoutObject->mutableStyle(); | 46 return layoutObject->mutableStyle(); |
44 | 47 |
45 if (isElementNode()) | 48 if (isElementNode()) |
46 return toElement(this)->mutableNonLayoutObjectComputedStyle(); | 49 return toElement(this)->mutableNonLayoutObjectComputedStyle(); |
47 | 50 |
48 return 0; | 51 return 0; |
49 } | 52 } |
50 | 53 |
51 inline const ComputedStyle* Node::parentComputedStyle() const { | 54 inline const ComputedStyle* Node::parentComputedStyle() const { |
52 if (isActiveSlotOrActiveInsertionPoint()) | 55 if (isActiveSlotOrActiveInsertionPoint()) |
53 return 0; | 56 return 0; |
54 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*this); | 57 ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*this); |
55 return parent ? parent->computedStyle() : 0; | 58 return parent ? parent->computedStyle() : 0; |
56 } | 59 } |
57 | 60 |
58 inline const ComputedStyle& Node::computedStyleRef() const { | 61 inline const ComputedStyle& Node::computedStyleRef() const { |
59 const ComputedStyle* style = computedStyle(); | 62 const ComputedStyle* style = computedStyle(); |
60 DCHECK(style); | 63 DCHECK(style); |
61 return *style; | 64 return *style; |
62 } | 65 } |
63 | 66 |
64 } // namespace blink | 67 } // namespace blink |
65 #endif // NodeComputedStyle_h | 68 #endif // NodeComputedStyle_h |
OLD | NEW |