OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 static bool boxIntersectsRegion(LayoutUnit logicalTopForBox, LayoutUnit logicalB
ottomForBox, LayoutUnit logicalTopForRegion, LayoutUnit logicalBottomForRegion) | 561 static bool boxIntersectsRegion(LayoutUnit logicalTopForBox, LayoutUnit logicalB
ottomForBox, LayoutUnit logicalTopForRegion, LayoutUnit logicalBottomForRegion) |
562 { | 562 { |
563 bool regionIsEmpty = logicalBottomForRegion != LayoutUnit::max() && logicalT
opForRegion != LayoutUnit::min() | 563 bool regionIsEmpty = logicalBottomForRegion != LayoutUnit::max() && logicalT
opForRegion != LayoutUnit::min() |
564 && (logicalBottomForRegion - logicalTopForRegion) <= 0; | 564 && (logicalBottomForRegion - logicalTopForRegion) <= 0; |
565 return (logicalBottomForBox - logicalTopForBox) > 0 | 565 return (logicalBottomForBox - logicalTopForBox) > 0 |
566 && !regionIsEmpty | 566 && !regionIsEmpty |
567 && logicalTopForBox < logicalBottomForRegion && logicalTopForRegion < lo
gicalBottomForBox; | 567 && logicalTopForBox < logicalBottomForRegion && logicalTopForRegion < lo
gicalBottomForBox; |
568 } | 568 } |
569 | 569 |
570 // Retrieve the next node to be visited while computing the ranges inside a regi
on. | 570 // Retrieve the next node to be visited while computing the ranges inside a regi
on. |
571 static Node* nextNodeInsideContentNode(const Node* currNode, const Node* content
Node) | 571 static Node* nextNodeInsideContentNode(const Node& currNode, const Node* content
Node) |
572 { | 572 { |
573 ASSERT(currNode); | |
574 ASSERT(contentNode && contentNode->inNamedFlow()); | 573 ASSERT(contentNode && contentNode->inNamedFlow()); |
575 | 574 |
576 if (currNode->renderer() && currNode->renderer()->isSVGRoot()) | 575 if (currNode.renderer() && currNode.renderer()->isSVGRoot()) |
577 return NodeTraversal::nextSkippingChildren(currNode, contentNode); | 576 return NodeTraversal::nextSkippingChildren(&currNode, contentNode); |
578 return NodeTraversal::next(currNode, contentNode); | 577 return NodeTraversal::next(currNode, contentNode); |
579 } | 578 } |
580 | 579 |
581 void RenderNamedFlowThread::getRanges(Vector<RefPtr<Range> >& rangeObjects, cons
t RenderRegion* region) const | 580 void RenderNamedFlowThread::getRanges(Vector<RefPtr<Range> >& rangeObjects, cons
t RenderRegion* region) const |
582 { | 581 { |
583 LayoutUnit logicalTopForRegion; | 582 LayoutUnit logicalTopForRegion; |
584 LayoutUnit logicalBottomForRegion; | 583 LayoutUnit logicalBottomForRegion; |
585 | 584 |
586 // extend the first region top to contain everything up to its logical heigh
t | 585 // extend the first region top to contain everything up to its logical heigh
t |
587 if (region->isFirstRegion()) | 586 if (region->isFirstRegion()) |
(...skipping 20 matching lines...) Expand all Loading... |
608 if (!contentNode->renderer()) | 607 if (!contentNode->renderer()) |
609 continue; | 608 continue; |
610 | 609 |
611 RefPtr<Range> range = Range::create(contentNode->document()); | 610 RefPtr<Range> range = Range::create(contentNode->document()); |
612 bool foundStartPosition = false; | 611 bool foundStartPosition = false; |
613 bool startsAboveRegion = true; | 612 bool startsAboveRegion = true; |
614 bool endsBelowRegion = true; | 613 bool endsBelowRegion = true; |
615 bool skipOverOutsideNodes = false; | 614 bool skipOverOutsideNodes = false; |
616 Node* lastEndNode = 0; | 615 Node* lastEndNode = 0; |
617 | 616 |
618 for (Node* node = contentNode; node; node = nextNodeInsideContentNode(no
de, contentNode)) { | 617 for (Node* node = contentNode; node; node = nextNodeInsideContentNode(*n
ode, contentNode)) { |
619 RenderObject* renderer = node->renderer(); | 618 RenderObject* renderer = node->renderer(); |
620 if (!renderer) | 619 if (!renderer) |
621 continue; | 620 continue; |
622 | 621 |
623 LayoutRect boundingBox; | 622 LayoutRect boundingBox; |
624 if (renderer->isRenderInline()) { | 623 if (renderer->isRenderInline()) { |
625 boundingBox = toRenderInline(renderer)->linesBoundingBox(); | 624 boundingBox = toRenderInline(renderer)->linesBoundingBox(); |
626 } else if (renderer->isText()) { | 625 } else if (renderer->isText()) { |
627 boundingBox = toRenderText(renderer)->linesBoundingBox(); | 626 boundingBox = toRenderText(renderer)->linesBoundingBox(); |
628 } else { | 627 } else { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 lastEndNode = node; | 721 lastEndNode = node; |
723 } | 722 } |
724 } | 723 } |
725 } | 724 } |
726 if (foundStartPosition || skipOverOutsideNodes) | 725 if (foundStartPosition || skipOverOutsideNodes) |
727 rangeObjects.append(range); | 726 rangeObjects.append(range); |
728 } | 727 } |
729 } | 728 } |
730 | 729 |
731 } | 730 } |
OLD | NEW |