OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 13 matching lines...) Expand all Loading... | |
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
27 * SUCH DAMAGE. | 27 * SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include "core/dom/NamedFlow.h" | 31 #include "core/dom/NamedFlow.h" |
32 | 32 |
33 #include "RuntimeEnabledFeatures.h" | 33 #include "RuntimeEnabledFeatures.h" |
34 #include "core/css/CSSRegion.h" | |
34 #include "core/dom/NamedFlowCollection.h" | 35 #include "core/dom/NamedFlowCollection.h" |
36 #include "core/dom/Range.h" | |
35 #include "core/dom/StaticNodeList.h" | 37 #include "core/dom/StaticNodeList.h" |
36 #include "core/events/ThreadLocalEventNames.h" | 38 #include "core/events/ThreadLocalEventNames.h" |
37 #include "core/events/UIEvent.h" | 39 #include "core/events/UIEvent.h" |
38 #include "core/rendering/RenderNamedFlowThread.h" | 40 #include "core/rendering/RenderNamedFlowThread.h" |
39 #include "core/rendering/RenderRegion.h" | 41 #include "core/rendering/RenderRegion.h" |
40 | 42 |
41 namespace WebCore { | 43 namespace WebCore { |
42 | 44 |
43 NamedFlow::NamedFlow(PassRefPtr<NamedFlowCollection> manager, const AtomicString & flowThreadName) | 45 NamedFlow::NamedFlow(PassRefPtr<NamedFlowCollection> manager, const AtomicString & flowThreadName) |
44 : m_flowThreadName(flowThreadName) | 46 : m_flowThreadName(flowThreadName) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 // http://dev.w3.org/csswg/css-regions/#the-region-interface | 112 // http://dev.w3.org/csswg/css-regions/#the-region-interface |
111 if (renderRegion->isPseudoElement()) | 113 if (renderRegion->isPseudoElement()) |
112 continue; | 114 continue; |
113 countNonPseudoRegions++; | 115 countNonPseudoRegions++; |
114 if (renderRegion->regionOversetState() == RegionEmpty) | 116 if (renderRegion->regionOversetState() == RegionEmpty) |
115 return countNonPseudoRegions; | 117 return countNonPseudoRegions; |
116 } | 118 } |
117 return -1; | 119 return -1; |
118 } | 120 } |
119 | 121 |
120 PassRefPtr<NodeList> NamedFlow::getRegionsByContent(Node* contentNode) | 122 Vector<RefPtr<CSSRegion>> NamedFlow::getRegionsByContent(Node* contentNode) |
121 { | 123 { |
122 Vector<RefPtr<Node> > regionNodes; | 124 Vector<RefPtr<CSSRegion>> regionObjects; |
Inactive
2013/10/25 17:51:48
C++11?
| |
123 | 125 |
124 if (!contentNode) | 126 if (!contentNode) |
125 return StaticNodeList::adopt(regionNodes); | 127 return regionObjects; |
126 | 128 |
127 if (m_flowManager->document()) | 129 if (m_flowManager->document()) |
128 m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); | 130 m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); |
129 | 131 |
130 // The renderer may be destroyed or created after the style update. | 132 // The renderer may be destroyed or created after the style update. |
131 // Because this is called from JS, where the wrapper keeps a reference to th e NamedFlow, no guard is necessary. | 133 // Because this is called from JS, where the wrapper keeps a reference to th e NamedFlow, no guard is necessary. |
132 if (!m_parentFlowThread) | 134 if (!m_parentFlowThread) |
133 return StaticNodeList::adopt(regionNodes); | 135 return regionObjects; |
134 | 136 |
135 if (inFlowThread(contentNode->renderer(), m_parentFlowThread)) { | 137 if (inFlowThread(contentNode->renderer(), m_parentFlowThread)) { |
136 const RenderRegionList& regionList = m_parentFlowThread->renderRegionLis t(); | 138 const RenderRegionList& regionList = m_parentFlowThread->renderRegionLis t(); |
137 for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) { | 139 for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) { |
138 const RenderRegion* renderRegion = *iter; | 140 const RenderRegion* renderRegion = *iter; |
139 // They will be included when we will properly support the Region in terface | 141 // They will be included when we will properly support the Region in terface |
140 // http://dev.w3.org/csswg/css-regions/#the-region-interface | 142 // http://dev.w3.org/csswg/css-regions/#the-region-interface |
141 if (renderRegion->isPseudoElement()) | 143 if (renderRegion->isPseudoElement()) |
142 continue; | 144 continue; |
143 if (m_parentFlowThread->objectInFlowRegion(contentNode->renderer(), renderRegion)) | 145 if (m_parentFlowThread->objectInFlowRegion(contentNode->renderer(), renderRegion)) |
144 regionNodes.append(renderRegion->node()); | 146 regionObjects.append(CSSRegion::create(renderRegion)); |
145 } | 147 } |
146 } | 148 } |
147 | 149 |
148 return StaticNodeList::adopt(regionNodes); | 150 return regionObjects; |
149 } | 151 } |
150 | 152 |
151 PassRefPtr<NodeList> NamedFlow::getRegions() | 153 Vector<RefPtr<CSSRegion>> NamedFlow::getRegions() |
152 { | 154 { |
153 Vector<RefPtr<Node> > regionNodes; | 155 Vector<RefPtr<CSSRegion>> regionObjects; |
154 | 156 |
155 if (m_flowManager->document()) | 157 if (m_flowManager->document()) |
156 m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); | 158 m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); |
157 | 159 |
158 // The renderer may be destroyed or created after the style update. | 160 // The renderer may be destroyed or created after the style update. |
159 // Because this is called from JS, where the wrapper keeps a reference to th e NamedFlow, no guard is necessary. | 161 // Because this is called from JS, where the wrapper keeps a reference to th e NamedFlow, no guard is necessary. |
160 if (!m_parentFlowThread) | 162 if (!m_parentFlowThread) |
161 return StaticNodeList::adopt(regionNodes); | 163 return regionObjects; |
162 | 164 |
163 const RenderRegionList& regionList = m_parentFlowThread->renderRegionList(); | 165 const RenderRegionList& regionList = m_parentFlowThread->renderRegionList(); |
164 for (RenderRegionList::const_iterator iter = regionList.begin(); iter != reg ionList.end(); ++iter) { | 166 for (RenderRegionList::const_iterator iter = regionList.begin(); iter != reg ionList.end(); ++iter) { |
165 const RenderRegion* renderRegion = *iter; | 167 const RenderRegion* renderRegion = *iter; |
166 // They will be included when we will properly support the Region interf ace | 168 // They will be included when we will properly support the Region interf ace |
167 // http://dev.w3.org/csswg/css-regions/#the-region-interface | 169 // http://dev.w3.org/csswg/css-regions/#the-region-interface |
168 if (renderRegion->isPseudoElement()) | 170 if (renderRegion->isPseudoElement()) |
169 continue; | 171 continue; |
170 regionNodes.append(renderRegion->node()); | 172 regionObjects.append(CSSRegion::create(renderRegion)); |
171 } | 173 } |
172 | 174 |
173 return StaticNodeList::adopt(regionNodes); | 175 return regionObjects; |
174 } | 176 } |
175 | 177 |
176 PassRefPtr<NodeList> NamedFlow::getContent() | 178 PassRefPtr<NodeList> NamedFlow::getContent() |
177 { | 179 { |
178 Vector<RefPtr<Node> > contentNodes; | 180 Vector<RefPtr<Node> > contentNodes; |
179 | 181 |
180 if (m_flowManager->document()) | 182 if (m_flowManager->document()) |
181 m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); | 183 m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); |
182 | 184 |
183 // The renderer may be destroyed or created after the style update. | 185 // The renderer may be destroyed or created after the style update. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 return m_flowManager->document(); | 242 return m_flowManager->document(); |
241 } | 243 } |
242 | 244 |
243 Node* NamedFlow::ownerNode() const | 245 Node* NamedFlow::ownerNode() const |
244 { | 246 { |
245 return m_flowManager->document(); | 247 return m_flowManager->document(); |
246 } | 248 } |
247 | 249 |
248 } // namespace WebCore | 250 } // namespace WebCore |
249 | 251 |
OLD | NEW |