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

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

Issue 2724333002: Get rid of VisibleSelection::firstRangeOf() (Closed)
Patch Set: 2017-03-03T13:18:27 DCHECK(!range) => DCHECK(range) Created 3 years, 9 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) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 void SelectionEditor::setLogicalRange(Range* range) { 362 void SelectionEditor::setLogicalRange(Range* range) {
363 DCHECK_EQ(range->ownerDocument(), document()); 363 DCHECK_EQ(range->ownerDocument(), document());
364 DCHECK(!m_logicalRange) << "A logical range should be one."; 364 DCHECK(!m_logicalRange) << "A logical range should be one.";
365 m_logicalRange = range; 365 m_logicalRange = range;
366 } 366 }
367 367
368 Range* SelectionEditor::firstRange() const { 368 Range* SelectionEditor::firstRange() const {
369 if (m_logicalRange) 369 if (m_logicalRange)
370 return m_logicalRange->cloneRange(); 370 return m_logicalRange->cloneRange();
371 return firstRangeOf(computeVisibleSelectionInDOMTree()); 371 return createRange(firstEphemeralRangeOf(computeVisibleSelectionInDOMTree()));
372 } 372 }
373 373
374 bool SelectionEditor::shouldAlwaysUseDirectionalSelection() const { 374 bool SelectionEditor::shouldAlwaysUseDirectionalSelection() const {
375 return frame()->editor().behavior().shouldConsiderSelectionAsDirectional(); 375 return frame()->editor().behavior().shouldConsiderSelectionAsDirectional();
376 } 376 }
377 377
378 bool SelectionEditor::needsUpdateVisibleSelection() const { 378 bool SelectionEditor::needsUpdateVisibleSelection() const {
379 return m_cacheIsDirty || m_styleVersion != document().styleVersion(); 379 return m_cacheIsDirty || m_styleVersion != document().styleVersion();
380 } 380 }
381 381
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 visitor->trace(m_frame); 419 visitor->trace(m_frame);
420 visitor->trace(m_selection); 420 visitor->trace(m_selection);
421 visitor->trace(m_cachedVisibleSelectionInDOMTree); 421 visitor->trace(m_cachedVisibleSelectionInDOMTree);
422 visitor->trace(m_cachedVisibleSelectionInFlatTree); 422 visitor->trace(m_cachedVisibleSelectionInFlatTree);
423 visitor->trace(m_logicalRange); 423 visitor->trace(m_logicalRange);
424 visitor->trace(m_cachedRange); 424 visitor->trace(m_cachedRange);
425 SynchronousMutationObserver::trace(visitor); 425 SynchronousMutationObserver::trace(visitor);
426 } 426 }
427 427
428 } // namespace blink 428 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698