Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: third_party/WebKit/Source/core/editing/DOMSelection.cpp

Issue 2704443005: Selection API: Show a deprecation message for a quirky addRange() behavior. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 addConsoleError("Discontiguous selection is not supported."); 610 addConsoleError("Discontiguous selection is not supported.");
610 return; 611 return;
611 } 612 }
612 613
613 // FIXME: "Merge the ranges if they intersect" is Blink-specific behavior; 614 // FIXME: "Merge the ranges if they intersect" is Blink-specific behavior;
614 // other browsers supporting discontiguous selection (obviously) keep each 615 // other browsers supporting discontiguous selection (obviously) keep each
615 // Range added and return it in getRangeAt(). But it's unclear if we can 616 // Range added and return it in getRangeAt(). But it's unclear if we can
616 // really do the same, since we don't support discontiguous selection. Further 617 // really do the same, since we don't support discontiguous selection. Further
617 // discussions at 618 // discussions at
618 // <https://code.google.com/p/chromium/issues/detail?id=353069>. 619 // <https://code.google.com/p/chromium/issues/detail?id=353069>.
619 UseCounter::count(frame(), UseCounter::SelectionAddRangeIntersect); 620 Deprecation::countDeprecation(frame(),
621 UseCounter::SelectionAddRangeIntersect);
620 622
621 Range* start = originalRange->compareBoundaryPoints( 623 Range* start = originalRange->compareBoundaryPoints(
622 Range::kStartToStart, newRange, ASSERT_NO_EXCEPTION) < 0 624 Range::kStartToStart, newRange, ASSERT_NO_EXCEPTION) < 0
623 ? originalRange 625 ? originalRange
624 : newRange; 626 : newRange;
625 Range* end = originalRange->compareBoundaryPoints(Range::kEndToEnd, newRange, 627 Range* end = originalRange->compareBoundaryPoints(Range::kEndToEnd, newRange,
626 ASSERT_NO_EXCEPTION) < 0 628 ASSERT_NO_EXCEPTION) < 0
627 ? newRange 629 ? newRange
628 : originalRange; 630 : originalRange;
629 const EphemeralRange merged = 631 const EphemeralRange merged =
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 m_treeScope->document().addConsoleMessage( 791 m_treeScope->document().addConsoleMessage(
790 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); 792 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message));
791 } 793 }
792 794
793 DEFINE_TRACE(DOMSelection) { 795 DEFINE_TRACE(DOMSelection) {
794 visitor->trace(m_treeScope); 796 visitor->trace(m_treeScope);
795 ContextClient::trace(visitor); 797 ContextClient::trace(visitor);
796 } 798 }
797 799
798 } // namespace blink 800 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698