Changeset 37611 in webkit


Ignore:
Timestamp:
Oct 15, 2008 1:32:43 PM (16 years ago)
Author:
Beth Dakin
Message:

WebCore:

2008-10-14 Maxime Britto <britto@apple.com>

Reviewed by Darin Adler, tweaked and landed by Beth.

  • WebCore.base.exp: Exposes two functions to be able to create a selection from a point on the screen. Also exposes the new TextIterator::currentNode function.
  • WebCore/editing/TextIterator.cpp: (TextIterator::currentNode) : New function that returns the current text node or NULL if there is no text node.

WebKit:

2008-10-14 Maxime Britto <britto@apple.com>

Reviewed by Darin Adler.

  • WebKit.xcodeproj/project.pbxproj: Added two files for the WebTextIterator, and made the WebTextIterator.h private

WebKit/mac:

2008-10-14 Maxime Britto <britto@apple.com>

Reviewed by Darin Adler.

Added SPI to use WebCore's TextIterator with WebKit.

  • WebView/WebTextIterator.h: Added.
  • WebView/WebTextIterator.mm: Added. (-[WebTextIteratorPrivate dealloc]): (-[WebTextIterator dealloc]): (-[WebTextIterator initWithRange:]): Creates a TextIterator instance (-[WebTextIterator advance]): Asks the iterator to advance() . (-[WebTextIterator currentNode]): Returns the current DOMNode from the iterator (-[WebTextIterator currentText]): Returns the current text from the iterator (-[WebTextIterator atEnd]): Indicated whether the iterator has reached the end of the range.
  • WebView/WebView.h:
  • WebView/WebView.mm: (-[WebView textIteratorForRect:]): Returns a WebTextIterator with the DOMRange contained in the rectangle given as a parameter.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r37610 r37611  
     12008-10-14  Maxime Britto  <britto@apple.com>
     2
     3        Reviewed by Darin Adler, tweaked and landed by Beth.
     4
     5        * WebCore.base.exp: Exposes two functions to be able to create a
     6        selection from a point on the screen. Also exposes the new
     7        TextIterator::currentNode function.
     8        * WebCore/editing/TextIterator.cpp:
     9        (TextIterator::currentNode) : New function that returns the current
     10        text node or NULL if there is no text node.
     11
    1122008-10-15  Marco Barisione  <marco.barisione@collabora.co.uk>
    213
  • trunk/WebCore/WebCore.base.exp

    r37511 r37611  
    131131__ZN7WebCore10EventNames12keydownEventE
    132132__ZN7WebCore10MouseEventC1ERKNS_12AtomicStringEbbN3WTF10PassRefPtrINS_9DOMWindowEEEiiiiibbbbtNS5_INS_15EventTargetNodeEEENS5_INS_9ClipboardEEEb
     133__ZN7WebCore10ScrollView17setScrollbarModesENS_13ScrollbarModeES1_
     134__ZN7WebCore10ScrollView20setCanHaveScrollbarsEb
    133135__ZN7WebCore10StringImpl7replaceEtt
    134136__ZN7WebCore10StringImplD1Ev
     
    468470__ZN7WebCore5Frame20setSelectionFromNoneEv
    469471__ZN7WebCore5Frame21markAllMatchesForTextERKNS_6StringEbj
     472__ZN7WebCore5Frame23visiblePositionForPointERKNS_8IntPointE
    470473__ZN7WebCore5Frame24computeAndSetTypingStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
    471474__ZN7WebCore5Frame24setExcludeFromTextSearchEb
     
    532535__ZN7WebCore6StringC1EPKcj
    533536__ZN7WebCore6StringC1ERKN3JSC7UStringE
     537__ZN7WebCore6Widget12setFrameRectERKNS_7IntRectE
    534538__ZN7WebCore6Widget16removeFromParentEv
    535 __ZN7WebCore6Widget12setFrameRectERKNS_7IntRectE
    536539__ZN7WebCore6Widget20retainPlatformWidgetEv
    537540__ZN7WebCore6Widget21releasePlatformWidgetEv
     
    613616__ZN7WebCore9FrameView18updateControlTintsEv
    614617__ZN7WebCore9FrameView22setBaseBackgroundColorENS_5ColorE
     618__ZN7WebCore9FrameView23layoutIfNeededRecursiveEv
    615619__ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb
    616620__ZN7WebCore9FrameViewC1EPNS_5FrameE
    617 __ZN7WebCore9HTMLNames8frameTagE
    618 __ZN7WebCore9HTMLNames9iframeTagE
     621__ZN7WebCore9FrameViewC1EPNS_5FrameERKNS_7IntSizeE
    619622__ZN7WebCore9HTMLNames10listingTagE
    620623__ZN7WebCore9HTMLNames13blockquoteTagE
     
    644647__ZN7WebCore9HTMLNames7formTagE
    645648__ZN7WebCore9HTMLNames7srcAttrE
     649__ZN7WebCore9HTMLNames8frameTagE
    646650__ZN7WebCore9HTMLNames8hrefAttrE
    647651__ZN7WebCore9HTMLNames8inputTagE
     652__ZN7WebCore9HTMLNames9iframeTagE
    648653__ZN7WebCore9PageCache11setCapacityEi
    649654__ZN7WebCore9PageCache27releaseAutoreleasedPagesNowEv
     
    654659__ZN7WebCore9Selection22expandUsingGranularityENS_15TextGranularityE
    655660__ZN7WebCore9SelectionC1EPKNS_5RangeENS_9EAffinityE
     661__ZN7WebCore9SelectionC1ERKNS_15VisiblePositionES3_
    656662__ZN7WebCore9TimerBase4stopEv
    657663__ZN7WebCore9TimerBase5startEdd
     
    665671__ZNK7WebCore10PluginData16supportsMimeTypeERKNS_6StringE
    666672__ZNK7WebCore10ScrollView12documentViewEv
    667 __ZN7WebCore10ScrollView17setScrollbarModesENS_13ScrollbarModeES1_
    668 __ZN7WebCore10ScrollView20setCanHaveScrollbarsEb
    669673__ZNK7WebCore10ScrollView14scrollbarModesERNS_13ScrollbarModeES2_
    670674__ZNK7WebCore11CachedImage5imageEv
     
    711715__ZNK7WebCore12SharedBuffer4sizeEv
    712716__ZNK7WebCore12TextEncoding6decodeEPKcmbRb
     717__ZNK7WebCore12TextIterator4nodeEv
    713718__ZNK7WebCore12TextIterator5rangeEv
     719__ZNK7WebCore13ContainerNode14childNodeCountEv
     720__ZNK7WebCore13ContainerNode9childNodeEj
    714721__ZNK7WebCore13HitTestResult10isLiveLinkEv
    715722__ZNK7WebCore13HitTestResult10isSelectedEv
     
    726733__ZNK7WebCore13HitTestResult9imageRectEv
    727734__ZNK7WebCore13ResourceErrorcvP7NSErrorEv
    728 __ZNK7WebCore13ContainerNode14childNodeCountEv
    729735__ZNK7WebCore14DocumentLoader10requestURLEv
    730736__ZNK7WebCore14DocumentLoader11frameLoaderEv
     
    773779__ZNK7WebCore4Node18getSubresourceURLsERN3WTF6VectorINS_4KURLELm0EEE
    774780__ZNK7WebCore4Node9nodeIndexEv
    775 __ZNK7WebCore13ContainerNode9childNodeEj
    776781__ZNK7WebCore4Page10pluginDataEv
    777782__ZNK7WebCore4Page34inLowQualityImageInterpolationModeEv
     
    861866__ZNK7WebCore9FrameTree6parentEb
    862867__ZNK7WebCore9FrameView11needsLayoutEv
    863 __ZN7WebCore9FrameView23layoutIfNeededRecursiveEv
    864 __ZN7WebCore9FrameViewC1EPNS_5FrameERKNS_7IntSizeE
    865868__ZNK7WebCore9Selection17isContentEditableEv
    866869__ZNK7WebCore9Selection19rootEditableElementEv
  • trunk/WebCore/editing/TextIterator.cpp

    r34822 r37611  
    713713    return 0;
    714714}
     715   
     716Node* TextIterator::node() const
     717{
     718    RefPtr<Range> textRange = range();
     719    if (!textRange)
     720        return 0;
     721
     722    Node* node = textRange->startContainer();
     723    if (!node)
     724        return 0;
     725    if (node->offsetInCharacters())
     726        return node;
     727   
     728    return node->childNode(textRange->startOffset());
     729}
    715730
    716731// --------
  • trunk/WebCore/editing/TextIterator.h

    r34822 r37611  
    6666   
    6767    PassRefPtr<Range> range() const;
     68    Node* node() const;
    6869     
    6970    static int rangeLength(const Range*, bool spacesForReplacedElements = false);
  • trunk/WebKit/ChangeLog

    r37312 r37611  
     12008-10-14  Maxime Britto  <britto@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        * WebKit.xcodeproj/project.pbxproj: Added two files for the
     6        WebTextIterator, and made the WebTextIterator.h private
     7
    182008-10-04  Mark Rowe  <mrowe@apple.com>
    29
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r37312 r37611  
    295295                EDE983800BCDF5FE00FDAE28 /* WebNSArrayExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = EDE9837E0BCDF5FE00FDAE28 /* WebNSArrayExtras.h */; };
    296296                EDE983810BCDF5FE00FDAE28 /* WebNSArrayExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = EDE9837F0BCDF5FE00FDAE28 /* WebNSArrayExtras.m */; };
     297                F834AAD70E64B1C700E2737C /* WebTextIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = F834AAD50E64B1C700E2737C /* WebTextIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
     298                F834AAD80E64B1C700E2737C /* WebTextIterator.mm in Sources */ = {isa = PBXBuildFile; fileRef = F834AAD60E64B1C700E2737C /* WebTextIterator.mm */; };
    297299/* End PBXBuildFile section */
    298300
     
    591593                F7EBEEAA03F9DBA103CA0DE6 /* HIWebView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HIWebView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    592594                F7EBEEAB03F9DBA103CA0DE6 /* HIWebView.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = HIWebView.m; sourceTree = "<group>"; usesTabs = 0; };
     595                F834AAD50E64B1C700E2737C /* WebTextIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebTextIterator.h; sourceTree = "<group>"; };
     596                F834AAD60E64B1C700E2737C /* WebTextIterator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebTextIterator.mm; sourceTree = "<group>"; };
    593597                F8CA15B5029A39D901000122 /* WebAuthenticationPanel.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationPanel.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    594598                F8CA15B6029A39D901000122 /* WebAuthenticationPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebAuthenticationPanel.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    920924                        isa = PBXGroup;
    921925                        children = (
     926                                F834AAD50E64B1C700E2737C /* WebTextIterator.h */,
     927                                F834AAD60E64B1C700E2737C /* WebTextIterator.mm */,
    922928                                F52CA6BD02DF9D0F018635CA /* HTML */,
    923929                                51E94C0706C02CA300A9B09E /* PDF */,
     
    13041310                                1A2D75500DE4810E00F0A648 /* WebIconFetcherInternal.h in Headers */,
    13051311                                5D1638F30E35B45D00F3038E /* EmptyProtocolDefinitions.h in Headers */,
     1312                                F834AAD70E64B1C700E2737C /* WebTextIterator.h in Headers */,
    13061313                        );
    13071314                        runOnlyForDeploymentPostprocessing = 0;
     
    15861593                                1AEA6A510DC8CE2F003D12BF /* WebNetscapePluginEventHandlerCocoa.mm in Sources */,
    15871594                                1A2D754E0DE480B900F0A648 /* WebIconFetcher.mm in Sources */,
     1595                                F834AAD80E64B1C700E2737C /* WebTextIterator.mm in Sources */,
    15881596                        );
    15891597                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit/mac/ChangeLog

    r37606 r37611  
     12008-10-14  Maxime Britto  <britto@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Added SPI to use WebCore's TextIterator with WebKit.
     6
     7        * WebView/WebTextIterator.h: Added.
     8        * WebView/WebTextIterator.mm: Added.
     9        (-[WebTextIteratorPrivate dealloc]):
     10        (-[WebTextIterator dealloc]):
     11        (-[WebTextIterator initWithRange:]): Creates a TextIterator
     12        instance
     13        (-[WebTextIterator advance]): Asks the iterator to advance() .
     14        (-[WebTextIterator currentNode]): Returns the current DOMNode from
     15        the iterator
     16        (-[WebTextIterator currentText]): Returns the current text from the
     17        iterator
     18        (-[WebTextIterator atEnd]): Indicated whether the iterator has
     19        reached the end of the range.
     20        * WebView/WebView.h:
     21        * WebView/WebView.mm:
     22        (-[WebView textIteratorForRect:]): Returns a WebTextIterator with
     23        the DOMRange contained in the rectangle given as a parameter.
     24
    1252008-10-15  Timothy Hatcher  <timothy@apple.com>
    226
  • trunk/WebKit/mac/WebView/WebView.mm

    r37606 r37611  
    8585#import "WebPreferenceKeysPrivate.h"
    8686#import "WebPreferencesPrivate.h"
     87#import "WebTextIterator.h"
    8788#import "WebUIDelegate.h"
    8889#import "WebUIDelegatePrivate.h"
     
    19351936}
    19361937
     1938- (WebTextIterator *)textIteratorForRect:(NSRect)rect
     1939{
     1940    IntPoint rectStart(rect.origin.x, rect.origin.y);
     1941    IntPoint rectEnd(rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
     1942   
     1943    Frame* coreFrame = core([self mainFrame]);
     1944    if (!coreFrame)
     1945        return nil;
     1946   
     1947    Selection selectionInsideRect(coreFrame->visiblePositionForPoint(rectStart), coreFrame->visiblePositionForPoint(rectEnd));
     1948   
     1949    return [[[WebTextIterator alloc] initWithRange:[DOMRange _wrapRange:selectionInsideRect.toRange().get()]] autorelease];
     1950}
     1951
    19371952- (void)handleAuthenticationForResource:(id)identifier challenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource
    19381953{
  • trunk/WebKit/mac/WebView/WebViewPrivate.h

    r37606 r37611  
    4646@class WebInspector;
    4747@class WebPreferences;
     48@class WebTextIterator;
    4849
    4950@protocol WebFormDelegate;
     
    362363- (void)setUsesPageCache:(BOOL)usesPageCache;
    363364
     365/*!
     366 @method textIteratorForRect:
     367 @param rectangle from which we want the WebTextIterator to load text from
     368 @result a WebtextIterator object.
     369 */
     370- (WebTextIterator *)textIteratorForRect:(NSRect)rect;
     371
    364372#if ENABLE_DASHBOARD_SUPPORT
    365373// <rdar://problem/5217124> Clients other than dashboard, don't use this.
Note: See TracChangeset for help on using the changeset viewer.