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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 LayoutUnit pageLogicalBottom = pageLogicalTop + pageLogicalHeight; | 308 LayoutUnit pageLogicalBottom = pageLogicalTop + pageLogicalHeight; |
309 LayoutUnit remainingHeight = pageLogicalBottom - offset; | 309 LayoutUnit remainingHeight = pageLogicalBottom - offset; |
310 if (pageBoundaryRule == IncludePageBoundary) { | 310 if (pageBoundaryRule == IncludePageBoundary) { |
311 // If IncludePageBoundary is set, the line exactly on the top edge of a | 311 // If IncludePageBoundary is set, the line exactly on the top edge of a |
312 // region will act as being part of the previous region. | 312 // region will act as being part of the previous region. |
313 remainingHeight = intMod(remainingHeight, pageLogicalHeight); | 313 remainingHeight = intMod(remainingHeight, pageLogicalHeight); |
314 } | 314 } |
315 return remainingHeight; | 315 return remainingHeight; |
316 } | 316 } |
317 | 317 |
318 RenderRegion* RenderFlowThread::mapFromFlowToRegion(TransformState& transformSta
te) const | |
319 { | |
320 if (!hasValidRegionInfo()) | |
321 return 0; | |
322 | |
323 LayoutRect boxRect = transformState.mappedQuad().enclosingBoundingBox(); | |
324 flipForWritingMode(boxRect); | |
325 | |
326 // FIXME: We need to refactor RenderObject::absoluteQuads to be able to spli
t the quads across regions, | |
327 // for now we just take the center of the mapped enclosing box and map it to
a region. | |
328 // Note: Using the center in order to avoid rounding errors. | |
329 | |
330 LayoutPoint center = boxRect.center(); | |
331 RenderRegion* renderRegion = regionAtBlockOffset(isHorizontalWritingMode() ?
center.y() : center.x()); | |
332 if (!renderRegion) | |
333 return 0; | |
334 | |
335 LayoutRect flippedRegionRect(renderRegion->flowThreadPortionRect()); | |
336 flipForWritingMode(flippedRegionRect); | |
337 | |
338 transformState.move(renderRegion->contentBoxRect().location() - flippedRegio
nRect.location()); | |
339 | |
340 return renderRegion; | |
341 } | |
342 | |
343 RenderRegion* RenderFlowThread::firstRegion() const | 318 RenderRegion* RenderFlowThread::firstRegion() const |
344 { | 319 { |
345 if (!hasValidRegionInfo()) | 320 if (!hasValidRegionInfo()) |
346 return 0; | 321 return 0; |
347 return m_regionList.first(); | 322 return m_regionList.first(); |
348 } | 323 } |
349 | 324 |
350 RenderRegion* RenderFlowThread::lastRegion() const | 325 RenderRegion* RenderFlowThread::lastRegion() const |
351 { | 326 { |
352 if (!hasValidRegionInfo()) | 327 if (!hasValidRegionInfo()) |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 526 } |
552 | 527 |
553 void RenderFlowThread::RegionSearchAdapter::collectIfNeeded(const RegionInterval
& interval) | 528 void RenderFlowThread::RegionSearchAdapter::collectIfNeeded(const RegionInterval
& interval) |
554 { | 529 { |
555 if (m_result) | 530 if (m_result) |
556 return; | 531 return; |
557 if (interval.low() <= m_offset && interval.high() > m_offset) | 532 if (interval.low() <= m_offset && interval.high() > m_offset) |
558 m_result = interval.data(); | 533 m_result = interval.data(); |
559 } | 534 } |
560 | 535 |
561 void RenderFlowThread::mapLocalToContainer(const RenderLayerModelObject* repaint
Container, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFi
xed) const | |
562 { | |
563 if (this == repaintContainer) | |
564 return; | |
565 | |
566 if (RenderRegion* region = mapFromFlowToRegion(transformState)) { | |
567 // FIXME: The cast below is probably not the best solution, we may need
to find a better way. | |
568 static_cast<const RenderObject*>(region)->mapLocalToContainer(region->co
ntainerForRepaint(), transformState, mode, wasFixed); | |
569 } else { | |
570 // This will happen for multicol when the flow thread is empty. | |
571 RenderBlockFlow::mapLocalToContainer(repaintContainer, transformState, m
ode, wasFixed); | |
572 } | |
573 } | |
574 | |
575 CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer(RenderFlowT
hread* renderFlowThread) | 536 CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer(RenderFlowT
hread* renderFlowThread) |
576 : m_renderFlowThread(renderFlowThread) | 537 : m_renderFlowThread(renderFlowThread) |
577 , m_previousRenderFlowThread(0) | 538 , m_previousRenderFlowThread(0) |
578 { | 539 { |
579 if (!m_renderFlowThread) | 540 if (!m_renderFlowThread) |
580 return; | 541 return; |
581 RenderView* view = m_renderFlowThread->view(); | 542 RenderView* view = m_renderFlowThread->view(); |
582 m_previousRenderFlowThread = view->flowThreadController()->currentRenderFlow
Thread(); | 543 m_previousRenderFlowThread = view->flowThreadController()->currentRenderFlow
Thread(); |
583 view->flowThreadController()->setCurrentRenderFlowThread(m_renderFlowThread)
; | 544 view->flowThreadController()->setCurrentRenderFlowThread(m_renderFlowThread)
; |
584 } | 545 } |
585 | 546 |
586 CurrentRenderFlowThreadMaintainer::~CurrentRenderFlowThreadMaintainer() | 547 CurrentRenderFlowThreadMaintainer::~CurrentRenderFlowThreadMaintainer() |
587 { | 548 { |
588 if (!m_renderFlowThread) | 549 if (!m_renderFlowThread) |
589 return; | 550 return; |
590 RenderView* view = m_renderFlowThread->view(); | 551 RenderView* view = m_renderFlowThread->view(); |
591 ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFl
owThread); | 552 ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFl
owThread); |
592 view->flowThreadController()->setCurrentRenderFlowThread(m_previousRenderFlo
wThread); | 553 view->flowThreadController()->setCurrentRenderFlowThread(m_previousRenderFlo
wThread); |
593 } | 554 } |
594 | 555 |
595 | 556 |
596 } // namespace WebCore | 557 } // namespace WebCore |
OLD | NEW |