| 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 StyleResolveScope::StyleResolveScope(StyleResolverState* state, Document* docume
nt, Element* e, RenderStyle* parentStyle, RenderRegion* regionForStyling) | 50 StyleResolveScope::StyleResolveScope(StyleResolverState* state, const Document*
document, Element* e, RenderStyle* parentStyle, RenderRegion* regionForStyling) |
| 51 : m_state(state) | 51 : m_state(state) |
| 52 { | 52 { |
| 53 m_state->initForStyleResolve(document, e, parentStyle, regionForStyling); | 53 m_state->initForStyleResolve(document, e, parentStyle, regionForStyling); |
| 54 } | 54 } |
| 55 | 55 |
| 56 StyleResolveScope::~StyleResolveScope() | 56 StyleResolveScope::~StyleResolveScope() |
| 57 { | 57 { |
| 58 m_state->clear(); | 58 m_state->clear(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void StyleResolverState::clear() | 61 void StyleResolverState::clear() |
| 62 { | 62 { |
| 63 m_elementContext = ElementResolveContext(); | 63 m_elementContext = ElementResolveContext(); |
| 64 m_style = 0; | 64 m_style = 0; |
| 65 m_parentStyle = 0; | 65 m_parentStyle = 0; |
| 66 m_regionForStyling = 0; | 66 m_regionForStyling = 0; |
| 67 m_elementStyleResources.clear(); | 67 m_elementStyleResources.clear(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void StyleResolverState::initForStyleResolve(Document* newDocument, Element* new
Element, RenderStyle* parentStyle, RenderRegion* regionForStyling) | 70 void StyleResolverState::initForStyleResolve(const Document* newDocument, Elemen
t* newElement, RenderStyle* parentStyle, RenderRegion* regionForStyling) |
| 71 { | 71 { |
| 72 ASSERT(!element() || document() == newDocument); | 72 ASSERT(!element() || document() == newDocument); |
| 73 if (newElement != element()) { | 73 if (newElement != element()) { |
| 74 if (newElement) | 74 if (newElement) |
| 75 m_elementContext = ElementResolveContext(newElement); | 75 m_elementContext = ElementResolveContext(newElement); |
| 76 else | 76 else |
| 77 m_elementContext = ElementResolveContext(); | 77 m_elementContext = ElementResolveContext(); |
| 78 | |
| 79 // FIXME: This method should not be modifying Document. | |
| 80 if (m_elementContext.isDocumentElement()) { | |
| 81 document()->setDirectionSetOnDocumentElement(false); | |
| 82 document()->setWritingModeSetOnDocumentElement(false); | |
| 83 } | |
| 84 } | 78 } |
| 85 | 79 |
| 86 m_regionForStyling = regionForStyling; | 80 m_regionForStyling = regionForStyling; |
| 87 | 81 |
| 88 if (m_elementContext.resetStyleInheritance()) | 82 if (m_elementContext.resetStyleInheritance()) |
| 89 m_parentStyle = 0; | 83 m_parentStyle = 0; |
| 90 else if (parentStyle) | 84 else if (parentStyle) |
| 91 m_parentStyle = parentStyle; | 85 m_parentStyle = parentStyle; |
| 92 else if (m_elementContext.parentNode()) | 86 else if (m_elementContext.parentNode()) |
| 93 m_parentStyle = m_elementContext.parentNode()->renderStyle(); | 87 m_parentStyle = m_elementContext.parentNode()->renderStyle(); |
| 94 else | 88 else |
| 95 m_parentStyle = 0; | 89 m_parentStyle = 0; |
| 96 | 90 |
| 97 m_style = 0; | 91 m_style = 0; |
| 98 m_elementStyleResources.clear(); | 92 m_elementStyleResources.clear(); |
| 99 m_fontDirty = false; | 93 m_fontDirty = false; |
| 100 | 94 |
| 101 // FIXME: StyleResolverState is never passed between documents | 95 // FIXME: StyleResolverState is never passed between documents |
| 102 // so we should be able to do this initialization at StyleResolverState | 96 // so we should be able to do this initialization at StyleResolverState |
| 103 // createion time instead of now, correct? | 97 // createion time instead of now, correct? |
| 104 if (Page* page = newDocument->page()) | 98 if (Page* page = newDocument->page()) |
| 105 m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor()); | 99 m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor()); |
| 106 } | 100 } |
| 107 | 101 |
| 108 } // namespace WebCore | 102 } // namespace WebCore |
| OLD | NEW |