OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Adobe Systems Incorporated. All Rights Reserved. | 2 * Copyright 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 202 } |
203 | 203 |
204 renderRegion->setIsValid(true); | 204 renderRegion->setIsValid(true); |
205 | 205 |
206 invalidateRegions(); | 206 invalidateRegions(); |
207 } | 207 } |
208 | 208 |
209 void RenderFlowThread::removeRegionFromThread(RenderRegion* renderRegion) | 209 void RenderFlowThread::removeRegionFromThread(RenderRegion* renderRegion) |
210 { | 210 { |
211 ASSERT(renderRegion); | 211 ASSERT(renderRegion); |
| 212 clearRenderRegionRangeMap(); |
212 m_regionList.remove(renderRegion); | 213 m_regionList.remove(renderRegion); |
| 214 |
213 if (renderRegion->parentFlowThread()) { | 215 if (renderRegion->parentFlowThread()) { |
214 if (!renderRegion->isValid()) { | 216 if (!renderRegion->isValid()) { |
215 renderRegion->parentFlowThread()->m_observerThreadsSet.remove(this); | 217 renderRegion->parentFlowThread()->m_observerThreadsSet.remove(this); |
216 // No need to invalidate the regions rectangles. The removed region | 218 // No need to invalidate the regions rectangles. The removed region |
217 // was not taken into account. Just return here. | 219 // was not taken into account. Just return here. |
218 return; | 220 return; |
219 } | 221 } |
220 removeDependencyOnFlowThread(renderRegion->parentFlowThread()); | 222 removeDependencyOnFlowThread(renderRegion->parentFlowThread()); |
221 } | 223 } |
222 | 224 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 bool RenderFlowThread::shouldRepaint(const LayoutRect& r) const | 494 bool RenderFlowThread::shouldRepaint(const LayoutRect& r) const |
493 { | 495 { |
494 if (view()->printing() || r.isEmpty()) | 496 if (view()->printing() || r.isEmpty()) |
495 return false; | 497 return false; |
496 | 498 |
497 return true; | 499 return true; |
498 } | 500 } |
499 | 501 |
500 void RenderFlowThread::repaintRectangleInRegions(const LayoutRect& repaintRect,
bool immediate) | 502 void RenderFlowThread::repaintRectangleInRegions(const LayoutRect& repaintRect,
bool immediate) |
501 { | 503 { |
502 if (!shouldRepaint(repaintRect)) | 504 if (!shouldRepaint(repaintRect) || !hasValidRegionInfo()) |
503 return; | 505 return; |
504 | 506 |
505 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regio
nList.end(); ++iter) { | 507 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regio
nList.end(); ++iter) { |
506 RenderRegion* region = *iter; | 508 RenderRegion* region = *iter; |
507 if (!region->isValid()) | 509 if (!region->isValid()) |
508 continue; | 510 continue; |
509 | 511 |
510 // We only have to issue a repaint in this region if the region rect int
ersects the repaint rect. | 512 // We only have to issue a repaint in this region if the region rect int
ersects the repaint rect. |
511 LayoutRect flippedRegionRect(region->regionRect()); | 513 LayoutRect flippedRegionRect(region->regionRect()); |
512 LayoutRect flippedRegionOverflowRect(region->regionOverflowRect()); | 514 LayoutRect flippedRegionOverflowRect(region->regionOverflowRect()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 // If IncludePageBoundary is set, the line exactly on the top edge of a | 588 // If IncludePageBoundary is set, the line exactly on the top edge of a |
587 // region will act as being part of the previous region. | 589 // region will act as being part of the previous region. |
588 LayoutUnit regionHeight = isHorizontalWritingMode() ? region->regionRect
().height() : region->regionRect().width(); | 590 LayoutUnit regionHeight = isHorizontalWritingMode() ? region->regionRect
().height() : region->regionRect().width(); |
589 remainingHeight = layoutMod(remainingHeight, regionHeight); | 591 remainingHeight = layoutMod(remainingHeight, regionHeight); |
590 } | 592 } |
591 return remainingHeight; | 593 return remainingHeight; |
592 } | 594 } |
593 | 595 |
594 RenderRegion* RenderFlowThread::mapFromFlowToRegion(TransformState& transformSta
te) const | 596 RenderRegion* RenderFlowThread::mapFromFlowToRegion(TransformState& transformSta
te) const |
595 { | 597 { |
596 if (!hasValidRegions()) | 598 if (!hasValidRegionInfo()) |
597 return 0; | 599 return 0; |
598 | 600 |
599 LayoutRect boxRect = transformState.mappedQuad().enclosingBoundingBox(); | 601 LayoutRect boxRect = transformState.mappedQuad().enclosingBoundingBox(); |
600 flipForWritingMode(boxRect); | 602 flipForWritingMode(boxRect); |
601 | 603 |
602 // FIXME: We need to refactor RenderObject::absoluteQuads to be able to spli
t the quads across regions, | 604 // FIXME: We need to refactor RenderObject::absoluteQuads to be able to spli
t the quads across regions, |
603 // for now we just take the center of the mapped enclosing box and map it to
a region. | 605 // for now we just take the center of the mapped enclosing box and map it to
a region. |
604 // Note: Using the center in order to avoid rounding errors. | 606 // Note: Using the center in order to avoid rounding errors. |
605 | 607 |
606 LayoutPoint center = boxRect.center(); | 608 LayoutPoint center = boxRect.center(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 | 669 |
668 if (region == endRegion) | 670 if (region == endRegion) |
669 break; | 671 break; |
670 } | 672 } |
671 | 673 |
672 return false; | 674 return false; |
673 } | 675 } |
674 | 676 |
675 LayoutUnit RenderFlowThread::contentLogicalWidthOfFirstRegion() const | 677 LayoutUnit RenderFlowThread::contentLogicalWidthOfFirstRegion() const |
676 { | 678 { |
677 if (!hasValidRegions()) | 679 if (!hasValidRegionInfo()) |
678 return 0; | 680 return 0; |
679 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m
_regionList.end(); ++iter) { | 681 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m
_regionList.end(); ++iter) { |
680 RenderRegion* region = *iter; | 682 RenderRegion* region = *iter; |
681 if (!region->isValid()) | 683 if (!region->isValid()) |
682 continue; | 684 continue; |
683 return isHorizontalWritingMode() ? region->contentWidth() : region->cont
entHeight(); | 685 return isHorizontalWritingMode() ? region->contentWidth() : region->cont
entHeight(); |
684 } | 686 } |
685 ASSERT_NOT_REACHED(); | 687 ASSERT_NOT_REACHED(); |
686 return 0; | 688 return 0; |
687 } | 689 } |
688 | 690 |
689 LayoutUnit RenderFlowThread::contentLogicalHeightOfFirstRegion() const | 691 LayoutUnit RenderFlowThread::contentLogicalHeightOfFirstRegion() const |
690 { | 692 { |
691 if (!hasValidRegions()) | 693 if (!hasValidRegionInfo()) |
692 return 0; | 694 return 0; |
693 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m
_regionList.end(); ++iter) { | 695 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m
_regionList.end(); ++iter) { |
694 RenderRegion* region = *iter; | 696 RenderRegion* region = *iter; |
695 if (!region->isValid()) | 697 if (!region->isValid()) |
696 continue; | 698 continue; |
697 return isHorizontalWritingMode() ? region->contentHeight() : region->con
tentWidth(); | 699 return isHorizontalWritingMode() ? region->contentHeight() : region->con
tentWidth(); |
698 } | 700 } |
699 ASSERT_NOT_REACHED(); | 701 ASSERT_NOT_REACHED(); |
700 return 0; | 702 return 0; |
701 } | 703 } |
702 | 704 |
703 LayoutUnit RenderFlowThread::contentLogicalLeftOfFirstRegion() const | 705 LayoutUnit RenderFlowThread::contentLogicalLeftOfFirstRegion() const |
704 { | 706 { |
705 if (!hasValidRegions()) | 707 if (!hasValidRegionInfo()) |
706 return 0; | 708 return 0; |
707 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m
_regionList.end(); ++iter) { | 709 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m
_regionList.end(); ++iter) { |
708 RenderRegion* region = *iter; | 710 RenderRegion* region = *iter; |
709 if (!region->isValid()) | 711 if (!region->isValid()) |
710 continue; | 712 continue; |
711 return isHorizontalWritingMode() ? region->regionRect().x() : region->re
gionRect().y(); | 713 return isHorizontalWritingMode() ? region->regionRect().x() : region->re
gionRect().y(); |
712 } | 714 } |
713 ASSERT_NOT_REACHED(); | 715 ASSERT_NOT_REACHED(); |
714 return 0; | 716 return 0; |
715 } | 717 } |
716 | 718 |
717 RenderRegion* RenderFlowThread::firstRegion() const | 719 RenderRegion* RenderFlowThread::firstRegion() const |
718 { | 720 { |
719 if (!hasValidRegions()) | 721 if (!hasValidRegionInfo()) |
720 return 0; | 722 return 0; |
721 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m
_regionList.end(); ++iter) { | 723 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m
_regionList.end(); ++iter) { |
722 RenderRegion* region = *iter; | 724 RenderRegion* region = *iter; |
723 if (!region->isValid()) | 725 if (!region->isValid()) |
724 continue; | 726 continue; |
725 return region; | 727 return region; |
726 } | 728 } |
727 return 0; | 729 return 0; |
728 } | 730 } |
729 | 731 |
730 RenderRegion* RenderFlowThread::lastRegion() const | 732 RenderRegion* RenderFlowThread::lastRegion() const |
731 { | 733 { |
732 if (!hasValidRegions()) | 734 if (!hasValidRegionInfo()) |
733 return 0; | 735 return 0; |
734 for (RenderRegionList::const_reverse_iterator iter = m_regionList.rbegin();
iter != m_regionList.rend(); ++iter) { | 736 for (RenderRegionList::const_reverse_iterator iter = m_regionList.rbegin();
iter != m_regionList.rend(); ++iter) { |
735 RenderRegion* region = *iter; | 737 RenderRegion* region = *iter; |
736 if (!region->isValid()) | 738 if (!region->isValid()) |
737 continue; | 739 continue; |
738 return region; | 740 return region; |
739 } | 741 } |
740 return 0; | 742 return 0; |
741 } | 743 } |
742 | 744 |
(...skipping 29 matching lines...) Expand all Loading... |
772 m_regionRangeMap.set(box, range); | 774 m_regionRangeMap.set(box, range); |
773 } | 775 } |
774 | 776 |
775 void RenderFlowThread::getRegionRangeForBox(const RenderBox* box, RenderRegion*&
startRegion, RenderRegion*& endRegion) const | 777 void RenderFlowThread::getRegionRangeForBox(const RenderBox* box, RenderRegion*&
startRegion, RenderRegion*& endRegion) const |
776 { | 778 { |
777 startRegion = 0; | 779 startRegion = 0; |
778 endRegion = 0; | 780 endRegion = 0; |
779 RenderRegionRange* range = m_regionRangeMap.get(box); | 781 RenderRegionRange* range = m_regionRangeMap.get(box); |
780 if (!range) | 782 if (!range) |
781 return; | 783 return; |
| 784 |
782 startRegion = range->startRegion(); | 785 startRegion = range->startRegion(); |
783 endRegion = range->endRegion(); | 786 endRegion = range->endRegion(); |
| 787 ASSERT(m_regionList.contains(startRegion) && m_regionList.contains(endRegion
)); |
784 } | 788 } |
785 | 789 |
786 } // namespace WebCore | 790 } // namespace WebCore |
OLD | NEW |