diff options
author | Iain Merrick <husky@google.com> | 2010-09-13 16:35:48 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-09-16 12:10:42 +0100 |
commit | 5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306 (patch) | |
tree | ddce1aa5e3b6967a69691892e500897558ff8ab6 /WebKit/mac/WebView | |
parent | 12bec63ec71e46baba27f0bd9bd9d8067683690a (diff) | |
download | external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.zip external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.gz external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.bz2 |
Merge WebKit at r67178 : Initial merge by git.
Change-Id: I57e01163b6866cb029cdadf405a0394a3918bc18
Diffstat (limited to 'WebKit/mac/WebView')
-rw-r--r-- | WebKit/mac/WebView/WebDeviceOrientation.h | 35 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebDeviceOrientation.mm | 78 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebDeviceOrientationInternal.h | 45 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebDeviceOrientationProvider.h | 32 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebDeviceOrientationProviderMock.h | 38 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebDeviceOrientationProviderMock.mm | 116 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebDeviceOrientationProviderMockInternal.h | 48 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebFrame.mm | 46 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebFramePrivate.h | 3 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebHTMLRepresentation.mm | 2 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebHTMLView.mm | 12 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebUIDelegatePrivate.h | 8 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebView.mm | 36 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebViewData.h | 2 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebViewPrivate.h | 7 |
15 files changed, 492 insertions, 16 deletions
diff --git a/WebKit/mac/WebView/WebDeviceOrientation.h b/WebKit/mac/WebView/WebDeviceOrientation.h new file mode 100644 index 0000000..ee04199 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientation.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2010 Google 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: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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. + */ + + +@class WebDeviceOrientationInternal; + +@interface WebDeviceOrientation : NSObject { + WebDeviceOrientationInternal* m_internal; +} + +- (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvideBeta:(bool)canProvideBeta beta:(double)beta canProvideGamma:(bool)canProvideGamma gamma:(double)gamma; + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientation.mm b/WebKit/mac/WebView/WebDeviceOrientation.mm new file mode 100644 index 0000000..7be5d0c --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientation.mm @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Google 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: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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. + */ + +#import "WebDeviceOrientationInternal.h" + +using namespace WebCore; + +@implementation WebDeviceOrientationInternal + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<DeviceOrientation>)coreDeviceOrientation +{ + self = [super init]; + if (!self) + return nil; + m_orientation = coreDeviceOrientation; + return self; +} + +@end + +@implementation WebDeviceOrientation (Internal) + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation +{ + self = [super init]; + if (!self) + return nil; + m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:coreDeviceOrientation]; + return self; +} + +@end + +@implementation WebDeviceOrientation + +DeviceOrientation* core(WebDeviceOrientation* orientation) +{ + return orientation ? orientation->m_internal->m_orientation.get() : 0; +} + +- (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvideBeta:(bool)canProvideBeta beta:(double)beta canProvideGamma:(bool)canProvideGamma gamma:(double)gamma +{ + self = [super init]; + if (!self) + return nil; + m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientation::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)]; + return self; +} + +- (void)dealloc +{ + [m_internal release]; + [super dealloc]; +} + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationInternal.h b/WebKit/mac/WebView/WebDeviceOrientationInternal.h new file mode 100644 index 0000000..b7c6aa5 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationInternal.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Google 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: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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. + */ + +#import "WebDeviceOrientation.h" + +#import <WebCore/DeviceOrientation.h> +#import <wtf/RefPtr.h> + +@interface WebDeviceOrientationInternal : NSObject { +@public + RefPtr<WebCore::DeviceOrientation> m_orientation; +} + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation; +@end + +@interface WebDeviceOrientation (Internal) + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation; + +@end + +WebCore::DeviceOrientation* core(WebDeviceOrientation*); diff --git a/WebKit/mac/WebView/WebDeviceOrientationProvider.h b/WebKit/mac/WebView/WebDeviceOrientationProvider.h new file mode 100644 index 0000000..18b688c --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProvider.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2010 Google 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: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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. + */ + +@class WebDeviceOrientation; + +@protocol WebDeviceOrientationProvider <NSObject> +- (void)startUpdating; +- (void)stopUpdating; +- (WebDeviceOrientation*)lastOrientation; +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationProviderMock.h b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.h new file mode 100644 index 0000000..be5a764 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 Google 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: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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. + */ + +#import "WebDeviceOrientationProvider.h" + +@class WebDeviceOrientationProviderMockInternal; +@class WebDeviceOrientation; + +@interface WebDeviceOrientationProviderMock : NSObject<WebDeviceOrientationProvider> { + WebDeviceOrientationProviderMockInternal* m_internal; +} + +- (id)init; +- (void)setOrientation:(WebDeviceOrientation*)orientation; + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationProviderMock.mm b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.mm new file mode 100644 index 0000000..0435264 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.mm @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2010 Google 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: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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. + */ + +#import "WebDeviceOrientationProviderMockInternal.h" + +#import "WebDeviceOrientationInternal.h" + +using namespace WebCore; + +@implementation WebDeviceOrientationProviderMockInternal + +- (id)init +{ + self = [super init]; + if (!self) + return nil; + m_core.set(new DeviceOrientationClientMock()); + return self; +} + +- (void)setOrientation:(WebDeviceOrientation*)orientation +{ + m_core->setOrientation(core(orientation)); +} + +- (void)setController:(DeviceOrientationController*)controller +{ + m_core->setController(controller); +} + +- (void)startUpdating +{ + m_core->startUpdating(); +} + +- (void)stopUpdating +{ + m_core->stopUpdating(); +} + +- (WebDeviceOrientation*)lastOrientation +{ + return [[WebDeviceOrientation alloc] initWithCoreDeviceOrientation:m_core->lastOrientation()]; +} + +@end + +@implementation WebDeviceOrientationProviderMock (Internal) + +- (void)setController:(WebCore::DeviceOrientationController*)controller +{ + [m_internal setController:controller]; +} + +@end + +@implementation WebDeviceOrientationProviderMock + +- (id)init +{ + self = [super init]; + if (!self) + return nil; + m_internal = [[WebDeviceOrientationProviderMockInternal alloc] init]; + return self; +} + +- (void)dealloc +{ + [super dealloc]; + [m_internal release]; +} + +- (void)setOrientation:(WebDeviceOrientation*)orientation +{ + [m_internal setOrientation:orientation]; +} + +- (void)startUpdating +{ + [m_internal startUpdating]; +} + +- (void)stopUpdating +{ + [m_internal stopUpdating]; +} + +- (WebDeviceOrientation*)lastOrientation +{ + return [m_internal lastOrientation]; +} + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationProviderMockInternal.h b/WebKit/mac/WebView/WebDeviceOrientationProviderMockInternal.h new file mode 100644 index 0000000..5ac38e5 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProviderMockInternal.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google 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: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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. + */ + +#import "WebDeviceOrientationProviderMock.h" + +#import <WebCore/DeviceOrientationClientMock.h> +#import <wtf/OwnPtr.h> + +@interface WebDeviceOrientationProviderMockInternal : NSObject { + OwnPtr<WebCore::DeviceOrientationClientMock> m_core; +} + +- (id)init; + +- (void)setOrientation:(WebDeviceOrientation*)orientation; + +- (void)setController:(WebCore::DeviceOrientationController*)controller; + +- (void)startUpdating; +- (void)stopUpdating; +- (WebDeviceOrientation*)lastOrientation; +@end + +@interface WebDeviceOrientationProviderMock (Internal) +- (void)setController:(WebCore::DeviceOrientationController*)controller; +@end diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index 1feb97e..8d564a3 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -60,7 +60,7 @@ #import <WebCore/Chrome.h> #import <WebCore/ColorMac.h> #import <WebCore/DOMImplementation.h> -#import <WebCore/DocLoader.h> +#import <WebCore/CachedResourceLoader.h> #import <WebCore/DocumentFragment.h> #import <WebCore/EventHandler.h> #import <WebCore/EventNames.h> @@ -529,7 +529,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (NSString *)_selectedString { - return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->selectedText()); + return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->editor()->selectedText()); } - (NSString *)_stringForRange:(DOMRange *)range @@ -662,7 +662,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (NSRect)_firstRectForDOMRange:(DOMRange *)range { - return _private->coreFrame->firstRectForRange(core(range)); + return _private->coreFrame->editor()->firstRectForRange(core(range)); } - (void)_scrollDOMRangeToVisible:(DOMRange *)range @@ -788,7 +788,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (DOMRange *)_markDOMRange { - return kit(_private->coreFrame->mark().toNormalizedRange().get()); + return kit(_private->coreFrame->editor()->mark().toNormalizedRange().get()); } // Given proposedRange, returns an extended range that includes adjacent whitespace that should @@ -904,7 +904,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return; - _private->coreFrame->computeAndSetTypingStyle(core(style), undoAction); + _private->coreFrame->editor()->computeAndSetTypingStyle(core(style), undoAction); } - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation @@ -1282,7 +1282,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return YES; - return SecurityOrigin::canLoad(URL, String(), _private->coreFrame->document()); + return SecurityOrigin::canDisplay(URL, String(), _private->coreFrame->document()); } - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObjectRef inScriptWorld:(WebScriptWorld *)world @@ -1366,6 +1366,40 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return coreFrame->layerTreeAsText(); } +static Node* spellingNode(Frame* coreFrame) +{ + Node* focusedNode = coreFrame->selection()->start().node(); + if (!focusedNode || !focusedNode->renderer()) + return 0; + + for (const RenderObject* renderer = focusedNode->renderer(); renderer; renderer = renderer->childAt(0)) { + if (renderer->isText()) + return renderer->node(); + } + return 0; +} + +- (BOOL)hasSpellingMarker:(int)from length:(int)length +{ + Frame* coreFrame = _private->coreFrame; + if (!coreFrame) + return NO; + + Node* node = spellingNode(coreFrame); + if (!node) + return NO; + + unsigned int startOffset = static_cast<unsigned int>(from); + unsigned int endOffset = static_cast<unsigned int>(from + length); + Vector<DocumentMarker> markers = coreFrame->document()->markers()->markersForNode(node); + for (size_t i = 0; i < markers.size(); ++i) { + DocumentMarker marker = markers[i]; + if (marker.startOffset <= startOffset && endOffset <= marker.endOffset && marker.type == DocumentMarker::Spelling) + return YES; + } + return NO; +} + @end @implementation WebFrame diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h index a1031f3..9cb6232 100644 --- a/WebKit/mac/WebView/WebFramePrivate.h +++ b/WebKit/mac/WebView/WebFramePrivate.h @@ -143,4 +143,7 @@ typedef enum { - (NSString*)_layerTreeAsText; +// Returns whether there is a spelling marker in the specified range of the focused node. +- (BOOL)hasSpellingMarker:(int)location length:(int)length; + @end diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.mm b/WebKit/mac/WebView/WebHTMLRepresentation.mm index 7843c9a..188747d 100644 --- a/WebKit/mac/WebView/WebHTMLRepresentation.mm +++ b/WebKit/mac/WebView/WebHTMLRepresentation.mm @@ -212,7 +212,7 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second) WebView *webView = [frame webView]; if ([webView isEditable]) - core(frame)->applyEditingStyleToBodyElement(); + core(frame)->editor()->applyEditingStyleToBodyElement(); } } diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index 34745a1..bd71eff 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -4204,7 +4204,7 @@ static BOOL isInPasswordField(Frame* coreFrame) { Frame* coreFrame = core([self _frame]); NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"x" - attributes:coreFrame ? coreFrame->fontAttributesForSelectionStart() : nil]; + attributes:coreFrame ? coreFrame->editor()->fontAttributesForSelectionStart() : nil]; NSData *data = [string RTFFromRange:NSMakeRange(0, [string length]) documentAttributes:nil]; [string release]; return data; @@ -4831,7 +4831,7 @@ NSStrokeColorAttributeName /* NSColor, default nil: same as foreground co return; WritingDirection direction = RightToLeftWritingDirection; - switch (coreFrame->baseWritingDirectionForSelectionStart()) { + switch (coreFrame->editor()->baseWritingDirectionForSelectionStart()) { case NSWritingDirectionLeftToRight: break; case NSWritingDirectionRightToLeft: @@ -6167,7 +6167,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde if (![string length]) return NO; Frame* coreFrame = core([self _frame]); - return coreFrame && coreFrame->findString(string, forward, caseFlag, wrapFlag, startInSelection); + return coreFrame && coreFrame->editor()->findString(string, forward, caseFlag, wrapFlag, startInSelection); } @end @@ -6197,7 +6197,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde Frame* coreFrame = core([self _frame]); if (!coreFrame) return 0; - return coreFrame->countMatchesForText(string, caseFlag, limit, markMatches); + return coreFrame->editor()->countMatchesForText(string, caseFlag, limit, markMatches); } - (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue @@ -6205,13 +6205,13 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde Frame* coreFrame = core([self _frame]); if (!coreFrame) return; - coreFrame->setMarkedTextMatchesAreHighlighted(newValue); + coreFrame->editor()->setMarkedTextMatchesAreHighlighted(newValue); } - (BOOL)markedTextMatchesAreHighlighted { Frame* coreFrame = core([self _frame]); - return coreFrame && coreFrame->markedTextMatchesAreHighlighted(); + return coreFrame && coreFrame->editor()->markedTextMatchesAreHighlighted(); } - (void)unmarkAllTextMatches diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h index 22752ae..4565a4e 100644 --- a/WebKit/mac/WebView/WebUIDelegatePrivate.h +++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h @@ -32,6 +32,10 @@ #define ENABLE_DASHBOARD_SUPPORT 1 #endif +#if !defined(ENABLE_FULLSCREEN_API) +#define ENABLE_FULLSCREEN_API 1 +#endif + // Mail on Tiger expects the old value for WebMenuItemTagSearchInGoogle #define WebMenuItemTagSearchInGoogle OldWebMenuItemTagSearchWeb @@ -95,7 +99,7 @@ enum { - (void)deny; @end -#if ENABLE(FULLSCREEN_API) +#if ENABLE_FULLSCREEN_API @protocol WebKitFullScreenListener<NSObject> - (void)webkitWillEnterFullScreen; - (void)webkitDidEnterFullScreen; @@ -173,7 +177,7 @@ enum { */ - (void)webView:(WebView *)sender printFrame:(WebFrame *)frame; -#if ENABLE(FULLSCREEN_API) +#if ENABLE_FULLSCREEN_API - (BOOL)webView:(WebView *)sender supportsFullScreenForElement:(DOMElement *)element; - (void)webView:(WebView *)sender enterFullScreenForElement:(DOMElement *)element; - (void)webView:(WebView *)sender exitFullScreenForElement:(DOMElement *)element; diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index f2e76c1..0125e1c 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -47,6 +47,8 @@ #import "WebDefaultPolicyDelegate.h" #import "WebDefaultUIDelegate.h" #import "WebDelegateImplementationCaching.h" +#import "WebDeviceOrientationClient.h" +#import "WebDeviceOrientationProvider.h" #import "WebDocument.h" #import "WebDocumentInternal.h" #import "WebDownload.h" @@ -683,6 +685,9 @@ static bool shouldEnableLoadDeferring() #if ENABLE(CLIENT_BASED_GEOLOCATION) pageClients.geolocationControllerClient = new WebGeolocationControllerClient(self); #endif +#if ENABLE(DEVICE_ORIENTATION) + pageClients.deviceOrientationClient = new WebDeviceOrientationClient(self); +#endif _private->page = new Page(pageClients); _private->page->setCanStartMedia([self window]); @@ -4375,11 +4380,17 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit { + if (_private->closed) + return 0; + return [self countMatchesForText:string caseSensitive:caseFlag highlight:highlight limit:limit markMatches:YES]; } - (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit markMatches:(BOOL)markMatches { + if (_private->closed) + return 0; + WebFrame *frame = [self mainFrame]; unsigned matchCount = 0; do { @@ -4404,6 +4415,9 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (void)unmarkAllTextMatches { + if (_private->closed) + return; + WebFrame *frame = [self mainFrame]; do { id <WebDocumentView> view = [[frame frameView] documentView]; @@ -4416,6 +4430,9 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (NSArray *)rectsForTextMatches { + if (_private->closed) + return [NSArray array]; + NSMutableArray *result = [NSMutableArray array]; WebFrame *frame = [self mainFrame]; do { @@ -4749,7 +4766,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu Frame* mainFrame = [self _mainCoreFrame]; if (mainFrame) { if (flag) { - mainFrame->applyEditingStyleToBodyElement(); + mainFrame->editor()->applyEditingStyleToBodyElement(); // If the WebView is made editable and the selection is empty, set it to something. if (![self selectedDOMRange]) mainFrame->setSelectionFromNone(); @@ -5883,6 +5900,23 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity @end +@implementation WebView (WebViewDeviceOrientation) + +- (void)_setDeviceOrientationProvider:(id<WebDeviceOrientationProvider>)deviceOrientationProvider +{ + if (_private) + _private->m_deviceOrientationProvider = deviceOrientationProvider; +} + +- (id<WebDeviceOrientationProvider>)_deviceOrientationProvider +{ + if (_private) + return _private->m_deviceOrientationProvider; + return nil; +} + +@end + @implementation WebView (WebViewGeolocation) - (void)_setGeolocationProvider:(id<WebGeolocationProvider>)geolocationProvider diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h index 3b80a89..558770e 100644 --- a/WebKit/mac/WebView/WebViewData.h +++ b/WebKit/mac/WebView/WebViewData.h @@ -44,6 +44,7 @@ namespace WebCore { @class WebPreferences; @class WebTextCompletionController; @protocol WebFormDelegate; +@protocol WebDeviceOrientationProvider; @protocol WebGeolocationProvider; #if ENABLE(VIDEO) @class WebVideoFullscreenController; @@ -174,5 +175,6 @@ extern int pluginDatabaseClientCount; CFRunLoopObserverRef glibRunLoopObserver; #endif id<WebGeolocationProvider> _geolocationProvider; + id<WebDeviceOrientationProvider> m_deviceOrientationProvider; } @end diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h index 28348cc..aeb36c7 100644 --- a/WebKit/mac/WebView/WebViewPrivate.h +++ b/WebKit/mac/WebView/WebViewPrivate.h @@ -44,12 +44,14 @@ @class NSError; @class WebFrame; +@class WebDeviceOrientation; @class WebGeolocationPosition; @class WebInspector; @class WebPreferences; @class WebScriptWorld; @class WebTextIterator; +@protocol WebDeviceOrientationProvider; @protocol WebFormDelegate; extern NSString *_WebCanGoBackKey; @@ -605,6 +607,11 @@ Could be worth adding to the API. - (BOOL)_selectionIsAll; @end +@interface WebView (WebViewDeviceOrientation) +- (void)_setDeviceOrientationProvider:(id<WebDeviceOrientationProvider>)deviceOrientationProvider; +- (id<WebDeviceOrientationProvider>)_deviceOrientationProvider; +@end + @protocol WebGeolocationProvider <NSObject> - (void)registerWebView:(WebView *)webView; - (void)unregisterWebView:(WebView *)webView; |