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