| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 void TextFinder::updateFindMatchRects() | 493 void TextFinder::updateFindMatchRects() |
| 494 { | 494 { |
| 495 IntSize currentContentsSize = ownerFrame().contentsSize(); | 495 IntSize currentContentsSize = ownerFrame().contentsSize(); |
| 496 if (m_contentsSizeForCurrentFindMatchRects != currentContentsSize) { | 496 if (m_contentsSizeForCurrentFindMatchRects != currentContentsSize) { |
| 497 m_contentsSizeForCurrentFindMatchRects = currentContentsSize; | 497 m_contentsSizeForCurrentFindMatchRects = currentContentsSize; |
| 498 m_findMatchRectsAreValid = false; | 498 m_findMatchRectsAreValid = false; |
| 499 } | 499 } |
| 500 | 500 |
| 501 size_t deadMatches = 0; | 501 size_t deadMatches = 0; |
| 502 for (FindMatch& match : m_findMatchesCache) { | 502 for (FindMatch& match : m_findMatchesCache) { |
| 503 if (!match.m_range->boundaryPointsValid() || !match.m_range->startContai
ner()->inDocument()) | 503 if (!match.m_range->boundaryPointsValid() || !match.m_range->startContai
ner()->inShadowIncludingDocument()) |
| 504 match.m_rect = FloatRect(); | 504 match.m_rect = FloatRect(); |
| 505 else if (!m_findMatchRectsAreValid) | 505 else if (!m_findMatchRectsAreValid) |
| 506 match.m_rect = findInPageRectFromRange(match.m_range.get()); | 506 match.m_rect = findInPageRectFromRange(match.m_range.get()); |
| 507 | 507 |
| 508 if (match.m_rect.isEmpty()) | 508 if (match.m_rect.isEmpty()) |
| 509 ++deadMatches; | 509 ++deadMatches; |
| 510 } | 510 } |
| 511 | 511 |
| 512 // Remove any invalid matches from the cache. | 512 // Remove any invalid matches from the cache. |
| 513 if (deadMatches) { | 513 if (deadMatches) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 } | 598 } |
| 599 } | 599 } |
| 600 return nearest; | 600 return nearest; |
| 601 } | 601 } |
| 602 | 602 |
| 603 int TextFinder::selectFindMatch(unsigned index, WebRect* selectionRect) | 603 int TextFinder::selectFindMatch(unsigned index, WebRect* selectionRect) |
| 604 { | 604 { |
| 605 ASSERT_WITH_SECURITY_IMPLICATION(index < m_findMatchesCache.size()); | 605 ASSERT_WITH_SECURITY_IMPLICATION(index < m_findMatchesCache.size()); |
| 606 | 606 |
| 607 RawPtr<Range> range = m_findMatchesCache[index].m_range; | 607 RawPtr<Range> range = m_findMatchesCache[index].m_range; |
| 608 if (!range->boundaryPointsValid() || !range->startContainer()->inDocument()) | 608 if (!range->boundaryPointsValid() || !range->startContainer()->inShadowInclu
dingDocument()) |
| 609 return -1; | 609 return -1; |
| 610 | 610 |
| 611 // Check if the match is already selected. | 611 // Check if the match is already selected. |
| 612 TextFinder& mainFrameTextFinder = ownerFrame().viewImpl()->mainFrameImpl()->
ensureTextFinder(); | 612 TextFinder& mainFrameTextFinder = ownerFrame().viewImpl()->mainFrameImpl()->
ensureTextFinder(); |
| 613 WebLocalFrameImpl* activeMatchFrame = mainFrameTextFinder.m_currentActiveMat
chFrame; | 613 WebLocalFrameImpl* activeMatchFrame = mainFrameTextFinder.m_currentActiveMat
chFrame; |
| 614 if (&ownerFrame() != activeMatchFrame || !m_activeMatch || !areRangesEqual(m
_activeMatch.get(), range.get())) { | 614 if (&ownerFrame() != activeMatchFrame || !m_activeMatch || !areRangesEqual(m
_activeMatch.get(), range.get())) { |
| 615 if (isActiveMatchFrameValid()) | 615 if (isActiveMatchFrameValid()) |
| 616 activeMatchFrame->ensureTextFinder().setMatchMarkerActive(false); | 616 activeMatchFrame->ensureTextFinder().setMatchMarkerActive(false); |
| 617 | 617 |
| 618 m_activeMatchIndexInCurrentFrame = m_findMatchesCache[index].m_ordinal -
1; | 618 m_activeMatchIndexInCurrentFrame = m_findMatchesCache[index].m_ordinal -
1; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 { | 813 { |
| 814 visitor->trace(m_ownerFrame); | 814 visitor->trace(m_ownerFrame); |
| 815 visitor->trace(m_currentActiveMatchFrame); | 815 visitor->trace(m_currentActiveMatchFrame); |
| 816 visitor->trace(m_activeMatch); | 816 visitor->trace(m_activeMatch); |
| 817 visitor->trace(m_resumeScopingFromRange); | 817 visitor->trace(m_resumeScopingFromRange); |
| 818 visitor->trace(m_deferredScopingWork); | 818 visitor->trace(m_deferredScopingWork); |
| 819 visitor->trace(m_findMatchesCache); | 819 visitor->trace(m_findMatchesCache); |
| 820 } | 820 } |
| 821 | 821 |
| 822 } // namespace blink | 822 } // namespace blink |
| OLD | NEW |