Search for the leftmost text that overlaps vertically and is to the right of the given box, but within the given right limit.
| 818 | // Search for the leftmost text that overlaps vertically and is to the right |
| 819 | // of the given box, but within the given right limit. |
| 820 | static int ExpandImageRight(const TBOX& box, int right_limit, |
| 821 | ColPartitionGrid* part_grid) { |
| 822 | ColPartitionGridSearch search(part_grid); |
| 823 | ColPartition* part; |
| 824 | // Search left to right for any text that overlaps. |
| 825 | search.StartSideSearch(box.right(), box.bottom(), box.top()); |
| 826 | while ((part = search.NextSideSearch(false)) != NULL) { |
| 827 | if (part->flow() == BTFT_STRONG_CHAIN || part->flow() == BTFT_CHAIN) { |
| 828 | const TBOX& part_box(part->bounding_box()); |
| 829 | if (part_box.y_gap(box) < 0) { |
| 830 | if (part_box.left() < right_limit && part_box.left() > box.right()) |
| 831 | right_limit = part_box.left(); |
| 832 | break; |
| 833 | } |
| 834 | } |
| 835 | } |
| 836 | if (part != NULL) { |
| 837 | // Search for the nearest text up to the one we already found. |
| 838 | TBOX search_box(box.left(), box.bottom(), right_limit, box.top()); |
| 839 | search.StartRectSearch(search_box); |
| 840 | while ((part = search.NextRectSearch()) != NULL) { |
| 841 | if (part->flow() == BTFT_STRONG_CHAIN || part->flow() == BTFT_CHAIN) { |
| 842 | const TBOX& part_box(part->bounding_box()); |
| 843 | if (part_box.y_gap(box) < 0) { |
| 844 | if (part_box.left() < right_limit && part_box.left() > box.right()) |
| 845 | right_limit = part_box.left(); |
| 846 | } |
| 847 | } |
| 848 | } |
| 849 | } |
| 850 | return right_limit; |
| 851 | } |
| 852 | |
| 853 | // Search for the topmost text that overlaps horizontally and is below |
| 854 | // the given box, but within the given bottom limit. |
no test coverage detected