| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 newStyle->setZIndex(0); | 64 newStyle->setZIndex(0); |
| 65 newStyle->setLeft(Length(0, Fixed)); | 65 newStyle->setLeft(Length(0, Fixed)); |
| 66 newStyle->setTop(Length(0, Fixed)); | 66 newStyle->setTop(Length(0, Fixed)); |
| 67 newStyle->setWidth(Length(100, Percent)); | 67 newStyle->setWidth(Length(100, Percent)); |
| 68 newStyle->setHeight(Length(100, Percent)); | 68 newStyle->setHeight(Length(100, Percent)); |
| 69 newStyle->font().update(nullptr); | 69 newStyle->font().update(nullptr); |
| 70 | 70 |
| 71 return newStyle.release(); | 71 return newStyle.release(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void RenderFlowThread::addRegionToThread(RenderRegion* renderRegion) | |
| 75 { | |
| 76 ASSERT(renderRegion); | |
| 77 m_regionList.add(renderRegion); | |
| 78 renderRegion->setIsValid(true); | |
| 79 } | |
| 80 | |
| 81 void RenderFlowThread::removeRegionFromThread(RenderRegion* renderRegion) | 74 void RenderFlowThread::removeRegionFromThread(RenderRegion* renderRegion) |
| 82 { | 75 { |
| 83 ASSERT(renderRegion); | 76 ASSERT(renderRegion); |
| 84 m_regionList.remove(renderRegion); | 77 m_regionList.remove(renderRegion); |
| 85 } | 78 } |
| 86 | 79 |
| 87 void RenderFlowThread::invalidateRegions() | 80 void RenderFlowThread::invalidateRegions() |
| 88 { | 81 { |
| 89 if (m_regionsInvalidated) { | 82 if (m_regionsInvalidated) { |
| 90 ASSERT(selfNeedsLayout()); | 83 ASSERT(selfNeedsLayout()); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // Let each region figure out the proper enclosing flow thread. | 198 // Let each region figure out the proper enclosing flow thread. |
| 206 CurrentRenderFlowThreadDisabler disabler(view()); | 199 CurrentRenderFlowThreadDisabler disabler(view()); |
| 207 | 200 |
| 208 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m
_regionList.end(); ++iter) { | 201 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m
_regionList.end(); ++iter) { |
| 209 RenderRegion* region = *iter; | 202 RenderRegion* region = *iter; |
| 210 | 203 |
| 211 region->repaintFlowThreadContent(repaintRect); | 204 region->repaintFlowThreadContent(repaintRect); |
| 212 } | 205 } |
| 213 } | 206 } |
| 214 | 207 |
| 215 RenderRegion* RenderFlowThread::regionAtBlockOffset(LayoutUnit offset, bool exte
ndLastRegion, RegionAutoGenerationPolicy autoGenerationPolicy) | 208 RenderRegion* RenderFlowThread::regionAtBlockOffset(LayoutUnit offset) |
| 216 { | 209 { |
| 217 ASSERT(!m_regionsInvalidated); | 210 ASSERT(!m_regionsInvalidated); |
| 218 | 211 |
| 219 if (autoGenerationPolicy == AllowRegionAutoGeneration) | |
| 220 autoGenerateRegionsToBlockOffset(offset); | |
| 221 | |
| 222 if (offset <= 0) | 212 if (offset <= 0) |
| 223 return m_regionList.isEmpty() ? 0 : m_regionList.first(); | 213 return m_regionList.isEmpty() ? 0 : m_regionList.first(); |
| 224 | 214 |
| 225 RegionSearchAdapter adapter(offset); | 215 RegionSearchAdapter adapter(offset); |
| 226 m_regionIntervalTree.allOverlapsWithAdapter<RegionSearchAdapter>(adapter); | 216 m_regionIntervalTree.allOverlapsWithAdapter<RegionSearchAdapter>(adapter); |
| 227 | 217 |
| 228 // If no region was found, the offset is in the flow thread overflow. | 218 // If no region was found, the offset is in the flow thread overflow. |
| 229 // The last region will contain the offset if extendLastRegion is set or if
the last region is a set. | |
| 230 if (!adapter.result() && !m_regionList.isEmpty()) | 219 if (!adapter.result() && !m_regionList.isEmpty()) |
| 231 return m_regionList.last(); | 220 return m_regionList.last(); |
| 232 | 221 |
| 233 return adapter.result(); | 222 return adapter.result(); |
| 234 } | 223 } |
| 235 | 224 |
| 236 LayoutPoint RenderFlowThread::adjustedPositionRelativeToOffsetParent(const Rende
rBoxModelObject& boxModelObject, const LayoutPoint& startPoint) | 225 LayoutPoint RenderFlowThread::adjustedPositionRelativeToOffsetParent(const Rende
rBoxModelObject& boxModelObject, const LayoutPoint& startPoint) |
| 237 { | 226 { |
| 238 LayoutPoint referencePoint = startPoint; | 227 LayoutPoint referencePoint = startPoint; |
| 239 | 228 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 } | 300 } |
| 312 | 301 |
| 313 LayoutUnit RenderFlowThread::pageLogicalTopForOffset(LayoutUnit offset) | 302 LayoutUnit RenderFlowThread::pageLogicalTopForOffset(LayoutUnit offset) |
| 314 { | 303 { |
| 315 RenderRegion* region = regionAtBlockOffset(offset); | 304 RenderRegion* region = regionAtBlockOffset(offset); |
| 316 return region ? region->pageLogicalTopForOffset(offset) : LayoutUnit(); | 305 return region ? region->pageLogicalTopForOffset(offset) : LayoutUnit(); |
| 317 } | 306 } |
| 318 | 307 |
| 319 LayoutUnit RenderFlowThread::pageLogicalWidthForOffset(LayoutUnit offset) | 308 LayoutUnit RenderFlowThread::pageLogicalWidthForOffset(LayoutUnit offset) |
| 320 { | 309 { |
| 321 RenderRegion* region = regionAtBlockOffset(offset, true); | 310 RenderRegion* region = regionAtBlockOffset(offset); |
| 322 return region ? region->pageLogicalWidth() : contentLogicalWidth(); | 311 return region ? region->pageLogicalWidth() : contentLogicalWidth(); |
| 323 } | 312 } |
| 324 | 313 |
| 325 LayoutUnit RenderFlowThread::pageLogicalHeightForOffset(LayoutUnit offset) | 314 LayoutUnit RenderFlowThread::pageLogicalHeightForOffset(LayoutUnit offset) |
| 326 { | 315 { |
| 327 RenderRegion* region = regionAtBlockOffset(offset); | 316 RenderRegion* region = regionAtBlockOffset(offset); |
| 328 if (!region) | 317 if (!region) |
| 329 return 0; | 318 return 0; |
| 330 | 319 |
| 331 return region->pageLogicalHeight(); | 320 return region->pageLogicalHeight(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 355 return 0; | 344 return 0; |
| 356 | 345 |
| 357 LayoutRect boxRect = transformState.mappedQuad().enclosingBoundingBox(); | 346 LayoutRect boxRect = transformState.mappedQuad().enclosingBoundingBox(); |
| 358 flipForWritingMode(boxRect); | 347 flipForWritingMode(boxRect); |
| 359 | 348 |
| 360 // FIXME: We need to refactor RenderObject::absoluteQuads to be able to spli
t the quads across regions, | 349 // FIXME: We need to refactor RenderObject::absoluteQuads to be able to spli
t the quads across regions, |
| 361 // for now we just take the center of the mapped enclosing box and map it to
a region. | 350 // for now we just take the center of the mapped enclosing box and map it to
a region. |
| 362 // Note: Using the center in order to avoid rounding errors. | 351 // Note: Using the center in order to avoid rounding errors. |
| 363 | 352 |
| 364 LayoutPoint center = boxRect.center(); | 353 LayoutPoint center = boxRect.center(); |
| 365 RenderRegion* renderRegion = const_cast<RenderFlowThread*>(this)->regionAtBl
ockOffset(isHorizontalWritingMode() ? center.y() : center.x(), true, DisallowReg
ionAutoGeneration); | 354 RenderRegion* renderRegion = const_cast<RenderFlowThread*>(this)->regionAtBl
ockOffset(isHorizontalWritingMode() ? center.y() : center.x()); |
| 366 if (!renderRegion) | 355 if (!renderRegion) |
| 367 return 0; | 356 return 0; |
| 368 | 357 |
| 369 LayoutRect flippedRegionRect(renderRegion->flowThreadPortionRect()); | 358 LayoutRect flippedRegionRect(renderRegion->flowThreadPortionRect()); |
| 370 flipForWritingMode(flippedRegionRect); | 359 flipForWritingMode(flippedRegionRect); |
| 371 | 360 |
| 372 transformState.move(renderRegion->contentBoxRect().location() - flippedRegio
nRect.location()); | 361 transformState.move(renderRegion->contentBoxRect().location() - flippedRegio
nRect.location()); |
| 373 | 362 |
| 374 return renderRegion; | 363 return renderRegion; |
| 375 } | 364 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 387 return 0; | 376 return 0; |
| 388 return m_regionList.last(); | 377 return m_regionList.last(); |
| 389 } | 378 } |
| 390 | 379 |
| 391 void RenderFlowThread::setRegionRangeForBox(const RenderBox* box, LayoutUnit off
setFromLogicalTopOfFirstPage) | 380 void RenderFlowThread::setRegionRangeForBox(const RenderBox* box, LayoutUnit off
setFromLogicalTopOfFirstPage) |
| 392 { | 381 { |
| 393 if (!hasRegions()) | 382 if (!hasRegions()) |
| 394 return; | 383 return; |
| 395 | 384 |
| 396 // FIXME: Not right for differing writing-modes. | 385 // FIXME: Not right for differing writing-modes. |
| 397 RenderRegion* startRegion = regionAtBlockOffset(offsetFromLogicalTopOfFirstP
age, true); | 386 RenderRegion* startRegion = regionAtBlockOffset(offsetFromLogicalTopOfFirstP
age); |
| 398 RenderRegion* endRegion = regionAtBlockOffset(offsetFromLogicalTopOfFirstPag
e + box->logicalHeight(), true); | 387 RenderRegion* endRegion = regionAtBlockOffset(offsetFromLogicalTopOfFirstPag
e + box->logicalHeight()); |
| 399 RenderRegionRangeMap::iterator it = m_regionRangeMap.find(box); | 388 RenderRegionRangeMap::iterator it = m_regionRangeMap.find(box); |
| 400 if (it == m_regionRangeMap.end()) { | 389 if (it == m_regionRangeMap.end()) { |
| 401 m_regionRangeMap.set(box, RenderRegionRange(startRegion, endRegion)); | 390 m_regionRangeMap.set(box, RenderRegionRange(startRegion, endRegion)); |
| 402 return; | 391 return; |
| 403 } | 392 } |
| 404 | 393 |
| 405 // If nothing changed, just bail. | 394 // If nothing changed, just bail. |
| 406 RenderRegionRange& range = it->value; | 395 RenderRegionRange& range = it->value; |
| 407 if (range.startRegion() == startRegion && range.endRegion() == endRegion) | 396 if (range.startRegion() == startRegion && range.endRegion() == endRegion) |
| 408 return; | 397 return; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 { | 607 { |
| 619 if (!m_renderFlowThread) | 608 if (!m_renderFlowThread) |
| 620 return; | 609 return; |
| 621 RenderView* view = m_renderFlowThread->view(); | 610 RenderView* view = m_renderFlowThread->view(); |
| 622 ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFl
owThread); | 611 ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFl
owThread); |
| 623 view->flowThreadController()->setCurrentRenderFlowThread(m_previousRenderFlo
wThread); | 612 view->flowThreadController()->setCurrentRenderFlowThread(m_previousRenderFlo
wThread); |
| 624 } | 613 } |
| 625 | 614 |
| 626 | 615 |
| 627 } // namespace WebCore | 616 } // namespace WebCore |
| OLD | NEW |