Changeset 176412 in webkit


Ignore:
Timestamp:
Nov 20, 2014 2:03:39 PM (9 years ago)
Author:
Beth Dakin
Message:

Invalid message WebPageProxy.DidPerformDictionaryLookup on Google stocks result
https://bugs.webkit.org/show_bug.cgi?id=138568
-and corresponding-
rdar://problem/18904600

Reviewed by Tim Horton.

Source/WebCore:

Add an optional parameter indicating whether or not to include images.

  • WebCore.exp.in:
  • editing/cocoa/HTMLConverter.h:
  • editing/cocoa/HTMLConverter.mm:

(WebCore::editingAttributedStringFromRange):

Source/WebKit/mac:

Skip images for lookup.

  • WebView/WebActionMenuController.mm:

(performDictionaryLookupForRange):

Source/WebKit2:

Skip images for lookup.

  • WebProcess/WebPage/mac/WebPageMac.mm:

(WebKit::WebPage::performDictionaryLookupForRange):

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r176410 r176412  
     12014-11-20  Beth Dakin  <bdakin@apple.com>
     2
     3        Invalid message WebPageProxy.DidPerformDictionaryLookup on Google stocks result
     4        https://bugs.webkit.org/show_bug.cgi?id=138568
     5        -and corresponding-
     6        rdar://problem/18904600
     7
     8        Reviewed by Tim Horton.
     9
     10        Add an optional parameter indicating whether or not to include images.
     11        * WebCore.exp.in:
     12        * editing/cocoa/HTMLConverter.h:
     13        * editing/cocoa/HTMLConverter.mm:
     14        (WebCore::editingAttributedStringFromRange):
     15
    1162014-11-20  Myles C. Maxfield  <mmaxfield@apple.com>
    217
  • trunk/Source/WebCore/WebCore.exp.in

    r176363 r176412  
    23672367__ZN7WebCore32contextMenuItemTagInspectElementEv
    23682368__ZN7WebCore32contextMenuItemTagSmartCopyPasteEv
    2369 __ZN7WebCore32editingAttributedStringFromRangeERNS_5RangeE
     2369__ZN7WebCore32editingAttributedStringFromRangeERNS_5RangeENS_31IncludeImagesInAttributedStringE
    23702370__ZN7WebCore32useBlockedPlugInContextMenuTitleEv
    23712371__ZN7WebCore33contextMenuItemTagTextReplacementEv
  • trunk/Source/WebCore/editing/cocoa/HTMLConverter.h

    r173679 r176412  
    3232   
    3333class Range;
     34
     35enum class IncludeImagesInAttributedString { Yes, No };
    3436   
    3537WEBCORE_EXPORT NSAttributedString *attributedStringFromRange(Range&);
    3638#if !PLATFORM(IOS)
    37 WEBCORE_EXPORT NSAttributedString *editingAttributedStringFromRange(Range&);
     39WEBCORE_EXPORT NSAttributedString *editingAttributedStringFromRange(Range&, IncludeImagesInAttributedString = IncludeImagesInAttributedString::Yes);
    3840#endif
    3941
  • trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm

    r175513 r176412  
    25562556#if !PLATFORM(IOS)
    25572557// This function uses TextIterator, which makes offsets in its result compatible with HTML editing.
    2558 NSAttributedString *editingAttributedStringFromRange(Range& range)
     2558NSAttributedString *editingAttributedStringFromRange(Range& range, IncludeImagesInAttributedString includeOrSkipImages)
    25592559{
    25602560    NSFontManager *fontManager = [NSFontManager sharedFontManager];
     
    25692569        int startOffset = currentTextRange->startOffset();
    25702570        int endOffset = currentTextRange->endOffset();
    2571        
    2572         if (startContainer == endContainer && (startOffset == endOffset - 1)) {
    2573             Node* node = startContainer->traverseToChildAt(startOffset);
    2574             if (is<HTMLImageElement>(node)) {
    2575                 NSFileWrapper* fileWrapper = fileWrapperForElement(downcast<HTMLImageElement>(node));
    2576                 NSTextAttachment* attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
    2577                 [string appendAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]];
    2578                 [attachment release];
     2571
     2572        if (includeOrSkipImages == IncludeImagesInAttributedString::Yes) {
     2573            if (startContainer == endContainer && (startOffset == endOffset - 1)) {
     2574                Node* node = startContainer->traverseToChildAt(startOffset);
     2575                if (is<HTMLImageElement>(node)) {
     2576                    NSFileWrapper* fileWrapper = fileWrapperForElement(downcast<HTMLImageElement>(node));
     2577                    NSTextAttachment* attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
     2578                    [string appendAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]];
     2579                    [attachment release];
     2580                }
    25792581            }
    25802582        }
  • trunk/Source/WebKit/mac/ChangeLog

    r176356 r176412  
     12014-11-20  Beth Dakin  <bdakin@apple.com>
     2
     3        Invalid message WebPageProxy.DidPerformDictionaryLookup on Google stocks result
     4        https://bugs.webkit.org/show_bug.cgi?id=138568
     5        -and corresponding-
     6        rdar://problem/18904600
     7
     8        Reviewed by Tim Horton.
     9
     10        Skip images for lookup.
     11        * WebView/WebActionMenuController.mm:
     12        (performDictionaryLookupForRange):
     13
    1142014-11-19  Beth Dakin  <bdakin@apple.com>
    215
  • trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm

    r176356 r176412  
    665665    popupInfo.options = options;
    666666
    667     NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range);
     667    NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range, IncludeImagesInAttributedString::No);
    668668    RetainPtr<NSMutableAttributedString> scaledNSAttributedString = adoptNS([[NSMutableAttributedString alloc] initWithString:[nsAttributedString string]]);
    669669    NSFontManager *fontManager = [NSFontManager sharedFontManager];
  • trunk/Source/WebKit2/ChangeLog

    r176411 r176412  
     12014-11-20  Beth Dakin  <bdakin@apple.com>
     2
     3        Invalid message WebPageProxy.DidPerformDictionaryLookup on Google stocks result
     4        https://bugs.webkit.org/show_bug.cgi?id=138568
     5        -and corresponding-
     6        rdar://problem/18904600
     7
     8        Reviewed by Tim Horton.
     9
     10        Skip images for lookup.
     11        * WebProcess/WebPage/mac/WebPageMac.mm:
     12        (WebKit::WebPage::performDictionaryLookupForRange):
     13
    1142014-11-20  Daniel Bates  <dabates@apple.com>
    215
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

    r176363 r176412  
    531531    dictionaryPopupInfo.options = (CFDictionaryRef)options;
    532532
    533     NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range);
     533    NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range, IncludeImagesInAttributedString::No);
    534534
    535535    RetainPtr<NSMutableAttributedString> scaledNSAttributedString = adoptNS([[NSMutableAttributedString alloc] initWithString:[nsAttributedString string]]);
Note: See TracChangeset for help on using the changeset viewer.