OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 29 matching lines...) Expand all Loading... |
40 NodeRenderingContext context(element); | 40 NodeRenderingContext context(element); |
41 m_parentNode = context.parentNodeForRenderingAndStyle(); | 41 m_parentNode = context.parentNodeForRenderingAndStyle(); |
42 m_distributedToInsertionPoint = context.insertionPoint(); | 42 m_distributedToInsertionPoint = context.insertionPoint(); |
43 m_resetStyleInheritance = context.resetStyleInheritance(); | 43 m_resetStyleInheritance = context.resetStyleInheritance(); |
44 | 44 |
45 Node* documentElement = document()->documentElement(); | 45 Node* documentElement = document()->documentElement(); |
46 RenderStyle* documentStyle = document()->renderStyle(); | 46 RenderStyle* documentStyle = document()->renderStyle(); |
47 m_rootElementStyle = documentElement && element != documentElement ? documen
tElement->renderStyle() : documentStyle; | 47 m_rootElementStyle = documentElement && element != documentElement ? documen
tElement->renderStyle() : documentStyle; |
48 } | 48 } |
49 | 49 |
| 50 ScopedStyleResolution::ScopedStyleResolution(StyleResolverState* state, Document
* document, Element* e, RenderStyle* parentStyle, RenderRegion* regionForStyling
) |
| 51 : m_state(state) |
| 52 { |
| 53 m_state->initForStyleResolve(document, e, parentStyle, regionForStyling); |
| 54 } |
| 55 |
| 56 ScopedStyleResolution::~ScopedStyleResolution() |
| 57 { |
| 58 m_state->clear(); |
| 59 } |
| 60 |
50 void StyleResolverState::clear() | 61 void StyleResolverState::clear() |
51 { | 62 { |
52 // FIXME: Use m_elementContent = ElementContext() instead. | 63 // FIXME: Use m_elementContent = ElementContext() instead. |
53 m_elementContext.deprecatedPartialClear(); | 64 m_elementContext.deprecatedPartialClear(); |
54 | 65 |
| 66 m_style = 0; |
55 m_parentStyle = 0; | 67 m_parentStyle = 0; |
56 m_regionForStyling = 0; | 68 m_regionForStyling = 0; |
57 m_elementStyleResources.clear(); | 69 m_elementStyleResources.clear(); |
58 } | 70 } |
59 | 71 |
60 void StyleResolverState::initForStyleResolve(Document* newDocument, Element* new
Element, RenderStyle* parentStyle, RenderRegion* regionForStyling) | 72 void StyleResolverState::initForStyleResolve(Document* newDocument, Element* new
Element, RenderStyle* parentStyle, RenderRegion* regionForStyling) |
61 { | 73 { |
62 ASSERT(!element() || document() == newDocument); | 74 ASSERT(!element() || document() == newDocument); |
63 if (newElement != element()) { | 75 if (newElement != element()) { |
64 if (newElement) | 76 if (newElement) |
(...skipping 24 matching lines...) Expand all Loading... |
89 m_fontDirty = false; | 101 m_fontDirty = false; |
90 | 102 |
91 // FIXME: StyleResolverState is never passed between documents | 103 // FIXME: StyleResolverState is never passed between documents |
92 // so we should be able to do this initialization at StyleResolverState | 104 // so we should be able to do this initialization at StyleResolverState |
93 // createion time instead of now, correct? | 105 // createion time instead of now, correct? |
94 if (Page* page = newDocument->page()) | 106 if (Page* page = newDocument->page()) |
95 m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor()); | 107 m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor()); |
96 } | 108 } |
97 | 109 |
98 } // namespace WebCore | 110 } // namespace WebCore |
OLD | NEW |