Changeset 141618 in webkit


Ignore:
Timestamp:
Feb 1, 2013 11:44:37 AM (11 years ago)
Author:
rniwa@webkit.org
Message:

Smart link can erroneously move caret after an URL when typing immediately before it
https://bugs.webkit.org/show_bug.cgi?id=92812

Reviewed by Enrica Casucci.

Source/WebCore:

The bug was caused by smart link being triggered even when a user finished typing a word
immediately before an URL. We already had a logic to avoid smart-linking an URL when the caret
was after the URL but we were missing a check for when the caret is before the URL.

Fixed the bug by adding this check.

Test: editing/inserting/smart-link-when-caret-is-moved-before-URL.html

  • editing/Editor.cpp:

(WebCore::Editor::markAndReplaceFor):

LayoutTests:

Add a regression for typing immediately before an URL while smart link is enabled.
WebKit should not be moving the caret erroneously.

  • editing/inserting/smart-link-when-caret-is-moved-before-URL-expected.txt: Added.
  • editing/inserting/smart-link-when-caret-is-moved-before-URL.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r141616 r141618  
     12013-02-01  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Smart link can erroneously move caret after an URL when typing immediately before it
     4        https://bugs.webkit.org/show_bug.cgi?id=92812
     5
     6        Reviewed by Enrica Casucci.
     7
     8        Add a regression for typing immediately before an URL while smart link is enabled.
     9        WebKit should not be moving the caret erroneously.
     10
     11        * editing/inserting/smart-link-when-caret-is-moved-before-URL-expected.txt: Added.
     12        * editing/inserting/smart-link-when-caret-is-moved-before-URL.html: Added.
     13
    1142013-02-01  Julien Chaffraix  <jchaffraix@webkit.org>
    215
  • trunk/Source/WebCore/ChangeLog

    r141617 r141618  
     12013-02-01  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Smart link can erroneously move caret after an URL when typing immediately before it
     4        https://bugs.webkit.org/show_bug.cgi?id=92812
     5
     6        Reviewed by Enrica Casucci.
     7
     8        The bug was caused by smart link being triggered even when a user finished typing a word
     9        immediately before an URL. We already had a logic to avoid smart-linking an URL when the caret
     10        was after the URL but we were missing a check for when the caret is before the URL.
     11
     12        Fixed the bug by adding this check.
     13
     14        Test: editing/inserting/smart-link-when-caret-is-moved-before-URL.html
     15
     16        * editing/Editor.cpp:
     17        (WebCore::Editor::markAndReplaceFor):
     18
    1192013-02-01  Roger Fong  <roger_fong@apple.com>
    220
  • trunk/Source/WebCore/editing/Editor.cpp

    r141545 r141618  
    21382138
    21392139            // adding links should be done only immediately after they are typed
    2140             if (result->type == TextCheckingTypeLink && selectionOffset > resultLocation + resultLength + 1)
     2140            int resultEnd = resultLocation + resultLength;
     2141            if (result->type == TextCheckingTypeLink
     2142                && (selectionOffset > resultEnd + 1 || selectionOffset <= resultLocation))
    21412143                continue;
    21422144
Note: See TracChangeset for help on using the changeset viewer.