| 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 // parameter that does not require clean layout, so that modifying selection | 610 // parameter that does not require clean layout, so that modifying selection |
| 611 // no longer performs synchronous layout by itself. | 611 // no longer performs synchronous layout by itself. |
| 612 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 612 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 613 | 613 |
| 614 if (rangeCount() == 0) { | 614 if (rangeCount() == 0) { |
| 615 selection.setSelectedRange(EphemeralRange(newRange), VP_DEFAULT_AFFINITY); | 615 selection.setSelectedRange(EphemeralRange(newRange), VP_DEFAULT_AFFINITY); |
| 616 cacheRangeIfSelectionOfDocument(newRange); | 616 cacheRangeIfSelectionOfDocument(newRange); |
| 617 return; | 617 return; |
| 618 } | 618 } |
| 619 | 619 |
| 620 Range* originalRange = selection.firstRange(); | 620 Range* originalRange = primaryRangeOrNull(); |
| 621 DCHECK(originalRange); |
| 621 | 622 |
| 622 if (originalRange->startContainer()->treeScope() != | 623 if (originalRange->startContainer()->treeScope() != |
| 623 newRange->startContainer()->treeScope()) { | 624 newRange->startContainer()->treeScope()) { |
| 624 return; | 625 return; |
| 625 } | 626 } |
| 626 | 627 |
| 627 if (originalRange->compareBoundaryPoints(Range::kStartToEnd, newRange, | 628 if (originalRange->compareBoundaryPoints(Range::kStartToEnd, newRange, |
| 628 ASSERT_NO_EXCEPTION) < 0 || | 629 ASSERT_NO_EXCEPTION) < 0 || |
| 629 newRange->compareBoundaryPoints(Range::kStartToEnd, originalRange, | 630 newRange->compareBoundaryPoints(Range::kStartToEnd, originalRange, |
| 630 ASSERT_NO_EXCEPTION) < 0) { | 631 ASSERT_NO_EXCEPTION) < 0) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 m_treeScope->document().addConsoleMessage( | 814 m_treeScope->document().addConsoleMessage( |
| 814 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); | 815 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); |
| 815 } | 816 } |
| 816 | 817 |
| 817 DEFINE_TRACE(DOMSelection) { | 818 DEFINE_TRACE(DOMSelection) { |
| 818 visitor->trace(m_treeScope); | 819 visitor->trace(m_treeScope); |
| 819 ContextClient::trace(visitor); | 820 ContextClient::trace(visitor); |
| 820 } | 821 } |
| 821 | 822 |
| 822 } // namespace blink | 823 } // namespace blink |
| OLD | NEW |