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 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 scopeStringMatchesSoon( | 1524 scopeStringMatchesSoon( |
1525 identifier, | 1525 identifier, |
1526 searchText, | 1526 searchText, |
1527 options, | 1527 options, |
1528 false); // false=we just reset, so don't do it again. | 1528 false); // false=we just reset, so don't do it again. |
1529 return; | 1529 return; |
1530 } | 1530 } |
1531 | 1531 |
1532 RefPtr<Range> searchRange(rangeOfContents(frame()->document())); | 1532 RefPtr<Range> searchRange(rangeOfContents(frame()->document())); |
1533 | 1533 |
| 1534 Node* originalEndContainer = searchRange->endContainer(); |
| 1535 int originalEndOffset = searchRange->endOffset(); |
| 1536 |
1534 ExceptionCode ec = 0, ec2 = 0; | 1537 ExceptionCode ec = 0, ec2 = 0; |
1535 if (m_resumeScopingFromRange.get()) { | 1538 if (m_resumeScopingFromRange.get()) { |
1536 // This is a continuation of a scoping operation that timed out and didn
't | 1539 // This is a continuation of a scoping operation that timed out and didn
't |
1537 // complete last time around, so we should start from where we left off. | 1540 // complete last time around, so we should start from where we left off. |
1538 searchRange->setStart(m_resumeScopingFromRange->startContainer(), | 1541 searchRange->setStart(m_resumeScopingFromRange->startContainer(), |
1539 m_resumeScopingFromRange->startOffset(ec2) + 1, | 1542 m_resumeScopingFromRange->startOffset(ec2) + 1, |
1540 ec); | 1543 ec); |
1541 if (ec || ec2) { | 1544 if (ec || ec2) { |
1542 if (ec2) // A non-zero |ec| happens when navigating during search. | 1545 if (ec2) // A non-zero |ec| happens when navigating during search. |
1543 ASSERT_NOT_REACHED(); | 1546 ASSERT_NOT_REACHED(); |
1544 return; | 1547 return; |
1545 } | 1548 } |
1546 } | 1549 } |
1547 | 1550 |
1548 Node* originalEndContainer = searchRange->endContainer(); | |
1549 int originalEndOffset = searchRange->endOffset(); | |
1550 | |
1551 // This timeout controls how long we scope before releasing control. This | 1551 // This timeout controls how long we scope before releasing control. This |
1552 // value does not prevent us from running for longer than this, but it is | 1552 // value does not prevent us from running for longer than this, but it is |
1553 // periodically checked to see if we have exceeded our allocated time. | 1553 // periodically checked to see if we have exceeded our allocated time. |
1554 const double maxScopingDuration = 0.1; // seconds | 1554 const double maxScopingDuration = 0.1; // seconds |
1555 | 1555 |
1556 int matchCount = 0; | 1556 int matchCount = 0; |
1557 bool timedOut = false; | 1557 bool timedOut = false; |
1558 double startTime = currentTime(); | 1558 double startTime = currentTime(); |
1559 do { | 1559 do { |
1560 // Find next occurrence of the search string. | 1560 // Find next occurrence of the search string. |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2284 | 2284 |
2285 String scriptResult; | 2285 String scriptResult; |
2286 if (!result.getString(scriptResult)) | 2286 if (!result.getString(scriptResult)) |
2287 return; | 2287 return; |
2288 | 2288 |
2289 if (!m_frame->navigationScheduler()->locationChangePending()) | 2289 if (!m_frame->navigationScheduler()->locationChangePending()) |
2290 m_frame->loader()->writer()->replaceDocument(scriptResult); | 2290 m_frame->loader()->writer()->replaceDocument(scriptResult); |
2291 } | 2291 } |
2292 | 2292 |
2293 } // namespace WebKit | 2293 } // namespace WebKit |
OLD | NEW |