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 16 matching lines...) Expand all Loading... |
27 #include "core/dom/NodeRenderStyle.h" | 27 #include "core/dom/NodeRenderStyle.h" |
28 #include "core/dom/NodeRenderingContext.h" | 28 #include "core/dom/NodeRenderingContext.h" |
29 #include "core/dom/VisitedLinkState.h" | 29 #include "core/dom/VisitedLinkState.h" |
30 #include "core/page/Page.h" | 30 #include "core/page/Page.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
34 void StyleResolverState::clear() | 34 void StyleResolverState::clear() |
35 { | 35 { |
36 m_element = 0; | 36 m_element = 0; |
37 m_childIndex = 0; | |
38 m_styledElement = 0; | 37 m_styledElement = 0; |
39 m_parentStyle = 0; | 38 m_parentStyle = 0; |
40 m_parentNode = 0; | 39 m_parentNode = 0; |
41 m_regionForStyling = 0; | 40 m_regionForStyling = 0; |
42 m_elementStyleResources.clear(); | 41 m_elementStyleResources.clear(); |
43 } | 42 } |
44 | 43 |
45 void StyleResolverState::initElement(Element* element, int childIndex) | 44 void StyleResolverState::initElement(Element* element) |
46 { | 45 { |
47 if (m_element == element) | 46 if (m_element == element) |
48 return; | 47 return; |
49 | 48 |
50 m_element = element; | 49 m_element = element; |
51 m_styledElement = element && element->isStyledElement() ? element : 0; | 50 m_styledElement = element && element->isStyledElement() ? element : 0; |
52 m_elementLinkState = element ? element->document()->visitedLinkState()->dete
rmineLinkState(element) : NotInsideLink; | 51 m_elementLinkState = element ? element->document()->visitedLinkState()->dete
rmineLinkState(element) : NotInsideLink; |
53 | 52 |
54 if (!element || element != element->document()->documentElement()) | 53 if (!element || element != element->document()->documentElement()) |
55 return; | 54 return; |
56 | 55 |
57 element->document()->setDirectionSetOnDocumentElement(false); | 56 element->document()->setDirectionSetOnDocumentElement(false); |
58 element->document()->setWritingModeSetOnDocumentElement(false); | 57 element->document()->setWritingModeSetOnDocumentElement(false); |
59 } | 58 } |
60 | 59 |
61 void StyleResolverState::initForStyleResolve(Document* document, Element* e, int
childIndex, RenderStyle* parentStyle, RenderRegion* regionForStyling) | 60 void StyleResolverState::initForStyleResolve(Document* document, Element* e, Ren
derStyle* parentStyle, RenderRegion* regionForStyling) |
62 { | 61 { |
63 initElement(e, childIndex); | 62 initElement(e); |
64 | 63 |
65 m_regionForStyling = regionForStyling; | 64 m_regionForStyling = regionForStyling; |
66 | 65 |
67 if (e) { | 66 if (e) { |
68 NodeRenderingContext context(e); | 67 NodeRenderingContext context(e); |
69 m_parentNode = context.parentNodeForRenderingAndStyle(); | 68 m_parentNode = context.parentNodeForRenderingAndStyle(); |
70 m_parentStyle = context.resetStyleInheritance() ? 0 : | 69 m_parentStyle = context.resetStyleInheritance() ? 0 : |
71 parentStyle ? parentStyle : | 70 parentStyle ? parentStyle : |
72 m_parentNode ? m_parentNode->renderStyle() : 0; | 71 m_parentNode ? m_parentNode->renderStyle() : 0; |
73 m_distributedToInsertionPoint = context.insertionPoint(); | 72 m_distributedToInsertionPoint = context.insertionPoint(); |
74 } else { | 73 } else { |
75 m_parentNode = 0; | 74 m_parentNode = 0; |
76 m_parentStyle = parentStyle; | 75 m_parentStyle = parentStyle; |
77 m_distributedToInsertionPoint = false; | 76 m_distributedToInsertionPoint = false; |
78 } | 77 } |
79 | 78 |
80 Node* docElement = e ? e->document()->documentElement() : 0; | 79 Node* docElement = e ? e->document()->documentElement() : 0; |
81 RenderStyle* docStyle = document->renderStyle(); | 80 RenderStyle* docStyle = document->renderStyle(); |
82 m_rootElementStyle = docElement && e != docElement ? docElement->renderStyle
() : docStyle; | 81 m_rootElementStyle = docElement && e != docElement ? docElement->renderStyle
() : docStyle; |
83 | 82 |
84 m_style = 0; | 83 m_style = 0; |
85 m_elementStyleResources.clear(); | 84 m_elementStyleResources.clear(); |
86 m_fontDirty = false; | 85 m_fontDirty = false; |
87 | 86 |
88 if (Page* page = document->page()) | 87 if (Page* page = document->page()) |
89 m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor()); | 88 m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor()); |
90 } | 89 } |
91 | 90 |
92 } // namespace WebCore | 91 } // namespace WebCore |
OLD | NEW |