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

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

Issue 1867703002: DevTools: allow builds with asserions when using DevTools front-end. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 return nullptr; 376 return nullptr;
377 } 377 }
378 378
379 // If you're hitting this, you've added broken multi-range selection support 379 // If you're hitting this, you've added broken multi-range selection support
380 ASSERT(rangeCount() == 1); 380 ASSERT(rangeCount() == 1);
381 381
382 Position anchor = anchorPosition(visibleSelection()); 382 Position anchor = anchorPosition(visibleSelection());
383 if (!anchor.anchorNode()->isInShadowTree()) 383 if (!anchor.anchorNode()->isInShadowTree())
384 return m_frame->selection().firstRange(); 384 return m_frame->selection().firstRange();
385 385
386 Node* node = shadowAdjustedNode(anchor);
387 if (!node) // crbug.com/595100
yosin_UTC9 2016/04/07 01:25:39 Could you add a layout test for this case and for
388 return nullptr;
386 if (!visibleSelection().isBaseFirst()) 389 if (!visibleSelection().isBaseFirst())
387 return Range::create(*anchor.document(), focusNode(), focusOffset(), sha dowAdjustedNode(anchor), anchorOffset()); 390 return Range::create(*anchor.document(), focusNode(), focusOffset(), nod e, anchorOffset());
388 return Range::create(*anchor.document(), shadowAdjustedNode(anchor), anchorO ffset(), focusNode(), focusOffset()); 391 return Range::create(*anchor.document(), node, anchorOffset(), focusNode(), focusOffset());
389 } 392 }
390 393
391 void DOMSelection::removeAllRanges() 394 void DOMSelection::removeAllRanges()
392 { 395 {
393 if (!m_frame) 396 if (!m_frame)
394 return; 397 return;
395 m_frame->selection().clear(); 398 m_frame->selection().clear();
396 } 399 }
397 400
398 void DOMSelection::addRange(Range* newRange) 401 void DOMSelection::addRange(Range* newRange)
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message)); 569 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message));
567 } 570 }
568 571
569 DEFINE_TRACE(DOMSelection) 572 DEFINE_TRACE(DOMSelection)
570 { 573 {
571 visitor->trace(m_treeScope); 574 visitor->trace(m_treeScope);
572 DOMWindowProperty::trace(visitor); 575 DOMWindowProperty::trace(visitor);
573 } 576 }
574 577
575 } // namespace blink 578 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698