| Index: Source/core/editing/FrameSelection.cpp
|
| diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
|
| index 8ae0f560edc37569b6e8c7d05d7640bf8cfdbcef..bd8ed462a8624d76bc6aa5a4b40fc00177d0adab 100644
|
| --- a/Source/core/editing/FrameSelection.cpp
|
| +++ b/Source/core/editing/FrameSelection.cpp
|
| @@ -20,9 +20,9 @@
|
| * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
| * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
| -
|
| +
|
| #include "config.h"
|
| #include "core/editing/FrameSelection.h"
|
|
|
| @@ -307,7 +307,7 @@ void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec
|
|
|
| m_selection = s;
|
| setCaretRectNeedsUpdate();
|
| -
|
| +
|
| if (!s.isNone() && !(options & DoNotSetFocus))
|
| setFocusedNodeIfNeeded();
|
|
|
| @@ -418,8 +418,8 @@ void FrameSelection::respondToNodeModification(Node* node, bool baseRemoved, boo
|
| ExceptionCode ec = 0;
|
| Range::CompareResults compareResult = range->compareNode(node, ec);
|
| if (!ec && (compareResult == Range::NODE_BEFORE_AND_AFTER || compareResult == Range::NODE_INSIDE)) {
|
| - // If we did nothing here, when this node's renderer was destroyed, the rect that it
|
| - // occupied would be invalidated, but, selection gaps that change as a result of
|
| + // If we did nothing here, when this node's renderer was destroyed, the rect that it
|
| + // occupied would be invalidated, but, selection gaps that change as a result of
|
| // the removal wouldn't be invalidated.
|
| // FIXME: Don't do so much unnecessary invalidation.
|
| clearRenderTreeSelection = true;
|
| @@ -822,7 +822,7 @@ VisiblePosition FrameSelection::modifyExtendingLeft(TextGranularity granularity)
|
| #endif
|
| return pos;
|
| }
|
| -
|
| +
|
| VisiblePosition FrameSelection::modifyExtendingBackward(TextGranularity granularity)
|
| {
|
| VisiblePosition pos(m_selection.extent(), m_selection.affinity());
|
| @@ -949,7 +949,7 @@ VisiblePosition FrameSelection::modifyMovingBackward(TextGranularity granularity
|
| static bool isBoundary(TextGranularity granularity)
|
| {
|
| return granularity == LineBoundary || granularity == ParagraphBoundary || granularity == DocumentBoundary;
|
| -}
|
| +}
|
|
|
| bool FrameSelection::modify(EAlteration alter, SelectionDirection direction, TextGranularity granularity, EUserTriggered userTriggered)
|
| {
|
| @@ -1044,7 +1044,7 @@ bool FrameSelection::modify(EAlteration alter, SelectionDirection direction, Tex
|
| }
|
| break;
|
| }
|
| -
|
| +
|
| if (granularity == LineGranularity || granularity == ParagraphGranularity)
|
| m_xPosForVerticalArrowNavigation = x;
|
|
|
| @@ -1174,7 +1174,7 @@ LayoutUnit FrameSelection::lineDirectionPointForBlockDirectionNavigation(EPositi
|
| Frame* frame = pos.anchorNode()->document()->frame();
|
| if (!frame)
|
| return x;
|
| -
|
| +
|
| if (m_xPosForVerticalArrowNavigation == NoXPosForVerticalArrowNavigation()) {
|
| VisiblePosition visiblePosition(pos, m_selection.affinity());
|
| // VisiblePosition creation can fail here if a node containing the selection becomes visibility:hidden
|
| @@ -1183,7 +1183,7 @@ LayoutUnit FrameSelection::lineDirectionPointForBlockDirectionNavigation(EPositi
|
| m_xPosForVerticalArrowNavigation = x;
|
| } else
|
| x = m_xPosForVerticalArrowNavigation;
|
| -
|
| +
|
| return x;
|
| }
|
|
|
| @@ -1341,7 +1341,7 @@ IntRect CaretBase::absoluteBoundsForLocalRect(Node* node, const LayoutRect& rect
|
| RenderObject* caretPainter = caretRenderer(node);
|
| if (!caretPainter)
|
| return IntRect();
|
| -
|
| +
|
| LayoutRect localRect(rect);
|
| if (caretPainter->isBox())
|
| toRenderBox(caretPainter)->flipForWritingMode(localRect);
|
| @@ -1388,7 +1388,7 @@ bool FrameSelection::recomputeCaretRect()
|
| IntRect oldAbsCaretBounds = m_absCaretBounds;
|
| m_absCaretBounds = absoluteBoundsForLocalRect(m_selection.start().deprecatedNode(), localCaretRectWithoutUpdate());
|
| m_absCaretBoundsDirty = false;
|
| -
|
| +
|
| if (oldAbsCaretBounds == m_absCaretBounds)
|
| return false;
|
|
|
| @@ -1423,15 +1423,15 @@ void FrameSelection::invalidateCaretRect()
|
| void CaretBase::invalidateCaretRect(Node* node, bool caretRectChanged)
|
| {
|
| // EDIT FIXME: This is an unfortunate hack.
|
| - // Basically, we can't trust this layout position since we
|
| - // can't guarantee that the check to see if we are in unrendered
|
| + // Basically, we can't trust this layout position since we
|
| + // can't guarantee that the check to see if we are in unrendered
|
| // content will work at this point. We may have to wait for
|
| // a layout and re-render of the document to happen. So, resetting this
|
| // flag will cause another caret layout to happen the first time
|
| // that we try to paint the caret after this call. That one will work since
|
| // it happens after the document has accounted for any editing
|
| // changes which may have been done.
|
| - // And, we need to leave this layout here so the caret moves right
|
| + // And, we need to leave this layout here so the caret moves right
|
| // away after clicking.
|
| m_caretRectNeedsUpdate = true;
|
|
|
| @@ -1489,7 +1489,7 @@ void FrameSelection::debugRenderer(RenderObject *r, bool selected) const
|
| fprintf(stderr, "%s#text (empty)\n", selected ? "==> " : " ");
|
| return;
|
| }
|
| -
|
| +
|
| static const int max = 36;
|
| String text = textRenderer->text();
|
| int textLength = text.length();
|
| @@ -1503,11 +1503,11 @@ void FrameSelection::debugRenderer(RenderObject *r, bool selected) const
|
| int pos;
|
| InlineTextBox* box = textRenderer->findNextInlineTextBox(offset, pos);
|
| text = text.substring(box->start(), box->len());
|
| -
|
| +
|
| String show;
|
| int mid = max / 2;
|
| int caret = 0;
|
| -
|
| +
|
| // text is shorter than max
|
| if (textLength < max) {
|
| show = text;
|
| @@ -1525,7 +1525,7 @@ void FrameSelection::debugRenderer(RenderObject *r, bool selected) const
|
| show = "..." + text.right(max - 3);
|
| caret = pos - (textLength - show.length());
|
| }
|
| -
|
| +
|
| show.replace('\n', ' ');
|
| show.replace('\r', ' ');
|
| fprintf(stderr, "==> #text : \"%s\" at offset %d\n", show.utf8().data(), pos);
|
| @@ -1546,27 +1546,27 @@ void FrameSelection::debugRenderer(RenderObject *r, bool selected) const
|
| bool FrameSelection::contains(const LayoutPoint& point)
|
| {
|
| Document* document = m_frame->document();
|
| -
|
| +
|
| // Treat a collapsed selection like no selection.
|
| if (!isRange())
|
| return false;
|
| - if (!document->renderer())
|
| + if (!document->renderer())
|
| return false;
|
| -
|
| +
|
| HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
|
| HitTestResult result(point);
|
| document->renderView()->hitTest(request, result);
|
| Node* innerNode = result.innerNode();
|
| if (!innerNode || !innerNode->renderer())
|
| return false;
|
| -
|
| +
|
| VisiblePosition visiblePos(innerNode->renderer()->positionForPoint(result.localPoint()));
|
| if (visiblePos.isNull())
|
| return false;
|
| -
|
| +
|
| if (m_selection.visibleStart().isNull() || m_selection.visibleEnd().isNull())
|
| return false;
|
| -
|
| +
|
| Position start(m_selection.visibleStart().deepEquivalent());
|
| Position end(m_selection.visibleEnd().deepEquivalent());
|
| Position p(visiblePos.deepEquivalent());
|
| @@ -1604,7 +1604,7 @@ void FrameSelection::selectFrameElementInParentIfFullySelected()
|
| ContainerNode* ownerElementParent = ownerElement->parentNode();
|
| if (!ownerElementParent)
|
| return;
|
| -
|
| +
|
| // This method's purpose is it to make it easier to select iframes (in order to delete them). Don't do anything if the iframe isn't deletable.
|
| if (!ownerElementParent->rendererIsEditable())
|
| return;
|
| @@ -1924,7 +1924,7 @@ void FrameSelection::setFocusedNodeIfNeeded()
|
| }
|
|
|
| if (Element* target = rootEditableElement()) {
|
| - // Walk up the DOM tree to search for a node to focus.
|
| + // Walk up the DOM tree to search for a node to focus.
|
| while (target) {
|
| // We don't want to set focus on a subframe when selecting in a parent frame,
|
| // so add the !isFrameElement check here. There's probably a better way to make this
|
|
|