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