| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "bindings/core/v8/ExceptionMessages.h" | 32 #include "bindings/core/v8/ExceptionMessages.h" |
| 33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/dom/ExceptionCode.h" | 35 #include "core/dom/ExceptionCode.h" |
| 36 #include "core/dom/Node.h" | 36 #include "core/dom/Node.h" |
| 37 #include "core/dom/Range.h" | 37 #include "core/dom/Range.h" |
| 38 #include "core/dom/TreeScope.h" | 38 #include "core/dom/TreeScope.h" |
| 39 #include "core/editing/EditingUtilities.h" | 39 #include "core/editing/EditingUtilities.h" |
| 40 #include "core/editing/FrameSelection.h" | 40 #include "core/editing/FrameSelection.h" |
| 41 #include "core/editing/iterators/TextIterator.h" | 41 #include "core/editing/iterators/TextIterator.h" |
| 42 #include "core/frame/Deprecation.h" |
| 42 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
| 43 #include "core/frame/UseCounter.h" | 44 #include "core/frame/UseCounter.h" |
| 44 #include "core/inspector/ConsoleMessage.h" | 45 #include "core/inspector/ConsoleMessage.h" |
| 45 #include "wtf/text/WTFString.h" | 46 #include "wtf/text/WTFString.h" |
| 46 | 47 |
| 47 namespace blink { | 48 namespace blink { |
| 48 | 49 |
| 49 static Node* selectionShadowAncestor(LocalFrame* frame) { | 50 static Node* selectionShadowAncestor(LocalFrame* frame) { |
| 50 Node* node = frame->selection().selection().base().anchorNode(); | 51 Node* node = frame->selection().selection().base().anchorNode(); |
| 51 if (!node) | 52 if (!node) |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 addConsoleError("Discontiguous selection is not supported."); | 490 addConsoleError("Discontiguous selection is not supported."); |
| 490 return; | 491 return; |
| 491 } | 492 } |
| 492 | 493 |
| 493 // FIXME: "Merge the ranges if they intersect" is Blink-specific behavior; | 494 // FIXME: "Merge the ranges if they intersect" is Blink-specific behavior; |
| 494 // other browsers supporting discontiguous selection (obviously) keep each | 495 // other browsers supporting discontiguous selection (obviously) keep each |
| 495 // Range added and return it in getRangeAt(). But it's unclear if we can | 496 // Range added and return it in getRangeAt(). But it's unclear if we can |
| 496 // really do the same, since we don't support discontiguous selection. Further | 497 // really do the same, since we don't support discontiguous selection. Further |
| 497 // discussions at | 498 // discussions at |
| 498 // <https://code.google.com/p/chromium/issues/detail?id=353069>. | 499 // <https://code.google.com/p/chromium/issues/detail?id=353069>. |
| 499 UseCounter::count(frame(), UseCounter::SelectionAddRangeIntersect); | 500 Deprecation::countDeprecation(frame(), |
| 501 UseCounter::SelectionAddRangeIntersect); |
| 500 | 502 |
| 501 Range* start = originalRange->compareBoundaryPoints( | 503 Range* start = originalRange->compareBoundaryPoints( |
| 502 Range::kStartToStart, newRange, ASSERT_NO_EXCEPTION) < 0 | 504 Range::kStartToStart, newRange, ASSERT_NO_EXCEPTION) < 0 |
| 503 ? originalRange | 505 ? originalRange |
| 504 : newRange; | 506 : newRange; |
| 505 Range* end = originalRange->compareBoundaryPoints(Range::kEndToEnd, newRange, | 507 Range* end = originalRange->compareBoundaryPoints(Range::kEndToEnd, newRange, |
| 506 ASSERT_NO_EXCEPTION) < 0 | 508 ASSERT_NO_EXCEPTION) < 0 |
| 507 ? newRange | 509 ? newRange |
| 508 : originalRange; | 510 : originalRange; |
| 509 const EphemeralRange merged = | 511 const EphemeralRange merged = |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 m_treeScope->document().addConsoleMessage( | 668 m_treeScope->document().addConsoleMessage( |
| 667 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); | 669 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); |
| 668 } | 670 } |
| 669 | 671 |
| 670 DEFINE_TRACE(DOMSelection) { | 672 DEFINE_TRACE(DOMSelection) { |
| 671 visitor->trace(m_treeScope); | 673 visitor->trace(m_treeScope); |
| 672 ContextClient::trace(visitor); | 674 ContextClient::trace(visitor); |
| 673 } | 675 } |
| 674 | 676 |
| 675 } // namespace blink | 677 } // namespace blink |
| OLD | NEW |