WebCore:
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Oct 2006 01:01:01 +0000 (01:01 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Oct 2006 01:01:01 +0000 (01:01 +0000)
        Reviewed by Darin.

        Removed a number of editing and selection methods from the bridge.

        I moved cross-platform editing and selection code into Editor and
        SelectionController, respecitvely.

        I moved ObjC and AppKit stuff up into WebKit, so I ended up exporting
        everything + the kitchen sink.

        Specific comments below for interesting things.

        * bindings/objc/DOMInternal.h: Moved exception handling helper methods into
        a new file so that WebKit can use them, too. Added a helper method for
        handling exceptions when selecting a Range.
        * bridge/mac/FrameMac.h: Moved attributedString creation and helper functions into
        WebKit, since they have to do with creating an NSAttributedString for API
        consumption, and not much to do with general Frame functionality.
        * editing/Editor.h: Moved lastEditCommand tracking (at least the data,
        for now) into the Editor. Eventually, the Frame will not have to notify
        the Editor of what the lastEditCommand was, since the Editor will perform
        all EditCommands.
        * editing/SelectionController.h: The code here is just stuff moved from the bridge.
        * editing/SelectionController.cpp:
        (WebCore::SelectionController::setSelectedRange): We now explicitly check from DOM exceptions
        and return them. The bridge method to select a DOM range did this implicitly,
        since all ObjC DOM operations handle DOM exceptions by throwing them as
        ObjC exceptions.
        * editing/TextAffinity.h: Added helper functions for conversion to NSSelectionAffinity.
        The two enumerations are numerically identical, but that's an implementation
        detail of TextAffinity that clients shouldn't be required to know about.

WebKit:

        Reviewed by Darin.

        Removed a number of editing and selection methods from the bridge.

        I moved cross-platform editing and selection code into WebCore::Editor and
        WebCore::SelectionController, respecitvely.

        All of the seemingly new code here is just code grabbed from WebCore or
        merged from WebCoreFrameBridge.

        I changed one piece of internal API: we now pass around Ranges in places
        where we used to pass around broken out components of Ranges.

        I also added WebCore XPATH_SUPPORT AND SVG_SUPPORT #defines to the project.
        Since we now include WebCore headers that depend on these #defines, we need
        to keep in sync with them, to avoid binary incompatibility.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17455 268f45cc-cd09-0410-ab3c-d52691b4dbfc

34 files changed:
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/objc/DOM.mm
WebCore/bindings/objc/DOMInternal.h
WebCore/bindings/objc/DOMInternal.mm
WebCore/bindings/objc/ExceptionHandlers.h [new file with mode: 0644]
WebCore/bindings/objc/ExceptionHandlers.mm [new file with mode: 0644]
WebCore/bindings/scripts/CodeGeneratorObjC.pm
WebCore/bridge/mac/FrameMac.h
WebCore/bridge/mac/FrameMac.mm
WebCore/bridge/mac/WebCoreFrameBridge.h
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/editing/CommandByName.cpp
WebCore/editing/Editor.cpp
WebCore/editing/Editor.h
WebCore/editing/JSEditor.cpp
WebCore/editing/SelectionController.cpp
WebCore/editing/SelectionController.h
WebCore/editing/TextAffinity.h
WebCore/editing/TypingCommand.cpp
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FramePrivate.h
WebCore/rendering/HitTestResult.cpp
WebCore/rendering/RenderBox.h
WebKit/ChangeLog
WebKit/Misc/WebNSAttributedStringExtras.h
WebKit/Misc/WebNSAttributedStringExtras.m
WebKit/WebCoreSupport/WebFrameBridge.mm
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/WebView/WebHTMLRepresentation.m
WebKit/WebView/WebHTMLView.m
WebKit/WebView/WebView.mm

index 95fbbce0121b527a672a68e6c36781be9ad70b7a..74e5107753169f2aa2ba5e362d86227f0994d792 100644 (file)
@@ -1,3 +1,37 @@
+2006-10-30  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Darin.
+
+        Removed a number of editing and selection methods from the bridge.
+        
+        I moved cross-platform editing and selection code into Editor and 
+        SelectionController, respecitvely.
+
+        I moved ObjC and AppKit stuff up into WebKit, so I ended up exporting
+        everything + the kitchen sink.
+        
+        Specific comments below for interesting things.
+        
+        * bindings/objc/DOMInternal.h: Moved exception handling helper methods into
+        a new file so that WebKit can use them, too. Added a helper method for
+        handling exceptions when selecting a Range.
+        * bridge/mac/FrameMac.h: Moved attributedString creation and helper functions into 
+        WebKit, since they have to do with creating an NSAttributedString for API
+        consumption, and not much to do with general Frame functionality.
+        * editing/Editor.h: Moved lastEditCommand tracking (at least the data,
+        for now) into the Editor. Eventually, the Frame will not have to notify 
+        the Editor of what the lastEditCommand was, since the Editor will perform
+        all EditCommands.
+        * editing/SelectionController.h: The code here is just stuff moved from the bridge.
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::setSelectedRange): We now explicitly check from DOM exceptions
+        and return them. The bridge method to select a DOM range did this implicitly,
+        since all ObjC DOM operations handle DOM exceptions by throwing them as
+        ObjC exceptions.
+        * editing/TextAffinity.h: Added helper functions for conversion to NSSelectionAffinity.
+        The two enumerations are numerically identical, but that's an implementation
+        detail of TextAffinity that clients shouldn't be required to know about.
+
 2006-10-30  Timothy Hatcher  <timothy@apple.com>
 
         Rolling out the following change because this crash:
index 88e5d24e9225875491e0b50789acc27f78f0f95d..bc6e4e244b0dc8edb7e1a1ce0e557567a68f75ed 100644 (file)
@@ -129,6 +129,7 @@ _WebCoreSetAlwaysUseATSU
 _WebCoreSetShouldUseFontSmoothing
 _WebCoreShouldUseFontSmoothing
 _WebCoreTextFloatWidth
+__Z26ReportBlockedObjCExceptionP11NSException
 __ZN7WebCore10StringImplD1Ev
 __ZN7WebCore11FrameLoader11stopLoadingEP7NSError
 __ZN7WebCore11FrameLoader11stopLoadingEv
@@ -157,6 +158,7 @@ __ZN7WebCore11FrameLoader7canLoadEP5NSURLRKNS_6StringERb
 __ZN7WebCore11FrameLoader8safeLoadEP5NSURL
 __ZN7WebCore11FrameLoader9setClientEPNS_17FrameLoaderClientE
 __ZN7WebCore11RenderLayer18gAlignCenterAlwaysE
+__ZN7WebCore11selectRangeEPNS_19SelectionControllerEPNS_5RangeENS_9EAffinityEb
 __ZN7WebCore12AtomicString3addEPNS_10StringImplE
 __ZN7WebCore13HitTestResultC1ERKNS_8IntPointEbbb
 __ZN7WebCore13HitTestResultC1ERKS0_
@@ -171,18 +173,29 @@ __ZN7WebCore14DocumentLoader32replaceRequestURLForAnchorScrollEP5NSURL
 __ZN7WebCore14DocumentLoader7requestEv
 __ZN7WebCore14DocumentLoaderC2EP12NSURLRequest
 __ZN7WebCore14DocumentLoaderD2Ev
+__ZN7WebCore14RenderListItem17markerStringValueEv
 __ZN7WebCore14ResourceLoader14cancelledErrorEv
 __ZN7WebCore14ResourceLoader20inConnectionCallbackEv
+__ZN7WebCore16DeprecatedString6appendENS_14DeprecatedCharE
+__ZN7WebCore16DeprecatedString6appendERKS0_
+__ZN7WebCore16DeprecatedString6appendEc
+__ZN7WebCore16DeprecatedString7replaceENS_14DeprecatedCharES1_
+__ZN7WebCore16DeprecatedStringC1EPKc
+__ZN7WebCore16DeprecatedStringC1Ev
 __ZN7WebCore16DeprecatedStringD1Ev
 __ZN7WebCore17FrameLoaderClientD2Ev
 __ZN7WebCore19SelectionController5clearEv
+__ZN7WebCore19SelectionController9selectAllEv
 __ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
 __ZN7WebCore26NetscapePlugInStreamLoader6createEPNS_5FrameEP11objc_object
 __ZN7WebCore4KURLC1EP5NSURL
+__ZN7WebCore4KURLC1ERKNS_16DeprecatedStringE
 __ZN7WebCore4Page16setDefersLoadingEb
 __ZN7WebCore5Frame11clearTimersEv
+__ZN7WebCore5Frame11completeURLERKNS_16DeprecatedStringE
 __ZN7WebCore5Frame11setSettingsEPNS_8SettingsE
 __ZN7WebCore5Frame12canCachePageEv
+__ZN7WebCore5Frame12hasSelectionEv
 __ZN7WebCore5Frame12ownerElementEv
 __ZN7WebCore5Frame13pauseTimeoutsEv
 __ZN7WebCore5Frame14scrollToAnchorERKNS_4KURLE
@@ -196,11 +209,17 @@ __ZN7WebCore5Frame23saveInterpreterBuiltinsERN3KJS13SavedBuiltinsE
 __ZN7WebCore5Frame26isSelectionInPasswordFieldEv
 __ZN7WebCore5Frame6indentEv
 __ZN7WebCore5Frame7outdentEv
+__ZN7WebCore5Image21getTIFFRepresentationEv
+__ZN7WebCore5RangeC1EPNS_8DocumentEPNS_4NodeEiS4_i
 __ZN7WebCore5RangeD1Ev
+__ZN7WebCore6Editor30deleteSelectionWithSmartDeleteEb
 __ZN7WebCore6StringC1EP8NSString
 __ZN7WebCore6StringC1EP8NSString
 __ZN7WebCore6StringC1EPKc
 __ZN7WebCore7nsColorERKNS_5ColorE
+__ZN7WebCore7nsColorERKNS_5ColorE
+__ZN7WebCore8Document11completeURLERKNS_16DeprecatedStringE
+__ZN7WebCore8Document12setFocusNodeEN3WTF10PassRefPtrINS_4NodeEEE
 __ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
 __ZN7WebCore8Document4bodyEv
 __ZN7WebCore8FrameMac10mouseMovedEP7NSEvent
@@ -222,9 +241,37 @@ __ZN7WebCore8FrameMac7mouseUpEP7NSEvent
 __ZN7WebCore8FrameMac8keyEventEP7NSEvent
 __ZN7WebCore8FrameMac9mouseDownEP7NSEvent
 __ZN7WebCore8IntPointC1ERK8_NSPoint
+__ZN7WebCore8parseURLERKNS_6StringE
 __ZN7WebCore9FrameTree11appendChildEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore9FrameTree7setNameERKNS_12AtomicStringE
+__ZN7WebCore9HTMLNames10listingTagE
+__ZN7WebCore9HTMLNames13blockquoteTagE
+__ZN7WebCore9HTMLNames4aTagE
+__ZN7WebCore9HTMLNames4pTagE
+__ZN7WebCore9HTMLNames5brTagE
+__ZN7WebCore9HTMLNames5ddTagE
+__ZN7WebCore9HTMLNames5dlTagE
+__ZN7WebCore9HTMLNames5dtTagE
+__ZN7WebCore9HTMLNames5h1TagE
+__ZN7WebCore9HTMLNames5h2TagE
+__ZN7WebCore9HTMLNames5h3TagE
+__ZN7WebCore9HTMLNames5h4TagE
+__ZN7WebCore9HTMLNames5h5TagE
+__ZN7WebCore9HTMLNames5h6TagE
+__ZN7WebCore9HTMLNames5hrTagE
+__ZN7WebCore9HTMLNames5liTagE
+__ZN7WebCore9HTMLNames5olTagE
+__ZN7WebCore9HTMLNames5tdTagE
+__ZN7WebCore9HTMLNames5thTagE
+__ZN7WebCore9HTMLNames5trTagE
+__ZN7WebCore9HTMLNames5ulTagE
+__ZN7WebCore9HTMLNames6divTagE
+__ZN7WebCore9HTMLNames6imgTagE
+__ZN7WebCore9HTMLNames6preTagE
+__ZN7WebCore9HTMLNames7srcAttrE
+__ZN7WebCore9HTMLNames8hrefAttrE
 __ZN7WebCore9PageState5clearEv
+__ZN7WebCore9Selection22expandUsingGranularityENS_15TextGranularityE
 __ZN7WebCore9TimerBase4stopEv
 __ZN7WebCore9TimerBase5startEdd
 __ZN7WebCore9TimerBaseC2Ev
@@ -232,6 +279,7 @@ __ZN7WebCore9TimerBaseD2Ev
 __ZNK7WebCore10StringImplcvP8NSStringEv
 __ZNK7WebCore10StringImplcvP8NSStringEv
 __ZNK7WebCore10StringImplcvP8NSStringEv
+__ZNK7WebCore11CachedImage5imageEv
 __ZNK7WebCore11FrameLoader14documentLoaderEv
 __ZNK7WebCore11FrameLoader15firstLayoutDoneEv
 __ZNK7WebCore11FrameLoader20activeDocumentLoaderEv
@@ -239,6 +287,8 @@ __ZNK7WebCore11FrameLoader21isQuickRedirectComingEv
 __ZNK7WebCore11FrameLoader27numPendingOrLoadingRequestsEb
 __ZNK7WebCore11FrameLoader6clientEv
 __ZNK7WebCore11FrameLoader8loadTypeEv
+__ZNK7WebCore12AtomicString16deprecatedStringEv
+__ZNK7WebCore12RenderObject25backslashAsCurrencySymbolEv
 __ZNK7WebCore13HitTestResult10isSelectedEv
 __ZNK7WebCore13HitTestResult11boundingBoxEv
 __ZNK7WebCore13HitTestResult11targetFrameEv
@@ -260,7 +310,12 @@ __ZNK7WebCore14DocumentLoader5titleEv
 __ZNK7WebCore14DocumentLoader8responseEv
 __ZNK7WebCore14DocumentLoader9isLoadingEv
 __ZNK7WebCore14ResourceLoader11frameLoaderEv
+__ZNK7WebCore16DeprecatedString11getNSStringEv
+__ZNK7WebCore16DeprecatedString2atEj
+__ZNK7WebCore16DeprecatedString3midEjj
 __ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv
+__ZNK7WebCore4Font11primaryFontEv
+__ZNK7WebCore4KURL8getNSURLEv
 __ZNK7WebCore4Page14frameNamespaceEv
 __ZNK7WebCore4Page19dragCaretControllerEv
 __ZNK7WebCore5Frame10isFrameSetEv
@@ -276,13 +331,24 @@ __ZNK7WebCore5Frame33removeEditingStyleFromBodyElementEv
 __ZNK7WebCore5Frame3urlEv
 __ZNK7WebCore5Frame4pageEv
 __ZNK7WebCore5Frame4treeEv
+__ZNK7WebCore5Frame6editorEv
 __ZNK7WebCore5Frame6loaderEv
 __ZNK7WebCore5Frame8documentEv
 __ZNK7WebCore5Frame8referrerEv
 __ZNK7WebCore5Frame8rendererEv
+__ZNK7WebCore5Range11pastEndNodeEv
+__ZNK7WebCore5Range11startOffsetERi
+__ZNK7WebCore5Range12endContainerERi
+__ZNK7WebCore5Range19boundaryPointsValidEv
+__ZNK7WebCore5Range9endOffsetERi
+__ZNK7WebCore5Range9startNodeEv
+__ZNK7WebCore6String16deprecatedStringEv
+__ZNK7WebCore6String7isEmptyEv
+__ZNK7WebCore7Element12getAttributeERKNS_13QualifiedNameE
 __ZNK7WebCore7IntRectcv6CGRectEv
 __ZNK7WebCore7IntRectcv7_NSRectEv
 __ZNK7WebCore7IntRectcv7_NSRectEv
+__ZNK7WebCore8Document5frameEv
 __ZNK7WebCore8FrameMac14selectionImageEb
 __ZNK7WebCore8FrameMac17eventMayStartDragEP7NSEvent
 __ZNK7WebCore8FrameMac31fontAttributesForSelectionStartEv
index 53356ea2bda0702e752f46c25e8c585e2c5e85bb..4fd5c97c9fd3600d8f573c348e9ffb6036842bf7 100644 (file)
@@ -40,6 +40,9 @@
                14115B7309F84CD600CA4FC1 /* JSNodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 14115B7109F84CD600CA4FC1 /* JSNodeFilter.h */; };
                142011B60A003133008303F9 /* JSCSSStyleDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 142011B40A003133008303F9 /* JSCSSStyleDeclaration.cpp */; };
                142011B70A003133008303F9 /* JSCSSStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 142011B50A003133008303F9 /* JSCSSStyleDeclaration.h */; };
+               148A00110AF59F3F008CC700 /* FontPlatformData.h in Headers */ = {isa = PBXBuildFile; fileRef = 148A00100AF59F3F008CC700 /* FontPlatformData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               148AFDA50AF58360008CC700 /* ExceptionHandlers.h in Headers */ = {isa = PBXBuildFile; fileRef = 148AFDA30AF58360008CC700 /* ExceptionHandlers.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               148AFDA60AF58360008CC700 /* ExceptionHandlers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 148AFDA40AF58360008CC700 /* ExceptionHandlers.mm */; };
                14CF78A409F58CBF00EB3665 /* JSCSSValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14CF78A309F58CBF00EB3665 /* JSCSSValue.cpp */; };
                14CF78A609F58CD800EB3665 /* JSCSSValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CF78A509F58CD800EB3665 /* JSCSSValue.h */; };
                14CF7B3309F6ECD700EB3665 /* JSCSSRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14CF7B3109F6ECD700EB3665 /* JSCSSRule.cpp */; };
                4B3043C70AE0370300A82647 /* Sound.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3043C60AE0370300A82647 /* Sound.h */; };
                4B3043C90AE0371D00A82647 /* SoundMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3043C80AE0371D00A82647 /* SoundMac.mm */; };
                4B3043CC0AE0373B00A82647 /* Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3043CA0AE0373B00A82647 /* Editor.cpp */; };
-               4B3043CD0AE0373B00A82647 /* Editor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3043CB0AE0373B00A82647 /* Editor.h */; };
+               4B3043CD0AE0373B00A82647 /* Editor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3043CB0AE0373B00A82647 /* Editor.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4BBDBF7D0ACC9290005F6E97 /* CommandByName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBDBF7B0ACC9290005F6E97 /* CommandByName.cpp */; };
                4BBDBF7E0ACC9290005F6E97 /* CommandByName.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBDBF7C0ACC9290005F6E97 /* CommandByName.h */; };
                4E1959210A39DABA00220FE5 /* MediaFeatureNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4E19591F0A39DABA00220FE5 /* MediaFeatureNames.cpp */; };
                6550B69D099DF0270090D781 /* CDATASection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B693099DF0270090D781 /* CDATASection.cpp */; };
                6550B69E099DF0270090D781 /* CDATASection.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B694099DF0270090D781 /* CDATASection.h */; };
                6550B69F099DF0270090D781 /* CharacterData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B695099DF0270090D781 /* CharacterData.cpp */; };
-               6550B6A0099DF0270090D781 /* CharacterData.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B696099DF0270090D781 /* CharacterData.h */; };
+               6550B6A0099DF0270090D781 /* CharacterData.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B696099DF0270090D781 /* CharacterData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6550B6A1099DF0270090D781 /* Comment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B697099DF0270090D781 /* Comment.cpp */; };
                6550B6A2099DF0270090D781 /* Comment.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B698099DF0270090D781 /* Comment.h */; };
                6550B6A3099DF0270090D781 /* EditingText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B699099DF0270090D781 /* EditingText.cpp */; };
                6550B6A4099DF0270090D781 /* EditingText.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B69A099DF0270090D781 /* EditingText.h */; };
                6550B6A5099DF0270090D781 /* Text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B69B099DF0270090D781 /* Text.cpp */; };
-               6550B6A6099DF0270090D781 /* Text.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B69C099DF0270090D781 /* Text.h */; };
+               6550B6A6099DF0270090D781 /* Text.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B69C099DF0270090D781 /* Text.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6552E7AA096AA11B0006F248 /* WebCoreFrameNamespaces.h in Headers */ = {isa = PBXBuildFile; fileRef = 6552E7A8096AA11B0006F248 /* WebCoreFrameNamespaces.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6552E7AB096AA11B0006F248 /* WebCoreFrameNamespaces.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6552E7A9096AA11B0006F248 /* WebCoreFrameNamespaces.mm */; };
                655A81BE0AEF67E6000975F0 /* HTTPHeaderMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 655A81BD0AEF67E6000975F0 /* HTTPHeaderMap.h */; };
                6565820209D1508D000E61D7 /* XLinkNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581EB09D1508D000E61D7 /* XLinkNames.h */; };
                6565821309D15111000E61D7 /* ksvgcssvalues.h in Headers */ = {isa = PBXBuildFile; fileRef = 6565820F09D15111000E61D7 /* ksvgcssvalues.h */; };
                656B84E00AEA1D3100A095B4 /* ResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656B84DC0AEA1D3100A095B4 /* ResourceHandle.cpp */; };
-               656B84E20AEA1D3100A095B4 /* ResourceHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 656B84DE0AEA1D3100A095B4 /* ResourceHandleClient.h */; };
+               656B84E20AEA1D3100A095B4 /* ResourceHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 656B84DE0AEA1D3100A095B4 /* ResourceHandleClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                656B84E30AEA1D3100A095B4 /* ResourceHandleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 656B84DF0AEA1D3100A095B4 /* ResourceHandleInternal.h */; };
                656B84EB0AEA1DDA00A095B4 /* ResourceHandleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 656B84EA0AEA1DDA00A095B4 /* ResourceHandleMac.mm */; };
                656B85380AEA1F9A00A095B4 /* ResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 656B85370AEA1F9A00A095B4 /* ResourceHandle.h */; };
                85E9E0A80AB3A11900069CD0 /* DOMXPathExpression.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85E9E09B0AB3A0C700069CD0 /* DOMXPathExpression.h */; };
                85E9E0AA0AB3A11900069CD0 /* DOMXPathNSResolver.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85E9E09E0AB3A0C700069CD0 /* DOMXPathNSResolver.h */; };
                85E9E0AB0AB3A11900069CD0 /* DOMXPathResult.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85E9E09F0AB3A0C700069CD0 /* DOMXPathResult.h */; };
-               85EC9AFA0A71A2C600EEEAED /* FontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 85EC9AF80A71A2C600EEEAED /* FontData.h */; };
+               85EC9AFA0A71A2C600EEEAED /* FontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 85EC9AF80A71A2C600EEEAED /* FontData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                85EC9AFB0A71A2C600EEEAED /* Language.h in Headers */ = {isa = PBXBuildFile; fileRef = 85EC9AF90A71A2C600EEEAED /* Language.h */; };
                85ECBEEB0AA7626900544F0B /* DOMHTMLAreaElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 85ECBEDD0AA7626800544F0B /* DOMHTMLAreaElement.h */; };
                85ECBEEC0AA7626900544F0B /* DOMHTMLAreaElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85ECBEDE0AA7626800544F0B /* DOMHTMLAreaElement.mm */; };
                85FF315A0AAFBFCB00374F38 /* DOMKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */; };
                85FF315B0AAFBFCB00374F38 /* DOMKeyboardEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */; };
                93032CC809AEC34300F82A18 /* PathCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93032CC709AEC34300F82A18 /* PathCG.cpp */; };
-               93032CCA09AEC34B00F82A18 /* Path.h in Headers */ = {isa = PBXBuildFile; fileRef = 93032CC909AEC34B00F82A18 /* Path.h */; };
+               93032CCA09AEC34B00F82A18 /* Path.h in Headers */ = {isa = PBXBuildFile; fileRef = 93032CC909AEC34B00F82A18 /* Path.h */; settings = {ATTRIBUTES = (Private, ); }; };
                930500200AF025D300FFF491 /* ClipboardAccessPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 9305001F0AF025D300FFF491 /* ClipboardAccessPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9305B24D098F1B6B00C28855 /* Timer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9305B24C098F1B6B00C28855 /* Timer.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               9307056C09E0AF8F00B17FE4 /* csshelper.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4786097CAAC80094C9E4 /* csshelper.h */; };
+               9307056C09E0AF8F00B17FE4 /* csshelper.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4786097CAAC80094C9E4 /* csshelper.h */; settings = {ATTRIBUTES = (Private, ); }; };
                930705D809E0C9B700B17FE4 /* JSCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930705D709E0C9B700B17FE4 /* JSCounter.cpp */; };
                930705DA09E0C9BF00B17FE4 /* JSCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 930705D909E0C9BF00B17FE4 /* JSCounter.h */; };
                930705E909E0C9F000B17FE4 /* JSCSSPrimitiveValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930705E809E0C9F000B17FE4 /* JSCSSPrimitiveValue.cpp */; };
                935C477009AC4D7300A6AAB4 /* KeyEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 935C476E09AC4D7300A6AAB4 /* KeyEventMac.mm */; };
                935C477109AC4D7300A6AAB4 /* PlatformMouseEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */; };
                935C477309AC4D7700A6AAB4 /* WheelEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 935C477209AC4D7700A6AAB4 /* WheelEventMac.mm */; };
-               935C477509AC4D8E00A6AAB4 /* GapRects.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C477409AC4D8D00A6AAB4 /* GapRects.h */; };
+               935C477509AC4D8E00A6AAB4 /* GapRects.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C477409AC4D8D00A6AAB4 /* GapRects.h */; settings = {ATTRIBUTES = (Private, ); }; };
                935FBC4509BA00B900E230B1 /* EventListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 935FBC4409BA00B900E230B1 /* EventListener.h */; };
                935FBCF209BA143B00E230B1 /* ExceptionCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 935FBCF109BA143B00E230B1 /* ExceptionCode.h */; };
                936B424E09A436CD00BAA820 /* SVGCSSParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F6F6089701F100BA5114 /* SVGCSSParser.cpp */; };
                93F1992908245E59001E9ABC /* DeprecatedCString.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868302DE3B8601EA4122 /* DeprecatedCString.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F1992F08245E59001E9ABC /* Cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868402DE3B8601EA4122 /* Cursor.h */; };
                93F1994F08245E59001E9ABC /* Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = F587863A02DE3A1401EA4122 /* Settings.h */; };
-               93F1995008245E59001E9ABC /* CachePolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F587864902DE3A9A01EA4122 /* CachePolicy.h */; };
+               93F1995008245E59001E9ABC /* CachePolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F587864902DE3A9A01EA4122 /* CachePolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F1996308245E59001E9ABC /* SSLKeyGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = F587866202DE3B1101EA4122 /* SSLKeyGenerator.h */; };
                93F1996B08245E59001E9ABC /* TextField.h in Headers */ = {isa = PBXBuildFile; fileRef = F587869802DE3B8601EA4122 /* TextField.h */; };
                93F1996C08245E59001E9ABC /* ListBox.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851302DE375901EA4122 /* ListBox.h */; };
                93F199BB08245E59001E9ABC /* WebCoreKeyboardAccess.h in Headers */ = {isa = PBXBuildFile; fileRef = BE983D95052A2E0A00892D85 /* WebCoreKeyboardAccess.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199BC08245E59001E9ABC /* WebCoreAXObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 55998A5A052B59CC0017A6C1 /* WebCoreAXObject.h */; };
                93F199BD08245E59001E9ABC /* AXObjectCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 55998A5C052B59CC0017A6C1 /* AXObjectCache.h */; };
-               93F199BE08245E59001E9ABC /* BlockExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A640F00533BB1F0085E777 /* BlockExceptions.h */; settings = {ATTRIBUTES = (); }; };
+               93F199BE08245E59001E9ABC /* BlockExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A640F00533BB1F0085E777 /* BlockExceptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199C208245E59001E9ABC /* WebCoreKeyGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199CF08245E59001E9ABC /* AtomicStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3B364705C9D5E200E42902 /* AtomicStringList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199D508245E59001E9ABC /* WebCoreEditCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = BEF7EEA005FF8F0D009717EE /* WebCoreEditCommand.h */; };
                A871DED60A1530C700B12A68 /* RenderPartObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DECE0A1530C700B12A68 /* RenderPartObject.cpp */; };
                A871DED70A1530C700B12A68 /* RenderPart.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DECF0A1530C700B12A68 /* RenderPart.h */; };
                A871DFE20A15376B00B12A68 /* RenderReplaced.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DFDE0A15376B00B12A68 /* RenderReplaced.cpp */; };
-               A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFDF0A15376B00B12A68 /* RenderReplaced.h */; };
+               A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFDF0A15376B00B12A68 /* RenderReplaced.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A871DFE40A15376B00B12A68 /* RenderWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFE00A15376B00B12A68 /* RenderWidget.h */; };
                A871DFE50A15376B00B12A68 /* RenderWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DFE10A15376B00B12A68 /* RenderWidget.cpp */; };
                A88AD3860952486D001DD196 /* KRenderingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB54089701F700BA5114 /* KRenderingDevice.cpp */; };
                A88AD3CB0952486E001DD196 /* KCanvasTreeDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = A810E39308A4160F00333D98 /* KCanvasTreeDebug.h */; };
                A88AD3CC0952486E001DD196 /* KCanvasTreeDebug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A810E39408A4160F00333D98 /* KCanvasTreeDebug.cpp */; };
                A88AD401095248F0001DD196 /* SVGRenderStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F6FF089701F100BA5114 /* SVGRenderStyle.cpp */; };
-               A88AD402095248F0001DD196 /* SVGRenderStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F700089701F100BA5114 /* SVGRenderStyle.h */; };
+               A88AD402095248F0001DD196 /* SVGRenderStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F700089701F100BA5114 /* SVGRenderStyle.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A88AD403095248F0001DD196 /* SVGRenderStyleDefs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F701089701F100BA5114 /* SVGRenderStyleDefs.cpp */; };
-               A88AD404095248F0001DD196 /* SVGRenderStyleDefs.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F702089701F100BA5114 /* SVGRenderStyleDefs.h */; };
+               A88AD404095248F0001DD196 /* SVGRenderStyleDefs.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F702089701F100BA5114 /* SVGRenderStyleDefs.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A88AD40A095248F0001DD196 /* SVGZoomEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F7F5089701F300BA5114 /* SVGZoomEvent.cpp */; };
                A88AD40B095248F0001DD196 /* SVGZoomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F7F6089701F300BA5114 /* SVGZoomEvent.h */; };
                A88AD40C095248F0001DD196 /* KCanvasRenderingStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F6EB089701F100BA5114 /* KCanvasRenderingStyle.cpp */; };
                A88AD43F095248F0001DD196 /* SVGClipPathElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F82D089701F300BA5114 /* SVGClipPathElement.cpp */; };
                A88AD440095248F0001DD196 /* SVGClipPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F82E089701F300BA5114 /* SVGClipPathElement.h */; };
                A88AD441095248F0001DD196 /* SVGColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F82F089701F300BA5114 /* SVGColor.cpp */; };
-               A88AD442095248F0001DD196 /* SVGColor.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F830089701F300BA5114 /* SVGColor.h */; };
+               A88AD442095248F0001DD196 /* SVGColor.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F830089701F300BA5114 /* SVGColor.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A88AD443095248F0001DD196 /* SVGComponentTransferFunctionElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F831089701F300BA5114 /* SVGComponentTransferFunctionElement.cpp */; };
                A88AD444095248F0001DD196 /* SVGComponentTransferFunctionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F832089701F300BA5114 /* SVGComponentTransferFunctionElement.h */; };
                A88AD445095248F0001DD196 /* SVGCursorElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A82FC33B08CBB07C00EFEE23 /* SVGCursorElement.h */; };
                A88AD4A6095248F0001DD196 /* SVGNumberList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F888089701F300BA5114 /* SVGNumberList.cpp */; };
                A88AD4A7095248F0001DD196 /* SVGNumberList.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F889089701F300BA5114 /* SVGNumberList.h */; };
                A88AD4A8095248F0001DD196 /* SVGPaint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F88A089701F300BA5114 /* SVGPaint.cpp */; };
-               A88AD4A9095248F0001DD196 /* SVGPaint.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F88B089701F300BA5114 /* SVGPaint.h */; };
+               A88AD4A9095248F0001DD196 /* SVGPaint.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F88B089701F300BA5114 /* SVGPaint.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A88AD4AA095248F0001DD196 /* SVGPathElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F88C089701F300BA5114 /* SVGPathElement.cpp */; };
                A88AD4AB095248F0001DD196 /* SVGPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F88D089701F300BA5114 /* SVGPathElement.h */; };
                A88AD4AC095248F0001DD196 /* svgpathparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F88E089701F300BA5114 /* svgpathparser.cpp */; };
                A8CFF04F0A154F09000A4234 /* FixedTableLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF04A0A154F09000A4234 /* FixedTableLayout.h */; };
                A8CFF0500A154F09000A4234 /* AutoTableLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8CFF04B0A154F09000A4234 /* AutoTableLayout.cpp */; };
                A8CFF0510A154F09000A4234 /* TableLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF04C0A154F09000A4234 /* TableLayout.h */; };
-               A8CFF5E10A155A05000A4234 /* RootInlineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF5DA0A155A05000A4234 /* RootInlineBox.h */; };
-               A8CFF5E20A155A05000A4234 /* InlineRunBox.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF5DB0A155A05000A4234 /* InlineRunBox.h */; };
-               A8CFF5E30A155A05000A4234 /* InlineFlowBox.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF5DC0A155A05000A4234 /* InlineFlowBox.h */; };
+               A8CFF5E10A155A05000A4234 /* RootInlineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF5DA0A155A05000A4234 /* RootInlineBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               A8CFF5E20A155A05000A4234 /* InlineRunBox.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF5DB0A155A05000A4234 /* InlineRunBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               A8CFF5E30A155A05000A4234 /* InlineFlowBox.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF5DC0A155A05000A4234 /* InlineFlowBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A8CFF5E40A155A05000A4234 /* InlineFlowBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8CFF5DD0A155A05000A4234 /* InlineFlowBox.cpp */; };
-               A8CFF5E50A155A05000A4234 /* InlineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF5DE0A155A05000A4234 /* InlineBox.h */; };
+               A8CFF5E50A155A05000A4234 /* InlineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF5DE0A155A05000A4234 /* InlineBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A8CFF5E60A155A05000A4234 /* InlineBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8CFF5DF0A155A05000A4234 /* InlineBox.cpp */; };
                A8CFF5E70A155A05000A4234 /* RootInlineBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8CFF5E00A155A05000A4234 /* RootInlineBox.cpp */; };
                A8CFF6BE0A156118000A4234 /* EllipsisBox.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF6BD0A156118000A4234 /* EllipsisBox.h */; };
                A8D064FB0A23C0CC005E7203 /* JSHTMLFormElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8D064F90A23C0CC005E7203 /* JSHTMLFormElement.cpp */; };
                A8D064FC0A23C0CC005E7203 /* JSHTMLFormElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8D064FA0A23C0CC005E7203 /* JSHTMLFormElement.h */; };
                A8D065AE0A2446CD005E7203 /* JSHTMLFormElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8D065AD0A2446CD005E7203 /* JSHTMLFormElementCustom.cpp */; };
-               A8D06B390A265DCD005E7203 /* HTMLNames.h in Headers */ = {isa = PBXBuildFile; fileRef = A8D06B370A265DCD005E7203 /* HTMLNames.h */; };
+               A8D06B390A265DCD005E7203 /* HTMLNames.h in Headers */ = {isa = PBXBuildFile; fileRef = A8D06B370A265DCD005E7203 /* HTMLNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A8D06B3A0A265DCD005E7203 /* HTMLNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8D06B380A265DCD005E7203 /* HTMLNames.cpp */; };
                A8DF3FCE097FA0FC0052981B /* HTMLFormCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = A8DF3FC6097FA0FB0052981B /* HTMLFormCollection.h */; };
                A8DF3FCF097FA0FC0052981B /* HTMLFormCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8DF3FC7097FA0FB0052981B /* HTMLFormCollection.cpp */; };
                A8EA7A4F0A191A5200A8EF5F /* ListMarkerBox.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7A490A191A5200A8EF5F /* ListMarkerBox.h */; };
                A8EA7A500A191A5200A8EF5F /* RenderListMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7A4A0A191A5200A8EF5F /* RenderListMarker.h */; };
                A8EA7A510A191A5200A8EF5F /* RenderListMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA7A4B0A191A5200A8EF5F /* RenderListMarker.cpp */; };
-               A8EA7A520A191A5200A8EF5F /* RenderListItem.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7A4C0A191A5200A8EF5F /* RenderListItem.h */; };
+               A8EA7A520A191A5200A8EF5F /* RenderListItem.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7A4C0A191A5200A8EF5F /* RenderListItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A8EA7A530A191A5200A8EF5F /* ListMarkerBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA7A4D0A191A5200A8EF5F /* ListMarkerBox.cpp */; };
                A8EA7CAB0A192B9C00A8EF5F /* HTMLMarqueeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7C9D0A192B9C00A8EF5F /* HTMLMarqueeElement.h */; };
                A8EA7CAC0A192B9C00A8EF5F /* HTMLMarqueeElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA7C9E0A192B9C00A8EF5F /* HTMLMarqueeElement.cpp */; };
                BC6DABF30A19015700E5CD14 /* FontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6DABF20A19015700E5CD14 /* FontCache.cpp */; };
                BC6DADEF0A195FDF00E5CD14 /* WebFontCache.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6DADEE0A195FDF00E5CD14 /* WebFontCache.h */; };
                BC6DADFA0A19602B00E5CD14 /* WebFontCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC6DADF90A19602B00E5CD14 /* WebFontCache.mm */; };
-               BC6DB3690A1A7CB700E5CD14 /* GlyphMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6DB3680A1A7CB700E5CD14 /* GlyphMap.h */; };
+               BC6DB3690A1A7CB700E5CD14 /* GlyphMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6DB3680A1A7CB700E5CD14 /* GlyphMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC6DB4740A1A90FB00E5CD14 /* GlyphMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6DB4730A1A90FB00E5CD14 /* GlyphMap.cpp */; };
                BC6DB4D40A1AFEEF00E5CD14 /* GlyphMapMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6DB4D30A1AFEEF00E5CD14 /* GlyphMapMac.cpp */; };
                BC73E25D0978682700EDFF8A /* FloatSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC73E25B0978682700EDFF8A /* FloatSize.cpp */; };
                BC837CB60A9D10FE006B186A /* GraphicsContextPlatformPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC837CB50A9D10FE006B186A /* GraphicsContextPlatformPrivate.h */; };
                BC92F1DD0A40AEA300AC0746 /* DeprecatedSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC92F1DB0A40AEA300AC0746 /* DeprecatedSlider.cpp */; };
                BC92F1DE0A40AEA300AC0746 /* DeprecatedSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = BC92F1DC0A40AEA300AC0746 /* DeprecatedSlider.h */; };
-               BC9C328B09933A6E001D6924 /* ImageAnimationObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9C328A09933A6D001D6924 /* ImageAnimationObserver.h */; };
+               BC9C328B09933A6E001D6924 /* ImageAnimationObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9C328A09933A6D001D6924 /* ImageAnimationObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCAA90C30A7EBA60008B1229 /* ScrollBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCAA90C20A7EBA60008B1229 /* ScrollBar.cpp */; };
                BCB16AF90979A08500467741 /* FloatRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16AF50979A08500467741 /* FloatRect.cpp */; };
                BCB16AFA0979A08500467741 /* FloatRect.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16AF60979A08500467741 /* FloatRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCB16C190979C3BD00467741 /* CachedCSSStyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C000979C3BD00467741 /* CachedCSSStyleSheet.cpp */; };
                BCB16C1A0979C3BD00467741 /* CachedCSSStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C010979C3BD00467741 /* CachedCSSStyleSheet.h */; };
                BCB16C1B0979C3BD00467741 /* CachedImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C020979C3BD00467741 /* CachedImage.cpp */; };
-               BCB16C1C0979C3BD00467741 /* CachedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C030979C3BD00467741 /* CachedImage.h */; };
+               BCB16C1C0979C3BD00467741 /* CachedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C030979C3BD00467741 /* CachedImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCB16C1F0979C3BD00467741 /* CachedResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C060979C3BD00467741 /* CachedResource.cpp */; };
-               BCB16C200979C3BD00467741 /* CachedResource.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C070979C3BD00467741 /* CachedResource.h */; };
+               BCB16C200979C3BD00467741 /* CachedResource.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C070979C3BD00467741 /* CachedResource.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCB16C210979C3BD00467741 /* CachedResourceClientWalker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C080979C3BD00467741 /* CachedResourceClientWalker.cpp */; };
                BCB16C220979C3BD00467741 /* CachedResourceClientWalker.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C090979C3BD00467741 /* CachedResourceClientWalker.h */; };
                BCB16C230979C3BD00467741 /* CachedScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C0A0979C3BD00467741 /* CachedScript.cpp */; };
                BCB16C2F0979C3BD00467741 /* Request.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C160979C3BD00467741 /* Request.h */; };
                BCC088860A1BD78D006189A6 /* FontDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCC088850A1BD78D006189A6 /* FontDataMac.mm */; };
                BCC0891A0A1C4652006189A6 /* FontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC089190A1C4652006189A6 /* FontData.cpp */; };
-               BCC0892A0A1C4991006189A6 /* GlyphWidthMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC089290A1C4991006189A6 /* GlyphWidthMap.h */; };
+               BCC0892A0A1C4991006189A6 /* GlyphWidthMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC089290A1C4991006189A6 /* GlyphWidthMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCC089560A1C4CC9006189A6 /* GlyphWidthMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC089550A1C4CC9006189A6 /* GlyphWidthMap.cpp */; };
                BCC47E2609A3D6F100ADB771 /* FontFamily.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC47E2409A3D6F100ADB771 /* FontFamily.cpp */; };
                BCC47E2709A3D6F100ADB771 /* FontFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC47E2509A3D6F100ADB771 /* FontFamily.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA479D097CAAC80094C9E4 /* cssstyleselector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA478A097CAAC80094C9E4 /* cssstyleselector.cpp */; };
                BCEA479E097CAAC80094C9E4 /* cssstyleselector.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA478B097CAAC80094C9E4 /* cssstyleselector.h */; };
                BCEA4852097D93020094C9E4 /* bidi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4813097D93020094C9E4 /* bidi.cpp */; };
-               BCEA4853097D93020094C9E4 /* bidi.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4814097D93020094C9E4 /* bidi.h */; };
+               BCEA4853097D93020094C9E4 /* bidi.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4814097D93020094C9E4 /* bidi.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA4854097D93020094C9E4 /* break_lines.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4815097D93020094C9E4 /* break_lines.cpp */; };
                BCEA4855097D93020094C9E4 /* break_lines.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4816097D93020094C9E4 /* break_lines.h */; };
                BCEA4856097D93020094C9E4 /* DataRef.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4817097D93020094C9E4 /* DataRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA4859097D93020094C9E4 /* InlineTextBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA481A097D93020094C9E4 /* InlineTextBox.cpp */; };
-               BCEA485A097D93020094C9E4 /* InlineTextBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481B097D93020094C9E4 /* InlineTextBox.h */; };
+               BCEA485A097D93020094C9E4 /* InlineTextBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481B097D93020094C9E4 /* InlineTextBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA485B097D93020094C9E4 /* RenderApplet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA481C097D93020094C9E4 /* RenderApplet.cpp */; };
                BCEA485C097D93020094C9E4 /* RenderApplet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481D097D93020094C9E4 /* RenderApplet.h */; };
                BCEA485D097D93020094C9E4 /* RenderArena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA481E097D93020094C9E4 /* RenderArena.cpp */; };
                BCEA485E097D93020094C9E4 /* RenderArena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481F097D93020094C9E4 /* RenderArena.h */; };
                BCEA485F097D93020094C9E4 /* RenderBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4820097D93020094C9E4 /* RenderBlock.cpp */; };
-               BCEA4860097D93020094C9E4 /* RenderBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4821097D93020094C9E4 /* RenderBlock.h */; };
+               BCEA4860097D93020094C9E4 /* RenderBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4821097D93020094C9E4 /* RenderBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA4861097D93020094C9E4 /* RenderBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4822097D93020094C9E4 /* RenderBox.cpp */; };
-               BCEA4862097D93020094C9E4 /* RenderBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4823097D93020094C9E4 /* RenderBox.h */; };
+               BCEA4862097D93020094C9E4 /* RenderBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4823097D93020094C9E4 /* RenderBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA4863097D93020094C9E4 /* RenderBR.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4824097D93020094C9E4 /* RenderBR.cpp */; };
                BCEA4864097D93020094C9E4 /* RenderBR.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4825097D93020094C9E4 /* RenderBR.h */; };
                BCEA4865097D93020094C9E4 /* RenderButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4826097D93020094C9E4 /* RenderButton.cpp */; };
                BCEA4869097D93020094C9E4 /* RenderHTMLCanvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA482A097D93020094C9E4 /* RenderHTMLCanvas.cpp */; };
                BCEA486A097D93020094C9E4 /* RenderHTMLCanvas.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA482B097D93020094C9E4 /* RenderHTMLCanvas.h */; };
                BCEA486B097D93020094C9E4 /* RenderContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA482C097D93020094C9E4 /* RenderContainer.cpp */; };
-               BCEA486C097D93020094C9E4 /* RenderContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA482D097D93020094C9E4 /* RenderContainer.h */; };
+               BCEA486C097D93020094C9E4 /* RenderContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA482D097D93020094C9E4 /* RenderContainer.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA486D097D93020094C9E4 /* RenderFlexibleBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA482E097D93020094C9E4 /* RenderFlexibleBox.cpp */; };
                BCEA486E097D93020094C9E4 /* RenderFlexibleBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA482F097D93020094C9E4 /* RenderFlexibleBox.h */; };
                BCEA486F097D93020094C9E4 /* RenderFlow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4830097D93020094C9E4 /* RenderFlow.cpp */; };
-               BCEA4870097D93020094C9E4 /* RenderFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4831097D93020094C9E4 /* RenderFlow.h */; };
+               BCEA4870097D93020094C9E4 /* RenderFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4831097D93020094C9E4 /* RenderFlow.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA4875097D93020094C9E4 /* RenderImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4836097D93020094C9E4 /* RenderImage.cpp */; };
-               BCEA4876097D93020094C9E4 /* RenderImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4837097D93020094C9E4 /* RenderImage.h */; };
+               BCEA4876097D93020094C9E4 /* RenderImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4837097D93020094C9E4 /* RenderImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA4877097D93020094C9E4 /* RenderInline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4838097D93020094C9E4 /* RenderInline.cpp */; };
                BCEA4878097D93020094C9E4 /* RenderInline.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4839097D93020094C9E4 /* RenderInline.h */; };
                BCEA4879097D93020094C9E4 /* RenderLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA483A097D93020094C9E4 /* RenderLayer.cpp */; };
                BCEA4889097D93020094C9E4 /* RenderTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA484A097D93020094C9E4 /* RenderTheme.cpp */; };
                BCEA488A097D93020094C9E4 /* RenderTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA484B097D93020094C9E4 /* RenderTheme.h */; };
                BCEA488B097D93020094C9E4 /* RenderText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA484C097D93020094C9E4 /* RenderText.cpp */; };
-               BCEA488C097D93020094C9E4 /* RenderText.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA484D097D93020094C9E4 /* RenderText.h */; };
+               BCEA488C097D93020094C9E4 /* RenderText.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA484D097D93020094C9E4 /* RenderText.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA488D097D93020094C9E4 /* RenderTextFragment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA484E097D93020094C9E4 /* RenderTextFragment.cpp */; };
                BCEA488E097D93020094C9E4 /* RenderTextFragment.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA484F097D93020094C9E4 /* RenderTextFragment.h */; };
                BCEA4944097F0F5C0094C9E4 /* BrowserExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4943097F0F5C0094C9E4 /* BrowserExtension.h */; settings = {ATTRIBUTES = (Private, ); }; };
                142011B40A003133008303F9 /* JSCSSStyleDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleDeclaration.cpp; sourceTree = "<group>"; };
                142011B50A003133008303F9 /* JSCSSStyleDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSStyleDeclaration.h; sourceTree = "<group>"; };
                14813BF309EDF88E00F757E1 /* IDLParser.pm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.perl; name = IDLParser.pm; path = scripts/IDLParser.pm; sourceTree = "<group>"; };
+               148A00100AF59F3F008CC700 /* FontPlatformData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontPlatformData.h; sourceTree = "<group>"; };
+               148AFDA30AF58360008CC700 /* ExceptionHandlers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ExceptionHandlers.h; sourceTree = "<group>"; };
+               148AFDA40AF58360008CC700 /* ExceptionHandlers.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ExceptionHandlers.mm; sourceTree = "<group>"; };
                14CF787109F587CA00EB3665 /* CSSValue.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CSSValue.idl; sourceTree = "<group>"; };
                14CF78A309F58CBF00EB3665 /* JSCSSValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSValue.cpp; sourceTree = "<group>"; };
                14CF78A509F58CD800EB3665 /* JSCSSValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSValue.h; sourceTree = "<group>"; };
                                BCC088850A1BD78D006189A6 /* FontDataMac.mm */,
                                BCF7C0980A1683580032F75B /* FontFallbackListMac.mm */,
                                BCEB377209B7BA3900CB38B1 /* FontMac.mm */,
+                               148A00100AF59F3F008CC700 /* FontPlatformData.h */,
                                935C476C09AC4D6300A6AAB4 /* FoundationExtras.h */,
                                BC6DB4D30A1AFEEF00E5CD14 /* GlyphMapMac.cpp */,
                                935367E809AF77EF00D35CD6 /* GraphicsContextMac.mm */,
                                BC1A37AA097C715F0019F3D8 /* DOMViews.h */,
                                1A1D137E0A5325520064BF5F /* DOMXPath.h */,
                                1A1D137F0A5325520064BF5F /* DOMXPath.mm */,
+                               148AFDA30AF58360008CC700 /* ExceptionHandlers.h */,
+                               148AFDA40AF58360008CC700 /* ExceptionHandlers.mm */,
                                1CAF347E0A6C405200ABE06E /* WebScriptObject.h */,
                                1CAF347F0A6C405200ABE06E /* WebScriptObject.mm */,
                                1CAF34800A6C405200ABE06E /* WebScriptObjectPrivate.h */,
                                655A81BE0AEF67E6000975F0 /* HTTPHeaderMap.h in Headers */,
                                930500200AF025D300FFF491 /* ClipboardAccessPolicy.h in Headers */,
                                9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */,
+                               148AFDA50AF58360008CC700 /* ExceptionHandlers.h in Headers */,
+                               148A00110AF59F3F008CC700 /* FontPlatformData.h in Headers */,
                                93E22A730AF5E94C00D48324 /* PageState.h in Headers */,
                                658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */,
                                6588216B0AF4CE1200F01D1F /* ResourceResponseMac.h in Headers */,
                                853CA9F00AEEC657002372DC /* RenderPath.cpp in Sources */,
                                654F68880AF1B7C50065BDD6 /* CachedResourceMac.mm in Sources */,
                                9307F1D70AF2D59000DBA31A /* HitTestResult.cpp in Sources */,
+                               148AFDA60AF58360008CC700 /* ExceptionHandlers.mm in Sources */,
                                6588216C0AF4CE1200F01D1F /* ResourceResponseMac.mm in Sources */,
                                932E16090AF578340025F408 /* FrameLoader.cpp in Sources */,
                                93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */,
index df953bae4adb9d75672dafea28226dc7655bc272..b518cbcb34cedbb2c2448144a798a6d9915a58d3 100644 (file)
@@ -41,6 +41,7 @@
 #import "EntityReference.h"
 #import "Event.h"
 #import "EventListener.h"
+#import "ExceptionHandlers.h"
 #import "FontData.h"
 #import "FoundationExtras.h"
 #import "FrameMac.h"
index 51ddbcbaa9cd315b9ac62c8f500c18c4431890cd..74da1b9a0e7cff9d1503b6880865e187a3dc29de 100644 (file)
@@ -339,8 +339,6 @@ namespace WebCore {
 
     // Helper functions for DOM wrappers and gluing to Objective-C
 
-    typedef int ExceptionCode;
-
     NSObject* getDOMWrapper(DOMObjectInternal*);
     void addDOMWrapper(NSObject* wrapper, DOMObjectInternal*);
     void removeDOMWrapper(DOMObjectInternal*);
@@ -357,14 +355,6 @@ namespace WebCore {
         addDOMWrapper(wrapper, reinterpret_cast<DOMObjectInternal*>(impl));
     }
 
-    void raiseDOMException(ExceptionCode);
-
-    inline void raiseOnDOMError(ExceptionCode ec) 
-    {
-        if (ec) 
-            raiseDOMException(ec);
-    }
-
     NSString* displayString(const String&, const Node*);
 
 } // namespace WebCore
index eecf3d33a8db1118515738235a0db031859f17f7..12c4294e21d963ed96e0929fb69f9b8acc0d944c 100644 (file)
@@ -70,54 +70,6 @@ void removeDOMWrapper(DOMObjectInternal* impl)
 } // namespace WebCore
 
 
-//------------------------------------------------------------------------------------------
-// Exceptions
-
-NSString * const DOMException = @"DOMException";
-NSString * const DOMRangeException = @"DOMRangeException";
-NSString * const DOMEventException = @"DOMEventException";
-#ifdef SVG_SUPPORT
-NSString * const DOMSVGException = @"DOMSVGException";
-#endif // SVG_SUPPORT
-#ifdef XPATH_SUPPORT
-NSString * const DOMXPathException = @"DOMXPathException";
-#endif // XPATH_SUPPORT
-
-namespace WebCore {
-
-void raiseDOMException(ExceptionCode ec)
-{
-    ASSERT(ec);
-
-    NSString *name = ::DOMException;
-
-    int code = ec;
-    if (ec >= RangeExceptionOffset && ec <= RangeExceptionMax) {
-        name = DOMRangeException;
-        code -= RangeExceptionOffset;
-    } else if (ec >= EventExceptionOffset && ec <= EventExceptionMax) {
-        name = DOMEventException;
-        code -= EventExceptionOffset;
-#ifdef SVG_SUPPORT
-    } else if (ec >= SVGExceptionOffset && ec <= SVGExceptionMax) {
-        name = DOMSVGException;
-        code -= SVGExceptionOffset;
-#endif // SVG_SUPPORT
-#ifdef XPATH_SUPPORT
-    } else if (ec >= XPathExceptionOffset && ec <= XPathExceptionMax) {
-        name = DOMXPathException;
-        code -= XPathExceptionOffset;
-#endif // XPATH_SUPPORT
-    }
-
-    NSString *reason = [NSString stringWithFormat:@"*** Exception received from DOM API: %d", code];
-    NSException *exception = [NSException exceptionWithName:name reason:reason
-        userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:code] forKey:name]];
-    [exception raise];
-}
-
-} // namespace WebCore
-
 //------------------------------------------------------------------------------------------
 
 @implementation WebScriptObject (WebScriptObjectInternal)
diff --git a/WebCore/bindings/objc/ExceptionHandlers.h b/WebCore/bindings/objc/ExceptionHandlers.h
new file mode 100644 (file)
index 0000000..70814b9
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2004-2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * 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. 
+ */
+
+#ifndef ExceptionHandlers_h
+#define ExceptionHandlers_h
+
+#include "TextAffinity.h"
+
+namespace WebCore {
+    
+    typedef int ExceptionCode;
+    
+    class SelectionController;
+    class Range;
+
+    void raiseDOMException(ExceptionCode);
+
+    inline void raiseOnDOMError(ExceptionCode ec) 
+    {
+        if (ec) 
+            raiseDOMException(ec);
+    }
+
+    void selectRange(SelectionController*, Range*, EAffinity, bool closeTyping);
+
+} // namespace WebCore
+
+#endif // ExceptionHandlers_h
diff --git a/WebCore/bindings/objc/ExceptionHandlers.mm b/WebCore/bindings/objc/ExceptionHandlers.mm
new file mode 100644 (file)
index 0000000..14f24f9
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * 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. 
+ */
+
+#include "config.h"
+#include "ExceptionHandlers.h"
+
+#include "Document.h"
+#include "Node.h"
+#include "SelectionController.h"
+#include "PlatformString.h"
+#include "RangeException.h"
+#include "Event.h"
+#include "SVGException.h"
+#include "XPathEvaluator.h"
+
+NSString * const DOMException = @"DOMException";
+NSString * const DOMRangeException = @"DOMRangeException";
+NSString * const DOMEventException = @"DOMEventException";
+#ifdef SVG_SUPPORT
+NSString * const DOMSVGException = @"DOMSVGException";
+#endif // SVG_SUPPORT
+#ifdef XPATH_SUPPORT
+NSString * const DOMXPathException = @"DOMXPathException";
+#endif // XPATH_SUPPORT
+
+namespace WebCore {
+
+void raiseDOMException(ExceptionCode ec)
+{
+    ASSERT(ec);
+
+    NSString *name = ::DOMException;
+
+    int code = ec;
+    if (ec >= RangeExceptionOffset && ec <= RangeExceptionMax) {
+        name = DOMRangeException;
+        code -= RangeExceptionOffset;
+    } else if (ec >= EventExceptionOffset && ec <= EventExceptionMax) {
+        name = DOMEventException;
+        code -= EventExceptionOffset;
+#ifdef SVG_SUPPORT
+    } else if (ec >= SVGExceptionOffset && ec <= SVGExceptionMax) {
+        name = DOMSVGException;
+        code -= SVGExceptionOffset;
+#endif // SVG_SUPPORT
+#ifdef XPATH_SUPPORT
+    } else if (ec >= XPathExceptionOffset && ec <= XPathExceptionMax) {
+        name = DOMXPathException;
+        code -= XPathExceptionOffset;
+#endif // XPATH_SUPPORT
+    }
+
+    NSString *reason = [NSString stringWithFormat:@"*** Exception received from DOM API: %d", code];
+    NSException *exception = [NSException exceptionWithName:name reason:reason
+        userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:code] forKey:name]];
+    [exception raise];
+}
+
+void selectRange(SelectionController* selectionController, Range* range, EAffinity affinity, bool closeTyping)
+{
+    ExceptionCode ec = 0;
+    selectionController->setSelectedRange(range, affinity, closeTyping, ec);
+    raiseOnDOMError(ec);
+}
+
+} // namespace WebCore
index c970ab3cf4bfb3d46b3f382fc3ed2ef8254bf953..5a61ca466494f86fe0bbb063d6829d6a11e54639 100644 (file)
@@ -818,6 +818,7 @@ sub GenerateImplementation
     }
 
     $implIncludes{"DOMInternal.h"} = 1;
+    $implIncludes{"ExceptionHandlers.h"} = 1;
 
     @implContent = ();
 
index b4eee54e6c5b67c1044f4c446a23539ffc74d1ab..6d684f55c1f0404896a06f103f3825aa816622ee 100644 (file)
@@ -174,9 +174,6 @@ public:
     virtual void markMisspellingsInAdjacentWords(const VisiblePosition&);
     virtual void markMisspellings(const Selection&);
 
-    NSFileWrapper* fileWrapperForElement(Element*);
-    NSAttributedString* attributedString(Node* startNode, int startOffset, Node* endNode, int endOffset);
-
     void mouseDown(NSEvent*);
     void mouseDragged(NSEvent*);
     void mouseUp(NSEvent*);
index 55b3638489484fae0696fd3f4d1eb3b87438abc7..2ee3cef5b01cdf5f195738e770cd0731d6f23bfe 100644 (file)
@@ -1488,7 +1488,7 @@ void FrameMac::handleMouseMoveEvent(const MouseEventWithHitTestResults& event)
                 node = result.innerNonSharedNode();
                 _dragSrcIsImage = node && node->renderer() && node->renderer()->isImage();
                 
-                _dragSrcInSelection = isPointInsideSelection(m_mouseDownPos);
+                _dragSrcInSelection = selectionController()->contains(m_mouseDownPos);
             }                
         }
         
@@ -1971,7 +1971,7 @@ bool FrameMac::sendContextMenuEvent(NSEvent *event)
     MouseEventWithHitTestResults mev = doc->prepareMouseEvent(false, true, false, viewportPos, mouseEvent);
 
     swallowEvent = v->dispatchMouseEvent(contextmenuEvent, mev.targetNode(), true, 0, mouseEvent, true);
-    if (!swallowEvent && !isPointInsideSelection(viewportPos) &&
+    if (!swallowEvent && !selectionController()->contains(viewportPos) &&
             ([_bridge selectWordBeforeMenuEvent] || [_bridge isEditable]
                 || (mev.targetNode() && mev.targetNode()->isContentEditable()))) {
         _mouseDownMayStartSelect = true; // context menu events are always allowed to perform a selection
@@ -1989,485 +1989,6 @@ bool FrameMac::sendContextMenuEvent(NSEvent *event)
     return false;
 }
 
-struct ListItemInfo {
-    unsigned start;
-    unsigned end;
-};
-
-NSFileWrapper *FrameMac::fileWrapperForElement(Element *e)
-{
-    NSFileWrapper *wrapper = nil;
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    
-    const AtomicString& attr = e->getAttribute(srcAttr);
-    if (!attr.isEmpty()) {
-        NSURL *URL = completeURL(attr.deprecatedString()).getNSURL();
-        wrapper = [_bridge fileWrapperForURL:URL];
-    }    
-    if (!wrapper) {
-        RenderImage *renderer = static_cast<RenderImage*>(e->renderer());
-        if (renderer->cachedImage() && !renderer->cachedImage()->isErrorImage()) {
-            wrapper = [[NSFileWrapper alloc] initRegularFileWithContents:(NSData*)(renderer->cachedImage()->image()->getTIFFRepresentation())];
-            [wrapper setPreferredFilename:@"image.tiff"];
-            [wrapper autorelease];
-        }
-    }
-
-    return wrapper;
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-
-    return nil;
-}
-
-static Element *listParent(Element *item)
-{
-    while (!item->hasTagName(ulTag) && !item->hasTagName(olTag)) {
-        item = static_cast<Element*>(item->parentNode());
-        if (!item)
-            break;
-    }
-    return item;
-}
-
-static Node* isTextFirstInListItem(Node *e)
-{
-    if (!e->isTextNode())
-        return 0;
-    Node* par = e->parentNode();
-    while (par) {
-        if (par->firstChild() != e)
-            return 0;
-        if (par->hasTagName(liTag))
-            return par;
-        e = par;
-        par = par->parentNode();
-    }
-    return 0;
-}
-
-// FIXME: Enhance TextIterator to optionally add attributes, then just call through to that.
-
-#define BULLET_CHAR 0x2022
-#define SQUARE_CHAR 0x25AA
-#define CIRCLE_CHAR 0x25E6
-
-NSAttributedString *FrameMac::attributedString(Node *startNode, int startOffset, Node *endNode, int endOffset)
-{
-    ListItemInfo info;
-    NSMutableAttributedString *result;
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    Range range(document(), startNode, startOffset, endNode, endOffset);
-    if (!range.boundaryPointsValid())
-        return nil;
-    
-    Node* firstNode = range.startNode();
-    if (!firstNode)
-        return nil;
-    Node* pastEndNode = range.pastEndNode();
-    
-    result = [[[NSMutableAttributedString alloc] init] autorelease];
-    
-    bool hasNewLine = true;
-    bool addedSpace = true;
-    NSAttributedString *pendingStyledSpace = nil;
-    bool hasParagraphBreak = true;
-    const Element *linkStartNode = 0;
-    unsigned linkStartLocation = 0;
-    Vector<Element*> listItems;
-    Vector<ListItemInfo> listItemLocations;
-    float maxMarkerWidth = 0;
-    
-    Node *currentNode = firstNode;
-    
-    // If the first item is the entire text of a list item, use the list item node as the start of the 
-    // selection, not the text node.  The user's intent was probably to select the list.
-    if (currentNode->isTextNode() && startOffset == 0) {
-        Node *startListNode = isTextFirstInListItem(firstNode);
-        if (startListNode){
-            firstNode = startListNode;
-            currentNode = firstNode;
-        }
-    }
-    
-    while (currentNode && currentNode != pastEndNode) {
-        RenderObject *renderer = currentNode->renderer();
-        if (renderer) {
-            RenderStyle *style = renderer->style();
-            NSFont *font = style->font().primaryFont()->getNSFont();
-            bool needSpace = pendingStyledSpace != nil;
-            if (currentNode->isTextNode()) {
-                if (hasNewLine) {
-                    addedSpace = true;
-                    needSpace = false;
-                    [pendingStyledSpace release];
-                    pendingStyledSpace = nil;
-                    hasNewLine = false;
-                }
-                DeprecatedString text;
-                DeprecatedString str = currentNode->nodeValue().deprecatedString();
-                int start = (currentNode == firstNode) ? startOffset : -1;
-                int end = (currentNode == endNode) ? endOffset : -1;
-                if (renderer->isText()) {
-                    if (!style->collapseWhiteSpace()) {
-                        if (needSpace && !addedSpace) {
-                            if (text.isEmpty() && linkStartLocation == [result length])
-                                ++linkStartLocation;
-                            [result appendAttributedString:pendingStyledSpace];
-                        }
-                        int runStart = (start == -1) ? 0 : start;
-                        int runEnd = (end == -1) ? str.length() : end;
-                        text += str.mid(runStart, runEnd-runStart);
-                        [pendingStyledSpace release];
-                        pendingStyledSpace = nil;
-                        addedSpace = u_charDirection(str[runEnd - 1].unicode()) == U_WHITE_SPACE_NEUTRAL;
-                    }
-                    else {
-                        RenderText* textObj = static_cast<RenderText*>(renderer);
-                        if (!textObj->firstTextBox() && str.length() > 0 && !addedSpace) {
-                            // We have no runs, but we do have a length.  This means we must be
-                            // whitespace that collapsed away at the end of a line.
-                            text += ' ';
-                            addedSpace = true;
-                        }
-                        else {
-                            addedSpace = false;
-                            for (InlineTextBox* box = textObj->firstTextBox(); box; box = box->nextTextBox()) {
-                                int runStart = (start == -1) ? box->m_start : start;
-                                int runEnd = (end == -1) ? box->m_start + box->m_len : end;
-                                runEnd = min(runEnd, box->m_start + box->m_len);
-                                if (runStart >= box->m_start &&
-                                    runStart < box->m_start + box->m_len) {
-                                    if (box == textObj->firstTextBox() && box->m_start == runStart && runStart > 0)
-                                        needSpace = true; // collapsed space at the start
-                                    if (needSpace && !addedSpace) {
-                                        if (pendingStyledSpace != nil) {
-                                            if (text.isEmpty() && linkStartLocation == [result length])
-                                                ++linkStartLocation;
-                                            [result appendAttributedString:pendingStyledSpace];
-                                        } else
-                                            text += ' ';
-                                    }
-                                    DeprecatedString runText = str.mid(runStart, runEnd - runStart);
-                                    runText.replace('\n', ' ');
-                                    text += runText;
-                                    int nextRunStart = box->nextTextBox() ? box->nextTextBox()->m_start : str.length(); // collapsed space between runs or at the end
-                                    needSpace = nextRunStart > runEnd;
-                                    [pendingStyledSpace release];
-                                    pendingStyledSpace = nil;
-                                    addedSpace = u_charDirection(str[runEnd - 1].unicode()) == U_WHITE_SPACE_NEUTRAL;
-                                    start = -1;
-                                }
-                                if (end != -1 && runEnd >= end)
-                                    break;
-                            }
-                        }
-                    }
-                }
-                
-                text.replace('\\', renderer->backslashAsCurrencySymbol());
-    
-                if (text.length() > 0 || needSpace) {
-                    NSMutableDictionary *attrs = [[NSMutableDictionary alloc] init];
-                    [attrs setObject:font forKey:NSFontAttributeName];
-                    if (style && style->color().isValid() && style->color().alpha() != 0)
-                        [attrs setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
-                    if (style && style->backgroundColor().isValid() && style->backgroundColor().alpha() != 0)
-                        [attrs setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
-
-                    if (text.length() > 0) {
-                        hasParagraphBreak = false;
-                        NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:text.getNSString() attributes:attrs];
-                        [result appendAttributedString: partialString];                
-                        [partialString release];
-                    }
-
-                    if (needSpace) {
-                        [pendingStyledSpace release];
-                        pendingStyledSpace = [[NSAttributedString alloc] initWithString:@" " attributes:attrs];
-                    }
-
-                    [attrs release];
-                }
-            } else {
-                // This is our simple HTML -> ASCII transformation:
-                DeprecatedString text;
-                if (currentNode->hasTagName(aTag)) {
-                    // Note the start of the <a> element.  We will add the NSLinkAttributeName
-                    // attribute to the attributed string when navigating to the next sibling 
-                    // of this node.
-                    linkStartLocation = [result length];
-                    linkStartNode = static_cast<Element*>(currentNode);
-                } else if (currentNode->hasTagName(brTag)) {
-                    text += "\n";
-                    hasNewLine = true;
-                } else if (currentNode->hasTagName(liTag)) {
-                    DeprecatedString listText;
-                    Element *itemParent = listParent(static_cast<Element*>(currentNode));
-                    
-                    if (!hasNewLine)
-                        listText += '\n';
-                    hasNewLine = true;
-
-                    listItems.append(static_cast<Element*>(currentNode));
-                    info.start = [result length];
-                    info.end = 0;
-                    listItemLocations.append (info);
-                    
-                    listText += '\t';
-                    if (itemParent && renderer->isListItem()) {
-                        RenderListItem* listRenderer = static_cast<RenderListItem*>(renderer);
-
-                        maxMarkerWidth = MAX([font pointSize], maxMarkerWidth);
-                        switch(style->listStyleType()) {
-                            case DISC:
-                                listText += ((DeprecatedChar)BULLET_CHAR);
-                                break;
-                            case CIRCLE:
-                                listText += ((DeprecatedChar)CIRCLE_CHAR);
-                                break;
-                            case SQUARE:
-                                listText += ((DeprecatedChar)SQUARE_CHAR);
-                                break;
-                            case LNONE:
-                                break;
-                            default:
-                                DeprecatedString marker = listRenderer->markerStringValue();
-                                listText += marker;
-                                // Use AppKit metrics.  Will be rendered by AppKit.
-                                float markerWidth = [marker.getNSString() sizeWithAttributes:[NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]].width;
-                                maxMarkerWidth = MAX(markerWidth, maxMarkerWidth);
-                        }
-
-                        listText += ' ';
-                        listText += '\t';
-
-                        NSMutableDictionary *attrs = [[NSMutableDictionary alloc] init];
-                        [attrs setObject:font forKey:NSFontAttributeName];
-                        if (style && style->color().isValid())
-                            [attrs setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
-                        if (style && style->backgroundColor().isValid())
-                            [attrs setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
-
-                        NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:listText.getNSString() attributes:attrs];
-                        [attrs release];
-                        [result appendAttributedString: partialString];                
-                        [partialString release];
-                    }
-                } else if (currentNode->hasTagName(olTag) || currentNode->hasTagName(ulTag)) {
-                    if (!hasNewLine)
-                        text += "\n";
-                    hasNewLine = true;
-                } else if (currentNode->hasTagName(blockquoteTag)
-                        || currentNode->hasTagName(ddTag)
-                        || currentNode->hasTagName(divTag)
-                        || currentNode->hasTagName(dlTag)
-                        || currentNode->hasTagName(dtTag)
-                        || currentNode->hasTagName(hrTag)
-                        || currentNode->hasTagName(listingTag)
-                        || currentNode->hasTagName(preTag)
-                        || currentNode->hasTagName(tdTag)
-                        || currentNode->hasTagName(thTag)) {
-                    if (!hasNewLine)
-                        text += '\n';
-                    hasNewLine = true;
-                } else if (currentNode->hasTagName(h1Tag)
-                        || currentNode->hasTagName(h2Tag)
-                        || currentNode->hasTagName(h3Tag)
-                        || currentNode->hasTagName(h4Tag)
-                        || currentNode->hasTagName(h5Tag)
-                        || currentNode->hasTagName(h6Tag)
-                        || currentNode->hasTagName(pTag)
-                        || currentNode->hasTagName(trTag)) {
-                    if (!hasNewLine)
-                        text += '\n';
-                    
-                    // In certain cases, emit a paragraph break.
-                    int bottomMargin = renderer->collapsedMarginBottom();
-                    int fontSize = style->fontDescription().computedPixelSize();
-                    if (bottomMargin * 2 >= fontSize) {
-                        if (!hasParagraphBreak) {
-                            text += '\n';
-                            hasParagraphBreak = true;
-                        }
-                    }
-                    
-                    hasNewLine = true;
-                }
-                else if (currentNode->hasTagName(imgTag)) {
-                    if (pendingStyledSpace != nil) {
-                        if (linkStartLocation == [result length])
-                            ++linkStartLocation;
-                        [result appendAttributedString:pendingStyledSpace];
-                        [pendingStyledSpace release];
-                        pendingStyledSpace = nil;
-                    }
-                    NSFileWrapper *fileWrapper = fileWrapperForElement(static_cast<Element*>(currentNode));
-                    NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
-                    NSAttributedString *iString = [NSAttributedString attributedStringWithAttachment:attachment];
-                    [result appendAttributedString: iString];
-                    [attachment release];
-                }
-
-                NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:text.getNSString()];
-                [result appendAttributedString: partialString];
-                [partialString release];
-            }
-        }
-
-        Node *nextNode = currentNode->firstChild();
-        if (!nextNode)
-            nextNode = currentNode->nextSibling();
-
-        while (!nextNode && currentNode->parentNode()) {
-            DeprecatedString text;
-            currentNode = currentNode->parentNode();
-            if (currentNode == pastEndNode)
-                break;
-            nextNode = currentNode->nextSibling();
-
-            if (currentNode->hasTagName(aTag)) {
-                // End of a <a> element.  Create an attributed string NSLinkAttributeName attribute
-                // for the range of the link.  Note that we create the attributed string from the DOM, which
-                // will have corrected any illegally nested <a> elements.
-                if (linkStartNode && currentNode == linkStartNode) {
-                    String href = parseURL(linkStartNode->getAttribute(hrefAttr));
-                    KURL kURL = Mac(linkStartNode->document()->frame())->completeURL(href.deprecatedString());
-                    
-                    NSURL *URL = kURL.getNSURL();
-                    NSRange tempRange = { linkStartLocation, [result length]-linkStartLocation }; // workaround for 4213314
-                    [result addAttribute:NSLinkAttributeName value:URL range:tempRange];
-                    linkStartNode = 0;
-                }
-            }
-            else if (currentNode->hasTagName(olTag) || currentNode->hasTagName(ulTag)) {
-                if (!hasNewLine)
-                    text += '\n';
-                hasNewLine = true;
-            } else if (currentNode->hasTagName(liTag)) {
-                
-                int i, count = listItems.size();
-                for (i = 0; i < count; i++){
-                    if (listItems[i] == currentNode){
-                        listItemLocations[i].end = [result length];
-                        break;
-                    }
-                }
-                if (!hasNewLine)
-                    text += '\n';
-                hasNewLine = true;
-            } else if (currentNode->hasTagName(blockquoteTag) ||
-                       currentNode->hasTagName(ddTag) ||
-                       currentNode->hasTagName(divTag) ||
-                       currentNode->hasTagName(dlTag) ||
-                       currentNode->hasTagName(dtTag) ||
-                       currentNode->hasTagName(hrTag) ||
-                       currentNode->hasTagName(listingTag) ||
-                       currentNode->hasTagName(preTag) ||
-                       currentNode->hasTagName(tdTag) ||
-                       currentNode->hasTagName(thTag)) {
-                if (!hasNewLine)
-                    text += '\n';
-                hasNewLine = true;
-            } else if (currentNode->hasTagName(pTag) ||
-                       currentNode->hasTagName(trTag) ||
-                       currentNode->hasTagName(h1Tag) ||
-                       currentNode->hasTagName(h2Tag) ||
-                       currentNode->hasTagName(h3Tag) ||
-                       currentNode->hasTagName(h4Tag) ||
-                       currentNode->hasTagName(h5Tag) ||
-                       currentNode->hasTagName(h6Tag)) {
-                if (!hasNewLine)
-                    text += '\n';
-                // An extra newline is needed at the start, not the end, of these types of tags,
-                // so don't add another here.
-                hasNewLine = true;
-            }
-            
-            NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:text.getNSString()];
-            [result appendAttributedString:partialString];
-            [partialString release];
-        }
-
-        currentNode = nextNode;
-    }
-    
-    [pendingStyledSpace release];
-    
-    // Apply paragraph styles from outside in.  This ensures that nested lists correctly
-    // override their parent's paragraph style.
-    {
-        unsigned i, count = listItems.size();
-        Element *e;
-
-#ifdef POSITION_LIST
-        Node *containingBlock;
-        int containingBlockX, containingBlockY;
-        
-        // Determine the position of the outermost containing block.  All paragraph
-        // styles and tabs should be relative to this position.  So, the horizontal position of 
-        // each item in the list (in the resulting attributed string) will be relative to position 
-        // of the outermost containing block.
-        if (count > 0){
-            containingBlock = firstNode;
-            while (containingBlock->renderer()->isInline()){
-                containingBlock = containingBlock->parentNode();
-            }
-            containingBlock->renderer()->absolutePosition(containingBlockX, containingBlockY);
-        }
-#endif
-        
-        for (i = 0; i < count; i++){
-            e = listItems[i];
-            info = listItemLocations[i];
-            
-            if (info.end < info.start)
-                info.end = [result length];
-                
-            RenderObject *r = e->renderer();
-            RenderStyle *style = r->style();
-
-            int rx;
-            NSFont *font = style->font().primaryFont()->getNSFont();
-            float pointSize = [font pointSize];
-
-#ifdef POSITION_LIST
-            int ry;
-            r->absolutePosition(rx, ry);
-            rx -= containingBlockX;
-            
-            // Ensure that the text is indented at least enough to allow for the markers.
-            rx = MAX(rx, (int)maxMarkerWidth);
-#else
-            rx = (int)MAX(maxMarkerWidth, pointSize);
-#endif
-
-            // The bullet text will be right aligned at the first tab marker, followed
-            // by a space, followed by the list item text.  The space is arbitrarily
-            // picked as pointSize*2/3.  The space on the first line of the text item
-            // is established by a left aligned tab, on subsequent lines it's established
-            // by the head indent.
-            NSMutableParagraphStyle *mps = [[NSMutableParagraphStyle alloc] init];
-            [mps setFirstLineHeadIndent: 0];
-            [mps setHeadIndent: rx];
-            [mps setTabStops:[NSArray arrayWithObjects:
-                        [[[NSTextTab alloc] initWithType:NSRightTabStopType location:rx-(pointSize*2/3)] autorelease],
-                        [[[NSTextTab alloc] initWithType:NSLeftTabStopType location:rx] autorelease],
-                        nil]];
-            NSRange tempRange = { info.start, info.end-info.start }; // workaround for 4213314
-            [result addAttribute:NSParagraphStyleAttributeName value:mps range:tempRange];
-            [mps release];
-        }
-    }
-
-    return result;
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-
-    return nil;
-}
-
 NSImage *FrameMac::imageFromRect(NSRect rect) const
 {
     NSView *view = d->m_view->getDocumentView();
@@ -3018,7 +2539,7 @@ bool FrameMac::shouldChangeSelection(const Selection& oldSelection, const Select
 {
     return [_bridge shouldChangeSelectedDOMRange:[DOMRange _rangeWith:oldSelection.toRange().get()]
                                       toDOMRange:[DOMRange _rangeWith:newSelection.toRange().get()]
-                                        affinity:static_cast<NSSelectionAffinity>(affinity)
+                                        affinity:affinity
                                   stillSelecting:stillSelecting];
 }
 
index 767a53f8666a8cf2a5e06e2588972438158de314..2bdc309a1d298be25908cc2bdaf95d3382007258 100644 (file)
@@ -27,7 +27,7 @@
 #import <JavaScriptCore/npruntime.h>
 #import <JavaVM/jni.h>
 #import <WebCore/WebCoreKeyboardAccess.h>
-
+#import <WebCore/TextAffinity.h>
 #ifdef __cplusplus
 
 namespace WebCore {
@@ -238,8 +238,6 @@ typedef enum {
 - (NSObject *)copyRenderTree:(id <WebCoreRenderTreeCopier>)copier;
 - (NSString *)renderTreeAsExternalRepresentation;
 
-- (BOOL)isPointInsideSelection:(NSPoint)point;
-
 - (NSURL *)URLWithAttributeString:(NSString *)string;
 
 - (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form;
@@ -267,7 +265,6 @@ typedef enum {
 
 - (BOOL)mayCopy;
 
-- (NSAttributedString *)selectedAttributedString;
 - (NSString *)selectedString;
 
 - (NSString *)stringForRange:(DOMRange *)range;
@@ -275,17 +272,10 @@ typedef enum {
 - (NSString *)markupStringFromNode:(DOMNode *)node nodes:(NSArray **)nodes;
 - (NSString *)markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes;
 
-- (void)selectAll;
-- (void)deselectAll;
-- (void)deselectText;
-
 - (NSRect)caretRectAtNode:(DOMNode *)node offset:(int)offset affinity:(NSSelectionAffinity)affinity;
 - (NSRect)firstRectForDOMRange:(DOMRange *)range;
 - (void)scrollDOMRangeToVisible:(DOMRange *)range;
 
-- (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity closeTyping:(BOOL)closeTyping;
-- (NSSelectionAffinity)selectionAffinity;
-
 // Emacs-style-editing "mark"
 - (void)setMarkDOMRange:(DOMRange *)range;
 - (DOMRange *)markDOMRange;
@@ -295,8 +285,6 @@ typedef enum {
 - (DOMRange *)markedTextDOMRange;
 - (void)replaceMarkedTextWithText:(NSString *)text;
 
-- (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset;
-
 - (NSFont *)fontForSelection:(BOOL *)hasMultipleFonts;
 - (NSWritingDirection)baseWritingDirectionForSelectionStart;
 
@@ -316,7 +304,6 @@ typedef enum {
 - (void)undoEditing:(id)arg;
 - (void)redoEditing:(id)arg;
 
-- (DOMRange *)rangeByExpandingSelectionWithGranularity:(WebBridgeSelectionGranularity)granularity;
 - (DOMRange *)rangeOfCharactersAroundCaret;
 - (DOMRange *)rangeByAlteringCurrentSelection:(WebSelectionAlteration)alteration direction:(WebBridgeSelectionDirection)direction granularity:(WebBridgeSelectionGranularity)granularity;
 - (void)alterCurrentSelection:(WebSelectionAlteration)alteration direction:(WebBridgeSelectionDirection)direction granularity:(WebBridgeSelectionGranularity)granularity;
@@ -360,7 +347,6 @@ typedef enum {
 - (DOMRange *)editableDOMRangeForPoint:(NSPoint)point;
 - (DOMRange *)characterRangeAtPoint:(NSPoint)point;
 
-- (void)deleteSelectionWithSmartDelete:(BOOL)smartDelete;
 - (void)deleteKeyPressedWithSmartDelete:(BOOL)smartDelete granularity:(WebBridgeSelectionGranularity)granularity;
 - (void)forwardDeleteKeyPressedWithSmartDelete:(BOOL)smartDelete granularity:(WebBridgeSelectionGranularity)granularity;
 
@@ -510,7 +496,7 @@ typedef enum {
 - (void)respondToChangedContents;
 - (void)setIsSelected:(BOOL)isSelected forView:(NSView *)view;
 - (BOOL)isEditable;
-- (BOOL)shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag;
+- (BOOL)shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(WebCore::EAffinity)selectionAffinity stillSelecting:(BOOL)flag;
 - (BOOL)shouldDeleteSelectedDOMRange:(DOMRange *)currentRange;
 - (BOOL)shouldBeginEditing:(DOMRange *)range;
 - (BOOL)shouldEndEditing:(DOMRange *)range;
index 2881895a48d4b12f00cfd6a1c21229f4544935e0..cc40ddfea5df11cb928a20f4537816464cb99216 100644 (file)
@@ -561,25 +561,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
     return [[(NSString*)text copy] autorelease];
 }
 
-- (void)selectAll
-{
-    m_frame->selectAll();
-}
-
-- (void)deselectAll
-{
-    [self deselectText];
-    Document *doc = m_frame->document();
-    if (doc) {
-        doc->setFocusNode(0);
-    }
-}
-
-- (void)deselectText
-{
-    m_frame->selectionController()->clear();
-}
-
 - (void)reapplyStylesForDeviceType:(WebCoreDeviceType)deviceType
 {
     m_frame->setMediaType(deviceType == WebCoreDeviceScreen ? "screen" : "print");
@@ -869,11 +850,6 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     return m_frame->matchLabelsAgainstElement(labels, [element _element]);
 }
 
-- (BOOL)isPointInsideSelection:(NSPoint)point
-{
-    return m_frame->isPointInsideSelection(IntPoint(point));
-}
-
 - (NSURL *)URLWithAttributeString:(NSString *)string
 {
     Document *doc = m_frame->document();
@@ -994,18 +970,6 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     return aeDescFromJSValue(m_frame->scriptProxy()->interpreter()->globalExec(), result);
 }
 
-- (NSAttributedString *)selectedAttributedString
-{
-    // FIXME: should be a no-arg version of attributedString() that does this
-    Selection selection = m_frame->selectionController()->selection();
-    return m_frame->attributedString(selection.start().node(), selection.start().offset(), selection.end().node(), selection.end().offset());
-}
-
-- (NSAttributedString *)attributedStringFrom:(DOMNode *)start startOffset:(int)startOffset to:(DOMNode *)end endOffset:(int)endOffset
-{
-    return m_frame->attributedString([start _node], startOffset, [end _node], endOffset);
-}
-
 - (NSRect)caretRectAtNode:(DOMNode *)node offset:(int)offset affinity:(NSSelectionAffinity)affinity
 {
     return [node _node]->renderer()->caretRect(offset, static_cast<EAffinity>(affinity));
@@ -1140,17 +1104,6 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     [arg command]->reapply();
 }
 
-- (DOMRange *)rangeByExpandingSelectionWithGranularity:(WebBridgeSelectionGranularity)granularity
-{
-    if (!m_frame->hasSelection())
-        return nil;
-
-    // NOTE: The enums *must* match the very similar ones declared in SelectionController.h
-    Selection selection(m_frame->selectionController()->selection());
-    selection.expandUsingGranularity(static_cast<TextGranularity>(granularity));
-    return [DOMRange _rangeWith:selection.toRange().get()];
-}
-
 - (DOMRange *)rangeByAlteringCurrentSelection:(WebSelectionAlteration)alteration direction:(WebBridgeSelectionDirection)direction granularity:(WebBridgeSelectionGranularity)granularity
 {
     if (!m_frame->hasSelection())
@@ -1191,30 +1144,6 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     return static_cast<WebBridgeSelectionGranularity>(m_frame->selectionGranularity());
 }
 
-- (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity closeTyping:(BOOL)closeTyping
-{
-    Node *startContainer = [[range startContainer] _node];
-    Node *endContainer = [[range endContainer] _node];
-    ASSERT(startContainer);
-    ASSERT(endContainer);
-    ASSERT(startContainer->document() == endContainer->document());
-    
-    m_frame->document()->updateLayoutIgnorePendingStylesheets();
-
-    EAffinity affinity = static_cast<EAffinity>(selectionAffinity);
-    
-    // Non-collapsed ranges are not allowed to start at the end of a line that is wrapped,
-    // they start at the beginning of the next line instead
-    if (![range collapsed])
-        affinity = DOWNSTREAM;
-    
-    // FIXME: Can we provide extentAffinity?
-    VisiblePosition visibleStart(startContainer, [range startOffset], affinity);
-    VisiblePosition visibleEnd(endContainer, [range endOffset], SEL_DEFAULT_AFFINITY);
-    Selection selection(visibleStart, visibleEnd);
-    m_frame->selectionController()->setSelection(selection, closeTyping);
-}
-
 - (NSRange)convertToNSRange:(Range *)range
 {
     int exception = 0;
@@ -1279,11 +1208,6 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     return [self convertToNSRange:m_frame->selectionController()->toRange().get()];
 }
 
-- (NSSelectionAffinity)selectionAffinity
-{
-    return static_cast<NSSelectionAffinity>(m_frame->selectionController()->affinity());
-}
-
 - (void)setMarkDOMRange:(DOMRange *)range
 {
     Range* r = [range _range];
@@ -1649,14 +1573,6 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     return nil;
 }
 
-- (void)deleteSelectionWithSmartDelete:(BOOL)smartDelete
-{
-    if (!m_frame->hasSelection())
-        return;
-    
-    applyCommand(new DeleteSelectionCommand(m_frame->document(), smartDelete));
-}
-
 - (void)deleteKeyPressedWithSmartDelete:(BOOL)smartDelete granularity:(WebBridgeSelectionGranularity)granularity
 {
     if (!m_frame || !m_frame->document())
index 4ac2a5f6b2ddae9ddc1f8934cab164b607d50c7d..924b8c7ede3a6c9f0901e162e4e2c38ca9137835 100644 (file)
@@ -118,7 +118,7 @@ bool execMoveDown(Frame* frame)
 
 bool execSelectAll(Frame* frame)
 {
-    frame->selectAll();
+    frame->selectionController()->selectAll();
     return true;
 }
 
index d2cbe5803893bd09e0351575db4d04bf595c6e26..51b7954f2e640e3d1edf95ebe645a7a5a2eb7347 100644 (file)
 #include "ApplyStyleCommand.h"
 #include "CSSComputedStyleDeclaration.h"
 #include "DeleteButtonController.h"
+#include "DeleteSelectionCommand.h"
 #include "Document.h"
 #include "DocumentFragment.h"
-#include "EditorClient.h"
 #include "EditCommand.h"
-#include "htmlediting.h"
+#include "Editor.h"
+#include "EditorClient.h"
 #include "HTMLElement.h"
 #include "HTMLNames.h"
-#include "markup.h"
+#include "HitTestResult.h"
 #include "Range.h"
 #include "ReplaceSelectionCommand.h"
 #include "SelectionController.h"
 #include "Sound.h"
+#include "htmlediting.h"
+#include "markup.h"
 
 namespace WebCore {
 
@@ -102,8 +105,12 @@ void Editor::deleteSelection()
 {
 }
 
-void Editor::deleteSelectionWithSmartDelete(bool enabled)
+void Editor::deleteSelectionWithSmartDelete(bool smartDelete)
 {
+    if (!m_frame->hasSelection())
+        return;
+    
+    applyCommand(new DeleteSelectionCommand(m_frame->document(), smartDelete));
 }
 
 bool Editor::isSelectionRichlyEditable()
@@ -232,6 +239,11 @@ void Editor::removeFormattingAndStyle()
     applyCommand(new ReplaceSelectionCommand(document, fragment, false, false, false, true, EditActionUnspecified));
 }
 
+void Editor::setLastEditCommand(PassRefPtr<EditCommand> lastEditCommand) 
+{
+    m_lastEditCommand = lastEditCommand;
+}
+
 // =============================================================================
 //
 // public editing commands
index 4a99e659fff5ac0ffbd6704e552a75c290d05650..9ab2364c84c78108ead418a60c145fffa669351c 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef EDITOR_H
-#define EDITOR_H
+#ifndef Editor_h
+#define Editor_h
 
+#include "Frame.h"
 #include <wtf/Forward.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/RefPtr.h>
 
-#include "Frame.h"
-
 namespace WebCore {
 
 class DeleteButtonController;
+class Editor;
 class EditorClient;
 class Frame;
 class HTMLElement;
@@ -66,11 +66,19 @@ public:
 
     Frame* frame() const { return m_frame; }
     DeleteButtonController* deleteButtonController() const { return m_deleteButtonController.get(); }
+    EditCommand* lastEditCommand() { return m_lastEditCommand.get(); }
+
+    // FIXME: Once the Editor implements all editing commands, it should track 
+    // the lastEditCommand on its own, and we should remove this function.
+    void setLastEditCommand(PassRefPtr<EditCommand> lastEditCommand);
+
+    void deleteSelectionWithSmartDelete(bool smartDelete);
 
 private:
     Frame* m_frame;
     RefPtr<EditorClient> m_client;
     OwnPtr<DeleteButtonController> m_deleteButtonController;
+    RefPtr<EditCommand> m_lastEditCommand;
 
     bool canCopy();
     bool canCut();
@@ -85,13 +93,11 @@ private:
     bool tryDHTMLCut();
     bool tryDHTMLPaste();
     void deleteSelection();
-    void deleteSelectionWithSmartDelete(bool enabled);
     void pasteAsPlainTextWithPasteboard(Pasteboard);
     void pasteWithPasteboard(Pasteboard, bool allowPlainText);
     void writeSelectionToPasteboard(Pasteboard);
-
 };
 
 } // namespace WebCore
 
-#endif // EDITOR_H
+#endif // Editor_h
index 424d31bd9a983d045bc5826e20dba2f20b4809b1..1925e3bb588e4800c997f1957898c2bf365b268c 100644 (file)
@@ -419,7 +419,7 @@ bool execRemoveFormat(Frame* frame, bool userInterface, const String& value)
 
 bool execSelectAll(Frame* frame, bool, const String&)
 {
-    frame->selectAll();
+    frame->selectionController()->selectAll();
     return true;
 }
 
index 64667be14a2cd32bb4fd26110005a2053fcd906f..843fac1d25def79ac6675752f3ce5434ef75d8db 100644 (file)
 #include "config.h"
 #include "SelectionController.h"
 
+#include "DeleteSelectionCommand.h"
 #include "Document.h"
 #include "Editor.h"
 #include "Element.h"
 #include "EventNames.h"
 #include "Frame.h"
+#include "FrameTree.h"
 #include "GraphicsContext.h"
+#include "HitTestResult.h"
 #include "RenderView.h"
 #include "TextIterator.h"
 #include "TypingCommand.h"
@@ -97,7 +100,7 @@ void SelectionController::setSelection(const Selection& s, bool closeTyping, boo
     ASSERT(!s.end().node() || s.end().node()->document() == m_frame->document());
     
     if (closeTyping)
-        TypingCommand::closeTyping(m_frame->lastEditCommand());
+        TypingCommand::closeTyping(m_frame->editor()->lastEditCommand());
 
     if (clearTypingStyle)
         m_frame->clearTypingStyle();
@@ -118,7 +121,7 @@ void SelectionController::setSelection(const Selection& s, bool closeTyping, boo
     // Always clear the x position used for vertical arrow navigation.
     // It will be restored by the vertical arrow navigation code if necessary.
     m_frame->setXPosForVerticalArrowNavigation(Frame::NoXPosForVerticalArrowNavigation);
-    m_frame->selectFrameElementInParentIfFullySelected();
+    selectFrameElementInParentIfFullySelected();
     m_frame->notifyRendererOfSelectionChange(userTriggered);
     m_frame->respondToChangedSelection(oldSelection, closeTyping);
     m_frame->editor()->respondToChangedSelection(oldSelection);
@@ -929,6 +932,146 @@ void SelectionController::debugRenderer(RenderObject *r, bool selected) const
     }
 }
 
+bool SelectionController::contains(const IntPoint& point)
+{
+    Document* document = m_frame->document();
+    
+    // Treat a collapsed selection like no selection.
+    if (!isRange())
+        return false;
+    if (!document->renderer()) 
+        return false;
+    
+    HitTestResult result(point, true, true);
+    document->renderer()->layer()->hitTest(result);
+    Node *innerNode = result.innerNode();
+    if (!innerNode || !innerNode->renderer())
+        return false;
+    
+    Position pos(innerNode->renderer()->positionForPoint(point).deepEquivalent());
+    if (pos.isNull())
+        return false;
+
+    Node *n = start().node();
+    while (n) {
+        if (n == pos.node()) {
+            if ((n == start().node() && pos.offset() < start().offset()) ||
+                (n == end().node() && pos.offset() > end().offset())) {
+                return false;
+            }
+            return true;
+        }
+        if (n == end().node())
+            break;
+        n = n->traverseNextNode();
+    }
+
+   return false;
+}
+
+// Workaround for the fact that it's hard to delete a frame.
+// Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
+// Can't do this implicitly as part of every setSelection call because in some contexts it might not be good
+// for the focus to move to another frame. So instead we call it from places where we are selecting with the
+// mouse or the keyboard after setting the selection.
+void SelectionController::selectFrameElementInParentIfFullySelected()
+{
+    // Find the parent frame; if there is none, then we have nothing to do.
+    Frame *parent = m_frame->tree()->parent();
+    if (!parent)
+        return;
+    FrameView *parentView = parent->view();
+    if (!parentView)
+        return;
+
+    // Check if the selection contains the entire frame contents; if not, then there is nothing to do.
+    if (!isRange())
+        return;
+    if (!isStartOfDocument(selection().visibleStart()))
+        return;
+    if (!isEndOfDocument(selection().visibleEnd()))
+        return;
+
+    // Get to the <iframe> or <frame> (or even <object>) element in the parent frame.
+    Document *doc = m_frame->document();
+    if (!doc)
+        return;
+    Element *ownerElement = doc->ownerElement();
+    if (!ownerElement)
+        return;
+    Node *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->isContentEditable())
+        return;
+
+    // Create compute positions before and after the element.
+    unsigned ownerElementNodeIndex = ownerElement->nodeIndex();
+    VisiblePosition beforeOwnerElement(VisiblePosition(ownerElementParent, ownerElementNodeIndex, SEL_DEFAULT_AFFINITY));
+    VisiblePosition afterOwnerElement(VisiblePosition(ownerElementParent, ownerElementNodeIndex + 1, VP_UPSTREAM_IF_POSSIBLE));
+
+    // Focus on the parent frame, and then select from before this element to after.
+    Selection newSelection(beforeOwnerElement, afterOwnerElement);
+    if (parent->shouldChangeSelection(newSelection)) {
+        parentView->setFocus();
+        parent->selectionController()->setSelection(newSelection);
+    }
+}
+
+void SelectionController::selectAll()
+{
+    Document* document = m_frame->document();
+    if (!document)
+        return;
+    
+    Node* root = isContentEditable() ? rootEditableElement() : document->documentElement();
+    Selection newSelection(Selection::selectionFromContentsOfNode(root));
+    if (m_frame->shouldChangeSelection(newSelection))
+        setSelection(newSelection);
+    selectFrameElementInParentIfFullySelected();
+    m_frame->notifyRendererOfSelectionChange(true);
+}
+
+void SelectionController::setSelectedRange(Range* range, EAffinity affinity, bool closeTyping, ExceptionCode& ec)
+{
+    ec = 0;
+    
+    Node* startContainer = range->startContainer(ec);
+    if (ec)
+        return;
+
+    Node* endContainer = range->endContainer(ec);
+    if (ec)
+        return;
+    
+    ASSERT(startContainer);
+    ASSERT(endContainer);
+    ASSERT(startContainer->document() == endContainer->document());
+    
+    m_frame->document()->updateLayoutIgnorePendingStylesheets();
+
+    // Non-collapsed ranges are not allowed to start at the end of a line that is wrapped,
+    // they start at the beginning of the next line instead
+    bool collapsed = range->collapsed(ec);
+    if (ec)
+        return;
+    
+    int startOffset = range->startOffset(ec);
+    if (ec)
+        return;
+
+    int endOffset = range->endOffset(ec);
+    if (ec)
+        return;
+    
+    // FIXME: Can we provide extentAffinity?
+    VisiblePosition visibleStart(startContainer, startOffset, collapsed ? affinity : DOWNSTREAM);
+    VisiblePosition visibleEnd(endContainer, endOffset, SEL_DEFAULT_AFFINITY);
+    setSelection(Selection(visibleStart, visibleEnd), closeTyping);
+}
+
 #ifndef NDEBUG
 
 void SelectionController::formatForDebugger(char* buffer, unsigned length) const
index bce1feb15ee5515a4af945e6909806a3eefec568..cd913bc3095f33fd32a0fdc84726abf7c9818b76 100644 (file)
@@ -57,6 +57,14 @@ public:
 
     const Selection& selection() const { return m_sel; }
     void setSelection(const Selection&, bool closeTyping = true, bool clearTypingStyle = true, bool userTriggered = false);
+    void setSelectedRange(Range*, EAffinity, bool closeTyping, ExceptionCode&);
+    void selectAll();
+    void clear();
+    
+    // Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
+    void selectFrameElementInParentIfFullySelected();
+
+    bool contains(const IntPoint&);
 
     Selection::EState state() const { return m_sel.state(); }
 
@@ -66,8 +74,6 @@ public:
     bool modify(EAlter, int verticalDistance, bool userTriggered = false);
     bool expandUsingGranularity(TextGranularity);
 
-    void clear();
-
     void setBase(const VisiblePosition&, bool userTriggered = false);
     void setBase(const Position&, EAffinity, bool userTriggered = false);
     void setExtent(const VisiblePosition&, bool userTriggered = false);
index 25578bf2e8a190777d3cc4f5aec2aa58c5764e0d..5562cc4292619909cc047ea445d1d7af4d4285c8 100644 (file)
 #ifndef TextAffinity_h
 #define TextAffinity_h
 
+#include <wtf/Platform.h>
+
+#ifdef __OBJC__
+#include <AppKit/NSTextView.h>
+#endif
+
 namespace WebCore {
 
 // These match the AppKit values for these concepts.
@@ -34,6 +40,18 @@ namespace WebCore {
 // NSSelectionAffinityDownstream = 1
 typedef enum { UPSTREAM = 0, DOWNSTREAM = 1 } EAffinity;
 
+#ifdef __OBJC__
+inline NSSelectionAffinity kit(EAffinity affinity)
+{
+    return static_cast<NSSelectionAffinity>(affinity);
 }
 
+inline EAffinity core(NSSelectionAffinity affinity)
+{
+    return static_cast<EAffinity>(affinity);
+}
 #endif
+
+} // namespace WebCore
+
+#endif // TextAffinity_h
index 7e910f0ab99d67599641eff1dbd2918c50a2ca09..e9fdfa6969f392a78620e499097e2aafc93991aa 100644 (file)
@@ -30,6 +30,7 @@
 #include "BreakBlockquoteCommand.h"
 #include "DeleteSelectionCommand.h"
 #include "Document.h"
+#include "Editor.h"
 #include "Element.h"
 #include "Frame.h"
 #include "InsertLineBreakCommand.h"
@@ -61,7 +62,7 @@ void TypingCommand::deleteKeyPressed(Document *document, bool smartDelete, TextG
     Frame *frame = document->frame();
     ASSERT(frame);
     
-    EditCommand* lastEditCommand = frame->lastEditCommand();
+    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
     if (isOpenForMoreTypingCommand(lastEditCommand)) {
         static_cast<TypingCommand*>(lastEditCommand)->deleteKeyPressed(granularity);
         return;
@@ -79,7 +80,7 @@ void TypingCommand::forwardDeleteKeyPressed(Document *document, bool smartDelete
     Frame *frame = document->frame();
     ASSERT(frame);
     
-    EditCommand* lastEditCommand = frame->lastEditCommand();
+    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
     if (isOpenForMoreTypingCommand(lastEditCommand)) {
         static_cast<TypingCommand*>(lastEditCommand)->forwardDeleteKeyPressed(granularity);
         return;
@@ -111,7 +112,7 @@ void TypingCommand::insertText(Document *document, const String &text, bool sele
     if (newText.isEmpty())
         return;
     
-    EditCommand* lastEditCommand = frame->lastEditCommand();
+    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
     if (isOpenForMoreTypingCommand(lastEditCommand)) {
         static_cast<TypingCommand*>(lastEditCommand)->insertText(newText, selectInsertedText);
         return;
@@ -127,7 +128,7 @@ void TypingCommand::insertLineBreak(Document *document)
     Frame *frame = document->frame();
     ASSERT(frame);
     
-    EditCommand* lastEditCommand = frame->lastEditCommand();
+    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
     if (isOpenForMoreTypingCommand(lastEditCommand)) {
         static_cast<TypingCommand*>(lastEditCommand)->insertLineBreak();
         return;
@@ -143,7 +144,7 @@ void TypingCommand::insertParagraphSeparatorInQuotedContent(Document *document)
     Frame *frame = document->frame();
     ASSERT(frame);
     
-    EditCommand* lastEditCommand = frame->lastEditCommand();
+    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
     if (isOpenForMoreTypingCommand(lastEditCommand)) {
         static_cast<TypingCommand*>(lastEditCommand)->insertParagraphSeparatorInQuotedContent();
         return;
@@ -159,7 +160,7 @@ void TypingCommand::insertParagraphSeparator(Document *document)
     Frame *frame = document->frame();
     ASSERT(frame);
     
-    EditCommand* lastEditCommand = frame->lastEditCommand();
+    EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
     if (isOpenForMoreTypingCommand(lastEditCommand)) {
         static_cast<TypingCommand*>(lastEditCommand)->insertParagraphSeparator();
         return;
index 1e81da0e148901eb438d41c94b57a68e19bfbc38..60e494bcc8b9d02a812b60ebddc10570e2daf48c 100644 (file)
@@ -567,10 +567,7 @@ bool Frame::didOpenURL(const KURL& url)
   }
   
   cancelRedirection();
-  
-  // clear last edit command
-  d->m_lastEditCommand = 0;
-  
+  editor()->setLastEditCommand(0);
   closeURL();
 
   d->m_bComplete = false;
@@ -1783,41 +1780,6 @@ bool Frame::shouldDragAutoNode(Node *node, const IntPoint& point) const
     return false;
 }
 
-bool Frame::isPointInsideSelection(const IntPoint& point)
-{
-    // Treat a collapsed selection like no selection.
-    if (!selectionController()->isRange())
-        return false;
-    if (!document()->renderer()) 
-        return false;
-    
-    HitTestResult result(point, true, true);
-    document()->renderer()->layer()->hitTest(result);
-    Node *innerNode = result.innerNode();
-    if (!innerNode || !innerNode->renderer())
-        return false;
-    
-    Position pos(innerNode->renderer()->positionForPoint(point).deepEquivalent());
-    if (pos.isNull())
-        return false;
-
-    Node *n = selectionController()->start().node();
-    while (n) {
-        if (n == pos.node()) {
-            if ((n == selectionController()->start().node() && pos.offset() < selectionController()->start().offset()) ||
-                (n == selectionController()->end().node() && pos.offset() > selectionController()->end().offset())) {
-                return false;
-            }
-            return true;
-        }
-        if (n == selectionController()->end().node())
-            break;
-        n = n->traverseNextNode();
-    }
-
-   return false;
-}
-
 void Frame::selectClosestWordFromMouseEvent(const PlatformMouseEvent& mouse, Node *innerNode)
 {
     Selection newSelection;
@@ -1892,7 +1854,7 @@ void Frame::handleMousePressEventSingleClick(const MouseEventWithHitTestResults&
             // Don't restart the selection when the mouse is pressed on an
             // existing selection so we can allow for text dragging.
             IntPoint vPoint = view()->windowToContents(event.event().pos());
-            if (!extendSelection && isPointInsideSelection(vPoint))
+            if (!extendSelection && selectionController()->contains(vPoint))
                 return;
 
             VisiblePosition visiblePos(innerNode->renderer()->positionForPoint(vPoint));
@@ -2041,28 +2003,7 @@ void Frame::handleMouseReleaseEvent(const MouseEventWithHitTestResults& event)
 
     notifyRendererOfSelectionChange(true);
 
-    selectFrameElementInParentIfFullySelected();
-}
-
-void Frame::selectAll()
-{
-    if (!d->m_doc)
-        return;
-    
-    Node* root = selectionController()->isContentEditable() ? selectionController()->rootEditableElement() : d->m_doc->documentElement();
-    selectContentsOfNode(root);
-    selectFrameElementInParentIfFullySelected();
-    notifyRendererOfSelectionChange(true);
-}
-
-bool Frame::selectContentsOfNode(Node* node)
-{
-    Selection newSelection(Selection::selectionFromContentsOfNode(node));
-    if (shouldChangeSelection(newSelection)) {
-        selectionController()->setSelection(newSelection);
-        return true;
-    }
-    return false;
+    selectionController()->selectFrameElementInParentIfFullySelected();
 }
 
 bool Frame::shouldChangeSelection(const Selection& newSelection) const
@@ -2125,11 +2066,6 @@ bool Frame::isSelectionInPasswordField()
     return startNode && startNode->hasTagName(inputTag) && static_cast<HTMLInputElement*>(startNode)->inputType() == HTMLInputElement::PASSWORD;
 }
   
-EditCommand* Frame::lastEditCommand()
-{
-    return d->m_lastEditCommand.get();
-}
-
 static void dispatchEditableContentChangedEvents(const EditCommand& command)
 {
      Element* startRoot = command.startingRootEditableElement();
@@ -2161,12 +2097,12 @@ void Frame::appliedEditing(PassRefPtr<EditCommand> cmd)
     }
 
     // Command will be equal to last edit command only in the case of typing
-    if (d->m_lastEditCommand == cmd)
+    if (editor()->lastEditCommand() == cmd)
         assert(cmd->isTypingCommand());
     else {
         // Only register a new undo command if the command passed in is
         // different from the last command
-        d->m_lastEditCommand = cmd.get();
+        editor()->setLastEditCommand(cmd.get());
         registerCommandForUndo(cmd);
     }
     respondToChangedContents(newSelection);
@@ -2181,7 +2117,7 @@ void Frame::unappliedEditing(PassRefPtr<EditCommand> cmd)
     if (shouldChangeSelection(newSelection))
         selectionController()->setSelection(newSelection, true);
         
-    d->m_lastEditCommand = 0;
+    editor()->setLastEditCommand(0);
     registerCommandForRedo(cmd);
     respondToChangedContents(newSelection);
     editor()->respondToChangedContents();
@@ -2195,7 +2131,7 @@ void Frame::reappliedEditing(PassRefPtr<EditCommand> cmd)
     if (shouldChangeSelection(newSelection))
         selectionController()->setSelection(newSelection, true);
         
-    d->m_lastEditCommand = 0;
+    editor()->setLastEditCommand(0);
     registerCommandForUndo(cmd);
     respondToChangedContents(newSelection);
     editor()->respondToChangedContents();
@@ -2616,57 +2552,6 @@ void Frame::lifeSupportTimerFired(Timer<Frame>*)
     deref();
 }
 
-// Workaround for the fact that it's hard to delete a frame.
-// Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
-// Can't do this implicitly as part of every setSelection call because in some contexts it might not be good
-// for the focus to move to another frame. So instead we call it from places where we are selecting with the
-// mouse or the keyboard after setting the selection.
-void Frame::selectFrameElementInParentIfFullySelected()
-{
-    // Find the parent frame; if there is none, then we have nothing to do.
-    Frame *parent = tree()->parent();
-    if (!parent)
-        return;
-    FrameView *parentView = parent->view();
-    if (!parentView)
-        return;
-
-    // Check if the selection contains the entire frame contents; if not, then there is nothing to do.
-    if (!selectionController()->isRange())
-        return;
-    if (!isStartOfDocument(selectionController()->selection().visibleStart()))
-        return;
-    if (!isEndOfDocument(selectionController()->selection().visibleEnd()))
-        return;
-
-    // Get to the <iframe> or <frame> (or even <object>) element in the parent frame.
-    Document *doc = document();
-    if (!doc)
-        return;
-    Element *ownerElement = doc->ownerElement();
-    if (!ownerElement)
-        return;
-    Node *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->isContentEditable())
-        return;
-
-    // Create compute positions before and after the element.
-    unsigned ownerElementNodeIndex = ownerElement->nodeIndex();
-    VisiblePosition beforeOwnerElement(VisiblePosition(ownerElementParent, ownerElementNodeIndex, SEL_DEFAULT_AFFINITY));
-    VisiblePosition afterOwnerElement(VisiblePosition(ownerElementParent, ownerElementNodeIndex + 1, VP_UPSTREAM_IF_POSSIBLE));
-
-    // Focus on the parent frame, and then select from before this element to after.
-    Selection newSelection(beforeOwnerElement, afterOwnerElement);
-    if (parent->shouldChangeSelection(newSelection)) {
-        parentView->setFocus();
-        parent->selectionController()->setSelection(newSelection);
-    }
-}
-
 bool Frame::mouseDownMayStartAutoscroll() const
 {
     return d->m_mouseDownMayStartAutoscroll;
index 60fc0d6d7eb5f60d86a5903d5a74879de8340346..d17608801a7a95352336c72b8bec67a6eb8b31ab 100644 (file)
@@ -392,17 +392,6 @@ public:
    */
   bool hasSelection() const;
 
-  /**
-   * Marks all text in the document as selected.
-   */
-  void selectAll();
-
-  /**
-   * Marks contents of node as selected.
-   * Returns whether the selection changed.
-   */
-  bool selectContentsOfNode(Node*);
   /**
    * Returns whether editing should end in the given range
    */
@@ -442,11 +431,6 @@ public:
   
   bool isSelectionInPasswordField();
   
-  /**
-   * Returns the most recent edit command applied.
-   */
-  EditCommand* lastEditCommand();
-
   /**
    * Called when editing has been applied.
    */
@@ -499,8 +483,6 @@ public:
    */
   String lastModified() const;
 
-  bool isPointInsideSelection(const IntPoint&);
-
   virtual bool tabsToLinks() const;
   virtual bool tabsToAllControls() const;
 
@@ -643,10 +625,6 @@ public:
   Document* document() const;
   void setDocument(Document* newDoc);
 
-  // Workaround for the fact that it's hard to delete a frame.
-  // Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
-  void selectFrameElementInParentIfFullySelected();
-  
   virtual bool mouseDownMayStartSelect() const { return true; }
   bool mouseDownMayStartAutoscroll() const;
   void setMouseDownMayStartAutoscroll(bool b);
index f8630b77ef02cb87eea1a545ba66d94e9bf5aeb4..7f6ef2bc713890ed78ef66711d68b3b6ee18181d 100644 (file)
@@ -212,7 +212,6 @@ namespace WebCore {
         bool m_bCleared : 1;
         bool m_isActive : 1;
 
-        RefPtr<EditCommand> m_lastEditCommand;
         int m_xPosForVerticalArrowNavigation;
         RefPtr<CSSMutableStyleDeclaration> m_typingStyle;
 
index f8407e2ce16a01d67bf96f291e9e7c7718bf061c..46f103b59e0c48af5e3949b60322b900f9eeccd8 100644 (file)
@@ -29,6 +29,7 @@
 #include "HTMLElement.h"
 #include "PlatformScrollBar.h"
 #include "RenderObject.h"
+#include "SelectionController.h"
 
 namespace WebCore {
 
@@ -121,7 +122,7 @@ bool HitTestResult::isSelected() const
     if (!frame)
         return false;
 
-    return frame->isPointInsideSelection(m_point);
+    return frame->selectionController()->contains(m_point);
 }
 
 String HitTestResult::title() const
index 7c14900f7f713ac87c00bc91a1f1590786edd470..733af8b2e534db4eabe4e8171c862fb5e0f3fda0 100644 (file)
@@ -25,7 +25,6 @@
 #ifndef RENDER_BOX_H
 #define RENDER_BOX_H
 
-#include "loader.h"
 #include "RenderLayer.h"
 
 namespace WebCore {
index 63e7ee4358878ca8592310bc161bd269165b1baf..772e63fed260b0cb523f0db2cccb7531bdd5b7b4 100644 (file)
@@ -1,3 +1,22 @@
+2006-10-30  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Darin.
+
+        Removed a number of editing and selection methods from the bridge.
+        
+        I moved cross-platform editing and selection code into WebCore::Editor and 
+        WebCore::SelectionController, respecitvely.
+        
+        All of the seemingly new code here is just code grabbed from WebCore or
+        merged from WebCoreFrameBridge.
+        
+        I changed one piece of internal API: we now pass around Ranges in places
+        where we used to pass around broken out components of Ranges.
+        
+        I also added WebCore XPATH_SUPPORT AND SVG_SUPPORT #defines to the project.
+        Since we now include WebCore headers that depend on these #defines, we need
+        to keep in sync with them, to avoid binary incompatibility.
+
 2006-10-30  Darin Adler  <darin@apple.com>
 
         Reviewed by John Sullivan.
index 733ec2bc70dcf4f5bf1516e52a30f2cc8243d475..a4ee9fc7a31af6a3d1a924b2ba1d694838b54871 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+namespace WebCore {
+    class Range;
+}
+
 @interface NSAttributedString (WebKitExtras)
 
++ (NSAttributedString *)_web_attributedStringFromRange:(WebCore::Range*)range;
 - (NSAttributedString *)_web_attributedStringByStrippingAttachmentCharacters;
 
 @end
index 14cf1922e07ef036d672bb72bea37fc51741927c..bcb3c5b951e91bca734a8b14db4c6412f0df78da 100644 (file)
 
 #import "WebNSAttributedStringExtras.h"
 
+#import "DOMRangeInternal.h"
+#import "WebDataSourcePrivate.h"
+#import "WebFrame.h"
+#import "WebFrameBridge.h"
+#import "WebFrameInternal.h"
+#import <WebCore/csshelper.h>
+#import <WebCore/BlockExceptions.h>
+#import <WebCore/Document.h>
+#import <WebCore/Element.h>
+#import <WebCore/FontData.h>
+#import <WebCore/FrameMac.h>
+#import <WebCore/HTMLNames.h>
+#import <WebCore/Image.h>
+#import <WebCore/InlineTextBox.h>
+#import <WebCore/KURL.h>
+#import <WebCore/Range.h>
+#import <WebCore/RenderImage.h>
+#import <WebCore/RenderListItem.h>
+#import <WebCore/RenderObject.h>
+#import <WebCore/RenderStyle.h>
+#import <WebCore/RenderText.h>
+#import <WebCore/Text.h>
+
+using namespace WebCore;
+using namespace HTMLNames;
+
+#define BULLET_CHAR 0x2022
+#define SQUARE_CHAR 0x25AA
+#define CIRCLE_CHAR 0x25E6
+
+struct ListItemInfo {
+    unsigned start;
+    unsigned end;
+};
+
+static Element* listParent(Element* item)
+{
+    while (!item->hasTagName(ulTag) && !item->hasTagName(olTag)) {
+        item = static_cast<Element*>(item->parentNode());
+        if (!item)
+            break;
+    }
+    return item;
+}
+
+static Node* isTextFirstInListItem(Node* e)
+{
+    if (!e->isTextNode())
+        return 0;
+    Node* par = e->parentNode();
+    while (par) {
+        if (par->firstChild() != e)
+            return 0;
+        if (par->hasTagName(liTag))
+            return par;
+        e = par;
+        par = par->parentNode();
+    }
+    return 0;
+}
+
+static NSFileWrapper *fileWrapperForElement(Element* e)
+{
+    NSFileWrapper *wrapper = nil;
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    
+    const AtomicString& attr = e->getAttribute(srcAttr);
+    if (!attr.isEmpty()) {
+        NSURL *URL = KURL(e->document()->completeURL(attr.deprecatedString())).getNSURL();
+        wrapper = [[kit(e->document()->frame()) dataSource] _fileWrapperForURL:URL];
+    }
+    if (!wrapper) {
+        RenderImage* renderer = static_cast<RenderImage*>(e->renderer());
+        if (renderer->cachedImage() && !renderer->cachedImage()->isErrorImage()) {
+            wrapper = [[NSFileWrapper alloc] initRegularFileWithContents:(NSData *)(renderer->cachedImage()->image()->getTIFFRepresentation())];
+            [wrapper setPreferredFilename:@"image.tiff"];
+            [wrapper autorelease];
+        }
+    }
+
+    return wrapper;
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    return nil;
+}
 
 @implementation NSAttributedString (WebKitExtras)
 
     return self;
 }
 
+// FIXME: Use WebCore::TextIterator to iterate text runs.
+
++ (NSAttributedString *)_web_attributedStringFromRange:(Range*)range
+{
+    ListItemInfo info;
+    ExceptionCode ec = 0; // dummy variable -- we ignore DOM exceptions
+    NSMutableAttributedString *result;
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    if (!range->boundaryPointsValid())
+        return nil;
+    
+    Node* firstNode = range->startNode();
+    if (!firstNode)
+        return nil;
+    Node* pastEndNode = range->pastEndNode();
+    
+    int startOffset = range->startOffset(ec);
+    int endOffset = range->endOffset(ec);
+    Node* endNode = range->endContainer(ec);
+
+    result = [[[NSMutableAttributedString alloc] init] autorelease];
+    
+    bool hasNewLine = true;
+    bool addedSpace = true;
+    NSAttributedString *pendingStyledSpace = nil;
+    bool hasParagraphBreak = true;
+    const Element *linkStartNode = 0;
+    unsigned linkStartLocation = 0;
+    Vector<Element*> listItems;
+    Vector<ListItemInfo> listItemLocations;
+    float maxMarkerWidth = 0;
+    
+    Node *currentNode = firstNode;
+    
+    // If the first item is the entire text of a list item, use the list item node as the start of the 
+    // selection, not the text node.  The user's intent was probably to select the list.
+    if (currentNode->isTextNode() && startOffset == 0) {
+        Node *startListNode = isTextFirstInListItem(firstNode);
+        if (startListNode){
+            firstNode = startListNode;
+            currentNode = firstNode;
+        }
+    }
+    
+    while (currentNode && currentNode != pastEndNode) {
+        RenderObject *renderer = currentNode->renderer();
+        if (renderer) {
+            RenderStyle *style = renderer->style();
+            NSFont *font = style->font().primaryFont()->getNSFont();
+            bool needSpace = pendingStyledSpace != nil;
+            if (currentNode->isTextNode()) {
+                if (hasNewLine) {
+                    addedSpace = true;
+                    needSpace = false;
+                    [pendingStyledSpace release];
+                    pendingStyledSpace = nil;
+                    hasNewLine = false;
+                }
+                DeprecatedString text;
+                DeprecatedString str = currentNode->nodeValue().deprecatedString();
+                int start = (currentNode == firstNode) ? startOffset : -1;
+                int end = (currentNode == endNode) ? endOffset : -1;
+                if (renderer->isText()) {
+                    if (!style->collapseWhiteSpace()) {
+                        if (needSpace && !addedSpace) {
+                            if (text.isEmpty() && linkStartLocation == [result length])
+                                ++linkStartLocation;
+                            [result appendAttributedString:pendingStyledSpace];
+                        }
+                        int runStart = (start == -1) ? 0 : start;
+                        int runEnd = (end == -1) ? str.length() : end;
+                        text += str.mid(runStart, runEnd-runStart);
+                        [pendingStyledSpace release];
+                        pendingStyledSpace = nil;
+                        addedSpace = u_charDirection(str[runEnd - 1].unicode()) == U_WHITE_SPACE_NEUTRAL;
+                    }
+                    else {
+                        RenderText* textObj = static_cast<RenderText*>(renderer);
+                        if (!textObj->firstTextBox() && str.length() > 0 && !addedSpace) {
+                            // We have no runs, but we do have a length.  This means we must be
+                            // whitespace that collapsed away at the end of a line.
+                            text += ' ';
+                            addedSpace = true;
+                        }
+                        else {
+                            addedSpace = false;
+                            for (InlineTextBox* box = textObj->firstTextBox(); box; box = box->nextTextBox()) {
+                                int runStart = (start == -1) ? box->m_start : start;
+                                int runEnd = (end == -1) ? box->m_start + box->m_len : end;
+                                if (runEnd > box->m_start + box->m_len)
+                                    runEnd = box->m_start + box->m_len;
+                                if (runStart >= box->m_start &&
+                                    runStart < box->m_start + box->m_len) {
+                                    if (box == textObj->firstTextBox() && box->m_start == runStart && runStart > 0)
+                                        needSpace = true; // collapsed space at the start
+                                    if (needSpace && !addedSpace) {
+                                        if (pendingStyledSpace != nil) {
+                                            if (text.isEmpty() && linkStartLocation == [result length])
+                                                ++linkStartLocation;
+                                            [result appendAttributedString:pendingStyledSpace];
+                                        } else
+                                            text += ' ';
+                                    }
+                                    DeprecatedString runText = str.mid(runStart, runEnd - runStart);
+                                    runText.replace('\n', ' ');
+                                    text += runText;
+                                    int nextRunStart = box->nextTextBox() ? box->nextTextBox()->m_start : str.length(); // collapsed space between runs or at the end
+                                    needSpace = nextRunStart > runEnd;
+                                    [pendingStyledSpace release];
+                                    pendingStyledSpace = nil;
+                                    addedSpace = u_charDirection(str[runEnd - 1].unicode()) == U_WHITE_SPACE_NEUTRAL;
+                                    start = -1;
+                                }
+                                if (end != -1 && runEnd >= end)
+                                    break;
+                            }
+                        }
+                    }
+                }
+                
+                text.replace('\\', renderer->backslashAsCurrencySymbol());
+    
+                if (text.length() > 0 || needSpace) {
+                    NSMutableDictionary *attrs = [[NSMutableDictionary alloc] init];
+                    [attrs setObject:font forKey:NSFontAttributeName];
+                    if (style && style->color().isValid() && style->color().alpha() != 0)
+                        [attrs setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
+                    if (style && style->backgroundColor().isValid() && style->backgroundColor().alpha() != 0)
+                        [attrs setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
+
+                    if (text.length() > 0) {
+                        hasParagraphBreak = false;
+                        NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:text.getNSString() attributes:attrs];
+                        [result appendAttributedString: partialString];                
+                        [partialString release];
+                    }
+
+                    if (needSpace) {
+                        [pendingStyledSpace release];
+                        pendingStyledSpace = [[NSAttributedString alloc] initWithString:@" " attributes:attrs];
+                    }
+
+                    [attrs release];
+                }
+            } else {
+                // This is our simple HTML -> ASCII transformation:
+                DeprecatedString text;
+                if (currentNode->hasTagName(aTag)) {
+                    // Note the start of the <a> element.  We will add the NSLinkAttributeName
+                    // attribute to the attributed string when navigating to the next sibling 
+                    // of this node.
+                    linkStartLocation = [result length];
+                    linkStartNode = static_cast<Element*>(currentNode);
+                } else if (currentNode->hasTagName(brTag)) {
+                    text += "\n";
+                    hasNewLine = true;
+                } else if (currentNode->hasTagName(liTag)) {
+                    DeprecatedString listText;
+                    Element *itemParent = listParent(static_cast<Element*>(currentNode));
+                    
+                    if (!hasNewLine)
+                        listText += '\n';
+                    hasNewLine = true;
+
+                    listItems.append(static_cast<Element*>(currentNode));
+                    info.start = [result length];
+                    info.end = 0;
+                    listItemLocations.append (info);
+                    
+                    listText += '\t';
+                    if (itemParent && renderer->isListItem()) {
+                        RenderListItem* listRenderer = static_cast<RenderListItem*>(renderer);
+
+                        maxMarkerWidth = MAX([font pointSize], maxMarkerWidth);
+                        switch(style->listStyleType()) {
+                            case DISC:
+                                listText += ((DeprecatedChar)BULLET_CHAR);
+                                break;
+                            case CIRCLE:
+                                listText += ((DeprecatedChar)CIRCLE_CHAR);
+                                break;
+                            case SQUARE:
+                                listText += ((DeprecatedChar)SQUARE_CHAR);
+                                break;
+                            case LNONE:
+                                break;
+                            default:
+                                DeprecatedString marker = listRenderer->markerStringValue();
+                                listText += marker;
+                                // Use AppKit metrics.  Will be rendered by AppKit.
+                                float markerWidth = [marker.getNSString() sizeWithAttributes:[NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]].width;
+                                maxMarkerWidth = MAX(markerWidth, maxMarkerWidth);
+                        }
+
+                        listText += ' ';
+                        listText += '\t';
+
+                        NSMutableDictionary *attrs = [[NSMutableDictionary alloc] init];
+                        [attrs setObject:font forKey:NSFontAttributeName];
+                        if (style && style->color().isValid())
+                            [attrs setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
+                        if (style && style->backgroundColor().isValid())
+                            [attrs setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
+
+                        NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:listText.getNSString() attributes:attrs];
+                        [attrs release];
+                        [result appendAttributedString: partialString];                
+                        [partialString release];
+                    }
+                } else if (currentNode->hasTagName(olTag) || currentNode->hasTagName(ulTag)) {
+                    if (!hasNewLine)
+                        text += "\n";
+                    hasNewLine = true;
+                } else if (currentNode->hasTagName(blockquoteTag)
+                        || currentNode->hasTagName(ddTag)
+                        || currentNode->hasTagName(divTag)
+                        || currentNode->hasTagName(dlTag)
+                        || currentNode->hasTagName(dtTag)
+                        || currentNode->hasTagName(hrTag)
+                        || currentNode->hasTagName(listingTag)
+                        || currentNode->hasTagName(preTag)
+                        || currentNode->hasTagName(tdTag)
+                        || currentNode->hasTagName(thTag)) {
+                    if (!hasNewLine)
+                        text += '\n';
+                    hasNewLine = true;
+                } else if (currentNode->hasTagName(h1Tag)
+                        || currentNode->hasTagName(h2Tag)
+                        || currentNode->hasTagName(h3Tag)
+                        || currentNode->hasTagName(h4Tag)
+                        || currentNode->hasTagName(h5Tag)
+                        || currentNode->hasTagName(h6Tag)
+                        || currentNode->hasTagName(pTag)
+                        || currentNode->hasTagName(trTag)) {
+                    if (!hasNewLine)
+                        text += '\n';
+                    
+                    // In certain cases, emit a paragraph break.
+                    int bottomMargin = renderer->collapsedMarginBottom();
+                    int fontSize = style->fontDescription().computedPixelSize();
+                    if (bottomMargin * 2 >= fontSize) {
+                        if (!hasParagraphBreak) {
+                            text += '\n';
+                            hasParagraphBreak = true;
+                        }
+                    }
+                    
+                    hasNewLine = true;
+                }
+                else if (currentNode->hasTagName(imgTag)) {
+                    if (pendingStyledSpace != nil) {
+                        if (linkStartLocation == [result length])
+                            ++linkStartLocation;
+                        [result appendAttributedString:pendingStyledSpace];
+                        [pendingStyledSpace release];
+                        pendingStyledSpace = nil;
+                    }
+                    NSFileWrapper *fileWrapper = fileWrapperForElement(static_cast<Element*>(currentNode));
+                    NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
+                    NSAttributedString *iString = [NSAttributedString attributedStringWithAttachment:attachment];
+                    [result appendAttributedString: iString];
+                    [attachment release];
+                }
+
+                NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:text.getNSString()];
+                [result appendAttributedString: partialString];
+                [partialString release];
+            }
+        }
+
+        Node *nextNode = currentNode->firstChild();
+        if (!nextNode)
+            nextNode = currentNode->nextSibling();
+
+        while (!nextNode && currentNode->parentNode()) {
+            DeprecatedString text;
+            currentNode = currentNode->parentNode();
+            if (currentNode == pastEndNode)
+                break;
+            nextNode = currentNode->nextSibling();
+
+            if (currentNode->hasTagName(aTag)) {
+                // End of a <a> element.  Create an attributed string NSLinkAttributeName attribute
+                // for the range of the link.  Note that we create the attributed string from the DOM, which
+                // will have corrected any illegally nested <a> elements.
+                if (linkStartNode && currentNode == linkStartNode) {
+                    String href = parseURL(linkStartNode->getAttribute(hrefAttr));
+                    KURL kURL = Mac(linkStartNode->document()->frame())->completeURL(href.deprecatedString());
+                    
+                    NSURL *URL = kURL.getNSURL();
+                    NSRange tempRange = { linkStartLocation, [result length]-linkStartLocation }; // workaround for 4213314
+                    [result addAttribute:NSLinkAttributeName value:URL range:tempRange];
+                    linkStartNode = 0;
+                }
+            }
+            else if (currentNode->hasTagName(olTag) || currentNode->hasTagName(ulTag)) {
+                if (!hasNewLine)
+                    text += '\n';
+                hasNewLine = true;
+            } else if (currentNode->hasTagName(liTag)) {
+                
+                int i, count = listItems.size();
+                for (i = 0; i < count; i++){
+                    if (listItems[i] == currentNode){
+                        listItemLocations[i].end = [result length];
+                        break;
+                    }
+                }
+                if (!hasNewLine)
+                    text += '\n';
+                hasNewLine = true;
+            } else if (currentNode->hasTagName(blockquoteTag) ||
+                       currentNode->hasTagName(ddTag) ||
+                       currentNode->hasTagName(divTag) ||
+                       currentNode->hasTagName(dlTag) ||
+                       currentNode->hasTagName(dtTag) ||
+                       currentNode->hasTagName(hrTag) ||
+                       currentNode->hasTagName(listingTag) ||
+                       currentNode->hasTagName(preTag) ||
+                       currentNode->hasTagName(tdTag) ||
+                       currentNode->hasTagName(thTag)) {
+                if (!hasNewLine)
+                    text += '\n';
+                hasNewLine = true;
+            } else if (currentNode->hasTagName(pTag) ||
+                       currentNode->hasTagName(trTag) ||
+                       currentNode->hasTagName(h1Tag) ||
+                       currentNode->hasTagName(h2Tag) ||
+                       currentNode->hasTagName(h3Tag) ||
+                       currentNode->hasTagName(h4Tag) ||
+                       currentNode->hasTagName(h5Tag) ||
+                       currentNode->hasTagName(h6Tag)) {
+                if (!hasNewLine)
+                    text += '\n';
+                // An extra newline is needed at the start, not the end, of these types of tags,
+                // so don't add another here.
+                hasNewLine = true;
+            }
+            
+            NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:text.getNSString()];
+            [result appendAttributedString:partialString];
+            [partialString release];
+        }
+
+        currentNode = nextNode;
+    }
+    
+    [pendingStyledSpace release];
+    
+    // Apply paragraph styles from outside in.  This ensures that nested lists correctly
+    // override their parent's paragraph style.
+    {
+        unsigned i, count = listItems.size();
+        Element *e;
+
+#ifdef POSITION_LIST
+        Node *containingBlock;
+        int containingBlockX, containingBlockY;
+        
+        // Determine the position of the outermost containing block.  All paragraph
+        // styles and tabs should be relative to this position.  So, the horizontal position of 
+        // each item in the list (in the resulting attributed string) will be relative to position 
+        // of the outermost containing block.
+        if (count > 0){
+            containingBlock = firstNode;
+            while (containingBlock->renderer()->isInline()){
+                containingBlock = containingBlock->parentNode();
+            }
+            containingBlock->renderer()->absolutePosition(containingBlockX, containingBlockY);
+        }
+#endif
+        
+        for (i = 0; i < count; i++){
+            e = listItems[i];
+            info = listItemLocations[i];
+            
+            if (info.end < info.start)
+                info.end = [result length];
+                
+            RenderObject *r = e->renderer();
+            RenderStyle *style = r->style();
+
+            int rx;
+            NSFont *font = style->font().primaryFont()->getNSFont();
+            float pointSize = [font pointSize];
+
+#ifdef POSITION_LIST
+            int ry;
+            r->absolutePosition(rx, ry);
+            rx -= containingBlockX;
+            
+            // Ensure that the text is indented at least enough to allow for the markers.
+            rx = MAX(rx, (int)maxMarkerWidth);
+#else
+            rx = (int)MAX(maxMarkerWidth, pointSize);
+#endif
+
+            // The bullet text will be right aligned at the first tab marker, followed
+            // by a space, followed by the list item text.  The space is arbitrarily
+            // picked as pointSize*2/3.  The space on the first line of the text item
+            // is established by a left aligned tab, on subsequent lines it's established
+            // by the head indent.
+            NSMutableParagraphStyle *mps = [[NSMutableParagraphStyle alloc] init];
+            [mps setFirstLineHeadIndent: 0];
+            [mps setHeadIndent: rx];
+            [mps setTabStops:[NSArray arrayWithObjects:
+                        [[[NSTextTab alloc] initWithType:NSRightTabStopType location:rx-(pointSize*2/3)] autorelease],
+                        [[[NSTextTab alloc] initWithType:NSLeftTabStopType location:rx] autorelease],
+                        nil]];
+            NSRange tempRange = { info.start, info.end-info.start }; // workaround for 4213314
+            [result addAttribute:NSParagraphStyleAttributeName value:mps range:tempRange];
+            [mps release];
+        }
+    }
+
+    return result;
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    return nil;
+}
+
 @end
index a02f99bc1f6615e2eab1870583a80e2ecef25ec3..47a22b31cfd94ad683d47a43bbbb6b37edc5c318 100644 (file)
@@ -1200,9 +1200,9 @@ static id <WebFormDelegate> formDelegate(WebFrameBridge *self)
     return [[self webView] isEditable];
 }
 
-- (BOOL)shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag
+- (BOOL)shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(WebCore::EAffinity)selectionAffinity stillSelecting:(BOOL)flag
 {
-    return [[self webView] _shouldChangeSelectedDOMRange:currentRange toDOMRange:proposedRange affinity:selectionAffinity stillSelecting:flag];
+    return [[self webView] _shouldChangeSelectedDOMRange:currentRange toDOMRange:proposedRange affinity:kit(selectionAffinity) stillSelecting:flag];
 }
 
 - (BOOL)shouldDeleteSelectedDOMRange:(DOMRange *)range
index 874531e55fd696fb97adf73be352b1ad94be2bd0..b0022b686c15413f8a92059f44e9bdb60bd539d6 100644 (file)
                2D36FD5E03F78F9E00A80166 /* WebFormDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFormDelegatePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                2D81DAB203EB0B2D00A80166 /* WebFormDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFormDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                2D81DAB303EB0B2D00A80166 /* WebFormDelegate.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebFormDelegate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               35081D9202B6D4D80ACA2ACA /* WebHTMLRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHTMLRepresentation.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               35081D9202B6D4D80ACA2ACA /* WebHTMLRepresentation.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; indentWidth = 4; path = WebHTMLRepresentation.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                35081D9302B6D4D80ACA2ACA /* WebHTMLRepresentation.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebHTMLRepresentation.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                35081D9402B6D4D80ACA2ACA /* WebHTMLView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHTMLView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                35081D9502B6D4D80ACA2ACA /* WebHTMLView.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebHTMLView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                ED2B2474033A2DA800C1A526 /* WebNSPasteboardExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSPasteboardExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                ED2B2475033A2DA800C1A526 /* WebNSPasteboardExtras.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebNSPasteboardExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                ED6BE2E5088C32B50044DEDC /* WebNSAttributedStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSAttributedStringExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               ED6BE2E6088C32B50044DEDC /* WebNSAttributedStringExtras.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSAttributedStringExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               ED6BE2E6088C32B50044DEDC /* WebNSAttributedStringExtras.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; indentWidth = 4; path = WebNSAttributedStringExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                ED7F6D8A0980683500C235ED /* WebNSDataExtrasPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNSDataExtrasPrivate.h; sourceTree = "<group>"; };
                EDD1A5C605C83987008E3150 /* WebNSPrintOperationExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSPrintOperationExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                EDD1A5C705C83987008E3150 /* WebNSPrintOperationExtras.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSPrintOperationExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                                EXPORTED_SYMBOLS_FILE_ppc = WebKit.exp;
                                EXPORTED_SYMBOLS_FILE_ppc64 = WebKit.LP64.exp;
                                EXPORTED_SYMBOLS_FILE_x86_64 = WebKit.LP64.exp;
+                               FEATURE_DEFINES = "SVG_SUPPORT XPATH_SUPPORT";
                                FRAMEWORK_SEARCH_PATHS = (
                                        "$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks",
                                        "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks",
                                GCC_PREFIX_HEADER = WebKitPrefix.h;
                                GCC_PREPROCESSOR_DEFINITIONS = (
                                        "$(DEBUG_DEFINES)",
+                                       "$(FEATURE_DEFINES)",
                                        "FRAMEWORK_NAME=WebKit",
                                        "$(PER_CONFIGURATION_PREPROCESSOR_DEFINES)",
                                );
                                EXPORTED_SYMBOLS_FILE_ppc = WebKit.exp;
                                EXPORTED_SYMBOLS_FILE_ppc64 = WebKit.LP64.exp;
                                EXPORTED_SYMBOLS_FILE_x86_64 = WebKit.LP64.exp;
+                               FEATURE_DEFINES = "SVG_SUPPORT XPATH_SUPPORT";
                                FRAMEWORK_SEARCH_PATHS = (
                                        "$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks",
                                        "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks",
                                GCC_PREFIX_HEADER = WebKitPrefix.h;
                                GCC_PREPROCESSOR_DEFINITIONS = (
                                        "$(DEBUG_DEFINES)",
+                                       "$(FEATURE_DEFINES)",
                                        "FRAMEWORK_NAME=WebKit",
                                        "$(PER_CONFIGURATION_PREPROCESSOR_DEFINES)",
                                );
                                EXPORTED_SYMBOLS_FILE_ppc = WebKit.exp;
                                EXPORTED_SYMBOLS_FILE_ppc64 = WebKit.LP64.exp;
                                EXPORTED_SYMBOLS_FILE_x86_64 = WebKit.LP64.exp;
+                               FEATURE_DEFINES = "SVG_SUPPORT XPATH_SUPPORT";
                                FRAMEWORK_SEARCH_PATHS = (
                                        "$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Frameworks",
                                        "$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks",
                                GCC_PREFIX_HEADER = WebKitPrefix.h;
                                GCC_PREPROCESSOR_DEFINITIONS = (
                                        "$(DEBUG_DEFINES)",
+                                       "$(FEATURE_DEFINES)",
                                        "FRAMEWORK_NAME=WebKit",
                                        "$(PER_CONFIGURATION_PREPROCESSOR_DEFINES)",
                                );
index 7de5c54dedcf1384d06598fb477988948be75200..3a4d705de1d9535bdbb0d50df2e12c77fe770816 100644 (file)
@@ -28,6 +28,8 @@
 
 #import "WebHTMLRepresentation.h"
 
+#import "DOMNodeInternal.h"
+#import "DOMRangeInternal.h"
 #import "WebArchive.h"
 #import "WebBasePluginPackage.h"
 #import "WebDataSourceInternal.h"
 #import "WebFrameInternal.h"
 #import "WebKitNSStringExtras.h"
 #import "WebKitStatisticsPrivate.h"
+#import "WebNSAttributedStringExtras.h"
 #import "WebNSObjectExtras.h"
 #import "WebResourcePrivate.h"
 #import "WebView.h"
 #import <Foundation/NSURLResponse.h>
 #import <JavaScriptCore/Assertions.h>
-#import <WebCore/FrameMac.h>
+#import <WebCore/Document.h>
 #import <WebCore/DocumentLoader.h>
+#import <WebCore/FrameMac.h>
+#import <WebCore/Range.h>
+
+using namespace WebCore;
 
 @interface WebHTMLRepresentationPrivate : NSObject
 {
     return nil;
 }
 
-- (NSAttributedString *)attributedStringFrom: (DOMNode *)startNode startOffset: (int)startOffset to: (DOMNode *)endNode endOffset: (int)endOffset
+- (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset
 {
-    return [_private->bridge attributedStringFrom: startNode startOffset: startOffset to: endNode endOffset: endOffset];
+    Range range([startNode _node]->document(), [startNode _node], startOffset, [endNode _node], endOffset);
+    return [NSAttributedString _web_attributedStringFromRange:&range];
 }
 
 - (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form
index d48e1e09c0ea1a58dee2e3760aa8a121b21b50f7..6301a26bf91914ce9f2dd01c38307710b019d9a9 100644 (file)
@@ -28,6 +28,8 @@
 
 #import "WebHTMLView.h"
 
+#import "DOMNodeInternal.h"
+#import "DOMRangeInternal.h"
 #import "WebArchive.h"
 #import "WebArchiver.h"
 #import "WebBaseNetscapePluginViewInternal.h"
 #import "WebViewInternal.h"
 #import <AppKit/NSAccessibility.h>
 #import <ApplicationServices/ApplicationServices.h>
+#import <WebCore/Document.h>
+#import <WebCore/Editor.h>
+#import <WebCore/ExceptionHandlers.h>
 #import <WebCore/FloatRect.h>
 #import <WebCore/FrameMac.h>
 #import <WebCore/HitTestResult.h>
+#import <WebCore/Range.h>
 #import <WebCore/SelectionController.h>
 #import <WebCore/WebCoreTextRenderer.h>
 #import <WebCore/WebDataProtocol.h>
@@ -609,6 +615,7 @@ extern "C" void *_NSSoftLinkingGetFrameworkFuncPtr(NSString *inUmbrellaFramework
          granularity:(WebBridgeSelectionGranularity)granularity
 {
     WebFrameBridge *bridge = [self _bridge];
+    Frame* coreFrame = core([self _frame]);
     BOOL smartDelete = smartDeleteOK ? [self _canSmartCopyOrDelete] : NO;
 
     BOOL startNewKillRingSequence = _private->startNewKillRingSequence;
@@ -626,19 +633,23 @@ extern "C" void *_NSSoftLinkingGetFrameworkFuncPtr(NSString *inUmbrellaFramework
         startNewKillRingSequence = NO;
     }
 
-    switch (deletionAction) {
-        case deleteSelectionAction:
-            [bridge setSelectedDOMRange:range affinity:NSSelectionAffinityDownstream closeTyping:YES];
-            [bridge deleteSelectionWithSmartDelete:smartDelete];
-            break;
-        case deleteKeyAction:
-            [bridge setSelectedDOMRange:range affinity:NSSelectionAffinityDownstream closeTyping:(granularity != WebBridgeSelectByCharacter)];
-            [bridge deleteKeyPressedWithSmartDelete:smartDelete granularity:granularity];
-            break;
-        case forwardDeleteKeyAction:
-            [bridge setSelectedDOMRange:range affinity:NSSelectionAffinityDownstream closeTyping:(granularity != WebBridgeSelectByCharacter)];
-            [bridge forwardDeleteKeyPressedWithSmartDelete:smartDelete granularity:granularity];
-            break;
+    if (coreFrame) {
+        SelectionController* selectionController = coreFrame->selectionController();
+        Editor* editor = coreFrame->editor();
+        switch (deletionAction) {
+            case deleteSelectionAction:
+                selectRange(selectionController, core(range), DOWNSTREAM, true);
+                editor->deleteSelectionWithSmartDelete(smartDelete);
+                break;
+            case deleteKeyAction:
+                selectRange(coreFrame->selectionController(), core(range), DOWNSTREAM, (granularity != WebBridgeSelectByCharacter));
+                [bridge deleteKeyPressedWithSmartDelete:smartDelete granularity:granularity];
+                break;
+            case forwardDeleteKeyAction:
+                selectRange(coreFrame->selectionController(), core(range), DOWNSTREAM, (granularity != WebBridgeSelectByCharacter));
+                [bridge forwardDeleteKeyPressedWithSmartDelete:smartDelete granularity:granularity];
+                break;
+        }
     }
 
     _private->startNewKillRingSequence = startNewKillRingSequence;
@@ -2669,9 +2680,16 @@ static WebHTMLView *lastHitView = nil;
     return [[self _bridge] searchFor:string direction:forward caseSensitive:caseFlag wrap:wrapFlag];
 }
 
-- (void)deselectText
+- (void)clearFocus
 {
-    [[self _bridge] deselectText];
+    Frame* coreFrame = core([self _frame]);
+    if (!coreFrame)
+        return;
+    Document* document = coreFrame->document();
+    if (!document)
+        return;
+    
+    document->setFocusNode(0);
 }
 
 - (BOOL)isOpaque
@@ -3142,10 +3160,9 @@ done:
         [_private->compController endRevertingChange:NO moveLeft:NO];
         _private->resigningFirstResponder = YES;
         if (![self maintainsInactiveSelection]) { 
-            if ([[self _webView] _isPerformingProgrammaticFocus])
-                [self deselectText];
-            else
-                [self deselectAll];
+            [self deselectAll];
+            if (![[self _webView] _isPerformingProgrammaticFocus])
+                [self clearFocus];
         }
         [self _updateActiveState];
         _private->resigningFirstResponder = NO;
@@ -3765,14 +3782,25 @@ done:
 {
     if (![self _canAlterCurrentSelection])
         return;
-        
-    WebFrameBridge *bridge = [self _bridge];
-    DOMRange *range = [bridge rangeByExpandingSelectionWithGranularity:granularity];
-    if (range && ![range collapsed]) {
-        WebView *webView = [self _webView];
-        if ([[webView _editingDelegateForwarder] webView:webView shouldChangeSelectedDOMRange:[self _selectedRange] toDOMRange:range affinity:[bridge selectionAffinity] stillSelecting:NO])
-            [bridge setSelectedDOMRange:range affinity:[bridge selectionAffinity] closeTyping:YES];
-    }
+    
+    Frame* coreFrame = core([self _frame]);
+    if (!coreFrame || !coreFrame->hasSelection())
+        return;
+
+    // NOTE: The enums *must* match the very similar ones declared in SelectionController.h
+    Selection selection(coreFrame->selectionController()->selection());
+    selection.expandUsingGranularity(static_cast<TextGranularity>(granularity));
+    
+    RefPtr<Range> range = selection.toRange();
+    DOMRange *domRange = kit(range.get());
+    
+    if ([domRange collapsed])
+        return;
+
+    EAffinity affinity = coreFrame->selectionController()->affinity();
+    WebView *webView = [self _webView];
+    if ([[webView _editingDelegateForwarder] webView:webView shouldChangeSelectedDOMRange:[self _selectedRange] toDOMRange:domRange affinity:kit(affinity) stillSelecting:NO])
+        selectRange(coreFrame->selectionController(), range.get(), affinity, true);
 }
 
 - (void)selectParagraph:(id)sender
@@ -4723,8 +4751,10 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
         return;
     }
     DOMRange *selection = [self _selectedRange];
+    Frame* coreFrame = core([self _frame]);
     NS_DURING
-        [bridge setSelectedDOMRange:unionDOMRanges(mark, selection) affinity:NSSelectionAffinityDownstream closeTyping:YES];
+        if (coreFrame)
+            selectRange(coreFrame->selectionController(), core(unionDOMRanges(mark, selection)), DOWNSTREAM, true);
     NS_HANDLER
         NSBeep();
     NS_ENDHANDLER
@@ -4734,13 +4764,17 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
 {
     WebFrameBridge *bridge = [self _bridge];
     DOMRange *mark = [bridge markDOMRange];
+
     if (mark == nil) {
         NSBeep();
         return;
     }
+
     DOMRange *selection = [self _selectedRange];
+    Frame* coreFrame = core([self _frame]);
     NS_DURING
-        [bridge setSelectedDOMRange:mark affinity:NSSelectionAffinityDownstream closeTyping:YES];
+        if (coreFrame)
+            selectRange(coreFrame->selectionController(), core(mark), DOWNSTREAM, true);
     NS_HANDLER
         NSBeep();
         return;
@@ -4765,7 +4799,10 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     if (![[webView _editingDelegateForwarder] webView:webView shouldChangeSelectedDOMRange:[self _selectedRange]
             toDOMRange:r affinity:NSSelectionAffinityDownstream stillSelecting:NO])
         return;
-    [bridge setSelectedDOMRange:r affinity:NSSelectionAffinityDownstream closeTyping:YES];
+
+    Frame* coreFrame = core([self _frame]);
+    if (coreFrame)
+        selectRange(coreFrame->selectionController(), core(r), DOWNSTREAM, true);
     if ([self _shouldReplaceSelectionWithText:transposed givenAction:WebViewInsertActionTyped])
         [bridge replaceSelectionWithText:transposed selectReplacement:NO smartReplace:NO];
 }
@@ -5145,9 +5182,8 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
 
 - (void)cut:(id)sender
 {
-    WebFrameBridge *bridge = [self _bridge];
-    FrameMac* frame = core([self _frame]);
-    if (frame && frame->tryDHTMLCut())
+    FrameMac* coreFrame = core([self _frame]);
+    if (coreFrame && coreFrame->tryDHTMLCut())
         return; // DHTML did the whole operation
     if (![self _canCut]) {
         NSBeep();
@@ -5156,7 +5192,8 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     DOMRange *range = [self _selectedRange];
     if ([self _shouldDeleteRange:range]) {
         [self _writeSelectionToPasteboard:[NSPasteboard generalPasteboard]];
-        [bridge deleteSelectionWithSmartDelete:[self _canSmartCopyOrDelete]];
+        if (coreFrame)
+            coreFrame->editor()->deleteSelectionWithSmartDelete([self _canSmartCopyOrDelete]);
    }
 }
 
@@ -5167,7 +5204,7 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
         return; // DHTML did the whole operation
     if (![self _canPaste])
         return;
-    if (coreFrame->selectionController()->isContentRichlyEditable())
+    if (coreFrame && coreFrame->selectionController()->isContentRichlyEditable())
         [self _pasteWithPasteboard:[NSPasteboard generalPasteboard] allowPlainText:YES];
     else
         [self _pasteAsPlainTextWithPasteboard:[NSPasteboard generalPasteboard]];
@@ -5279,13 +5316,13 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     return [[self _bridge] markedTextNSRange];
 }
 
-- (NSAttributedString *)attributedSubstringFromRange:(NSRange)theRange
+- (NSAttributedString *)attributedSubstringFromRange:(NSRange)nsRange
 {
     WebFrameBridge *bridge = [self _bridge];
-    DOMRange *range = [bridge convertNSRangeToDOMRange:theRange];
-    if (!range)
+    DOMRange *domRange = [bridge convertNSRangeToDOMRange:nsRange];
+    if (!domRange)
         return nil;
-    return [bridge attributedStringFrom:[range startContainer] startOffset:[range startOffset] to:[range endContainer] endOffset:[range endOffset]];
+    return [NSAttributedString _web_attributedStringFromRange:core(domRange)];
 }
 
 // test for 10.4 because of <rdar://problem/4243463>
@@ -5316,7 +5353,9 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     if ([self hasMarkedText]) {
         WebFrameBridge *bridge = [self _bridge];
         DOMRange *markedTextRange = [bridge markedTextDOMRange];
-        [bridge setSelectedDOMRange:markedTextRange affinity:NSSelectionAffinityDownstream closeTyping:NO];
+        Frame* coreFrame = core([self _frame]);
+        if (coreFrame)
+            selectRange(coreFrame->selectionController(), core(markedTextRange), DOWNSTREAM, false);
     }
 }
 
@@ -5336,7 +5375,9 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     [selectedRange setStart:[markedTextRange startContainer] offset:selectionStart];
     [selectedRange setEnd:[markedTextRange startContainer] offset:selectionEnd];
 
-    [bridge setSelectedDOMRange:selectedRange affinity:NSSelectionAffinityDownstream closeTyping:NO];
+    Frame* coreFrame = core([self _frame]);
+    if (coreFrame)
+        selectRange(coreFrame->selectionController(), core(selectedRange), DOWNSTREAM, false);
 }
 
 - (void)_extractAttributes:(NSArray **)a ranges:(NSArray **)r fromAttributedString:(NSAttributedString *)string
@@ -5415,7 +5456,8 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     [self unmarkText];
     [[NSInputManager currentInputManager] markedTextAbandoned:self];
     // FIXME: Should we be calling the delegate here?
-    [[self _bridge] deleteSelectionWithSmartDelete:NO];
+    if (Frame* coreFrame = core([self _frame]))
+        coreFrame->editor()->deleteSelectionWithSmartDelete(false);
 
     _private->ignoreMarkedTextSelectionChange = NO;
 }
@@ -5813,12 +5855,17 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
 
 - (void)selectAll
 {
-    [[self _bridge] selectAll];
+    Frame* coreFrame = core([self _frame]);
+    if (coreFrame)
+        coreFrame->selectionController()->selectAll();
 }
 
 - (void)deselectAll
 {
-    [[self _bridge] deselectAll];
+    Frame* coreFrame = core([self _frame]);
+    if (!coreFrame)
+        return;
+    coreFrame->selectionController()->clear();
 }
 
 - (NSString *)string
@@ -5842,11 +5889,12 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
 
 - (NSAttributedString *)attributedString
 {
-    WebFrameBridge *bridge = [self _bridge];
     DOMDocument *document = [[self _frame] DOMDocument];
     NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[document _documentRange]];
-    if (attributedString == nil) {
-        attributedString = [bridge attributedStringFrom:document startOffset:0 to:nil endOffset:0];
+    if (!attributedString) {
+        Document* coreDocument = core(document);
+        Range range(coreDocument, coreDocument, 0, 0, 0);
+        attributedString = [NSAttributedString _web_attributedStringFromRange:&range];
     }
     return attributedString;
 }
@@ -5858,10 +5906,13 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
 
 - (NSAttributedString *)selectedAttributedString
 {
-    WebFrameBridge *bridge = [self _bridge];
     NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[self _selectedRange]];
-    if (attributedString == nil) {
-        attributedString = [bridge selectedAttributedString];
+    if (!attributedString) {
+        FrameMac* coreFrame = core([self _frame]);
+        if (coreFrame) {
+            RefPtr<Range> range = coreFrame->selectionController()->selection().toRange();
+            attributedString = [NSAttributedString _web_attributedStringFromRange:range.get()];
+        }
     }
     return attributedString;
 }
index 92ee4d4523be28057379fae655fc68109a8f935e..150c86cd5e5d276e7a55967f50e4a98bfb5b6266 100644 (file)
@@ -29,6 +29,7 @@
 
 #import "WebViewInternal.h"
 
+#import "DOMRangeInternal.h"
 #import "WebBackForwardList.h"
 #import "WebBaseNetscapePluginView.h"
 #import "WebDOMOperationsPrivate.h"
@@ -85,6 +86,9 @@
 #import <CoreFoundation/CFSet.h>
 #import <Foundation/NSURLConnection.h>
 #import <JavaScriptCore/Assertions.h>
+#import <WebCore/Document.h>
+#import <WebCore/Editor.h>
+#import <WebCore/ExceptionHandlers.h>
 #import <WebCore/FrameLoader.h>
 #import <WebCore/FrameMac.h>
 #import <WebCore/FrameTree.h>
@@ -3141,13 +3145,21 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity
 {
-    if (range == nil) {
-        [[self _bridgeForSelectedOrMainFrame] deselectText];
-    } else {
-        // Derive the bridge to use from the range passed in.
+    Frame* coreFrame = core([self _selectedOrMainFrame]);
+    if (!coreFrame)
+        return;
+
+    if (range == nil)
+        coreFrame->selectionController()->clear();
+    else {
+        // Derive the frame to use from the range passed in.
         // Using _bridgeForSelectedOrMainFrame could give us a different document than
         // the one the range uses.
-        [[[range startContainer] _bridge] setSelectedDOMRange:range affinity:selectionAffinity closeTyping:YES];
+        coreFrame = core([range startContainer])->document()->frame();
+        if (!coreFrame)
+            return;
+
+        selectRange(coreFrame->selectionController(), [range _range], core(selectionAffinity), true);
     }
 }
 
@@ -3161,7 +3173,10 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 - (NSSelectionAffinity)selectionAffinity
 {
-    return [[self _bridgeForSelectedOrMainFrame] selectionAffinity];
+    Frame* coreFrame = core([self _selectedOrMainFrame]);
+    if (!coreFrame)
+        return NSSelectionAffinityDownstream;
+    return kit(coreFrame->selectionController()->affinity());
 }
 
 - (void)setEditable:(BOOL)flag
@@ -3352,8 +3367,10 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 - (void)deleteSelection
 {
-    WebFrameBridge *bridge = [self _bridgeForSelectedOrMainFrame];
-    [bridge deleteSelectionWithSmartDelete:[(WebHTMLView *)[[[bridge webFrame] frameView] documentView] _canSmartCopyOrDelete]];
+    WebFrame *webFrame = [self _selectedOrMainFrame];
+    Frame* coreFrame = core(webFrame);
+    if (coreFrame)
+        coreFrame->editor()->deleteSelectionWithSmartDelete([(WebHTMLView *)[[webFrame frameView] documentView] _canSmartCopyOrDelete]);
 }
     
 - (void)applyStyle:(DOMCSSStyleDeclaration *)style