| Index: Source/core/editing/VisibleSelection.cpp
|
| diff --git a/Source/core/editing/VisibleSelection.cpp b/Source/core/editing/VisibleSelection.cpp
|
| index 09b7ab7ef2b845fbdccc2a40e1b2b558cd176c04..c5e98849878b0a206d0566ebf0f30b0f16918987 100644
|
| --- a/Source/core/editing/VisibleSelection.cpp
|
| +++ b/Source/core/editing/VisibleSelection.cpp
|
| @@ -34,6 +34,8 @@
|
| #include "core/editing/VisiblePosition.h"
|
| #include "core/editing/VisibleUnits.h"
|
| #include "core/editing/htmlediting.h"
|
| +#include "core/platform/graphics/LayoutPoint.h"
|
| +#include "core/rendering/RenderObject.h"
|
| #include <wtf/Assertions.h>
|
| #include <wtf/text/CString.h>
|
| #include <wtf/text/StringBuilder.h>
|
| @@ -624,6 +626,27 @@ void VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries()
|
| m_extent = m_baseIsFirst ? m_end : m_start;
|
| }
|
|
|
| +VisiblePosition VisibleSelection::visiblePositionRespectingEditingBoundary(const LayoutPoint& localPoint, Node* targetNode) const
|
| +{
|
| + if (!targetNode->renderer())
|
| + return VisiblePosition();
|
| +
|
| + LayoutPoint selectionEndPoint = localPoint;
|
| + Element* editableElement = rootEditableElement();
|
| +
|
| + if (editableElement && !editableElement->contains(targetNode)) {
|
| + if (!editableElement->renderer())
|
| + return VisiblePosition();
|
| +
|
| + FloatPoint absolutePoint = targetNode->renderer()->localToAbsolute(FloatPoint(selectionEndPoint));
|
| + selectionEndPoint = roundedLayoutPoint(editableElement->renderer()->absoluteToLocal(absolutePoint));
|
| + targetNode = editableElement;
|
| + }
|
| +
|
| + return targetNode->renderer()->positionForPoint(selectionEndPoint);
|
| +}
|
| +
|
| +
|
| bool VisibleSelection::isContentEditable() const
|
| {
|
| return isEditablePosition(start());
|
|
|