| Index: third_party/WebKit/Source/core/editing/SelectionAdjuster.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/SelectionAdjuster.cpp b/third_party/WebKit/Source/core/editing/SelectionAdjuster.cpp
|
| index 450fe189491bacae676770847718c5d3d8302383..4d77b449cacd339be95c2410fa4a0a6cd2836a65 100644
|
| --- a/third_party/WebKit/Source/core/editing/SelectionAdjuster.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/SelectionAdjuster.cpp
|
| @@ -153,100 +153,6 @@ Position adjustPositionForStart(const Position& currentPosition,
|
|
|
| } // namespace
|
|
|
| -// Updates |selectionInFlatTree| to match with |selection|.
|
| -void SelectionAdjuster::adjustSelectionInFlatTree(
|
| - VisibleSelectionInFlatTree* selectionInFlatTree,
|
| - const VisibleSelection& selection) {
|
| - if (selection.isNone()) {
|
| - *selectionInFlatTree = VisibleSelectionInFlatTree();
|
| - return;
|
| - }
|
| -
|
| - const PositionInFlatTree& base = toPositionInFlatTree(selection.base());
|
| - const PositionInFlatTree& extent = toPositionInFlatTree(selection.extent());
|
| - const PositionInFlatTree& position1 = toPositionInFlatTree(selection.start());
|
| - const PositionInFlatTree& position2 = toPositionInFlatTree(selection.end());
|
| - position1.anchorNode()->updateDistribution();
|
| - position2.anchorNode()->updateDistribution();
|
| - selectionInFlatTree->m_base = base;
|
| - selectionInFlatTree->m_extent = extent;
|
| - selectionInFlatTree->m_affinity = selection.m_affinity;
|
| - selectionInFlatTree->m_isDirectional = selection.m_isDirectional;
|
| - selectionInFlatTree->m_granularity = selection.m_granularity;
|
| - selectionInFlatTree->m_hasTrailingWhitespace =
|
| - selection.m_hasTrailingWhitespace;
|
| - selectionInFlatTree->m_baseIsFirst =
|
| - base.isNull() || base.compareTo(extent) <= 0;
|
| - if (position1.compareTo(position2) <= 0) {
|
| - selectionInFlatTree->m_start = position1;
|
| - selectionInFlatTree->m_end = position2;
|
| - } else {
|
| - selectionInFlatTree->m_start = position2;
|
| - selectionInFlatTree->m_end = position1;
|
| - }
|
| - selectionInFlatTree->updateSelectionType();
|
| -}
|
| -
|
| -static bool isCrossingShadowBoundaries(
|
| - const VisibleSelectionInFlatTree& selection) {
|
| - if (!selection.isRange())
|
| - return false;
|
| - TreeScope& treeScope = selection.base().anchorNode()->treeScope();
|
| - return selection.extent().anchorNode()->treeScope() != treeScope ||
|
| - selection.start().anchorNode()->treeScope() != treeScope ||
|
| - selection.end().anchorNode()->treeScope() != treeScope;
|
| -}
|
| -
|
| -// TODO(yosin): We should make |adjustSelectionInDOMTree()| to return
|
| -// |VisibleSelection| once |VisibleSelection| constructor doesn't call
|
| -// |validate()|.
|
| -void SelectionAdjuster::adjustSelectionInDOMTree(
|
| - VisibleSelection* selection,
|
| - const VisibleSelectionInFlatTree& selectionInFlatTree) {
|
| - if (selectionInFlatTree.isNone()) {
|
| - *selection = VisibleSelection();
|
| - return;
|
| - }
|
| -
|
| - const Position& base = toPositionInDOMTree(selectionInFlatTree.base());
|
| - const Position& extent = toPositionInDOMTree(selectionInFlatTree.extent());
|
| -
|
| - if (isCrossingShadowBoundaries(selectionInFlatTree)) {
|
| - DCHECK(base.document());
|
| -
|
| - // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
|
| - // needs to be audited. See http://crbug.com/590369 for more details.
|
| - // This layout update call cannot be hoisted out of the |if|, otherwise it's
|
| - // going to cause performance regression (http://crbug.com/652301).
|
| - // TODO(yosin): Implement and apply lazy visible selection validation so
|
| - // that we don't need to update layout here.
|
| - base.document()->updateStyleAndLayoutIgnorePendingStylesheets();
|
| -
|
| - *selection = createVisibleSelection(
|
| - SelectionInDOMTree::Builder().setBaseAndExtent(base, extent).build());
|
| - return;
|
| - }
|
| -
|
| - const Position& position1 = toPositionInDOMTree(selectionInFlatTree.start());
|
| - const Position& position2 = toPositionInDOMTree(selectionInFlatTree.end());
|
| - selection->m_base = base;
|
| - selection->m_extent = extent;
|
| - selection->m_affinity = selectionInFlatTree.m_affinity;
|
| - selection->m_isDirectional = selectionInFlatTree.m_isDirectional;
|
| - selection->m_granularity = selectionInFlatTree.m_granularity;
|
| - selection->m_hasTrailingWhitespace =
|
| - selectionInFlatTree.m_hasTrailingWhitespace;
|
| - selection->m_baseIsFirst = base.isNull() || base.compareTo(extent) <= 0;
|
| - if (position1.compareTo(position2) <= 0) {
|
| - selection->m_start = position1;
|
| - selection->m_end = position2;
|
| - } else {
|
| - selection->m_start = position2;
|
| - selection->m_end = position1;
|
| - }
|
| - selection->updateSelectionType();
|
| -}
|
| -
|
| void SelectionAdjuster::adjustSelectionToAvoidCrossingShadowBoundaries(
|
| VisibleSelection* selection) {
|
| // Note: |m_selectionType| isn't computed yet.
|
|
|