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

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

Issue 2068053002: Rename Blink constants generated from IDL files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 438
439 if (originalRange->startContainer()->document() != newRange->startContainer( )->document()) { 439 if (originalRange->startContainer()->document() != newRange->startContainer( )->document()) {
440 addConsoleError("The given range does not belong to the current selectio n's document."); 440 addConsoleError("The given range does not belong to the current selectio n's document.");
441 return; 441 return;
442 } 442 }
443 if (originalRange->startContainer()->treeScope() != newRange->startContainer ()->treeScope()) { 443 if (originalRange->startContainer()->treeScope() != newRange->startContainer ()->treeScope()) {
444 addConsoleError("The given range and the current selection belong to two different document fragments."); 444 addConsoleError("The given range and the current selection belong to two different document fragments.");
445 return; 445 return;
446 } 446 }
447 447
448 if (originalRange->compareBoundaryPoints(Range::START_TO_END, newRange, ASSE RT_NO_EXCEPTION) < 0 448 if (originalRange->compareBoundaryPoints(Range::kStartToEnd, newRange, ASSER T_NO_EXCEPTION) < 0
449 || newRange->compareBoundaryPoints(Range::START_TO_END, originalRange, A SSERT_NO_EXCEPTION) < 0) { 449 || newRange->compareBoundaryPoints(Range::kStartToEnd, originalRange, AS SERT_NO_EXCEPTION) < 0) {
450 addConsoleError("Discontiguous selection is not supported."); 450 addConsoleError("Discontiguous selection is not supported.");
451 return; 451 return;
452 } 452 }
453 453
454 // FIXME: "Merge the ranges if they intersect" is Blink-specific behavior; o ther browsers supporting discontiguous 454 // FIXME: "Merge the ranges if they intersect" is Blink-specific behavior; o ther browsers supporting discontiguous
455 // selection (obviously) keep each Range added and return it in getRangeAt() . But it's unclear if we can really 455 // selection (obviously) keep each Range added and return it in getRangeAt() . But it's unclear if we can really
456 // do the same, since we don't support discontiguous selection. Further disc ussions at 456 // do the same, since we don't support discontiguous selection. Further disc ussions at
457 // <https://code.google.com/p/chromium/issues/detail?id=353069>. 457 // <https://code.google.com/p/chromium/issues/detail?id=353069>.
458 458
459 Range* start = originalRange->compareBoundaryPoints(Range::START_TO_START, n ewRange, ASSERT_NO_EXCEPTION) < 0 ? originalRange : newRange; 459 Range* start = originalRange->compareBoundaryPoints(Range::kStartToStart, ne wRange, ASSERT_NO_EXCEPTION) < 0 ? originalRange : newRange;
460 Range* end = originalRange->compareBoundaryPoints(Range::END_TO_END, newRang e, ASSERT_NO_EXCEPTION) < 0 ? newRange : originalRange; 460 Range* end = originalRange->compareBoundaryPoints(Range::kEndToEnd, newRange , ASSERT_NO_EXCEPTION) < 0 ? newRange : originalRange;
461 Range* merged = Range::create(originalRange->startContainer()->document(), s tart->startContainer(), start->startOffset(), end->endContainer(), end->endOffse t()); 461 Range* merged = Range::create(originalRange->startContainer()->document(), s tart->startContainer(), start->startOffset(), end->endContainer(), end->endOffse t());
462 TextAffinity affinity = selection.selection().affinity(); 462 TextAffinity affinity = selection.selection().affinity();
463 selection.setSelectedRange(merged, affinity); 463 selection.setSelectedRange(merged, affinity);
464 } 464 }
465 465
466 void DOMSelection::deleteFromDocument() 466 void DOMSelection::deleteFromDocument()
467 { 467 {
468 if (!isAvailable()) 468 if (!isAvailable())
469 return; 469 return;
470 470
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message)); 586 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message));
587 } 587 }
588 588
589 DEFINE_TRACE(DOMSelection) 589 DEFINE_TRACE(DOMSelection)
590 { 590 {
591 visitor->trace(m_treeScope); 591 visitor->trace(m_treeScope);
592 DOMWindowProperty::trace(visitor); 592 DOMWindowProperty::trace(visitor);
593 } 593 }
594 594
595 } // namespace blink 595 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698