Chromium Code Reviews| Index: Source/core/editing/DOMSelection.cpp |
| diff --git a/Source/core/editing/DOMSelection.cpp b/Source/core/editing/DOMSelection.cpp |
| index 25703e256911f5e5673ad5af24a39089b115e0d4..76d1e5ebbe288eda38ac7c0662bb06d468ebeaa9 100644 |
| --- a/Source/core/editing/DOMSelection.cpp |
| +++ b/Source/core/editing/DOMSelection.cpp |
| @@ -369,14 +369,13 @@ PassRefPtrWillBeRawPtr<Range> DOMSelection::getRangeAt(int index, ExceptionState |
| // If you're hitting this, you've added broken multi-range selection support |
| ASSERT(rangeCount() == 1); |
| - if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) { |
| - ASSERT(!shadowAncestor->isShadowRoot()); |
| - ContainerNode* container = shadowAncestor->parentOrShadowHostNode(); |
| - int offset = shadowAncestor->nodeIndex(); |
| - return Range::create(shadowAncestor->document(), container, offset, container, offset); |
| - } |
| + Position anchor = anchorPosition(visibleSelection()); |
| + if (!anchor.anchorNode()->isInShadowTree()) |
| + return m_frame->selection().firstRange(); |
| - return m_frame->selection().firstRange(); |
| + if (!visibleSelection().isBaseFirst()) |
| + return Range::create(*anchor.document(), focusNode(), focusOffset(), shadowAdjustedNode(anchor), anchorOffset()); |
|
Yuta Kitamura
2015/01/07 07:50:57
Does anchorOffset() work for shadowAdjustedNode(an
kojii
2015/01/07 08:20:43
Yes, this |anchorOffset()| is |DOMSelection::ancho
Yuta Kitamura
2015/01/07 08:47:54
Okay, then the PS5 looks fine to me.
I don't have
|
| + return Range::create(*anchor.document(), shadowAdjustedNode(anchor), anchorOffset(), focusNode(), focusOffset()); |
| } |
| void DOMSelection::removeAllRanges() |