OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 ASSERT(contentNode && contentNode->isElementNode()); | 83 ASSERT(contentNode && contentNode->isElementNode()); |
84 ASSERT(contentNode->inNamedFlow()); | 84 ASSERT(contentNode->inNamedFlow()); |
85 ASSERT(contentNode->document() == document()); | 85 ASSERT(contentNode->document() == document()); |
86 | 86 |
87 contentNode->clearInNamedFlow(); | 87 contentNode->clearInNamedFlow(); |
88 } | 88 } |
89 | 89 |
90 m_contentNodes.clear(); | 90 m_contentNodes.clear(); |
91 } | 91 } |
92 | 92 |
93 void RenderNamedFlowThread::updateWritingMode() | |
94 { | |
95 if (m_regionList.isEmpty()) | |
mihnea
2013/07/30 15:50:44
I believe you want to add an assert here instead.
mstensho (USE GERRIT)
2013/07/31 13:09:37
If you remove the last region, this list may be em
| |
96 return; | |
97 | |
98 RenderRegion* firstRegion = m_regionList.first(); | |
99 if (style()->writingMode() != firstRegion->style()->writingMode()) { | |
100 // The first region defines the principal writing mode for the entire fl ow. | |
101 RefPtr<RenderStyle> newStyle = RenderStyle::clone(style()); | |
102 newStyle->setWritingMode(firstRegion->style()->writingMode()); | |
103 setStyle(newStyle); | |
104 } | |
105 } | |
106 | |
93 RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const | 107 RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const |
94 { | 108 { |
95 FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin(); | 109 FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin(); |
96 FlowThreadChildList::const_iterator end = m_flowThreadChildList.end(); | 110 FlowThreadChildList::const_iterator end = m_flowThreadChildList.end(); |
97 | 111 |
98 for (; it != end; ++it) { | 112 for (; it != end; ++it) { |
99 RenderObject* child = *it; | 113 RenderObject* child = *it; |
100 ASSERT(child->node()); | 114 ASSERT(child->node()); |
101 unsigned short position = node->compareDocumentPosition(child->node()); | 115 unsigned short position = node->compareDocumentPosition(child->node()); |
102 if (position & Node::DOCUMENT_POSITION_FOLLOWING) | 116 if (position & Node::DOCUMENT_POSITION_FOLLOWING) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 void RenderNamedFlowThread::addRegionToNamedFlowThread(RenderRegion* renderRegio n) | 251 void RenderNamedFlowThread::addRegionToNamedFlowThread(RenderRegion* renderRegio n) |
238 { | 252 { |
239 ASSERT(renderRegion); | 253 ASSERT(renderRegion); |
240 ASSERT(!renderRegion->isValid()); | 254 ASSERT(!renderRegion->isValid()); |
241 | 255 |
242 if (renderRegion->parentNamedFlowThread()) | 256 if (renderRegion->parentNamedFlowThread()) |
243 addDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); | 257 addDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); |
244 | 258 |
245 renderRegion->setIsValid(true); | 259 renderRegion->setIsValid(true); |
246 addRegionToList(m_regionList, renderRegion); | 260 addRegionToList(m_regionList, renderRegion); |
261 | |
262 if (m_regionList.first() == renderRegion) | |
263 updateWritingMode(); | |
247 } | 264 } |
248 | 265 |
249 void RenderNamedFlowThread::addRegionToThread(RenderRegion* renderRegion) | 266 void RenderNamedFlowThread::addRegionToThread(RenderRegion* renderRegion) |
250 { | 267 { |
251 ASSERT(renderRegion); | 268 ASSERT(renderRegion); |
252 ASSERT(!renderRegion->isValid()); | 269 ASSERT(!renderRegion->isValid()); |
253 | 270 |
254 resetMarkForDestruction(); | 271 resetMarkForDestruction(); |
255 | 272 |
256 if (renderRegion->parentNamedFlowThread() && renderRegion->parentNamedFlowTh read()->dependsOn(this)) { | 273 if (renderRegion->parentNamedFlowThread() && renderRegion->parentNamedFlowTh read()->dependsOn(this)) { |
(...skipping 19 matching lines...) Expand all Loading... | |
276 m_invalidRegionList.remove(renderRegion); | 293 m_invalidRegionList.remove(renderRegion); |
277 renderRegion->parentNamedFlowThread()->m_observerThreadsSet.remove(t his); | 294 renderRegion->parentNamedFlowThread()->m_observerThreadsSet.remove(t his); |
278 // No need to invalidate the regions rectangles. The removed region | 295 // No need to invalidate the regions rectangles. The removed region |
279 // was not taken into account. Just return here. | 296 // was not taken into account. Just return here. |
280 return; | 297 return; |
281 } | 298 } |
282 removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); | 299 removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); |
283 } | 300 } |
284 | 301 |
285 ASSERT(m_regionList.contains(renderRegion)); | 302 ASSERT(m_regionList.contains(renderRegion)); |
303 bool wasFirst = m_regionList.first() == renderRegion; | |
286 m_regionList.remove(renderRegion); | 304 m_regionList.remove(renderRegion); |
287 | 305 |
288 if (canBeDestroyed()) | 306 if (canBeDestroyed()) |
289 setMarkForDestruction(); | 307 setMarkForDestruction(); |
290 | 308 |
291 // After removing all the regions in the flow the following layout needs to dispatch the regionLayoutUpdate event | 309 // After removing all the regions in the flow the following layout needs to dispatch the regionLayoutUpdate event |
292 if (m_regionList.isEmpty()) | 310 if (m_regionList.isEmpty()) |
293 setDispatchRegionLayoutUpdateEvent(true); | 311 setDispatchRegionLayoutUpdateEvent(true); |
312 else if (wasFirst) | |
313 updateWritingMode(); | |
294 | 314 |
295 invalidateRegions(); | 315 invalidateRegions(); |
296 } | 316 } |
297 | 317 |
298 void RenderNamedFlowThread::computeOversetStateForRegions(LayoutUnit oldClientAf terEdge) | 318 void RenderNamedFlowThread::computeOversetStateForRegions(LayoutUnit oldClientAf terEdge) |
299 { | 319 { |
300 LayoutUnit height = oldClientAfterEdge; | 320 LayoutUnit height = oldClientAfterEdge; |
301 | 321 |
302 // FIXME: the visual overflow of middle region (if it is the last one to con tain any content in a render flow thread) | 322 // FIXME: the visual overflow of middle region (if it is the last one to con tain any content in a render flow thread) |
303 // might not be taken into account because the render flow thread height is greater that that regions height + its visual overflow | 323 // might not be taken into account because the render flow thread height is greater that that regions height + its visual overflow |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 lastEndNode = node; | 707 lastEndNode = node; |
688 } | 708 } |
689 } | 709 } |
690 } | 710 } |
691 if (foundStartPosition || skipOverOutsideNodes) | 711 if (foundStartPosition || skipOverOutsideNodes) |
692 rangeObjects.append(range); | 712 rangeObjects.append(range); |
693 } | 713 } |
694 } | 714 } |
695 | 715 |
696 } | 716 } |
OLD | NEW |