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

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

Issue 2712223002: Get rid of redundant functions updateIfNeeded() in FrameSelection and SelectionEditor (Closed)
Patch Set: 2017-02-27T11:10:27 Remove updateIfNeeded() from FrameSeleciton.h 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 firstRangeOf(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 void SelectionEditor::updateIfNeeded() {
379 // TODO(yosin): We should unify |SelectionEditor::updateIfNeeded()| and
380 // |updateCachedVisibleSelectionIfNeeded()|
381 updateCachedVisibleSelectionIfNeeded();
382 }
383
384 bool SelectionEditor::needsUpdateVisibleSelection() const { 378 bool SelectionEditor::needsUpdateVisibleSelection() const {
385 return m_cacheIsDirty || m_styleVersion != document().styleVersion(); 379 return m_cacheIsDirty || m_styleVersion != document().styleVersion();
386 } 380 }
387 381
388 void SelectionEditor::updateCachedVisibleSelectionIfNeeded() const { 382 void SelectionEditor::updateCachedVisibleSelectionIfNeeded() const {
389 // Note: Since we |FrameCaret::updateApperance()| is called from 383 // Note: Since we |FrameCaret::updateApperance()| is called from
390 // |FrameView::performPostLayoutTasks()|, we check lifecycle against 384 // |FrameView::performPostLayoutTasks()|, we check lifecycle against
391 // |AfterPerformLayout| instead of |LayoutClean|. 385 // |AfterPerformLayout| instead of |LayoutClean|.
392 DCHECK_GE(document().lifecycle().state(), 386 DCHECK_GE(document().lifecycle().state(),
393 DocumentLifecycle::AfterPerformLayout); 387 DocumentLifecycle::AfterPerformLayout);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 visitor->trace(m_frame); 419 visitor->trace(m_frame);
426 visitor->trace(m_selection); 420 visitor->trace(m_selection);
427 visitor->trace(m_cachedVisibleSelectionInDOMTree); 421 visitor->trace(m_cachedVisibleSelectionInDOMTree);
428 visitor->trace(m_cachedVisibleSelectionInFlatTree); 422 visitor->trace(m_cachedVisibleSelectionInFlatTree);
429 visitor->trace(m_logicalRange); 423 visitor->trace(m_logicalRange);
430 visitor->trace(m_cachedRange); 424 visitor->trace(m_cachedRange);
431 SynchronousMutationObserver::trace(visitor); 425 SynchronousMutationObserver::trace(visitor);
432 } 426 }
433 427
434 } // namespace blink 428 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698