diff options
Diffstat (limited to 'WebKit/mac')
27 files changed, 680 insertions, 135 deletions
diff --git a/WebKit/mac/Carbon/HIViewAdapter.m b/WebKit/mac/Carbon/HIViewAdapter.m index d11bea4..565be4f 100644 --- a/WebKit/mac/Carbon/HIViewAdapter.m +++ b/WebKit/mac/Carbon/HIViewAdapter.m @@ -30,6 +30,7 @@ #import "HIViewAdapter.h" +#import "QuickDrawCompatibility.h" #import "WebNSObjectExtras.h" #import <wtf/Assertions.h> diff --git a/WebKit/mac/Carbon/HIWebView.mm b/WebKit/mac/Carbon/HIWebView.mm index b461394..a3cdc66 100644 --- a/WebKit/mac/Carbon/HIWebView.mm +++ b/WebKit/mac/Carbon/HIWebView.mm @@ -32,11 +32,11 @@ #import "CarbonWindowAdapter.h" #import "HIViewAdapter.h" +#import "QuickDrawCompatibility.h" #import "WebHTMLViewInternal.h" #import "WebKit.h" - -#import <objc/objc-runtime.h> #import <WebKitSystemInterface.h> +#import <objc/objc-runtime.h> @interface NSWindow (AppKitSecretsHIWebViewKnows) - (void)_removeWindowRef; @@ -351,7 +351,7 @@ Draw( HIWebView* inView, RgnHandle limitRgn, CGContextRef inContext ) NSView <WebDocumentView> *documentView = [[[inView->fWebView mainFrame] frameView] documentView]; if ([documentView isKindOfClass:[WebHTMLView class]]) - [(WebHTMLView *)documentView _web_layoutIfNeededRecursive]; + [(WebHTMLView *)documentView _web_updateLayoutAndStyleIfNeededRecursive]; if ( inView->fIsComposited ) [inView->fWebView displayIfNeededInRect: *(NSRect*)&hiRect]; diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index 565b1b0..88a2fbf 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,265 @@ +2010-09-01 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + Add support for autocorrection UI on Mac OS X. + https://bugs.webkit.org/show_bug.cgi?id=44958 + <rdar://problem/7326847> + + See detailed high level description in WebCore/ChangeLog. + + * WebCoreSupport/WebEditorClient.h: Added new member methods declared in + EditorClient. Added m_correctionPanelTag to store the ID of current autocorrection UI object. + + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::WebEditorClient): Initialize m_correctionPanelTag. + (WebEditorClient::~WebEditorClient): Make sure the autocorrection UI is + dismissed before destroying the object. + (WebEditorClient::respondToChangedSelection): Dismiss autocorrection UI whenever the selection changes. + (WebEditorClient::showCorrectionPanel): Show autocorrection UI. + (WebEditorClient::dismissCorrectionPanel): Dismiss autocorrection UI. + +2010-09-01 Mark Rowe <mrowe@apple.com> + + Reviewed by Adam Roben. + + <rdar://problem/8374711> WebKit needs to compile without access to QuickDraw private headers. + + * Carbon/HIViewAdapter.m: + * Carbon/HIWebView.mm: + * Misc/QuickDrawCompatibility.h: Added. + * Plugins/WebNetscapePluginView.mm: + +2010-08-31 Dave Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that + the former can occur in more places without having to do the latter. + + Eliminate Mac-specific code for style re-application and recursive layout/style updating in + favor of the cross-platform code that all the other ports use. + + * Carbon/HIWebView.mm: + (Draw): + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::forceLayout): + * WebView/WebHTMLView.mm: + (-[WebHTMLView _propagateDirtyRectsToOpaqueAncestors]): + (-[WebHTMLView viewWillDraw]): + (-[WebHTMLView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]): + (-[WebHTMLView _recursiveDisplayAllDirtyWithLockFocus:visRect:]): + (-[WebHTMLView _recursive:displayRectIgnoringOpacity:inContext:topView:]): + (-[WebHTMLView reapplyStyles]): + (-[WebHTMLView layoutToMinimumPageWidth:height:maximumPageWidth:adjustingViewSize:]): + (-[WebHTMLView setNeedsToApplyStyles:]): + (-[WebHTMLView _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:paginateScreenContent:]): + (-[WebHTMLView _layoutIfNeeded]): + (-[WebHTMLView _web_updateLayoutAndStyleIfNeededRecursive]): + * WebView/WebHTMLViewInternal.h: + * WebView/WebView.mm: + (-[WebView _viewWillDrawInternal]): + +2010-08-31 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Add ability to count text matches without marking + https://bugs.webkit.org/show_bug.cgi?id=43996 + + Safari needs to be able to count text matches without triggering lots of repainting. + Rename markAllMatchesForText: to countMatchesForText: and add a markMatches: + parameter. For backwards compatibility markAllMatchesForText: calls + countMatchesForText: and passes YES for markMatches:. + + * WebView/WebDocumentInternal.h: + * WebView/WebHTMLView.mm: + (-[WebHTMLView markAllMatchesForText:caseSensitive:limit:]): + (-[WebHTMLView countMatchesForText:caseSensitive:limit:markMatches:]): + * WebView/WebPDFView.mm: + (-[WebPDFView markAllMatchesForText:caseSensitive:limit:]): + (-[WebPDFView countMatchesForText:caseSensitive:limit:markMatches:]): + * WebView/WebView.mm: + (-[WebView markAllMatchesForText:caseSensitive:highlight:limit:]): + (-[WebView countMatchesForText:caseSensitive:highlight:limit:markMatches:]): + * WebView/WebViewPrivate.h: + +2010-08-31 Darin Adler <darin@apple.com> + + Reviewed by Anders Carlsson. + + * WebInspector/WebInspectorFrontend.mm: + (-[WebInspectorFrontend initWithFrontendClient:]): Remove a stray semicolon. + +2010-08-30 Mark Rowe <mrowe@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8369736> WebKit build fails. + + Temporarily add some extra includes in order to get things building again until <rdar://problem/8374711> is addressed. + + * Carbon/HIViewAdapter.m: + * Carbon/HIWebView.mm: + * Plugins/WebNetscapePluginView.mm: + +2010-08-30 Andy Estes <aestes@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r66156): Sites using AppleConnect for authentication fail to log in. + https://bugs.webkit.org/show_bug.cgi?id=44865 + + After http://trac.webkit.org/changeset/66156, sites using the AppleConnect plug-in + for authentication fail to log in. This is due to a bug in AppleConnect that r66156 + exposed, but since this will have a significant impact on users of WebKit nightly + builds, a plugin-specific hack should be added while the underlying issue is being + addressed. + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::createPlugin): Convert plug-in parameter names to lowercase + if the plugin is of type 'application/x-snkp'. + +2010-08-27 Jer Noble <jer.noble@apple.com> + + Reviewed by Eric Carlson. + + text/plain non-video files cause <video> to hang (while reading them?) + https://bugs.webkit.org/show_bug.cgi?id=44212 + + Add the new WebKitSystemInterface function WKQTMovieDisableComponent to + the initialization routine. + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Initialize WKQTMovieDisableComponent. + +2010-08-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r66198. + http://trac.webkit.org/changeset/66198 + https://bugs.webkit.org/show_bug.cgi?id=44856 + + It made tests crash on Qt bot (Requested by Ossy_ on #webkit). + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorFrontendClient::closeWindow): + (-[WebInspectorWindowController windowShouldClose:]): + (-[WebInspectorWindowController destroyInspectorView]): + +2010-08-28 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Make an internal method used by Apple Mail into SPI + https://bugs.webkit.org/show_bug.cgi?id=44832 + rdar://problem/5748951 + + * WebView/WebFrame.mm: + (-[WebFrame _smartInsertForString:replacingRange:beforeString:afterString:]): Moved this method + from the internal section to the private section. + * WebView/WebFrameInternal.h: Moved the method declaration out of here. + * WebView/WebFramePrivate.h: Moved the method declaration in here. + +2010-08-27 Jer Noble <jer.noble@apple.com> + + Reviewed by Eric Carlson. + + Add JavaScript API to allow a page to go fullscreen. + rdar://problem/6867795 + + Added chrome client overrides which support entering and exiting full screen. A new preference has + been added (setFullScreenEnabled:) to control at runtime whether full screen support is enabled + (defaults to disabled). Added a new WebKitFullScreenListener callback object which notifies WebCore + when the chrome has started/finished its full screen animation. + + * Configurations/FeatureDefines.xcconfig: + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::supportsFullscreenForElement): + (WebChromeClient::enterFullscreenForElement): + (WebChromeClient::exitFullscreenForElement): + (-[WebKitFullScreenListener initWithElement:]): + (-[WebKitFullScreenListener webkitWillEnterFullScreen]): + (-[WebKitFullScreenListener webkitDidEnterFullScreen]): + (-[WebKitFullScreenListener webkitWillExitFullScreen]): + (-[WebKitFullScreenListener webkitDidExitFullScreen]): + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences setFullScreenEnabled:]): + (-[WebPreferences fullScreenEnabled]): + * WebView/WebUIDelegatePrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-08-27 David Hyatt <hyatt@apple.com> + + Reviewed by Simon Fraser. + + https://bugs.webkit.org/show_bug.cgi?id=44788, implement HTML5-compliant doctype switching. + + Rename the various modes to match the HTML5 specification: + ParseMode -> CompatibilityMode + CompatMode -> QuirksMode + AlmostStrictMode -> LimitedQuirksMode + StrictMode -> NoQuirksMode + + Remove the htmlHacks() accessor from RenderStyle and make rendering code just go to the document + instead. This makes switching modes avoid forcing all RenderStyles to detect as changed. + + Clean up user stylesheets to minimize style recalculation when the mode is switched. + + Fix bugs with the propagation of correct modes in the HTML5 parser. Make sure the + dummy document created for fragment parsing properly inherits the real document's CompatibilityMode. + Make sure the tree builder properly changes the insertion mode to "BeforeHTML" after handling + a doctype token. + + determineParseMode -> setCompatibilityModeFromDoctype, and it now implements the HTML5 algorithm + precisely. + + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-08-27 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + REGRESSION: Crash occurs at objc_msgSend when closing a window that is displaying the web inspector + https://bugs.webkit.org/show_bug.cgi?id=44230 + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorFrontendClient::closeWindow): + (WebInspectorFrontendClient::disconnectFromBackend): + (-[WebInspectorWindowController windowShouldClose:]): + (-[WebInspectorWindowController destroyInspectorView:]): + +2010-08-26 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Revert r66103 since Qt tests are failing. + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorFrontendClient::closeWindow): + (-[WebInspectorWindowController windowShouldClose:]): + (-[WebInspectorWindowController destroyInspectorView]): + +2010-08-26 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + REGRESSION: Crash occurs at objc_msgSend when closing a window that is displaying the web inspector + https://bugs.webkit.org/show_bug.cgi?id=44230 + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorFrontendClient::closeWindow): + (WebInspectorFrontendClient::disconnectFromBackend): + (-[WebInspectorWindowController windowShouldClose:]): + (-[WebInspectorWindowController destroyInspectorView:]): + 2010-08-24 Eric Seidel <eric@webkit.org> Reviewed by Adam Barth. diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index f2b4c09..8f8c213 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -71,6 +71,7 @@ ENABLE_FILTERS_macosx = ENABLE_FILTERS; ENABLE_FILE_WRITER = ; ENABLE_FILE_SYSTEM = ; +ENABLE_FULLSCREEN_API = ENABLE_FULLSCREEN_API; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME)); @@ -120,4 +121,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_WRITER) $(ENABLE_FILE_SYSTEM) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_WRITER) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index deb52b6..659ac62 100644 --- a/WebKit/mac/Configurations/Version.xcconfig +++ b/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 6; +MINOR_VERSION = 7; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebKit/mac/Misc/QuickDrawCompatibility.h b/WebKit/mac/Misc/QuickDrawCompatibility.h new file mode 100644 index 0000000..1a4ff99 --- /dev/null +++ b/WebKit/mac/Misc/QuickDrawCompatibility.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2010 Apple 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 QuickDrawCompatibility_h +#define QuickDrawCompatibility_h + +#ifndef __LP64__ + +#import <Carbon/Carbon.h> + +#if defined(QD_HEADERS_ARE_PRIVATE) && QD_HEADERS_ARE_PRIVATE + +#ifdef __cplusplus +extern "C" { +#endif + +#define MacSetRect SetRect +#define MacSetRectRgn SetRectRgn +#define MacUnionRgn UnionRgn + +extern Boolean EmptyRgn(RgnHandle); +extern OSStatus CreateCGContextForPort(CGrafPtr, CGContextRef*); +extern OSStatus SyncCGContextOriginWithPort(CGContextRef, CGrafPtr); +extern PixMapHandle GetPortPixMap(CGrafPtr); +extern QDErr NewGWorldFromPtr(GWorldPtr*, UInt32, const Rect*, CTabHandle, GDHandle, GWorldFlags, Ptr, SInt32); +extern Rect* GetPortBounds(CGrafPtr, Rect*); +extern Rect* GetRegionBounds(RgnHandle, Rect*); +extern RgnHandle GetPortClipRegion(CGrafPtr, RgnHandle); +extern RgnHandle GetPortVisibleRegion(CGrafPtr, RgnHandle); +extern RgnHandle NewRgn(); +extern void BackColor(long); +extern void DisposeGWorld(GWorldPtr); +extern void DisposeRgn(RgnHandle); +extern void ForeColor(long); +extern void GetGWorld(CGrafPtr*, GDHandle*); +extern void GetPort(GrafPtr*); +extern void GlobalToLocal(Point*); +extern void MacSetRect(Rect*, short, short, short, short); +extern void MacSetRectRgn(RgnHandle, short, short, short, short); +extern void MacUnionRgn(RgnHandle, RgnHandle, RgnHandle); +extern void MovePortTo(short, short); +extern void OffsetRect(Rect*, short, short); +extern void OffsetRgn(RgnHandle, short, short); +extern void PaintRect(const Rect*); +extern void PenNormal(); +extern void PortSize(short, short); +extern void RectRgn(RgnHandle, const Rect*); +extern void SectRgn(RgnHandle, RgnHandle, RgnHandle); +extern void SetGWorld(CGrafPtr, GDHandle); +extern void SetOrigin(short, short); +extern void SetPort(GrafPtr); +extern void SetPortClipRegion(CGrafPtr, RgnHandle); +extern void SetPortVisibleRegion(CGrafPtr, RgnHandle); + +enum { + k16BE555PixelFormat = 0x00000010, + k32ARGBPixelFormat = 0x00000020, + k16LE555PixelFormat = 'L555', + k32BGRAPixelFormat = 'BGRA', + + blackColor = 33, + whiteColor = 30, + greenColor = 341, +}; + +#ifdef __cplusplus +} +#endif + +#endif // defined(QD_HEADERS_ARE_PRIVATE) && QD_HEADERS_ARE_PRIVATE + +#endif // __LP64__ + +#endif // QuickDrawCompatibility_h diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm index 10a3187..a4481bc 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -30,6 +30,7 @@ #import "WebNetscapePluginView.h" +#import "QuickDrawCompatibility.h" #import "WebDataSourceInternal.h" #import "WebDefaultUIDelegate.h" #import "WebFrameInternal.h" diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h index e5de14d..5f3b727 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -164,6 +164,12 @@ public: virtual void enterFullscreenForNode(WebCore::Node*); virtual void exitFullscreenForNode(WebCore::Node*); #endif + +#if ENABLE(FULLSCREEN_API) + virtual bool supportsFullScreenForElement(const WebCore::Element*); + virtual void enterFullScreenForElement(WebCore::Element*); + virtual void exitFullScreenForElement(WebCore::Element*); +#endif virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*) { } diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm index 2c2616d..d973e2b 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -110,6 +110,16 @@ using namespace WebCore; - (id)initWithGeolocation:(Geolocation*)geolocation; @end +#if ENABLE(FULLSCREEN_API) +@interface WebKitFullScreenListener : NSObject <WebKitFullScreenListener> +{ + RefPtr<Element> _element; +} + +- (id)initWithElement:(Element*)element; +@end +#endif + WebChromeClient::WebChromeClient(WebView *webView) : m_webView(webView) { @@ -815,6 +825,29 @@ void WebChromeClient::exitFullscreenForNode(Node*) #endif +#if ENABLE(FULLSCREEN_API) + +bool WebChromeClient::supportsFullScreenForElement(const Element* element) +{ + return CallUIDelegateReturningBoolean(false, m_webView, @selector(webView:supportsFullScreenForElement:), kit(const_cast<WebCore::Element*>(element))); +} + +void WebChromeClient::enterFullScreenForElement(Element* element) +{ + WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element]; + CallUIDelegate(m_webView, @selector(webView:enterFullScreenForElement:listener:), kit(element), listener); + [listener release]; +} + +void WebChromeClient::exitFullScreenForElement(Element* element) +{ + WebKitFullScreenListener* listener = [[WebKitFullScreenListener alloc] initWithElement:element]; + CallUIDelegate(m_webView, @selector(webView:exitFullScreenForElement:listener:), kit(element), listener); + [listener release]; +} + +#endif + void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation) { BEGIN_BLOCK_OBJC_EXCEPTIONS; @@ -919,3 +952,41 @@ void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geoloca } @end + +#if ENABLE(FULLSCREEN_API) +@implementation WebKitFullScreenListener +- (id)initWithElement:(Element*)element +{ + if (!(self = [super init])) + return nil; + + _element = element; + return self; +} + +- (void)webkitWillEnterFullScreen +{ + if (_element) + _element->document()->webkitWillEnterFullScreenForElement(_element.get()); +} + +- (void)webkitDidEnterFullScreen +{ + if (_element) + _element->document()->webkitDidEnterFullScreenForElement(_element.get()); +} + +- (void)webkitWillExitFullScreen +{ + if (_element) + _element->document()->webkitWillExitFullScreenForElement(_element.get()); +} + +- (void)webkitDidExitFullScreen +{ + if (_element) + _element->document()->webkitDidExitFullScreenForElement(_element.get()); +} + +@end +#endif diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.h b/WebKit/mac/WebCoreSupport/WebEditorClient.h index e6426aa..fe33e05 100644 --- a/WebKit/mac/WebCoreSupport/WebEditorClient.h +++ b/WebKit/mac/WebCoreSupport/WebEditorClient.h @@ -27,6 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#import <WebCore/Editor.h> #import <WebCore/EditorClient.h> #import <wtf/RetainPtr.h> #import <wtf/Forward.h> @@ -38,7 +39,7 @@ class WebEditorClient : public WebCore::EditorClient { public: WebEditorClient(WebView *); - + virtual ~WebEditorClient(); virtual void pageDestroyed(); virtual bool isGrammarCheckingEnabled(); @@ -129,12 +130,19 @@ public: virtual void getGuessesForWord(const WTF::String&, WTF::Vector<WTF::String>& guesses); virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + virtual void showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*); + virtual void dismissCorrectionPanel(bool correctionAccepted); +#endif private: void registerCommandForUndoOrRedo(PassRefPtr<WebCore::EditCommand>, bool isRedo); WebEditorClient(); - + WebView *m_webView; RetainPtr<WebEditorUndoTarget> m_undoTarget; - bool m_haveUndoRedoOperations; + +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + NSInteger m_correctionPanelTag; +#endif }; diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/WebKit/mac/WebCoreSupport/WebEditorClient.mm index 2c89919..41cff68 100644 --- a/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -64,6 +64,9 @@ #import <runtime/InitializeThreading.h> #import <wtf/PassRefPtr.h> #import <wtf/Threading.h> +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#import <AppKit/NSTextChecker.h> +#endif using namespace WebCore; using namespace WTF; @@ -171,7 +174,17 @@ WebEditorClient::WebEditorClient(WebView *webView) : m_webView(webView) , m_undoTarget([[[WebEditorUndoTarget alloc] init] autorelease]) , m_haveUndoRedoOperations(false) +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + , m_correctionPanelTag(-1) +#endif +{ +} + +WebEditorClient::~WebEditorClient() { +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + dismissCorrectionPanel(true); +#endif } bool WebEditorClient::isContinuousSpellCheckingEnabled() @@ -286,6 +299,10 @@ void WebEditorClient::respondToChangedSelection() { [m_webView _selectionChanged]; +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + dismissCorrectionPanel(true); +#endif + // FIXME: This quirk is needed due to <rdar://problem/5009625> - We can phase it out once Aperture can adopt the new behavior on their end if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_APERTURE_QUIRK) && [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.Aperture"]) return; @@ -790,6 +807,35 @@ void WebEditorClient::updateSpellingUIWithGrammarString(const String& badGrammar #endif } +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +void WebEditorClient::showCorrectionPanel(const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, Editor* editor) { + dismissCorrectionPanel(true); + + NSRect boundingBoxAsNSRect = boundingBoxOfReplacedString; + NSRect webViewFrame = m_webView.frame; + boundingBoxAsNSRect.origin.y = webViewFrame.size.height-NSMaxY(boundingBoxAsNSRect); + + // Need to explicitly use these local NSString objects, because the C++ references may be invalidated by the time the block below is executed. + NSString *replacedStringAsNSString = replacedString; + NSString *replacementStringAsNSString = replacementString; + + m_correctionPanelTag = [[NSSpellChecker sharedSpellChecker] showCorrection:replacementStringAsNSString forStringInRect:boundingBoxAsNSRect view:m_webView completionHandler:^(BOOL accepted) { + if (!accepted) { + [[NSSpellChecker sharedSpellChecker] recordResponse:NSCorrectionResponseRejected toCorrection:replacementStringAsNSString forWord:replacedStringAsNSString language:nil inSpellDocumentWithTag:[m_webView spellCheckerDocumentTag]]; + editor->handleRejectedCorrection(); + } + }]; +} + +void WebEditorClient::dismissCorrectionPanel(bool correctionAccepted) +{ + if (m_correctionPanelTag >= 0) { + [[NSSpellChecker sharedSpellChecker] dismissCorrection:m_correctionPanelTag acceptCorrection:correctionAccepted]; + m_correctionPanelTag = -1; + } +} +#endif + void WebEditorClient::updateSpellingUIWithMisspelledWord(const String& misspelledWord) { [[NSSpellChecker sharedSpellChecker] updateSpellingPanelWithMisspelledWord:misspelledWord]; diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 8bdeca0..3f7c471 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -241,8 +241,6 @@ bool WebFrameLoaderClient::hasHTMLView() const void WebFrameLoaderClient::forceLayout() { NSView <WebDocumentView> *view = [m_webFrame->_private->webFrameView documentView]; - if ([view isKindOfClass:[WebHTMLView class]]) - [(WebHTMLView *)view setNeedsToApplyStyles:YES]; [view setNeedsLayout:YES]; [view layout]; } @@ -1576,8 +1574,20 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP NSURL *baseURL = document->baseURL(); NSURL *pluginURL = url; + // <rdar://problem/8366089>: AppleConnect has a bug where it does not + // understand the parameter names specified in the <object> element that + // embeds its plug-in. This site-specific hack works around the issue by + // converting the parameter names to lowercase before passing them to the + // plug-in. + Frame* frame = core(m_webFrame.get()); + NSMutableArray *attributeKeys = kit(paramNames); + if (frame && frame->settings()->needsSiteSpecificQuirks() && equalIgnoringCase(mimeType, "application/x-snkp")) { + for (NSUInteger i = 0; i < [attributeKeys count]; ++i) + [attributeKeys replaceObjectAtIndex:i withObject:[[attributeKeys objectAtIndex:i] lowercaseString]]; + } + if ([[webView UIDelegate] respondsToSelector:selector]) { - NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithObjects:kit(paramValues) forKeys:kit(paramNames)]; + NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithObjects:kit(paramValues) forKeys:attributeKeys]; NSDictionary *arguments = [[NSDictionary alloc] initWithObjectsAndKeys: attributes, WebPlugInAttributesKey, [NSNumber numberWithInt:loadManually ? WebPlugInModeFull : WebPlugInModeEmbed], WebPlugInModeKey, @@ -1620,7 +1630,7 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP if (pluginPackage) { if ([pluginPackage isKindOfClass:[WebPluginPackage class]]) - view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, kit(paramNames), kit(paramValues), baseURL, kit(element), loadManually); + view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, attributeKeys, kit(paramValues), baseURL, kit(element), loadManually); #if ENABLE(NETSCAPE_PLUGIN_API) else if ([pluginPackage isKindOfClass:[WebNetscapePluginPackage class]]) { @@ -1630,7 +1640,7 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP URL:pluginURL baseURL:baseURL MIMEType:MIMEType - attributeKeys:kit(paramNames) + attributeKeys:attributeKeys attributeValues:kit(paramValues) loadManually:loadManually element:element] autorelease]; diff --git a/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/WebKit/mac/WebCoreSupport/WebSystemInterface.mm index 0b74dee..47b16b2 100644 --- a/WebKit/mac/WebCoreSupport/WebSystemInterface.mm +++ b/WebKit/mac/WebCoreSupport/WebSystemInterface.mm @@ -84,6 +84,7 @@ void InitWebCoreSystemInterface(void) INIT(SignalCFReadStreamHasBytes); INIT(QTIncludeOnlyModernMediaFileTypes); INIT(QTMovieDataRate); + INIT(QTMovieDisableComponent); INIT(QTMovieMaxTimeLoaded); INIT(QTMovieMaxTimeLoadedChangeNotification); INIT(QTMovieMaxTimeSeekable); diff --git a/WebKit/mac/WebInspector/WebInspectorFrontend.mm b/WebKit/mac/WebInspector/WebInspectorFrontend.mm index 91caa64..c285ef7 100644 --- a/WebKit/mac/WebInspector/WebInspectorFrontend.mm +++ b/WebKit/mac/WebInspector/WebInspectorFrontend.mm @@ -29,7 +29,7 @@ @implementation WebInspectorFrontend -- (id)initWithFrontendClient:(WebInspectorFrontendClient *)frontendClient; +- (id)initWithFrontendClient:(WebInspectorFrontendClient *)frontendClient { if (!(self = [super init])) return nil; diff --git a/WebKit/mac/WebView/WebDocumentInternal.h b/WebKit/mac/WebView/WebDocumentInternal.h index 191264b..0f63d75 100644 --- a/WebKit/mac/WebView/WebDocumentInternal.h +++ b/WebKit/mac/WebView/WebDocumentInternal.h @@ -62,6 +62,7 @@ - (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue; - (BOOL)markedTextMatchesAreHighlighted; - (WebNSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(WebNSUInteger)limit; +- (WebNSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(WebNSUInteger)limit markMatches:(BOOL)markMatches; - (void)unmarkAllTextMatches; - (NSArray *)rectsForTextMatches; @end diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index dff9ff7..1feb97e 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -824,64 +824,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return kit(range.get()); } -// Determines whether whitespace needs to be added around aString to preserve proper spacing and -// punctuation when it’s inserted into the receiver’s text over charRange. Returns by reference -// in beforeString and afterString any whitespace that should be added, unless either or both are -// nil. Both are returned as nil if aString is nil or if smart insertion and deletion are disabled. -- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString -{ - // give back nil pointers in case of early returns - if (beforeString) - *beforeString = nil; - if (afterString) - *afterString = nil; - - // inspect destination - Node *startContainer = core([rangeToReplace startContainer]); - Node *endContainer = core([rangeToReplace endContainer]); - - Position startPos(startContainer, [rangeToReplace startOffset]); - Position endPos(endContainer, [rangeToReplace endOffset]); - - VisiblePosition startVisiblePos = VisiblePosition(startPos, VP_DEFAULT_AFFINITY); - VisiblePosition endVisiblePos = VisiblePosition(endPos, VP_DEFAULT_AFFINITY); - - // this check also ensures startContainer, startPos, endContainer, and endPos are non-null - if (startVisiblePos.isNull() || endVisiblePos.isNull()) - return; - - bool addLeadingSpace = startPos.leadingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isStartOfParagraph(startVisiblePos); - if (addLeadingSpace) - if (UChar previousChar = startVisiblePos.previous().characterAfter()) - addLeadingSpace = !isCharacterSmartReplaceExempt(previousChar, true); - - bool addTrailingSpace = endPos.trailingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isEndOfParagraph(endVisiblePos); - if (addTrailingSpace) - if (UChar thisChar = endVisiblePos.characterAfter()) - addTrailingSpace = !isCharacterSmartReplaceExempt(thisChar, false); - - // inspect source - bool hasWhitespaceAtStart = false; - bool hasWhitespaceAtEnd = false; - unsigned pasteLength = [pasteString length]; - if (pasteLength > 0) { - NSCharacterSet *whiteSet = [NSCharacterSet whitespaceAndNewlineCharacterSet]; - - if ([whiteSet characterIsMember:[pasteString characterAtIndex:0]]) { - hasWhitespaceAtStart = YES; - } - if ([whiteSet characterIsMember:[pasteString characterAtIndex:(pasteLength - 1)]]) { - hasWhitespaceAtEnd = YES; - } - } - - // issue the verdict - if (beforeString && addLeadingSpace && !hasWhitespaceAtStart) - *beforeString = @" "; - if (afterString && addTrailingSpace && !hasWhitespaceAtEnd) - *afterString = @" "; -} - - (DOMDocumentFragment *)_documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString { if (!_private->coreFrame || !_private->coreFrame->document()) @@ -1240,6 +1182,64 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) [self _replaceSelectionWithFragment:fragment selectReplacement:selectReplacement smartReplace:smartReplace matchStyle:NO]; } +// Determines whether whitespace needs to be added around aString to preserve proper spacing and +// punctuation when it's inserted into the receiver's text over charRange. Returns by reference +// in beforeString and afterString any whitespace that should be added, unless either or both are +// nil. Both are returned as nil if aString is nil or if smart insertion and deletion are disabled. +- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString +{ + // give back nil pointers in case of early returns + if (beforeString) + *beforeString = nil; + if (afterString) + *afterString = nil; + + // inspect destination + Node *startContainer = core([rangeToReplace startContainer]); + Node *endContainer = core([rangeToReplace endContainer]); + + Position startPos(startContainer, [rangeToReplace startOffset]); + Position endPos(endContainer, [rangeToReplace endOffset]); + + VisiblePosition startVisiblePos = VisiblePosition(startPos, VP_DEFAULT_AFFINITY); + VisiblePosition endVisiblePos = VisiblePosition(endPos, VP_DEFAULT_AFFINITY); + + // this check also ensures startContainer, startPos, endContainer, and endPos are non-null + if (startVisiblePos.isNull() || endVisiblePos.isNull()) + return; + + bool addLeadingSpace = startPos.leadingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isStartOfParagraph(startVisiblePos); + if (addLeadingSpace) + if (UChar previousChar = startVisiblePos.previous().characterAfter()) + addLeadingSpace = !isCharacterSmartReplaceExempt(previousChar, true); + + bool addTrailingSpace = endPos.trailingWhitespacePosition(VP_DEFAULT_AFFINITY, true).isNull() && !isEndOfParagraph(endVisiblePos); + if (addTrailingSpace) + if (UChar thisChar = endVisiblePos.characterAfter()) + addTrailingSpace = !isCharacterSmartReplaceExempt(thisChar, false); + + // inspect source + bool hasWhitespaceAtStart = false; + bool hasWhitespaceAtEnd = false; + unsigned pasteLength = [pasteString length]; + if (pasteLength > 0) { + NSCharacterSet *whiteSet = [NSCharacterSet whitespaceAndNewlineCharacterSet]; + + if ([whiteSet characterIsMember:[pasteString characterAtIndex:0]]) { + hasWhitespaceAtStart = YES; + } + if ([whiteSet characterIsMember:[pasteString characterAtIndex:(pasteLength - 1)]]) { + hasWhitespaceAtEnd = YES; + } + } + + // issue the verdict + if (beforeString && addLeadingSpace && !hasWhitespaceAtStart) + *beforeString = @" "; + if (afterString && addTrailingSpace && !hasWhitespaceAtEnd) + *afterString = @" "; +} + - (NSMutableDictionary *)_cacheabilityDictionary { NSMutableDictionary *result = [NSMutableDictionary dictionary]; diff --git a/WebKit/mac/WebView/WebFrameInternal.h b/WebKit/mac/WebView/WebFrameInternal.h index 240b09c..dc3de21 100644 --- a/WebKit/mac/WebView/WebFrameInternal.h +++ b/WebKit/mac/WebView/WebFrameInternal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,7 +30,6 @@ #import "WebFramePrivate.h" #import "WebPreferencesPrivate.h" - #import <WebCore/EditAction.h> #import <WebCore/FrameLoaderTypes.h> #import <WebCore/SelectionController.h> @@ -142,7 +141,6 @@ WebView *getWebView(WebFrame *webFrame); - (id)_accessibilityTree; - (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::SelectionController::EAlteration)alteration direction:(WebCore::SelectionController::EDirection)direction granularity:(WebCore::TextGranularity)granularity; -- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)charRangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString; - (NSRange)_convertToNSRange:(WebCore::Range*)range; - (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range; - (NSRange)_convertDOMRangeToNSRange:(DOMRange *)range; diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h index 3556ad8..a1031f3 100644 --- a/WebKit/mac/WebView/WebFramePrivate.h +++ b/WebKit/mac/WebView/WebFramePrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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 @@ -37,6 +37,7 @@ @class DOMDocumentFragment; @class DOMNode; +@class DOMRange; @class WebIconFetcher; @class WebScriptObject; @class WebScriptWorld; @@ -84,7 +85,7 @@ typedef enum { - (BOOL)_isDisplayingStandaloneImage; -- (unsigned) _pendingFrameUnloadEventCount; +- (unsigned)_pendingFrameUnloadEventCount; - (WebIconFetcher *)fetchApplicationIcon:(id)target selector:(SEL)selector; @@ -111,16 +112,18 @@ typedef enum { - (BOOL)_pauseSVGAnimation:(NSString*)elementId onSMILNode:(DOMNode *)node atTime:(NSTimeInterval)time; // Returns the total number of currently running animations (includes both CSS transitions and CSS animations). -- (unsigned) _numberOfActiveAnimations; +- (unsigned)_numberOfActiveAnimations; // Suspend and resume animations (includes both CSS transitions and CSS animations). -- (void) _suspendAnimations; -- (void) _resumeAnimations; +- (void)_suspendAnimations; +- (void)_resumeAnimations; - (void)_replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle; - (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace; - (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace; +- (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString; + - (NSMutableDictionary *)_cacheabilityDictionary; - (BOOL)_allowsFollowingLink:(NSURL *)URL; diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index a619f18..34745a1 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -443,7 +443,6 @@ struct WebHTMLViewInterpretKeyEventsParameters { @interface WebHTMLViewPrivate : NSObject { @public BOOL closed; - BOOL needsToApplyStyles; BOOL ignoringMouseDraggedEvents; BOOL printing; BOOL avoidingPrintOrphan; @@ -1290,7 +1289,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) - (void)_propagateDirtyRectsToOpaqueAncestors { if (![[self _webView] drawsBackground]) - [self _web_layoutIfNeededRecursive]; + [self _web_updateLayoutAndStyleIfNeededRecursive]; [super _propagateDirtyRectsToOpaqueAncestors]; } @@ -1302,7 +1301,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) // So check if the dataSource is nil before calling [self _isTopHTMLView], this can be removed // once the FIXME in _isTopHTMLView is fixed. if (_private->dataSource && [self _isTopHTMLView]) - [self _web_layoutIfNeededRecursive]; + [self _web_updateLayoutAndStyleIfNeededRecursive]; [super viewWillDraw]; } @@ -1320,7 +1319,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) [self _web_setPrintingModeRecursive]; #ifndef BUILDING_ON_TIGER else - [self _web_layoutIfNeededRecursive]; + [self _web_updateLayoutAndStyleIfNeededRecursive]; #endif } else if (wasInPrintingMode) [self _web_clearPrintingModeRecursive]; @@ -1336,12 +1335,12 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) [self getRectsBeingDrawn:0 count:&rectCount]; if (rectCount) { LOG_ERROR("View needs layout. Either -viewWillDraw wasn't called or layout was invalidated during the display operation. Performing layout now."); - [self _web_layoutIfNeededRecursive]; + [self _web_updateLayoutAndStyleIfNeededRecursive]; } } #else // Because Tiger does not have viewWillDraw we need to do layout here. - [self _web_layoutIfNeededRecursive]; + [self _web_updateLayoutAndStyleIfNeededRecursive]; [_subviews makeObjectsPerformSelector:@selector(_propagateDirtyRectsToOpaqueAncestors)]; #endif @@ -1373,7 +1372,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) [self _web_setPrintingModeRecursive]; #ifndef BUILDING_ON_TIGER else - [self _web_layoutIfNeededRecursive]; + [self _web_updateLayoutAndStyleIfNeededRecursive]; #endif } else if (wasInPrintingMode) [self _web_clearPrintingModeRecursive]; @@ -1383,7 +1382,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) // Because Tiger does not have viewWillDraw we need to do layout here. NSRect boundsBeforeLayout = [self bounds]; if (!NSIsEmptyRect(visRect)) - [self _web_layoutIfNeededRecursive]; + [self _web_updateLayoutAndStyleIfNeededRecursive]; // If layout changes the view's bounds, then we need to recompute the visRect. // That's because the visRect passed to us was based on the bounds at the time @@ -1416,7 +1415,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) { #ifdef BUILDING_ON_TIGER // Because Tiger does not have viewWillDraw we need to do layout here. - [self _web_layoutIfNeededRecursive]; + [self _web_updateLayoutAndStyleIfNeededRecursive]; #endif [self _setAsideSubviews]; @@ -3117,37 +3116,23 @@ WEBCORE_COMMAND(yankAndSelect) - (void)reapplyStyles { - if (!_private->needsToApplyStyles) - return; - #ifdef LOG_TIMES double start = CFAbsoluteTimeGetCurrent(); #endif - if (Frame* coreFrame = core([self _frame])) { - if (FrameView* coreView = coreFrame->view()) - coreView->setMediaType(_private->printing ? "print" : "screen"); - if (Document* document = coreFrame->document()) { - document->setPaginatedForScreen(_private->paginateScreenContent); - document->setPrinting(_private->printing); - } - coreFrame->reapplyStyles(); - } + if (Frame* coreFrame = core([self _frame])) + coreFrame->document()->styleSelectorChanged(RecalcStyleImmediately); #ifdef LOG_TIMES double thisTime = CFAbsoluteTimeGetCurrent() - start; LOG(Timing, "%s apply style seconds = %f", [self URL], thisTime); #endif - - _private->needsToApplyStyles = NO; } // Do a layout, but set up a new fixed width for the purposes of doing printing layout. // minPageWidth==0 implies a non-printing layout - (void)layoutToMinimumPageWidth:(float)minPageWidth height:(float)minPageHeight maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustViewSize -{ - [self reapplyStyles]; - +{ if (![self _needsLayout]) return; @@ -3308,7 +3293,13 @@ WEBCORE_COMMAND(yankAndSelect) - (void)setNeedsToApplyStyles: (BOOL)flag { LOG(View, "%@ setNeedsToApplyStyles:%@", self, flag ? @"YES" : @"NO"); - _private->needsToApplyStyles = flag; + if (!flag) + return; // There's no way to say you don't need a style recalc. + if (Frame* frame = core([self _frame])) { + if (frame->document() && frame->document()->inPageCache()) + return; + frame->document()->scheduleForcedStyleRecalc(); + } } - (void)drawSingleRect:(NSRect)rect @@ -3883,7 +3874,18 @@ static BOOL isInPasswordField(Frame* coreFrame) _private->paginateScreenContent = paginateScreenContent; if (!printing && !paginateScreenContent) _private->avoidingPrintOrphan = NO; - [self setNeedsToApplyStyles:YES]; + + Frame* coreFrame = core([self _frame]); + if (coreFrame) { + if (FrameView* coreView = coreFrame->view()) + coreView->setMediaType(_private->printing ? "print" : "screen"); + if (Document* document = coreFrame->document()) { + document->setPaginatedForScreen(_private->paginateScreenContent); + document->setPrinting(_private->printing); + document->styleSelectorChanged(RecalcStyleImmediately); + } + } + [self setNeedsLayout:YES]; [self layoutToMinimumPageWidth:minPageWidth height:minPageHeight maximumPageWidth:maxPageWidth adjustingViewSize:adjustViewSize]; if (!printing) { @@ -5507,31 +5509,16 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) { ASSERT(!_private->subviewsSetAside); - if (_private->needsToApplyStyles || [self _needsLayout]) + if ([self _needsLayout]) [self layout]; } -- (void)_web_layoutIfNeededRecursive +- (void)_web_updateLayoutAndStyleIfNeededRecursive { - [self _layoutIfNeeded]; - -#ifndef NDEBUG - _private->enumeratingSubviews = YES; -#endif - - NSMutableArray *descendantWebHTMLViews = [[NSMutableArray alloc] init]; - - [self _web_addDescendantWebHTMLViewsToArray:descendantWebHTMLViews]; - - unsigned count = [descendantWebHTMLViews count]; - for (unsigned i = 0; i < count; ++i) - [[descendantWebHTMLViews objectAtIndex:i] _layoutIfNeeded]; - - [descendantWebHTMLViews release]; - -#ifndef NDEBUG - _private->enumeratingSubviews = NO; -#endif + WebFrame *webFrame = [self _frame]; + Frame* coreFrame = core(webFrame); + if (coreFrame && coreFrame->view()) + coreFrame->view()->updateLayoutAndStyleIfNeededRecursive(); } - (void) _destroyAllWebPlugins @@ -6202,10 +6189,15 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(NSUInteger)limit { + return [self countMatchesForText:string caseSensitive:caseFlag limit:limit markMatches:YES]; +} + +- (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(NSUInteger)limit markMatches:(BOOL)markMatches +{ Frame* coreFrame = core([self _frame]); if (!coreFrame) return 0; - return coreFrame->markAllMatchesForText(string, caseFlag, limit); + return coreFrame->countMatchesForText(string, caseFlag, limit, markMatches); } - (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue diff --git a/WebKit/mac/WebView/WebHTMLViewInternal.h b/WebKit/mac/WebView/WebHTMLViewInternal.h index 3f1f50d..2d9e2a9 100644 --- a/WebKit/mac/WebView/WebHTMLViewInternal.h +++ b/WebKit/mac/WebView/WebHTMLViewInternal.h @@ -59,7 +59,7 @@ namespace WebCore { #endif - (WebCore::CachedImage*)promisedDragTIFFDataSource; - (void)setPromisedDragTIFFDataSource:(WebCore::CachedImage*)source; -- (void)_web_layoutIfNeededRecursive; +- (void)_web_updateLayoutAndStyleIfNeededRecursive; - (void)_destroyAllWebPlugins; - (BOOL)_needsLayout; diff --git a/WebKit/mac/WebView/WebPDFView.mm b/WebKit/mac/WebView/WebPDFView.mm index 5e7b73c..70fceb6 100644 --- a/WebKit/mac/WebView/WebPDFView.mm +++ b/WebKit/mac/WebView/WebPDFView.mm @@ -628,6 +628,11 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec - (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(NSUInteger)limit { + return [self countMatchesForText:string caseSensitive:caseFlag limit:limit markMatches:YES]; +} + +- (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(NSUInteger)limit markMatches:(BOOL)markMatches +{ PDFSelection *previousMatch = nil; PDFSelection *nextMatch = nil; NSMutableArray *matches = [[NSMutableArray alloc] initWithCapacity:limit]; diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 86f6d85..3b750ff 100644 --- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -97,6 +97,7 @@ #define WebKitFrameFlatteningEnabledPreferenceKey @"WebKitFrameFlatteningEnabled" #define WebKitPaginateDuringLayoutEnabledPreferenceKey @"WebKitPaginateDuringLayoutEnabled" #define WebKitDNSPrefetchingEnabledPreferenceKey @"WebKitDNSPrefetchingEnabled" +#define WebKitFullScreenEnabledPreferenceKey @"WebKitFullScreenEnabled" #define WebKitMemoryInfoEnabledPreferenceKey @"WebKitMemoryInfoEnabled" // These are private both because callers should be using the cover methods and because the diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm index eae2d8d..a4a5383 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -365,6 +365,7 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey, [NSNumber numberWithBool:NO], WebKitFrameFlatteningEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitDNSPrefetchingEnabledPreferenceKey, + [NSNumber numberWithBool:NO], WebKitFullScreenEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitMemoryInfoEnabledPreferenceKey, [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota, [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota, @@ -1346,6 +1347,16 @@ static NSString *classIBCreatorID = nil; [self _setStringValue:value forKey:key]; } +- (void)setFullScreenEnabled:(BOOL)flag +{ + [self _setBoolValue:flag forKey:WebKitFullScreenEnabledPreferenceKey]; +} + +- (BOOL)fullScreenEnabled +{ + return [self _boolValueForKey:WebKitFullScreenEnabledPreferenceKey]; +} + @end @implementation WebPreferences (WebInternal) diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h index 45c2a24..783038d 100644 --- a/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -206,4 +206,10 @@ extern NSString *WebPreferencesRemovedNotification; // For WebView's use only. - (void)willAddToWebView; - (void)didRemoveFromWebView; + +// Full screen support is dependent on WebCore/WebKit being +// compiled with ENABLE_FULLSCREEN_API. +- (void)setFullScreenEnabled:(BOOL)flag; +- (BOOL)fullScreenEnabled; + @end diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h index 0fb120c..22752ae 100644 --- a/WebKit/mac/WebView/WebUIDelegatePrivate.h +++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h @@ -95,6 +95,15 @@ enum { - (void)deny; @end +#if ENABLE(FULLSCREEN_API) +@protocol WebKitFullScreenListener<NSObject> +- (void)webkitWillEnterFullScreen; +- (void)webkitDidEnterFullScreen; +- (void)webkitWillExitFullScreen; +- (void)webkitDidExitFullScreen; +@end +#endif + @interface NSObject (WebUIDelegatePrivate) - (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)message; @@ -164,4 +173,10 @@ enum { */ - (void)webView:(WebView *)sender printFrame:(WebFrame *)frame; +#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; +#endif + @end diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 2d3dbfa..f2e76c1 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -842,7 +842,7 @@ static bool shouldEnableLoadDeferring() { Frame* frame = [self _mainCoreFrame]; if (frame && frame->view()) - frame->view()->layoutIfNeededRecursive(); + frame->view()->updateLayoutAndStyleIfNeededRecursive(); } #endif @@ -1425,7 +1425,7 @@ static bool fastDocumentTeardownEnabled() settings->setZoomMode([preferences zoomsTextOnly] ? ZoomTextOnly : ZoomPage); settings->setJavaScriptCanAccessClipboard([preferences javaScriptCanAccessClipboard]); settings->setXSSAuditorEnabled([preferences isXSSAuditorEnabled]); - settings->setEnforceCSSMIMETypeInStrictMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1)); + settings->setEnforceCSSMIMETypeInNoQuirksMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1)); settings->setDNSPrefetchingEnabled([preferences isDNSPrefetchingEnabled]); // FIXME: Enabling accelerated compositing when WebGL is enabled causes tests to fail on Leopard which expect HW compositing to be disabled. @@ -1438,6 +1438,9 @@ static bool fastDocumentTeardownEnabled() settings->setLoadDeferringEnabled(shouldEnableLoadDeferring()); settings->setFrameFlatteningEnabled([preferences isFrameFlatteningEnabled]); settings->setPaginateDuringLayoutEnabled([preferences paginateDuringLayoutEnabled]); +#if ENABLE(FULLSCREEN_API) + settings->setFullScreenEnabled([preferences fullScreenEnabled]); +#endif settings->setMemoryInfoEnabled([preferences memoryInfoEnabled]); // Application Cache Preferences are stored on the global cache storage manager, not in Settings. @@ -4372,15 +4375,21 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit { + 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 +{ WebFrame *frame = [self mainFrame]; unsigned matchCount = 0; do { id <WebDocumentView> view = [[frame frameView] documentView]; if ([view conformsToProtocol:@protocol(WebMultipleTextMatches)]) { - [(NSView <WebMultipleTextMatches>*)view setMarkedTextMatchesAreHighlighted:highlight]; + if (markMatches) + [(NSView <WebMultipleTextMatches>*)view setMarkedTextMatchesAreHighlighted:highlight]; ASSERT(limit == 0 || matchCount < limit); - matchCount += [(NSView <WebMultipleTextMatches>*)view markAllMatchesForText:string caseSensitive:caseFlag limit:limit == 0 ? 0 : limit - matchCount]; + matchCount += [(NSView <WebMultipleTextMatches>*)view countMatchesForText:string caseSensitive:caseFlag limit:limit == 0 ? 0 : limit - matchCount markMatches:markMatches]; // Stop looking if we've reached the limit. A limit of 0 means no limit. if (limit > 0 && matchCount >= limit) diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h index 9d47a4d..28348cc 100644 --- a/WebKit/mac/WebView/WebViewPrivate.h +++ b/WebKit/mac/WebView/WebViewPrivate.h @@ -180,6 +180,7 @@ typedef enum { // These methods are still in flux; don't rely on them yet. - (BOOL)canMarkAllTextMatches; - (WebNSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(WebNSUInteger)limit; +- (WebNSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(WebNSUInteger)limit markMatches:(BOOL)markMatches; - (void)unmarkAllTextMatches; - (NSArray *)rectsForTextMatches; |