| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 void TextFinder::updateFindMatchRects() | 489 void TextFinder::updateFindMatchRects() |
| 490 { | 490 { |
| 491 IntSize currentContentsSize = ownerFrame().contentsSize(); | 491 IntSize currentContentsSize = ownerFrame().contentsSize(); |
| 492 if (m_contentsSizeForCurrentFindMatchRects != currentContentsSize) { | 492 if (m_contentsSizeForCurrentFindMatchRects != currentContentsSize) { |
| 493 m_contentsSizeForCurrentFindMatchRects = currentContentsSize; | 493 m_contentsSizeForCurrentFindMatchRects = currentContentsSize; |
| 494 m_findMatchRectsAreValid = false; | 494 m_findMatchRectsAreValid = false; |
| 495 } | 495 } |
| 496 | 496 |
| 497 size_t deadMatches = 0; | 497 size_t deadMatches = 0; |
| 498 for (FindMatch& match : m_findMatchesCache) { | 498 for (FindMatch& match : m_findMatchesCache) { |
| 499 if (!match.m_range->boundaryPointsValid() || !match.m_range->startContai
ner()->inShadowIncludingDocument()) | 499 if (!match.m_range->boundaryPointsValid() || !match.m_range->startContai
ner()->isConnected()) |
| 500 match.m_rect = FloatRect(); | 500 match.m_rect = FloatRect(); |
| 501 else if (!m_findMatchRectsAreValid) | 501 else if (!m_findMatchRectsAreValid) |
| 502 match.m_rect = findInPageRectFromRange(match.m_range.get()); | 502 match.m_rect = findInPageRectFromRange(match.m_range.get()); |
| 503 | 503 |
| 504 if (match.m_rect.isEmpty()) | 504 if (match.m_rect.isEmpty()) |
| 505 ++deadMatches; | 505 ++deadMatches; |
| 506 } | 506 } |
| 507 | 507 |
| 508 // Remove any invalid matches from the cache. | 508 // Remove any invalid matches from the cache. |
| 509 if (deadMatches) { | 509 if (deadMatches) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 *distanceSquared = nearestDistanceSquared; | 579 *distanceSquared = nearestDistanceSquared; |
| 580 | 580 |
| 581 return nearest; | 581 return nearest; |
| 582 } | 582 } |
| 583 | 583 |
| 584 int TextFinder::selectFindMatch(unsigned index, WebRect* selectionRect) | 584 int TextFinder::selectFindMatch(unsigned index, WebRect* selectionRect) |
| 585 { | 585 { |
| 586 ASSERT_WITH_SECURITY_IMPLICATION(index < m_findMatchesCache.size()); | 586 ASSERT_WITH_SECURITY_IMPLICATION(index < m_findMatchesCache.size()); |
| 587 | 587 |
| 588 Range* range = m_findMatchesCache[index].m_range; | 588 Range* range = m_findMatchesCache[index].m_range; |
| 589 if (!range->boundaryPointsValid() || !range->startContainer()->inShadowInclu
dingDocument()) | 589 if (!range->boundaryPointsValid() || !range->startContainer()->isConnected()
) |
| 590 return -1; | 590 return -1; |
| 591 | 591 |
| 592 // Check if the match is already selected. | 592 // Check if the match is already selected. |
| 593 if (!m_currentActiveMatchFrame || !m_activeMatch || !areRangesEqual(m_active
Match.get(), range)) { | 593 if (!m_currentActiveMatchFrame || !m_activeMatch || !areRangesEqual(m_active
Match.get(), range)) { |
| 594 m_activeMatchIndex = m_findMatchesCache[index].m_ordinal - 1; | 594 m_activeMatchIndex = m_findMatchesCache[index].m_ordinal - 1; |
| 595 | 595 |
| 596 // Set this frame as the active frame (the one with the active highlight
). | 596 // Set this frame as the active frame (the one with the active highlight
). |
| 597 m_currentActiveMatchFrame = true; | 597 m_currentActiveMatchFrame = true; |
| 598 ownerFrame().viewImpl()->setFocusedFrame(&ownerFrame()); | 598 ownerFrame().viewImpl()->setFocusedFrame(&ownerFrame()); |
| 599 | 599 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 DEFINE_TRACE(TextFinder) | 737 DEFINE_TRACE(TextFinder) |
| 738 { | 738 { |
| 739 visitor->trace(m_ownerFrame); | 739 visitor->trace(m_ownerFrame); |
| 740 visitor->trace(m_activeMatch); | 740 visitor->trace(m_activeMatch); |
| 741 visitor->trace(m_resumeScopingFromRange); | 741 visitor->trace(m_resumeScopingFromRange); |
| 742 visitor->trace(m_deferredScopingWork); | 742 visitor->trace(m_deferredScopingWork); |
| 743 visitor->trace(m_findMatchesCache); | 743 visitor->trace(m_findMatchesCache); |
| 744 } | 744 } |
| 745 | 745 |
| 746 } // namespace blink | 746 } // namespace blink |
| OLD | NEW |