| 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 (RenderRegion* firstRegion = m_regionList.first()) { |
| 96 if (style()->writingMode() != firstRegion->style()->writingMode()) { |
| 97 // The first region defines the principal writing mode for the entir
e flow. |
| 98 RefPtr<RenderStyle> newStyle = RenderStyle::clone(style()); |
| 99 newStyle->setWritingMode(firstRegion->style()->writingMode()); |
| 100 setStyle(newStyle); |
| 101 } |
| 102 } |
| 103 } |
| 104 |
| 93 RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const | 105 RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const |
| 94 { | 106 { |
| 95 FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin(); | 107 FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin(); |
| 96 FlowThreadChildList::const_iterator end = m_flowThreadChildList.end(); | 108 FlowThreadChildList::const_iterator end = m_flowThreadChildList.end(); |
| 97 | 109 |
| 98 for (; it != end; ++it) { | 110 for (; it != end; ++it) { |
| 99 RenderObject* child = *it; | 111 RenderObject* child = *it; |
| 100 ASSERT(child->node()); | 112 ASSERT(child->node()); |
| 101 unsigned short position = node->compareDocumentPosition(child->node()); | 113 unsigned short position = node->compareDocumentPosition(child->node()); |
| 102 if (position & Node::DOCUMENT_POSITION_FOLLOWING) | 114 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) | 249 void RenderNamedFlowThread::addRegionToNamedFlowThread(RenderRegion* renderRegio
n) |
| 238 { | 250 { |
| 239 ASSERT(renderRegion); | 251 ASSERT(renderRegion); |
| 240 ASSERT(!renderRegion->isValid()); | 252 ASSERT(!renderRegion->isValid()); |
| 241 | 253 |
| 242 if (renderRegion->parentNamedFlowThread()) | 254 if (renderRegion->parentNamedFlowThread()) |
| 243 addDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); | 255 addDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); |
| 244 | 256 |
| 245 renderRegion->setIsValid(true); | 257 renderRegion->setIsValid(true); |
| 246 addRegionToList(m_regionList, renderRegion); | 258 addRegionToList(m_regionList, renderRegion); |
| 259 |
| 260 if (m_regionList.first() == renderRegion) |
| 261 updateWritingMode(); |
| 247 } | 262 } |
| 248 | 263 |
| 249 void RenderNamedFlowThread::addRegionToThread(RenderRegion* renderRegion) | 264 void RenderNamedFlowThread::addRegionToThread(RenderRegion* renderRegion) |
| 250 { | 265 { |
| 251 ASSERT(renderRegion); | 266 ASSERT(renderRegion); |
| 252 ASSERT(!renderRegion->isValid()); | 267 ASSERT(!renderRegion->isValid()); |
| 253 | 268 |
| 254 resetMarkForDestruction(); | 269 resetMarkForDestruction(); |
| 255 | 270 |
| 256 if (renderRegion->parentNamedFlowThread() && renderRegion->parentNamedFlowTh
read()->dependsOn(this)) { | 271 if (renderRegion->parentNamedFlowThread() && renderRegion->parentNamedFlowTh
read()->dependsOn(this)) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 276 m_invalidRegionList.remove(renderRegion); | 291 m_invalidRegionList.remove(renderRegion); |
| 277 renderRegion->parentNamedFlowThread()->m_observerThreadsSet.remove(t
his); | 292 renderRegion->parentNamedFlowThread()->m_observerThreadsSet.remove(t
his); |
| 278 // No need to invalidate the regions rectangles. The removed region | 293 // No need to invalidate the regions rectangles. The removed region |
| 279 // was not taken into account. Just return here. | 294 // was not taken into account. Just return here. |
| 280 return; | 295 return; |
| 281 } | 296 } |
| 282 removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); | 297 removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); |
| 283 } | 298 } |
| 284 | 299 |
| 285 ASSERT(m_regionList.contains(renderRegion)); | 300 ASSERT(m_regionList.contains(renderRegion)); |
| 301 bool wasFirst = m_regionList.first() == renderRegion; |
| 286 m_regionList.remove(renderRegion); | 302 m_regionList.remove(renderRegion); |
| 287 | 303 |
| 288 if (canBeDestroyed()) | 304 if (canBeDestroyed()) |
| 289 setMarkForDestruction(); | 305 setMarkForDestruction(); |
| 290 | 306 |
| 291 // After removing all the regions in the flow the following layout needs to
dispatch the regionLayoutUpdate event | 307 // After removing all the regions in the flow the following layout needs to
dispatch the regionLayoutUpdate event |
| 292 if (m_regionList.isEmpty()) | 308 if (m_regionList.isEmpty()) |
| 293 setDispatchRegionLayoutUpdateEvent(true); | 309 setDispatchRegionLayoutUpdateEvent(true); |
| 310 else if (wasFirst) |
| 311 updateWritingMode(); |
| 294 | 312 |
| 295 invalidateRegions(); | 313 invalidateRegions(); |
| 296 } | 314 } |
| 297 | 315 |
| 316 void RenderNamedFlowThread::regionChangedWritingMode(RenderRegion* region) |
| 317 { |
| 318 if (m_regionList.first() == region) |
| 319 updateWritingMode(); |
| 320 } |
| 321 |
| 298 void RenderNamedFlowThread::computeOversetStateForRegions(LayoutUnit oldClientAf
terEdge) | 322 void RenderNamedFlowThread::computeOversetStateForRegions(LayoutUnit oldClientAf
terEdge) |
| 299 { | 323 { |
| 300 LayoutUnit height = oldClientAfterEdge; | 324 LayoutUnit height = oldClientAfterEdge; |
| 301 | 325 |
| 302 // FIXME: the visual overflow of middle region (if it is the last one to con
tain any content in a render flow thread) | 326 // 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 | 327 // might not be taken into account because the render flow thread height is
greater that that regions height + its visual overflow |
| 304 // because of how computeLogicalHeight is implemented for RenderFlowThread (
as a sum of all regions height). | 328 // because of how computeLogicalHeight is implemented for RenderFlowThread (
as a sum of all regions height). |
| 305 // This means that the middle region will be marked as fit (even if it has v
isual overflow flowing into the next region) | 329 // This means that the middle region will be marked as fit (even if it has v
isual overflow flowing into the next region) |
| 306 if (hasRenderOverflow() | 330 if (hasRenderOverflow() |
| 307 && ( (isHorizontalWritingMode() && visualOverflowRect().maxY() > clientB
oxRect().maxY()) | 331 && ( (isHorizontalWritingMode() && visualOverflowRect().maxY() > clientB
oxRect().maxY()) |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 lastEndNode = node; | 711 lastEndNode = node; |
| 688 } | 712 } |
| 689 } | 713 } |
| 690 } | 714 } |
| 691 if (foundStartPosition || skipOverOutsideNodes) | 715 if (foundStartPosition || skipOverOutsideNodes) |
| 692 rangeObjects.append(range); | 716 rangeObjects.append(range); |
| 693 } | 717 } |
| 694 } | 718 } |
| 695 | 719 |
| 696 } | 720 } |
| OLD | NEW |