Changeset 82533 in webkit


Ignore:
Timestamp:
Mar 30, 2011 7:08:34 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-03-30 Jia Pu <jpu@apple.com>

Reviewed by Darin Adler.

Autocorrection panel isn't positioned correctly in Safari (mac) when the zooming is not 1x.
https://bugs.webkit.org/show_bug.cgi?id=57353
<rdar://problem/9163983>

Updated following test in response to recent change in AppKit spell checker.

  • platform/mac/editing/spelling/delete-autocorrected-word-1-expected.txt:
  • platform/mac/editing/spelling/delete-autocorrected-word-1.html:

2011-03-30 Jia Pu <jpu@apple.com>

Reviewed by Darin Adler.

Autocorrection panel isn't positioned correctly in Safari (mac) when the zooming is not 1x.
https://bugs.webkit.org/show_bug.cgi?id=57353
<rdar://problem/9163983>

We use Range::textQuads() instead of Range::boundingRect() to compute the position of correction
panel. The latter function compensates for zooming, which we don't need in this case. We also
dismiss correction panel when zooming factor is changed. This is done in Frame::setPageAndTextZoomFactors().

  • WebCore.exp.in:
  • dom/Range.cpp: (WebCore::Range::textQuads):
  • dom/Range.h:
  • editing/Editor.cpp: (WebCore::Editor::windowRectForRange):
  • editing/Editor.h:
  • page/Frame.cpp: (WebCore::Frame::setPageAndTextZoomFactors):
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r82529 r82533  
     12011-03-30  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Autocorrection panel isn't positioned correctly in Safari (mac) when the zooming is not 1x.
     6        https://bugs.webkit.org/show_bug.cgi?id=57353
     7        <rdar://problem/9163983>
     8
     9        Updated following test in response to recent change in AppKit spell checker.
     10
     11        * platform/mac/editing/spelling/delete-autocorrected-word-1-expected.txt:
     12        * platform/mac/editing/spelling/delete-autocorrected-word-1.html:
     13
    1142011-03-30  Dan Bernstein  <mitz@apple.com>
    215
  • trunk/LayoutTests/platform/mac/editing/spelling/delete-autocorrected-word-1-expected.txt

    r80226 r82533  
    4646EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    4747EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     48EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
     49EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    4850EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 10 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    4951EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    5052EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    51 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    52 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 12 of #text > DIV > BODY > HTML > #document toDOMRange:range from 12 of #text > DIV > BODY > HTML > #document to 12 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    53 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    54 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    55 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    56 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    57 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    58 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 12 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document toDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    59 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    60 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    61 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 12 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    62 EDITING DELEGATE: shouldInsertText:message replacingDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 12 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
    63 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 12 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    64 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 12 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     53EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 10 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     54EDITING DELEGATE: shouldInsertText:message replacingDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 10 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
     55EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 10 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     56EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 10 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    6557EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    6658EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/spelling/delete-autocorrected-word-1.html

    r73088 r82533  
    2121    typeCharacterCommand('e');
    2222    typeCharacterCommand('s');
    23     typeCharacterCommand('s');
    2423    typeCharacterCommand('a');
    2524    typeCharacterCommand('g');
    26     typeCharacterCommand('e');
    2725    typeCharacterCommand('e');
    2826    typeCharacterCommand(' ');
  • trunk/Source/WebCore/ChangeLog

    r82532 r82533  
     12011-03-30  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Autocorrection panel isn't positioned correctly in Safari (mac) when the zooming is not 1x.
     6        https://bugs.webkit.org/show_bug.cgi?id=57353
     7        <rdar://problem/9163983>
     8
     9        We use Range::textQuads() instead of Range::boundingRect() to compute the position of correction
     10        panel. The latter function compensates for zooming, which we don't need in this case. We also
     11        dismiss correction panel when zooming factor is changed. This is done in Frame::setPageAndTextZoomFactors().
     12
     13        * WebCore.exp.in:
     14        * dom/Range.cpp:
     15        (WebCore::Range::textQuads):
     16        * dom/Range.h:
     17        * editing/Editor.cpp:
     18        (WebCore::Editor::windowRectForRange):
     19        * editing/Editor.h:
     20        * page/Frame.cpp:
     21        (WebCore::Frame::setPageAndTextZoomFactors):
     22
    1232011-03-30  Chris Guillory  <chris.guillory@google.com>
    224
  • trunk/Source/WebCore/WebCore.exp.in

    r82492 r82533  
    725725__ZN7WebCore5Range6setEndEN3WTF10PassRefPtrINS_4NodeEEEiRi
    726726__ZN7WebCore5Range8setStartEN3WTF10PassRefPtrINS_4NodeEEEiRi
    727 __ZN7WebCore5Range9textQuadsERN3WTF6VectorINS_9FloatQuadELm0EEEb
    728727__ZN7WebCore5Range9textRectsERN3WTF6VectorINS_7IntRectELm0EEEb
    729728__ZN7WebCore5RangeD1Ev
     
    10011000__ZNK3JSC8Bindings10RootObject12globalObjectEv
    10021001__ZNK3WTF6String14createCFStringEv
     1002__ZNK7WebCore5Range9textQuadsERN3WTF6VectorINS_9FloatQuadELm0EEEb
    10031003__ZNK7WebCore10Credential11persistenceEv
    10041004__ZNK7WebCore10Credential4userEv
  • trunk/Source/WebCore/dom/Range.cpp

    r80696 r82533  
    16211621}
    16221622
    1623 void Range::textQuads(Vector<FloatQuad>& quads, bool useSelectionHeight)
     1623void Range::textQuads(Vector<FloatQuad>& quads, bool useSelectionHeight) const
    16241624{
    16251625    Node* startContainer = m_start.container();
  • trunk/Source/WebCore/dom/Range.h

    r80408 r82533  
    110110    void textRects(Vector<IntRect>&, bool useSelectionHeight = false);
    111111    // Transform-friendly
    112     void textQuads(Vector<FloatQuad>&, bool useSelectionHeight = false);
     112    void textQuads(Vector<FloatQuad>&, bool useSelectionHeight = false) const;
    113113    void getBorderAndTextQuads(Vector<FloatQuad>&) const;
    114114    FloatRect boundingRect() const;
  • trunk/Source/WebCore/editing/Editor.cpp

    r82503 r82533  
    35943594{
    35953595    FrameView* view = frame()->view();
    3596     return view ? view->contentsToWindow(IntRect(range->boundingRect())) : FloatRect();
     3596    if (!view)
     3597        return FloatRect();
     3598    Vector<FloatQuad> textQuads;
     3599    range->textQuads(textQuads);
     3600    FloatRect boundingRect;
     3601    size_t size = textQuads.size();
     3602    for (size_t i = 0; i < size; ++i)
     3603        boundingRect.unite(textQuads[i].boundingBox());
     3604    return view->contentsToWindow(IntRect(boundingRect));
    35973605}       
    35983606
  • trunk/Source/WebCore/editing/Editor.h

    r82159 r82533  
    327327    // If user confirmed a correction in the correction panel, correction has non-zero length, otherwise it means that user has dismissed the panel.
    328328    void handleCorrectionPanelResult(const String& correction);
     329    void dismissCorrectionPanel(ReasonForDismissingCorrectionPanel);
    329330
    330331    void pasteAsFragment(PassRefPtr<DocumentFragment>, bool smartReplace, bool matchStyle);
     
    427428    Node* findEventTargetFromSelection() const;
    428429    void stopCorrectionPanelTimer();
    429     void dismissCorrectionPanel(ReasonForDismissingCorrectionPanel);
    430430    String dismissCorrectionPanelSoon(ReasonForDismissingCorrectionPanel);
    431431    void applyCorrectionPanelInfo(const Vector<DocumentMarker::MarkerType>& markerTypesToAdd);
  • trunk/Source/WebCore/page/Frame.cpp

    r81603 r82533  
    944944        return;
    945945
     946    m_editor.dismissCorrectionPanel(ReasonForDismissingCorrectionPanelIgnored);
     947
    946948#if ENABLE(SVG)
    947949    // Respect SVGs zoomAndPan="disabled" property in standalone SVG documents.
Note: See TracChangeset for help on using the changeset viewer.