| Index: third_party/WebKit/Source/core/editing/SelectionController.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp
|
| index 2879cc9efe038d8f372021a6157f19adf7061d17..af883d256930717a633a6df5fa29b9344fc72f3d 100644
|
| --- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
|
| @@ -1051,12 +1051,25 @@ bool SelectionController::mouseDownWasSingleClickInSelection() const {
|
| }
|
|
|
| void SelectionController::notifySelectionChanged() {
|
| - if (selection().getSelectionType() == SelectionType::RangeSelection)
|
| - m_selectionState = SelectionState::ExtendedSelection;
|
| - else if (selection().getSelectionType() == SelectionType::CaretSelection)
|
| - m_selectionState = SelectionState::PlacedCaret;
|
| - else
|
| - m_selectionState = SelectionState::HaveNotStartedSelection;
|
| + // To avoid regression on speedometer benchmark[1] test, we should not
|
| + // update layout tree in this code block.
|
| + // [1] http://browserbench.org/Speedometer/
|
| + DocumentLifecycle::DisallowTransitionScope disallowTransition(
|
| + m_frame->document()->lifecycle());
|
| +
|
| + const SelectionInDOMTree& selection = this->selection().selectionInDOMTree();
|
| + switch (selection.computeSelectionTypeConsideringGranularity()) {
|
| + case NoSelection:
|
| + m_selectionState = SelectionState::HaveNotStartedSelection;
|
| + return;
|
| + case CaretSelection:
|
| + m_selectionState = SelectionState::PlacedCaret;
|
| + return;
|
| + case RangeSelection:
|
| + m_selectionState = SelectionState::ExtendedSelection;
|
| + return;
|
| + }
|
| + NOTREACHED() << "We should handle all SelectionType" << selection;
|
| }
|
|
|
| FrameSelection& SelectionController::selection() const {
|
|
|