OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "sky/engine/config.h" | 26 #include "sky/engine/config.h" |
27 #include "sky/engine/core/editing/VisibleUnits.h" | 27 #include "sky/engine/core/editing/VisibleUnits.h" |
28 | 28 |
29 #include "gen/sky/platform/RuntimeEnabledFeatures.h" | 29 #include "gen/sky/platform/RuntimeEnabledFeatures.h" |
30 #include "sky/engine/bindings/core/v8/ExceptionState.h" | 30 #include "sky/engine/bindings2/exception_state.h" |
31 #include "sky/engine/bindings/core/v8/ExceptionStatePlaceholder.h" | 31 #include "sky/engine/bindings2/exception_state_placeholder.h" |
32 #include "sky/engine/core/dom/Document.h" | 32 #include "sky/engine/core/dom/Document.h" |
33 #include "sky/engine/core/dom/Element.h" | 33 #include "sky/engine/core/dom/Element.h" |
34 #include "sky/engine/core/dom/NodeTraversal.h" | 34 #include "sky/engine/core/dom/NodeTraversal.h" |
35 #include "sky/engine/core/dom/Position.h" | 35 #include "sky/engine/core/dom/Position.h" |
36 #include "sky/engine/core/dom/Text.h" | 36 #include "sky/engine/core/dom/Text.h" |
37 #include "sky/engine/core/editing/RenderedPosition.h" | 37 #include "sky/engine/core/editing/RenderedPosition.h" |
38 #include "sky/engine/core/editing/TextIterator.h" | 38 #include "sky/engine/core/editing/TextIterator.h" |
39 #include "sky/engine/core/editing/VisiblePosition.h" | 39 #include "sky/engine/core/editing/VisiblePosition.h" |
40 #include "sky/engine/core/editing/htmlediting.h" | 40 #include "sky/engine/core/editing/htmlediting.h" |
41 #include "sky/engine/core/rendering/InlineTextBox.h" | 41 #include "sky/engine/core/rendering/InlineTextBox.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 suffixLength += i; | 472 suffixLength += i; |
473 if (static_cast<unsigned>(i) < characters.size()) | 473 if (static_cast<unsigned>(i) < characters.size()) |
474 break; | 474 break; |
475 forwardsIterator.advance(); | 475 forwardsIterator.advance(); |
476 } | 476 } |
477 } | 477 } |
478 | 478 |
479 searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(
), exceptionState); | 479 searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(
), exceptionState); |
480 searchRange->setEnd(end.deprecatedNode(), end.deprecatedEditingOffset(), exc
eptionState); | 480 searchRange->setEnd(end.deprecatedNode(), end.deprecatedEditingOffset(), exc
eptionState); |
481 | 481 |
482 ASSERT(!exceptionState.hadException()); | 482 ASSERT(!exceptionState.had_exception()); |
483 if (exceptionState.hadException()) | 483 if (exceptionState.had_exception()) |
484 return VisiblePosition(); | 484 return VisiblePosition(); |
485 | 485 |
486 SimplifiedBackwardsTextIterator it(searchRange.get()); | 486 SimplifiedBackwardsTextIterator it(searchRange.get()); |
487 unsigned next = 0; | 487 unsigned next = 0; |
488 bool needMoreContext = false; | 488 bool needMoreContext = false; |
489 while (!it.atEnd()) { | 489 while (!it.atEnd()) { |
490 it.prependTextTo(string); | 490 it.prependTextTo(string); |
491 next = searchFunction(string.data(), string.size(), string.size() - suff
ixLength, MayHaveMoreContext, needMoreContext); | 491 next = searchFunction(string.data(), string.size(), string.size() - suff
ixLength, MayHaveMoreContext, needMoreContext); |
492 if (next) | 492 if (next) |
493 break; | 493 break; |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 int caretOffset; | 1370 int caretOffset; |
1371 position.position().getInlineBoxAndOffset(position.affinity(), inlineBox, ca
retOffset); | 1371 position.position().getInlineBoxAndOffset(position.affinity(), inlineBox, ca
retOffset); |
1372 | 1372 |
1373 if (inlineBox) | 1373 if (inlineBox) |
1374 renderer = &inlineBox->renderer(); | 1374 renderer = &inlineBox->renderer(); |
1375 | 1375 |
1376 return renderer->localCaretRect(inlineBox, caretOffset); | 1376 return renderer->localCaretRect(inlineBox, caretOffset); |
1377 } | 1377 } |
1378 | 1378 |
1379 } | 1379 } |
OLD | NEW |