diff options
Diffstat (limited to 'WebKit')
296 files changed, 22542 insertions, 2383 deletions
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog index 7a0721a..9293336 100644 --- a/WebKit/ChangeLog +++ b/WebKit/ChangeLog @@ -1,3 +1,239 @@ +2009-10-06 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Mark Rowe. + + accessibility/media-element.html crashes (and has incorrect result) + https://bugs.webkit.org/show_bug.cgi?id=30108 + + Fix up the accessibilty label for the newly added fullscreen button, + and update the test result accordingly. + + * English.lproj/Localizable.strings: + +2009-10-05 Kevin Decker <kdecker@apple.com> + + Reviewed by Dan Bernstein. + + * WebKit.xcodeproj/project.pbxproj: Add WebPluginHalterClient to the project. + +2009-10-05 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + One of the dependencies' SVN url was missing a @ before the revision number. + + https://bugs.webkit.org/show_bug.cgi?id=30101 + + * chromium/DEPS: + +2009-10-05 Pierre d'Herbemont <pdherbemont@webkit.org> + + Reviewed by Simon Fraser + + Support fullscreen in MediaPlayer (Mac) + https://bugs.webkit.org/show_bug.cgi?id=26742 + + Add new files for video fullscreen. + + * WebKit.xcodeproj/project.pbxproj: + +2009-10-05 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: add testing harness for Web Inspector. + + https://bugs.webkit.org/show_bug.cgi?id=30010 + + * WebKit.xcodeproj/project.pbxproj: + +2009-10-04 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Eric Seidel + + Enable Web Sockets in chromium build. + https://bugs.webkit.org/show_bug.cgi?id=29917 + + * chromium/features.gypi: + +2009-10-02 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + Added gyp_webkit that does a subset of the things gyp_chromium does + plus some specialization for an upstream chromium build. + + https://bugs.webkit.org/show_bug.cgi?id=29986 + + * chromium/DEPS: Points to gyp_webkit instead of gyp_chromium. + * chromium/gyp_webkit: A new python file. + +2009-10-01 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + Make it possible to override the list of feature defines when building + downstream. + + https://bugs.webkit.org/show_bug.cgi?id=29979 + + * chromium/features.gypi: + +2009-10-01 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + Added windows-specific dependencies, updated some revisions and + re-organized file to make revision tracking easier. Also removed + extensions/v8 dependency that is no longer needed upstream. + + https://bugs.webkit.org/show_bug.cgi?id=29973 + + * chromium/DEPS: + +2009-09-30 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + 1. Keeping up with downstream revisions. + 2. Turning off v8 snapshot build step. + + https://bugs.webkit.org/show_bug.cgi?id=29928 + + * chromium/DEPS + +2009-09-29 Brady Eidson <beidson@apple.com> + + Reviewed by John Sullivan. + + WebKit Mac API should provide a delegate interface for global history. + <rdar://problem/7042773> and https://webkit.org/b/29904 + + * WebKit.xcodeproj/project.pbxproj: + +2009-09-28 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + https://bugs.webkit.org/show_bug.cgi?id=29722 + + * chromium/DEPS: Describes the chromium port's dependencies and + is used by gclient to fetch them. + * chromium/webkit.gyp: Currently only builds webcore but in + the future will also build the webkit api. + +2009-09-26 David Kilzer <ddkilzer@apple.com> + + Part 2 of 2: <http://webkit.org/b/29753> DerivedSources.make broken for non-Mac targets + + Reviewed by Darin Adler. + + Fix ENABLE_ORIENTATION_EVENTS for non-Mac platforms. + + * chromium/features.gypi: Added 'ENABLE_ORIENTATION_EVENTS=0' to + disable this feature by default. + +2009-09-22 Yaar Schnitman <yaar@chromium.org> + + Reviewed by David Levin. + + Create chromium directory and ported chromium.org's features.gypi for + the webkit chromium port. + + https://bugs.webkit.org/show_bug.cgi?id=29617 + + * chromium/features.gypi: Added. + +2009-09-21 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/4137135> iFrame with PDF not being handled correctly on + usps.com + https://bugs.webkit.org/show_bug.cgi?id=4151 + + * WebKit.xcodeproj/project.pbxproj: Added WebPDFDocumentExtras.{h,mm} + and WebJSPDFDoc.{h,mm} and changed WebPDFRepresentation to + Objective-C++. + +2009-09-07 Steve Block <steveblock@google.com> + + Reviewed by Adam Barth. + + Adds a mock Geolocation service. This will be used to provide predictable behavior of the + Geolocation API for use in LayoutTests. Later changes will integrate the the mock + Geolocation service with DumpRenderTree. + https://bugs.webkit.org/show_bug.cgi?id=28264 + + * WebKit.xcodeproj/project.pbxproj: Modified. Adds WebGeolocationMock. + +2009-09-03 John Sullivan <sullivan@apple.com> + + Reviewed by Adam Roben + + * StringsNotToBeLocalized.txt: + Brought this file up to date. + +2009-08-31 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Beth Dakin. + + Remove WebViewEditingContextMenu.nib and WebViewEditingContextMenuOld.nib. + We stopped using these back in r18592 when we switched over to context menus + driven by WebCore. + + * English.lproj/WebViewEditingContextMenu.nib/classes.nib: Removed. + * English.lproj/WebViewEditingContextMenu.nib/info.nib: Removed. + * English.lproj/WebViewEditingContextMenu.nib/objects.nib: Removed. + * English.lproj/WebViewEditingContextMenuOld.nib/classes.nib: Removed. + * English.lproj/WebViewEditingContextMenuOld.nib/info.nib: Removed. + * English.lproj/WebViewEditingContextMenuOld.nib/objects.nib: Removed. + * WebKit.xcodeproj/project.pbxproj: + +2009-08-28 Chris Fleizach <cfleizach@apple.com> + + Reviewed by John Sullivan. + + update-webkit-localizable-strings script can no longer complete + https://bugs.webkit.org/show_bug.cgi?id=28792 + + * English.lproj/Localizable.strings: + +2009-08-27 John Sullivan <sullivan@apple.com> + + * StringsNotToBeLocalized.txt: + Brought up to date, other than the problem mentioned in https://bugs.webkit.org/show_bug.cgi?id=28792 + +2009-08-25 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Oliver Hunt. + + <video> and <audio> controller should be accessible + https://bugs.webkit.org/show_bug.cgi?id=28081 + + Add localized strings for media controller accessiblility. + + * English.lproj/Localizable.strings: + +2009-08-20 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + Enable various "grouping" ARIA roles + https://bugs.webkit.org/show_bug.cgi?id=28486 + + * English.lproj/Localizable.strings: + +2009-08-18 Drew Wilson <atwilson@google.com> + + Reviewed by Eric Seidel. + + Need to extend DumpRenderTree to expose number of worker threads. + https://bugs.webkit.org/show_bug.cgi?id=28292 + + * WebKit.xcodeproj/project.pbxproj: + Added WebWorkersPrivate APIs to mac WebKit to expose workerThreadCount() for DumpRenderTree. + 2009-08-06 Mark Rowe <mrowe@apple.com> Rubber-stamped by Sam Weinig. diff --git a/WebKit/English.lproj/Localizable.strings b/WebKit/English.lproj/Localizable.strings Binary files differindex a0182db..e4a172b 100644 --- a/WebKit/English.lproj/Localizable.strings +++ b/WebKit/English.lproj/Localizable.strings diff --git a/WebKit/English.lproj/WebViewEditingContextMenu.nib/classes.nib b/WebKit/English.lproj/WebViewEditingContextMenu.nib/classes.nib deleted file mode 100644 index 0cdded5..0000000 --- a/WebKit/English.lproj/WebViewEditingContextMenu.nib/classes.nib +++ /dev/null @@ -1,31 +0,0 @@ -{ - IBClasses = ( - { - ACTIONS = { - changeBaseWritingDirection = id; - myAction = id; - outline = id; - startSpeaking = id; - stopSpeaking = id; - toggleBaseWritingDirection = id; - toggleGrammarChecking = id; - }; - CLASS = FirstResponder; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, - { - CLASS = MyObject; - LANGUAGE = ObjC; - OUTLETS = {defaultMenu = id; }; - SUPERCLASS = NSObject; - }, - { - ACTIONS = {orderFrontFontOptionsPanel = id; orderFrontStylesPanel = id; }; - CLASS = NSFontManager; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - } - ); - IBVersion = 1; -}
\ No newline at end of file diff --git a/WebKit/English.lproj/WebViewEditingContextMenu.nib/info.nib b/WebKit/English.lproj/WebViewEditingContextMenu.nib/info.nib deleted file mode 100644 index d40ca6c..0000000 --- a/WebKit/English.lproj/WebViewEditingContextMenu.nib/info.nib +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBDocumentLocation</key> - <string>819 178 356 240 0 0 2560 1578 </string> - <key>IBEditorPositions</key> - <dict> - <key>5</key> - <string>138 491 215 175 0 0 2560 1578 </string> - </dict> - <key>IBFramework Version</key> - <string>446.1</string> - <key>IBOpenObjects</key> - <array> - <integer>5</integer> - </array> - <key>IBSystem Version</key> - <string>8L127</string> -</dict> -</plist> diff --git a/WebKit/English.lproj/WebViewEditingContextMenu.nib/objects.nib b/WebKit/English.lproj/WebViewEditingContextMenu.nib/objects.nib Binary files differdeleted file mode 100644 index aef59b9..0000000 --- a/WebKit/English.lproj/WebViewEditingContextMenu.nib/objects.nib +++ /dev/null diff --git a/WebKit/English.lproj/WebViewEditingContextMenuOld.nib/classes.nib b/WebKit/English.lproj/WebViewEditingContextMenuOld.nib/classes.nib deleted file mode 100644 index 0cdded5..0000000 --- a/WebKit/English.lproj/WebViewEditingContextMenuOld.nib/classes.nib +++ /dev/null @@ -1,31 +0,0 @@ -{ - IBClasses = ( - { - ACTIONS = { - changeBaseWritingDirection = id; - myAction = id; - outline = id; - startSpeaking = id; - stopSpeaking = id; - toggleBaseWritingDirection = id; - toggleGrammarChecking = id; - }; - CLASS = FirstResponder; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, - { - CLASS = MyObject; - LANGUAGE = ObjC; - OUTLETS = {defaultMenu = id; }; - SUPERCLASS = NSObject; - }, - { - ACTIONS = {orderFrontFontOptionsPanel = id; orderFrontStylesPanel = id; }; - CLASS = NSFontManager; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - } - ); - IBVersion = 1; -}
\ No newline at end of file diff --git a/WebKit/English.lproj/WebViewEditingContextMenuOld.nib/info.nib b/WebKit/English.lproj/WebViewEditingContextMenuOld.nib/info.nib deleted file mode 100644 index 70fed51..0000000 --- a/WebKit/English.lproj/WebViewEditingContextMenuOld.nib/info.nib +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBDocumentLocation</key> - <string>403 85 356 240 0 0 1440 878 </string> - <key>IBEditorPositions</key> - <dict> - <key>5</key> - <string>72 246 179 203 0 0 1440 878 </string> - </dict> - <key>IBFramework Version</key> - <string>453.0</string> - <key>IBOpenObjects</key> - <array> - <integer>5</integer> - </array> - <key>IBSystem Version</key> - <string>9A288</string> -</dict> -</plist> diff --git a/WebKit/English.lproj/WebViewEditingContextMenuOld.nib/objects.nib b/WebKit/English.lproj/WebViewEditingContextMenuOld.nib/objects.nib Binary files differdeleted file mode 100644 index dc68b9b..0000000 --- a/WebKit/English.lproj/WebViewEditingContextMenuOld.nib/objects.nib +++ /dev/null diff --git a/WebKit/StringsNotToBeLocalized.txt b/WebKit/StringsNotToBeLocalized.txt index 7e593ca..3f1964d 100644 --- a/WebKit/StringsNotToBeLocalized.txt +++ b/WebKit/StringsNotToBeLocalized.txt @@ -8,7 +8,6 @@ " Mac OS X %@; %@) AppleWebKit/%@ (KHTML, like Gecko) %@" " Mac OS X %@; %@) AppleWebKit/%@ (KHTML, like Gecko)" " Version/3.2.1" -" webViewDrawResizer delegate call" "#" "%" "%.0f" @@ -49,12 +48,12 @@ "._" ".download" ".html" +".jpg" ".svg" ".xhtml" "/" "/Frameworks/PDFKit.framework" "/Library/Internet Plug-Ins" -"/System/Library/Frameworks/Accelerate.framework/Accelerate" "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/LangAnalysis.framework/LangAnalysis" "/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox" "/Volumes" @@ -74,6 +73,7 @@ "5CACD637-F82F-491F-947A-5DCA38AA0FEA" "6EB8D98F-2723-4472-88D3-5936F9D6E631" "7" +"7.1" "9" ":" "://" @@ -96,6 +96,22 @@ "@" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-." "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+.-" +"ARIAApplicationLog" +"ARIAApplicationMarquee" +"ARIAApplicationStatus" +"ARIAApplicationTimer" +"ARIADocument" +"ARIADocumentArticle" +"ARIADocumentNote" +"ARIADocumentRegion" +"ARIALandmarkApplication" +"ARIALandmarkBanner" +"ARIALandmarkComplementary" +"ARIALandmarkContentInfo" +"ARIALandmarkMain" +"ARIALandmarkNavigation" +"ARIALandmarkSearch" +"ARIAUserInterfaceTooltip" "AXEnhancedUserInterface" "AccessibleBase" "AccessibleObjectFromWindow" @@ -104,6 +120,7 @@ "AppleKeyboardUIMode" "AppleLanguages" "AppleTextDirection" +"AudioElement" "BEGIN:VCALENDAR" "BEGIN:VCARD" "BP_CreatePluginMIMETypesPreferences" @@ -113,6 +130,7 @@ "Content-Encoding" "Content-Length" "Content-Type" +"CurrentTimeDisplay" "D" "DCMDictionaryServiceWindowShow" "DELEGATE METHODS" @@ -133,12 +151,14 @@ "FastMallocHeapSize" "FastMallocReturnedSize" "FrameName" +"FullscreenButton" "GEN_DOMObject" "GET" "GroupName" "HIDictionaryWindowShow" "HTTP " "Helvetica" +"HostedNetscapePluginStream" "IDNScriptWhiteList" "IDNScriptWhiteList.txt" "IMM32.DLL" @@ -167,7 +187,6 @@ "Library/Caches" "Library/Internet Plug-Ins" "LresultFromObject" -"Lucida Grande" "MIME\\Database\\Content Type" "MainPageJavaScript.js" "MemoryStream" @@ -198,9 +217,8 @@ "MoveWordRight" "MoveWordRightAndModifySelection" "Mozilla/5.0 (Macintosh; U; " -"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.28.3" "Mozilla/5.0 (Windows; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko)%s%s" -"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.29" +"MuteButton" "NP_GetEntryPoints" "NP_Initialize" "NP_Shutdown" @@ -213,6 +231,7 @@ "NSEvent" "NSView" "NeXT smart paste pasteboard type" +"NetscapePluginInstanceProxy" "PDFDocument" "PDFPreviewView" "PDFView" @@ -222,21 +241,33 @@ "PNG" "POST" "PPC" +"PauseButton" +"PlayButton" "Quartz.framework" "RTL" "Referer" +"ReturnToRealtimeButton" +"RewindButton" "SAMILang" "SAMIStyle" "Safari.exe" +"SeekBackButton" +"SeekForwardButton" "SelectAll" +"Slider" +"SliderThumb" +"StatusDisplay" +"TimeRemainingDisplay" "Times" "ToggleBold" "ToggleItalic" "U+0009" "U+001B" "UTF-8" +"UnMuteButton" "UseBackForwardList" "User-Agent" +"VideoElement" "Volumes" "W" "WEBKIT_UNSET_DYLD_FRAMEWORK_PATH" @@ -285,7 +316,14 @@ "WebElementTitle" "WebError" "WebFrame" +"WebFrameCanSuspendActiveDOMObjectsKey" +"WebFrameHasPluginsKey" +"WebFrameHasUnloadListenerKey" +"WebFrameMainDocumentErrorKey" "WebFramePolicyListener" +"WebFrameUsesApplicationCacheKey" +"WebFrameUsesDatabasesKey" +"WebFrameUsesGeolocationKey" "WebHTMLRepresentation" "WebHistory" "WebHistoryAllItemsRemovedNotification" @@ -321,8 +359,6 @@ "WebKitErrorPlugInPageURLStringKey" "WebKitHistoryAgeInDaysLimit" "WebKitHistoryItemLimit" -"WebKitInspectorAttached" -"WebKitInspectorAttachedViewHeight" "WebKitInspectorHiddenPanels" "WebKitLocalCache" "WebKitLogLevel" @@ -402,6 +438,7 @@ "WebViewDidChangeTypingStyleNotification" "WebViewDidEndEditingNotification" "WebViewWindowClass" +"WebWorkersPrivate" "Windows %d.%d" "Windows 95" "Windows 98" @@ -429,7 +466,8 @@ "a" "ab" "about:" -"ads.pointroll.com" +"actions" +"anchorPoint" "applewebdata" "applewebdata://%@" "application.pdf" @@ -446,6 +484,7 @@ "attributeValues" "b" "basefont" +"bounds" "bundlePath" "c" "canGoBack" @@ -517,6 +556,8 @@ "com.sunrisebrowser.Sunrise" "com.thinkmac.NewsLife" "com.yahoo.messenger3" +"contents" +"contentsRect" "cp949" "cpuType" "de.codingmonkeys.SubEthaEdit" @@ -552,11 +593,11 @@ "img" "info.colloquy" "insertText:" +"inspectorStartsAttached" "isLoading" "isindex" "javascript:" "jpeg" -"jpg" "js" "kioskmode" "ks_c_5601-1987" @@ -581,6 +622,7 @@ "nullPlugin" "nullplugin" "oleacc.dll" +"opacity" "org.xlife.NewsFire" "panEastCursor" "panIcon" @@ -593,6 +635,7 @@ "panWestCursor" "pluginHostPath" "pluginspage" +"position" "public.url" "public.url-name" "r" @@ -608,6 +651,8 @@ "sourceURL" "src" "sub" +"sublayerTransform" +"sublayers" "text/calendar" "text/directory" "text/html" @@ -626,13 +671,13 @@ "text/x-vcf" "textAreaResizeCorner" "tiff" +"transform" "txt" "u" "uk.co.opencommunity.vienna2" "userAgent" "userInfo" "utf-16" -"vImagePermuteChannels_ARGB8888" "verticalTextCursor" "visibleName" "visitCount" diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj index 45bcd15..db25bf9 100644 --- a/WebKit/WebKit.xcodeproj/project.pbxproj +++ b/WebKit/WebKit.xcodeproj/project.pbxproj @@ -11,10 +11,18 @@ 065AD5A40B0C32C7005A2B1D /* WebContextMenuClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 065AD5A20B0C32C7005A2B1D /* WebContextMenuClient.mm */; }; 06693DDC0BFBA85200216072 /* WebInspectorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 06693DDA0BFBA85200216072 /* WebInspectorClient.h */; }; 06693DDD0BFBA85200216072 /* WebInspectorClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 06693DDB0BFBA85200216072 /* WebInspectorClient.mm */; }; + 0A2D87FD107AF52B00CDDEE3 /* WebPluginHalterClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A2D87FB107AF52B00CDDEE3 /* WebPluginHalterClient.h */; }; + 0A2D87FE107AF52B00CDDEE3 /* WebPluginHalterClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0A2D87FC107AF52B00CDDEE3 /* WebPluginHalterClient.mm */; }; 0AB752370FA2E4DB00D7CBB1 /* WebNetscapeContainerCheckContextInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AB752350FA2E4DB00D7CBB1 /* WebNetscapeContainerCheckContextInfo.h */; }; 0AB752380FA2E4DB00D7CBB1 /* WebNetscapeContainerCheckContextInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0AB752360FA2E4DB00D7CBB1 /* WebNetscapeContainerCheckContextInfo.mm */; }; 0AEBFF630F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AEBFF610F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0AEBFF640F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0AEBFF620F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.mm */; }; + 0FD3B0F21076C3E900039B96 /* WebVideoFullscreenController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD3B0EE1076C3E900039B96 /* WebVideoFullscreenController.h */; }; + 0FD3B0F31076C3E900039B96 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FD3B0EF1076C3E900039B96 /* WebVideoFullscreenController.mm */; }; + 0FD3B0F41076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD3B0F01076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h */; }; + 0FD3B0F51076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FD3B0F11076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm */; }; + 0FD3B0F81076C3F700039B96 /* WebWindowAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD3B0F61076C3F700039B96 /* WebWindowAnimation.h */; }; + 0FD3B0F91076C3F700039B96 /* WebWindowAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FD3B0F71076C3F700039B96 /* WebWindowAnimation.m */; }; 14D8252F0AF955090004F057 /* WebChromeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D8252D0AF955090004F057 /* WebChromeClient.h */; }; 14D825300AF955090004F057 /* WebChromeClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 14D8252E0AF955090004F057 /* WebChromeClient.mm */; }; 1A20D08B0ED384F20043FA9F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A20D08A0ED384F20043FA9F /* QuartzCore.framework */; }; @@ -71,6 +79,12 @@ 226E9E6A09D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 226E9E6809D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.h */; }; 226E9E6B09D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.c in Sources */ = {isa = PBXBuildFile; fileRef = 226E9E6909D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; 22F219CC08D236730030E078 /* WebBackForwardListPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 22F219CB08D236730030E078 /* WebBackForwardListPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 37B6FB4E1063530C000FDB3B /* WebPDFDocumentExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 37B6FB4C1063530C000FDB3B /* WebPDFDocumentExtras.h */; }; + 37B6FB4F1063530C000FDB3B /* WebPDFDocumentExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37B6FB4D1063530C000FDB3B /* WebPDFDocumentExtras.mm */; }; + 37D1DCA81065928C0068F7EF /* WebJSPDFDoc.h in Headers */ = {isa = PBXBuildFile; fileRef = 37D1DCA61065928C0068F7EF /* WebJSPDFDoc.h */; }; + 37D1DCA91065928C0068F7EF /* WebJSPDFDoc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D1DCA71065928C0068F7EF /* WebJSPDFDoc.mm */; }; + 41F4484F10338E8C0030E55E /* WebWorkersPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F4484D10338E8C0030E55E /* WebWorkersPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41F4484E10338E8C0030E55E /* WebWorkersPrivate.mm */; }; 441793A60E34EE150055E1AE /* WebHTMLRepresentationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 441793A50E34EE150055E1AE /* WebHTMLRepresentationInternal.h */; }; 4BF99F900AE050BC00815C2B /* WebEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */; settings = {ATTRIBUTES = (); }; }; 4BF99F910AE050BC00815C2B /* WebEditorClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */; }; @@ -85,6 +99,9 @@ 51494CD70C7EBDE0004178C5 /* WebIconDatabaseClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51494CD50C7EBDE0004178C5 /* WebIconDatabaseClient.mm */; }; 51494D240C7EC1B7004178C5 /* WebNSNotificationCenterExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 51494D220C7EC1B6004178C5 /* WebNSNotificationCenterExtras.h */; }; 51494D250C7EC1B7004178C5 /* WebNSNotificationCenterExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 51494D230C7EC1B7004178C5 /* WebNSNotificationCenterExtras.m */; }; + 5158F6EF106D862A00AF457C /* WebHistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */; }; + 5185F62610712B80007AA393 /* WebNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185F62510712B80007AA393 /* WebNavigationData.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 5185F62810712B97007AA393 /* WebNavigationData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F62710712B97007AA393 /* WebNavigationData.mm */; }; 51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */; }; 51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */; }; 51C714FB0B20F79F00E5E33C /* WebBackForwardListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */; }; @@ -92,12 +109,12 @@ 51FDC4D30B0AF5C100F84EB3 /* WebHistoryItemPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5241ADF50B1BC48A004012BD /* WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5241ADF30B1BC48A004012BD /* WebCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5241ADF60B1BC48A004012BD /* WebCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5241ADF40B1BC48A004012BD /* WebCache.mm */; }; + 59C77F3510545F7E00506104 /* WebGeolocationMock.mm in Sources */ = {isa = PBXBuildFile; fileRef = 59C77F3310545F7E00506104 /* WebGeolocationMock.mm */; }; + 59C77F4B105471E700506104 /* WebGeolocationMockPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 59C77F4A105471E700506104 /* WebGeolocationMockPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5D1638F30E35B45D00F3038E /* EmptyProtocolDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D1638F20E35B45D00F3038E /* EmptyProtocolDefinitions.h */; }; 5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D7BF8120C2A1D90008CE06D /* WebInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5D7BF8150C2A1D90008CE06D /* WebInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */; }; 5DE83A7A0D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A740D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib */; }; - 5DE83A7B0D0F7F9400CAD12A /* WebViewEditingContextMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A760D0F7F9400CAD12A /* WebViewEditingContextMenu.nib */; }; - 5DE83A7C0D0F7F9400CAD12A /* WebViewEditingContextMenuOld.nib in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A780D0F7F9400CAD12A /* WebViewEditingContextMenuOld.nib */; }; 5DE83A7F0D0F7FAD00CAD12A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A7D0D0F7FAD00CAD12A /* Localizable.strings */; }; 5DE92FEF0BD7017E0059A5FD /* WebAssertions.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DE92FEE0BD7017E0059A5FD /* WebAssertions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 65488DA1084FBCCB00831AD0 /* WebNSDictionaryExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 65488D9F084FBCCB00831AD0 /* WebNSDictionaryExtras.h */; }; @@ -112,6 +129,7 @@ 65EEDE58084FFC9E0002DB25 /* WebNSFileManagerExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 65EEDE56084FFC9E0002DB25 /* WebNSFileManagerExtras.m */; }; 65FFB7FC0AD0B7D30048CD05 /* WebDocumentLoaderMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 65FFB7FA0AD0B7D30048CD05 /* WebDocumentLoaderMac.h */; }; 65FFB7FD0AD0B7D30048CD05 /* WebDocumentLoaderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65FFB7FB0AD0B7D30048CD05 /* WebDocumentLoaderMac.mm */; }; + 7A8FF0D11075024A00A80A08 /* WebInspectorPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A8FF0D01075024A00A80A08 /* WebInspectorPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7E6FEF0808985A7200C44C3F /* WebScriptDebugDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E6FEF0508985A7200C44C3F /* WebScriptDebugDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7E6FEF0908985A7200C44C3F /* WebScriptDebugDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E6FEF0608985A7200C44C3F /* WebScriptDebugDelegate.mm */; }; 9304B3000B02341500F7850D /* WebIconDatabaseInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9304B2FF0B02341500F7850D /* WebIconDatabaseInternal.h */; }; @@ -289,7 +307,7 @@ 9398111C0824BF01008DF038 /* WebDOMOperations.mm in Sources */ = {isa = PBXBuildFile; fileRef = 846171FA0624AE5B0071A4A3 /* WebDOMOperations.mm */; }; 9398111D0824BF01008DF038 /* WebArchive.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8373435B0624EE0D00F3B289 /* WebArchive.mm */; }; 9398111E0824BF01008DF038 /* WebPDFView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E94C3506C0321200A9B09E /* WebPDFView.mm */; }; - 9398111F0824BF01008DF038 /* WebPDFRepresentation.m in Sources */ = {isa = PBXBuildFile; fileRef = 51E94C6906C0347500A9B09E /* WebPDFRepresentation.m */; }; + 9398111F0824BF01008DF038 /* WebPDFRepresentation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E94C6906C0347500A9B09E /* WebPDFRepresentation.mm */; }; 939811260824BF01008DF038 /* WebPluginContainerCheck.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65E1150407EFFEBF009B8BF7 /* WebPluginContainerCheck.mm */; }; 939811290824BF01008DF038 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5C2869402846DCD018635CA /* Carbon.framework */; }; 9398112A0824BF01008DF038 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5C2869502846DCD018635CA /* Cocoa.framework */; }; @@ -335,10 +353,18 @@ 065AD5A20B0C32C7005A2B1D /* WebContextMenuClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuClient.mm; sourceTree = "<group>"; }; 06693DDA0BFBA85200216072 /* WebInspectorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspectorClient.h; sourceTree = "<group>"; }; 06693DDB0BFBA85200216072 /* WebInspectorClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspectorClient.mm; sourceTree = "<group>"; }; + 0A2D87FB107AF52B00CDDEE3 /* WebPluginHalterClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginHalterClient.h; sourceTree = "<group>"; }; + 0A2D87FC107AF52B00CDDEE3 /* WebPluginHalterClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPluginHalterClient.mm; sourceTree = "<group>"; }; 0AB752350FA2E4DB00D7CBB1 /* WebNetscapeContainerCheckContextInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNetscapeContainerCheckContextInfo.h; sourceTree = "<group>"; }; 0AB752360FA2E4DB00D7CBB1 /* WebNetscapeContainerCheckContextInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNetscapeContainerCheckContextInfo.mm; sourceTree = "<group>"; }; 0AEBFF610F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = WebNetscapeContainerCheckPrivate.h; sourceTree = "<group>"; }; 0AEBFF620F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNetscapeContainerCheckPrivate.mm; sourceTree = "<group>"; }; + 0FD3B0EE1076C3E900039B96 /* WebVideoFullscreenController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenController.h; sourceTree = "<group>"; }; + 0FD3B0EF1076C3E900039B96 /* WebVideoFullscreenController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenController.mm; sourceTree = "<group>"; }; + 0FD3B0F01076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenHUDWindowController.h; sourceTree = "<group>"; }; + 0FD3B0F11076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenHUDWindowController.mm; sourceTree = "<group>"; }; + 0FD3B0F61076C3F700039B96 /* WebWindowAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebWindowAnimation.h; sourceTree = "<group>"; }; + 0FD3B0F71076C3F700039B96 /* WebWindowAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebWindowAnimation.m; sourceTree = "<group>"; }; 14D8252D0AF955090004F057 /* WebChromeClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebChromeClient.h; sourceTree = "<group>"; }; 14D8252E0AF955090004F057 /* WebChromeClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebChromeClient.mm; sourceTree = "<group>"; }; 1A20D08A0ED384F20043FA9F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; }; @@ -407,6 +433,10 @@ 35081D9502B6D4D80ACA2ACA /* WebHTMLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebHTMLView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 35081D9602B6D4D80ACA2ACA /* WebHTMLViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHTMLViewPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 35081DAE02B6D4F50ACA2ACA /* WebDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 37B6FB4C1063530C000FDB3B /* WebPDFDocumentExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPDFDocumentExtras.h; sourceTree = "<group>"; }; + 37B6FB4D1063530C000FDB3B /* WebPDFDocumentExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPDFDocumentExtras.mm; sourceTree = "<group>"; }; + 37D1DCA61065928C0068F7EF /* WebJSPDFDoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebJSPDFDoc.h; sourceTree = "<group>"; }; + 37D1DCA71065928C0068F7EF /* WebJSPDFDoc.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = WebJSPDFDoc.mm; sourceTree = "<group>"; }; 3944606B020F50ED0ECA1767 /* WebDynamicScrollBarsView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDynamicScrollBarsView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 3944606C020F50ED0ECA1767 /* WebDynamicScrollBarsView.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebDynamicScrollBarsView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 3944606E020F50ED0ECA1767 /* WebPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPreferences.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; @@ -418,6 +448,8 @@ 3944607E020F50ED0ECA1767 /* WebBackForwardList.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebBackForwardList.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 3944607F020F50ED0ECA1767 /* WebHistoryItem.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItem.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 39446080020F50ED0ECA1767 /* WebHistoryItem.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebHistoryItem.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 41F4484D10338E8C0030E55E /* WebWorkersPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebWorkersPrivate.h; path = mac/Workers/WebWorkersPrivate.h; sourceTree = "<group>"; }; + 41F4484E10338E8C0030E55E /* WebWorkersPrivate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebWorkersPrivate.mm; path = mac/Workers/WebWorkersPrivate.mm; sourceTree = "<group>"; }; 441793A50E34EE150055E1AE /* WebHTMLRepresentationInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebHTMLRepresentationInternal.h; sourceTree = "<group>"; }; 449098B90F8F82DF0076A327 /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; }; 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebEditorClient.h; sourceTree = "<group>"; }; @@ -442,10 +474,13 @@ 5152FADF033FC50400CA2ACD /* WebDefaultPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDefaultPolicyDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 5152FAE0033FC50400CA2ACD /* WebDefaultPolicyDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDefaultPolicyDelegate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 5152FAE5033FC52200CA2ACD /* WebFrameLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameLoadDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryDelegate.h; sourceTree = "<group>"; }; 515E27CC0458C86500CA2D3A /* WebUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebUIDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 515E27CF0458CA4B00CA2D3A /* WebDefaultUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDefaultUIDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 515E27D00458CA4B00CA2D3A /* WebDefaultUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDefaultUIDelegate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 516F296F03A6C45A00CA2D3A /* WebHistoryItemInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItemInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 5185F62510712B80007AA393 /* WebNavigationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNavigationData.h; sourceTree = "<group>"; }; + 5185F62710712B97007AA393 /* WebNavigationData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNavigationData.mm; sourceTree = "<group>"; }; 51863EFC065419EB00E9E8DD /* WebJavaPlugIn.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebJavaPlugIn.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 51A8B52E04282B5900CA2D3A /* WebFrameView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 51A8B52F04282B5900CA2D3A /* WebFrameView.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFrameView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; @@ -460,16 +495,16 @@ 51E94C3406C0321200A9B09E /* WebPDFView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPDFView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 51E94C3506C0321200A9B09E /* WebPDFView.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPDFView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 51E94C6806C0347500A9B09E /* WebPDFRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPDFRepresentation.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; - 51E94C6906C0347500A9B09E /* WebPDFRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebPDFRepresentation.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 51E94C6906C0347500A9B09E /* WebPDFRepresentation.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPDFRepresentation.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItemPrivate.h; sourceTree = "<group>"; }; 5241ADF30B1BC48A004012BD /* WebCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCache.h; sourceTree = "<group>"; }; 5241ADF40B1BC48A004012BD /* WebCache.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCache.mm; sourceTree = "<group>"; }; + 59C77F3310545F7E00506104 /* WebGeolocationMock.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGeolocationMock.mm; sourceTree = "<group>"; }; + 59C77F4A105471E700506104 /* WebGeolocationMockPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeolocationMockPrivate.h; sourceTree = "<group>"; }; 5D1638F20E35B45D00F3038E /* EmptyProtocolDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmptyProtocolDefinitions.h; sourceTree = "<group>"; }; 5D7BF8120C2A1D90008CE06D /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; }; 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspector.mm; sourceTree = "<group>"; }; 5DE83A750D0F7F9400CAD12A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/WebJavaScriptTextInputPanel.nib; sourceTree = SOURCE_ROOT; }; - 5DE83A770D0F7F9400CAD12A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/WebViewEditingContextMenu.nib; sourceTree = SOURCE_ROOT; }; - 5DE83A790D0F7F9400CAD12A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/WebViewEditingContextMenuOld.nib; sourceTree = SOURCE_ROOT; }; 5DE83A7E0D0F7FAD00CAD12A /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = SOURCE_ROOT; }; 5DE92FEE0BD7017E0059A5FD /* WebAssertions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebAssertions.h; sourceTree = "<group>"; }; 65488D9F084FBCCB00831AD0 /* WebNSDictionaryExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSDictionaryExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; @@ -492,6 +527,7 @@ 65FFB7FB0AD0B7D30048CD05 /* WebDocumentLoaderMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDocumentLoaderMac.mm; sourceTree = "<group>"; }; 7082F56F038EADAA00A80180 /* WebKitNSStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNSStringExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 7082F570038EADAA00A80180 /* WebKitNSStringExtras.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; indentWidth = 4; path = WebKitNSStringExtras.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 7A8FF0D01075024A00A80A08 /* WebInspectorPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorPrivate.h; sourceTree = "<group>"; }; 7E6FEF0508985A7200C44C3F /* WebScriptDebugDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 7E6FEF0608985A7200C44C3F /* WebScriptDebugDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebScriptDebugDelegate.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 830E81E005853AC000AD0891 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; }; @@ -705,6 +741,7 @@ F5B36B400281DE87018635CB /* WebCoreSupport */, 9C7CABBB0190A37C0ECA16EA /* WebView */, 1C68F63F095B5F9C00C2984E /* WebInspector */, + 41F4484C10338E570030E55E /* Workers */, F7EBEE5903F9DB2203CA0DE6 /* Carbon */, 089C1665FE841158C02AAC07 /* Resources */, 0867D69AFE84028FC02AAC07 /* Frameworks and Libraries */, @@ -740,8 +777,6 @@ ED3B48DE0CC51F7E00DFF1EB /* StringsNotToBeLocalized.txt */, F5B67130023EDF8901C1A525 /* url_icon.tiff */, 5DE83A740D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib */, - 5DE83A760D0F7F9400CAD12A /* WebViewEditingContextMenu.nib */, - 5DE83A780D0F7F9400CAD12A /* WebViewEditingContextMenuOld.nib */, ); name = Resources; path = mac/Resources; @@ -794,6 +829,7 @@ children = ( 5D7BF8120C2A1D90008CE06D /* WebInspector.h */, 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */, + 7A8FF0D01075024A00A80A08 /* WebInspectorPrivate.h */, 1C68F663095B5FC100C2984E /* WebNodeHighlight.h */, 1C68F664095B5FC100C2984E /* WebNodeHighlight.mm */, 1C68F665095B5FC100C2984E /* WebNodeHighlightView.h */, @@ -929,6 +965,15 @@ tabWidth = 4; usesTabs = 0; }; + 41F4484C10338E570030E55E /* Workers */ = { + isa = PBXGroup; + children = ( + 41F4484D10338E8C0030E55E /* WebWorkersPrivate.h */, + 41F4484E10338E8C0030E55E /* WebWorkersPrivate.mm */, + ); + name = Workers; + sourceTree = "<group>"; + }; 511F3FC30CECC7E200852565 /* Storage */ = { isa = PBXGroup; children = ( @@ -948,8 +993,12 @@ 51E94C0706C02CA300A9B09E /* PDF */ = { isa = PBXGroup; children = ( + 37D1DCA61065928C0068F7EF /* WebJSPDFDoc.h */, + 37D1DCA71065928C0068F7EF /* WebJSPDFDoc.mm */, + 37B6FB4C1063530C000FDB3B /* WebPDFDocumentExtras.h */, + 37B6FB4D1063530C000FDB3B /* WebPDFDocumentExtras.mm */, 51E94C6806C0347500A9B09E /* WebPDFRepresentation.h */, - 51E94C6906C0347500A9B09E /* WebPDFRepresentation.m */, + 51E94C6906C0347500A9B09E /* WebPDFRepresentation.mm */, 51E94C3406C0321200A9B09E /* WebPDFView.h */, 51E94C3506C0321200A9B09E /* WebPDFView.mm */, ); @@ -1057,6 +1106,9 @@ 51A8B52F04282B5900CA2D3A /* WebFrameView.mm */, 51A8B53204282BD200CA2D3A /* WebFrameViewInternal.h */, 93C6F14507920B93002449CD /* WebFrameViewPrivate.h */, + 5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */, + 5185F62710712B97007AA393 /* WebNavigationData.mm */, + 5185F62510712B80007AA393 /* WebNavigationData.h */, 51443F9A0429392B00CA2D3A /* WebPolicyDelegate.h */, 51443F9B0429392B00CA2D3A /* WebPolicyDelegate.mm */, 51443F9C0429392B00CA2D3A /* WebPolicyDelegatePrivate.h */, @@ -1082,12 +1134,18 @@ F834AAD60E64B1C700E2737C /* WebTextIterator.mm */, 515E27CC0458C86500CA2D3A /* WebUIDelegate.h */, 65A7D44A0568AB2600E70EF6 /* WebUIDelegatePrivate.h */, + 0FD3B0EE1076C3E900039B96 /* WebVideoFullscreenController.h */, + 0FD3B0EF1076C3E900039B96 /* WebVideoFullscreenController.mm */, + 0FD3B0F01076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h */, + 0FD3B0F11076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm */, 51A8B579042834F700CA2D3A /* WebView.h */, 51A8B57A042834F700CA2D3A /* WebView.mm */, BC2E464B0FD8A96800A9D9DE /* WebViewData.h */, BC2E464C0FD8A96800A9D9DE /* WebViewData.mm */, 930D02BB06275F640076701E /* WebViewInternal.h */, 51A8B57D0428353A00CA2D3A /* WebViewPrivate.h */, + 0FD3B0F61076C3F700039B96 /* WebWindowAnimation.h */, + 0FD3B0F71076C3F700039B96 /* WebWindowAnimation.m */, ); name = WebView; path = mac/WebView; @@ -1127,6 +1185,8 @@ F5B36B400281DE87018635CB /* WebCoreSupport */ = { isa = PBXGroup; children = ( + 59C77F4A105471E700506104 /* WebGeolocationMockPrivate.h */, + 59C77F3310545F7E00506104 /* WebGeolocationMock.mm */, B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */, B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */, 51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */, @@ -1155,6 +1215,8 @@ 84723BE4056D719E0044BFEA /* WebKeyGenerator.m */, A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */, A7D3C5BB0B5773C5002CA450 /* WebPasteboardHelper.mm */, + 0A2D87FB107AF52B00CDDEE3 /* WebPluginHalterClient.h */, + 0A2D87FC107AF52B00CDDEE3 /* WebPluginHalterClient.mm */, 93EB178E09F88D510091F8FF /* WebSystemInterface.h */, 93EB178C09F88D460091F8FF /* WebSystemInterface.m */, F5F7174C02885C5B018635CA /* WebViewFactory.h */, @@ -1343,6 +1405,7 @@ 1A2D75500DE4810E00F0A648 /* WebIconFetcherInternal.h in Headers */, 5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */, 06693DDC0BFBA85200216072 /* WebInspectorClient.h in Headers */, + 7A8FF0D11075024A00A80A08 /* WebInspectorPrivate.h in Headers */, 939810A00824BF01008DF038 /* WebJavaPlugIn.h in Headers */, 939810420824BF01008DF038 /* WebJavaScriptTextInputPanel.h in Headers */, 939810850824BF01008DF038 /* WebKeyGenerator.h in Headers */, @@ -1437,6 +1500,16 @@ 939810460824BF01008DF038 /* WebViewFactory.h in Headers */, 9398109B0824BF01008DF038 /* WebViewInternal.h in Headers */, 939810710824BF01008DF038 /* WebViewPrivate.h in Headers */, + 41F4484F10338E8C0030E55E /* WebWorkersPrivate.h in Headers */, + 59C77F4B105471E700506104 /* WebGeolocationMockPrivate.h in Headers */, + 37B6FB4E1063530C000FDB3B /* WebPDFDocumentExtras.h in Headers */, + 37D1DCA81065928C0068F7EF /* WebJSPDFDoc.h in Headers */, + 5158F6EF106D862A00AF457C /* WebHistoryDelegate.h in Headers */, + 5185F62610712B80007AA393 /* WebNavigationData.h in Headers */, + 0FD3B0F21076C3E900039B96 /* WebVideoFullscreenController.h in Headers */, + 0FD3B0F41076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h in Headers */, + 0FD3B0F81076C3F700039B96 /* WebWindowAnimation.h in Headers */, + 0A2D87FD107AF52B00CDDEE3 /* WebPluginHalterClient.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1508,8 +1581,6 @@ 939810B70824BF01008DF038 /* url_icon.tiff in Resources */, 939810B50824BF01008DF038 /* WebAuthenticationPanel.nib in Resources */, 5DE83A7A0D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib in Resources */, - 5DE83A7B0D0F7F9400CAD12A /* WebViewEditingContextMenu.nib in Resources */, - 5DE83A7C0D0F7F9400CAD12A /* WebViewEditingContextMenuOld.nib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1745,7 +1816,7 @@ 939810D90824BF01008DF038 /* WebNullPluginView.mm in Sources */, 939810D00824BF01008DF038 /* WebPanelAuthenticationHandler.m in Sources */, A7D3C5BD0B5773C5002CA450 /* WebPasteboardHelper.mm in Sources */, - 9398111F0824BF01008DF038 /* WebPDFRepresentation.m in Sources */, + 9398111F0824BF01008DF038 /* WebPDFRepresentation.mm in Sources */, 9398111E0824BF01008DF038 /* WebPDFView.mm in Sources */, 939811260824BF01008DF038 /* WebPluginContainerCheck.mm in Sources */, 939810DA0824BF01008DF038 /* WebPluginController.mm in Sources */, @@ -1769,6 +1840,15 @@ 939811070824BF01008DF038 /* WebView.mm in Sources */, BC2E464E0FD8A96800A9D9DE /* WebViewData.mm in Sources */, 939810E80824BF01008DF038 /* WebViewFactory.mm in Sources */, + 41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */, + 59C77F3510545F7E00506104 /* WebGeolocationMock.mm in Sources */, + 37B6FB4F1063530C000FDB3B /* WebPDFDocumentExtras.mm in Sources */, + 37D1DCA91065928C0068F7EF /* WebJSPDFDoc.mm in Sources */, + 5185F62810712B97007AA393 /* WebNavigationData.mm in Sources */, + 0FD3B0F31076C3E900039B96 /* WebVideoFullscreenController.mm in Sources */, + 0FD3B0F51076C3E900039B96 /* WebVideoFullscreenHUDWindowController.mm in Sources */, + 0FD3B0F91076C3F700039B96 /* WebWindowAnimation.m in Sources */, + 0A2D87FE107AF52B00CDDEE3 /* WebPluginHalterClient.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1784,24 +1864,6 @@ path = mac/Resources; sourceTree = SOURCE_ROOT; }; - 5DE83A760D0F7F9400CAD12A /* WebViewEditingContextMenu.nib */ = { - isa = PBXVariantGroup; - children = ( - 5DE83A770D0F7F9400CAD12A /* English */, - ); - name = WebViewEditingContextMenu.nib; - path = mac/Resources; - sourceTree = SOURCE_ROOT; - }; - 5DE83A780D0F7F9400CAD12A /* WebViewEditingContextMenuOld.nib */ = { - isa = PBXVariantGroup; - children = ( - 5DE83A790D0F7F9400CAD12A /* English */, - ); - name = WebViewEditingContextMenuOld.nib; - path = mac/Resources; - sourceTree = SOURCE_ROOT; - }; 5DE83A7D0D0F7FAD00CAD12A /* Localizable.strings */ = { isa = PBXVariantGroup; children = ( diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS new file mode 100644 index 0000000..514a640 --- /dev/null +++ b/WebKit/chromium/DEPS @@ -0,0 +1,179 @@ +# +# Copyright (C) 2009 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. +# * Neither the name of Google Inc. nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. +# + +# This file is used by gclient to fetch the projects that the webkit +# chromium port depends on. + +vars = { + 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', + 'chromium_deps_svn': 'http://src.chromium.org/svn/trunk/deps/third_party', + + # Dependencies' revisions to use: + 'chromium_rev': '27692', + 'google-url_rev': '119', + 'gyp_rev': '671', + 'icu_rev': '27687', + 'openvcdiff_rev': '26', + 'skia_rev': '341', + 'v8_rev': '2966', + + # Windows: + 'cygwin_rev': '11984', + 'ffmpeg_ia32_rev': '26428', + 'pthreads-win32_rev': '26716', + 'python_24_rev': '22967', +} + +deps = { + # build tools + 'build': + Var('chromium_svn')+'/build@'+Var('chromium_rev'), + 'webkit/build': + Var('chromium_svn')+'/webkit/build@'+Var('chromium_rev'), + 'tools/gyp': + 'http://gyp.googlecode.com/svn/trunk@'+Var('gyp_rev'), + + # Basic tools + 'base': + Var('chromium_svn')+'/base@'+Var('chromium_rev'), + + # skia dependencies + 'skia': + Var('chromium_svn')+'/skia@'+Var('chromium_rev'), + 'third_party/skia': + 'http://skia.googlecode.com/svn/trunk@'+Var('skia_rev'), + + # testing + 'testing': + Var('chromium_svn')+'/testing@'+Var('chromium_rev'), + + # v8 javascript engine + 'v8': + 'http://v8.googlecode.com/svn/trunk@'+Var('v8_rev'), + + # net dependencies + 'net': + Var('chromium_svn')+'/net@'+Var('chromium_rev'), + 'sdch': + Var('chromium_svn')+'/sdch@'+Var('chromium_rev'), + 'sdch/open-vcdiff': + 'http://open-vcdiff.googlecode.com/svn/trunk@'+Var('openvcdiff_rev'), + 'googleurl': + 'http://google-url.googlecode.com/svn/trunk@'+Var('google-url_rev'), + + # other third party + 'third_party/icu': + Var('chromium_deps_svn')+'/icu42@'+Var('icu_rev'), + + 'third_party/bzip2': + Var('chromium_svn')+'/third_party/bzip2@'+Var('chromium_rev'), + + 'third_party/libevent': + Var('chromium_svn')+'/third_party/libevent@'+Var('chromium_rev'), + + 'third_party/libjpeg': + Var('chromium_svn')+'/third_party/libjpeg@'+Var('chromium_rev'), + + 'third_party/libpng': + Var('chromium_svn')+'/third_party/libpng@'+Var('chromium_rev'), + + 'third_party/libxml': + Var('chromium_svn')+'/third_party/libxml@'+Var('chromium_rev'), + + 'third_party/libxslt': + Var('chromium_svn')+'/third_party/libxslt@'+Var('chromium_rev'), + + 'third_party/modp_b64': + Var('chromium_svn')+'/third_party/modp_b64@'+Var('chromium_rev'), + + 'third_party/npapi': + Var('chromium_svn')+'/third_party/npapi@'+Var('chromium_rev'), + + 'third_party/sqlite': + Var('chromium_svn')+'/third_party/sqlite@'+Var('chromium_rev'), + + 'third_party/zlib': + Var('chromium_svn')+'/third_party/zlib@'+Var('chromium_rev'), +} + +deps_os = { + 'win': { + 'third_party/cygwin': + Var('chromium_deps_svn')+'/cygwin@'+Var('cygwin_rev'), + + 'third_party/python_24': + Var('chromium_deps_svn')+'/python_24@'+Var('python_24_rev'), + + 'third_party/ffmpeg/binaries/chromium/win/ia32': + Var('chromium_deps_svn')+'/ffmpeg/binaries/win@'+Var('ffmpeg_ia32_rev'), + + 'third_party/pthreads-win32': + Var('chromium_deps_svn')+'/pthreads-win32@'+Var('pthreads-win32_rev'), + }, +} + +skip_child_includes = [ + # Don't look for dependencies in the following folders: + 'base', + 'build', + 'googleurl', + 'net', + 'sdch', + 'skia', + 'testing', + 'third_party', + 'tools', + 'v8', + 'webkit', +] + +include_rules = [ + # Everybody can use some things. + '+base', + '+build', + '+ipc', + + # For now, we allow ICU to be included by specifying 'unicode/...', although + # this should probably change. + '+unicode', + '+testing', + + # Allow anybody to include files from the 'public' Skia directory in the + # webkit port. This is shared between the webkit port and Chromium. + '+webkit/port/platform/graphics/skia/public', +] + + +hooks = [ + { + # A change to any file in this directory should run the gyp generator. + 'pattern': '.', + 'action': ['python', 'gyp_webkit'], + }, +] diff --git a/WebKit/chromium/features.gypi b/WebKit/chromium/features.gypi new file mode 100644 index 0000000..f91598c --- /dev/null +++ b/WebKit/chromium/features.gypi @@ -0,0 +1,70 @@ +# +# Copyright (C) 2009 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. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. +# + +{ + # The following defines turn webkit features on and off. + 'variables': { + 'variables': { + # We have to nest variables inside variables as a hack for variables + # override. + + # WARNING: build/features_override.gypi which is included in a full + # chromium build, overrides this list with its own values. See + # features_override.gypi inline documentation for more details. + 'feature_defines%': [ + 'ENABLE_3D_CANVAS=0', + 'ENABLE_CHANNEL_MESSAGING=1', + 'ENABLE_DATABASE=1', + 'ENABLE_DATAGRID=0', + 'ENABLE_OFFLINE_WEB_APPLICATIONS=1', + 'ENABLE_DASHBOARD_SUPPORT=0', + 'ENABLE_DOM_STORAGE=1', + 'ENABLE_JAVASCRIPT_DEBUGGER=0', + 'ENABLE_JSC_MULTIPLE_THREADS=0', + 'ENABLE_ICONDATABASE=0', + 'ENABLE_NOTIFICATIONS=0', + 'ENABLE_ORIENTATION_EVENTS=0', + 'ENABLE_XSLT=1', + 'ENABLE_XPATH=1', + 'ENABLE_SHARED_WORKERS=0', + 'ENABLE_SVG=1', + 'ENABLE_SVG_ANIMATION=1', + 'ENABLE_SVG_AS_IMAGE=1', + 'ENABLE_SVG_USE=1', + 'ENABLE_SVG_FOREIGN_OBJECT=1', + 'ENABLE_SVG_FONTS=1', + 'ENABLE_VIDEO=1', + 'ENABLE_WEB_SOCKETS=1', + 'ENABLE_WORKERS=1', + ], + }, + 'feature_defines%': '<(feature_defines)', + }, +} diff --git a/WebKit/chromium/gyp_webkit b/WebKit/chromium/gyp_webkit new file mode 100644 index 0000000..810af54 --- /dev/null +++ b/WebKit/chromium/gyp_webkit @@ -0,0 +1,96 @@ +# +# Copyright (C) 2009 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. +# * Neither the name of Google Inc. nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. +# + +# This file is used by gclient execute gyp with the proper command +# line arguments. + +import glob +import os +import shlex +import sys + +script_dir = os.path.dirname(__file__) + +sys.path.append(os.path.join(script_dir, 'tools', 'gyp', 'pylib')) +import gyp + +def additional_include_files(args=[]): + """ + Returns a list of additional (.gypi) files to include, without + duplicating ones that are already specified on the command line. + """ + # Determine the include files specified on the command line. + # This doesn't cover all the different option formats you can use, + # but it's mainly intended to avoid duplicating flags on the automatic + # makefile regeneration which only uses this format. + specified_includes = set() + for arg in args: + if arg.startswith('-I') and len(arg) > 2: + specified_includes.add(os.path.realpath(arg[2:])) + + result = [] + def AddInclude(path): + if os.path.realpath(path) not in specified_includes: + result.append(path) + + # Always include common.gypi + AddInclude(os.path.join(script_dir, 'build', 'common.gypi')) + + # Optionally add supplemental .gypi files if present. + supplements = glob.glob(os.path.join(script_dir, '*', 'supplement.gypi')) + for supplement in supplements: + AddInclude(supplement) + + return result + +if __name__ == '__main__': + + args = sys.argv[1:] + + # Add includes. + args.extend(['-I' + i for i in additional_include_files(args)]) + + # Other command args: + args.extend([ + # gyp variable defines. + '-Dinside_chromium_build=0', + '-Dv8_use_snapshot=false', + '-Dmsvs_use_common_release=0', + + # gyp hack: otherwise gyp assumes its in chromium's src/ dir. + '--depth=./', + + # gyp file to execute. + 'webkit.gyp']) + + print 'Updating webkit projects from gyp files...' + sys.stdout.flush() + + # Off we go... + sys.exit(gyp.main(args)) diff --git a/WebKit/chromium/webkit.gyp b/WebKit/chromium/webkit.gyp new file mode 100644 index 0000000..04d1bad --- /dev/null +++ b/WebKit/chromium/webkit.gyp @@ -0,0 +1,42 @@ +# +# Copyright (C) 2009 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. +# * Neither the name of Google Inc. nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. +# + +{ + 'targets': [ + { + # This target only builds webcore right now, but it will also build + # the chromium webkit api once the api is upstreamed. + 'target_name': 'webkit', + 'type': 'none', + 'dependencies': [ + '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', + ], + }, + ], # targets +} diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index 4d49861..370fb2b 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,1250 @@ +2009-10-07 Xan Lopez <xlopez@igalia.com> + + Fix the GTK+ build. + + * webkit/webkitwebpolicydecision.cpp: + (webkit_web_policy_decision_use): + (webkit_web_policy_decision_ignore): + (webkit_web_policy_decision_download): + +2009-10-07 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Factor PolicyChecker out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=30155 + + Move the policy callback to the policy object. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchWillSubmitForm): + (WebKit::FrameLoaderClient::dispatchDecidePolicyForMIMEType): + (WebKit::FrameLoaderClient::dispatchDecidePolicyForNewWindowAction): + (WebKit::FrameLoaderClient::dispatchDecidePolicyForNavigationAction): + +2009-10-07 Martin Robinson <martin.james.robinson@gmail.com> + + [GTK] Segfault while testing fast/events/keydown-keypress-preventDefault.html + https://bugs.webkit.org/show_bug.cgi?id=30121 + + Clear previous preedit or pending composition before storing new ones. + This can happen when a WebView receives a native keydown event without + a matching keyup event or when preventDefault() is called on DOM keydown + events. + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::setPendingComposition): + (WebKit::setPendingPreedit): + (WebKit::clearPendingIMData): + (WebKit::imContextCommitted): + (WebKit::imContextPreeditChanged): + +2009-10-06 Xan Lopez <xlopez@igalia.com> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=25526 + [Gtk] Additional support is needed for caret browsing + + Remove special cases for caret browsing, they are now handled in + cross-platform code. + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::EditorClient::handleKeyboardEvent): + +2009-10-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: close inspector client view on + InspectorController::close API call. + + In order to run batch web inspector layout tests (and not affect + subsequent tests) we should close inspector client's view upon + InspectorController::close API call. + + https://bugs.webkit.org/show_bug.cgi?id=30009 + + * WebCoreSupport/InspectorClientGtk.cpp: + (WebKit::InspectorClient::createPage): + +2009-10-06 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Xan Lopez. + + ASSERT executing the webhistory unittest in a debug build + https://bugs.webkit.org/show_bug.cgi?id=28947 + + We have to call g_object_new first to initialize webkit threading + before creating the KURL. + + * WebKit/gtk/webkit/webkitwebhistoryitem.cpp: + +2009-10-06 José Millán Soto <fid@gpul.org> + + Reviewed by Xan Lopez. + + Header files of WebKitGTK do not comply with WebKit coding style (Patch attached) + https://bugs.webkit.org/show_bug.cgi?id=30076 + + Solves various issues in header files. + + * WebCoreSupport/DocumentLoaderGtk.h: Added "headed guards" + * webkit/webkitdefines.h: + * webkit/webkitdownload.h: + * webkit/webkiterror.h: + * webkit/webkithittestresult.h: + * webkit/webkitnetworkrequest.h: + * webkit/webkitnetworkresponse.h: + * webkit/webkitprivate.h: + * webkit/webkitsecurityorigin.h: + * webkit/webkitsoupauthdialog.h: + * webkit/webkitversion.h.in: + * webkit/webkitwebbackforwardlist.h: + * webkit/webkitwebdatabase.h: + * webkit/webkitwebdatasource.h: + * webkit/webkitwebframe.h: + * webkit/webkitwebhistoryitem.h: + * webkit/webkitwebinspector.h: + * webkit/webkitwebnavigationaction.h: + * webkit/webkitwebpolicydecision.h: + * webkit/webkitwebresource.h: + * webkit/webkitwebsettings.h: + * webkit/webkitwebview.h: + * webkit/webkitwebwindowfeatures.h: + +2009-10-03 Adam Barth <abarth@webkit.org> + + More build fixing. + + * webkit/webkitwebview.cpp: + (webkit_web_view_go_back_or_forward): + (webkit_web_view_can_go_back_or_forward): + +2009-10-03 Adam Barth <abarth@webkit.org> + + Unreviewed build fix. + + * webkit/webkitwebview.cpp: + (webkit_web_view_go_back_or_forward): + +2009-10-03 Adam Barth <abarth@webkit.org> + + Reviewed by Sam Weinig. + + Factor PageController out of FrameLoader and Page + https://bugs.webkit.org/show_bug.cgi?id=30037 + + * webkit/webkitwebview.cpp: + (webkit_web_view_can_go_back_or_forward): + +2009-10-01 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Set the type for the fake event, otherwise the test ASSERTs in + debug builds. + + * tests/testhittestresult.c: + (load_status_cb): + +2009-10-01 Martin Robinson <martin.james.robinson@gmail.com> + + Reviewed by Xan Lopez. + + [GTK] GtkIMContext filtering interferes with DOM key events + https://bugs.webkit.org/show_bug.cgi?id=28733 + + Ensure that keyboard events filtered by the GtkIMContext still create + the proper DOM events. + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::clearPendingIMData): + (WebKit::imContextCommitted): + (WebKit::imContextPreeditChanged): + (WebKit::EditorClient::shouldBeginEditing): + (WebKit::EditorClient::shouldEndEditing): + (WebKit::interpretEditorCommandKeyEvent): + (WebKit::handleCaretBrowsingKeyboardEvent): + (WebKit::EditorClient::handleKeyboardEvent): + (WebKit::EditorClient::handleInputMethodKeydown): + * tests/testkeyevents.c: Added. + (test_info_new): + (test_info_destroy): + (key_event_fixture_setup): + (key_event_fixture_teardown): + (key_press_event_cb): + (key_release_event_cb): + (load_status_cb): + (map_event_cb): + (test_keypress): + (main): + +2009-09-29 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Do not set a non-default parent window for child widgets. We are + just doing the same than the default path does, and on top of that + if the widget's window changes (for example, during DnD widgets + are usually unrealized/realized) the child widget will we left + pointing to a dead window. + + For examples of crashers caused by this see + https://bugzilla.gnome.org/show_bug.cgi?id=596397 and + https://bugzilla.gnome.org/show_bug.cgi?id=596398 + + * webkit/webkitwebview.cpp: + (webkit_web_view_container_add): + +2009-09-29 Xan Lopez <xlopez@igalia.com> + + Rubber-stamped by Eric Seidel. + + [Gtk] Crash when saving a password + https://bugs.webkit.org/show_bug.cgi?id=28070 + + Disconnect the 'got-headers' callback when we are done with + it. The signal can be emitted more than once if the message is + retransmitted, but each time that happens authData is created + again and a new callback connected, so we have to get rid of the + old one (which will crash because we free authData). + + * webkit/webkitsoupauthdialog.c: + (save_password_callback): + +2009-09-25 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + Pop down the context menu when the page transitions to committed, + to avoid keeping a context menu out of context. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::transitionToCommittedForNewPage): + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (destroy_menu_cb): + (webkit_web_view_forward_context_menu_event): + +2009-09-24 Jon Honeycutt <jhoneycutt@apple.com> + + Reviewed by Alice Liu. + + * webkit/webkitwebview.cpp: + (webkit_web_view_init): + Pass 0 for new Page constructor argument. + +2009-09-24 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha and Jan Alonzo. + [GTK] Add WEBKIT_LOAD_ERROR status + https://bugs.webkit.org/show_bug.cgi?id=29644 + + Add a new load-status enum value, WEBKIT_LOAD_FAILED, emitted when + there's an error during the load process. This is needed if we + want notify::load-status to be able to handle all situations, + since WEBKIT_LOAD_FINISHED is not emitted when there's an error + and we are lacking a notification of the load being stopped. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDidFailLoad): + * tests/testloading.c: + (web_loading_fixture_setup): + (load_error_status_changed_cb): + (load_error_cb): + (test_loading_error): + (load_cancelled_cb): + (stop_load): + (load_cancelled_status_changed_cb): + (test_loading_cancelled): + (main): + * webkit/webkitwebframe.h: + +2009-09-24 Xan Lopez <xlopez@igalia.com> + + Revert r48697, since it broke key handling notification to GTK+. + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::imContextCommitted): + (WebKit::imContextPreeditChanged): + (WebKit::EditorClient::shouldBeginEditing): + (WebKit::EditorClient::shouldEndEditing): + (WebKit::interpretKeyEvent): + (WebKit::handleEditingKeyboardEvent): + (WebKit::EditorClient::handleKeyboardEvent): + (WebKit::EditorClient::handleInputMethodKeydown): + +2009-09-23 Martin Robinson <martin.james.robinson@gmail.com> + + Reviewed by Xan Lopez. + + [GTK] REGRESSION: BitmapImage::getGdkPixbuf fails for non-square images + https://bugs.webkit.org/show_bug.cgi?id=29654 + + Ensure that even when GTKSimpleIMContext filters non-IME keystrokes, + keyboard events are fired properly. + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::clearPendingIMData): + (WebKit::imContextCommitted): + (WebKit::imContextPreeditChanged): + (WebKit::EditorClient::shouldBeginEditing): + (WebKit::EditorClient::shouldEndEditing): + (WebKit::interpretEditorCommandKeyEvent): + (WebKit::handleCaretBrowsingKeyboardEvent): + (WebKit::EditorClient::handleKeyboardEvent): + (WebKit::EditorClient::handleInputMethodKeydown): + +2009-09-23 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] need to dump number of pending unload handlers + https://bugs.webkit.org/show_bug.cgi?id=29685 + + * webkit/webkitprivate.h: + * webkit/webkitwebframe.cpp: + (webkit_web_frame_get_pending_unload_event_count): New function to + satisfy DRT needs. + +2009-09-23 Jan Michael Alonzo <jmalonzo@webkit.org> + + Reviewed by Xan Lopez. + + Minor reorganization to the patch landed in + http://trac.webkit.org/changeset/48670. Also move JSCore-1.0.gir + in the gtk directory as that's only useful to the Gtk port at the + moment. + + * JSCore-1.0.gir: Renamed from JSCore-1.0.gir. + +2009-09-22 Xan Lopez <xlopez@igalia.com> + + Reviewed by Jan Alonzo. + + Hardcode element positions at 0,0 so that we know where to + generate events to test WebKitHitTestResult. + + * tests/testhittestresult.c: + (load_status_cb): + (test_webkit_hit_test_result): + (main): + +2009-09-22 Xan Lopez <xlopez@igalia.com> + + Reviewed by Jan Alonzo. + + [GTK] WebKitHitTestResult is completely broken in gmail + https://bugs.webkit.org/show_bug.cgi?id=29527 + + We need to use the main or focused frame when doing the coordinate + transformation instead of always using the main frame. + + * webkit/webkitwebview.cpp: + (webkit_web_view_get_hit_test_result): + +2009-09-21 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Update documentation control files to 1.1.15. + + * docs/webkitgtk-docs.sgml: + * docs/webkitgtk-sections.txt: + +2009-09-21 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Unreviewed docs build fix. Current CFLAGS and LIBS variables no + longer bring gthread in. + + * docs/GNUmakefile.am: + +2009-09-21 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Update for release. + + * NEWS: + +2009-09-20 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Small documentation fix. + + * webkit/webkithittestresult.cpp: + +2009-09-18 Xan Lopez <xlopez@igalia.com> + + Build fix. + + Add missing file to the repository. + + * tests/testhittestresult.c: Added. + (test_info_new): + (test_info_destroy): + (hit_test_result_fixture_setup): + (hit_test_result_fixture_teardown): + (load_status_cb): + (test_webkit_hit_test_result): + (main): + +2009-09-18 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Gtk] Unreviewed build fix. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::platformPageClient): + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Reflect the rename of platformWindow and it's return type. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::platformPageClient): + (WebKit::ChromeClient::runOpenPanel): + * WebCoreSupport/ChromeClientGtk.h: + * webkit/webkitprivate.cpp: + (currentToplevelCallback): + * webkit/webkitwebview.cpp: + (webkit_web_view_popup_menu_handler): + +2009-09-18 Xan Lopez <xlopez@igalia.com> + + Reviewed by Jan Alonzo. + + Document webkit_web_view_stop_loading. + + * webkit/webkitwebview.cpp: + +2009-09-18 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha and Jan Alonzo. + + [GTK] context menu overriding API is very limited + https://bugs.webkit.org/show_bug.cgi?id=27546 + + Add webkit_web_view_get_hit_test_result, a function to get a hit + test result from a GdkEventButton. Useful to let applications + decide between several actions on button press depending on what + is being pressed. + + * webkit/webkitwebview.cpp: + (webkit_web_view_stop_loading): + (documentPointForWindowPoint): + (webkit_web_view_get_hit_test_result): + * webkit/webkitwebview.h: + +2009-09-18 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha and Jan Alonzo. + + [GTK] context menu overriding API is very limited + https://bugs.webkit.org/show_bug.cgi?id=27546 + + Add WebKitHitTestResult, a wrapper over HitTestResult. It contains + context information about a point in the web page. + + * webkit/webkit.h: + * webkit/webkitdefines.h: + * webkit/webkithittestresult.cpp: Added. + (webkit_hit_test_result_finalize): + (webkit_hit_test_result_get_property): + (webkit_hit_test_result_set_property): + (webkit_hit_test_result_class_init): + (webkit_hit_test_result_init): + * webkit/webkithittestresult.h: Added. + * webkit/webkitprivate.cpp: + (WebKit::kit): + * webkit/webkitprivate.h: + +2009-09-14 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez and Jan Alonzo. + + https://bugs.webkit.org/show_bug.cgi?id=29134 + [GTK] Add API to access sub resources + + Implement getting subresources, and improve testing of + main, and sub resources loading. + +2009-09-11 Xan Lopez <xlopez@igalia.com> + + Reviewed by Jan Alonzo. + + [GTK] Use gtk_style_set_background instead of gdk_window_set_background + https://bugs.webkit.org/show_bug.cgi?id=29173 + + Use gtk_style_set_background instead of gdk_window_set_background, + as suggested by the documentation. Also, use GTK_STATE_NORMAL + directly, since that's the default state of a GtkWidget. + + * webkit/webkitwebview.cpp: + (webkit_web_view_realize): + +2009-09-09 Zan Dobersek <zandobersek@gmail.com> + + Reviewed by Gustavo Noronha. + + [GTK] DumpRenderTree needs eventSender object and implementation + https://bugs.webkit.org/show_bug.cgi?id=25990 + + Creates a function that is accessible from the DumpRenderTree tool + and calls the layout method on the frame view. + + * webkit/webkitprivate.h: + * webkit/webkitwebframe.cpp: + (webkit_web_frame_layout): + +2009-09-08 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=29044 + [GTK] Should update suggested-filename when the response is received + + Set suggested filename also when the response only comes after the + download has started. + + * webkit/webkitdownload.cpp: + (webkit_download_set_response): + (webkit_download_set_suggested_filename): + * webkit/webkitwebview.cpp: + (webkit_web_view_request_download): + +2009-09-08 Priit Laes <plaes@plaes.org> + + Reviewed by Gustavo Noronha. + + Fix up erroneus 'Since: @version@' tags in documentation. + + * webkit/webkitwebdatasource.cpp: + * webkit/webkitwebresource.cpp: + (webkit_web_resource_class_init): + * webkit/webkitwebsettings.cpp: + (webkit_web_settings_class_init): + * webkit/webkitwebview.cpp: + (webkit_web_view_class_init): + * webkit/webkitwebwindowfeatures.cpp: + +2009-09-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Link new objects documents in the main document. + + * docs/webkitgtk-docs.sgml: + +2009-09-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Documentation control files updated for 1.1.14. + + * docs/webkitgtk-docs.sgml: + * docs/webkitgtk-sections.txt: + +2009-09-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + What's new for 1.1.14. + + * NEWS: + +2009-09-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Rubber-stamped by Xan Lopez. + + Use g_return_if_fail to check for the SoupURI creation, instead of + printing a custom warning. + + * webkit/webkitnetworkrequest.cpp: + (webkit_network_request_set_uri): + +2009-09-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=26854 + [GTK] Needs API to allow more control over outgoing requests + + Map the willSendRequest delegate to the 'resource-request-starting' + signal, allowing more control of the resources that are fetched. + + Mapping willSendRequest properly requires an appropriate Response + object, so we are introducing WebKitNetworkResponse, which works in a + way similar to WebKitNetworkRequest. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchWillSendRequest): + (WebKit::FrameLoaderClient::assignIdentifierToInitialRequest): + (WebKit::FrameLoaderClient::dispatchDidFinishLoading): + (WebKit::FrameLoaderClient::dispatchDidFailLoading): + * tests/testnetworkresponse.c: Added. + (test_network_response_create_destroy): + (test_network_response_properties): + (main): + * tests/testwebresource.c: + (resource_request_starting_cb): + (load_finished_cb): + (test_web_resource_loading): + (main): + * webkit/webkit.h: + * webkit/webkitdefines.h: + * webkit/webkitnetworkrequest.cpp: + * webkit/webkitnetworkresponse.cpp: Added. + (webkit_network_response_dispose): + (webkit_network_response_finalize): + (webkit_network_response_get_property): + (webkit_network_response_set_property): + (webkit_network_response_class_init): + (webkit_network_response_init): + (webkit_network_response_new_with_core_response): + (webkit_network_response_new): + (webkit_network_response_set_uri): + (webkit_network_response_get_uri): + (webkit_network_response_get_message): + * webkit/webkitnetworkresponse.h: Added. + * webkit/webkitprivate.cpp: + (WTF::SoupMessage): + (WTF::WebKitNetworkRequest): + (WTF::WebKitNetworkResponse): + (WTF::WebKitWebResource): + * webkit/webkitprivate.h: + * webkit/webkitwebresource.cpp: + (webkit_web_resource_cleanup): + (webkit_web_resource_finalize): + (webkit_web_resource_class_init): + (webkit_web_resource_set_property): + (webkit_web_resource_get_uri): + * webkit/webkitwebview.cpp: + (webkit_web_view_class_init): + * webkitmarshal.list: + +2009-09-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Jan Alonzo. + + https://bugs.webkit.org/show_bug.cgi?id=28979 + [GTK] Misc improvments to NetworkRequest + + Unref message in dispose, as it should be, not in finalize. + + * webkit/webkitnetworkrequest.cpp: + (webkit_network_request_dispose): + (webkit_network_request_finalize): + (webkit_network_request_class_init): + +2009-09-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Jan Alonzo. + + https://bugs.webkit.org/show_bug.cgi?id=28979 + [GTK] Misc improvments to NetworkRequest + + Bring documentation up-to-date with reality regarding NetworkRequest. + + * webkit/webkitnetworkrequest.cpp: + +2009-09-07 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Make the auth dialog usable when libsoup does not have a + SoupPasswordManager, since it might go away in the next + development cycle. + + * webkit/webkitsoupauthdialog.c: + (response_callback): + (session_can_save_passwords): + (session_authenticate): +2009-09-06 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Update the unitests to latest changes wrt scrollbar policy. + + * tests/testwindow.c: + (test_webkit_window_scrollbar_policy): + +2009-09-06 Martin Robinson <martin.james.robinson@gmail.com> + + Reviewed by Gustavo Noronha, Jan Alonzo and Xan Lopez. + + [Gtk] Expose a database API + https://bugs.webkit.org/show_bug.cgi?id=27899 + + Expose an HTML5 database API for GTK+. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::print): + * webkit/webkit.h: + * webkit/webkitdefines.h: + * webkit/webkitprivate.cpp: + (webkit_init): + * webkit/webkitprivate.h: + * webkit/webkitsecurityorigin.cpp: Added. + (webkit_security_origin_finalize): + (webkit_security_origin_dispose): + (webkit_security_origin_set_property): + (webkit_security_origin_get_property): + (webkit_security_origins): + (webkit_security_origin_class_init): + (webkit_security_origin_init): + (webkit_security_origin_get_protocol): + (webkit_security_origin_get_host): + (webkit_security_origin_get_port): + (webkit_security_origin_get_web_database_usage): + (webkit_security_origin_get_web_database_quota): + (webkit_security_origin_set_web_database_quota): + (webkit_security_origin_get_all_web_databases): + (WebKit::kit): + (WebKit::core): + (webkit_security_origin_get_web_database): + * webkit/webkitsecurityorigin.h: Added. + * webkit/webkitwebdatabase.cpp: Added. + (webkit_web_database_finalize): + (webkit_web_database_dispose): + (webkit_web_database_set_property): + (webkit_web_database_get_property): + (webkit_web_database_class_init): + (webkit_web_database_init): + (webkit_web_database_set_security_origin): + (webkit_web_database_set_name): + (webkit_web_database_get_security_origin): + (webkit_web_database_get_name): + (webkit_web_database_get_display_name): + (webkit_web_database_get_expected_size): + (webkit_web_database_get_size): + (webkit_web_database_get_filename): + (webkit_web_database_remove): + (webkit_remove_all_web_databases): + (webkit_get_web_database_directory_path): + (webkit_set_web_database_directory_path): + (webkit_get_default_web_database_quota): + * webkit/webkitwebdatabase.h: Added. + * webkit/webkitwebframe.cpp: + (webkit_web_frame_new): + (webkit_web_frame_get_focused_accessible_element): + (webkit_web_frame_get_horizontal_scrollbar_policy): + * webkit/webkitwebframe.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_class_init): + +2009-09-03 Adam Barth <abarth@webkit.org> + + Reviewed by eric@webkit.org. + + https://bugs.webkit.org/show_bug.cgi?id=24696 + + Stub implementations of mixed content methods of FrameLoaderClient. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::didDisplayInsecureContent): + (WebKit::FrameLoaderClient::didRunInsecureContent): + * WebCoreSupport/FrameLoaderClientGtk.h: + +2009-09-03 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Access private member variables directly instead of using the + accessor. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::createFrame): + (WebKit::FrameLoaderClient::windowObjectCleared): + +2009-09-03 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + Remove bogus asserts that break Debug builds at runtime. + + * WebCoreSupport/DocumentLoaderGtk.cpp: + (WebKit::DocumentLoader::detachFromFrame): + (WebKit::DocumentLoader::decreaseLoadCount): + +2009-09-02 Jan Michael Alonzo <jmalonzo@webkit.org> + + Reviewed by Xan Lopez and Gustavo Noronha. + + [Gtk] Implement a WebDataSource for the gtk port + https://bugs.webkit.org/show_bug.cgi?id=24758 + + Add data source API getters to WebKitWebFrame. + Also add WebKitWebDataSource unit test. + + * tests/testwebdatasource.c: Added. + * webkit/webkitwebframe.cpp: + * webkit/webkitwebframe.h: + +2009-09-02 Jan Michael Alonzo <jmalonzo@webkit.org> + + Reviewed by Xan Lopez and Gustavo Noronha. + + [Gtk] Implement a WebDataSource for the gtk port + https://bugs.webkit.org/show_bug.cgi?id=24758 + + Subclass DocumentLoader for Gtk and implement it under the WebKit + namespace. Add WebKitWebDataSource implementation that closely + follows the mac implementation of the API. + + * WebCoreSupport/DocumentLoaderGtk.cpp: Added. + * WebCoreSupport/DocumentLoaderGtk.h: Added. + * webkit/webkitwebdatasource.cpp: Added. + * webkit/webkitwebdatasource.h: Added. + +2009-09-01 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + Avoid causing unexpected issues with window sizing when sites + disable scrollbars completely. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::scrollbarsModeDidChange): + * tests/testwindow.c: + (test_webkit_window_scrollbar_policy): + * webkit/webkitwebframe.cpp: + (webkit_web_frame_class_init): + +2009-09-01 Jan Michael Alonzo <jmalonzo@webkit.org> + + Reviewed by Xan Lopez and Gustavo Noronha. + + [Gtk] Implement a WebDataSource for the gtk port + https://bugs.webkit.org/show_bug.cgi?id=24758 + + Implement WebKitWebResource for the resource-related API for + WebKitWebDataSource. + + * GNUmakefile.am: + +2009-09-01 Xan Lopez <xlopez@igalia.com> + + Reviewed by Jan Alonzo. + + https://bugs.webkit.org/show_bug.cgi?id=28842 + [GTK] Do not emit extra FINISHED load-status signals + + Do not emit FINISHED load-status signals on our own, just rely on + WebCore for that. Avoids emitting FINISHED several times when we + fail to load a URI. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDidFailProvisionalLoad): + (WebKit::FrameLoaderClient::dispatchDidFailLoad): + * tests/testloading.c: + (web_loading_fixture_setup): + (web_loading_fixture_teardown): + (load_finished_cb): + (status_changed_cb): + (test_loading_status): + (load_error_status_changed_cb): + (load_error_cb): + (test_loading_error): + (main): + * webkit/webkitwebframe.h: + +2009-08-31 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=28466 + When downloading a file, two GET requests are sent to the HTTP server + + Support reusing a connection that is already ongoing, instead of + cancelling the connection and creating another. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::download): + * webkit/webkitdownload.cpp: + (webkit_download_new_with_handle): + (webkit_download_start): + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_request_download): + +2009-08-31 Alexey Proskuryakov <ap@apple.com> + + Gtk build fix. + + This is also a behavior fix, at least on debug builds - a caller of + webkit_web_history_item_new_with_data() could pass an URL that could cause an assertion + failure in KURL. + + * webkit/webkitwebhistoryitem.cpp: (webkit_web_history_item_new_with_data): Pass a null + KURL as base to parse properly. + +2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Holger Freyther. + + https://bugs.webkit.org/show_bug.cgi?id=25889 + [GTK] scrollbar policy for main frame is not implementable + + Add properties and a signal to report scrollbar policy changes to + client code, and a default handler that does the right thing when + using GtkScrolledWindow. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::scrollbarsModeDidChange): + * WebCoreSupport/ChromeClientGtk.h: + * webkit/webkitwebframe.cpp: + (webkit_web_frame_get_property): + (webkit_web_frame_class_init): + (webkit_web_frame_get_horizontal_scrollbar_policy): + (webkit_web_frame_get_vertical_scrollbar_policy): + * webkit/webkitwebframe.h: + * tests/testwindow.c: Added. + (load_finished_cb): + (test_webkit_window_scrollbar_policy): + (main): + +2009-08-28 Jan Michael Alonzo <jmalonzo@webkit.org> + + Reviewed by Gustavo Noronha and Xan Lopez. + + [Gtk] Add view source mode API + https://bugs.webkit.org/show_bug.cgi?id=28805 + + Implement setter and getter for "view source" mode. + + * webkit/webkitwebview.cpp: + (webkit_web_view_set_view_source_mode): + (webkit_web_frame_get_view_source_mode): + * webkit/webkitwebview.h: + +2009-08-26 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + https://bugs.webkit.org/show_bug.cgi?id=28738 + Expose undo/redo functionality in WebKitWebView + + Expose undo/redo functionality in WebKitWebView, keeping the + default bindings as they were. + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::): + * webkit/webkitwebview.cpp: + (webkit_web_view_real_undo): + (webkit_web_view_real_redo): + (webkit_web_view_class_init): + (webkit_web_view_can_undo): + (webkit_web_view_undo): + (webkit_web_view_can_redo): + (webkit_web_view_redo): + * webkit/webkitwebview.h: + +2009-08-24 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + News about the 1.1.13 release. + + * NEWS: + +2009-08-24 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + Add new symbols, and an index of new symbols for the 1.1.13 + release. + + * docs/webkitgtk-docs.sgml: + * docs/webkitgtk-sections.txt: + +2009-08-23 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Fix a couple of typos. + + * webkit/webkitwebsettings.cpp: + (webkit_web_settings_class_init): + +2009-08-23 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Update editing-behavior property here too. + + * webkit/webkitwebview.cpp: + (webkit_web_view_settings_notify): + +2009-08-23 Jan Michael Alonzo <jmalonzo@webkit.org> + + Rubberstamped by Gustavo Noronha. + + Fix regressions introduced by http://trac.webkit.org/changeset/47690. + + Update the setting whenever the property gets set. + + * webkit/webkitwebview.cpp: + (webkit_web_view_settings_notify): + +2009-08-23 Jan Michael Alonzo <jmalonzo@webkit.org> + + Reviewed by Xan Lopez. + + [Gtk] API for disabling local file access to web URLs + https://bugs.webkit.org/show_bug.cgi?id=28663 + + Add a setting to enable or disable file access to web URLs. It's + disabled by default for security reasons. + + * webkit/webkitwebsettings.cpp: + (webkit_web_settings_class_init): + (webkit_web_settings_set_property): + (webkit_web_settings_get_property): + (webkit_web_settings_copy): + * webkit/webkitwebview.cpp: + (webkit_web_view_update_settings): + +2009-08-22 Xan Lopez <xlopez@igalia.com> + + Reviewed by Jan Alonzo. + + https://bugs.webkit.org/show_bug.cgi?id=28154 + clicking below end of text in a textarea moves cursor to wrong position + + Expose the EditingBehavior setting and set it by default to Mac, + since that what matches the GTK+ default behavior. + + * webkit/webkitprivate.cpp: + (WebKit::core): + * webkit/webkitprivate.h: + * webkit/webkitwebsettings.cpp: + (webkit_web_settings_class_init): + (webkit_web_settings_set_property): + (webkit_web_settings_get_property): + (webkit_web_settings_copy): + * webkit/webkitwebsettings.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_update_settings): + +2009-08-20 Aaron Boodman <aa@chromium.org> + + Hopefully the last speculative build for gtk. + + * webkit/webkitprivate.cpp: + (webkit_white_list_access_from_origin): + * webkit/webkitprivate.h: + +2009-08-20 David Levin <levin@chromium.org> + + Another speculative build for gtk. + + * webkit/webkitprivate.cpp: + (webkit_white_list_access_to_origin): + +2009-08-20 David Levin <levin@chromium.org> + + Speculative build for gtk. + + * webkit/webkitprivate.cpp: + (webkit_white_list_access_to_origin): + +2009-08-19 Aaron Boodman <aa@chromium.org> + + Fix build break. + + * webkit/webkitprivate.h: "WEBKIT API" -> "WEBKIT_API" + +2009-08-19 Aaron Boodman <aa@chromium.org> + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=24853: Provide a way for WebKit clients to + specify a more granular policy for cross-origin XHR access. + + * webkit/webkitprivate.cpp: + (webkit_white_list_access_to_origin): Add API to manipulate origin access whitelists. + (webkit_reset_origin_access_white_lists): Ditto. + * webkit/webkitprivate.h: Ditto. + +2009-08-18 Xan Lopez <xlopez@igalia.com> + + Rubber-stamped by Holger Freyther. + + Remove an unneeded include. + + * WebCoreSupport/DragClientGtk.cpp: + +2009-08-18 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=28443 + Fix build break with gtk older than 2.14. + + WebKit gtk port requires gtk 2.10 or later, but DragClientGtk.cpp + uses gtk_widget_get_window that is introduced in 2.14. + + * WebCoreSupport/DragClientGtk.cpp: + define gtk_widget_get_window for gtk older than 2.14. + +2009-08-18 Jan Michael Alonzo <jmalonzo@webkit.org> + + Reviewed by Oliver Hunt. + + [Gtk] crash when closing page from javascript + https://bugs.webkit.org/show_bug.cgi?id=27439 + + Do not unref the WebView in ChromeClientGtk::closeWindowSoon + because (1) a create-web-view handler can return a NULL WebView, + (2) the created WebView is owned by its containing widget, and (3) + clients may not handle the close-web-view signal so this avoids + unreffing a WebView more than once. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::closeWindowSoon): + * webkit/webkitwebview.cpp: + (webkit_web_view_class_init): + +2009-08-18 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Jan Alonzo. + + https://bugs.webkit.org/show_bug.cgi?id=19360 + Frags on current page don't generate "navigation-requested" events + + Fix order of parameters for the creation of SubstituteData object, + so that normal data loads do not have an unreachable URL. Also + remove a confusion about the purpose of the last parameter. + + * webkit/webkitwebframe.cpp: + (webkit_web_frame_load_data): + +2009-08-18 Drew Wilson <atwilson@google.com> + + Reviewed by Eric Seidel. + + Need to extend DumpRenderTree to expose number of worker threads + https://bugs.webkit.org/show_bug.cgi?id=28292 + + * webkit/webkitprivate.h: + * webkit/webkitworkers.cpp: Added. + (webkit_worker_thread_count): + Exposed WebCore::WorkerThread::workerThreadCount() for the gtk version of DumpRenderTree. + +2009-08-18 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Fix the ATK unit test. + + We now support line boundaries in the get_text functions, so we + need to make sure the test has the layout we expect by giving it + enough space to fit in one line. + + * tests/testatk.c: + (test_webkit_atk_get_text_at_offset): + +2009-08-15 Zan Dobersek <zandobersek@gmail.com> + + Reviewed by Xan Lopez. + + Fix compiler warnings. + + * webkit/webkitwebview.cpp: + (clipboard_contents_received): + (webkit_web_view_drag_data_get): + +2009-08-14 Jiahua Huang <jhuangjiahua@gmail.com> + + Reviewed by Jan Alonzo. + + [gtk] Pasteboard/GtkClipboard can't handle the "text/html" target. + https://bugs.webkit.org/show_bug.cgi?id=27028 + + Add a function in WebKit::PasteboardHelperGtk that will return the + value of WEBKIT_WEB_VIEW_TARGET_INFO_HTML, + and WebCore::clipboard_get_contents_cb will use that. + + * WebCoreSupport/PasteboardHelperGtk.cpp: + (WebKit::PasteboardHelperGtk::getWebViewTargetInfoHtml): + * WebCoreSupport/PasteboardHelperGtk.h: + +2009-08-14 Benjamin Otte <otte@gnome.org> + + Reviewed by Gustavo Noronha. + + Fix webkit_web_view_set_highlight_text_matches() so that highlighting + works properly in documents with frames. + + * webkit/webkitwebview.cpp: + (webkit_web_view_set_highlight_text_matches): + +2009-08-13 Zan Dobersek <zandobersek@gmail.com> + + Reviewed by Gustavo Noronha. + + [GTK] Drag and drop support + https://bugs.webkit.org/show_bug.cgi?id=23642 + + Adds support for drag actions in WebKitWebView and DragClient. + + Defines a support structure that can hold additional drag and drop data, + such as selection data or target IDs (infos) and can be passed through + clipboard requests. + + Implements DragClient functions that gather start position of the drag + and start the GTK drag. + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::DragClient): + (WebKit::DragClient::willPerformDragSourceAction): + (WebKit::DragClient::startDrag): + (WebKit::DragClient::createDragImageForLink): A small style fix. + * WebCoreSupport/DragClientGtk.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_drag_end): + (clipboard_contents_received): GtkClipboard callback. + (webkit_web_view_drag_data_get): + (webkit_web_view_class_init): + (webkit_web_view_init): + * webkit/webkitwebview.h: Add GTK selection targets. + +2009-08-12 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Unreviewed build fix. + + Last-minute change on the new soup API to use the keyring was not + reflected in our usage - the documentation says we should use + g_slist_free, and soup_auth_free_saved_users doesn't exist. + + * webkit/webkitsoupauthdialog.c: + (session_authenticate): + +2009-08-12 Xan Lopez <xlopez@igalia.com> + + Reviewed by Jan Alonzo. + + [GTK] Remove keyring optional features + https://bugs.webkit.org/show_bug.cgi?id=28173 + + Remove keyring support from our code and rely on libsoup to store + the authentication data if the user requests that support in their + application/library. + + * webkit/webkitsoupauthdialog.c: + (response_callback): + (show_auth_dialog): + (session_authenticate): + +2009-08-11 Benjamin Otte <otte@gnome.org> + + Reviewed by Xan Lopez. + + When instructed to print an out-of-range page, print an empty page + instead of crashing. + + * webkit/webkitwebframe.cpp: + (draw_page_callback): + 2009-08-10 Brady Eidson <beidson@apple.com> GTK build fix. diff --git a/WebKit/gtk/JSCore-1.0.gir b/WebKit/gtk/JSCore-1.0.gir new file mode 100644 index 0000000..2fb4d46 --- /dev/null +++ b/WebKit/gtk/JSCore-1.0.gir @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<repository version="1.0" + xmlns="http://www.gtk.org/introspection/core/1.0" + xmlns:c="http://www.gtk.org/introspection/c/1.0"> + <namespace name="JSCore" version="1.0" shared-library="webkit-1.0"> + <alias name="GlobalContextRef" + target="none" + c:type="JSGlobalContextRef"/> + <alias name="ObjectRef" target="none" c:type="JSObjectRef"/> + <function name="EvaluateScript" c:identifier="JSEvaluateScript"> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + </parameters> + </function> + </namespace> +</repository> diff --git a/WebKit/gtk/NEWS b/WebKit/gtk/NEWS index 39a54ff..8d0803c 100644 --- a/WebKit/gtk/NEWS +++ b/WebKit/gtk/NEWS @@ -1,4 +1,71 @@ ================= +WebKitGTK+ 1.1.15 +================= + +What's new in WebKitGTK+ 1.1.15? + + - New API to get the subresources from a WebKitWebDataSource. This + provides a way of accessing all the resources that compose the + view to which the data source is attached. + - A new function, webkit_web_view_get_hit_test_result, which allows + to do a 'hit test' on the coordinates specified by a mouse + event. A hit test provides context information about that point in + the document, like whether it's an image, a link, an input box, + etc. + - Our DumpRenderTree implementation now supports eventSender, which + allows us to run many more LayoutTests and make WebKitGTK+ more + stable and feature-complete. + - JSNES runs 6x faster: http://trac.webkit.org/changeset/48573 + - The usual small improvements and bugfixes. + +================= +WebKitGTK+ 1.1.14 +================= + +What's new in WebKitGTK+ 1.1.14? + + - New API has been added to WebKitWebFrame to allow applying + scrollbars policy as requested by web applications to the main + frame; if the parent of the WebKitWebView widget is a + GtkScrolledWindow, policy is applied by the default handler. + - A new API has been added to help dealing with the various + resources that are downloaded to compose the final rendering; you + can now obtain the source code for a page that is loaded, for + instance. + - A new property has been added to WebKitWebView to allow setting it + to "View Source" mode. + - HTML5 database has gained API to manage the individual databases, + including usage and quota. + - A new signal `resource-request-starting' has been added to the + WebKitWebView to allow modification of outgoing requests for every + resource. + - Connection limit has been increased to 60 total connections, 6 + per-host, matching other browsers more closely; this seems to have + improved loading time of some sites. + - Undo/redo support has been added to editable texts. + - The usual stream of small improvements and bug fixes. + +================= +WebKitGTK+ 1.1.13 +================= + +What's new in WebKitGTK+ 1.1.13? + + - GNOME Keyring support was removed in favor of the new Password + Manager soup feature; to get exactly the same behavior, + applications should use SoupPasswordManagerGNOME. This requires + libsoup 2.27.91 or newer. + - Several accessibility improvements, including support for testing + the a11y infrastructure in our layout tests. + - You can now enable/disable HTML5 offline application cache using a + new setting added to WebKitWebSettings. + - Drag support has landed, meaning you can start playing with HTML5 + drag and drop support; drop support is still missing. + - A crash with scripts closing windows has been fixed. + - Image cursors support has been added. + - The usual stream of small improvements and bug fixes. + +================= WebKitGTK+ 1.1.12 ================= diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 1292e99..8d31af3 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -215,6 +215,10 @@ void ChromeClient::setResizable(bool) void ChromeClient::closeWindowSoon() { + // We may not have a WebView as create-web-view can return NULL. + if (!m_webView) + return; + webkit_web_view_stop_loading(m_webView); gboolean isHandled = false; @@ -226,7 +230,6 @@ void ChromeClient::closeWindowSoon() // FIXME: should we clear the frame group name here explicitly? Mac does it. // But this gets cleared in Page's destructor anyway. // webkit_web_view_set_group_name(m_webView, ""); - g_object_unref(m_webView); } bool ChromeClient::canTakeFocus(FocusDirection) @@ -383,7 +386,7 @@ IntPoint ChromeClient::screenToWindow(const IntPoint& point) const return result; } -PlatformWidget ChromeClient::platformWindow() const +PlatformPageClient ChromeClient::platformPageClient() const { return GTK_WIDGET(m_webView); } @@ -399,6 +402,40 @@ void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const gtk_widget_queue_resize_no_redraw(widget); } +void ChromeClient::scrollbarsModeDidChange() const +{ + WebKitWebFrame* webFrame = webkit_web_view_get_main_frame(m_webView); + + g_object_notify(G_OBJECT(webFrame), "horizontal-scrollbar-policy"); + g_object_notify(G_OBJECT(webFrame), "vertical-scrollbar-policy"); + + gboolean isHandled; + g_signal_emit_by_name(webFrame, "scrollbars-policy-changed", &isHandled); + + if (isHandled) + return; + + GtkWidget* parent = gtk_widget_get_parent(GTK_WIDGET(m_webView)); + if (!parent || !GTK_IS_SCROLLED_WINDOW(parent)) + return; + + GtkPolicyType horizontalPolicy = webkit_web_frame_get_horizontal_scrollbar_policy(webFrame); + GtkPolicyType verticalPolicy = webkit_web_frame_get_vertical_scrollbar_policy(webFrame); + + // ScrolledWindow doesn't like to display only part of a widget if + // the scrollbars are completely disabled; We have a disparity + // here on what the policy requested by the web app is and what we + // can represent; the idea is not to show scrollbars, only. + if (horizontalPolicy == GTK_POLICY_NEVER) + horizontalPolicy = GTK_POLICY_AUTOMATIC; + + if (verticalPolicy == GTK_POLICY_NEVER) + verticalPolicy = GTK_POLICY_AUTOMATIC; + + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(parent), + horizontalPolicy, verticalPolicy); +} + void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned modifierFlags) { // If a tooltip must be displayed it will be, afterwards, when @@ -459,13 +496,17 @@ void ChromeClient::print(Frame* frame) } #if ENABLE(DATABASE) -void ChromeClient::exceededDatabaseQuota(Frame* frame, const String&) +void ChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName) { - // Set to 5M for testing - // FIXME: Make this configurable - notImplemented(); - const unsigned long long defaultQuota = 5 * 1024 * 1024; + guint64 defaultQuota = webkit_get_default_web_database_quota(); DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), defaultQuota); + + WebKitWebFrame* webFrame = kit(frame); + WebKitWebView* webView = getViewFromFrame(webFrame); + + WebKitSecurityOrigin* origin = webkit_web_frame_get_security_origin(webFrame); + WebKitWebDatabase* webDatabase = webkit_security_origin_get_web_database(origin, databaseName.utf8().data()); + g_signal_emit_by_name(webView, "database-quota-exceeded", webFrame, webDatabase); } #endif @@ -482,7 +523,7 @@ void ChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser) RefPtr<FileChooser> chooser = prpFileChooser; GtkWidget* dialog = gtk_file_chooser_dialog_new(_("Upload File"), - GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(platformWindow()))), + GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(platformPageClient()))), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h index 0f35e52..e321c35 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h @@ -89,9 +89,10 @@ namespace WebKit { virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect); virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const; virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const; - virtual PlatformWidget platformWindow() const; + virtual PlatformPageClient platformPageClient() const; virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const; + virtual void scrollbarsModeDidChange() const; virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags); virtual void setToolTip(const WebCore::String&, WebCore::TextDirection); diff --git a/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp new file mode 100644 index 0000000..0efc9fa --- /dev/null +++ b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2009 Jan Michael Alonzo + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. + */ + +#include "config.h" +#include "DocumentLoaderGtk.h" + +#include "webkitwebdatasource.h" + +using namespace WebCore; + +namespace WebKit { + +DocumentLoader::DocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) + : WebCore::DocumentLoader(request, substituteData) + , m_isDataSourceReffed(false) + , m_dataSource(0) +{ +} + +void DocumentLoader::setDataSource(WebKitWebDataSource* dataSource) +{ + ASSERT(!m_dataSource); + + m_dataSource = dataSource; + refDataSource(); +} + +void DocumentLoader::detachDataSource() +{ + unrefDataSource(); +} + +void DocumentLoader::attachToFrame() +{ + WebCore::DocumentLoader::attachToFrame(); + + refDataSource(); +} + +void DocumentLoader::detachFromFrame() +{ + WebCore::DocumentLoader::detachFromFrame(); + + if (m_loadingResources.isEmpty()) + unrefDataSource(); +} + +void DocumentLoader::increaseLoadCount(unsigned long identifier) +{ + ASSERT(m_dataSource); + + if (m_loadingResources.contains(identifier)) + return; + m_loadingResources.add(identifier); + refDataSource(); +} + +void DocumentLoader::decreaseLoadCount(unsigned long identifier) +{ + HashSet<unsigned long>::iterator it = m_loadingResources.find(identifier); + + // It is valid for a load to be cancelled before it's started. + if (it == m_loadingResources.end()) + return; + + m_loadingResources.remove(it); + + if (m_loadingResources.isEmpty() && !frame()) + unrefDataSource(); +} + +// helper methos to avoid ref count churn +void DocumentLoader::refDataSource() +{ + if (!m_dataSource || m_isDataSourceReffed) + return; + m_isDataSourceReffed = true; + g_object_ref(m_dataSource); +} +void DocumentLoader::unrefDataSource() +{ + if (!m_isDataSourceReffed) + return; + ASSERT(m_dataSource); + m_isDataSourceReffed = false; + g_object_unref(m_dataSource); +} + +} // end namespace WebKit diff --git a/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.h b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.h new file mode 100644 index 0000000..c601bc5 --- /dev/null +++ b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2009 Jan Michael Alonzo + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DocumentLoaderGtk_h +#define DocumentLoaderGtk_h + +#include "DocumentLoader.h" +#include "webkitdefines.h" +#include "wtf/HashSet.h" + +namespace WebCore { + class ResourceRequest; + class SubstituteData; +} + +namespace WebKit { + +class DocumentLoader : public WebCore::DocumentLoader { +public: + static PassRefPtr<WebKit::DocumentLoader> create(const WebCore::ResourceRequest& request, const WebCore::SubstituteData& data) + { + return adoptRef(new DocumentLoader(request, data)); + } + + void setDataSource(WebKitWebDataSource*); + void detachDataSource(); + WebKitWebDataSource* dataSource() const { return m_dataSource; } + + void increaseLoadCount(unsigned long identifier); + void decreaseLoadCount(unsigned long identifier); + +private: + DocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); + + virtual void attachToFrame(); + virtual void detachFromFrame(); + + void refDataSource(); + void unrefDataSource(); + + bool m_isDataSourceReffed; + WebKitWebDataSource* m_dataSource; + HashSet<unsigned long> m_loadingResources; +}; + +} // end namespace WebKit + +#endif diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp index f55b6ea..f4b0df1 100644 --- a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp @@ -17,20 +17,36 @@ #include "config.h" #include "DragClientGtk.h" +#include "Document.h" +#include "Element.h" +#include "Frame.h" #include "NotImplemented.h" +#include "RenderObject.h" +#include "webkitwebview.h" + +#include <gtk/gtk.h> +#if !GTK_CHECK_VERSION(2, 14, 0) +#define gtk_widget_get_window(widget) (widget)->window +#endif using namespace WebCore; namespace WebKit { +DragClient::DragClient(WebKitWebView* webView) + : m_webView(webView) + , m_startPos(0, 0) +{ +} + void DragClient::willPerformDragDestinationAction(DragDestinationAction, DragData*) { notImplemented(); } -void DragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) +void DragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint& startPos, Clipboard*) { - notImplemented(); + m_startPos = startPos; } DragDestinationAction DragClient::actionMaskForDrag(DragData*) @@ -45,12 +61,53 @@ DragSourceAction DragClient::dragSourceActionMaskForPoint(const IntPoint&) return DragSourceActionAny; } -void DragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool) +void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard*, Frame* frame, bool linkDrag) { - notImplemented(); + Element* targetElement = frame->document()->elementFromPoint(m_startPos.x(), m_startPos.y()); + bool imageDrag = false; + + if (targetElement) + imageDrag = targetElement->renderer()->isImage(); + + GdkAtom textHtml = gdk_atom_intern_static_string("text/html"); + GdkAtom netscapeUrl = gdk_atom_intern_static_string("_NETSCAPE_URL"); + + GtkTargetList* targetList = gtk_target_list_new(NULL, 0); + gtk_target_list_add(targetList, textHtml, 0, WEBKIT_WEB_VIEW_TARGET_INFO_HTML); + gtk_target_list_add_text_targets(targetList, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT); + + if (linkDrag || imageDrag) { + gtk_target_list_add(targetList, netscapeUrl, 0, WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL); + gtk_target_list_add_uri_targets(targetList, WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST); + } + + if (imageDrag) + gtk_target_list_add_image_targets(targetList, WEBKIT_WEB_VIEW_TARGET_INFO_IMAGE, false); + + GdkDragAction dragAction = GDK_ACTION_COPY; + if (linkDrag) { + dragAction = GDK_ACTION_LINK; + if (imageDrag) + dragAction = (GdkDragAction)(dragAction | GDK_ACTION_COPY); + } + + GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS); + reinterpret_cast<GdkEventButton*>(event)->window = gtk_widget_get_window(GTK_WIDGET(m_webView)); + reinterpret_cast<GdkEventButton*>(event)->time = GDK_CURRENT_TIME; + + GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), + targetList, dragAction, 1, event); + g_object_ref(context); + + if (image) + gtk_drag_set_icon_pixbuf(context, image, eventPos.x() - dragImageOrigin.x(), eventPos.y() - dragImageOrigin.y()); + else + gtk_drag_set_icon_default(context); + + gtk_target_list_unref(targetList); } -DragImageRef DragClient::createDragImageForLink(KURL&, const String& label, Frame*) +DragImageRef DragClient::createDragImageForLink(KURL&, const String&, Frame*) { notImplemented(); return 0; @@ -61,4 +118,3 @@ void DragClient::dragControllerDestroyed() delete this; } } - diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.h b/WebKit/gtk/WebCoreSupport/DragClientGtk.h index 4367c68..97ea72a 100644 --- a/WebKit/gtk/WebCoreSupport/DragClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.h @@ -32,9 +32,14 @@ #include "DragClient.h" +typedef struct _WebKitWebView WebKitWebView; + namespace WebKit { + class DragClient : public WebCore::DragClient { public: + DragClient(WebKitWebView*); + virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*); virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*); virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*); @@ -45,6 +50,10 @@ namespace WebKit { virtual WebCore::DragImageRef createDragImageForLink(WebCore::KURL&, const WebCore::String& label, WebCore::Frame*); virtual void dragControllerDestroyed(); + + private: + WebKitWebView* m_webView; + WebCore::IntPoint m_startPos; }; } diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp index b5148d8..7121163 100644 --- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp @@ -49,39 +49,40 @@ using namespace WebCore; namespace WebKit { -static void imContextCommitted(GtkIMContext* context, const gchar* str, EditorClient* client) -{ - Frame* targetFrame = core(client->m_webView)->focusController()->focusedOrMainFrame(); +static gchar* pendingComposition = 0; +static gchar* pendingPreedit = 0; - if (!targetFrame || !targetFrame->editor()->canEdit()) - return; +static void setPendingComposition(gchar* newComposition) +{ + g_free(pendingComposition); + pendingComposition = newComposition; +} - Editor* editor = targetFrame->editor(); +static void setPendingPreedit(gchar* newPreedit) +{ + g_free(pendingPreedit); + pendingPreedit = newPreedit; +} - String commitString = String::fromUTF8(str); - editor->confirmComposition(commitString); +static void clearPendingIMData() +{ + setPendingComposition(0); + setPendingPreedit(0); +} +static void imContextCommitted(GtkIMContext* context, const gchar* str, EditorClient* client) +{ + // This signal will fire during a keydown event. We want the contents of the + // field to change right before the keyup event, so we wait until then to actually + // commit this composition. + setPendingComposition(g_strdup(str)); } static void imContextPreeditChanged(GtkIMContext* context, EditorClient* client) { - Frame* frame = core(client->m_webView)->focusController()->focusedOrMainFrame(); - Editor* editor = frame->editor(); - - gchar* preedit = NULL; - gint cursorPos = 0; // We ignore the provided PangoAttrList for now. - gtk_im_context_get_preedit_string(context, &preedit, NULL, &cursorPos); - String preeditString = String::fromUTF8(preedit); - g_free(preedit); - - // setComposition() will replace the user selection if passed an empty - // preedit. We don't want this to happen. - if (preeditString.isEmpty() && !editor->hasComposition()) - return; - - Vector<CompositionUnderline> underlines; - underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false)); - editor->setComposition(preeditString, underlines, cursorPos, 0); + gchar* newPreedit = 0; + gtk_im_context_get_preedit_string(context, &newPreedit, NULL, NULL); + setPendingPreedit(newPreedit); } void EditorClient::setInputMethodState(bool active) @@ -136,12 +137,16 @@ int EditorClient::spellCheckerDocumentTag() bool EditorClient::shouldBeginEditing(WebCore::Range*) { + clearPendingIMData(); + notImplemented(); return true; } bool EditorClient::shouldEndEditing(WebCore::Range*) { + clearPendingIMData(); + notImplemented(); return true; } @@ -410,11 +415,6 @@ static const KeyDownEntry keyDownEntries[] = { { VK_RETURN, CtrlKey, "InsertNewline" }, { VK_RETURN, AltKey, "InsertNewline" }, { VK_RETURN, AltKey | ShiftKey, "InsertNewline" }, - - // It's not quite clear whether Undo/Redo should be handled - // in the application or in WebKit. We chose WebKit. - { 'Z', CtrlKey, "Undo" }, - { 'Z', CtrlKey | ShiftKey, "Redo" }, }; static const KeyPressEntry keyPressEntries[] = { @@ -426,7 +426,7 @@ static const KeyPressEntry keyPressEntries[] = { { '\r', AltKey | ShiftKey, "InsertNewline" }, }; -static const char* interpretKeyEvent(const KeyboardEvent* evt) +static const char* interpretEditorCommandKeyEvent(const KeyboardEvent* evt) { ASSERT(evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent); @@ -461,74 +461,79 @@ static const char* interpretKeyEvent(const KeyboardEvent* evt) return mapKey ? keyPressCommandsMap->get(mapKey) : 0; } -static bool handleEditingKeyboardEvent(KeyboardEvent* evt) +void EditorClient::handleKeyboardEvent(KeyboardEvent* event) { - Node* node = evt->target()->toNode(); + Node* node = event->target()->toNode(); ASSERT(node); Frame* frame = node->document()->frame(); ASSERT(frame); - const PlatformKeyboardEvent* keyEvent = evt->keyEvent(); - if (!keyEvent) - return false; - - bool caretBrowsing = frame->settings()->caretBrowsingEnabled(); - if (caretBrowsing) { - switch (keyEvent->windowsVirtualKeyCode()) { - case VK_LEFT: - frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE, - SelectionController::LEFT, - keyEvent->ctrlKey() ? WordGranularity : CharacterGranularity, - true); - return true; - case VK_RIGHT: - frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE, - SelectionController::RIGHT, - keyEvent->ctrlKey() ? WordGranularity : CharacterGranularity, - true); - return true; - case VK_UP: - frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE, - SelectionController::BACKWARD, - keyEvent->ctrlKey() ? ParagraphGranularity : LineGranularity, - true); - return true; - case VK_DOWN: - frame->selection()->modify(keyEvent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE, - SelectionController::FORWARD, - keyEvent->ctrlKey() ? ParagraphGranularity : LineGranularity, - true); - return true; + const PlatformKeyboardEvent* platformEvent = event->keyEvent(); + if (!platformEvent) + return; + + // Don't allow editor commands or text insertion for nodes that + // cannot edit, unless we are in caret mode. + if (!frame->editor()->canEdit() && !(frame->settings() && frame->settings()->caretBrowsingEnabled())) + return; + + const gchar* editorCommandString = interpretEditorCommandKeyEvent(event); + if (editorCommandString) { + Editor::Command command = frame->editor()->command(editorCommandString); + + // On editor commands from key down events, we only want to let the event bubble up to + // the DOM if it inserts text. If it doesn't insert text (e.g. Tab that changes focus) + // we just want WebKit to handle it immediately without a DOM event. + if (platformEvent->type() == PlatformKeyboardEvent::RawKeyDown) { + if (!command.isTextInsertion() && command.execute(event)) + event->setDefaultHandled(); + + return; + } else if (command.execute(event)) { + event->setDefaultHandled(); + return; } } - Editor::Command command = frame->editor()->command(interpretKeyEvent(evt)); + // This is just a normal text insertion, so wait to execute the insertion + // until a keypress event happens. This will ensure that the insertion will not + // be reflected in the contents of the field until the keyup DOM event. + if (event->type() == eventNames().keypressEvent) { - if (keyEvent->type() == PlatformKeyboardEvent::RawKeyDown) { - // WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated, - // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated - // (e.g. Tab that inserts a Tab character, or Enter). - return !command.isTextInsertion() && command.execute(evt); - } + if (pendingComposition) { + String compositionString = String::fromUTF8(pendingComposition); + frame->editor()->confirmComposition(compositionString); - if (command.execute(evt)) - return true; + clearPendingIMData(); + event->setDefaultHandled(); - // Don't insert null or control characters as they can result in unexpected behaviour - if (evt->charCode() < ' ') - return false; + } else if (pendingPreedit) { + String preeditString = String::fromUTF8(pendingPreedit); - // Don't insert anything if a modifier is pressed - if (keyEvent->ctrlKey() || keyEvent->altKey()) - return false; + // Don't use an empty preedit as it will destroy the current + // selection, even if the composition is cancelled or fails later on. + if (!preeditString.isEmpty()) { + Vector<CompositionUnderline> underlines; + underlines.append(CompositionUnderline(0, preeditString.length(), Color(0, 0, 0), false)); + frame->editor()->setComposition(preeditString, underlines, 0, 0); + } - return frame->editor()->insertText(evt->keyEvent()->text(), evt); -} + clearPendingIMData(); + event->setDefaultHandled(); -void EditorClient::handleKeyboardEvent(KeyboardEvent* event) -{ - if (handleEditingKeyboardEvent(event)) - event->setDefaultHandled(); + } else { + // Don't insert null or control characters as they can result in unexpected behaviour + if (event->charCode() < ' ') + return; + + // Don't insert anything if a modifier is pressed + if (platformEvent->ctrlKey() || platformEvent->altKey()) + return; + + if (frame->editor()->insertText(platformEvent->text(), event)) + event->setDefaultHandled(); + } + } } void EditorClient::handleInputMethodKeydown(KeyboardEvent* event) @@ -537,10 +542,10 @@ void EditorClient::handleInputMethodKeydown(KeyboardEvent* event) if (!targetFrame || !targetFrame->editor()->canEdit()) return; + // TODO: We need to decide which filtered keystrokes should be treated as IM + // events and which should not. WebKitWebViewPrivate* priv = m_webView->priv; - // TODO: Dispatch IE-compatible text input events for IM events. - if (gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey())) - event->setDefaultHandled(); + gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey()); } EditorClient::EditorClient(WebKitWebView* webView) diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 68c0435..1cf9aee 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -2,7 +2,7 @@ * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com> * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther * Copyright (C) 2007 Christian Dywan <christian@twotoasts.de> - * Copyright (C) 2008 Collabora Ltd. All rights reserved. + * Copyright (C) 2008, 2009 Collabora Ltd. All rights reserved. * Copyright (C) 2009 Gustavo Noronha Silva <gns@gnome.org> * * This library is free software; you can redistribute it and/or @@ -23,8 +23,10 @@ #include "config.h" #include "FrameLoaderClientGtk.h" +#include "ArchiveResource.h" #include "Color.h" #include "DocumentLoader.h" +#include "DocumentLoaderGtk.h" #include "FormState.h" #include "FrameLoader.h" #include "FrameView.h" @@ -53,6 +55,7 @@ #include "ScriptController.h" #include "webkiterror.h" #include "webkitnetworkrequest.h" +#include "webkitnetworkresponse.h" #include "webkitprivate.h" #include "webkitwebframe.h" #include "webkitwebnavigationaction.h" @@ -111,7 +114,13 @@ static void loadDone(WebKitWebFrame* frame, bool didSucceed) WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClient::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData) { - return DocumentLoader::create(request, substituteData); + RefPtr<WebKit::DocumentLoader> loader = WebKit::DocumentLoader::create(request, substituteData); + + WebKitWebDataSource* webDataSource = webkit_web_data_source_new_with_loader(loader.get()); + loader->setDataSource(webDataSource); + g_object_unref(webDataSource); + + return loader.release(); } void FrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction policyFunction, PassRefPtr<FormState>) @@ -120,11 +129,11 @@ void FrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction policyFunctio ASSERT(policyFunction); if (!policyFunction) return; - (core(m_frame)->loader()->*policyFunction)(PolicyUse); + (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyUse); } -void FrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length) +void FrameLoaderClient::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) { if (!m_pluginView) { ASSERT(loader->frame()); @@ -158,30 +167,68 @@ void FrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, } bool -FrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier) +FrameLoaderClient::shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier) { notImplemented(); return false; } -void FrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) +void FrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) { notImplemented(); } -void FrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) +void FrameLoaderClient::dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) { notImplemented(); } -void FrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&) +// We convert this to string because it's easier to use strings as +// keys in a GHashTable. +static char* toString(unsigned long identifier) { - notImplemented(); + return g_strdup_printf("%ld", identifier); } -void FrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&) +void FrameLoaderClient::dispatchWillSendRequest(WebCore::DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse) { - notImplemented(); + GOwnPtr<WebKitNetworkResponse> networkResponse(0); + + // We are adding one more resource to the load, or maybe we are + // just redirecting a load. + if (redirectResponse.isNull()) + static_cast<WebKit::DocumentLoader*>(loader)->increaseLoadCount(identifier); + else + networkResponse.set(webkit_network_response_new_with_core_response(redirectResponse)); + + WebKitWebView* webView = getViewFromFrame(m_frame); + GOwnPtr<gchar> identifierString(toString(identifier)); + WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); + GOwnPtr<WebKitNetworkRequest> networkRequest(webkit_network_request_new_with_core_request(request)); + + if (!redirectResponse.isNull()) { + // This is a redirect, so we need to update the WebResource's knowledge + // of the URI. + g_free(webResource->priv->uri); + webResource->priv->uri = g_strdup(request.url().string().utf8().data()); + } + + g_signal_emit_by_name(webView, "resource-request-starting", m_frame, webResource, networkRequest.get(), networkResponse.get()); + + // Feed any changes back into the ResourceRequest object. + SoupMessage* message = webkit_network_request_get_message(networkRequest.get()); + if (!message) { + request.setURL(KURL(KURL(), String::fromUTF8(webkit_network_request_get_uri(networkRequest.get())))); + return; + } + + request.updateFromSoupMessage(message); +} + +void FrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const ResourceRequest& request) +{ + webkit_web_view_add_resource(getViewFromFrame(m_frame), toString(identifier), + WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, "uri", request.url().string().utf8().data(), 0))); } void FrameLoaderClient::postProgressStartedNotification() @@ -221,7 +268,7 @@ void FrameLoaderClient::frameLoaderDestroyed() delete this; } -void FrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse& response) +void FrameLoaderClient::dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long, const ResourceResponse& response) { m_response = response; } @@ -233,7 +280,7 @@ void FrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction poli return; if (resourceRequest.isNull()) { - (core(m_frame)->loader()->*policyFunction)(PolicyIgnore); + (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyIgnore); return; } @@ -300,7 +347,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFuncti return; if (resourceRequest.isNull()) { - (core(m_frame)->loader()->*policyFunction)(PolicyIgnore); + (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyIgnore); return; } @@ -323,7 +370,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFuncti // FIXME: I think Qt version marshals this to another thread so when we // have multi-threaded download, we might need to do the same if (!isHandled) - (core(m_frame)->loader()->*policyFunction)(PolicyUse); + (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyUse); } void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction policyFunction, const NavigationAction& action, const ResourceRequest& resourceRequest, PassRefPtr<FormState>) @@ -333,7 +380,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunct return; if (resourceRequest.isNull()) { - (core(m_frame)->loader()->*policyFunction)(PolicyIgnore); + (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyIgnore); return; } @@ -350,7 +397,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunct g_signal_emit_by_name(webView, "navigation-requested", m_frame, request, &response); if (response == WEBKIT_NAVIGATION_RESPONSE_IGNORE) { - (core(m_frame)->loader()->*policyFunction)(PolicyIgnore); + (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyIgnore); g_object_unref(request); return; } @@ -403,11 +450,11 @@ PassRefPtr<Widget> FrameLoaderClient::createPlugin(const IntSize& pluginSize, HT PassRefPtr<Frame> FrameLoaderClient::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) { - Frame* coreFrame = core(webFrame()); + Frame* coreFrame = core(m_frame); - ASSERT(core(getViewFromFrame(webFrame())) == coreFrame->page()); + ASSERT(core(getViewFromFrame(m_frame)) == coreFrame->page()); - RefPtr<Frame> childFrame = webkit_web_frame_init_with_web_view(getViewFromFrame(webFrame()), ownerElement); + RefPtr<Frame> childFrame = webkit_web_frame_init_with_web_view(getViewFromFrame(m_frame), ownerElement); coreFrame->tree()->appendChild(childFrame); @@ -474,7 +521,7 @@ void FrameLoaderClient::windowObjectCleared() // Is this obsolete now? g_signal_emit_by_name(m_frame, "cleared"); - Frame* coreFrame = core(webFrame()); + Frame* coreFrame = core(m_frame); ASSERT(coreFrame); Settings* settings = coreFrame->settings(); @@ -546,7 +593,17 @@ bool FrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const return item != 0; } -void FrameLoaderClient::makeRepresentation(DocumentLoader*) +void FrameLoaderClient::didDisplayInsecureContent() +{ + notImplemented(); +} + +void FrameLoaderClient::didRunInsecureContent(SecurityOrigin*) +{ + notImplemented(); +} + +void FrameLoaderClient::makeRepresentation(WebCore::DocumentLoader*) { notImplemented(); } @@ -700,22 +757,22 @@ void FrameLoaderClient::cancelPolicyCheck() webkit_web_policy_decision_cancel(m_policyDecision); } -void FrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader*) +void FrameLoaderClient::dispatchDidLoadMainResource(WebCore::DocumentLoader*) { notImplemented(); } -void FrameLoaderClient::revertToProvisionalState(DocumentLoader*) +void FrameLoaderClient::revertToProvisionalState(WebCore::DocumentLoader*) { notImplemented(); } -void FrameLoaderClient::willChangeTitle(DocumentLoader*) +void FrameLoaderClient::willChangeTitle(WebCore::DocumentLoader*) { notImplemented(); } -void FrameLoaderClient::didChangeTitle(DocumentLoader *l) +void FrameLoaderClient::didChangeTitle(WebCore::DocumentLoader *l) { setTitle(l->title(), l->url()); } @@ -744,7 +801,7 @@ String FrameLoaderClient::generatedMIMETypeForURLScheme(const String&) const return String(); } -void FrameLoaderClient::finishedLoading(DocumentLoader* documentLoader) +void FrameLoaderClient::finishedLoading(WebCore::DocumentLoader* documentLoader) { if (!m_pluginView) committedLoad(documentLoader, 0, 0); @@ -758,7 +815,10 @@ void FrameLoaderClient::finishedLoading(DocumentLoader* documentLoader) void FrameLoaderClient::provisionalLoadStarted() { - notImplemented(); + WebKitWebView* webView = getViewFromFrame(m_frame); + + if (m_frame == webkit_web_view_get_main_frame(webView)) + webkit_web_view_clear_resources(webView); } void FrameLoaderClient::didFinishLoad() { @@ -774,19 +834,45 @@ void FrameLoaderClient::setTitle(const String& title, const KURL& url) frameData->title = g_strdup(title.utf8().data()); } -void FrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived) +void FrameLoaderClient::dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived) { notImplemented(); } -void FrameLoaderClient::dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier) +void FrameLoaderClient::dispatchDidFinishLoading(WebCore::DocumentLoader* loader, unsigned long identifier) { + static_cast<WebKit::DocumentLoader*>(loader)->decreaseLoadCount(identifier); + + WebKitWebView* webView = getViewFromFrame(m_frame); + GOwnPtr<gchar> identifierString(toString(identifier)); + WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); + + const char* uri = webkit_web_resource_get_uri(webResource); + RefPtr<ArchiveResource> coreResource(loader->subresource(KURL(KURL(), uri))); + + // If coreResource is NULL here, the resource failed to load, + // unless it's the main resource. + if (!coreResource && webResource != webkit_web_view_get_main_resource(webView)) + return; + + if (!coreResource) + coreResource = loader->mainResource().releaseRef(); + + webkit_web_resource_init_with_core_resource(webResource, coreResource.get()); + + // FIXME: This function should notify the application that the resource + // finished loading, maybe using a load-status property in the + // WebKitWebResource object, similar to what we do for WebKitWebFrame' + // signal. notImplemented(); } -void FrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError& error) +void FrameLoaderClient::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long identifier, const ResourceError& error) { - // FIXME: when does this occur and what should happen? + static_cast<WebKit::DocumentLoader*>(loader)->decreaseLoadCount(identifier); + + // FIXME: This function should notify the application that the resource failed + // loading, maybe a 'load-error' signal in the WebKitWebResource object. notImplemented(); } @@ -795,7 +881,7 @@ void FrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, c notImplemented(); } -bool FrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) +bool FrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) { notImplemented(); return false; @@ -804,12 +890,12 @@ bool FrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, void FrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error) { dispatchDidFailLoad(error); - - loadDone(m_frame, false); } void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) { + notifyStatus(m_frame, WEBKIT_LOAD_FAILED); + WebKitWebView* webView = getViewFromFrame(m_frame); GError* webError = g_error_new_literal(g_quark_from_string(error.domain().utf8().data()), error.errorCode(), @@ -824,7 +910,6 @@ void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) if (!shouldFallBack(error)) { g_error_free(webError); - loadDone(m_frame, false); return; } @@ -852,21 +937,14 @@ void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) g_object_unref(errorFile); g_error_free(webError); - - loadDone(m_frame, false); } void FrameLoaderClient::download(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest&, const ResourceResponse& response) { - // FIXME: We could reuse the same handle here, but when I tried - // implementing that the main load would fail and stop, so I have - // simplified this case for now. - handle->cancel(); - - WebKitNetworkRequest* networkRequest = webkit_network_request_new(request.url().string().utf8().data()); + WebKitNetworkRequest* networkRequest = webkit_network_request_new_with_core_request(request); WebKitWebView* view = getViewFromFrame(m_frame); - webkit_web_view_request_download(view, networkRequest, response); + webkit_web_view_request_download(view, networkRequest, response, handle); g_object_unref(networkRequest); } @@ -943,7 +1021,7 @@ void FrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&) notImplemented(); } -void FrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceError& error) +void FrameLoaderClient::setMainDocumentError(WebCore::DocumentLoader*, const ResourceError& error) { if (m_pluginView) { m_pluginView->didFail(error); @@ -997,6 +1075,14 @@ void FrameLoaderClient::transitionToCommittedForNewPage() WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(containingWindow); frame->view()->setGtkAdjustments(priv->horizontalAdjustment, priv->verticalAdjustment); + + if (priv->currentMenu) { + GtkMenu* menu = priv->currentMenu; + priv->currentMenu = NULL; + + gtk_menu_popdown(menu); + g_object_unref(menu); + } } } diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h index bc64c2f..c820135 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h @@ -136,6 +136,9 @@ namespace WebKit { virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual void didDisplayInsecureContent(); + virtual void didRunInsecureContent(WebCore::SecurityOrigin*); + virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&); virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&); diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp index 908bffa..fef07c1 100644 --- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp @@ -68,8 +68,13 @@ void InspectorClient::webViewDestroyed() Page* InspectorClient::createPage() { - if (m_webView) - return core(m_webView); + if (m_webView) { + gboolean handled = FALSE; + g_signal_emit_by_name(m_webInspector, "destroy", &handled); + + /* we can now dispose our own reference */ + g_object_unref(m_webInspector); + } // This g_object_get will ref the inspector. We're not doing an // unref if this method succeeds because the inspector object must diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp index 5a7157e..f2ea316 100644 --- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp @@ -67,4 +67,9 @@ GtkTargetList* PasteboardHelperGtk::getPasteTargetList(Frame* frame) const return webkit_web_view_get_paste_target_list(webView); } +gint PasteboardHelperGtk::getWebViewTargetInfoHtml() const +{ + return WEBKIT_WEB_VIEW_TARGET_INFO_HTML; +} + } diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h index 4e66357..849b417 100644 --- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h +++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h @@ -45,6 +45,7 @@ public: virtual GtkClipboard* getPrimary(Frame*) const; virtual GtkTargetList* getCopyTargetList(Frame*) const; virtual GtkTargetList* getPasteTargetList(Frame*) const; + virtual gint getWebViewTargetInfoHtml() const; }; } diff --git a/WebKit/gtk/docs/GNUmakefile.am b/WebKit/gtk/docs/GNUmakefile.am index b34dace..968b7f6 100644 --- a/WebKit/gtk/docs/GNUmakefile.am +++ b/WebKit/gtk/docs/GNUmakefile.am @@ -80,10 +80,12 @@ INCLUDES= \ -I$(top_builddir)/DerivedSources \ $(GLOBALDEPS_CFLAGS) \ $(CAIRO_CFLAGS) \ + $(GLIB_CFLAGS) \ $(GTK_CFLAGS) \ $(LIBSOUP_CFLAGS) GTKDOC_LIBS= \ $(top_builddir)/libwebkit-1.0.la \ + $(GLIB_LIBS) \ $(GTK_LIBS) \ $(LIBSOUP_LIBS) diff --git a/WebKit/gtk/docs/webkitgtk-docs.sgml b/WebKit/gtk/docs/webkitgtk-docs.sgml index 402b41a..ca608d4 100644 --- a/WebKit/gtk/docs/webkitgtk-docs.sgml +++ b/WebKit/gtk/docs/webkitgtk-docs.sgml @@ -19,9 +19,14 @@ <xi:include href="xml/webkitwebnavigationaction.xml"/> <xi:include href="xml/webkitwebpolicydecision.xml"/> <xi:include href="xml/webkitnetworkrequest.xml"/> + <xi:include href="xml/webkitnetworkresponse.xml"/> <xi:include href="xml/webkitwebinspector.xml"/> + <xi:include href="xml/webkitwebdatabase.xml"/> + <xi:include href="xml/webkitwebdatasource.xml"/> + <xi:include href="xml/webkitwebresource.xml"/> <xi:include href="xml/webkitdownload.xml"/> <xi:include href="xml/webkitsoupauthdialog.xml"/> + <xi:include href="xml/webkitsecurityorigin.xml"/> <xi:include href="xml/webkitwebwindowfeatures.xml"/> </chapter> @@ -75,4 +80,13 @@ <index id="index-1.1.11" role="1.1.11"> <title>Index of new symbols in 1.1.11</title> </index> + <index id="index-1.1.13" role="1.1.13"> + <title>Index of new symbols in 1.1.13</title> + </index> + <index id="index-1.1.14" role="1.1.14"> + <title>Index of new symbols in 1.1.14</title> + </index> + <index id="index-1.1.15" role="1.1.15"> + <title>Index of new symbols in 1.1.15</title> + </index> </book> diff --git a/WebKit/gtk/docs/webkitgtk-sections.txt b/WebKit/gtk/docs/webkitgtk-sections.txt index d038ae9..a7b636c 100644 --- a/WebKit/gtk/docs/webkitgtk-sections.txt +++ b/WebKit/gtk/docs/webkitgtk-sections.txt @@ -1,6 +1,7 @@ <SECTION> <FILE>webkitwebsettings</FILE> <TITLE>WebKitWebSettings</TITLE> +WebKitEditingBehavior WebKitWebSettings webkit_web_settings_copy webkit_web_settings_new @@ -85,12 +86,17 @@ WebKitWebHistoryItemClass WebKitLoadStatus WebKitWebFrame webkit_web_frame_find_frame +webkit_web_frame_get_data_source webkit_web_frame_get_global_context +webkit_web_frame_get_horizontal_scrollbar_policy webkit_web_frame_get_load_status webkit_web_frame_get_name webkit_web_frame_get_parent +webkit_web_frame_get_provisional_data_source +webkit_web_frame_get_security_origin webkit_web_frame_get_title webkit_web_frame_get_uri +webkit_web_frame_get_vertical_scrollbar_policy webkit_web_frame_get_web_view webkit_web_frame_load_alternate_string webkit_web_frame_load_request @@ -154,6 +160,105 @@ WebKitDownloadStatus </SECTION> <SECTION> +<FILE>webkitsecurityorigin</FILE> +<TITLE>WebKitSecurityOrigin</TITLE> +WebKitSecurityOrigin +webkit_security_origin_get_all_web_databases +webkit_security_origin_get_host +webkit_security_origin_get_port +webkit_security_origin_get_protocol +webkit_security_origin_get_type +webkit_security_origin_get_web_database_quota +webkit_security_origin_get_web_database_usage +webkit_security_origin_set_web_database_quota +<SUBSECTION Standard> +WEBKIT_SECURITY_ORIGIN +WEBKIT_SECURITY_ORIGIN_CLASS +WEBKIT_SECURITY_ORIGIN_GET_CLASS +WEBKIT_IS_SECURITY_ORIGIN +WEBKIT_IS_SECURITY_ORIGIN_CLASS +WEBKIT_TYPE_SECURITY_ORIGIN +<SUBSECTION Private> +WebKitSecurityOrigin +WebKitSecurityOriginClass +WebKitSecurityOriginPrivate +</SECTION> + +<SECTION> +<FILE>webkithittestresult</FILE> +<TITLE>WebKitHitTestResult</TITLE> +WebKitHitTestResult +WebKitHitTestResultContext +<SUBSECTION Standard> +WEBKIT_HIT_TEST_RESULT +WEBKIT_HIT_TEST_RESULT_CLASS +WEBKIT_HIT_TEST_RESULT_GET_CLASS +WEBKIT_IS_HIT_TEST_RESULT +WEBKIT_IS_HIT_TEST_RESULT_CLASS +WEBKIT_TYPE_HIT_TEST_RESULT +<SUBSECTION Private> +WebKitHitTestResult +WebKitHitTestResultClass +WebKitHitTestResultContext +WebKitHitTestResultPrivate +webkit_hit_test_result_get_type +</SECTION> + +<SECTION> +<FILE>webkitwebdatasource</FILE> +<TITLE>WebKitWebDataSource</TITLE> +WebKitWebDataSource +webkit_web_data_source_get_data +webkit_web_data_source_get_encoding +webkit_web_data_source_get_initial_request +webkit_web_data_source_get_main_resource +webkit_web_data_source_get_request +webkit_web_data_source_get_subresources +webkit_web_data_source_get_unreachable_uri +webkit_web_data_source_get_web_frame +webkit_web_data_source_is_loading +webkit_web_data_source_new +<SUBSECTION Standard> +WEBKIT_IS_WEB_DATA_SOURCE +WEBKIT_IS_WEB_DATA_SOURCE_CLASS +WEBKIT_TYPE_WEB_DATA_SOURCE +WEBKIT_WEB_DATA_SOURCE +WEBKIT_WEB_DATA_SOURCE_CLASS +WEBKIT_WEB_DATA_SOURCE_GET_CLASS +<SUBSECTION Private> +WebKitWebDataSource +WebKitWebDataSourceClass +WebKitWebDataSourcePrivate +webkit_web_data_source_new_with_request +webkit_web_data_source_get_type +</SECTION> + +<SECTION> +<FILE>webkitwebdatabase</FILE> +<TITLE>WebKitWebDatabase</TITLE> +WebKitWebDatabase +webkit_web_database_get_display_name +webkit_web_database_get_expected_size +webkit_web_database_get_filename +webkit_web_database_get_name +webkit_web_database_get_security_origin +webkit_web_database_get_size +webkit_web_database_remove +<SUBSECTION Standard> +WEBKIT_IS_WEB_DATABASE +WEBKIT_IS_WEB_DATABASE_CLASS +WEBKIT_TYPE_WEB_DATABASE +WEBKIT_WEB_DATABASE +WEBKIT_WEB_DATABASE_CLASS +WEBKIT_WEB_DATABASE_GET_CLASS +<SUBSECTION Private> +WebKitWebDatabase +WebKitWebDatabaseClass +WebKitWebDatabasePrivate +webkit_web_database_get_type +</SECTION> + +<SECTION> <FILE>webkitsoupauthdialog</FILE> <TITLE>WebKitSoupAuthDialog</TITLE> WebKitSoupAuthDialog @@ -199,6 +304,7 @@ webkit_web_navigation_action_get_button webkit_web_navigation_action_get_modifier_state webkit_web_navigation_action_get_original_uri webkit_web_navigation_action_get_reason +webkit_web_navigation_action_get_target_frame webkit_web_navigation_action_get_type webkit_web_navigation_action_set_original_uri webkit_web_navigation_action_set_reason @@ -261,6 +367,28 @@ WebKitNetworkRequestClass </SECTION> <SECTION> +<FILE>webkitnetworkresponse</FILE> +<TITLE>WebKitNetworkResponse</TITLE> +WebKitNetworkResponse +webkit_network_response_get_uri +webkit_network_response_get_message +webkit_network_response_set_uri +<SUBSECTION Standard> +WEBKIT_NETWORK_RESPONSE +WEBKIT_IS_NETWORK_RESPONSE +WEBKIT_TYPE_NETWORK_RESPONSE +WEBKIT_NETWORK_RESPONSE_CLASS +WEBKIT_IS_NETWORK_RESPONSE_CLASS +WEBKIT_NETWORK_RESPONSE_GET_CLASS +<SUBSECTION Private> +webkit_network_response_get_type +webkit_network_response_new +WebKitNetworkResponsePrivate +WebKitNetworkResponse +WebKitNetworkResponseClass +</SECTION> + +<SECTION> <FILE>webkitwebview</FILE> WebKitNavigationResponse WebKitWebViewTargetInfo @@ -272,7 +400,9 @@ webkit_web_view_can_go_back webkit_web_view_can_go_back_or_forward webkit_web_view_can_go_forward webkit_web_view_can_paste_clipboard +webkit_web_view_can_redo webkit_web_view_can_show_mime_type +webkit_web_view_can_undo webkit_web_view_copy_clipboard webkit_web_view_cut_clipboard webkit_web_view_delete_selection @@ -284,6 +414,7 @@ webkit_web_view_get_editable webkit_web_view_get_encoding webkit_web_view_get_focused_frame webkit_web_view_get_full_content_zoom +webkit_web_view_get_hit_test_result webkit_web_view_get_inspector webkit_web_view_get_load_status webkit_web_view_get_main_frame @@ -293,6 +424,7 @@ webkit_web_view_get_settings webkit_web_view_get_title webkit_web_view_get_transparent webkit_web_view_get_uri +webkit_web_view_get_view_source_mode webkit_web_view_get_zoom_level webkit_web_view_go_back webkit_web_view_go_back_or_forward @@ -308,6 +440,7 @@ webkit_web_view_move_cursor webkit_web_view_new webkit_web_view_open webkit_web_view_paste_clipboard +webkit_web_view_redo webkit_web_view_reload webkit_web_view_reload_bypass_cache webkit_web_view_search_text @@ -319,9 +452,11 @@ webkit_web_view_set_highlight_text_matches webkit_web_view_set_maintains_back_forward_list webkit_web_view_set_settings webkit_web_view_set_transparent +webkit_web_view_set_view_source_mode webkit_web_view_set_zoom_level webkit_web_view_stop_loading webkit_web_view_target_info_get_type +webkit_web_view_undo webkit_web_view_unmark_text_matches webkit_web_view_zoom_in webkit_web_view_zoom_out @@ -366,6 +501,37 @@ WebKitWebWindowFeaturesPrivate <FILE>webkit</FILE> webkit_init webkit_get_default_session +webkit_get_default_web_database_quota +webkit_get_web_database_directory_path +webkit_remove_all_web_databases +webkit_set_default_web_database_quota +webkit_set_web_database_directory_path +</SECTION> + +<SECTION> +<FILE>webkitwebresource</FILE> +<TITLE>WebKitWebResource</TITLE> +WebKitWebResource +webkit_web_resource_get_data +webkit_web_resource_get_encoding +webkit_web_resource_get_frame_name +webkit_web_resource_get_mime_type +webkit_web_resource_get_type +webkit_web_resource_get_uri +webkit_web_resource_new +<SUBSECTION Standard> +WEBKIT_WEB_RESOURCE +WEBKIT_IS_WEB_RESOURCE +WEBKIT_TYPE_WEB_RESOURCE +WEBKIT_WEB_RESOURCE_CLASS +WEBKIT_IS_WEB_RESOURCE_CLASS +WEBKIT_WEB_RESOURCE_GET_CLASS +<SUBSECTION Private> +webkit_web_resource_get_type +webkit_web_resource_new +WebKitWebResourcePrivate +WebKitWebResource +WebKitWebResourceClass </SECTION> <SECTION> diff --git a/WebKit/gtk/tests/testatk.c b/WebKit/gtk/tests/testatk.c index 61eae60..3910347 100644 --- a/WebKit/gtk/tests/testatk.c +++ b/WebKit/gtk/tests/testatk.c @@ -60,6 +60,8 @@ static void test_webkit_atk_get_text_at_offset(void) webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); g_object_ref_sink(webView); + GtkAllocation alloc = { 0, 0, 800, 600 }; + gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc); webkit_web_view_load_string(webView, contents, NULL, NULL, NULL); loop = g_main_loop_new(NULL, TRUE); diff --git a/WebKit/gtk/tests/testhittestresult.c b/WebKit/gtk/tests/testhittestresult.c new file mode 100644 index 0000000..defda7a --- /dev/null +++ b/WebKit/gtk/tests/testhittestresult.c @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2009 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2,1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include <errno.h> +#include <unistd.h> +#include <glib/gstdio.h> +#include <webkit/webkit.h> + +#if GTK_CHECK_VERSION(2, 14, 0) + +typedef struct { + char* data; + guint flag; +} TestInfo; + +static GMainLoop* loop; + +typedef struct { + WebKitWebView* webView; + TestInfo* info; +} HitTestResultFixture; + +TestInfo* +test_info_new(const char* data, guint flag) +{ + TestInfo* info; + + info = g_slice_new(TestInfo); + info->data = g_strdup(data); + info->flag = flag; + + return info; +} + +void +test_info_destroy(TestInfo* info) +{ + g_free(info->data); + g_slice_free(TestInfo, info); +} + +static void hit_test_result_fixture_setup(HitTestResultFixture* fixture, gconstpointer data) +{ + fixture->webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(fixture->webView); + loop = g_main_loop_new(NULL, TRUE); + fixture->info = (TestInfo*)data; +} + +static void hit_test_result_fixture_teardown(HitTestResultFixture* fixture, gconstpointer data) +{ + g_object_unref(fixture->webView); + g_main_loop_unref(loop); + test_info_destroy(fixture->info); +} + +static void +load_status_cb(WebKitWebView* webView, + GParamSpec* spec, + gpointer data) +{ + WebKitLoadStatus status = webkit_web_view_get_load_status(webView); + TestInfo* info = (TestInfo*)data; + + if (status == WEBKIT_LOAD_FINISHED) { + WebKitHitTestResult* result; + guint context; + GdkEventButton event; + event.type = GDK_BUTTON_PRESS; + /* Close enough to 0,0 */ + event.x = 5; + event.y = 5; + + result = webkit_web_view_get_hit_test_result(webView, &event); + g_assert(result); + g_object_get(result, "context", &context, NULL); + g_assert(context & info->flag); + g_object_unref(result); + g_main_loop_quit(loop); + } +} + +static void +test_webkit_hit_test_result(HitTestResultFixture* fixture, gconstpointer data) +{ + TestInfo* info = (TestInfo*)data; + GtkAllocation allocation = { 0, 0, 50, 50 }; + + webkit_web_view_load_string(fixture->webView, + info->data, + "text/html", + "utf-8", + "file://"); + gtk_widget_size_allocate(GTK_WIDGET(fixture->webView), &allocation); + g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_status_cb), info); + g_main_loop_run(loop); +} + +int main(int argc, char** argv) +{ + g_thread_init(NULL); + gtk_test_init(&argc, &argv, NULL); + + g_test_bug_base("https://bugs.webkit.org/"); + + g_test_add("/webkit/hittestresult/document", HitTestResultFixture, + test_info_new("<html><body><h1>WebKitGTK+!</h1></body></html>", + WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT), + hit_test_result_fixture_setup, test_webkit_hit_test_result, hit_test_result_fixture_teardown); + /* We hardcode all elements to be at 0,0 so that we know where to + * generate the button events */ + g_test_add("/webkit/hittestresult/image", HitTestResultFixture, + test_info_new("<html><body><img style='position:absolute; left:0; top:0'src='0xdeadbeef' width=50 height=50></img></body></html>", + WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE), + hit_test_result_fixture_setup, test_webkit_hit_test_result, hit_test_result_fixture_teardown); + g_test_add("/webkit/hittestresult/editable", HitTestResultFixture, + test_info_new("<html><body><input style='position:absolute; left:0; top:0' size='35'></input>></body></html>", + WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE), + hit_test_result_fixture_setup, test_webkit_hit_test_result, hit_test_result_fixture_teardown); + g_test_add("/webkit/hittestresult/link", HitTestResultFixture, + test_info_new("<html><body><a style='position:absolute; left:0; top:0' href='http://www.example.com'>HELLO WORLD</a></body></html>", + WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK), + hit_test_result_fixture_setup, test_webkit_hit_test_result, hit_test_result_fixture_teardown); + + return g_test_run (); +} + +#else + +int main(int argc, char** argv) +{ + g_critical("You will need at least GTK+ 2.14.0 to run the unit tests."); + return 0; +} + +#endif diff --git a/WebKit/gtk/tests/testkeyevents.c b/WebKit/gtk/tests/testkeyevents.c new file mode 100644 index 0000000..ee7728c --- /dev/null +++ b/WebKit/gtk/tests/testkeyevents.c @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2009 Martin Robinson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2,1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include <errno.h> +#include <unistd.h> +#include <string.h> +#include <glib/gstdio.h> +#include <webkit/webkit.h> + +#if GTK_CHECK_VERSION(2, 14, 0) + +typedef struct { + char* page; + gboolean shouldBeHandled; +} TestInfo; + +typedef struct { + GtkWidget* window; + WebKitWebView* webView; + GMainLoop* loop; + TestInfo* info; +} KeyEventFixture; + +TestInfo* +test_info_new(const char* page, gboolean shouldBeHandled) +{ + TestInfo* info; + + info = g_slice_new(TestInfo); + info->page = g_strdup(page); + info->shouldBeHandled = shouldBeHandled; + + return info; +} + +void +test_info_destroy(TestInfo* info) +{ + g_free(info->page); + g_slice_free(TestInfo, info); +} + +static void key_event_fixture_setup(KeyEventFixture* fixture, gconstpointer data) +{ + fixture->loop = g_main_loop_new(NULL, TRUE); + + fixture->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + fixture->webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + + gtk_container_add(GTK_CONTAINER(fixture->window), GTK_WIDGET(fixture->webView)); +} + +static void key_event_fixture_teardown(KeyEventFixture* fixture, gconstpointer data) +{ + gtk_widget_destroy(fixture->window); + g_main_loop_unref(fixture->loop); + test_info_destroy(fixture->info); +} + +static gboolean key_press_event_cb(WebKitWebView* webView, GdkEvent* event, gpointer data) +{ + KeyEventFixture* fixture = (KeyEventFixture*)data; + gboolean handled = GTK_WIDGET_GET_CLASS(fixture->webView)->key_press_event(GTK_WIDGET(fixture->webView), &event->key); + g_assert_cmpint(handled, ==, fixture->info->shouldBeHandled); + + return FALSE; +} + + +static gboolean key_release_event_cb(WebKitWebView* webView, GdkEvent* event, gpointer data) +{ + // WebCore never seems to mark keyup events as handled. + KeyEventFixture* fixture = (KeyEventFixture*)data; + gboolean handled = GTK_WIDGET_GET_CLASS(fixture->webView)->key_press_event(GTK_WIDGET(fixture->webView), &event->key); + g_assert(!handled); + + g_main_loop_quit(fixture->loop); + + return FALSE; +} + +static void load_status_cb(WebKitWebView* webView, GParamSpec* spec, gpointer data) +{ + KeyEventFixture* fixture = (KeyEventFixture*)data; + WebKitLoadStatus status = webkit_web_view_get_load_status(webView); + if (status == WEBKIT_LOAD_FINISHED) { + gtk_test_widget_send_key(GTK_WIDGET(fixture->webView), + gdk_unicode_to_keyval('a'), 0); + } + +} + +gboolean map_event_cb(GtkWidget *widget, GdkEvent* event, gpointer data) +{ + gtk_widget_grab_focus(widget); + KeyEventFixture* fixture = (KeyEventFixture*)data; + + g_signal_connect(fixture->webView, "key-press-event", + G_CALLBACK(key_press_event_cb), fixture); + g_signal_connect(fixture->webView, "key-release-event", + G_CALLBACK(key_release_event_cb), fixture); + + g_signal_connect(fixture->webView, "notify::load-status", + G_CALLBACK(load_status_cb), fixture); + + webkit_web_view_load_string(fixture->webView, fixture->info->page, + "text/html", "utf-8", "file://"); + + return FALSE; +} + +static void test_keypress(KeyEventFixture* fixture, gconstpointer data) +{ + fixture->info = (TestInfo*)data; + + g_signal_connect(fixture->window, "map-event", + G_CALLBACK(map_event_cb), fixture); + + gtk_widget_show(fixture->window); + gtk_widget_show(GTK_WIDGET(fixture->webView)); + gtk_window_present(GTK_WINDOW(fixture->window)); + + g_main_loop_run(fixture->loop); + +} + +int main(int argc, char** argv) +{ + g_thread_init(NULL); + gtk_test_init(&argc, &argv, NULL); + + g_test_bug_base("https://bugs.webkit.org/"); + + g_test_add("/webkit/keyevent/textfield", KeyEventFixture, + test_info_new("<html><body><input id=\"in\" type=\"text\">" + "<script>document.getElementById('in').focus();" + "</script></body></html>", TRUE), + key_event_fixture_setup, + test_keypress, + key_event_fixture_teardown); + + g_test_add("/webkit/keyevent/buttons", KeyEventFixture, + test_info_new("<html><body><input id=\"in\" type=\"button\">" + "<script>document.getElementById('in').focus();" + "</script></body></html>", FALSE), + key_event_fixture_setup, + test_keypress, + key_event_fixture_teardown); + + g_test_add("/webkit/keyevent/link", KeyEventFixture, + test_info_new("<html><body><a href=\"http://www.gnome.org\" id=\"in\">" + "LINKY MCLINKERSON</a><script>" + "document.getElementById('in').focus();</script>" + "</body></html>", FALSE), + key_event_fixture_setup, + test_keypress, + key_event_fixture_teardown); + + return g_test_run(); +} + +#else + +int main(int argc, char** argv) +{ + g_critical("You will need at least GTK+ 2.14.0 to run the unit tests."); + return 0; +} + +#endif diff --git a/WebKit/gtk/tests/testloading.c b/WebKit/gtk/tests/testloading.c index cd5f08e..c1f0fac 100644 --- a/WebKit/gtk/tests/testloading.c +++ b/WebKit/gtk/tests/testloading.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Gustavo Noronha Silva + * Copyright (C) 2009 Igalia S.L. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -22,77 +23,201 @@ #if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) -static gboolean has_been_provisional = FALSE; -static gboolean has_been_committed = FALSE; -static gboolean has_been_first_visually_non_empty_layout = FALSE; +typedef struct { + WebKitWebView* webView; + GMainLoop *loop; + gboolean has_been_provisional; + gboolean has_been_committed; + gboolean has_been_first_visually_non_empty_layout; + gboolean has_been_finished; + gboolean has_been_failed; + gboolean has_been_load_error; +} WebLoadingFixture; + +static void web_loading_fixture_setup(WebLoadingFixture* fixture, gconstpointer data) +{ + fixture->webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + fixture->loop = g_main_loop_new(NULL, TRUE); + g_object_ref_sink(fixture->webView); + fixture->has_been_provisional = FALSE; + fixture->has_been_committed = FALSE; + fixture->has_been_first_visually_non_empty_layout = FALSE; + fixture->has_been_finished = FALSE; + fixture->has_been_failed = FALSE; + fixture->has_been_load_error = FALSE; +} -static void load_finished_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, gpointer data) +static void web_loading_fixture_teardown(WebLoadingFixture* fixture, gconstpointer data) { - GMainLoop* loop = (GMainLoop*)data; + g_object_unref(fixture->webView); + g_main_loop_unref(fixture->loop); +} - g_assert(has_been_provisional); - g_assert(has_been_committed); - g_assert(has_been_first_visually_non_empty_layout); +static void load_finished_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, WebLoadingFixture* fixture) +{ + g_assert(fixture->has_been_provisional); + g_assert(fixture->has_been_committed); + g_assert(fixture->has_been_first_visually_non_empty_layout); - g_main_loop_quit(loop); + g_main_loop_quit(fixture->loop); } -static void status_changed_cb(GObject* object, GParamSpec* pspec, gpointer data) +static void status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixture* fixture) { WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(object)); switch (status) { case WEBKIT_LOAD_PROVISIONAL: - g_assert(!has_been_provisional); - g_assert(!has_been_committed); - g_assert(!has_been_first_visually_non_empty_layout); - has_been_provisional = TRUE; + g_assert(!fixture->has_been_provisional); + g_assert(!fixture->has_been_committed); + g_assert(!fixture->has_been_first_visually_non_empty_layout); + fixture->has_been_provisional = TRUE; break; case WEBKIT_LOAD_COMMITTED: - g_assert(has_been_provisional); - g_assert(!has_been_committed); - g_assert(!has_been_first_visually_non_empty_layout); - has_been_committed = TRUE; + g_assert(fixture->has_been_provisional); + g_assert(!fixture->has_been_committed); + g_assert(!fixture->has_been_first_visually_non_empty_layout); + fixture->has_been_committed = TRUE; break; case WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT: - g_assert(has_been_provisional); - g_assert(has_been_committed); - g_assert(!has_been_first_visually_non_empty_layout); - has_been_first_visually_non_empty_layout = TRUE; + g_assert(fixture->has_been_provisional); + g_assert(fixture->has_been_committed); + g_assert(!fixture->has_been_first_visually_non_empty_layout); + fixture->has_been_first_visually_non_empty_layout = TRUE; break; case WEBKIT_LOAD_FINISHED: - g_assert(has_been_provisional); - g_assert(has_been_committed); - g_assert(has_been_first_visually_non_empty_layout); + g_assert(fixture->has_been_provisional); + g_assert(fixture->has_been_committed); + g_assert(fixture->has_been_first_visually_non_empty_layout); break; default: g_assert_not_reached(); } } -static void test_loading_status() +static void test_loading_status(WebLoadingFixture* fixture, gconstpointer data) { - WebKitWebView* web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); - GMainLoop* loop = g_main_loop_new(NULL, TRUE); + g_assert_cmpint(webkit_web_view_get_load_status(fixture->webView), ==, WEBKIT_LOAD_PROVISIONAL); - g_object_ref_sink(web_view); - - g_assert_cmpint(webkit_web_view_get_load_status(web_view), ==, WEBKIT_LOAD_PROVISIONAL); - - g_object_connect(G_OBJECT(web_view), - "signal::notify::load-status", G_CALLBACK(status_changed_cb), NULL, - "signal::load-finished", G_CALLBACK(load_finished_cb), loop, + g_object_connect(G_OBJECT(fixture->webView), + "signal::notify::load-status", G_CALLBACK(status_changed_cb), fixture, + "signal::load-finished", G_CALLBACK(load_finished_cb), fixture, NULL); /* load_uri will trigger the navigation-policy-decision-requested * signal emission; */ - webkit_web_view_load_uri(web_view, "http://gnome.org/"); + webkit_web_view_load_uri(fixture->webView, "http://gnome.org/"); + + g_main_loop_run(fixture->loop); +} + +static void load_error_status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixture* fixture) +{ + WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(object)); + + switch(status) { + case WEBKIT_LOAD_PROVISIONAL: + /* We are going to go through here twice, so don't assert + * anything */ + fixture->has_been_provisional = TRUE; + break; + case WEBKIT_LOAD_FINISHED: + g_assert(fixture->has_been_provisional); + g_assert(fixture->has_been_load_error); + g_assert(fixture->has_been_failed); + /* We are checking that only one FINISHED is received in the + whole cycle, so assert it's FALSE */ + g_assert(!fixture->has_been_finished); + fixture->has_been_finished = TRUE; + g_main_loop_quit(fixture->loop); + break; + case WEBKIT_LOAD_FAILED: + g_assert(!fixture->has_been_failed); + fixture->has_been_failed = TRUE; + break; + default: + break; + } +} + +static gboolean load_error_cb(WebKitWebView* webView, WebKitWebFrame* frame, const char* uri, GError *error, WebLoadingFixture* fixture) +{ + g_assert(fixture->has_been_provisional); + g_assert(!fixture->has_been_load_error); + fixture->has_been_load_error = TRUE; + + return FALSE; +} + +static void test_loading_error(WebLoadingFixture* fixture, gconstpointer data) +{ + g_test_bug("28842"); + + g_signal_connect(fixture->webView, "load-error", G_CALLBACK(load_error_cb), fixture); + g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_error_status_changed_cb), fixture); + + webkit_web_view_load_uri(fixture->webView, "http://snoetuhsetuhseoutoeutc.com/"); + g_main_loop_run(fixture->loop); +} + +/* Cancelled load */ + +static gboolean load_cancelled_cb(WebKitWebView* webView, WebKitWebFrame* frame, const char* uri, GError *error, WebLoadingFixture* fixture) +{ + g_assert(fixture->has_been_provisional); + g_assert(fixture->has_been_failed); + g_assert(!fixture->has_been_load_error); + g_assert(error->code == WEBKIT_NETWORK_ERROR_CANCELLED); + fixture->has_been_load_error = TRUE; + + return TRUE; +} + +static gboolean stop_load (gpointer data) +{ + webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(data)); + return FALSE; +} + +static void load_cancelled_status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixture* fixture) +{ + WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(object)); + + switch(status) { + case WEBKIT_LOAD_PROVISIONAL: + g_assert(!fixture->has_been_provisional); + g_assert(!fixture->has_been_failed); + fixture->has_been_provisional = TRUE; + break; + case WEBKIT_LOAD_COMMITTED: + g_idle_add (stop_load, object); + break; + case WEBKIT_LOAD_FAILED: + g_assert(fixture->has_been_provisional); + g_assert(!fixture->has_been_failed); + g_assert(!fixture->has_been_load_error); + fixture->has_been_failed = TRUE; + g_main_loop_quit(fixture->loop); + break; + case WEBKIT_LOAD_FINISHED: + g_assert_not_reached(); + break; + default: + break; + } +} + +static void test_loading_cancelled(WebLoadingFixture* fixture, gconstpointer data) +{ + g_test_bug("29644"); - g_main_loop_run(loop); + g_signal_connect(fixture->webView, "load-error", G_CALLBACK(load_cancelled_cb), fixture); + g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_cancelled_status_changed_cb), fixture); - g_object_unref(web_view); + webkit_web_view_load_uri(fixture->webView, "http://google.com/"); + g_main_loop_run(fixture->loop); } int main(int argc, char** argv) @@ -101,7 +226,21 @@ int main(int argc, char** argv) gtk_test_init(&argc, &argv, NULL); g_test_bug_base("https://bugs.webkit.org/"); - g_test_add_func("/webkit/loading/status", test_loading_status); + g_test_add("/webkit/loading/status", + WebLoadingFixture, NULL, + web_loading_fixture_setup, + test_loading_status, + web_loading_fixture_teardown); + g_test_add("/webkit/loading/error", + WebLoadingFixture, NULL, + web_loading_fixture_setup, + test_loading_error, + web_loading_fixture_teardown); + g_test_add("/webkit/loading/cancelled", + WebLoadingFixture, NULL, + web_loading_fixture_setup, + test_loading_cancelled, + web_loading_fixture_teardown); return g_test_run(); } diff --git a/WebKit/gtk/tests/testnetworkresponse.c b/WebKit/gtk/tests/testnetworkresponse.c new file mode 100644 index 0000000..9050c04 --- /dev/null +++ b/WebKit/gtk/tests/testnetworkresponse.c @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2009 Gustavo Noronha Silva + * Copyright (C) 2009 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include <errno.h> +#include <unistd.h> +#include <glib.h> +#include <glib/gstdio.h> +#include <gtk/gtk.h> +#include <stdlib.h> +#include <webkit/webkit.h> + +#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) + +static void test_network_response_create_destroy() +{ + WebKitNetworkResponse* response; + SoupMessage* message; + + /* Test creation with URI */ + response = WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "uri", "http://debian.org/", NULL)); + g_assert(WEBKIT_IS_NETWORK_RESPONSE(response)); + message = webkit_network_response_get_message(response); + g_assert(!message); + g_object_unref(response); + + /* Test creation with SoupMessage */ + message = soup_message_new("GET", "http://debian.org/"); + response = WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "message", message, NULL)); + g_assert(WEBKIT_IS_NETWORK_RESPONSE(response)); + g_assert_cmpint(G_OBJECT(message)->ref_count, ==, 2); + g_object_unref(response); + g_assert_cmpint(G_OBJECT(message)->ref_count, ==, 1); + g_object_unref(message); + + /* Test creation with both SoupMessage and URI */ + message = soup_message_new("GET", "http://debian.org/"); + response = WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "message", message, "uri", "http://gnome.org/", NULL)); + g_assert(WEBKIT_IS_NETWORK_RESPONSE(response)); + g_assert_cmpint(G_OBJECT(message)->ref_count, ==, 2); + g_assert_cmpstr(webkit_network_response_get_uri(response), ==, "http://gnome.org/"); + g_object_unref(response); + g_assert_cmpint(G_OBJECT(message)->ref_count, ==, 1); + g_object_unref(message); +} + +static void test_network_response_properties() +{ + WebKitNetworkResponse* response; + SoupMessage* message; + gchar* soupURI; + + /* Test URI is set correctly when creating with URI */ + response = webkit_network_response_new("http://debian.org/"); + g_assert(WEBKIT_IS_NETWORK_RESPONSE(response)); + g_assert_cmpstr(webkit_network_response_get_uri(response), ==, "http://debian.org/"); + g_object_unref(response); + + /* Test URI is set correctly when creating with Message */ + message = soup_message_new("GET", "http://debian.org/"); + response = WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "message", message, NULL)); + g_assert(WEBKIT_IS_NETWORK_RESPONSE(response)); + g_object_unref(message); + + message = webkit_network_response_get_message(response); + soupURI = soup_uri_to_string(soup_message_get_uri(message), FALSE); + g_assert_cmpstr(soupURI, ==, "http://debian.org/"); + g_free(soupURI); + + g_assert_cmpstr(webkit_network_response_get_uri(response), ==, "http://debian.org/"); + g_object_unref(response); +} + +int main(int argc, char** argv) +{ + g_thread_init(NULL); + gtk_test_init(&argc, &argv, NULL); + + g_test_bug_base("https://bugs.webkit.org/"); + g_test_add_func("/webkit/networkresponse/createdestroy", test_network_response_create_destroy); + g_test_add_func("/webkit/networkresponse/properties", test_network_response_properties); + return g_test_run (); +} + +#else +int main(int argc, char** argv) +{ + g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now."); + return 0; +} + +#endif diff --git a/WebKit/gtk/tests/testwebdatasource.c b/WebKit/gtk/tests/testwebdatasource.c new file mode 100644 index 0000000..de2430f --- /dev/null +++ b/WebKit/gtk/tests/testwebdatasource.c @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2009 Jan Michael Alonzo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include <glib.h> +#include <gtk/gtk.h> +#include <webkit/webkit.h> + +#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) + +static const gshort defaultTimeout = 10; +guint waitTimer; +gboolean shouldWait; + +typedef struct { + WebKitWebView* webView; + WebKitWebFrame* mainFrame; +} WebDataSourceFixture; + +static void test_webkit_web_data_source_get_initial_request() +{ + WebKitWebView* view; + WebKitWebFrame* frame; + WebKitWebDataSource* dataSource; + WebKitNetworkRequest* initialRequest; + + view = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(view); + frame = webkit_web_view_get_main_frame(view); + + WebKitNetworkRequest* request = webkit_network_request_new("http://www.google.com"); + webkit_web_frame_load_request(frame, request); + g_object_unref(request); + + dataSource = webkit_web_frame_get_provisional_data_source(frame); + g_assert(dataSource); + initialRequest = webkit_web_data_source_get_initial_request(dataSource); + g_assert_cmpstr(webkit_network_request_get_uri(initialRequest), ==, "http://www.google.com/"); + + g_object_unref(view); +} + +static void load_finished_unreachable_cb(WebKitWebView* view, WebKitWebFrame* frame, GMainLoop* loop) +{ + if (waitTimer) { + g_source_remove(waitTimer); + waitTimer = 0; + } + + WebKitWebDataSource* datasource; + frame = webkit_web_view_get_main_frame(view); + datasource = webkit_web_frame_get_data_source(frame); + + g_assert_cmpstr("http://localhost/doireallyexist.html", ==, + webkit_web_data_source_get_unreachable_uri(datasource)); + + if (g_main_loop_is_running(loop)) + g_main_loop_quit(loop); +} + +static void load_finished_cb(WebKitWebView* view, WebKitWebFrame* frame, GMainLoop* loop) +{ + if (waitTimer) { + g_source_remove(waitTimer); + waitTimer = 0; + } + + WebKitWebDataSource* dataSource; + frame = webkit_web_view_get_main_frame(view); + dataSource = webkit_web_frame_get_data_source(frame); + + /* Test get_request */ + g_test_message("Testing webkit_web_data_source_get_request"); + WebKitNetworkRequest* request = webkit_web_data_source_get_request(dataSource); + g_assert_cmpstr(webkit_network_request_get_uri(request), ==, "http://webkit.org/"); + + /* Test get_main_resource */ + g_test_message("Testing webkit_web_data_source_get_main_resource"); + WebKitWebResource* resource = webkit_web_data_source_get_main_resource(dataSource); + g_assert_cmpstr("text/html", ==, webkit_web_resource_get_mime_type(resource)); + g_assert_cmpstr("http://webkit.org/", ==, webkit_web_resource_get_uri(resource)); + + /* Test get_data. We just test if data has certain size for the mean time */ + g_test_message("Testing webkit_web_data_source_get_data has certain size"); + GString* data = webkit_web_data_source_get_data(dataSource); + g_assert(data->len > 100); + + /* FIXME: Add test for get_encoding */ + + if (g_main_loop_is_running(loop)) + g_main_loop_quit(loop); +} + +static void load_committed_cb(WebKitWebView* view, WebKitWebFrame* frame) +{ + WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(frame); + g_assert(webkit_web_data_source_is_loading(dataSource)); +} + +static gboolean wait_timer_fired(GMainLoop* loop) +{ + waitTimer = 0; + if (g_main_loop_is_running(loop)) + g_main_loop_quit(loop); + + return FALSE; +} + +static void test_webkit_web_data_source() +{ + WebKitWebView* view; + GMainLoop* loop; + + view = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(view); + loop = g_main_loop_new(NULL, TRUE); + g_signal_connect(view, "load-committed", G_CALLBACK(load_committed_cb), loop); + g_signal_connect(view, "load-finished", G_CALLBACK(load_finished_cb), loop); + webkit_web_view_load_uri(view, "http://webkit.org"); + + if (!waitTimer) + waitTimer = g_timeout_add_seconds(defaultTimeout, (GSourceFunc)wait_timer_fired, loop); + + g_main_loop_run(loop); + g_object_unref(view); +} + +static void test_webkit_web_data_source_unreachable_uri() +{ + WebKitWebView* view; + GMainLoop* loop; + + view = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(view); + loop = g_main_loop_new(NULL, TRUE); + g_signal_connect(view, "load-finished", G_CALLBACK(load_finished_unreachable_cb), loop); + webkit_web_view_load_uri(view, "http://localhost/doireallyexist.html"); + + if (!waitTimer) + waitTimer = g_timeout_add_seconds(defaultTimeout, (GSourceFunc)wait_timer_fired, loop); + + g_main_loop_run(loop); + g_object_unref(view); +} + +int main(int argc, char** argv) +{ + g_thread_init(NULL); + gtk_test_init(&argc, &argv, NULL); + + g_test_bug_base("https://bugs.webkit.org/"); + g_test_bug("24758"); + g_test_add_func("/webkit/webdatasource/get_initial_request", + test_webkit_web_data_source_get_initial_request); + g_test_add_func("/webkit/webdatasource/api", + test_webkit_web_data_source); + g_test_add_func("/webkit/webdatasource/unreachable_uri", + test_webkit_web_data_source_unreachable_uri); + return g_test_run (); +} + +#else +int main(int argc, char** argv) +{ + g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now."); + return 0; +} + +#endif diff --git a/WebKit/gtk/tests/testwebresource.c b/WebKit/gtk/tests/testwebresource.c new file mode 100644 index 0000000..b9cd40b --- /dev/null +++ b/WebKit/gtk/tests/testwebresource.c @@ -0,0 +1,332 @@ +/* + * Copyright (C) 2009 Jan Michael Alonzo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include <glib.h> +#include <gtk/gtk.h> +#include <libsoup/soup.h> +#include <string.h> +#include <webkit/webkit.h> + +#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) + +#define INDEX_HTML "<html></html>" +#define MAIN_HTML "<html><head><script language=\"javascript\" src=\"/javascript.js\"></script></head><body><h1>hah</h1></html>" +#define JAVASCRIPT "function blah () { var a = 1; }" + +GMainLoop* loop; +SoupSession *session; +char *base_uri; +WebKitWebResource* main_resource; +WebKitWebResource* sub_resource; + +typedef struct { + WebKitWebResource* webResource; + WebKitWebView* webView; +} WebResourceFixture; + +/* For real request testing */ +static void +server_callback (SoupServer *server, SoupMessage *msg, + const char *path, GHashTable *query, + SoupClientContext *context, gpointer data) +{ + if (msg->method != SOUP_METHOD_GET) { + soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED); + return; + } + + soup_message_set_status (msg, SOUP_STATUS_OK); + + /* Redirect */ + if (g_str_equal (path, "/")) { + soup_message_set_status (msg, SOUP_STATUS_MOVED_PERMANENTLY); + + soup_message_headers_append (msg->response_headers, + "Location", "/index.html"); + } else if (g_str_equal (path, "/index.html")) { + soup_message_body_append (msg->response_body, + SOUP_MEMORY_COPY, + INDEX_HTML, + strlen (INDEX_HTML)); + } else if (g_str_equal (path, "/main.html")) { + soup_message_body_append (msg->response_body, + SOUP_MEMORY_COPY, + MAIN_HTML, + strlen (MAIN_HTML)); + } else if (g_str_equal (path, "/javascript.js")) { + soup_message_body_append (msg->response_body, + SOUP_MEMORY_COPY, + JAVASCRIPT, + strlen (JAVASCRIPT)); + } + + + soup_message_body_complete (msg->response_body); +} + +static void web_resource_fixture_setup(WebResourceFixture* fixture, gconstpointer data) +{ + fixture->webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(fixture->webView); + const gchar* webData = "<html></html>"; + fixture->webResource = webkit_web_resource_new(webData, strlen(webData), "http://example.com/", "text/html", "utf8", "Example.com"); + g_assert(fixture->webResource); +} + +static void web_resource_fixture_teardown(WebResourceFixture* fixture, gconstpointer data) +{ + g_assert(fixture->webResource); + g_object_unref(fixture->webResource); + g_object_unref(fixture->webView); +} + +static void test_webkit_web_resource_get_url(WebResourceFixture* fixture, gconstpointer data) +{ + gchar* url; + g_object_get(G_OBJECT(fixture->webResource), "uri", &url, NULL); + g_assert_cmpstr(url, ==, "http://example.com/"); + g_assert_cmpstr(webkit_web_resource_get_uri(fixture->webResource) ,==,"http://example.com/"); + g_free(url); +} + +static void test_webkit_web_resource_get_data(WebResourceFixture* fixture, gconstpointer data) +{ + GString* charData = webkit_web_resource_get_data(fixture->webResource); + g_assert_cmpstr(charData->str, ==, "<html></html>"); +} + +static void test_webkit_web_resource_get_mime_type(WebResourceFixture* fixture, gconstpointer data) +{ + gchar* mime_type; + g_object_get(G_OBJECT(fixture->webResource), "mime-type", &mime_type, NULL); + g_assert_cmpstr(mime_type, ==, "text/html"); + g_assert_cmpstr(webkit_web_resource_get_mime_type(fixture->webResource),==,"text/html"); + g_free(mime_type); +} + +static void test_webkit_web_resource_get_encoding(WebResourceFixture* fixture, gconstpointer data) +{ + gchar* text_encoding; + g_object_get(G_OBJECT(fixture->webResource), "encoding", &text_encoding, NULL); + g_assert_cmpstr(text_encoding, ==, "utf8"); + g_assert_cmpstr(webkit_web_resource_get_encoding(fixture->webResource),==,"utf8"); + g_free(text_encoding); +} + +static void test_webkit_web_resource_get_frame_name(WebResourceFixture* fixture, gconstpointer data) +{ + gchar* frame_name; + g_object_get(G_OBJECT(fixture->webResource), "frame-name", &frame_name, NULL); + g_assert_cmpstr(frame_name, ==, "Example.com"); + g_assert_cmpstr(webkit_web_resource_get_frame_name(fixture->webResource),==,"Example.com"); + g_free(frame_name); +} + +static void resource_request_starting_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, WebKitWebResource* web_resource, WebKitNetworkRequest* request, WebKitNetworkResponse* response, gpointer data) +{ + gint* been_there = data; + *been_there = *been_there + 1; + + if (*been_there == 1) { + g_assert(!main_resource); + main_resource = g_object_ref(web_resource); + + g_assert_cmpstr(webkit_web_resource_get_uri(web_resource), ==, base_uri); + + /* This should be a redirect, so the response must be NULL */ + g_assert(!response); + } else if (*been_there == 2) { + char* uri = g_strdup_printf("%sindex.html", base_uri); + + g_assert_cmpstr(webkit_web_resource_get_uri(web_resource), ==, uri); + + /* Cancel the request. */ + webkit_network_request_set_uri(request, "about:blank"); + + g_free(uri); + } +} + +static void load_finished_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, gpointer data) +{ + gboolean* been_there = data; + *been_there = TRUE; + + g_assert_cmpstr(webkit_web_view_get_uri(web_view), ==, "about:blank"); + + g_main_loop_quit(loop); +} + +static void test_web_resource_loading() +{ + WebKitWebView* web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); + gint been_to_resource_request_starting = 0; + gboolean been_to_load_finished = FALSE; + WebKitWebFrame* web_frame; + WebKitWebDataSource* data_source; + + loop = g_main_loop_new(NULL, TRUE); + + g_object_ref_sink(web_view); + + g_signal_connect(web_view, "resource-request-starting", + G_CALLBACK(resource_request_starting_cb), + &been_to_resource_request_starting); + + g_signal_connect(web_view, "load-finished", + G_CALLBACK(load_finished_cb), + &been_to_load_finished); + + webkit_web_view_load_uri(web_view, base_uri); + + /* We won't get finished immediately, because of the redirect */ + g_main_loop_run(loop); + + web_frame = webkit_web_view_get_main_frame(web_view); + data_source = webkit_web_frame_get_data_source(web_frame); + + g_assert(main_resource); + g_assert(webkit_web_data_source_get_main_resource(data_source) == main_resource); + g_object_unref(main_resource); + + g_assert_cmpint(been_to_resource_request_starting, ==, 2); + g_assert_cmpint(been_to_load_finished, ==, TRUE); + + g_object_unref(web_view); + g_main_loop_unref(loop); +} + +static void resource_request_starting_sub_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, WebKitWebResource* web_resource, WebKitNetworkRequest* request, WebKitNetworkResponse* response, gpointer data) +{ + if (!main_resource) + main_resource = g_object_ref(web_resource); + else + sub_resource = g_object_ref(web_resource); +} + +static void load_finished_sub_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, gpointer data) +{ + g_main_loop_quit(loop); +} + +static gboolean idle_quit_loop_cb(gpointer data) +{ + g_main_loop_quit(loop); + return FALSE; +} + +static void test_web_resource_sub_resource_loading() +{ + WebKitWebView* web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); + WebKitWebFrame* web_frame; + WebKitWebDataSource* data_source; + GList* sub_resources; + char* uri = g_strdup_printf("%smain.html", base_uri); + + main_resource = NULL; + + loop = g_main_loop_new(NULL, TRUE); + + g_object_ref_sink(web_view); + + g_signal_connect(web_view, "resource-request-starting", + G_CALLBACK(resource_request_starting_sub_cb), + NULL); + + g_signal_connect(web_view, "load-finished", + G_CALLBACK(load_finished_sub_cb), + NULL); + + webkit_web_view_load_uri(web_view, uri); + + g_main_loop_run(loop); + + /* The main resource should be loaded; now let's wait for the sub-resource to load */ + g_idle_add(idle_quit_loop_cb, NULL); + g_main_loop_run(loop); + + g_assert(main_resource && sub_resource); + g_assert(main_resource != sub_resource); + + web_frame = webkit_web_view_get_main_frame(web_view); + data_source = webkit_web_frame_get_data_source(web_frame); + + g_assert(webkit_web_data_source_get_main_resource(data_source) == main_resource); + g_object_unref(main_resource); + + sub_resources = webkit_web_data_source_get_subresources(data_source); + g_assert(sub_resources); + g_assert(!sub_resources->next); + + g_assert(WEBKIT_WEB_RESOURCE(sub_resources->data) == sub_resource); + + g_object_unref(web_view); + g_main_loop_unref(loop); +} + +int main(int argc, char** argv) +{ + SoupServer* server; + SoupURI* soup_uri; + + g_thread_init(NULL); + gtk_test_init(&argc, &argv, NULL); + + server = soup_server_new(SOUP_SERVER_PORT, 0, NULL); + soup_server_run_async(server); + + soup_server_add_handler(server, NULL, server_callback, NULL, NULL); + + soup_uri = soup_uri_new ("http://127.0.0.1/"); + soup_uri_set_port(soup_uri, soup_server_get_port(server)); + + base_uri = soup_uri_to_string(soup_uri, FALSE); + soup_uri_free(soup_uri); + + g_test_bug_base("https://bugs.webkit.org/"); + g_test_add("/webkit/webresource/get_url", + WebResourceFixture, 0, web_resource_fixture_setup, + test_webkit_web_resource_get_url, web_resource_fixture_teardown); + g_test_add("/webkit/webresource/get_mime_type", + WebResourceFixture, 0, web_resource_fixture_setup, + test_webkit_web_resource_get_mime_type, web_resource_fixture_teardown); + g_test_add("/webkit/webresource/get_text_encoding_name", + WebResourceFixture, 0, web_resource_fixture_setup, + test_webkit_web_resource_get_encoding, web_resource_fixture_teardown); + g_test_add("/webkit/webresource/get_frame_name", + WebResourceFixture, 0, web_resource_fixture_setup, + test_webkit_web_resource_get_frame_name, web_resource_fixture_teardown); + g_test_add("/webkit/webresource/get_data", + WebResourceFixture, 0, web_resource_fixture_setup, + test_webkit_web_resource_get_data, web_resource_fixture_teardown); + + g_test_add_func("/webkit/webresource/loading", test_web_resource_loading); + g_test_add_func("/webkit/webresource/sub_resource_loading", test_web_resource_sub_resource_loading); + + return g_test_run (); +} + +#else +int main(int argc, char** argv) +{ + g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now."); + return 0; +} + +#endif diff --git a/WebKit/gtk/tests/testwindow.c b/WebKit/gtk/tests/testwindow.c new file mode 100644 index 0000000..41ff323 --- /dev/null +++ b/WebKit/gtk/tests/testwindow.c @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2009 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include <gtk/gtk.h> +#include <webkit/webkit.h> + +#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) + +static void load_finished_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, gpointer data) +{ + GMainLoop* loop = (GMainLoop*)data; + + g_main_loop_quit(loop); +} + +static void test_webkit_window_scrollbar_policy(void) +{ + GMainLoop* loop; + GtkWidget* scrolledWindow; + GtkWidget* webView; + WebKitWebFrame* mainFrame; + GtkPolicyType horizontalPolicy; + GtkPolicyType verticalPolicy; + + loop = g_main_loop_new(NULL, TRUE); + + scrolledWindow = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledWindow), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + webView = webkit_web_view_new(); + g_object_ref_sink(webView); + + g_signal_connect(webView, "load-finished", + G_CALLBACK(load_finished_cb), loop); + + gtk_container_add(GTK_CONTAINER(scrolledWindow), webView); + + mainFrame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(webView)); + + /* Test we correctly apply policy for not having scrollbars; This + * case is special, because we turn the policy from NEVER to + * AUTOMATIC, since we cannot easily represent the same thing + * using GtkScrolledWindow */ + webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(webView), + "<html><body>WebKit!</body><script>document.getElementsByTagName('body')[0].style.overflow = 'hidden';</script></html>", + "file://"); + + g_main_loop_run(loop); + + gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(scrolledWindow), + &horizontalPolicy, &verticalPolicy); + + g_assert(horizontalPolicy == GTK_POLICY_AUTOMATIC); + g_assert(verticalPolicy == GTK_POLICY_AUTOMATIC); + + g_assert(GTK_POLICY_NEVER == webkit_web_frame_get_horizontal_scrollbar_policy(mainFrame)); + g_assert(GTK_POLICY_NEVER == webkit_web_frame_get_vertical_scrollbar_policy(mainFrame)); + + /* Test we correctly apply policy for always having scrollbars */ + webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(webView), + "<html><body>WebKit!</body><script>document.getElementsByTagName('body')[0].style.overflow = 'scroll';</script></html>", + "file://"); + + g_main_loop_run(loop); + + gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(scrolledWindow), + &horizontalPolicy, &verticalPolicy); + + g_assert(horizontalPolicy == GTK_POLICY_ALWAYS); + g_assert(verticalPolicy == GTK_POLICY_ALWAYS); + + g_assert(horizontalPolicy == webkit_web_frame_get_horizontal_scrollbar_policy(mainFrame)); + g_assert(verticalPolicy == webkit_web_frame_get_vertical_scrollbar_policy(mainFrame)); + + /* Test we correctly apply policy for having scrollbars when needed */ + webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(webView), + "<html><body>WebKit!</body><script>document.getElementsByTagName('body')[0].style.overflow = 'auto';</script></html>", + "file://"); + + g_main_loop_run(loop); + + gtk_scrolled_window_get_policy(GTK_SCROLLED_WINDOW(scrolledWindow), + &horizontalPolicy, &verticalPolicy); + + g_assert(horizontalPolicy == GTK_POLICY_AUTOMATIC); + g_assert(verticalPolicy == GTK_POLICY_AUTOMATIC); + + g_assert(horizontalPolicy == webkit_web_frame_get_horizontal_scrollbar_policy(mainFrame)); + g_assert(verticalPolicy == webkit_web_frame_get_vertical_scrollbar_policy(mainFrame)); + + g_object_unref(webView); +} + +int main(int argc, char** argv) +{ + g_thread_init(NULL); + gtk_test_init(&argc, &argv, NULL); + + g_test_bug_base("https://bugs.webkit.org/"); + g_test_add_func("/webkit/window/scrollbar_policy", test_webkit_window_scrollbar_policy); + return g_test_run (); +} + +#else +int main(int argc, char** argv) +{ + g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now."); + return 0; +} + +#endif diff --git a/WebKit/gtk/webkit/webkit.h b/WebKit/gtk/webkit/webkit.h index c22165e..4cd0709 100644 --- a/WebKit/gtk/webkit/webkit.h +++ b/WebKit/gtk/webkit/webkit.h @@ -24,8 +24,11 @@ #include <webkit/webkitversion.h> #include <webkit/webkitdefines.h> #include <webkit/webkitdownload.h> +#include <webkit/webkithittestresult.h> #include <webkit/webkitnetworkrequest.h> +#include <webkit/webkitnetworkresponse.h> #include <webkit/webkitsoupauthdialog.h> +#include <webkit/webkitwebdatasource.h> #include <webkit/webkitwebframe.h> #include <webkit/webkitwebsettings.h> #include <webkit/webkitwebinspector.h> @@ -35,6 +38,9 @@ #include <webkit/webkitwebhistoryitem.h> #include <webkit/webkitwebpolicydecision.h> #include <webkit/webkitwebnavigationaction.h> +#include <webkit/webkitwebresource.h> +#include <webkit/webkitwebdatabase.h> +#include <webkit/webkitsecurityorigin.h> #include <webkit/webkitenumtypes.h> #endif /* __WEBKIT_H__ */ diff --git a/WebKit/gtk/webkit/webkitdefines.h b/WebKit/gtk/webkit/webkitdefines.h index b0ab5e9..a5884f3 100644 --- a/WebKit/gtk/webkit/webkitdefines.h +++ b/WebKit/gtk/webkit/webkitdefines.h @@ -18,8 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_DEFINES_H -#define WEBKIT_DEFINES_H +#ifndef webkitdefines_h +#define webkitdefines_h #include <glib.h> @@ -44,6 +44,9 @@ G_BEGIN_DECLS typedef struct _WebKitNetworkRequest WebKitNetworkRequest; typedef struct _WebKitNetworkRequestClass WebKitNetworkRequestClass; +typedef struct _WebKitNetworkResponse WebKitNetworkResponse; +typedef struct _WebKitNetworkResponseClass WebKitNetworkResponseClass; + typedef struct _WebKitWebBackForwardList WebKitWebBackForwardList; typedef struct _WebKitWebBackForwardListClass WebKitWebBackForwardListClass; @@ -71,6 +74,21 @@ typedef struct _WebKitWebViewClass WebKitWebViewClass; typedef struct _WebKitDownload WebKitDownload; typedef struct _WebKitDownloadClass WebKitDownloadClass; +typedef struct _WebKitWebResource WebKitWebResource; +typedef struct _WebKitWebResourceClass WebKitWebResourceClass; + +typedef struct _WebKitWebDataSource WebKitWebDataSource; +typedef struct _WebKitWebDataSourceClass WebKitWebDataSourceClass; + +typedef struct _WebKitWebDatabase WebKitWebDatabase; +typedef struct _WebKitWebDatabaseClass WebKitWebDatabaseClass; + +typedef struct _WebKitSecurityOrigin WebKitSecurityOrigin; +typedef struct _WebKitSecurityOriginClass WebKitSecurityOriginClass; + +typedef struct _WebKitHitTestResult WebKitHitTestResult; +typedef struct _WebKitHitTestResultClass WebKitHitTestResultClass; + G_END_DECLS #endif diff --git a/WebKit/gtk/webkit/webkitdownload.cpp b/WebKit/gtk/webkit/webkitdownload.cpp index c0c6ea7..568378c 100644 --- a/WebKit/gtk/webkit/webkitdownload.cpp +++ b/WebKit/gtk/webkit/webkitdownload.cpp @@ -25,6 +25,7 @@ #include "Noncopyable.h" #include "NotImplemented.h" #include "ResourceHandleClient.h" +#include "ResourceHandleInternal.h" #include "ResourceRequest.h" #include "ResourceResponse.h" #include "webkitdownload.h" @@ -100,6 +101,7 @@ enum { G_DEFINE_TYPE(WebKitDownload, webkit_download, G_TYPE_OBJECT); +static void webkit_download_set_response(WebKitDownload* download, const ResourceResponse& response); static void webkit_download_set_status(WebKitDownload* download, WebKitDownloadStatus status); static void webkit_download_dispose(GObject* object) @@ -373,6 +375,25 @@ WebKitDownload* webkit_download_new(WebKitNetworkRequest* request) return WEBKIT_DOWNLOAD(g_object_new(WEBKIT_TYPE_DOWNLOAD, "network-request", request, NULL)); } +// Internal usage only +WebKitDownload* webkit_download_new_with_handle(WebKitNetworkRequest* request, WebCore::ResourceHandle* handle, const WebCore::ResourceResponse& response) +{ + g_return_val_if_fail(request, NULL); + + ResourceHandleInternal* d = handle->getInternal(); + soup_session_pause_message(webkit_get_default_session(), d->m_msg); + + WebKitDownload* download = WEBKIT_DOWNLOAD(g_object_new(WEBKIT_TYPE_DOWNLOAD, "network-request", request, NULL)); + WebKitDownloadPrivate* priv = download->priv; + + handle->ref(); + priv->resourceHandle = handle; + + webkit_download_set_response(download, response); + + return download; +} + static gboolean webkit_download_open_stream_for_uri(WebKitDownload* download, const gchar* uri, gboolean append=FALSE) { g_return_val_if_fail(uri, FALSE); @@ -425,10 +446,14 @@ void webkit_download_start(WebKitDownload* download) g_return_if_fail(priv->status == WEBKIT_DOWNLOAD_STATUS_CREATED); g_return_if_fail(priv->timer == NULL); - if (priv->resourceHandle) - priv->resourceHandle->setClient(priv->downloadClient); - else + if (!priv->resourceHandle) priv->resourceHandle = ResourceHandle::create(core(priv->networkRequest), priv->downloadClient, 0, false, false, false); + else { + priv->resourceHandle->setClient(priv->downloadClient); + + ResourceHandleInternal* d = priv->resourceHandle->getInternal(); + soup_session_unpause_message(webkit_get_default_session(), d->m_msg); + } priv->timer = g_timer_new(); webkit_download_open_stream_for_uri(download, priv->destinationURI); @@ -510,6 +535,9 @@ static void webkit_download_set_response(WebKitDownload* download, const Resourc // FIXME Use WebKitNetworkResponse when it's merged. WebKitDownloadPrivate* priv = download->priv; priv->networkResponse = new ResourceResponse(response); + + if (!response.isNull() && !response.suggestedFilename().isEmpty()) + webkit_download_set_suggested_filename(download, response.suggestedFilename().utf8().data()); } /** @@ -544,6 +572,8 @@ void webkit_download_set_suggested_filename(WebKitDownload* download, const gcha WebKitDownloadPrivate* priv = download->priv; g_free(priv->suggestedFilename); priv->suggestedFilename = g_strdup(suggestedFilename); + + g_object_notify(G_OBJECT(download), "suggested-filename"); } diff --git a/WebKit/gtk/webkit/webkitdownload.h b/WebKit/gtk/webkit/webkitdownload.h index 7c86c65..6e7f38b 100644 --- a/WebKit/gtk/webkit/webkitdownload.h +++ b/WebKit/gtk/webkit/webkitdownload.h @@ -18,8 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_DOWNLOAD_H -#define WEBKIT_DOWNLOAD_H +#ifndef webkitdownload_h +#define webkitdownload_h #include <webkit/webkitdefines.h> diff --git a/WebKit/gtk/webkit/webkiterror.h b/WebKit/gtk/webkit/webkiterror.h index 512bc7d..8fec949 100644 --- a/WebKit/gtk/webkit/webkiterror.h +++ b/WebKit/gtk/webkit/webkiterror.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_ERROR_H -#define WEBKIT_ERROR_H +#ifndef webkiterror_h +#define webkiterror_h #include <glib.h> diff --git a/WebKit/gtk/webkit/webkithittestresult.cpp b/WebKit/gtk/webkit/webkithittestresult.cpp new file mode 100644 index 0000000..be97933 --- /dev/null +++ b/WebKit/gtk/webkit/webkithittestresult.cpp @@ -0,0 +1,193 @@ +/* + * Copyright (C) 2009 Collabora Ltd. + * Copyright (C) 2009 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "webkithittestresult.h" + +#include "CString.h" +#include "GOwnPtr.h" +#include "webkitenumtypes.h" +#include "webkitprivate.h" + +#include <glib/gi18n-lib.h> + +/** + * SECTION:webkithittestresult + * @short_description: The target of a mouse event + * + * This class holds context information about the coordinates + * specified by a GDK event. + */ + +G_DEFINE_TYPE(WebKitHitTestResult, webkit_hit_test_result, G_TYPE_OBJECT) + +struct _WebKitHitTestResultPrivate { + guint context; + char* linkURI; + char* imageURI; + char* mediaURI; +}; + +#define WEBKIT_HIT_TEST_RESULT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_HIT_TEST_RESULT, WebKitHitTestResultPrivate)) + +enum { + PROP_0, + + PROP_CONTEXT, + PROP_LINK_URI, + PROP_IMAGE_URI, + PROP_MEDIA_URI +}; + +static void webkit_hit_test_result_finalize(GObject* object) +{ + WebKitHitTestResult* web_hit_test_result = WEBKIT_HIT_TEST_RESULT(object); + WebKitHitTestResultPrivate* priv = web_hit_test_result->priv; + + g_free(priv->linkURI); + g_free(priv->imageURI); + g_free(priv->mediaURI); + + G_OBJECT_CLASS(webkit_hit_test_result_parent_class)->finalize(object); +} + +static void webkit_hit_test_result_get_property(GObject* object, guint propertyID, GValue* value, GParamSpec* pspec) +{ + WebKitHitTestResult* web_hit_test_result = WEBKIT_HIT_TEST_RESULT(object); + WebKitHitTestResultPrivate* priv = web_hit_test_result->priv; + + switch(propertyID) { + case PROP_CONTEXT: + g_value_set_flags(value, priv->context); + break; + case PROP_LINK_URI: + g_value_set_string(value, priv->linkURI); + break; + case PROP_IMAGE_URI: + g_value_set_string(value, priv->imageURI); + break; + case PROP_MEDIA_URI: + g_value_set_string(value, priv->mediaURI); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, pspec); + } +} + +static void webkit_hit_test_result_set_property(GObject* object, guint propertyID, const GValue* value, GParamSpec* pspec) +{ + WebKitHitTestResult* web_hit_test_result = WEBKIT_HIT_TEST_RESULT(object); + WebKitHitTestResultPrivate* priv = web_hit_test_result->priv; + + switch(propertyID) { + case PROP_CONTEXT: + priv->context = g_value_get_flags(value); + break; + case PROP_LINK_URI: + g_free (priv->linkURI); + priv->linkURI = g_value_dup_string(value); + break; + case PROP_IMAGE_URI: + g_free (priv->imageURI); + priv->imageURI = g_value_dup_string(value); + break; + case PROP_MEDIA_URI: + g_free (priv->mediaURI); + priv->mediaURI = g_value_dup_string(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, pspec); + } +} + +static void webkit_hit_test_result_class_init(WebKitHitTestResultClass* webHitTestResultClass) +{ + GObjectClass* objectClass = G_OBJECT_CLASS(webHitTestResultClass); + + objectClass->finalize = webkit_hit_test_result_finalize; + objectClass->get_property = webkit_hit_test_result_get_property; + objectClass->set_property = webkit_hit_test_result_set_property; + + webkit_init(); + + /** + * WebKitHitTestResult:context: + * + * Flags indicating the kind of target that received the event. + * + * Since: 1.1.15 + */ + g_object_class_install_property(objectClass, PROP_CONTEXT, + g_param_spec_flags("context", + _("Context"), + _("Flags indicating the kind of target that received the event."), + WEBKIT_TYPE_HIT_TEST_RESULT_CONTEXT, + WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT, + static_cast<GParamFlags>((WEBKIT_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)))); + + /** + * WebKitHitTestResult:link-uri: + * + * The URI to which the target that received the event points, if any. + * + * Since: 1.1.15 + */ + g_object_class_install_property(objectClass, PROP_LINK_URI, + g_param_spec_string("link-uri", + _("Link URI"), + _("The URI to which the target that received the event points, if any."), + NULL, + static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY))); + + /** + * WebKitHitTestResult:image-uri: + * + * The URI of the image that is part of the target that received the event, if any. + * + * Since: 1.1.15 + */ + g_object_class_install_property(objectClass, PROP_IMAGE_URI, + g_param_spec_string("image-uri", + _("Image URI"), + _("The URI of the image that is part of the target that received the event, if any."), + NULL, + static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY))); + + /** + * WebKitHitTestResult:media-uri: + * + * The URI of the media that is part of the target that received the event, if any. + * + * Since: 1.1.15 + */ + g_object_class_install_property(objectClass, PROP_MEDIA_URI, + g_param_spec_string("media-uri", + _("Media URI"), + _("The URI of the media that is part of the target that received the event, if any."), + NULL, + static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY))); + + g_type_class_add_private(webHitTestResultClass, sizeof(WebKitHitTestResultPrivate)); +} + +static void webkit_hit_test_result_init(WebKitHitTestResult* web_hit_test_result) +{ + web_hit_test_result->priv = WEBKIT_HIT_TEST_RESULT_GET_PRIVATE(web_hit_test_result); +} diff --git a/WebKit/gtk/webkit/webkithittestresult.h b/WebKit/gtk/webkit/webkithittestresult.h new file mode 100644 index 0000000..6caa84e --- /dev/null +++ b/WebKit/gtk/webkit/webkithittestresult.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2009 Collabora Ltd. + * Copyright (C) 2009 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef webkithittestresult_h +#define webkithittestresult_h + +#include <glib-object.h> + +#include <webkit/webkitdefines.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_HIT_TEST_RESULT (webkit_hit_test_result_get_type()) +#define WEBKIT_HIT_TEST_RESULT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_HIT_TEST_RESULT, WebKitHitTestResult)) +#define WEBKIT_HIT_TEST_RESULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_HIT_TEST_RESULT, WebKitHitTestResultClass)) +#define WEBKIT_IS_HIT_TEST_RESULT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_HIT_TEST_RESULT)) +#define WEBKIT_IS_HIT_TEST_RESULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_HIT_TEST_RESULT)) +#define WEBKIT_HIT_TEST_RESULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_HIT_TEST_RESULT, WebKitHitTestResultClass)) + +typedef struct _WebKitHitTestResultPrivate WebKitHitTestResultPrivate; + +struct _WebKitHitTestResult { + GObject parent_instance; + + /*< private >*/ + WebKitHitTestResultPrivate *priv; +}; + +struct _WebKitHitTestResultClass { + GObjectClass parent_class; + + /* Padding for future expansion */ + void (*_webkit_reserved0) (void); + void (*_webkit_reserved1) (void); + void (*_webkit_reserved2) (void); + void (*_webkit_reserved3) (void); +}; + +/** + * WebKitHitTestResultContext + * @WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT: anywhere in the document. + * @WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK: a hyperlink element. + * @WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE: an image element. + * @WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA: a video or audio element. + * @WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION: the area is selected by + * the user. + * @WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE: the area is + * editable by the user. + */ +typedef enum +{ + WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT = 1 << 1, + WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK = 1 << 2, + WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE = 1 << 3, + WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA = 1 << 4, + WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION = 1 << 5, + WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE = 1 << 6, +} WebKitHitTestResultContext; + +WEBKIT_API GType +webkit_hit_test_result_get_type (void); + +G_END_DECLS + +#endif + diff --git a/WebKit/gtk/webkit/webkitnetworkrequest.cpp b/WebKit/gtk/webkit/webkitnetworkrequest.cpp index e8a225c..be6d5ff 100644 --- a/WebKit/gtk/webkit/webkitnetworkrequest.cpp +++ b/WebKit/gtk/webkit/webkitnetworkrequest.cpp @@ -28,26 +28,17 @@ #include <glib/gi18n-lib.h> -namespace WTF { - -template <> void freeOwnedGPtr<SoupMessage>(SoupMessage* soupMessage) -{ - if (soupMessage) - g_object_unref(soupMessage); -} - -} - /** * SECTION:webkitnetworkrequest * @short_description: The target of a navigation request - * @see_also: #WebKitWebView::navigation-requested + * @see_also: #WebKitWebView::navigation-policy-decision-requested * * This class represents the network related aspects of a navigation - * request. Currently this is only the uri of the target. In the future - * the state of the web form might be added. - * Currently this object is only used along with the - * #WebKitWebView::navigation-requested signal. + * request. It is used whenever WebKit wants to provide information + * about a request that will be sent, or has been sent. Inside it you + * can find the URI of the request, and, for valid URIs, a + * #SoupMessage object, which provides access to further information + * such as headers. * */ @@ -67,18 +58,26 @@ enum { PROP_MESSAGE, }; -static void webkit_network_request_finalize(GObject* object) +static void webkit_network_request_dispose(GObject* object) { WebKitNetworkRequest* request = WEBKIT_NETWORK_REQUEST(object); WebKitNetworkRequestPrivate* priv = request->priv; - g_free(priv->uri); - if (priv->message) { g_object_unref(priv->message); priv->message = NULL; } + G_OBJECT_CLASS(webkit_network_request_parent_class)->dispose(object); +} + +static void webkit_network_request_finalize(GObject* object) +{ + WebKitNetworkRequest* request = WEBKIT_NETWORK_REQUEST(object); + WebKitNetworkRequestPrivate* priv = request->priv; + + g_free(priv->uri); + G_OBJECT_CLASS(webkit_network_request_parent_class)->finalize(object); } @@ -119,6 +118,7 @@ static void webkit_network_request_class_init(WebKitNetworkRequestClass* request { GObjectClass* objectClass = G_OBJECT_CLASS(requestClass); + objectClass->dispose = webkit_network_request_dispose; objectClass->finalize = webkit_network_request_finalize; objectClass->get_property = webkit_network_request_get_property; objectClass->set_property = webkit_network_request_set_property; @@ -213,10 +213,7 @@ void webkit_network_request_set_uri(WebKitNetworkRequest* request, const gchar* return; SoupURI* soupURI = soup_uri_new(uri); - if (!soupURI) { - g_warning("Invalid URI: %s", uri); - return; - } + g_return_if_fail(soupURI); soup_message_set_uri(priv->message, soupURI); soup_uri_free(soupURI); diff --git a/WebKit/gtk/webkit/webkitnetworkrequest.h b/WebKit/gtk/webkit/webkitnetworkrequest.h index 78e04a1..825ca9e 100644 --- a/WebKit/gtk/webkit/webkitnetworkrequest.h +++ b/WebKit/gtk/webkit/webkitnetworkrequest.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_NETWORK_REQUEST_H -#define WEBKIT_NETWORK_REQUEST_H +#ifndef webkitnetworkrequest_h +#define webkitnetworkrequest_h #include <glib-object.h> #include <libsoup/soup.h> diff --git a/WebKit/gtk/webkit/webkitnetworkresponse.cpp b/WebKit/gtk/webkit/webkitnetworkresponse.cpp new file mode 100644 index 0000000..33bcd28 --- /dev/null +++ b/WebKit/gtk/webkit/webkitnetworkresponse.cpp @@ -0,0 +1,261 @@ +/* + * Copyright (C) 2007, 2008 Holger Hans Peter Freyther + * Copyright (C) 2009 Gustavo Noronha Silva + * Copyright (C) 2009 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "webkitnetworkresponse.h" + +#include "GOwnPtr.h" +#include "ResourceResponse.h" +#include "webkitprivate.h" + +#include <glib/gi18n-lib.h> + +/** + * SECTION:webkitnetworkresponse + * @short_description: the response given to a network request + * @see_also: #WebKitNetworkRequest + * + * This class represents the network related aspects of a navigation + * response. + * + * Since: 1.1.14 + */ + +G_DEFINE_TYPE(WebKitNetworkResponse, webkit_network_response, G_TYPE_OBJECT); + +struct _WebKitNetworkResponsePrivate { + gchar* uri; + SoupMessage* message; +}; + +#define WEBKIT_NETWORK_RESPONSE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_NETWORK_RESPONSE, WebKitNetworkResponsePrivate)) + +enum { + PROP_0, + + PROP_URI, + PROP_MESSAGE, +}; + +static void webkit_network_response_dispose(GObject* object) +{ + WebKitNetworkResponse* response = WEBKIT_NETWORK_RESPONSE(object); + WebKitNetworkResponsePrivate* priv = response->priv; + + if (priv->message) { + g_object_unref(priv->message); + priv->message = NULL; + } + + G_OBJECT_CLASS(webkit_network_response_parent_class)->dispose(object); +} + +static void webkit_network_response_finalize(GObject* object) +{ + WebKitNetworkResponse* response = WEBKIT_NETWORK_RESPONSE(object); + WebKitNetworkResponsePrivate* priv = response->priv; + + g_free(priv->uri); + + G_OBJECT_CLASS(webkit_network_response_parent_class)->finalize(object); +} + +static void webkit_network_response_get_property(GObject* object, guint propertyID, GValue* value, GParamSpec* pspec) +{ + WebKitNetworkResponse* response = WEBKIT_NETWORK_RESPONSE(object); + + switch(propertyID) { + case PROP_URI: + g_value_set_string(value, webkit_network_response_get_uri(response)); + break; + case PROP_MESSAGE: + g_value_set_object(value, webkit_network_response_get_message(response)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, pspec); + } +} + +static void webkit_network_response_set_property(GObject* object, guint propertyID, const GValue* value, GParamSpec* pspec) +{ + WebKitNetworkResponse* response = WEBKIT_NETWORK_RESPONSE(object); + WebKitNetworkResponsePrivate* priv = response->priv; + + switch(propertyID) { + case PROP_URI: + webkit_network_response_set_uri(response, g_value_get_string(value)); + break; + case PROP_MESSAGE: + priv->message = SOUP_MESSAGE(g_value_dup_object(value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, pspec); + } +} + +static void webkit_network_response_class_init(WebKitNetworkResponseClass* responseClass) +{ + GObjectClass* objectClass = G_OBJECT_CLASS(responseClass); + + objectClass->dispose = webkit_network_response_dispose; + objectClass->finalize = webkit_network_response_finalize; + objectClass->get_property = webkit_network_response_get_property; + objectClass->set_property = webkit_network_response_set_property; + + webkit_init(); + + /** + * WebKitNetworkResponse:uri: + * + * The URI to which the response will be made. + * + * Since: 1.1.14 + */ + g_object_class_install_property(objectClass, PROP_URI, + g_param_spec_string("uri", + _("URI"), + _("The URI to which the response will be made."), + NULL, + (GParamFlags)(WEBKIT_PARAM_READWRITE))); + + /** + * WebKitNetworkResponse:message: + * + * The #SoupMessage that backs the response. + * + * Since: 1.1.14 + */ + g_object_class_install_property(objectClass, PROP_MESSAGE, + g_param_spec_object("message", + _("Message"), + _("The SoupMessage that backs the response."), + SOUP_TYPE_MESSAGE, + (GParamFlags)(WEBKIT_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY))); + + g_type_class_add_private(responseClass, sizeof(WebKitNetworkResponsePrivate)); +} + +static void webkit_network_response_init(WebKitNetworkResponse* response) +{ + response->priv = WEBKIT_NETWORK_RESPONSE_GET_PRIVATE(response); +} + +// for internal use only +WebKitNetworkResponse* webkit_network_response_new_with_core_response(const WebCore::ResourceResponse& resourceResponse) +{ + GOwnPtr<SoupMessage> soupMessage(resourceResponse.toSoupMessage()); + if (soupMessage) + return WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "message", soupMessage.get(), NULL)); + + return WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "uri", resourceResponse.url().string().utf8().data(), NULL)); +} + +/** + * webkit_network_response_new: + * @uri: an URI + * + * Creates a new #WebKitNetworkResponse initialized with an URI. + * + * Returns: a new #WebKitNetworkResponse, or %NULL if the URI is + * invalid. + * + * Since: 1.1.14 + */ +WebKitNetworkResponse* webkit_network_response_new(const gchar* uri) +{ + g_return_val_if_fail(uri, NULL); + + return WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "uri", uri, NULL)); +} + +/** + * webkit_network_response_set_uri: + * @response: a #WebKitNetworkResponse + * @uri: an URI + * + * Sets the URI held and used by the given response. When the response + * has an associated #SoupMessage, its URI will also be set by this + * call. + * + * Since: 1.1.14 + */ +void webkit_network_response_set_uri(WebKitNetworkResponse* response, const gchar* uri) +{ + g_return_if_fail(WEBKIT_IS_NETWORK_RESPONSE(response)); + g_return_if_fail(uri); + + WebKitNetworkResponsePrivate* priv = response->priv; + + if (priv->uri) + g_free(priv->uri); + priv->uri = g_strdup(uri); + + if (!priv->message) + return; + + SoupURI* soupURI = soup_uri_new(uri); + g_return_if_fail(soupURI); + + soup_message_set_uri(priv->message, soupURI); + soup_uri_free(soupURI); +} + +/** + * webkit_network_response_get_uri: + * @response: a #WebKitNetworkResponse + * + * Returns: the uri of the #WebKitNetworkResponse + * + * Since: 1.1.14 + */ +G_CONST_RETURN gchar* webkit_network_response_get_uri(WebKitNetworkResponse* response) +{ + g_return_val_if_fail(WEBKIT_IS_NETWORK_RESPONSE(response), NULL); + + WebKitNetworkResponsePrivate* priv = response->priv; + + if (priv->uri) + return priv->uri; + + SoupURI* soupURI = soup_message_get_uri(priv->message); + priv->uri = soup_uri_to_string(soupURI, FALSE); + return priv->uri; +} + +/** + * webkit_network_response_get_soup_message: + * @response: a #WebKitNetworkResponse + * + * Obtains the #SoupMessage that represents the given response. Notice + * that only the response side of the HTTP conversation is + * represented. + * + * Returns: the #SoupMessage + * Since: 1.1.14 + */ +SoupMessage* webkit_network_response_get_message(WebKitNetworkResponse* response) +{ + g_return_val_if_fail(WEBKIT_IS_NETWORK_RESPONSE(response), NULL); + + WebKitNetworkResponsePrivate* priv = response->priv; + + return priv->message; +} diff --git a/WebKit/gtk/webkit/webkitnetworkresponse.h b/WebKit/gtk/webkit/webkitnetworkresponse.h new file mode 100644 index 0000000..a00308d --- /dev/null +++ b/WebKit/gtk/webkit/webkitnetworkresponse.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2009 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef webkitnewtorkresponse_h +#define webkitnewtorkresponse_h + +#include <glib-object.h> +#include <libsoup/soup.h> + +#include <webkit/webkitdefines.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_NETWORK_RESPONSE (webkit_network_response_get_type()) +#define WEBKIT_NETWORK_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NETWORK_RESPONSE, WebKitNetworkResponse)) +#define WEBKIT_NETWORK_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_NETWORK_RESPONSE, WebKitNetworkResponseClass)) +#define WEBKIT_IS_NETWORK_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_NETWORK_RESPONSE)) +#define WEBKIT_IS_NETWORK_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_NETWORK_RESPONSE)) +#define WEBKIT_NETWORK_RESPONSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_NETWORK_RESPONSE, WebKitNetworkResponseClass)) + +typedef struct _WebKitNetworkResponsePrivate WebKitNetworkResponsePrivate; + +struct _WebKitNetworkResponse { + GObject parent_instance; + + /*< private >*/ + WebKitNetworkResponsePrivate *priv; +}; + +struct _WebKitNetworkResponseClass { + GObjectClass parent_class; + + /* Padding for future expansion */ + void (*_webkit_reserved0) (void); + void (*_webkit_reserved1) (void); + void (*_webkit_reserved2) (void); + void (*_webkit_reserved3) (void); +}; + +WEBKIT_API GType +webkit_network_response_get_type (void); + +WEBKIT_API WebKitNetworkResponse * +webkit_network_response_new (const gchar *uri); + +WEBKIT_API void +webkit_network_response_set_uri (WebKitNetworkResponse *response, + const gchar* uri); + +WEBKIT_API G_CONST_RETURN gchar * +webkit_network_response_get_uri (WebKitNetworkResponse *response); + +WEBKIT_API SoupMessage * +webkit_network_response_get_message(WebKitNetworkResponse* response); + +G_END_DECLS + +#endif diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp index 755b4d3..4425dcd 100644 --- a/WebKit/gtk/webkit/webkitprivate.cpp +++ b/WebKit/gtk/webkit/webkitprivate.cpp @@ -27,6 +27,7 @@ #include "Frame.h" #include "FrameLoader.h" #include "FrameLoaderClientGtk.h" +#include "HitTestResult.h" #include <libintl.h> #include "Logging.h" #include "PageCache.h" @@ -37,6 +38,7 @@ #include "ResourceHandleClient.h" #include "ResourceHandleInternal.h" #include <runtime/InitializeThreading.h> +#include "SecurityOrigin.h" #if ENABLE(DATABASE) #include "DatabaseTracker.h" @@ -97,7 +99,7 @@ WebKitWebNavigationReason kit(WebCore::NavigationType type) WebCore::NavigationType core(WebKitWebNavigationReason type) { - return (WebCore::NavigationType)type; + return static_cast<WebCore::NavigationType>(type); } WebCore::ResourceRequest core(WebKitNetworkRequest* request) @@ -110,8 +112,77 @@ WebCore::ResourceRequest core(WebKitNetworkRequest* request) return ResourceRequest(url); } +WebCore::EditingBehavior core(WebKitEditingBehavior type) +{ + return (WebCore::EditingBehavior)type; +} + +WebKitHitTestResult* kit(const WebCore::HitTestResult& result) +{ + guint context = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT; + GOwnPtr<char> linkURI(0); + GOwnPtr<char> imageURI(0); + GOwnPtr<char> mediaURI(0); + + if (!result.absoluteLinkURL().isEmpty()) { + context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK; + linkURI.set(g_strdup(result.absoluteLinkURL().string().utf8().data())); + } + + if (!result.absoluteImageURL().isEmpty()) { + context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE; + imageURI.set(g_strdup(result.absoluteImageURL().string().utf8().data())); + } + + if (!result.absoluteMediaURL().isEmpty()) { + context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA; + mediaURI.set(g_strdup(result.absoluteMediaURL().string().utf8().data())); + } + + if (result.isSelected()) + context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION; + + if (result.isContentEditable()) + context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE; + + return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT, + "link-uri", linkURI.get(), + "image-uri", imageURI.get(), + "media-uri", mediaURI.get(), + "context", context, + NULL)); +} + } /** end namespace WebKit */ +namespace WTF { + +template <> void freeOwnedGPtr<SoupMessage>(SoupMessage* soupMessage) +{ + if (soupMessage) + g_object_unref(soupMessage); +} + +template <> void freeOwnedGPtr<WebKitNetworkRequest>(WebKitNetworkRequest* request) +{ + if (request) + g_object_unref(request); +} + +template <> void freeOwnedGPtr<WebKitNetworkResponse>(WebKitNetworkResponse* response) +{ + if (response) + g_object_unref(response); +} + +template <> void freeOwnedGPtr<WebKitWebResource>(WebKitWebResource* resource) +{ + if (resource) + g_object_unref(resource); +} + +} + static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMessage* message, gpointer userData) { gpointer messageData = g_object_get_data(G_OBJECT(message), "resourceHandle"); @@ -130,7 +201,7 @@ static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMes if (!frame) return NULL; - GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(frame->page()->chrome()->platformWindow())); + GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(frame->page()->chrome()->platformPageClient())); if (GTK_WIDGET_TOPLEVEL(toplevel)) return toplevel; else @@ -156,9 +227,10 @@ void webkit_init() WebCore::pageCache()->setCapacity(3); #if ENABLE(DATABASE) - // FIXME: It should be possible for client applications to override this default location gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL); - WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(databaseDirectory); + webkit_set_web_database_directory_path(databaseDirectory); + + // FIXME: It should be possible for client applications to override the default appcache location WebCore::cacheStorage().setCacheDirectory(databaseDirectory); g_free(databaseDirectory); #endif @@ -178,3 +250,13 @@ void webkit_init() soup_session_add_feature(session, sniffer); g_object_unref(sniffer); } + +void webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains) +{ + SecurityOrigin::whiteListAccessFromOrigin(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains); +} + +void webkit_reset_origin_access_white_lists() +{ + SecurityOrigin::resetOriginAccessWhiteLists(); +} diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index 0c3fbd3..44dac04 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -19,8 +19,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_PRIVATE_H -#define WEBKIT_PRIVATE_H +#ifndef webkitprivate_h +#define webkitprivate_h /* * This file knows the shared secret of WebKitWebView, WebKitWebFrame, @@ -30,18 +30,25 @@ #include <webkit/webkitdefines.h> #include <webkit/webkitdownload.h> +#include <webkit/webkithittestresult.h> #include <webkit/webkitnetworkrequest.h> #include <webkit/webkitwebview.h> +#include <webkit/webkitwebdatasource.h> #include <webkit/webkitwebframe.h> #include <webkit/webkitwebpolicydecision.h> #include <webkit/webkitwebnavigationaction.h> +#include <webkit/webkitwebresource.h> #include <webkit/webkitwebsettings.h> #include <webkit/webkitwebwindowfeatures.h> #include <webkit/webkitwebbackforwardlist.h> #include <webkit/webkitnetworkrequest.h> +#include <webkit/webkitsecurityorigin.h> +#include "ArchiveResource.h" #include "BackForwardList.h" +#include "CString.h" #include <enchant.h> +#include "GOwnPtr.h" #include "HistoryItem.h" #include "Settings.h" #include "Page.h" @@ -52,6 +59,7 @@ #include "ResourceRequest.h" #include "ResourceResponse.h" #include "WindowFeatures.h" +#include "SecurityOrigin.h" #include <atk/atk.h> #include <glib.h> @@ -60,6 +68,9 @@ class DownloadClient; namespace WebKit { + + class DocumentLoader; + WebKitWebView* getViewFromFrame(WebKitWebFrame*); WebCore::Frame* core(WebKitWebFrame*); @@ -77,6 +88,15 @@ namespace WebKit { WebCore::NavigationType core(WebKitWebNavigationReason reason); WebCore::ResourceRequest core(WebKitNetworkRequest* request); + + WebCore::ResourceResponse core(WebKitNetworkResponse* response); + + WebCore::EditingBehavior core(WebKitEditingBehavior type); + + WebKitSecurityOrigin* kit(WebCore::SecurityOrigin*); + WebCore::SecurityOrigin* core(WebKitSecurityOrigin*); + + WebKitHitTestResult* kit(const WebCore::HitTestResult&); } typedef struct { @@ -101,6 +121,7 @@ extern "C" { WebKitWebFrame* mainFrame; WebKitWebBackForwardList* backForwardList; + GtkMenu* currentMenu; gint lastPopupXPosition; gint lastPopupYPosition; @@ -123,6 +144,12 @@ extern "C" { gboolean disposing; gboolean usePrimaryForPaste; + + // These are hosted here because the DataSource object is + // created too late in the frame loading process. + WebKitWebResource* mainResource; + char* mainResourceIdentifier; + GHashTable* subResources; }; #define WEBKIT_WEB_FRAME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate)) @@ -135,6 +162,17 @@ extern "C" { gchar* title; gchar* uri; WebKitLoadStatus loadStatus; + WebKitSecurityOrigin* origin; + }; + +#define WEBKIT_SECURITY_ORIGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_SECURITY_ORIGIN, WebKitSecurityOriginPrivate)) + struct _WebKitSecurityOriginPrivate { + RefPtr<WebCore::SecurityOrigin> coreOrigin; + gchar* protocol; + gchar* host; + GHashTable* webDatabases; + + gboolean disposed; }; PassRefPtr<WebCore::Frame> @@ -157,6 +195,26 @@ extern "C" { webkit_web_history_item_get_children(WebKitWebHistoryItem*); // end WebKitWebHistoryItem private + // WebKitWebResource private + #define WEBKIT_WEB_RESOURCE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_RESOURCE, WebKitWebResourcePrivate)) + struct _WebKitWebResourcePrivate { + WebCore::ArchiveResource* resource; + + gchar* uri; + gchar* mimeType; + gchar* textEncoding; + gchar* frameName; + + GString* data; + }; + WebKitWebResource* + webkit_web_resource_new_with_core_resource(PassRefPtr<WebCore::ArchiveResource>); + + void + webkit_web_resource_init_with_core_resource(WebKitWebResource*, PassRefPtr<WebCore::ArchiveResource>); + + // end WebKitWebResource private + void webkit_web_inspector_set_inspector_client(WebKitWebInspector*, WebCore::Page*); @@ -173,7 +231,25 @@ extern "C" { webkit_web_view_notify_ready (WebKitWebView* web_view); void - webkit_web_view_request_download(WebKitWebView* web_view, WebKitNetworkRequest* request, const WebCore::ResourceResponse& response = WebCore::ResourceResponse()); + webkit_web_view_request_download(WebKitWebView* web_view, WebKitNetworkRequest* request, const WebCore::ResourceResponse& response = WebCore::ResourceResponse(), WebCore::ResourceHandle* handle = 0); + + void + webkit_web_view_add_resource(WebKitWebView*, char*, WebKitWebResource*); + + WebKitWebResource* + webkit_web_view_get_resource(WebKitWebView*, char*); + + WebKitWebResource* + webkit_web_view_get_main_resource(WebKitWebView*); + + void + webkit_web_view_clear_resources(WebKitWebView*); + + GList* + webkit_web_view_get_subresources(WebKitWebView*); + + WebKitDownload* + webkit_download_new_with_handle(WebKitNetworkRequest* request, WebCore::ResourceHandle* handle, const WebCore::ResourceResponse& response); void webkit_download_set_suggested_filename(WebKitDownload* download, const gchar* suggestedFilename); @@ -187,6 +263,9 @@ extern "C" { WebKitNetworkRequest* webkit_network_request_new_with_core_request(const WebCore::ResourceRequest& resourceRequest); + WebKitNetworkResponse* + webkit_network_response_new_with_core_response(const WebCore::ResourceResponse& resourceResponse); + // FIXME: move this to webkitnetworkrequest.h once the API is agreed upon. WEBKIT_API SoupMessage* webkit_network_request_get_message(WebKitNetworkRequest* request); @@ -206,6 +285,9 @@ extern "C" { WEBKIT_API gchar* webkit_web_frame_dump_render_tree (WebKitWebFrame* frame); + WEBKIT_API guint + webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame); + WEBKIT_API bool webkit_web_frame_pause_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element); @@ -250,6 +332,32 @@ extern "C" { WEBKIT_API void webkit_application_cache_set_maximum_size(unsigned long long size); + + WEBKIT_API unsigned int + webkit_worker_thread_count(); + + WEBKIT_API void + webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains); + + WEBKIT_API void + webkit_reset_origin_access_white_lists(); + + // WebKitWebDataSource private + WebKitWebDataSource* + webkit_web_data_source_new_with_loader(PassRefPtr<WebKit::DocumentLoader>); + + WEBKIT_API WebKitWebDatabase * + webkit_security_origin_get_web_database(WebKitSecurityOrigin* securityOrigin, const char* databaseName); + + WEBKIT_API void + webkit_web_frame_layout(WebKitWebFrame* frame); +} + +namespace WTF { + template <> void freeOwnedGPtr<SoupMessage>(SoupMessage*); + template <> void freeOwnedGPtr<WebKitNetworkRequest>(WebKitNetworkRequest*); + template <> void freeOwnedGPtr<WebKitNetworkResponse>(WebKitNetworkResponse*); + template <> void freeOwnedGPtr<WebKitWebResource>(WebKitWebResource*); } #endif diff --git a/WebKit/gtk/webkit/webkitsecurityorigin.cpp b/WebKit/gtk/webkit/webkitsecurityorigin.cpp new file mode 100644 index 0000000..cd80236 --- /dev/null +++ b/WebKit/gtk/webkit/webkitsecurityorigin.cpp @@ -0,0 +1,423 @@ +/* + * Copyright (C) 2009 Martin Robinson, Jan Michael C. Alonzo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "webkitwebdatabase.h" + +#include "webkitprivate.h" + +#include "CString.h" +#include "PlatformString.h" +#include "DatabaseTracker.h" + +#include <glib/gi18n-lib.h> + +/** + * SECTION:webkitsecurityorigin + * @short_description: A security boundary for web sites + * + * #WebKitSecurityOrigin is a representation of a security domain defined + * by web sites. An origin consists of a host name, a protocol, and a port + * number. Web sites with the same security origin can access each other's + * resources for client-side scripting or database access. + * + * Use #webkit_web_frame_get_security_origin to get the security origin of a + * #WebKitWebFrame. + * + * Database quotas and usages are also defined per security origin. The + * cumulative disk usage of an origin's databases may be retrieved with + * #webkit_security_origin_get_web_database_usage. An origin's quota can be + * adjusted with #webkit_security_origin_set_web_database_quota. + */ + +using namespace WebKit; + +enum { + PROP_0, + + PROP_PROTOCOL, + PROP_HOST, + PROP_PORT, + PROP_DATABASE_USAGE, + PROP_DATABASE_QUOTA +}; + +G_DEFINE_TYPE(WebKitSecurityOrigin, webkit_security_origin, G_TYPE_OBJECT) + +static void webkit_security_origin_finalize(GObject* object) +{ + WebKitSecurityOrigin* securityOrigin = WEBKIT_SECURITY_ORIGIN(object); + WebKitSecurityOriginPrivate* priv = securityOrigin->priv; + + g_free(priv->protocol); + g_free(priv->host); + + G_OBJECT_CLASS(webkit_security_origin_parent_class)->finalize(object); +} + +static void webkit_security_origin_dispose(GObject* object) +{ + WebKitSecurityOrigin* securityOrigin = WEBKIT_SECURITY_ORIGIN(object); + WebKitSecurityOriginPrivate* priv = securityOrigin->priv; + + if (!priv->disposed) { + priv->coreOrigin->deref(); + g_hash_table_destroy(priv->webDatabases); + priv->disposed = true; + } + + G_OBJECT_CLASS(webkit_security_origin_parent_class)->dispose(object); +} + +static void webkit_security_origin_set_property(GObject* object, guint propId, const GValue* value, GParamSpec* pspec) +{ + WebKitSecurityOrigin* securityOrigin = WEBKIT_SECURITY_ORIGIN(object); + + switch (propId) { + case PROP_DATABASE_QUOTA: + webkit_security_origin_set_web_database_quota(securityOrigin, g_value_get_uint64(value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, pspec); + break; + } +} + +static void webkit_security_origin_get_property(GObject* object, guint propId, GValue* value, GParamSpec* pspec) +{ + WebKitSecurityOrigin* securityOrigin = WEBKIT_SECURITY_ORIGIN(object); + + switch (propId) { + case PROP_PROTOCOL: + g_value_set_string(value, webkit_security_origin_get_protocol(securityOrigin)); + break; + case PROP_HOST: + g_value_set_string(value, webkit_security_origin_get_host(securityOrigin)); + break; + case PROP_PORT: + g_value_set_uint(value, webkit_security_origin_get_port(securityOrigin)); + break; + case PROP_DATABASE_USAGE: + g_value_set_uint64(value, webkit_security_origin_get_web_database_usage(securityOrigin)); + break; + case PROP_DATABASE_QUOTA: + g_value_set_uint64(value, webkit_security_origin_get_web_database_quota(securityOrigin)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, pspec); + break; + } +} + +static GHashTable* webkit_security_origins() +{ + static GHashTable* securityOrigins = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref); + return securityOrigins; +} + +static void webkit_security_origin_class_init(WebKitSecurityOriginClass* klass) +{ + GObjectClass* gobjectClass = G_OBJECT_CLASS(klass); + gobjectClass->dispose = webkit_security_origin_dispose; + gobjectClass->finalize = webkit_security_origin_finalize; + gobjectClass->set_property = webkit_security_origin_set_property; + gobjectClass->get_property = webkit_security_origin_get_property; + + /** + * WebKitSecurityOrigin:protocol: + * + * The protocol of the security origin. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_PROTOCOL, + g_param_spec_string("protocol", + _("Protocol"), + _("The protocol of the security origin"), + NULL, + WEBKIT_PARAM_READABLE)); + + /** + * WebKitSecurityOrigin:host: + * + * The host of the security origin. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_HOST, + g_param_spec_string("host", + _("Host"), + _("The host of the security origin"), + NULL, + WEBKIT_PARAM_READABLE)); + + /** + * WebKitSecurityOrigin:port: + * + * The port of the security origin. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_PORT, + g_param_spec_uint("port", + _("Port"), + _("The port of the security origin"), + 0, G_MAXUSHORT, 0, + WEBKIT_PARAM_READABLE)); + + /** + * WebKitSecurityOrigin:web-database-usage: + * + * The cumulative size of all web databases in the security origin in bytes. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_DATABASE_USAGE, + g_param_spec_uint64("web-database-usage", + _("Web Database Usage"), + _("The cumulative size of all web databases in the security origin"), + 0, G_MAXUINT64, 0, + WEBKIT_PARAM_READABLE)); + /** + * WebKitSecurityOrigin:web-database-quota: + * + * The web database qouta of the security origin in bytes. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_DATABASE_QUOTA, + g_param_spec_uint64("web-database-quota", + _("Web Database Quota"), + _("The web database quota of the security origin in bytes"), + 0, G_MAXUINT64, 0, + WEBKIT_PARAM_READWRITE)); + + g_type_class_add_private(klass, sizeof(WebKitSecurityOriginPrivate)); +} + +static void webkit_security_origin_init(WebKitSecurityOrigin* securityOrigin) +{ + WebKitSecurityOriginPrivate* priv = WEBKIT_SECURITY_ORIGIN_GET_PRIVATE(securityOrigin); + priv->webDatabases = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref); + securityOrigin->priv = priv; +} + +/** + * webkit_security_origin_get_protocol: + * @security_origin: a #WebKitSecurityOrigin + * + * Returns the protocol for the security origin. + * + * Returns: the protocol for the security origin + * + * Since: 1.1.14 + **/ +G_CONST_RETURN gchar* webkit_security_origin_get_protocol(WebKitSecurityOrigin* securityOrigin) +{ + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin), NULL); + + WebKitSecurityOriginPrivate* priv = securityOrigin->priv; + WebCore::String protocol = priv->coreOrigin->protocol(); + + if (!priv->protocol) + priv->protocol = g_strdup(protocol.utf8().data()); + + return priv->protocol; +} + +/** + * webkit_security_origin_get_host: + * @security_origin: a #WebKitSecurityOrigin + * + * Returns the hostname for the security origin. + * + * Returns: the hostname for the security origin + * + * Since: 1.1.14 + **/ +G_CONST_RETURN gchar* webkit_security_origin_get_host(WebKitSecurityOrigin* securityOrigin) +{ + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin), NULL); + + WebKitSecurityOriginPrivate* priv = securityOrigin->priv; + WebCore::String host = priv->coreOrigin->host(); + + if (!priv->host) + priv->host = g_strdup(host.utf8().data()); + + return priv->host; +} + +/** + * webkit_security_origin_get_port: + * @security_origin: a #WebKitSecurityOrigin + * + * Returns the port for the security origin. + * + * Returns: the port for the security origin + * + * Since: 1.1.14 + **/ +guint webkit_security_origin_get_port(WebKitSecurityOrigin* securityOrigin) +{ + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin), 0); + + WebCore::SecurityOrigin* coreOrigin = core(securityOrigin); + return coreOrigin->port(); +} + +/** + * webkit_security_origin_get_web_database_usage: + * @security_origin: a #WebKitSecurityOrigin + * + * Returns the cumulative size of all Web Database database's in the origin + * in bytes. + * + * Returns: the cumulative size of all databases + * + * Since: 1.1.14 + **/ +guint64 webkit_security_origin_get_web_database_usage(WebKitSecurityOrigin* securityOrigin) +{ + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin), 0); + +#if ENABLE(DATABASE) + WebCore::SecurityOrigin* coreOrigin = core(securityOrigin); + return WebCore::DatabaseTracker::tracker().usageForOrigin(coreOrigin); +#else + return 0; +#endif +} + +/** + * webkit_security_origin_get_web_database_quota: + * @security_origin: a #WebKitSecurityOrigin + * + * Returns the quota for Web Database storage of the security origin + * in bytes. + * + * Returns: the Web Database quota + * + * Since: 1.1.14 + **/ +guint64 webkit_security_origin_get_web_database_quota(WebKitSecurityOrigin* securityOrigin) +{ + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin), 0); + +#if ENABLE(DATABASE) + WebCore::SecurityOrigin* coreOrigin = core(securityOrigin); + return WebCore::DatabaseTracker::tracker().quotaForOrigin(coreOrigin); +#else + return 0; +#endif +} + +/** + * webkit_security_origin_set_web_database_quota: + * @security_origin: a #WebKitSecurityOrigin + * @quota: a new Web Database quota in bytes + * + * Adjust the quota for Web Database storage of the security origin + * + * Since: 1.1.14 + **/ +void webkit_security_origin_set_web_database_quota(WebKitSecurityOrigin* securityOrigin, guint64 quota) +{ + g_return_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin)); + +#if ENABLE(DATABASE) + WebCore::SecurityOrigin* coreOrigin = core(securityOrigin); + WebCore::DatabaseTracker::tracker().setQuota(coreOrigin, quota); +#endif +} + +/** + * webkit_security_origin_get_all_web_databases: + * @security_origin: a #WebKitSecurityOrigin + * + * Returns a list of all Web Databases in the security origin. + * + * Returns: a #Glist of databases in the security origin. + * + * Since: 1.1.14 + **/ +GList* webkit_security_origin_get_all_web_databases(WebKitSecurityOrigin* securityOrigin) +{ + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin), NULL); + GList* databases = NULL; + +#if ENABLE(DATABASE) + WebCore::SecurityOrigin* coreOrigin = core(securityOrigin); + Vector<WebCore::String> databaseNames; + + if (!WebCore::DatabaseTracker::tracker().databaseNamesForOrigin(coreOrigin, databaseNames)) + return NULL; + + for (unsigned i = 0; i < databaseNames.size(); ++i) { + WebKitWebDatabase* database = webkit_security_origin_get_web_database(securityOrigin, databaseNames[i].utf8().data()); + databases = g_list_append(databases, database); + } +#endif + + return databases; +} + +WebKitSecurityOrigin* WebKit::kit(WebCore::SecurityOrigin* coreOrigin) +{ + ASSERT(coreOrigin); + + GHashTable* table = webkit_security_origins(); + WebKitSecurityOrigin* origin = (WebKitSecurityOrigin*) g_hash_table_lookup(table, coreOrigin); + + if (!origin) { + origin = WEBKIT_SECURITY_ORIGIN(g_object_new(WEBKIT_TYPE_SECURITY_ORIGIN, NULL)); + origin->priv->coreOrigin = coreOrigin; + g_hash_table_insert(table, coreOrigin, origin); + } + + return origin; +} + + +WebCore::SecurityOrigin* WebKit::core(WebKitSecurityOrigin* securityOrigin) +{ + ASSERT(securityOrigin); + + return securityOrigin->priv->coreOrigin.get(); +} + +WebKitWebDatabase* webkit_security_origin_get_web_database(WebKitSecurityOrigin* securityOrigin, const gchar* databaseName) +{ + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin), NULL); + + WebKitSecurityOriginPrivate* priv = securityOrigin->priv; + GHashTable* databaseHash = priv->webDatabases; + WebKitWebDatabase* database = (WebKitWebDatabase*) g_hash_table_lookup(databaseHash, databaseName); + + if (!database) { + database = WEBKIT_WEB_DATABASE(g_object_new(WEBKIT_TYPE_WEB_DATABASE, + "security-origin", securityOrigin, + "name", databaseName, + NULL)); + g_hash_table_insert(databaseHash, g_strdup(databaseName), database); + } + + return database; +} + diff --git a/WebKit/gtk/webkit/webkitsecurityorigin.h b/WebKit/gtk/webkit/webkitsecurityorigin.h new file mode 100644 index 0000000..57bcd19 --- /dev/null +++ b/WebKit/gtk/webkit/webkitsecurityorigin.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2009 Martin Robinson, Jan Michael C. Alonzo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef webkitsecurityorigin_h +#define webkitsecurityorigin_h + +#include "webkitsecurityorigin.h" +#include "webkitwebdatabase.h" + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_SECURITY_ORIGIN (webkit_security_origin_get_type()) +#define WEBKIT_SECURITY_ORIGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_SECURITY_ORIGIN, WebKitSecurityOrigin)) +#define WEBKIT_SECURITY_ORIGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_SECURITY_ORIGIN, WebKitSecurityOriginClass)) +#define WEBKIT_IS_SECURITY_ORIGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_SECURITY_ORIGIN)) +#define WEBKIT_IS_SECURITY_ORIGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_SECURITY_ORIGIN)) +#define WEBKIT_SECURITY_ORIGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_SECURITY_ORIGIN, WebKitSecurityOriginClass)) + +typedef struct _WebKitSecurityOriginPrivate WebKitSecurityOriginPrivate; + +struct _WebKitSecurityOrigin { + GObject parent_instance; + + /*< private >*/ + WebKitSecurityOriginPrivate* priv; +}; + +struct _WebKitSecurityOriginClass { + GObjectClass parent_class; + + /* Padding for future expansion */ + void (*_webkit_reserved1) (void); + void (*_webkit_reserved2) (void); + void (*_webkit_reserved3) (void); + void (*_webkit_reserved4) (void); +}; + +WEBKIT_API GType +webkit_security_origin_get_type (void); + +WEBKIT_API G_CONST_RETURN gchar* +webkit_security_origin_get_protocol (WebKitSecurityOrigin* securityOrigin); + +WEBKIT_API G_CONST_RETURN gchar* +webkit_security_origin_get_host (WebKitSecurityOrigin* securityOrigin); + +WEBKIT_API guint +webkit_security_origin_get_port (WebKitSecurityOrigin* securityOrigin); + +WEBKIT_API guint64 +webkit_security_origin_get_web_database_usage (WebKitSecurityOrigin* securityOrigin); + +WEBKIT_API guint64 +webkit_security_origin_get_web_database_quota (WebKitSecurityOrigin* securityOrigin); + +WEBKIT_API void +webkit_security_origin_set_web_database_quota (WebKitSecurityOrigin* securityOrigin, guint64 quota); + +WEBKIT_API GList * +webkit_security_origin_get_all_web_databases (WebKitSecurityOrigin* securityOrigin); + +G_END_DECLS + +#endif /* __WEBKIT_SECURITY_ORIGIN_H__ */ diff --git a/WebKit/gtk/webkit/webkitsoupauthdialog.c b/WebKit/gtk/webkit/webkitsoupauthdialog.c index 9bc188e..538dbfa 100644 --- a/WebKit/gtk/webkit/webkitsoupauthdialog.c +++ b/WebKit/gtk/webkit/webkitsoupauthdialog.c @@ -19,25 +19,24 @@ #include "config.h" +#define LIBSOUP_I_HAVE_READ_BUG_594377_AND_KNOW_SOUP_PASSWORD_MANAGER_MIGHT_GO_AWAY + #include <glib/gi18n-lib.h> #include <gtk/gtk.h> #include <libsoup/soup.h> -#if USE(GNOMEKEYRING) -#include <gnome-keyring.h> -#endif #include "webkitmarshal.h" #include "webkitsoupauthdialog.h" /** * SECTION:webkitsoupauthdialog - * @short_description: A #SoupFeature to provide a simple + * @short_description: A #SoupSessionFeature to provide a simple * authentication dialog for HTTP basic auth support. * - * #WebKitSoupAuthDialog is a #SoupFeature that you can attach to your - * #SoupSession to provide a simple authentication dialog, with - * optional GNOME Keyring support, while handling HTTP basic auth. It - * is built as a simple C-only module to ease reuse. + * #WebKitSoupAuthDialog is a #SoupSessionFeature that you can attach to your + * #SoupSession to provide a simple authentication dialog while + * handling HTTP basic auth. It is built as a simple C-only module + * to ease reuse. */ static void webkit_soup_auth_dialog_session_feature_init(SoupSessionFeatureInterface* feature_interface, gpointer interface_data); @@ -88,9 +87,7 @@ typedef struct _WebKitAuthData { SoupSessionFeature* manager; GtkWidget* loginEntry; GtkWidget* passwordEntry; -#if USE(GNOMEKEYRING) GtkWidget* checkButton; -#endif char *username; char *password; } WebKitAuthData; @@ -103,63 +100,53 @@ static void free_authData(WebKitAuthData* authData) g_slice_free(WebKitAuthData, authData); } -#if USE(GNOMEKEYRING) -static void set_password_callback(GnomeKeyringResult result, guint32 val, gpointer user_data) -{ - /* Dummy callback, gnome_keyring_set_network_password does not accept a NULL one */ -} - +#ifdef SOUP_TYPE_PASSWORD_MANAGER static void save_password_callback(SoupMessage* msg, WebKitAuthData* authData) { - /* Check only for Success status codes (2xx) */ - if (msg->status_code >= 200 && msg->status_code < 300) { - SoupURI* uri = soup_message_get_uri(authData->msg); - gnome_keyring_set_network_password(NULL, - authData->username, - soup_auth_get_realm(authData->auth), - uri->host, - NULL, - uri->scheme, - soup_auth_get_scheme_name(authData->auth), - uri->port, - authData->password, - (GnomeKeyringOperationGetIntCallback)set_password_callback, - NULL, - NULL); - } + /* Anything but 401 and 5xx means the password was accepted */ + if (msg->status_code != 401 && msg->status_code < 500) + soup_auth_save_password(authData->auth, authData->username, authData->password); + + /* Disconnect the callback. If the authentication succeeded we are + * done, and if it failed we'll create a new authData and we'll + * connect to 'got-headers' again in response_callback */ + g_signal_handlers_disconnect_by_func(msg, save_password_callback, authData); + free_authData(authData); } #endif static void response_callback(GtkDialog* dialog, gint response_id, WebKitAuthData* authData) { - switch(response_id) { - case GTK_RESPONSE_OK: + gboolean freeAuthData = TRUE; + + if (response_id == GTK_RESPONSE_OK) { authData->username = g_strdup(gtk_entry_get_text(GTK_ENTRY(authData->loginEntry))); authData->password = g_strdup(gtk_entry_get_text(GTK_ENTRY(authData->passwordEntry))); + soup_auth_authenticate(authData->auth, authData->username, authData->password); -#if USE(GNOMEKEYRING) - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(authData->checkButton))) +#ifdef SOUP_TYPE_PASSWORD_MANAGER + if (authData->checkButton && + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(authData->checkButton))) { g_signal_connect(authData->msg, "got-headers", G_CALLBACK(save_password_callback), authData); + freeAuthData = FALSE; + } #endif - default: - break; } soup_session_unpause_message(authData->session, authData->msg); -#if !USE(GNOMEKEYRING) - free_authData(authData); -#endif + if (freeAuthData) + free_authData(authData); gtk_widget_destroy(GTK_WIDGET(dialog)); } static GtkWidget * -table_add_entry (GtkWidget* table, - int row, - const char* label_text, - const char* value, - gpointer user_data) +table_add_entry(GtkWidget* table, + int row, + const char* label_text, + const char* value, + gpointer user_data) { GtkWidget* entry; GtkWidget* label; @@ -182,6 +169,15 @@ table_add_entry (GtkWidget* table, return entry; } +static gboolean session_can_save_passwords(SoupSession* session) +{ +#ifdef SOUP_TYPE_PASSWORD_MANAGER + return soup_session_get_feature(session, SOUP_TYPE_PASSWORD_MANAGER) != NULL; +#else + return FALSE; +#endif +} + static void show_auth_dialog(WebKitAuthData* authData, const char* login, const char* password) { GtkWidget* toplevel; @@ -197,10 +193,8 @@ static void show_auth_dialog(WebKitAuthData* authData, const char* login, const GtkWidget* messageLabel; char* message; SoupURI* uri; -#if USE(GNOMEKEYRING) GtkWidget* rememberBox; GtkWidget* checkButton; -#endif /* From GTK+ gtkmountoperation.c, modified and simplified. LGPL 2 license */ @@ -215,9 +209,9 @@ static void show_auth_dialog(WebKitAuthData* authData, const char* login, const /* Set the dialog up with HIG properties */ gtk_dialog_set_has_separator(dialog, FALSE); - gtk_container_set_border_width(GTK_CONTAINER (dialog), 5); + gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); gtk_box_set_spacing(GTK_BOX(dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width(GTK_CONTAINER (dialog->action_area), 5); + gtk_container_set_border_width(GTK_CONTAINER(dialog->action_area), 5); gtk_box_set_spacing(GTK_BOX(dialog->action_area), 6); gtk_window_set_resizable(window, FALSE); @@ -256,7 +250,7 @@ static void show_auth_dialog(WebKitAuthData* authData, const char* login, const FALSE, FALSE, 0); vbox = gtk_vbox_new(FALSE, 6); - gtk_box_pack_start(GTK_BOX (mainVBox), vbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(mainVBox), vbox, FALSE, FALSE, 0); /* The table that holds the entries */ entryContainer = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); @@ -268,8 +262,8 @@ static void show_auth_dialog(WebKitAuthData* authData, const char* login, const FALSE, FALSE, 0); table = gtk_table_new(2, 2, FALSE); - gtk_table_set_col_spacings(GTK_TABLE (table), 12); - gtk_table_set_row_spacings(GTK_TABLE (table), 6); + gtk_table_set_col_spacings(GTK_TABLE(table), 12); + gtk_table_set_row_spacings(GTK_TABLE(table), 6); gtk_container_add(GTK_CONTAINER(entryContainer), table); authData->loginEntry = table_add_entry(table, 0, _("Username:"), @@ -279,77 +273,55 @@ static void show_auth_dialog(WebKitAuthData* authData, const char* login, const gtk_entry_set_visibility(GTK_ENTRY(authData->passwordEntry), FALSE); -#if USE(GNOMEKEYRING) - rememberBox = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (vbox), rememberBox, - FALSE, FALSE, 0); - - checkButton = gtk_check_button_new_with_mnemonic(_("_Remember password")); - if (login && password) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkButton), TRUE); - gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(checkButton))), TRUE); - gtk_box_pack_start (GTK_BOX (rememberBox), checkButton, FALSE, FALSE, 0); - authData->checkButton = checkButton; -#endif + if (session_can_save_passwords(authData->session)) { + rememberBox = gtk_vbox_new(FALSE, 6); + gtk_box_pack_start(GTK_BOX(vbox), rememberBox, + FALSE, FALSE, 0); + checkButton = gtk_check_button_new_with_mnemonic(_("_Remember password")); + if (login && password) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkButton), TRUE); + gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(checkButton))), TRUE); + gtk_box_pack_start(GTK_BOX(rememberBox), checkButton, FALSE, FALSE, 0); + authData->checkButton = checkButton; + } g_signal_connect(dialog, "response", G_CALLBACK(response_callback), authData); gtk_widget_show_all(widget); } -#if USE(GNOMEKEYRING) -static void find_password_callback(GnomeKeyringResult result, GList* list, WebKitAuthData* authData) -{ - GList* p; - const char* login = NULL; - const char* password = NULL; - - for (p = list; p; p = p->next) { - /* FIXME: support multiple logins/passwords ? */ - GnomeKeyringNetworkPasswordData* data = (GnomeKeyringNetworkPasswordData*)p->data; - login = data->user; - password = data->password; - break; - } - - show_auth_dialog(authData, login, password); -} -#endif - static void session_authenticate(SoupSession* session, SoupMessage* msg, SoupAuth* auth, gboolean retrying, gpointer user_data) { SoupURI* uri; WebKitAuthData* authData; SoupSessionFeature* manager = (SoupSessionFeature*)user_data; +#ifdef SOUP_TYPE_PASSWORD_MANAGER + GSList* users; +#endif + const char *login, *password; soup_session_pause_message(session, msg); /* We need to make sure the message sticks around when pausing it */ g_object_ref(msg); uri = soup_message_get_uri(msg); - authData = g_slice_new(WebKitAuthData); + authData = g_slice_new0(WebKitAuthData); authData->msg = msg; authData->auth = auth; authData->session = session; authData->manager = manager; - /* - * If we have gnome-keyring let's try to find the password first in the ring. - * Otherwise just show the dialog straight away - */ -#if USE(GNOMEKEYRING) - gnome_keyring_find_network_password(NULL, - soup_auth_get_realm(auth), - uri->host, - NULL, - uri->scheme, - soup_auth_get_scheme_name(auth), - uri->port, - (GnomeKeyringOperationGetListCallback)find_password_callback, - authData, - NULL); -#else - show_auth_dialog(authData, NULL, NULL); + login = password = NULL; + +#ifdef SOUP_TYPE_PASSWORD_MANAGER + users = soup_auth_get_saved_users(auth); + if (users) { + login = users->data; + password = soup_auth_get_saved_password(auth, login); + g_slist_free(users); + } #endif + + show_auth_dialog(authData, login, password); } static void attach(SoupSessionFeature* manager, SoupSession* session) diff --git a/WebKit/gtk/webkit/webkitsoupauthdialog.h b/WebKit/gtk/webkit/webkitsoupauthdialog.h index 9721c72..01ccfc8 100644 --- a/WebKit/gtk/webkit/webkitsoupauthdialog.h +++ b/WebKit/gtk/webkit/webkitsoupauthdialog.h @@ -22,8 +22,8 @@ #include <webkit/webkitdefines.h> -#ifndef WEBKIT_SOUP_AUTH_DIALOG_H -#define WEBKIT_SOUP_AUTH_DIALOG_H 1 +#ifndef webkitsoupauthdialog_h +#define webkitsoupauthdialog_h G_BEGIN_DECLS @@ -49,4 +49,4 @@ webkit_soup_auth_dialog_get_type (void); G_END_DECLS -#endif /* WEBKIT_SOUP_AUTH_DIALOG_H */ +#endif /* webkitsoupauthdialog_h */ diff --git a/WebKit/gtk/webkit/webkitversion.h.in b/WebKit/gtk/webkit/webkitversion.h.in index 9f1b818..5eb9426 100644 --- a/WebKit/gtk/webkit/webkitversion.h.in +++ b/WebKit/gtk/webkit/webkitversion.h.in @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_VERSION_H -#define WEBKIT_VERSION_H +#ifndef webkitversion_h +#define webkitversion_h #include <glib.h> #include <webkit/webkitdefines.h> diff --git a/WebKit/gtk/webkit/webkitwebbackforwardlist.h b/WebKit/gtk/webkit/webkitwebbackforwardlist.h index a44cbcd..d08566e 100644 --- a/WebKit/gtk/webkit/webkitwebbackforwardlist.h +++ b/WebKit/gtk/webkit/webkitwebbackforwardlist.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_WEB_BACK_FORWARD_LIST_H -#define WEBKIT_WEB_BACK_FORWARD_LIST_H +#ifndef webkitwebbackforwardlist_h +#define webkitwebbackforwardlist_h #include <glib.h> #include <glib-object.h> @@ -114,4 +114,4 @@ webkit_web_back_forward_list_add_item (WebKitWebBackForwardLi G_END_DECLS -#endif /* WEBKIT_WEB_BACK_FORWARD_LIST_H */ +#endif /* webkitwebbackforwardlist_h */ diff --git a/WebKit/gtk/webkit/webkitwebdatabase.cpp b/WebKit/gtk/webkit/webkitwebdatabase.cpp new file mode 100644 index 0000000..100176e --- /dev/null +++ b/WebKit/gtk/webkit/webkitwebdatabase.cpp @@ -0,0 +1,533 @@ +/* + * Copyright (C) 2009 Martin Robinson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "webkitwebdatabase.h" + +#include "webkitprivate.h" + +#include "CString.h" +#include "DatabaseDetails.h" +#include "DatabaseTracker.h" + +#include <glib/gi18n-lib.h> + +/** + * SECTION:webkitwebdatabase + * @short_description: A WebKit web application database + * + * #WebKitWebDatabase is a representation of a Web Database database. The + * proposed Web Database standard introduces support for SQL databases that web + * sites can create and access on a local computer through JavaScript. + * + * To get access to all databases defined by a security origin, use + * #webkit_security_origin_get_databases. Each database has a canonical + * name, as well as a user-friendly display name. + * + * WebKit uses SQLite to create and access the local SQL databases. The location + * of a #WebKitWebDatabase can be accessed wth #webkit_web_database_get_filename. + * You can configure the location of all databases with + * #webkit_set_database_directory_path. + * + * For each database the web site can define an estimated size which can be + * accessed with #webkit_web_database_get_expected_size. The current size of the + * database in bytes is returned by #webkit_web_database_get_size. + * + * For more information refer to the Web Database specification proposal at + * http://dev.w3.org/html5/webdatabase + */ + +using namespace WebKit; + +enum { + PROP_0, + + PROP_SECURITY_ORIGIN, + PROP_NAME, + PROP_DISPLAY_NAME, + PROP_EXPECTED_SIZE, + PROP_SIZE, + PROP_PATH +}; + +G_DEFINE_TYPE(WebKitWebDatabase, webkit_web_database, G_TYPE_OBJECT) + +struct _WebKitWebDatabasePrivate { + WebKitSecurityOrigin* origin; + gchar* name; + gchar* displayName; + gchar* filename; +}; + +static gchar* webkit_database_directory_path = NULL; +static guint64 webkit_default_database_quota = 5 * 1024 * 1024; + +#define WEBKIT_WEB_DATABASE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_DATABASE, WebKitWebDatabasePrivate)) + +static void webkit_web_database_set_security_origin(WebKitWebDatabase* webDatabase, WebKitSecurityOrigin* security_origin); + +static void webkit_web_database_set_name(WebKitWebDatabase* webDatabase, const gchar* name); + +static void webkit_web_database_finalize(GObject* object) +{ + WebKitWebDatabase* webDatabase = WEBKIT_WEB_DATABASE(object); + WebKitWebDatabasePrivate* priv = webDatabase->priv; + + g_free(priv->name); + g_free(priv->displayName); + g_free(priv->filename); + + G_OBJECT_CLASS(webkit_web_database_parent_class)->finalize(object); +} + +static void webkit_web_database_dispose(GObject* object) +{ + WebKitWebDatabase* webDatabase = WEBKIT_WEB_DATABASE(object); + WebKitWebDatabasePrivate* priv = webDatabase->priv; + + if (priv->origin) { + g_object_unref(priv->origin); + priv->origin = NULL; + } + + G_OBJECT_CLASS(webkit_web_database_parent_class)->dispose(object); +} + +static void webkit_web_database_set_property(GObject* object, guint propId, const GValue* value, GParamSpec* pspec) +{ + WebKitWebDatabase* webDatabase = WEBKIT_WEB_DATABASE(object); + + switch (propId) { + case PROP_SECURITY_ORIGIN: + webkit_web_database_set_security_origin(webDatabase, WEBKIT_SECURITY_ORIGIN(g_value_get_object(value))); + break; + case PROP_NAME: + webkit_web_database_set_name(webDatabase, g_value_get_string(value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, pspec); + break; + } +} + +static void webkit_web_database_get_property(GObject* object, guint propId, GValue* value, GParamSpec* pspec) +{ + WebKitWebDatabase* webDatabase = WEBKIT_WEB_DATABASE(object); + WebKitWebDatabasePrivate* priv = webDatabase->priv; + + switch (propId) { + case PROP_SECURITY_ORIGIN: + g_value_set_object(value, priv->origin); + break; + case PROP_NAME: + g_value_set_string(value, webkit_web_database_get_name(webDatabase)); + break; + case PROP_DISPLAY_NAME: + g_value_set_string(value, webkit_web_database_get_display_name(webDatabase)); + break; + case PROP_EXPECTED_SIZE: + g_value_set_uint64(value, webkit_web_database_get_expected_size(webDatabase)); + break; + case PROP_SIZE: + g_value_set_uint64(value, webkit_web_database_get_size(webDatabase)); + break; + case PROP_PATH: + g_value_set_string(value, webkit_web_database_get_filename(webDatabase)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, pspec); + break; + } +} + +static void webkit_web_database_class_init(WebKitWebDatabaseClass* klass) +{ + GObjectClass* gobjectClass = G_OBJECT_CLASS(klass); + gobjectClass->dispose = webkit_web_database_dispose; + gobjectClass->finalize = webkit_web_database_finalize; + gobjectClass->set_property = webkit_web_database_set_property; + gobjectClass->get_property = webkit_web_database_get_property; + + /** + * WebKitWebDatabase:security-origin: + * + * The security origin of the database. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_SECURITY_ORIGIN, + g_param_spec_object("security-origin", + _("Security Origin"), + _("The security origin of the database"), + WEBKIT_TYPE_SECURITY_ORIGIN, + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); + + /** + * WebKitWebDatabase:name: + * + * The name of the Web Database database. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_NAME, + g_param_spec_string("name", + _("Name"), + _("The name of the Web Database database"), + NULL, + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); + + /** + * WebKitWebDatabase:display-name: + * + * The display name of the Web Database database. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_DISPLAY_NAME, + g_param_spec_string("display-name", + _("Display Name"), + _("The display name of the Web Storage database"), + NULL, + WEBKIT_PARAM_READABLE)); + + /** + * WebKitWebDatabase:expected-size: + * + * The expected size of the database in bytes as defined by the web author. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_EXPECTED_SIZE, + g_param_spec_uint64("expected-size", + _("Expected Size"), + _("The expected size of the Web Database database"), + 0, G_MAXUINT64, 0, + WEBKIT_PARAM_READABLE)); + /** + * WebKitWebDatabase:size: + * + * The current size of the database in bytes. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_SIZE, + g_param_spec_uint64("size", + _("Size"), + _("The current size of the Web Database database"), + 0, G_MAXUINT64, 0, + WEBKIT_PARAM_READABLE)); + /** + * WebKitWebDatabase:filename: + * + * The absolute filename of the Web Database database. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobjectClass, PROP_PATH, + g_param_spec_string("filename", + _("Filename"), + _("The absolute filename of the Web Storage database"), + NULL, + WEBKIT_PARAM_READABLE)); + + g_type_class_add_private(klass, sizeof(WebKitWebDatabasePrivate)); +} + +static void webkit_web_database_init(WebKitWebDatabase* webDatabase) +{ + webDatabase->priv = WEBKIT_WEB_DATABASE_GET_PRIVATE(webDatabase); +} + +// Internal use only +static void webkit_web_database_set_security_origin(WebKitWebDatabase *webDatabase, WebKitSecurityOrigin *securityOrigin) +{ + g_return_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase)); + g_return_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin)); + + WebKitWebDatabasePrivate* priv = webDatabase->priv; + + if (priv->origin) + g_object_unref(priv->origin); + + g_object_ref(securityOrigin); + priv->origin = securityOrigin; +} + +static void webkit_web_database_set_name(WebKitWebDatabase* webDatabase, const gchar* name) +{ + g_return_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase)); + + WebKitWebDatabasePrivate* priv = webDatabase->priv; + g_free(priv->name); + priv->name = g_strdup(name); +} + +/** + * webkit_web_database_get_security_origin: + * @web_database: a #WebKitWebDatabase + * + * Returns the security origin of the #WebKitWebDatabase. + * + * Returns: the security origin of the database + * + * Since: 1.1.14 + **/ +WebKitSecurityOrigin* webkit_web_database_get_security_origin(WebKitWebDatabase* webDatabase) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase), NULL); + WebKitWebDatabasePrivate* priv = webDatabase->priv; + + return priv->origin; +} + +/** + * webkit_web_database_get_name: + * @web_database: a #WebKitWebDatabase + * + * Returns the canonical name of the #WebKitWebDatabase. + * + * Returns: the name of the database + * + * Since: 1.1.14 + **/ +G_CONST_RETURN gchar* webkit_web_database_get_name(WebKitWebDatabase* webDatabase) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase), NULL); + WebKitWebDatabasePrivate* priv = webDatabase->priv; + + return priv->name; +} + +/** + * webkit_web_database_get_display_name: + * @web_database: a #WebKitWebDatabase + * + * Returns the name of the #WebKitWebDatabase as seen by the user. + * + * Returns: the name of the database as seen by the user. + * + * Since: 1.1.14 + **/ +G_CONST_RETURN gchar* webkit_web_database_get_display_name(WebKitWebDatabase* webDatabase) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase), NULL); + +#if ENABLE(DATABASE) + WebKitWebDatabasePrivate* priv = webDatabase->priv; + WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin)); + WebCore::String displayName = details.displayName(); + + if (displayName.isEmpty()) + return ""; + + g_free(priv->displayName); + priv->displayName = g_strdup(displayName.utf8().data()); + return priv->displayName; +#else + return ""; +#endif +} + +/** + * webkit_web_database_get_expected_size: + * @web_database: a #WebKitWebDatabase + * + * Returns the expected size of the #WebKitWebDatabase in bytes as defined by the + * web author. The Web Database standard allows web authors to specify an expected + * size of the database to optimize the user experience. + * + * Returns: the expected size of the database in bytes + * + * Since: 1.1.14 + **/ +guint64 webkit_web_database_get_expected_size(WebKitWebDatabase* webDatabase) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase), 0); + +#if ENABLE(DATABASE) + WebKitWebDatabasePrivate* priv = webDatabase->priv; + WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin)); + return details.expectedUsage(); +#else + return 0; +#endif +} + +/** + * webkit_web_database_get_size: + * @web_database: a #WebKitWebDatabase + * + * Returns the actual size of the #WebKitWebDatabase space on disk in bytes. + * + * Returns: the actual size of the database in bytes + * + * Since: 1.1.14 + **/ +guint64 webkit_web_database_get_size(WebKitWebDatabase* webDatabase) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase), 0); + +#if ENABLE(DATABASE) + WebKitWebDatabasePrivate* priv = webDatabase->priv; + WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin)); + return details.currentUsage(); +#else + return 0; +#endif +} + +/** + * webkit_web_database_get_filename: + * @web_database: a #WebKitWebDatabase + * + * Returns the absolute filename to the #WebKitWebDatabase file on disk. + * + * Returns: the absolute filename of the database + * + * Since: 1.1.14 + **/ +G_CONST_RETURN gchar* webkit_web_database_get_filename(WebKitWebDatabase* webDatabase) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase), NULL); + +#if ENABLE(DATABASE) + WebKitWebDatabasePrivate* priv = webDatabase->priv; + WebCore::String coreName = WebCore::String::fromUTF8(priv->name); + WebCore::String corePath = WebCore::DatabaseTracker::tracker().fullPathForDatabase(core(priv->origin), coreName); + + if (corePath.isEmpty()) + return""; + + g_free(priv->filename); + priv->filename = g_strdup(corePath.utf8().data()); + return priv->filename; + +#else + return ""; +#endif +} + +/** + * webkit_web_database_remove: + * @web_database: a #WebKitWebDatabase + * + * Removes the #WebKitWebDatabase from its security origin and destroys all data + * stored in the database. + * + * Since: 1.1.14 + **/ +void webkit_web_database_remove(WebKitWebDatabase* webDatabase) +{ + g_return_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase)); + +#if ENABLE(DATABASE) + WebKitWebDatabasePrivate* priv = webDatabase->priv; + WebCore::DatabaseTracker::tracker().deleteDatabase(core(priv->origin), priv->name); +#endif +} + +/** + * webkit_remove_all_web_databases: + * + * Removes all web databases from the current database directory path. + * + * Since: 1.1.14 + **/ +void webkit_remove_all_web_databases() +{ +#if ENABLE(DATABASE) + WebCore::DatabaseTracker::tracker().deleteAllDatabases(); +#endif +} + +/** + * webkit_get_web_database_directory_path: + * + * Returns the current path to the directory WebKit will write Web + * Database databases. By default this path will be in the user data + * directory. + * + * Returns: the current database directory path + * + * Since: 1.1.14 + **/ +G_CONST_RETURN gchar* webkit_get_web_database_directory_path() +{ +#if ENABLE(DATABASE) + WebCore::String path = WebCore::DatabaseTracker::tracker().databaseDirectoryPath(); + + if (path.isEmpty()) + return ""; + + g_free(webkit_database_directory_path); + webkit_database_directory_path = g_strdup(path.utf8().data()); + return webkit_database_directory_path; +#else + return ""; +#endif +} + +/** + * webkit_set_web_database_directory_path: + * @path: the new database directory path + * + * Sets the current path to the directory WebKit will write Web + * Database databases. + * + * Since: 1.1.14 + **/ +void webkit_set_web_database_directory_path(const gchar* path) +{ +#if ENABLE(DATABASE) + WebCore::String corePath = WebCore::String::fromUTF8(path); + WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(corePath); + + g_free(webkit_database_directory_path); + webkit_database_directory_path = g_strdup(corePath.utf8().data()); +#endif +} + +/** + * webkit_get_default_web_database_quota: + * + * Returns the default quota for Web Database databases. By default + * this value is 5MB. + + * Returns: the current default database quota in bytes + * + * Since: 1.1.14 + **/ +guint64 webkit_get_default_web_database_quota() +{ + return webkit_default_database_quota; +} + +/** + * webkit_set_default_web_database_quota: + * @default_quota: the new default database quota + * + * Sets the current path to the directory WebKit will write Web + * Database databases. + * + * Since: 1.1.14 + **/ +void webkit_set_default_web_database_quota(guint64 defaultQuota) +{ + webkit_default_database_quota = defaultQuota; +} diff --git a/WebKit/gtk/webkit/webkitwebdatabase.h b/WebKit/gtk/webkit/webkitwebdatabase.h new file mode 100644 index 0000000..8a9a151 --- /dev/null +++ b/WebKit/gtk/webkit/webkitwebdatabase.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2009 Martin Robinson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef webkitwebdatabase_h +#define webkitwebdatabase_h + +#include <glib-object.h> + +#include <webkit/webkitdefines.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_WEB_DATABASE (webkit_web_database_get_type()) +#define WEBKIT_WEB_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_DATABASE, WebKitWebDatabase)) +#define WEBKIT_WEB_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_DATABASE, WebKitWebDatabaseClass)) +#define WEBKIT_IS_WEB_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_DATABASE)) +#define WEBKIT_IS_WEB_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_DATABASE)) +#define WEBKIT_WEB_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_DATABASE, WebKitWebDatabaseClass)) + +typedef struct _WebKitWebDatabasePrivate WebKitWebDatabasePrivate; + +struct _WebKitWebDatabase { + GObject parent_instance; + + /*< private >*/ + WebKitWebDatabasePrivate* priv; +}; + +struct _WebKitWebDatabaseClass { + GObjectClass parent_class; + + /* Padding for future expansion */ + void (*_webkit_reserved1) (void); + void (*_webkit_reserved2) (void); + void (*_webkit_reserved3) (void); + void (*_webkit_reserved4) (void); +}; + +WEBKIT_API GType +webkit_web_database_get_type (void); + +WEBKIT_API WebKitSecurityOrigin * +webkit_web_database_get_security_origin (WebKitWebDatabase* webDatabase); + +WEBKIT_API G_CONST_RETURN gchar* +webkit_web_database_get_name (WebKitWebDatabase* webDatabase); + +WEBKIT_API G_CONST_RETURN gchar* +webkit_web_database_get_display_name (WebKitWebDatabase* webDatabase); + +WEBKIT_API guint64 +webkit_web_database_get_expected_size (WebKitWebDatabase* webDatabase); + +WEBKIT_API guint64 +webkit_web_database_get_size (WebKitWebDatabase* webDatabase); + +WEBKIT_API G_CONST_RETURN gchar* +webkit_web_database_get_filename (WebKitWebDatabase* webDatabase); + +WEBKIT_API void +webkit_web_database_remove (WebKitWebDatabase* webDatabase); + +WEBKIT_API void +webkit_remove_all_web_databases (void); + +WEBKIT_API G_CONST_RETURN gchar* +webkit_get_web_database_directory_path (void); + +WEBKIT_API void +webkit_set_web_database_directory_path (const gchar* path); + +WEBKIT_API guint64 +webkit_get_default_web_database_quota (void); + +WEBKIT_API void +webkit_set_default_web_database_quota (guint64 defaultQuota); + +G_END_DECLS + +#endif /* webkitwebdatabase_h */ diff --git a/WebKit/gtk/webkit/webkitwebdatasource.cpp b/WebKit/gtk/webkit/webkitwebdatasource.cpp new file mode 100644 index 0000000..059688e --- /dev/null +++ b/WebKit/gtk/webkit/webkitwebdatasource.cpp @@ -0,0 +1,436 @@ +/* + * Copyright (C) 2009 Jan Michael C. Alonzo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "webkitwebdatasource.h" + +#include "ArchiveResource.h" +#include "DocumentLoaderGtk.h" +#include "FrameLoaderClientGtk.h" +#include "FrameLoader.h" +#include "KURL.h" +#include "PlatformString.h" +#include "ResourceRequest.h" +#include "runtime/InitializeThreading.h" +#include "SharedBuffer.h" +#include "SubstituteData.h" +#include "webkitwebresource.h" +#include "webkitprivate.h" +#include "wtf/Assertions.h" + +#include <glib.h> + +/** + * SECTION:webkitwebdatasource + * @short_description: Encapsulates the content to be displayed in a #WebKitWebFrame. + * @see_also: #WebKitWebFrame + * + * Data source encapsulates the content of a #WebKitWebFrame. A + * #WebKitWebFrame has a main resource and subresources and the data source + * provides access to these resources. When a request gets loaded initially, + * it is set to a provisional state. The application can request for the + * request that initiated the load by asking for the provisional data source + * and invoking the webkit_web_data_source_get_initial_request method of + * #WebKitWebDataSource. This data source may not have enough data and some + * methods may return empty values. To get a "full" data source with the data + * and resources loaded, you need to get the non-provisional data source + * through #WebKitWebFrame's webkit_web_frame_get_data_source method. This + * data source will have the data after everything was loaded. Make sure that + * the data source was finished loading before using any of its methods. You + * can do this via webkit_web_data_source_is_loading. + */ + +using namespace WebCore; +using namespace WebKit; + +struct _WebKitWebDataSourcePrivate { + WebKit::DocumentLoader* loader; + + WebKitNetworkRequest* initialRequest; + WebKitNetworkRequest* networkRequest; + WebKitWebResource* mainresource; + + GString* data; + + gchar* textEncoding; + gchar* unreachableURL; +}; + +#define WEBKIT_WEB_DATA_SOURCE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_DATA_SOURCE, WebKitWebDataSourcePrivate)) + +G_DEFINE_TYPE(WebKitWebDataSource, webkit_web_data_source, G_TYPE_OBJECT); + +static void webkit_web_data_source_dispose(GObject* object) +{ + WebKitWebDataSource* webDataSource = WEBKIT_WEB_DATA_SOURCE(object); + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + + ASSERT(priv->loader); + ASSERT(!priv->loader->isLoading()); + priv->loader->detachDataSource(); + priv->loader->deref(); + + if (priv->initialRequest) { + g_object_unref(priv->initialRequest); + priv->initialRequest = NULL; + } + + if (priv->networkRequest) { + g_object_unref(priv->networkRequest); + priv->networkRequest = NULL; + } + + if (priv->mainresource) { + g_object_unref(priv->mainresource); + priv->mainresource = NULL; + } + + G_OBJECT_CLASS(webkit_web_data_source_parent_class)->dispose(object); +} + +static void webkit_web_data_source_finalize(GObject* object) +{ + WebKitWebDataSource* dataSource = WEBKIT_WEB_DATA_SOURCE(object); + WebKitWebDataSourcePrivate* priv = dataSource->priv; + + g_free(priv->unreachableURL); + g_free(priv->textEncoding); + + if (priv->data) { + g_string_free(priv->data, TRUE); + priv->data = NULL; + } + + G_OBJECT_CLASS(webkit_web_data_source_parent_class)->finalize(object); +} + +static void webkit_web_data_source_class_init(WebKitWebDataSourceClass* klass) +{ + GObjectClass* gobject_class = G_OBJECT_CLASS(klass); + gobject_class->dispose = webkit_web_data_source_dispose; + gobject_class->finalize = webkit_web_data_source_finalize; + + webkit_init(); + + g_type_class_add_private(gobject_class, sizeof(WebKitWebDataSourcePrivate)); +} + +static void webkit_web_data_source_init(WebKitWebDataSource* webDataSource) +{ + webDataSource->priv = WEBKIT_WEB_DATA_SOURCE_GET_PRIVATE(webDataSource); +} + +WebKitWebDataSource* webkit_web_data_source_new_with_loader(PassRefPtr<WebKit::DocumentLoader> loader) +{ + WebKitWebDataSource* webDataSource = WEBKIT_WEB_DATA_SOURCE(g_object_new(WEBKIT_TYPE_WEB_DATA_SOURCE, NULL)); + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + priv->loader = loader.releaseRef(); + + return webDataSource; +} + +/** + * webkit_web_data_source_new: + * + * Creates a new #WebKitWebDataSource instance. The URL of the + * #WebKitWebDataSource will be set to "about:blank". + * + * Return: a new #WebKitWebDataSource. + * + * Since: 1.1.14 + */ +WebKitWebDataSource* webkit_web_data_source_new() +{ + WebKitNetworkRequest* request = webkit_network_request_new("about:blank"); + WebKitWebDataSource* datasource = webkit_web_data_source_new_with_request(request); + g_object_unref(request); + + return datasource; +} + +/** + * webkit_web_data_source_new_with_request: + * @request: the #WebKitNetworkRequest to use to create this data source + * + * Creates a new #WebKitWebDataSource from a #WebKitNetworkRequest. Normally, + * #WebKitWebFrame objects create their data sources so you will almost never + * want to invoke this method directly. + * + * Returns: a new #WebKitWebDataSource + * + * Since: 1.1.14 + */ +WebKitWebDataSource* webkit_web_data_source_new_with_request(WebKitNetworkRequest* request) +{ + ASSERT(request); + + const gchar* uri = webkit_network_request_get_uri(request); + + WebKitWebDataSource* datasource; + datasource = webkit_web_data_source_new_with_loader( + WebKit::DocumentLoader::create(ResourceRequest(KURL(KURL(), String::fromUTF8(uri))), + SubstituteData())); + + WebKitWebDataSourcePrivate* priv = datasource->priv; + priv->initialRequest = request; + + return datasource; +} + +/** + * webkit_web_data_source_get_web_frame + * @data_source: a #WebKitWebDataSource + * + * Returns the #WebKitWebFrame that represents this data source + * + * Return value: the #WebKitWebFrame that represents the @data_source. The + * #WebKitWebFrame is owned by WebKit and should not be freed or destroyed. + * This will return %NULL of the @data_source is not attached to a frame. + * + * Since: 1.1.14 + */ +WebKitWebFrame* webkit_web_data_source_get_web_frame(WebKitWebDataSource* webDataSource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); + + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + FrameLoader* frameLoader = priv->loader->frameLoader(); + + if (!frameLoader) + return NULL; + + return static_cast<WebKit::FrameLoaderClient*>(frameLoader->client())->webFrame(); +} + +/** + * webkit_web_data_source_get_initial_request: + * @data_source: a #WebKitWebDataSource + * + * Returns a reference to the original request that was used to load the web + * content. The #WebKitNetworkRequest returned by this method is the request + * prior to the "committed" load state. See webkit_web_data_source_get_request + * for getting the "committed" request. + * + * Return value: the original #WebKitNetworkRequest + * + * Since: 1.1.14 + */ +WebKitNetworkRequest* webkit_web_data_source_get_initial_request(WebKitWebDataSource* webDataSource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); + + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + ResourceRequest request = priv->loader->originalRequest(); + + if (priv->initialRequest) + g_object_unref(priv->initialRequest); + + priv->initialRequest = webkit_network_request_new_with_core_request(request); + return priv->initialRequest; +} + +/** + * webkit_web_data_source_get_request: + * @data_source: a #WebKitWebDataSource + * + * Returns a #WebKitNetworkRequest that was used to create this + * #WebKitWebDataSource. The #WebKitNetworkRequest returned by this method is + * the request that was "committed", and hence, different from the request you + * get from the webkit_web_data_source_get_initial_request method. + * + * Return value: the #WebKitNetworkRequest that created the @data_source or + * %NULL if the @data_source is not attached to the frame or the frame hasn't + * been loaded. + * + * Since: 1.1.14 + */ +WebKitNetworkRequest* webkit_web_data_source_get_request(WebKitWebDataSource* webDataSource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); + + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + FrameLoader* frameLoader = priv->loader->frameLoader(); + if (!frameLoader || !frameLoader->frameHasLoaded()) + return NULL; + + ResourceRequest request = priv->loader->request(); + + if (priv->networkRequest) + g_object_unref(priv->networkRequest); + + priv->networkRequest = webkit_network_request_new_with_core_request(request); + return priv->networkRequest; +} + +/** + * webkit_web_data_source_get_encoding: + * @data_source: a #WebKitWebDataSource + * + * Returns the text encoding name as set in the #WebKitWebView, or if not, the + * text encoding of the response. + * + * Return value: the encoding name of the #WebKitWebView or of the response. + * + * Since: 1.1.14 + */ +G_CONST_RETURN gchar* webkit_web_data_source_get_encoding(WebKitWebDataSource* webDataSource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); + + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + String textEncodingName = priv->loader->overrideEncoding(); + + if (!textEncodingName) + textEncodingName = priv->loader->response().textEncodingName(); + + CString encoding = textEncodingName.utf8(); + g_free(priv->textEncoding); + priv->textEncoding = g_strdup(encoding.data()); + return priv->textEncoding; +} + +/** + * webkit_web_data_source_is_loading: + * @data_source: a #WebKitWebDataSource + * + * Determines whether the data source is in the process of loading its content. + * + * Return value: %TRUE if the @data_source is still loading, %FALSE otherwise + * + * Since: 1.1.14 + */ +gboolean webkit_web_data_source_is_loading(WebKitWebDataSource* webDataSource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); + + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + + return priv->loader->isLoadingInAPISense(); +} + +/** + * webkit_web_data_source_get_data: + * @data_source: a #WebKitWebDataSource + * + * Returns the raw data that represents the the frame's content.The data will + * be incomplete until the data has finished loading. Returns %NULL if the web + * frame hasn't loaded any data. Use webkit_web_data_source_is_loading to test + * if data source is in the process of loading. + * + * Return value: a #GString which contains the raw data that represents the @data_source or %NULL if the + * @data_source hasn't loaded any data. + * + * Since: 1.1.14 + */ +GString* webkit_web_data_source_get_data(WebKitWebDataSource* webDataSource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); + + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + + RefPtr<SharedBuffer> mainResourceData = priv->loader->mainResourceData(); + + if (!mainResourceData) + return NULL; + + if (priv->data) { + g_string_free(priv->data, TRUE); + priv->data = NULL; + } + + priv->data = g_string_new_len(mainResourceData->data(), mainResourceData->size()); + return priv->data; +} + +/** + * webkit_web_data_source_get_main_resource: + * @data_source: a #WebKitWebDataSource + * + * Returns the main resource of the @data_source + * + * Return value: a new #WebKitWebResource representing the main resource of + * the @data_source. + * + * Since: 1.1.14 + */ +WebKitWebResource* webkit_web_data_source_get_main_resource(WebKitWebDataSource* webDataSource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); + + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + + if (priv->mainresource) + return priv->mainresource; + + WebKitWebFrame* webFrame = webkit_web_data_source_get_web_frame(webDataSource); + WebKitWebView* webView = getViewFromFrame(webFrame); + + priv->mainresource = WEBKIT_WEB_RESOURCE(g_object_ref(webkit_web_view_get_main_resource(webView))); + + return priv->mainresource; +} + +/** + * webkit_web_data_source_get_unreachable_uri: + * @data_source: a #WebKitWebDataSource + * + * Return the unreachable URI of @data_source. The @data_source will have an + * unreachable URL if it was created using #WebKitWebFrame's + * webkit_web_frame_load_alternate_html_string method. + * + * Return value: the unreachable URL of @data_source or %NULL if there is no unreachable URL. + * + * Since: 1.1.14 + */ +G_CONST_RETURN gchar* webkit_web_data_source_get_unreachable_uri(WebKitWebDataSource* webDataSource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); + + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + const KURL& unreachableURL = priv->loader->unreachableURL(); + + if (unreachableURL.isEmpty()) + return NULL; + + g_free(priv->unreachableURL); + priv->unreachableURL = g_strdup(unreachableURL.string().utf8().data()); + return priv->unreachableURL; +} + +/** + * webkit_web_data_source_get_subresources + * @data_source: a #WebKitWebDataSource + * + * Gives you a #GList of #WebKitWebResource objects that compose the + * #WebView to which this #WebKitWebDataSource is attached. + * + * Return value: a #GList of #WebKitResource objects; the objects are + * owned by WebKit, but the GList must be freed. + * + * Since: 1.1.15 + */ +GList* webkit_web_data_source_get_subresources(WebKitWebDataSource* webDataSource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DATA_SOURCE(webDataSource), NULL); + + WebKitWebFrame* webFrame = webkit_web_data_source_get_web_frame(webDataSource); + WebKitWebView* webView = getViewFromFrame(webFrame); + + return webkit_web_view_get_subresources(webView); +} diff --git a/WebKit/gtk/webkit/webkitwebdatasource.h b/WebKit/gtk/webkit/webkitwebdatasource.h new file mode 100644 index 0000000..df83118 --- /dev/null +++ b/WebKit/gtk/webkit/webkitwebdatasource.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2009 Jan Michael C. Alonzo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef webkitwebdatasource_h +#define webkitwebdatasource_h + +#include <glib.h> +#include <glib-object.h> + +#include <webkit/webkitdefines.h> +#include <webkit/webkitwebframe.h> +#include <webkit/webkitnetworkrequest.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_WEB_DATA_SOURCE (webkit_web_data_source_get_type()) +#define WEBKIT_WEB_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_DATA_SOURCE, WebKitWebDataSource)) +#define WEBKIT_WEB_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_DATA_SOURCE, WebKitWebDataSourceClass)) +#define WEBKIT_IS_WEB_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_DATA_SOURCE)) +#define WEBKIT_IS_WEB_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_DATA_SOURCE)) +#define WEBKIT_WEB_DATA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_DATA_SOURCE, WebKitWebDataSourceClass)) + +typedef struct _WebKitWebDataSourcePrivate WebKitWebDataSourcePrivate; + +struct _WebKitWebDataSource { + GObject parent_instance; + + /*< private >*/ + WebKitWebDataSourcePrivate *priv; +}; + +struct _WebKitWebDataSourceClass { + GObjectClass parent_class; + + /* Padding for future expansion */ + void (*_webkit_reserved0) (void); + void (*_webkit_reserved1) (void); + void (*_webkit_reserved2) (void); + void (*_webkit_reserved3) (void); +}; + +WEBKIT_API GType +webkit_web_data_source_get_type (void); + +WEBKIT_API WebKitWebDataSource * +webkit_web_data_source_new (void); + +WEBKIT_API WebKitWebDataSource * +webkit_web_data_source_new_with_request (WebKitNetworkRequest *request); + +WEBKIT_API WebKitWebFrame * +webkit_web_data_source_get_web_frame (WebKitWebDataSource *data_source); + +WEBKIT_API WebKitNetworkRequest * +webkit_web_data_source_get_initial_request (WebKitWebDataSource *data_source); + +WEBKIT_API WebKitNetworkRequest * +webkit_web_data_source_get_request (WebKitWebDataSource *data_source); + +WEBKIT_API G_CONST_RETURN gchar * +webkit_web_data_source_get_encoding (WebKitWebDataSource *data_source); + +WEBKIT_API gboolean +webkit_web_data_source_is_loading (WebKitWebDataSource *data_source); + +WEBKIT_API GString * +webkit_web_data_source_get_data (WebKitWebDataSource *data_source); + +WEBKIT_API WebKitWebResource * +webkit_web_data_source_get_main_resource (WebKitWebDataSource *data_source); + +WEBKIT_API G_CONST_RETURN gchar * +webkit_web_data_source_get_unreachable_uri (WebKitWebDataSource *data_source); + +WEBKIT_API GList* +webkit_web_data_source_get_subresources (WebKitWebDataSource *data_source); + +G_END_DECLS + +#endif /* webkitwebdatasource_h */ diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp index fba084e..67fa632 100644 --- a/WebKit/gtk/webkit/webkitwebframe.cpp +++ b/WebKit/gtk/webkit/webkitwebframe.cpp @@ -37,6 +37,7 @@ #include "AXObjectCache.h" #include "CString.h" #include "DocumentLoader.h" +#include "DocumentLoaderGtk.h" #include "FrameLoader.h" #include "FrameLoaderClientGtk.h" #include "FrameTree.h" @@ -85,6 +86,7 @@ enum { LOAD_DONE, TITLE_CHANGED, HOVERING_OVER_LINK, + SCROLLBARS_POLICY_CHANGED, LAST_SIGNAL }; @@ -94,7 +96,9 @@ enum { PROP_NAME, PROP_TITLE, PROP_URI, - PROP_LOAD_STATUS + PROP_LOAD_STATUS, + PROP_HORIZONTAL_SCROLLBAR_POLICY, + PROP_VERTICAL_SCROLLBAR_POLICY }; static guint webkit_web_frame_signals[LAST_SIGNAL] = { 0, }; @@ -118,6 +122,12 @@ static void webkit_web_frame_get_property(GObject* object, guint prop_id, GValue case PROP_LOAD_STATUS: g_value_set_enum(value, webkit_web_frame_get_load_status(frame)); break; + case PROP_HORIZONTAL_SCROLLBAR_POLICY: + g_value_set_enum(value, webkit_web_frame_get_horizontal_scrollbar_policy(frame)); + break; + case PROP_VERTICAL_SCROLLBAR_POLICY: + g_value_set_enum(value, webkit_web_frame_get_vertical_scrollbar_policy(frame)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -133,6 +143,11 @@ void webkit_web_frame_core_frame_gone(WebKitWebFrame* frame) frame->priv->coreFrame = 0; } +static WebKitWebDataSource* webkit_web_frame_get_data_source_from_core_loader(WebCore::DocumentLoader* loader) +{ + return loader ? static_cast<WebKit::DocumentLoader*>(loader)->dataSource() : NULL; +} + static void webkit_web_frame_finalize(GObject* object) { WebKitWebFrame* frame = WEBKIT_WEB_FRAME(object); @@ -214,6 +229,37 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); + /** + * WebKitWebFrame::scrollbars-policy-changed: + * @web_view: the object which received the signal + * + * Signal emitted when policy for one or both of the scrollbars of + * the view has changed. The default handler will apply the new + * policy to the container that holds the #WebKitWebFrame if it is + * a #GtkScrolledWindow and the frame is the main frame. If you do + * not want this to be handled automatically, you need to handle + * this signal. + * + * The exception to this rule is that policies to disable the + * scrollbars are applied as %GTK_POLICY_AUTOMATIC instead, since + * the size request of the widget would force browser windows to + * not be resizable. + * + * You can obtain the new policies from the + * WebKitWebFrame:horizontal-scrollbar-policy and + * WebKitWebFrame:vertical-scrollbar-policy properties. + * + * Since: 1.1.14 + */ + webkit_web_frame_signals[SCROLLBARS_POLICY_CHANGED] = g_signal_new("scrollbars-policy-changed", + G_TYPE_FROM_CLASS(frameClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + 0, + g_signal_accumulator_true_handled, + NULL, + webkit_marshal_BOOLEAN__VOID, + G_TYPE_BOOLEAN, 0); + /* * implementations of virtual methods */ @@ -260,6 +306,42 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) WEBKIT_LOAD_FINISHED, WEBKIT_PARAM_READABLE)); + /** + * WebKitWebFrame:horizontal-scrollbar-policy: + * + * Determines the current policy for the horizontal scrollbar of + * the frame. For the main frame, make sure to set the same policy + * on the scrollable widget containing the #WebKitWebView, unless + * you know what you are doing. + * + * Since: 1.1.14 + */ + g_object_class_install_property(objectClass, PROP_HORIZONTAL_SCROLLBAR_POLICY, + g_param_spec_enum("horizontal-scrollbar-policy", + _("Horizontal Scrollbar Policy"), + _("Determines the current policy for the horizontal scrollbar of the frame."), + GTK_TYPE_POLICY_TYPE, + GTK_POLICY_AUTOMATIC, + WEBKIT_PARAM_READABLE)); + + /** + * WebKitWebFrame:vertical-scrollbar-policy: + * + * Determines the current policy for the vertical scrollbar of + * the frame. For the main frame, make sure to set the same policy + * on the scrollable widget containing the #WebKitWebView, unless + * you know what you are doing. + * + * Since: 1.1.14 + */ + g_object_class_install_property(objectClass, PROP_VERTICAL_SCROLLBAR_POLICY, + g_param_spec_enum("vertical-scrollbar-policy", + _("Vertical Scrollbar Policy"), + _("Determines the current policy for the vertical scrollbar of the frame."), + GTK_TYPE_POLICY_TYPE, + GTK_POLICY_AUTOMATIC, + WEBKIT_PARAM_READABLE)); + g_type_class_add_private(frameClass, sizeof(WebKitWebFramePrivate)); } @@ -295,6 +377,8 @@ WebKitWebFrame* webkit_web_frame_new(WebKitWebView* webView) priv->coreFrame = Frame::create(viewPriv->corePage, 0, client).get(); priv->coreFrame->init(); + priv->origin = NULL; + return frame; } @@ -443,7 +527,7 @@ static void webkit_web_frame_load_data(WebKitWebFrame* frame, const gchar* conte SubstituteData substituteData(sharedBuffer.release(), mimeType ? String::fromUTF8(mimeType) : String::fromUTF8("text/html"), encoding ? String::fromUTF8(encoding) : String::fromUTF8("UTF-8"), - baseKURL, + KURL(KURL(), String::fromUTF8(unreachableURL)), KURL(KURL(), String::fromUTF8(unreachableURL))); coreFrame->loader()->load(request, substituteData, false); @@ -603,6 +687,46 @@ JSGlobalContextRef webkit_web_frame_get_global_context(WebKitWebFrame* frame) } /** + * webkit_web_frame_get_data_source: + * @frame: a #WebKitWebFrame + * + * Returns the committed data source. + * + * Return value: the committed #WebKitWebDataSource. + * + * Since: 1.1.14 + */ +WebKitWebDataSource* webkit_web_frame_get_data_source(WebKitWebFrame* frame) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + + Frame* coreFrame = core(frame); + return webkit_web_frame_get_data_source_from_core_loader(coreFrame->loader()->documentLoader()); +} + +/** + * webkit_web_frame_get_provisional_data_source: + * @frame: a #WebKitWebFrame + * + * You use the webkit_web_frame_load_request method to initiate a request that + * creates a provisional data source. The provisional data source will + * transition to a committed data source once any data has been received. Use + * webkit_web_frame_get_data_source to get the committed data source. + * + * Return value: the provisional #WebKitWebDataSource or %NULL if a load + * request is not in progress. + * + * Since: 1.1.14 + */ +WebKitWebDataSource* webkit_web_frame_get_provisional_data_source(WebKitWebFrame* frame) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + + Frame* coreFrame = core(frame); + return webkit_web_frame_get_data_source_from_core_loader(coreFrame->loader()->provisionalDocumentLoader()); +} + +/** * webkit_web_frame_get_children: * @frame: a #WebKitWebFrame * @@ -674,6 +798,19 @@ gchar* webkit_web_frame_dump_render_tree(WebKitWebFrame* frame) return g_strdup(string.utf8().data()); } +/** + * webkit_web_frame_get_pending_unload_event_count: + * @frame: a #WebKitWebFrame + * + * Return value: number of pending unload events + */ +guint webkit_web_frame_get_pending_unload_event_count(WebKitWebFrame* frame) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); + + return core(frame)->domWindow()->pendingUnloadEventListeners(); +} + static void begin_print_callback(GtkPrintOperation* op, GtkPrintContext* context, gpointer user_data) { PrintContext* printContext = reinterpret_cast<PrintContext*>(user_data); @@ -696,6 +833,9 @@ static void draw_page_callback(GtkPrintOperation* op, GtkPrintContext* context, { PrintContext* printContext = reinterpret_cast<PrintContext*>(user_data); + if (page_nr >= printContext->pageCount()) + return; + cairo_t* cr = gtk_print_context_get_cairo_context(context); GraphicsContext ctx(cr); float width = gtk_print_context_get_width(context); @@ -813,7 +953,7 @@ unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame) gchar* webkit_web_frame_get_response_mime_type(WebKitWebFrame* frame) { Frame* coreFrame = core(frame); - DocumentLoader* docLoader = coreFrame->loader()->documentLoader(); + WebCore::DocumentLoader* docLoader = coreFrame->loader()->documentLoader(); String mimeType = docLoader->responseMIMEType(); return g_strdup(mimeType.utf8().data()); } @@ -883,3 +1023,82 @@ AtkObject* webkit_web_frame_get_focused_accessible_element(WebKitWebFrame* frame return NULL; #endif } + +GtkPolicyType webkit_web_frame_get_horizontal_scrollbar_policy(WebKitWebFrame* frame) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), GTK_POLICY_AUTOMATIC); + + Frame* coreFrame = core(frame); + FrameView* view = coreFrame->view(); + if (!view) + return GTK_POLICY_AUTOMATIC; + + ScrollbarMode hMode = view->horizontalScrollbarMode(); + + if (hMode == ScrollbarAlwaysOn) + return GTK_POLICY_ALWAYS; + + if (hMode == ScrollbarAlwaysOff) + return GTK_POLICY_NEVER; + + return GTK_POLICY_AUTOMATIC; +} + +GtkPolicyType webkit_web_frame_get_vertical_scrollbar_policy(WebKitWebFrame* frame) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), GTK_POLICY_AUTOMATIC); + + Frame* coreFrame = core(frame); + FrameView* view = coreFrame->view(); + if (!view) + return GTK_POLICY_AUTOMATIC; + + ScrollbarMode vMode = view->verticalScrollbarMode(); + + if (vMode == ScrollbarAlwaysOn) + return GTK_POLICY_ALWAYS; + + if (vMode == ScrollbarAlwaysOff) + return GTK_POLICY_NEVER; + + return GTK_POLICY_AUTOMATIC; +} + +/** + * webkit_web_frame_get_security_origin: + * @frame: a #WebKitWebFrame + * + * Returns the @frame's security origin. + * + * Return value: the security origin of @frame + * + * Since: 1.1.14 + */ +WebKitSecurityOrigin* webkit_web_frame_get_security_origin(WebKitWebFrame* frame) +{ + WebKitWebFramePrivate* priv = frame->priv; + if (!priv->coreFrame || !priv->coreFrame->document() || !priv->coreFrame->document()->securityOrigin()) + return NULL; + + if (priv->origin && priv->origin->priv->coreOrigin.get() == priv->coreFrame->document()->securityOrigin()) + return priv->origin; + + if (priv->origin) + g_object_unref(priv->origin); + + priv->origin = kit(priv->coreFrame->document()->securityOrigin()); + return priv->origin; +} + +void webkit_web_frame_layout(WebKitWebFrame* frame) +{ + Frame* coreFrame = core(frame); + if (!coreFrame) + return; + + FrameView* view = coreFrame->view(); + if (!view) + return; + + view->layout(); +} diff --git a/WebKit/gtk/webkit/webkitwebframe.h b/WebKit/gtk/webkit/webkitwebframe.h index b2e61b9..7a95545 100644 --- a/WebKit/gtk/webkit/webkitwebframe.h +++ b/WebKit/gtk/webkit/webkitwebframe.h @@ -18,8 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_WEB_FRAME_H -#define WEBKIT_WEB_FRAME_H +#ifndef webkitwebframe_h +#define webkitwebframe_h #include <glib-object.h> #include <gtk/gtk.h> @@ -28,6 +28,7 @@ #include <webkit/webkitdefines.h> #include <webkit/webkitnetworkrequest.h> +#include <webkit/webkitwebdatasource.h> G_BEGIN_DECLS @@ -72,15 +73,19 @@ struct _WebKitWebFrameClass { * actual visible content happened; one or more layouts may have * happened before that caused nothing to be visible on the screen, * because the data available at the time was not significant enough. - * @WEBKIT_LOAD_FINISHED: This state means either that everything that - * was required to display the page has been loaded, or that an error - * has happened. + * @WEBKIT_LOAD_FINISHED: This state means that everything that was + * required to display the page has been loaded. + * @WEBKIT_LOAD_FAILED: This state means that some error occurred + * during the page load that prevented it from being completed. You + * can connect to the #WebKitWebView::load-error signal if you want to + * know precisely what kind of error occurred. */ typedef enum { WEBKIT_LOAD_PROVISIONAL, WEBKIT_LOAD_COMMITTED, WEBKIT_LOAD_FINISHED, - WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT + WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT, + WEBKIT_LOAD_FAILED } WebKitLoadStatus; WEBKIT_API GType @@ -152,6 +157,21 @@ webkit_web_frame_print (WebKitWebFrame *frame); WEBKIT_API WebKitLoadStatus webkit_web_frame_get_load_status (WebKitWebFrame *frame); +WEBKIT_API GtkPolicyType +webkit_web_frame_get_horizontal_scrollbar_policy (WebKitWebFrame *frame); + +WEBKIT_API GtkPolicyType +webkit_web_frame_get_vertical_scrollbar_policy (WebKitWebFrame *frame); + +WEBKIT_API WebKitWebDataSource * +webkit_web_frame_get_data_source (WebKitWebFrame *frame); + +WEBKIT_API WebKitWebDataSource * +webkit_web_frame_get_provisional_data_source (WebKitWebFrame *frame); + +WEBKIT_API WebKitSecurityOrigin* +webkit_web_frame_get_security_origin (WebKitWebFrame *frame); + G_END_DECLS #endif diff --git a/WebKit/gtk/webkit/webkitwebhistoryitem.cpp b/WebKit/gtk/webkit/webkitwebhistoryitem.cpp index a75bc0d..aab8b51 100644 --- a/WebKit/gtk/webkit/webkitwebhistoryitem.cpp +++ b/WebKit/gtk/webkit/webkitwebhistoryitem.cpp @@ -297,12 +297,11 @@ WebKitWebHistoryItem* webkit_web_history_item_new() */ WebKitWebHistoryItem* webkit_web_history_item_new_with_data(const gchar* uri, const gchar* title) { - WebCore::KURL historyUri(uri); - WebCore::String historyTitle = WebCore::String::fromUTF8(title); - WebKitWebHistoryItem* webHistoryItem = WEBKIT_WEB_HISTORY_ITEM(g_object_new(WEBKIT_TYPE_WEB_HISTORY_ITEM, NULL)); WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv; + WebCore::KURL historyUri(WebCore::KURL(), uri); + WebCore::String historyTitle = WebCore::String::fromUTF8(title); RefPtr<WebCore::HistoryItem> item = WebCore::HistoryItem::create(historyUri, historyTitle, 0); priv->historyItem = item.release().releaseRef(); webkit_history_item_add(webHistoryItem, priv->historyItem); diff --git a/WebKit/gtk/webkit/webkitwebhistoryitem.h b/WebKit/gtk/webkit/webkitwebhistoryitem.h index c8a754a..cafeb36 100644 --- a/WebKit/gtk/webkit/webkitwebhistoryitem.h +++ b/WebKit/gtk/webkit/webkitwebhistoryitem.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_WEB_HISTORY_ITEM_H -#define WEBKIT_WEB_HISTORY_ITEM_H +#ifndef webkitwebhistoryitem_h +#define webkitwebhistoryitem_h #include <glib.h> #include <glib-object.h> @@ -84,4 +84,4 @@ webkit_web_history_item_get_last_visited_time (WebKitWebHistoryItem *web_history G_END_DECLS -#endif /* WEBKIT_WEB_HISTORY_ITEM_H */ +#endif /* webkitwebhistoryitem_h */ diff --git a/WebKit/gtk/webkit/webkitwebinspector.h b/WebKit/gtk/webkit/webkitwebinspector.h index 41ccf92..9010e26 100644 --- a/WebKit/gtk/webkit/webkitwebinspector.h +++ b/WebKit/gtk/webkit/webkitwebinspector.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __WEBKIT_WEB_INSPECTOR_H__ -#define __WEBKIT_WEB_INSPECTOR_H__ +#ifndef webkitwebinspector_h +#define webkitwebinspector_h #include <glib-object.h> @@ -62,4 +62,4 @@ webkit_web_inspector_get_inspected_uri(WebKitWebInspector* web_inspector); G_END_DECLS -#endif /* __WEBKIT_WEB_INSPECTOR_H__ */ +#endif /* webkitwebinspector_h */ diff --git a/WebKit/gtk/webkit/webkitwebnavigationaction.h b/WebKit/gtk/webkit/webkitwebnavigationaction.h index c437c50..dbb47a8 100644 --- a/WebKit/gtk/webkit/webkitwebnavigationaction.h +++ b/WebKit/gtk/webkit/webkitwebnavigationaction.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_WEB_NAVIGATION_ACTION_H -#define WEBKIT_WEB_NAVIGATION_ACTION_H +#ifndef webkitwebnavigationaction_h +#define webkitwebnavigationaction_h #include <glib-object.h> diff --git a/WebKit/gtk/webkit/webkitwebpolicydecision.cpp b/WebKit/gtk/webkit/webkitwebpolicydecision.cpp index b2bab6b..5ef6310 100644 --- a/WebKit/gtk/webkit/webkitwebpolicydecision.cpp +++ b/WebKit/gtk/webkit/webkitwebpolicydecision.cpp @@ -86,7 +86,7 @@ void webkit_web_policy_decision_use(WebKitWebPolicyDecision* decision) WebKitWebPolicyDecisionPrivate* priv = decision->priv; if (!priv->isCancelled) - (core(priv->frame)->loader()->*(priv->framePolicyFunction))(WebCore::PolicyUse); + (core(priv->frame)->loader()->policyChecker()->*(priv->framePolicyFunction))(WebCore::PolicyUse); } /** @@ -104,7 +104,7 @@ void webkit_web_policy_decision_ignore(WebKitWebPolicyDecision* decision) WebKitWebPolicyDecisionPrivate* priv = decision->priv; if (!priv->isCancelled) - (core(priv->frame)->loader()->*(priv->framePolicyFunction))(WebCore::PolicyIgnore); + (core(priv->frame)->loader()->policyChecker()->*(priv->framePolicyFunction))(WebCore::PolicyIgnore); } /** @@ -122,7 +122,7 @@ void webkit_web_policy_decision_download(WebKitWebPolicyDecision* decision) WebKitWebPolicyDecisionPrivate* priv = decision->priv; if (!priv->isCancelled) - (core(priv->frame)->loader()->*(priv->framePolicyFunction))(WebCore::PolicyDownload); + (core(priv->frame)->loader()->policyChecker()->*(priv->framePolicyFunction))(WebCore::PolicyDownload); } void webkit_web_policy_decision_cancel(WebKitWebPolicyDecision* decision) diff --git a/WebKit/gtk/webkit/webkitwebpolicydecision.h b/WebKit/gtk/webkit/webkitwebpolicydecision.h index f1ec963..2b61837 100644 --- a/WebKit/gtk/webkit/webkitwebpolicydecision.h +++ b/WebKit/gtk/webkit/webkitwebpolicydecision.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_WEB_POLICY_DECISION_H -#define WEBKIT_WEB_POLICY_DECISION_H +#ifndef webkitwebpolicydecision_h +#define webkitwebpolicydecision_h #include <glib-object.h> #include <stdint.h> diff --git a/WebKit/gtk/webkit/webkitwebresource.cpp b/WebKit/gtk/webkit/webkitwebresource.cpp new file mode 100644 index 0000000..e995e08 --- /dev/null +++ b/WebKit/gtk/webkit/webkitwebresource.cpp @@ -0,0 +1,401 @@ +/* + * Copyright (C) 2009 Jan Michael C. Alonzo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" + +#include "webkitwebresource.h" +#include "webkitprivate.h" + +#include "ArchiveResource.h" +#include "CString.h" +#include "KURL.h" +#include "PlatformString.h" +#include "SharedBuffer.h" +#include "webkitenumtypes.h" +#include "webkitmarshal.h" +#include "wtf/Assertions.h" + +#include <glib.h> +#include <glib/gi18n-lib.h> + +/** + * SECTION:webkitwebresource + * @short_description: Represents a downloaded URI. + * @see_also: #WebKitWebDataSource + * + * A web resource encapsulates the data of the download as well as the URI, + * MIME type and frame name of the resource. + */ + +using namespace WebCore; +using namespace WebKit; + +enum { + PROP_0, + + PROP_URI, + PROP_MIME_TYPE, + PROP_ENCODING, + PROP_FRAME_NAME +}; + +G_DEFINE_TYPE(WebKitWebResource, webkit_web_resource, G_TYPE_OBJECT); + +static void webkit_web_resource_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec); +static void webkit_web_resource_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec); + +static void webkit_web_resource_cleanup(WebKitWebResource* webResource) +{ + WebKitWebResourcePrivate* priv = webResource->priv; + + g_free(priv->uri); + priv->uri = NULL; + + g_free(priv->mimeType); + priv->mimeType = NULL; + + g_free(priv->textEncoding); + priv->textEncoding = NULL; + + g_free(priv->frameName); + priv->frameName = NULL; + + if (priv->data) + g_string_free(priv->data, TRUE); + priv->data = NULL; +} + +static void webkit_web_resource_dispose(GObject* object) +{ + WebKitWebResource* webResource = WEBKIT_WEB_RESOURCE(object); + WebKitWebResourcePrivate* priv = webResource->priv; + + if (priv->resource) { + priv->resource->deref(); + priv->resource = 0; + } + + G_OBJECT_CLASS(webkit_web_resource_parent_class)->dispose(object); +} + +static void webkit_web_resource_finalize(GObject* object) +{ + WebKitWebResource* webResource = WEBKIT_WEB_RESOURCE(object); + + webkit_web_resource_cleanup(webResource); + + G_OBJECT_CLASS(webkit_web_resource_parent_class)->finalize(object); +} + +static void webkit_web_resource_class_init(WebKitWebResourceClass* klass) +{ + GObjectClass* gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->dispose = webkit_web_resource_dispose; + gobject_class->finalize = webkit_web_resource_finalize; + gobject_class->get_property = webkit_web_resource_get_property; + gobject_class->set_property = webkit_web_resource_set_property; + + /** + * WebKitWebResource:uri: + * + * The URI of the web resource + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobject_class, + PROP_URI, + g_param_spec_string( + "uri", + _("URI"), + _("The uri of the resource"), + NULL, + (GParamFlags)(WEBKIT_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY))); + /** + * WebKitWebResource:mime-type: + * + * The MIME type of the web resource. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobject_class, + PROP_MIME_TYPE, + g_param_spec_string( + "mime-type", + _("MIME Type"), + _("The MIME type of the resource"), + NULL, + WEBKIT_PARAM_READABLE)); + /** + * WebKitWebResource:encoding: + * + * The encoding name to which the web resource was encoded in. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobject_class, + PROP_ENCODING, + g_param_spec_string( + "encoding", + _("Encoding"), + _("The text encoding name of the resource"), + NULL, + WEBKIT_PARAM_READABLE)); + + /** + * WebKitWebResource:frame-name: + * + * The frame name for the web resource. + * + * Since: 1.1.14 + */ + g_object_class_install_property(gobject_class, + PROP_FRAME_NAME, + g_param_spec_string( + "frame-name", + _("Frame Name"), + _("The frame name of the resource"), + NULL, + WEBKIT_PARAM_READABLE)); + + g_type_class_add_private(gobject_class, sizeof(WebKitWebResourcePrivate)); +} + +static void webkit_web_resource_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +{ + WebKitWebResource* webResource = WEBKIT_WEB_RESOURCE(object); + + switch (prop_id) { + case PROP_URI: + g_value_set_string(value, webkit_web_resource_get_uri(webResource)); + break; + case PROP_MIME_TYPE: + g_value_set_string(value, webkit_web_resource_get_mime_type(webResource)); + break; + case PROP_ENCODING: + g_value_set_string(value, webkit_web_resource_get_encoding(webResource)); + break; + case PROP_FRAME_NAME: + g_value_set_string(value, webkit_web_resource_get_frame_name(webResource)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + +static void webkit_web_resource_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) +{ + WebKitWebResource* webResource = WEBKIT_WEB_RESOURCE(object); + + switch (prop_id) { + case PROP_URI: + g_free(webResource->priv->uri); + webResource->priv->uri = g_value_dup_string(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + +static void webkit_web_resource_init(WebKitWebResource* webResource) +{ + webResource->priv = WEBKIT_WEB_RESOURCE_GET_PRIVATE(webResource); +} + +// internal use only +WebKitWebResource* webkit_web_resource_new_with_core_resource(PassRefPtr<ArchiveResource> resource) +{ + WebKitWebResource* webResource = WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, NULL)); + WebKitWebResourcePrivate* priv = webResource->priv; + priv->resource = resource.releaseRef(); + + return webResource; +} + +void webkit_web_resource_init_with_core_resource(WebKitWebResource* webResource, PassRefPtr<ArchiveResource> resource) +{ + ASSERT(resource); + + WebKitWebResourcePrivate* priv = webResource->priv; + + if (priv->resource) + priv->resource->deref(); + + priv->resource = resource.releaseRef(); +} + +/** + * webkit_web_resource_new: + * @data: the data to initialize the #WebKitWebResource + * @length: the length of @data + * @uri: the uri of the #WebKitWebResource + * @mime_type: the MIME type of the #WebKitWebResource + * @text_encoding_name: the text encoding name of the #WebKitWebResource + * @frame_name: the frame name of the #WebKitWebResource + * + * Returns a new #WebKitWebResource. The @text_encoding_name can be %NULL. The + * @frame_name argument can be used if the resource represents contents of an + * entire HTML frame, otherwise pass %NULL. + * + * Return value: a new #WebKitWebResource + * + * Since: 1.1.14 + */ +WebKitWebResource* webkit_web_resource_new(const gchar* data, + gssize size, + const gchar* uri, + const gchar* mimeType, + const gchar* encoding, + const gchar* frameName) +{ + g_return_val_if_fail(data, NULL); + g_return_val_if_fail(uri, NULL); + g_return_val_if_fail(mimeType, NULL); + + if (size < 0) + size = strlen(data); + + RefPtr<SharedBuffer> buffer = SharedBuffer::create(data, size); + WebKitWebResource* webResource = webkit_web_resource_new_with_core_resource(ArchiveResource::create(buffer, KURL(KURL(), String::fromUTF8(uri)), String::fromUTF8(mimeType), String::fromUTF8(encoding), String::fromUTF8(frameName))); + + return webResource; +} + +/** + * webkit_web_resource_get_data: + * @web_resource: a #WebKitWebResource + * + * Returns the data of the @webResource. + * + * Return value: a #GString containing the character data of the @webResource. + * The string is owned by WebKit and should not be freed or destroyed. + * + * Since: 1.1.14 + */ +GString* webkit_web_resource_get_data(WebKitWebResource* webResource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_RESOURCE(webResource), NULL); + + WebKitWebResourcePrivate* priv = webResource->priv; + + if (!priv->resource) + return NULL; + + if (!priv->data) + priv->data = g_string_new_len(priv->resource->data()->data(), priv->resource->data()->size()); + + return priv->data; +} + +/** + * webkit_web_resource_get_uri: + * @web_resource: a #WebKitWebResource + * + * Return value: the URI of the resource + * + * Since: 1.1.14 + */ +G_CONST_RETURN gchar* webkit_web_resource_get_uri(WebKitWebResource* webResource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_RESOURCE(webResource), NULL); + + WebKitWebResourcePrivate* priv = webResource->priv; + + + // We may have an URI without having a resource assigned to us (e.g., if the + // FrameLoaderClient only had a ResourceRequest when we got created + if (priv->uri) + return priv->uri; + + if (!priv->resource) + return NULL; + + priv->uri = g_strdup(priv->resource->url().string().utf8().data()); + + return priv->uri; +} + +/** + * webkit_web_resource_get_mime_type: + * @web_resource: a #WebKitWebResource + * + * Return value: the MIME type of the resource + * + * Since: 1.1.14 + */ +G_CONST_RETURN gchar* webkit_web_resource_get_mime_type(WebKitWebResource* webResource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_RESOURCE(webResource), NULL); + + WebKitWebResourcePrivate* priv = webResource->priv; + if (!priv->resource) + return NULL; + + if (!priv->mimeType) + priv->mimeType = g_strdup(priv->resource->mimeType().utf8().data()); + + return priv->mimeType; +} + +/** + * webkit_web_resource_get_encoding: + * @web_resource: a #WebKitWebResource + * + * Return value: the encoding name of the resource + * + * Since: 1.1.14 + */ +G_CONST_RETURN gchar* webkit_web_resource_get_encoding(WebKitWebResource* webResource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_RESOURCE(webResource), NULL); + + WebKitWebResourcePrivate* priv = webResource->priv; + if (!priv->resource) + return NULL; + + if (!priv->textEncoding) + priv->textEncoding = g_strdup(priv->resource->textEncoding().utf8().data()); + + return priv->textEncoding; +} + +/** + * webkit_web_resource_get_frame_name: + * @web_resource: a #WebKitWebResource + * + * Return value: the frame name of the resource. + * + * Since: 1.1.14 + */ +G_CONST_RETURN gchar* webkit_web_resource_get_frame_name(WebKitWebResource* webResource) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_RESOURCE(webResource), NULL); + + WebKitWebResourcePrivate* priv = webResource->priv; + if (!priv->resource) + return NULL; + + if (!priv->frameName) + priv->frameName = g_strdup(priv->resource->frameName().utf8().data()); + + return priv->frameName; +} + diff --git a/WebKit/gtk/webkit/webkitwebresource.h b/WebKit/gtk/webkit/webkitwebresource.h new file mode 100644 index 0000000..05f6066 --- /dev/null +++ b/WebKit/gtk/webkit/webkitwebresource.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2009 Jan Michael C. Alonzo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef webkitwebresource_h +#define webkitwebresource_h + +#include <glib.h> +#include <glib-object.h> + +#include <webkit/webkitdefines.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_WEB_RESOURCE (webkit_web_resource_get_type()) +#define WEBKIT_WEB_RESOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_RESOURCE, WebKitWebResource)) +#define WEBKIT_WEB_RESOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_RESOURCE, WebKitWebResourceClass)) +#define WEBKIT_IS_WEB_RESOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_RESOURCE)) +#define WEBKIT_IS_WEB_RESOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_RESOURCE)) +#define WEBKIT_WEB_RESOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_RESOURCE, WebKitWebResourceClass)) + +typedef struct _WebKitWebResourcePrivate WebKitWebResourcePrivate; + +struct _WebKitWebResource { + GObject parent_instance; + + /*< private >*/ + WebKitWebResourcePrivate *priv; +}; + +struct _WebKitWebResourceClass { + GObjectClass parent_class; + + /* Padding for future expansion */ + void (*_webkit_reserved0) (void); + void (*_webkit_reserved1) (void); + void (*_webkit_reserved2) (void); + void (*_webkit_reserved3) (void); +}; + +WEBKIT_API GType +webkit_web_resource_get_type (void); + +WEBKIT_API WebKitWebResource * +webkit_web_resource_new (const gchar *data, + gssize size, + const gchar *uri, + const gchar *mime_type, + const gchar *encoding, + const gchar *frame_name); + +WEBKIT_API GString * +webkit_web_resource_get_data (WebKitWebResource *web_resource); + +WEBKIT_API G_CONST_RETURN gchar * +webkit_web_resource_get_uri (WebKitWebResource *web_resource); + +WEBKIT_API G_CONST_RETURN gchar * +webkit_web_resource_get_mime_type (WebKitWebResource *web_resource); + +WEBKIT_API G_CONST_RETURN gchar * +webkit_web_resource_get_encoding (WebKitWebResource *web_resource); + +WEBKIT_API G_CONST_RETURN gchar * +webkit_web_resource_get_frame_name (WebKitWebResource *web_resource); + +G_END_DECLS + +#endif /* webkitwebresource_h */ diff --git a/WebKit/gtk/webkit/webkitwebsettings.cpp b/WebKit/gtk/webkit/webkitwebsettings.cpp index 061d3e2..588d5bd 100644 --- a/WebKit/gtk/webkit/webkitwebsettings.cpp +++ b/WebKit/gtk/webkit/webkitwebsettings.cpp @@ -24,6 +24,7 @@ #include "config.h" #include "webkitwebsettings.h" +#include "webkitenumtypes.h" #include "webkitprivate.h" #include "webkitversion.h" @@ -93,6 +94,8 @@ struct _WebKitWebSettingsPrivate { gchar* user_agent; gboolean javascript_can_open_windows_automatically; gboolean enable_offline_web_application_cache; + WebKitEditingBehavior editing_behavior; + gboolean enable_universal_access_from_file_uris; }; #define WEBKIT_WEB_SETTINGS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SETTINGS, WebKitWebSettingsPrivate)) @@ -130,7 +133,9 @@ enum { PROP_ENABLE_XSS_AUDITOR, PROP_USER_AGENT, PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY, - PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE + PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE, + PROP_EDITING_BEHAVIOR, + PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS }; // Create a default user agent string @@ -433,7 +438,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) * * This is currently experimental for WebKitGtk. * - * Since 1.1.2 + * Since: 1.1.2 */ g_object_class_install_property(gobject_class, PROP_ENABLE_PRIVATE_BROWSING, @@ -449,7 +454,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) * * Whether to enable spell checking while typing. * - * Since 1.1.6 + * Since: 1.1.6 */ g_object_class_install_property(gobject_class, PROP_ENABLE_SPELL_CHECKING, @@ -473,7 +478,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) * If no value is specified then the value returned by * gtk_get_default_language will be used. * - * Since 1.1.6 + * Since: 1.1.6 */ g_object_class_install_property(gobject_class, PROP_SPELL_CHECKING_LANGUAGES, @@ -489,7 +494,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) * * Whether to enable caret browsing mode. * - * Since 1.1.6 + * Since: 1.1.6 */ g_object_class_install_property(gobject_class, PROP_ENABLE_CARET_BROWSING, @@ -505,7 +510,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) * SQL database allows web pages to store structured data and be able to * use SQL to manipulate that data asynchronously. * - * Since 1.1.8 + * Since: 1.1.8 */ g_object_class_install_property(gobject_class, PROP_ENABLE_HTML5_DATABASE, @@ -521,7 +526,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) * Whether to enable HTML5 localStorage support. localStorage provides * simple synchronous storage access. * - * Since 1.1.8 + * Since: 1.1.8 */ g_object_class_install_property(gobject_class, PROP_ENABLE_HTML5_LOCAL_STORAGE, @@ -536,7 +541,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) * Whether to enable the XSS Auditor. This feature filters some kinds of * reflective XSS attacks on vulnerable web sites. * - * Since 1.1.11 + * Since: 1.1.11 */ g_object_class_install_property(gobject_class, PROP_ENABLE_XSS_AUDITOR, @@ -571,7 +576,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) * Whether JavaScript can open popup windows automatically without user * intervention. * - * Since 1.1.11 + * Since: 1.1.11 */ g_object_class_install_property(gobject_class, PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY, @@ -587,7 +592,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) * Web Application Cache ensures web applications are available even when * the user is not connected to the network. * - * Since 1.1.13 + * Since: 1.1.13 */ g_object_class_install_property(gobject_class, PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE, @@ -597,7 +602,50 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) TRUE, flags)); + COMPILE_ASSERT(static_cast<int>(WEBKIT_EDITING_BEHAVIOR_MAC) == static_cast<int>(WebCore::EditingMacBehavior), editing_behavior_type_mac_match); + COMPILE_ASSERT(static_cast<int>(WEBKIT_EDITING_BEHAVIOR_WINDOWS) == static_cast<int>(WebCore::EditingWindowsBehavior), editing_behavior_type_windows_match); + /** + * WebKitWebSettings:editing-behavior + * + * This setting controls various editing behaviors that differ + * between platforms and that have been combined in two groups, + * 'Mac' and 'Windows'. Some examples: + * + * 1) Clicking below the last line of an editable area puts the + * caret at the end of the last line on Mac, but in the middle of + * the last line on Windows. + * + * 2) Pushing down the arrow key on the last line puts the caret + * at the end of the last line on Mac, but does nothing on + * Windows. A similar case exists on the top line. + * + * Since: 1.1.13 + */ + g_object_class_install_property(gobject_class, + PROP_EDITING_BEHAVIOR, + g_param_spec_enum("editing-behavior", + _("Editing behavior"), + _("The behavior mode to use in editing mode"), + WEBKIT_TYPE_EDITING_BEHAVIOR, + WEBKIT_EDITING_BEHAVIOR_MAC, + flags)); + + /** + * WebKitWebSettings:enable-universal-access-from-file-uris + * + * Whether to allow files loaded through file:// URIs universal access to + * all pages. + * + * Since: 1.1.13 + */ + g_object_class_install_property(gobject_class, + PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS, + g_param_spec_boolean("enable-universal-access-from-file-uris", + _("Enable universal access from file URIs"), + _("Whether to allow universal access from file URIs"), + FALSE, + flags)); g_type_class_add_private(klass, sizeof(WebKitWebSettingsPrivate)); } @@ -779,6 +827,12 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE: priv->enable_offline_web_application_cache = g_value_get_boolean(value); break; + case PROP_EDITING_BEHAVIOR: + priv->editing_behavior = static_cast<WebKitEditingBehavior>(g_value_get_enum(value)); + break; + case PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS: + priv->enable_universal_access_from_file_uris = g_value_get_boolean(value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -884,7 +938,13 @@ static void webkit_web_settings_get_property(GObject* object, guint prop_id, GVa case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE: g_value_set_boolean(value, priv->enable_offline_web_application_cache); break; - default: + case PROP_EDITING_BEHAVIOR: + g_value_set_enum(value, priv->editing_behavior); + break; + case PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS: + g_value_set_boolean(value, priv->enable_universal_access_from_file_uris); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } @@ -946,6 +1006,8 @@ WebKitWebSettings* webkit_web_settings_copy(WebKitWebSettings* web_settings) "user-agent", webkit_web_settings_get_user_agent(web_settings), "javascript-can-open-windows-automatically", priv->javascript_can_open_windows_automatically, "enable-offline-web-application-cache", priv->enable_offline_web_application_cache, + "editing-behavior", priv->editing_behavior, + "enable-universal-access-from-file-uris", priv->enable_universal_access_from_file_uris, NULL)); return copy; diff --git a/WebKit/gtk/webkit/webkitwebsettings.h b/WebKit/gtk/webkit/webkitwebsettings.h index 9eac321..d8dafd9 100644 --- a/WebKit/gtk/webkit/webkitwebsettings.h +++ b/WebKit/gtk/webkit/webkitwebsettings.h @@ -18,8 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __WEBKIT_WEB_SETTINGS_H__ -#define __WEBKIT_WEB_SETTINGS_H__ +#ifndef webkitwebsettings_h +#define webkitwebsettings_h #include <glib-object.h> @@ -34,6 +34,11 @@ G_BEGIN_DECLS #define WEBKIT_IS_WEB_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_SETTINGS)) #define WEBKIT_WEB_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_SETTINGS, WebKitWebSettingsClass)) +typedef enum { + WEBKIT_EDITING_BEHAVIOR_MAC, + WEBKIT_EDITING_BEHAVIOR_WINDOWS +} WebKitEditingBehavior; + typedef struct _WebKitWebSettingsPrivate WebKitWebSettingsPrivate; struct _WebKitWebSettings { @@ -67,4 +72,4 @@ webkit_web_settings_get_user_agent (WebKitWebSettings *web_settings); G_END_DECLS -#endif /* __WEBKIT_WEB_SETTINGS_H__ */ +#endif /* webkitwebsettings_h */ diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index ec59e60..47d7d98 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -6,7 +6,7 @@ * Copyright (C) 2008 Jan Alonzo <jmalonzo@unpluggable.com> * Copyright (C) 2008 Gustavo Noronha Silva <gns@gnome.org> * Copyright (C) 2008 Nuanti Ltd. - * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2008, 2009 Collabora Ltd. * Copyright (C) 2009 Igalia S.L. * * This library is free software; you can redistribute it and/or @@ -25,11 +25,13 @@ */ #include "config.h" +#include "webkitwebview.h" #include "webkitdownload.h" -#include "webkitwebview.h" #include "webkitenumtypes.h" #include "webkitmarshal.h" +#include "webkitnetworkrequest.h" +#include "webkitnetworkresponse.h" #include "webkitprivate.h" #include "webkitwebinspector.h" #include "webkitwebbackforwardlist.h" @@ -60,11 +62,13 @@ #include "InspectorClientGtk.h" #include "FrameLoader.h" #include "FrameView.h" +#include "MouseEventWithHitTestResults.h" #include "PasteboardHelper.h" #include "PlatformKeyboardEvent.h" #include "PlatformWheelEvent.h" #include "ProgressTracker.h" #include "ResourceHandle.h" +#include "RenderView.h" #include "ScriptValue.h" #include "Scrollbar.h" #include <wtf/GOwnPtr.h> @@ -96,7 +100,7 @@ * gtk_container_add (GTK_CONTAINER (main_window), scrolled_window); * * /<!-- -->* Open a webpage *<!-- -->/ - * webkit_web_view_open (WEBKIT_WEB_VIEW (web_view), "http://www.gnome.org"); + * webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), "http://www.gnome.org"); * * /<!-- -->* Show the result *<!-- -->/ * gtk_window_set_default_size (GTK_WINDOW (main_window), 800, 600); @@ -142,6 +146,10 @@ enum { PRINT_REQUESTED, PLUGIN_WIDGET, CLOSE_WEB_VIEW, + UNDO, + REDO, + DATABASE_QUOTA_EXCEEDED, + RESOURCE_REQUEST_STARTING, LAST_SIGNAL }; @@ -172,6 +180,15 @@ G_DEFINE_TYPE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER) static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView); static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures); +static void destroy_menu_cb(GtkObject* object, gpointer data) +{ + WebKitWebView* webView = WEBKIT_WEB_VIEW(data); + WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); + + g_object_unref(priv->currentMenu); + priv->currentMenu = NULL; +} + static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webView, const PlatformMouseEvent& event) { Page* page = core(webView); @@ -203,8 +220,14 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie return FALSE; WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); + priv->currentMenu = GTK_MENU(g_object_ref(menu)); priv->lastPopupXPosition = event.globalX(); priv->lastPopupYPosition = event.globalY(); + + g_signal_connect(menu, "destroy", + G_CALLBACK(destroy_menu_cb), + NULL); + gtk_menu_popup(menu, NULL, NULL, NULL, priv, event.button() + 1, gtk_get_current_event_time()); @@ -268,7 +291,7 @@ static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget) } int x, y; - gdk_window_get_origin(GTK_WIDGET(view->hostWindow()->platformWindow())->window, &x, &y); + gdk_window_get_origin(GTK_WIDGET(view->hostWindow()->platformPageClient())->window, &x, &y); // FIXME: The IntSize(0, -1) is a hack to get the hit-testing to result in the selected element. // Ideally we'd have the position of a context menu event be separate from its target node. @@ -649,7 +672,7 @@ static void webkit_web_view_realize(GtkWidget* widget) gdk_window_set_user_data(widget->window, widget); widget->style = gtk_style_attach(widget->style, widget->window); - gdk_window_set_background(widget->window, &widget->style->base[GTK_WIDGET_STATE(widget)]); + gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; @@ -690,8 +713,6 @@ static void webkit_web_view_container_add(GtkContainer* container, GtkWidget* wi WebKitWebViewPrivate* priv = webView->priv; priv->children.add(widget); - if (GTK_WIDGET_REALIZED(container)) - gtk_widget_set_parent_window(widget, GTK_WIDGET(webView)->window); gtk_widget_set_parent(widget, GTK_WIDGET(container)); } @@ -866,6 +887,18 @@ static void webkit_web_view_real_copy_clipboard(WebKitWebView* webView) frame->editor()->command("Copy").execute(); } +static void webkit_web_view_real_undo(WebKitWebView* webView) +{ + Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); + frame->editor()->command("Undo").execute(); +} + +static void webkit_web_view_real_redo(WebKitWebView* webView) +{ + Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); + frame->editor()->command("Redo").execute(); +} + static gboolean webkit_web_view_real_move_cursor (WebKitWebView* webView, GtkMovementStep step, gint count) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW (webView), FALSE); @@ -976,6 +1009,16 @@ static void webkit_web_view_dispose(GObject* object) priv->paste_target_list = NULL; } + if (priv->mainResource) { + g_object_unref(priv->mainResource); + priv->mainResource = NULL; + } + + if (priv->subResources) { + g_hash_table_unref(priv->subResources); + priv->subResources = NULL; + } + G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object); } @@ -984,6 +1027,7 @@ static void webkit_web_view_finalize(GObject* object) WebKitWebView* webView = WEBKIT_WEB_VIEW(object); WebKitWebViewPrivate* priv = webView->priv; + g_free(priv->mainResourceIdentifier); g_free(priv->encoding); g_free(priv->customEncoding); @@ -1081,6 +1125,130 @@ static void webkit_web_view_screen_changed(GtkWidget* widget, GdkScreen* previou settings->setMinimumLogicalFontSize(minimumLogicalFontSize / 72.0 * DPI); } +static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context) +{ + g_object_unref(context); +} + +struct DNDContentsRequest +{ + gint info; + GtkSelectionData* dnd_selection_data; + + gboolean is_url_label_request; + gchar* url; +}; + +void clipboard_contents_received(GtkClipboard* clipboard, GtkSelectionData* selection_data, gpointer data) +{ + DNDContentsRequest* contents_request = reinterpret_cast<DNDContentsRequest*>(data); + + if (contents_request->is_url_label_request) { + // We have received contents of the label clipboard. Use them to form + // required structures. When formed, enhance the dnd's selection data + // with them and return. + + // If the label is empty, use the url itself. + gchar* url_label = reinterpret_cast<gchar*>(gtk_selection_data_get_text(selection_data)); + if (!url_label) + url_label = g_strdup(contents_request->url); + + gchar* data = 0; + switch (contents_request->info) { + case WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST: + data = g_strdup_printf("%s\r\n%s\r\n", contents_request->url, url_label); + break; + case WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL: + data = g_strdup_printf("%s\n%s", contents_request->url, url_label); + break; + } + + if (data) { + gtk_selection_data_set(contents_request->dnd_selection_data, + contents_request->dnd_selection_data->target, 8, + reinterpret_cast<const guchar*>(data), strlen(data)); + g_free(data); + } + + g_free(url_label); + g_free(contents_request->url); + g_free(contents_request); + + return; + } + + switch (contents_request->info) { + case WEBKIT_WEB_VIEW_TARGET_INFO_HTML: + case WEBKIT_WEB_VIEW_TARGET_INFO_TEXT: + { + gchar* data = reinterpret_cast<gchar*>(gtk_selection_data_get_text(selection_data)); + if (data) { + gtk_selection_data_set(contents_request->dnd_selection_data, + contents_request->dnd_selection_data->target, 8, + reinterpret_cast<const guchar*>(data), + strlen(data)); + g_free(data); + } + break; + } + case WEBKIT_WEB_VIEW_TARGET_INFO_IMAGE: + { + GdkPixbuf* pixbuf = gtk_selection_data_get_pixbuf(selection_data); + if (pixbuf) { + gtk_selection_data_set_pixbuf(contents_request->dnd_selection_data, pixbuf); + g_object_unref(pixbuf); + } + break; + } + case WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST: + case WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL: + // URL's label is stored in another clipboard, so we store URL into + // contents request, mark the latter as an url label request + // and request for contents of the label clipboard. + contents_request->is_url_label_request = TRUE; + contents_request->url = reinterpret_cast<gchar*>(gtk_selection_data_get_text(selection_data)); + + gtk_clipboard_request_contents(gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardUrlLabel")), + selection_data->target, clipboard_contents_received, contents_request); + break; + } +} + +static void webkit_web_view_drag_data_get(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selection_data, guint info, guint time_) +{ + GdkAtom selection_atom = GDK_NONE; + GdkAtom target_atom = selection_data->target; + + switch (info) { + case WEBKIT_WEB_VIEW_TARGET_INFO_HTML: + selection_atom = gdk_atom_intern_static_string("WebKitClipboardHtml"); + // HTML markup data is set as text, therefor, we need a text-like target atom + target_atom = gdk_atom_intern_static_string("UTF8_STRING"); + break; + case WEBKIT_WEB_VIEW_TARGET_INFO_TEXT: + selection_atom = gdk_atom_intern_static_string("WebKitClipboardText"); + break; + case WEBKIT_WEB_VIEW_TARGET_INFO_IMAGE: + selection_atom = gdk_atom_intern_static_string("WebKitClipboardImage"); + break; + case WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST: + case WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL: + selection_atom = gdk_atom_intern_static_string("WebKitClipboardUrl"); + // We require URL and label, which are both stored in text format + // and are needed to be retrieved as such. + target_atom = gdk_atom_intern_static_string("UTF8_STRING"); + break; + } + + DNDContentsRequest* contents_request = g_new(DNDContentsRequest, 1); + contents_request->info = info; + contents_request->is_url_label_request = FALSE; + contents_request->dnd_selection_data = selection_data; + + gtk_clipboard_request_contents(gtk_clipboard_get(selection_atom), target_atom, + clipboard_contents_received, contents_request); +} + static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) { GtkBindingSet* binding_set; @@ -1104,11 +1272,11 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) * The new #WebKitWebView should not be displayed to the user * until the #WebKitWebView::web-view-ready signal is emitted. * - * The signal handlers should not try to deal with the reference - * count for the new #WebKitWebView. The widget to which the - * widget is added will handle that. + * The signal handlers should not try to deal with the reference count for + * the new #WebKitWebView. The widget to which the widget is added will + * handle that. * - * Since 1.0.3 + * Since: 1.0.3 */ webkit_web_view_signals[CREATE_WEB_VIEW] = g_signal_new("create-web-view", G_TYPE_FROM_CLASS(webViewClass), @@ -1137,7 +1305,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) * time of the window, so you may want to connect to the ::notify * signal of the #WebKitWebWindowFeatures object to handle those. * - * Since 1.0.3 + * Since: 1.0.3 */ webkit_web_view_signals[WEB_VIEW_READY] = g_signal_new("web-view-ready", G_TYPE_FROM_CLASS(webViewClass), @@ -1154,10 +1322,12 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) * @return: %TRUE to stop handlers from being invoked for the event or * %FALSE to propagate the event furter * - * Emitted when closing a WebView is requested. This occurs when a call - * is made from JavaScript's window.close function. + * Emitted when closing a #WebKitWebView is requested. This occurs when a + * call is made from JavaScript's window.close function. The default + * signal handler does not do anything. It is the owner's responsibility + * to hide or delete the web view, if necessary. * - * Since 1.1.11 + * Since: 1.1.11 */ webkit_web_view_signals[CLOSE_WEB_VIEW] = g_signal_new("close-web-view", G_TYPE_FROM_CLASS(webViewClass), @@ -1727,6 +1897,44 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) G_TYPE_NONE, 0); /** + * WebKitWebView::undo + * @web_view: the object which received the signal + * + * The #WebKitWebView::undo signal is a keybinding signal which gets emitted to + * undo the last editing command. + * + * The default binding for this signal is Ctrl-z + * + * Since: 1.1.14 + */ + webkit_web_view_signals[UNDO] = g_signal_new("undo", + G_TYPE_FROM_CLASS(webViewClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + G_STRUCT_OFFSET(WebKitWebViewClass, undo), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** + * WebKitWebView::redo + * @web_view: the object which received the signal + * + * The #WebKitWebView::redo signal is a keybinding signal which gets emitted to + * redo the last editing command. + * + * The default binding for this signal is Ctrl-Shift-z + * + * Since: 1.1.14 + */ + webkit_web_view_signals[REDO] = g_signal_new("redo", + G_TYPE_FROM_CLASS(webViewClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + G_STRUCT_OFFSET(WebKitWebViewClass, redo), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + /** * WebKitWebView::move-cursor: * @web_view: the object which received the signal * @step: the type of movement, one of #GtkMovementStep @@ -1774,6 +1982,69 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) GTK_TYPE_WIDGET, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_HASH_TABLE); + /** + * WebKitWebView::database-quota-exceeded + * @web_view: the object which received the signal + * @frame: the relevant frame + * @database: the #WebKitWebDatabase which exceeded the quota of its #WebKitSecurityOrigin + * + * The #WebKitWebView::database-exceeded-quota signal will be emitted when + * a Web Database exceeds the quota of its security origin. This signal + * may be used to increase the size of the quota before the originating + * operation fails. + * + * Since: 1.1.14 + */ + webkit_web_view_signals[DATABASE_QUOTA_EXCEEDED] = g_signal_new("database-quota-exceeded", + G_TYPE_FROM_CLASS(webViewClass), + (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + 0, + NULL, NULL, + webkit_marshal_VOID__OBJECT_OBJECT, + G_TYPE_NONE, 2, + G_TYPE_OBJECT, G_TYPE_OBJECT); + + /** + * WebKitWebView::resource-request-starting: + * @web_view: the object which received the signal + * @web_frame: the #WebKitWebFrame whose load dispatched this request + * @web_resource: an empty #WebKitWebResource object + * @request: the #WebKitNetworkRequest that will be dispatched + * @response: the #WebKitNetworkResponse representing the redirect + * response, if any + * + * Emitted when a request is about to be sent. You can modify the + * request while handling this signal. You can set the URI in the + * #WebKitNetworkRequest object itself, and add/remove/replace + * headers using the #SoupMessage object it carries, if it is + * present. See webkit_network_request_get_message(). Setting the + * request URI to "about:blank" will effectively cause the request + * to load nothing, and can be used to disable the loading of + * specific resources. + * + * Notice that information about an eventual redirect is available + * in @response's #SoupMessage, not in the #SoupMessage carried by + * the @request. If @response is %NULL, then this is not a + * redirected request. + * + * The #WebKitWebResource object will be the same throughout all + * the lifetime of the resource, but the contents may change from + * inbetween signal emissions. + * + * Since: 1.1.14 + */ + webkit_web_view_signals[RESOURCE_REQUEST_STARTING] = g_signal_new("resource-request-starting", + G_TYPE_FROM_CLASS(webViewClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + 0, + NULL, NULL, + webkit_marshal_VOID__OBJECT_OBJECT_OBJECT_OBJECT, + G_TYPE_NONE, 4, + WEBKIT_TYPE_WEB_FRAME, + WEBKIT_TYPE_WEB_RESOURCE, + WEBKIT_TYPE_NETWORK_REQUEST, + WEBKIT_TYPE_NETWORK_RESPONSE); + /* * implementations of virtual methods */ @@ -1791,6 +2062,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) webViewClass->cut_clipboard = webkit_web_view_real_cut_clipboard; webViewClass->copy_clipboard = webkit_web_view_real_copy_clipboard; webViewClass->paste_clipboard = webkit_web_view_real_paste_clipboard; + webViewClass->undo = webkit_web_view_real_undo; + webViewClass->redo = webkit_web_view_real_redo; webViewClass->move_cursor = webkit_web_view_real_move_cursor; GObjectClass* objectClass = G_OBJECT_CLASS(webViewClass); @@ -1816,6 +2089,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) widgetClass->focus_out_event = webkit_web_view_focus_out_event; widgetClass->get_accessible = webkit_web_view_get_accessible; widgetClass->screen_changed = webkit_web_view_screen_changed; + widgetClass->drag_end = webkit_web_view_drag_end; + widgetClass->drag_data_get = webkit_web_view_drag_data_get; GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webViewClass); containerClass->add = webkit_web_view_container_add; @@ -1852,6 +2127,10 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) "copy_clipboard", 0); gtk_binding_entry_add_signal(binding_set, GDK_v, GDK_CONTROL_MASK, "paste_clipboard", 0); + gtk_binding_entry_add_signal(binding_set, GDK_z, GDK_CONTROL_MASK, + "undo", 0); + gtk_binding_entry_add_signal(binding_set, GDK_z, static_cast<GdkModifierType>(GDK_CONTROL_MASK | GDK_SHIFT_MASK), + "redo", 0); gtk_binding_entry_add_signal(binding_set, GDK_Delete, GDK_SHIFT_MASK, "cut_clipboard", 0); @@ -2112,7 +2391,10 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) gboolean autoLoadImages, autoShrinkImages, printBackgrounds, enableScripts, enablePlugins, enableDeveloperExtras, resizableTextAreas, enablePrivateBrowsing, enableCaretBrowsing, enableHTML5Database, enableHTML5LocalStorage, - enableXSSAuditor, javascriptCanOpenWindows, enableOfflineWebAppCache; + enableXSSAuditor, javascriptCanOpenWindows, enableOfflineWebAppCache, + enableUniversalAccessFromFileURI; + + WebKitEditingBehavior editingBehavior; g_object_get(webSettings, "default-encoding", &defaultEncoding, @@ -2137,6 +2419,8 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) "enable-xss-auditor", &enableXSSAuditor, "javascript-can-open-windows-automatically", &javascriptCanOpenWindows, "enable-offline-web-application-cache", &enableOfflineWebAppCache, + "editing-behavior", &editingBehavior, + "enable-universal-access-from-file-uris", &enableUniversalAccessFromFileURI, NULL); settings->setDefaultTextEncodingName(defaultEncoding); @@ -2161,6 +2445,8 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) settings->setXSSAuditorEnabled(enableXSSAuditor); settings->setJavaScriptCanOpenWindowsAutomatically(javascriptCanOpenWindows); settings->setOfflineWebApplicationCacheEnabled(enableOfflineWebAppCache); + settings->setEditingBehavior(core(editingBehavior)); + settings->setAllowUniversalAccessFromFileURLs(enableUniversalAccessFromFileURI); g_free(defaultEncoding); g_free(cursiveFontFamily); @@ -2243,6 +2529,10 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar settings->setJavaScriptCanOpenWindowsAutomatically(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-offline-web-application-cache")) settings->setOfflineWebApplicationCacheEnabled(g_value_get_boolean(&value)); + else if (name == g_intern_string("editing-behavior")) + settings->setEditingBehavior(core(static_cast<WebKitEditingBehavior>(g_value_get_enum(&value)))); + else if (name == g_intern_string("enable-universal-access-from-file-uris")) + settings->setAllowUniversalAccessFromFileURLs(g_value_get_boolean(&value)); else if (!g_object_class_find_property(G_OBJECT_GET_CLASS(webSettings), name)) g_warning("Unexpected setting '%s'", name); g_value_unset(&value); @@ -2256,7 +2546,7 @@ static void webkit_web_view_init(WebKitWebView* webView) priv->imContext = gtk_im_multicontext_new(); WebKit::InspectorClient* inspectorClient = new WebKit::InspectorClient(webView); - priv->corePage = new Page(new WebKit::ChromeClient(webView), new WebKit::ContextMenuClient(webView), new WebKit::EditorClient(webView), new WebKit::DragClient, inspectorClient); + priv->corePage = new Page(new WebKit::ChromeClient(webView), new WebKit::ContextMenuClient(webView), new WebKit::EditorClient(webView), new WebKit::DragClient(webView), inspectorClient, 0); // We also add a simple wrapper class to provide the public // interface for the Web Inspector. @@ -2294,6 +2584,8 @@ static void webkit_web_view_init(WebKitWebView* webView) g_signal_connect(priv->webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); priv->webWindowFeatures = webkit_web_window_features_new(); + + priv->subResources = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref); } GtkWidget* webkit_web_view_new(void) @@ -2312,14 +2604,16 @@ void webkit_web_view_notify_ready(WebKitWebView* webView) g_signal_emit(webView, webkit_web_view_signals[WEB_VIEW_READY], 0, &isHandled); } -void webkit_web_view_request_download(WebKitWebView* webView, WebKitNetworkRequest* request, const ResourceResponse& response) +void webkit_web_view_request_download(WebKitWebView* webView, WebKitNetworkRequest* request, const ResourceResponse& response, ResourceHandle* handle) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); - WebKitDownload* download = webkit_download_new(request); + WebKitDownload* download; - if (!response.isNull() && !response.suggestedFilename().isEmpty()) - webkit_download_set_suggested_filename(download, response.suggestedFilename().utf8().data()); + if (handle) + download = webkit_download_new_with_handle(request, handle, response); + else + download = webkit_download_new(request); gboolean handled; g_signal_emit(webView, webkit_web_view_signals[DOWNLOAD_REQUESTED], 0, download, &handled); @@ -2535,8 +2829,7 @@ void webkit_web_view_go_back_or_forward(WebKitWebView* webView, gint steps) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); - Frame* frame = core(webView)->mainFrame(); - frame->loader()->goBackOrForward(steps); + core(webView)->goBackOrForward(steps); } /** @@ -2585,8 +2878,7 @@ gboolean webkit_web_view_can_go_back_or_forward(WebKitWebView* webView, gint ste { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); - Frame* frame = core(webView)->mainFrame(); - return frame->loader()->canGoBackOrForward(steps); + return core(webView)->canGoBackOrForward(steps); } /** @@ -2740,6 +3032,12 @@ void webkit_web_view_load_request(WebKitWebView* webView, WebKitNetworkRequest* webkit_web_frame_load_request(frame, request); } +/** + * webkit_web_view_stop_loading: + * @webView: a #WebKitWebView + * + * Stops any ongoing load in the @webView. + **/ void webkit_web_view_stop_loading(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); @@ -2747,7 +3045,7 @@ void webkit_web_view_stop_loading(WebKitWebView* webView) Frame* frame = core(webView)->mainFrame(); if (FrameLoader* loader = frame->loader()) - loader->stopAllLoaders(); + loader->stopForUserCancel(); } /** @@ -2805,7 +3103,11 @@ void webkit_web_view_set_highlight_text_matches(WebKitWebView* webView, gboolean { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); - core(webView)->mainFrame()->setMarkedTextMatchesAreHighlighted(shouldHighlight); + Frame *frame = core(webView)->mainFrame(); + do { + frame->setMarkedTextMatchesAreHighlighted(shouldHighlight); + frame = frame->tree()->traverseNextWithWrap(false); + } while (frame); } /** @@ -3462,3 +3764,205 @@ void webkit_web_view_set_group_name(WebKitWebView* webView, const gchar* groupNa priv->corePage->setGroupName(String::fromUTF8(groupName)); } + +/** + * webkit_web_view_can_undo: + * @web_view: a #WebKitWebView + * + * Determines whether or not it is currently possible to undo the last + * editing command in the view. + * + * Return value: %TRUE if a undo can be done, %FALSE if not + * + * Since: 1.1.14 + */ +gboolean webkit_web_view_can_undo(WebKitWebView* webView) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); + + Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); + return frame->editor()->canUndo(); +} + +/** + * webkit_web_view_undo: + * @web_view: a #WebKitWebView + * + * Undoes the last editing command in the view, if possible. + * + * Since: 1.1.14 + */ +void webkit_web_view_undo(WebKitWebView* webView) +{ + g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); + + if (webkit_web_view_can_undo(webView)) + g_signal_emit(webView, webkit_web_view_signals[UNDO], 0); +} + +/** + * webkit_web_view_can_redo: + * @web_view: a #WebKitWebView + * + * Determines whether or not it is currently possible to redo the last + * editing command in the view. + * + * Return value: %TRUE if a redo can be done, %FALSE if not + * + * Since: 1.1.14 + */ +gboolean webkit_web_view_can_redo(WebKitWebView* webView) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); + + Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); + return frame->editor()->canRedo(); +} + +/** + * webkit_web_view_redo: + * @web_view: a #WebKitWebView + * + * Redoes the last editing command in the view, if possible. + * + * Since: 1.1.14 + */ +void webkit_web_view_redo(WebKitWebView* webView) +{ + g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); + + if (webkit_web_view_can_redo(webView)) + g_signal_emit(webView, webkit_web_view_signals[REDO], 0); +} + + +/** + * webkit_web_view_set_view_source_mode: + * @web_view: a #WebKitWebView + * @view_source_mode: the mode to turn on or off view source mode + * + * Set whether the view should be in view source mode. Setting this mode to + * %TRUE before loading a URI will display the source of the web page in a + * nice and readable format. + * + * Since: 1.1.14 + */ +void webkit_web_view_set_view_source_mode (WebKitWebView* webView, gboolean mode) +{ + g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); + + if (Frame* mainFrame = core(webView)->mainFrame()) + mainFrame->setInViewSourceMode(mode); +} + +/** + * webkit_web_view_get_view_source_mode: + * @web_view: a #WebKitWebView + * + * Return value: %TRUE if @web_view is in view source mode, %FALSE otherwise. + * + * Since: 1.1.14 + */ +gboolean webkit_web_view_get_view_source_mode (WebKitWebView* webView) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); + + if (Frame* mainFrame = core(webView)->mainFrame()) + return mainFrame->inViewSourceMode(); + + return FALSE; +} + +// Internal subresource management +void webkit_web_view_add_resource(WebKitWebView* webView, char* identifier, WebKitWebResource* webResource) +{ + WebKitWebViewPrivate* priv = webView->priv; + + if (!priv->mainResource) { + priv->mainResource = webResource; + priv->mainResourceIdentifier = g_strdup(identifier); + return; + } + + g_hash_table_insert(priv->subResources, identifier, webResource); +} + +WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* identifier) +{ + WebKitWebViewPrivate* priv = webView->priv; + gpointer webResource = NULL; + + gboolean resourceFound = g_hash_table_lookup_extended(priv->subResources, identifier, NULL, &webResource); + + // The only resource we do not store in this hash table is the main! + g_return_val_if_fail(resourceFound || g_str_equal(identifier, priv->mainResourceIdentifier), NULL); + + if (!webResource) + return webkit_web_view_get_main_resource(webView); + + return WEBKIT_WEB_RESOURCE(webResource); +} + +WebKitWebResource* webkit_web_view_get_main_resource(WebKitWebView* webView) +{ + return webView->priv->mainResource; +} + +void webkit_web_view_clear_resources(WebKitWebView* webView) +{ + WebKitWebViewPrivate* priv = webView->priv; + + g_free(priv->mainResourceIdentifier); + priv->mainResourceIdentifier = NULL; + + if (priv->mainResource) { + g_object_unref(priv->mainResource); + priv->mainResource = NULL; + } + + if (priv->subResources) + g_hash_table_remove_all(priv->subResources); +} + +GList* webkit_web_view_get_subresources(WebKitWebView* webView) +{ + WebKitWebViewPrivate* priv = webView->priv; + GList* subResources = g_hash_table_get_values(priv->subResources); + return g_list_remove(subResources, priv->mainResource); +} + +/* From EventHandler.cpp */ +static IntPoint documentPointForWindowPoint(Frame* frame, const IntPoint& windowPoint) +{ + FrameView* view = frame->view(); + // FIXME: Is it really OK to use the wrong coordinates here when view is 0? + // Historically the code would just crash; this is clearly no worse than that. + return view ? view->windowToContents(windowPoint) : windowPoint; +} + +/** + * webkit_web_view_get_hit_test_result: + * @webView: a #WebKitWebView + * @event: a #GdkEventButton + * + * Does a 'hit test' in the coordinates specified by @event to figure + * out context information about that position in the @webView. + * + * Returns: a newly created #WebKitHitTestResult with the context of the + * specified position. + * + * Since: 1.1.15 + **/ +WebKitHitTestResult* webkit_web_view_get_hit_test_result(WebKitWebView* webView, GdkEventButton* event) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); + g_return_val_if_fail(event, NULL); + + PlatformMouseEvent mouseEvent = PlatformMouseEvent(event); + Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); + HitTestRequest request(HitTestRequest::Active); + IntPoint documentPoint = documentPointForWindowPoint(frame, mouseEvent.pos()); + MouseEventWithHitTestResults mev = frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent); + + return kit(mev.hitTestResult()); +} diff --git a/WebKit/gtk/webkit/webkitwebview.h b/WebKit/gtk/webkit/webkitwebview.h index fbdefa8..1297695 100644 --- a/WebKit/gtk/webkit/webkitwebview.h +++ b/WebKit/gtk/webkit/webkitwebview.h @@ -19,8 +19,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_WEB_VIEW_H -#define WEBKIT_WEB_VIEW_H +#ifndef webkitwebview_h +#define webkitwebview_h #include <gtk/gtk.h> #include <libsoup/soup.h> @@ -52,7 +52,10 @@ typedef enum { typedef enum { WEBKIT_WEB_VIEW_TARGET_INFO_HTML, - WEBKIT_WEB_VIEW_TARGET_INFO_TEXT + WEBKIT_WEB_VIEW_TARGET_INFO_TEXT, + WEBKIT_WEB_VIEW_TARGET_INFO_IMAGE, + WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST, + WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL } WebKitWebViewTargetInfo; struct _WebKitWebView { @@ -116,13 +119,15 @@ struct _WebKitWebViewClass { void (* set_scroll_adjustments) (WebKitWebView *web_view, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); + + void (* undo) (WebKitWebView *web_view); + void (* redo) (WebKitWebView *web_view); + /* Padding for future expansion */ void (*_webkit_reserved0) (void); void (*_webkit_reserved1) (void); void (*_webkit_reserved2) (void); void (*_webkit_reserved3) (void); - void (*_webkit_reserved4) (void); - void (*_webkit_reserved5) (void); }; WEBKIT_API GType @@ -339,6 +344,28 @@ webkit_web_view_get_load_status (WebKitWebView *web_view) WEBKIT_API gdouble webkit_web_view_get_progress (WebKitWebView *web_view); +WEBKIT_API void +webkit_web_view_undo (WebKitWebView *webView); + +WEBKIT_API gboolean +webkit_web_view_can_undo (WebKitWebView *webView); + +WEBKIT_API void +webkit_web_view_redo (WebKitWebView *webView); + +WEBKIT_API gboolean +webkit_web_view_can_redo (WebKitWebView *webView); + +WEBKIT_API void +webkit_web_view_set_view_source_mode (WebKitWebView *web_view, + gboolean view_source_mode); + +WEBKIT_API gboolean +webkit_web_view_get_view_source_mode (WebKitWebView *web_view); + +WEBKIT_API WebKitHitTestResult* +webkit_web_view_get_hit_test_result (WebKitWebView *webView, + GdkEventButton *event); G_END_DECLS #endif diff --git a/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp b/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp index 47610d3..cdb6858 100644 --- a/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp +++ b/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp @@ -371,7 +371,7 @@ static void webkit_web_window_features_get_property(GObject* object, guint prop_ * * Returns: a new #WebKitWebWindowFeatures instance * - * Since 1.0.3 + * Since: 1.0.3 */ WebKitWebWindowFeatures* webkit_web_window_features_new() { @@ -418,7 +418,7 @@ WebKitWebWindowFeatures* webkit_web_window_features_new_from_core_features(const * Returns: %TRUE if the instances have the same values, %FALSE * otherwise * - * Since 1.0.3 + * Since: 1.0.3 */ gboolean webkit_web_window_features_equal(WebKitWebWindowFeatures* features1, WebKitWebWindowFeatures* features2) { diff --git a/WebKit/gtk/webkit/webkitwebwindowfeatures.h b/WebKit/gtk/webkit/webkitwebwindowfeatures.h index cd28988..a79119d 100644 --- a/WebKit/gtk/webkit/webkitwebwindowfeatures.h +++ b/WebKit/gtk/webkit/webkitwebwindowfeatures.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WEBKIT_WEB_WINDOW_FEATURES_H -#define WEBKIT_WEB_WINDOW_FEATURES_H +#ifndef webkitwebwindowfeatures_h +#define webkitwebwindowfeatures_h #include <glib-object.h> @@ -65,4 +65,4 @@ webkit_web_window_features_equal (WebKitWebWindowFeatures* feature G_END_DECLS -#endif /* WEBKIT_WEB_WINDOW_FEATURES_H */ +#endif /* webkitwebwindowfeatures_h */ diff --git a/WebKit/gtk/webkit/webkitworkers.cpp b/WebKit/gtk/webkit/webkitworkers.cpp new file mode 100644 index 0000000..255863c --- /dev/null +++ b/WebKit/gtk/webkit/webkitworkers.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. + */ + +#include "config.h" +#include "webkitprivate.h" + +#include "WorkerThread.h" + +unsigned int webkit_worker_thread_count(void) +{ +#if ENABLE(WORKERS) + return WebCore::WorkerThread::workerThreadCount(); +#else + return 0; +#endif +} + + diff --git a/WebKit/gtk/webkitmarshal.list b/WebKit/gtk/webkitmarshal.list index aa0d40c..fefdff3 100644 --- a/WebKit/gtk/webkitmarshal.list +++ b/WebKit/gtk/webkitmarshal.list @@ -13,6 +13,7 @@ OBJECT:OBJECT OBJECT:STRING,STRING,POINTER OBJECT:VOID VOID:OBJECT,OBJECT +VOID:OBJECT,OBJECT,OBJECT,OBJECT VOID:OBJECT,POINTER,POINTER VOID:OBJECT,STRING VOID:STRING diff --git a/WebKit/haiku/ChangeLog b/WebKit/haiku/ChangeLog index f73a332..457e3f4 100644 --- a/WebKit/haiku/ChangeLog +++ b/WebKit/haiku/ChangeLog @@ -1,3 +1,43 @@ +2009-10-07 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Factor PolicyChecker out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=30155 + + Move the policy callback to the policy object. + + * WebCoreSupport/FrameLoaderClientHaiku.cpp: + (WebCore::FrameLoaderClientHaiku::dispatchWillSubmitForm): + (WebCore::FrameLoaderClientHaiku::dispatchDecidePolicyForMIMEType): + (WebCore::FrameLoaderClientHaiku::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientHaiku::dispatchDecidePolicyForNavigationAction): + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Reflect the rename of platformWindow and it's return type. + + * WebCoreSupport/ChromeClientHaiku.cpp: + (WebCore::ChromeClientHaiku::platformPageClient): + * WebCoreSupport/ChromeClientHaiku.h: + +2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Holger Freyther. + + https://bugs.webkit.org/show_bug.cgi?id=25889 + [GTK] scrollbar policy for main frame is not implementable + + Add empty implementation for new ChromeClient method. + + * WebCoreSupport/ChromeClientHaiku.h: + (ChromeClientHaiku::scrollbarsModeDidChange): + 2009-07-29 Kevin McCullough <kmccullough@apple.com> Reviewed by Darin Adler. diff --git a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp index 8932da1..4820d78 100644 --- a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp +++ b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp @@ -271,7 +271,7 @@ IntRect ChromeClientHaiku::windowToScreen(const IntRect&) const return IntRect(); } -PlatformWidget ChromeClientHaiku::platformWindow() const +PlatformPageClient ChromeClientHaiku::platformPageClient() const { notImplemented(); return PlatformWidget(); diff --git a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h index 386c380..a6f57eb 100644 --- a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h +++ b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h @@ -104,7 +104,7 @@ namespace WebCore { void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); IntPoint screenToWindow(const IntPoint&) const; IntRect windowToScreen(const IntRect&) const; - PlatformWidget platformWindow() const; + PlatformPageClient platformPageClient() const; void contentsSizeChanged(Frame*, const IntSize&) const; void scrollRectIntoView(const IntRect&, const ScrollView*) const; @@ -112,6 +112,7 @@ namespace WebCore { void scrollBackingStore(int, int, const IntRect&, const IntRect&); void updateBackingStore(); + void scrollbarsModeDidChange() const { } void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); void setToolTip(const String&); diff --git a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp index d2683c0..a8ba16f 100644 --- a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp +++ b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp @@ -280,7 +280,7 @@ void FrameLoaderClientHaiku::dispatchWillSubmitForm(FramePolicyFunction function // FIXME: Send an event to allow for alerts and cancellation. if (!m_frame) return; - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } void FrameLoaderClientHaiku::dispatchDidLoadMainResource(DocumentLoader*) @@ -635,7 +635,7 @@ void FrameLoaderClientHaiku::dispatchDecidePolicyForMIMEType(FramePolicyFunction return; notImplemented(); - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } void FrameLoaderClientHaiku::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, @@ -650,12 +650,12 @@ void FrameLoaderClientHaiku::dispatchDecidePolicyForNewWindowAction(FramePolicyF BMessage message(NEW_WINDOW_REQUESTED); message.AddString("url", request.url().string()); if (m_messenger->SendMessage(&message)) { - (m_frame->loader()->*function)(PolicyIgnore); + (m_frame->loader()->policyChecker()->*function)(PolicyIgnore); return; } } - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } void FrameLoaderClientHaiku::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, @@ -671,7 +671,7 @@ void FrameLoaderClientHaiku::dispatchDecidePolicyForNavigationAction(FramePolicy message.AddString("url", request.url().string()); m_messenger->SendMessage(&message); - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } } diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index e35709c..63c888a 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,1362 @@ +2009-10-07 Simon Fraser <simon.fraser@apple.com> + + Re-land 49269-49271 since reverting them did not fix the tests. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView drawRect:]): + +2009-10-07 Simon Fraser <simon.fraser@apple.com> + + Revert 49269-49271 to see if it fixes test failures on SnowLeopard that do not + reproduce locally. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView drawRect:]): + +2009-10-07 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Factor PolicyChecker out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=30155 + + Move the policy callback to the policy object. + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::dispatchWillSubmitForm): + (WebFrameLoaderClient::receivedPolicyDecison): + +2009-10-07 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + Send title changes to the global history delegate. + <rdar://problem/7285293> and https://webkit.org/b/29904 + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::setTitle): + * WebView/WebDelegateImplementationCaching.h: + * WebView/WebHistoryDelegate.h: + * WebView/WebView.mm: + (-[WebView _cacheHistoryDelegateImplementations]): + +2009-10-07 Darin Adler <darin@apple.com> + + Reviewed by John Sullivan. + + Make the setMetadataURL function foolproof by having it remove user info + https://bugs.webkit.org/show_bug.cgi?id=30178 + rdar://problem/6544670 + + * Misc/WebNSFileManagerExtras.m: + (-[NSFileManager _webkit_setMetadataURL:referrer:atPath:]): + Call _web_URLByRemovingUserInfo on the passed in URL string after converting + it to a URL, and then convert it back to a string. + + * Misc/WebNSURLExtras.h: Added _web_URLByRemovingUserInfo. + * Misc/WebNSURLExtras.mm: Removed unused WebKitURLComponents struct. + (-[NSURL _web_URLByTruncatingOneCharacterBeforeComponent:]): Renamed to be + clearer on what this does. + (-[NSURL _webkit_URLByRemovingFragment]): Changed to call new name. + (-[NSURL _webkit_URLByRemovingResourceSpecifier]): Ditto. + (-[NSURL _web_URLByRemovingComponentAndSubsequentCharacter:]): Added. + (-[NSURL _web_URLByRemovingUserInfo]): Added. + +2009-10-07 Simon Fraser <simon.fraser@apple.com> + + Make Dan Bernstein happy. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView drawRect:]): + +2009-10-07 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Avoid Obj-C message dispatch when possible by storing accessed objects + in local variables. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView drawRect:]): + +2009-10-07 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Animation stalls for a few seconds partway through + https://bugs.webkit.org/show_bug.cgi?id=30182 + + Make sure that we only call -disableScreenUpdatesUntilFlush when a window + update is actually going to happen, otherwise screen updates are disabled + for too long. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView drawRect:]): + +2009-10-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: default to an attached inspector window on Windows (as on Mac). + + https://bugs.webkit.org/show_bug.cgi?id=30134 + + * WebCoreSupport/WebInspectorClient.mm: + (-[WebInspectorWindowController showWindow:]): + +2009-10-06 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move FrameLoader::canLoad to SecurityOrigin + https://bugs.webkit.org/show_bug.cgi?id=30111 + + * Plugins/Hosted/HostedNetscapePluginStream.mm: + (WebKit::HostedNetscapePluginStream::HostedNetscapePluginStream): + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::loadRequest): + * Plugins/WebBaseNetscapePluginStream.mm: + (WebNetscapePluginStream::WebNetscapePluginStream): + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]): + * Plugins/WebPluginContainerCheck.mm: + (-[WebPluginContainerCheck _isForbiddenFileLoad]): + * WebView/WebFrame.mm: + (-[WebFrame _allowsFollowingLink:]): + +2009-10-06 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move setLocalLoadPolicy and friends to SecurityOrigin + https://bugs.webkit.org/show_bug.cgi?id=30110 + + Call the new API. + + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + +2009-10-06 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Mark Rowe. + + accessibility/media-element.html crashes (and has incorrect result) + https://bugs.webkit.org/show_bug.cgi?id=30108 + + Fix up the accessibilty label for the newly added fullscreen button, + and update the test result accordingly. + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory localizedMediaControlElementString:]): + Handle "ControlsPanel" which is just an empty container, to avoid + asserting in debug builds. + +2009-10-06 Daniel Bates <dbates@webkit.org> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=30107 + + Fixes an issue where the Mac build does return the correct drop effect + with respect to the HTML 5 specification when effectAllowed == "none". + + Currently, when effectAllowed == "none" and dropEffect == "copy" or + dropEffect == "move" the resulting drop effect is "copy" and "move", + respectively. However, the HTML 5 specification states that regardless + of the specified dropEffect, when effectAllowed == "none" the resulting + drop effect should be "none". + + * WebView/WebHTMLView.mm: + (-[WebHTMLView draggingSourceOperationMaskForLocal:]): + +2009-10-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: close inspector client view on + InspectorController::close API call. + + In order to run batch web inspector layout tests (and not affect + subsequent tests) we should close inspector client's view upon + InspectorController::close API call. + + https://bugs.webkit.org/show_bug.cgi?id=30009 + + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorClient::createPage): + +2009-10-05 Dan Bernstein <mitz@apple.com> + + Rubber-stamped by Mark Rowe. + + Moved a WebPluginHalterClient out of the WebCore namesapce. + + * WebCoreSupport/WebPluginHalterClient.h: + +2009-10-05 Kevin Decker <kdecker@apple.com> + + Reviewed by Dan Bernstein. + + Added new PluginHalter client, delegate and few more WebPreferences keys. + + * WebView/WebPreferenceKeysPrivate.h: Added two new keys. + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): Initialize newly added key. + (-[WebPreferences pluginAllowedRunTime]): Added. + (-[WebPreferences setPluginAllowedRunTime:]): Added. + * WebView/WebPreferencesPrivate.h: Added above two methods. + * WebView/WebUIDelegatePrivate.h: Added shouldHaltPlugin delegate. + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + Setup a new WebPluginHalterClient. + (-[WebView _preferencesChangedNotification:]): Update WebCore settings accordingly. + * WebCoreSupport/WebPluginHalterClient.h: Added. + * WebCoreSupport/WebPluginHalterClient.mm: Added. + (WebPluginHalterClient::WebPluginHalterClient): + (WebPluginHalterClient::shouldHaltPlugin): Added, invoke the delegate. + +2009-10-05 Simon Fraser <simon.fraser@apple.com> + + More build fixes for Tiger. + + * WebView/WebVideoFullscreenController.mm: + +2009-10-05 Simon Fraser <simon.fraser@apple.com> + + More build fixes for Tiger. + + * WebView/WebVideoFullscreenController.mm: + (-[WebVideoFullscreenWindow animationDidEnd:]): + * WebView/WebWindowAnimation.m: + +2009-10-05 Simon Fraser <simon.fraser@apple.com> + + More build fixes for Tiger. + + * WebView/WebVideoFullscreenController.mm: + * WebView/WebVideoFullscreenHUDWindowController.mm: + (-[WebVideoFullscreenHUDWindow initWithContentRect:styleMask:backing:defer:]): + (-[WebVideoFullscreenHUDWindowController scheduleTimeUpdate]): + (-[WebVideoFullscreenHUDWindowController fadeWindowIn]): + (-[WebVideoFullscreenHUDWindowController fadeWindowOut]): + (-[WebVideoFullscreenHUDWindowController closeWindow]): + +2009-10-05 Simon Fraser <simon.fraser@apple.com> + + Build fixes for Tiger. + + * WebView/WebVideoFullscreenHUDWindowController.h: + * WebView/WebVideoFullscreenHUDWindowController.mm: + (-[WebVideoFullscreenHUDWindow initWithContentRect:styleMask:backing:defer:]): + (-[WebVideoFullscreenHUDWindowController dealloc]): + (-[WebVideoFullscreenHUDWindowController closeWindow]): + (-[WebVideoFullscreenHUDWindowController windowDidLoad]): + +2009-10-05 Simon Fraser <simon.fraser@apple.com> + + Build fix. If you call Node::hasTagName(), you also have to include Element.h. + + * WebCoreSupport/WebChromeClient.mm: + +2009-10-05 Pierre d'Herbemont <pdherbemont@webkit.org> + + Reviewed by Simon Fraser + + Support fullscreen in MediaPlayer (Mac) + https://bugs.webkit.org/show_bug.cgi?id=26742 + + Add a fullscreen button to the <video> controller if the media engine, + and the theme have support for fullscreen, and can show appropriate controls. + Clicking the button calls through the ChromeClient to the WebVideoFullscreenController + in WebKit to do a nice animation to fullscreen, with a custom controller. + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::supportsFullscreenForNode): + (WebChromeClient::enterFullscreenForNode): + (WebChromeClient::exitFullscreenForNode): + New methods to ask whether fullscreen is possible for a given node, and + notifications on enterying and exiting fullscreen. + + * WebView/WebVideoFullscreenController.h: Added. + * WebView/WebVideoFullscreenController.mm: Added. + WebVideoFullscreenController is responsible for creating the fullscreen window, + and coordinating the various animations when going fullscreen. + + * WebView/WebVideoFullscreenHUDWindowController.h: Added. + * WebView/WebVideoFullscreenHUDWindowController.mm: Added. + This class manages the heads-up display (HUD) control bar. + + * WebView/WebView.mm: + (-[WebView _close]): + Make sure we come out of fullscreen if the WebView is torn down (e.g. if + you close a background window). + + (-[WebView _enterFullscreenForNode:WebCore::]): + Make a WebVideoFullscreenController and tell is to start to go fullscreen. + + (-[WebView _exitFullscreen]): + Tell the WebVideoFullscreenController to come out of fullscreen, and clean up. + + * WebView/WebViewData.h: + * WebView/WebViewData.mm: + (-[WebViewPrivate dealloc]): + (-[WebViewPrivate finalize]): + * WebView/WebViewInternal.h: + Keep a pointer to the WebVideoFullscreenController. + + * WebView/WebWindowAnimation.h: Added. + * WebView/WebWindowAnimation.m: Added. + (WebWindowAnimationDurationFromDuration): + (scaledRect): + (squaredDistance): + Handle the animations used during the transitition to fullscreen. + +2009-10-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Kevin Decker. + + WebKit side of <rdar://problem/7179166> + + * Plugins/Hosted/NetscapePluginInstanceProxy.h: + Add an m_pluginIsWaitingForDraw member variable. + + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::NetscapePluginInstanceProxy): + Initialize m_pluginIsWaitingForDraw. + + (WebKit::NetscapePluginInstanceProxy::invalidateRect): + Set m_pluginIsWaitingForDraw to true. + + (WebKit::NetscapePluginInstanceProxy::didDraw): + If m_pluginIsWaitingForDraw is true, call _WKPHPluginInstanceDidDraw. + + * Plugins/Hosted/WebHostedNetscapePluginView.mm: + (-[WebHostedNetscapePluginView drawRect:]): + Call didDraw. + + * Plugins/Hosted/WebKitPluginHost.defs: + Add PHPluginInstanceDidDraw. + +2009-10-02 Chris Marrin <cmarrin@apple.com> + + Reviewed by Adele Peterson. + + Add functionality to pause/throttle CSS transitions/animations in a WebView + https://bugs.webkit.org/show_bug.cgi?id=29942 + + Added both a setter and getter function + + * WebView/WebView.mm: + (-[WebView cssAnimationsSuspended]): + (-[WebView setCSSAnimationsSuspended:]): + * WebView/WebViewData.h: + * WebView/WebViewData.mm: + (-[WebViewPrivate init]): + * WebView/WebViewPrivate.h: + +2009-10-04 Kevin Decker <kdecker@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/7273363> Plug-ins should use PluginHalter + + * Plugins/WebBaseNetscapePluginView.h: Add WebHaltablePlugin forward declare and _haltable ivar. + * Plugins/WebBaseNetscapePluginView.mm: + (WebHaltablePlugin::WebHaltablePlugin): Added. + (WebHaltablePlugin::halt): New method that stops a plug-in. + (WebHaltablePlugin::restart): New method that starts a plug-in. + (WebHaltablePlugin::node): Added. Provides the DOMNode corresponding to the plug-in in WebBaseNetscapePluginView. + (-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:WebCore::]): + Initialize new _haltable ivar. + (-[WebBaseNetscapePluginView start]): Call the page's didStartPlugin() upon starting a plug-in. + (-[WebBaseNetscapePluginView stop]): Call the page's didStopPlugin() upon stopping a plug-in. + +2009-10-05 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: add testing harness for Web Inspector. + + https://bugs.webkit.org/show_bug.cgi?id=30010 + + * WebInspector/WebInspector.mm: + (-[WebInspector evaluateInFrontend:callId:script:]): + * WebInspector/WebInspectorPrivate.h: Added. + +2009-10-04 Kevin Decker <kdecker@apple.com> + + Reviewed by Cameron Zwarich. + + * WebView/WebPreferenceKeysPrivate.h: Added new key. + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): Leave plug-in halting disabled by default. + (-[WebPreferences pluginHalterEnabled]): Added. + (-[WebPreferences setPluginHalterEnabled:]): Ditto. + * WebView/WebPreferencesPrivate.h: Added above new methods. + +2009-10-02 Dave Hyatt <hyatt@apple.com> + + Reviewed by Adam Roben. + + Add support for blacklist patterns to user stylesheets and scripts in addition to whitelist patterns. + + * WebView/WebView.mm: + (toStringVector): + (+[WebView _addUserScriptToGroup:source:url:worldID:whitelist:blacklist:injectionTime:]): + (+[WebView _addUserStyleSheetToGroup:source:url:worldID:whitelist:blacklist:]): + * WebView/WebViewPrivate.h: + +2009-10-01 Mark Rowe <mrowe@apple.com> + + Fix the Tiger build. Don't unconditionally enable 3D canvas as it is not supported on Tiger. + + * Configurations/FeatureDefines.xcconfig: + +2009-10-01 Chris Marrin <cmarrin@apple.com> + + Reviewed by Oliver Hunt. + + Turn on ENABLE_3D_CANVAS in TOT + https://bugs.webkit.org/show_bug.cgi?id=29906 + + * Configurations/FeatureDefines.xcconfig: + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences webGLEnabled]): + (-[WebPreferences setWebGLEnabled:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2009-09-30 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Fix for <rdar://problem/7259706> + Need WebKit API or SPI on Mac and Windows to test whether it's safe to load a page in a new tab/window + + * WebView/WebFrame.mm: + (-[WebFrame _allowsFollowingLink:]): + * WebView/WebFramePrivate.h: + +2009-09-30 Dave Hyatt <hyatt@apple.com> + + Reviewed by Adam Roben. + + Add the ability to remove user stylesheets and scripts by URL. + + * WebView/WebView.mm: + (+[WebView _removeUserContentFromGroup:url:worldID:]): + * WebView/WebViewPrivate.h: + +2009-09-29 Brady Eidson <beidson@apple.com> + + Rubberstamped by Dan Bernstein. + + Fix license and some sorting in new files. + + * WebView/WebHistoryDelegate.h: + * WebView/WebNavigationData.h: + * WebView/WebNavigationData.mm: + +2009-09-29 Brady Eidson <beidson@apple.com> + + Reviewed by John Sullivan. + + WebKit Mac API should provide a delegate interface for global history. + <rdar://problem/7042773> and https://webkit.org/b/29904 + + * WebView/WebHistoryDelegate.h: Added. New interface for WebKit clients to implement to manage + their own global history store. + + Object to store all of the bits of data relevant to a page visit: + * WebView/WebNavigationData.h: Added. + * WebView/WebNavigationData.mm: Added. + (-[WebNavigationDataPrivate dealloc]): + (-[WebNavigationData initWithURLString:title:originalRequest:response:hasSubstituteData:clientRedirectSource:]): + (-[WebNavigationData url]): + (-[WebNavigationData title]): + (-[WebNavigationData originalRequest]): + (-[WebNavigationData response]): + (-[WebNavigationData hasSubstituteData]): + (-[WebNavigationData clientRedirectSource]): + (-[WebNavigationData dealloc]): + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::updateGlobalHistory): If the delegate exists, don't use the built-in WebHistory. + If the implementation for this method exists, call it. + (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): Ditto + + * WebView/WebDelegateImplementationCaching.h: + * WebView/WebDelegateImplementationCaching.mm: + (WebViewGetHistoryDelegateImplementations): + (CallHistoryDelegate): + + * WebView/WebView.mm: + (-[WebView _cacheHistoryDelegateImplementations]): + (-[WebView setHistoryDelegate:]): + (-[WebView historyDelegate]): + * WebView/WebViewData.h: + * WebView/WebViewPrivate.h: + +2009-09-29 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Add support for run-time flag for 3D canvas + https://bugs.webkit.org/show_bug.cgi?id=29826 + + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): Enable experimental + WebGL flag when 3D_CANVAS is enabled in the build. + +2009-09-28 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Eric Seidel. + + Add experimentalWebSocketsEnabled in WebPreferences. + https://bugs.webkit.org/show_bug.cgi?id=28941 + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences experimentalWebSocketsEnabled]): + (-[WebPreferences setExperimentalWebSocketsEnabled:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2009-09-28 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/7240911> REGRESSION (r48586): Crash occurs when loading + a PDF + + CGPDFObjectRef is not a CFTypeRef, and cannot be retained or released. + Its lifetime is managed by its container. Just use a Vector to store + CGPDFObjectRefs, relying on the CGPDFDocument to keep them alive. + + * WebView/WebPDFDocumentExtras.mm: + (appendValuesInPDFNameSubtreeToVector): + (getAllValuesInPDFNameTree): + (web_PDFDocumentAllScripts): + +2009-09-24 Jon Honeycutt <jhoneycutt@apple.com> + + Reviewed by Alice Liu. + + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + Pass 0 for new Page constructor argument. + +2009-09-14 John Gregg <johnnyg@google.com> + + Reviewed by Eric Seidel. + + isEnabled switch for notifications (experimental) in Page Settings + https://bugs.webkit.org/show_bug.cgi?id=28930 + + Adds support for the experimentalNotificationsEnabled flag in Settings + through WebPreferencesPrivate. + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences experimentalNotificationsEnabled]): + (-[WebPreferences setExperimentalNotificationsEnabled:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2009-09-23 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Updated for a WebCore rename. + + * WebView/WebFrame.mm: + (-[WebFrame _cacheabilityDictionary]): + +2009-09-23 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + Speed up access to history items by caching date computation. + + * History/WebHistory.mm: + (getDayBoundaries): Refactored from timeIntervalForBeginningOfDay. + Returns the beginning of the day that the passed time is within and + the beginning of the next day. + (beginningOfDay): Added. Uses getDayBoundaries so it can be fast for + multiple dates within the same day, which is the common case. + (dateKey): Added. Calls beginningOfDay and converts to an integer. + (-[WebHistoryPrivate findKey:forDay:]): Changed to call dateKey + insetad of timeIntervalForBeginningOfDay. + +2009-09-23 David Kilzer <ddkilzer@apple.com> + + Move definition of USE(PLUGIN_HOST_PROCESS) from WebKitPrefix.h to Platform.h + + Reviewed by Mark Rowe. + + * WebKitPrefix.h: Removed definition of + WTF_USE_PLUGIN_HOST_PROCESS. + +2009-09-22 Timothy Hatcher <timothy@apple.com> + + Prevent scrolling multiple frames during latched wheel events. + + Reviewed by Anders Carlsson. + + * WebView/WebDynamicScrollBarsView.h: + * WebView/WebDynamicScrollBarsView.mm: + (-[WebDynamicScrollBarsView scrollWheel:]): + +2009-09-22 Dan Bernstein <mitz@apple.com> + + Reviewed by John Sullivan. + + <rdar://problem/7240911> REGRESSION (r48586): Crash occurs when loading + a PDF + + * WebView/WebPDFDocumentExtras.mm: + (addWebPDFDocumentExtras): Made methodList static, because + class_addMethods() doesn't copy it. + +2009-09-21 Dan Bernstein <mitz@apple.com> + + Attempt to fix the Tiger build + + * WebView/WebPDFDocumentExtras.mm: + (addWebPDFDocumentExtras): + +2009-09-21 Dan Bernstein <mitz@apple.com> + + Attempt to fix the Tiger build + + * WebView/WebPDFDocumentExtras.mm: + (web_PDFDocumentAllScripts): + (addWebPDFDocumentExtras): + +2009-09-21 Dan Bernstein <mitz@apple.com> + + Attempt to fix the Tiger build + + * WebView/WebPDFDocumentExtras.mm: + * WebView/WebPDFRepresentation.mm: + +2009-09-21 Dan Bernstein <mitz@apple.com> + + Attempt to fix the Leopard and Tiger builds + + * WebView/WebPDFDocumentExtras.mm: + +2009-09-21 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/4137135> iFrame with PDF not being handled correctly on + usps.com + https://bugs.webkit.org/show_bug.cgi?id=4151 + + * WebView/WebJSPDFDoc.h: Added. + * WebView/WebJSPDFDoc.mm: Added. + (jsPDFDocInitialize): Retains the WebDataSource. + (jsPDFDocFinalize): Releases the WebDataSource. + (jsPDFDocPrint): Call the WebUIDelegate method -webView:printFrameView: + with the PDF document's view. + (makeJSPDFDoc): Makes and returns a JavaScript Doc instance that wraps + the WebDataSource. + * WebView/WebPDFDocumentExtras.h: Added. + * WebView/WebPDFDocumentExtras.mm: Added. + (appendValuesInPDFNameSubtreeToArray): Traverses a subtree of a PDF name + tree and adds all values in the subtree to an array. + (allValuesInPDFNameTree): Returns an array with all of the values in a + PDF name tree. + (web_PDFDocumentAllScripts): This is the implementation of -[PDFDocument + _web_allScripts]. It gets all values in the document-level "JavaScript" + name tree, which are action dictionaries, and returns an array of the + actions' scripts. + (addWebPDFDocumentExtras): Adds the -_web_allScripts method to + PDFDocument. + * WebView/WebPDFRepresentation.h: + * WebView/WebPDFRepresentation.m: Removed. + * WebView/WebPDFRepresentation.mm: Copied from WebKit/mac/WebView/WebPDFRepresentation.m. + (+[WebPDFRepresentation initialize]): Added. Calls + addWebPDFDocumentExtras(). + (-[WebPDFRepresentation finishedLoadingWithDataSource:]): Get the + scripts from the PDF document, create a JavaScript Doc object for the + document, and a JavaScript execution context, then execute every script + in the context, with the Doc object as "this". + +2009-09-17 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Compositing layers are incorrectly positioned after scrolling with position:fixed + https://bugs.webkit.org/show_bug.cgi?id=29262 + + When scrolling a page with compositing layers inside a position:fixed element, + we need to update the compositing layer positions when the scroll position changes. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _frameOrBoundsChanged]): + Call the new FrameView::scrollPositionChanged() method rather than sending the + scroll event directly. + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Reflect the rename of platformWindow and it's return type. + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::platformPageClient): + +2009-09-17 Anders Carlsson <andersca@apple.com> + + Reviewed by Oliver Hunt. + + <rdar://problem/7007541> + CrashTracer: 4800+ crashes in Safari at com.apple.WebKit • WTF::HashTableIterator... + + Add null checks for m_instanceProxy (It will be null when a plug-in has crashed). + + * Plugins/Hosted/ProxyInstance.mm: + (WebKit::ProxyInstance::invoke): + (WebKit::ProxyInstance::supportsInvokeDefaultMethod): + (WebKit::ProxyInstance::supportsConstruct): + (WebKit::ProxyInstance::getPropertyNames): + (WebKit::ProxyInstance::methodsNamed): + (WebKit::ProxyInstance::fieldNamed): + (WebKit::ProxyInstance::fieldValue): + (WebKit::ProxyInstance::setFieldValue): + (WebKit::ProxyInstance::invalidate): + +2009-09-16 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Work around a bug in AppKit on Leopard which causes compositing layers to jitter, and + become misplaced when the WebHTMLView is resized or scrolled sometimes. + <rdar://problem/7071636> + + The previous fix didn't fix the case where the layers jiggle when resizing the docked + inspector when the view size is over 2048px tall, on Leopard. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _updateLayerHostingViewPosition]): + +2009-09-16 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Oliver Hunt. + + Work around a bug in AppKit on Leopard which causes compositing layers to jitter, and + become misplaced when the WebHTMLView is resized or scrolled sometimes. + <rdar://problem/7071636> + + We call an internal AppKit method to make sure the layer geometry is updated correctly. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _updateLayerHostingViewPosition]): + +2009-09-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Fixed position elements flash when CSS transforms are applied on page > 2048px tall + https://bugs.webkit.org/show_bug.cgi?id=27272 + + Update the previous workaround for misplaced compositing layers, which used a 4096px + threshold, to 2048px since that's the GPU max texture size on some older hardware. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _updateLayerHostingViewPosition]): + +2009-09-15 Alex Milowski <alex@milowski.com> + + Reviewed by Tor Arne Vestbø. + + Added the ENABLE_MATHML to the feaure defines + + * Configurations/FeatureDefines.xcconfig: + +2009-09-15 Mark Rowe <mrowe@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/7224378> REGRESSION(r48360): Dragging a tab with a plug-in out of a window, the plug-in gets slow and confused + + In r48360, the fix for <rdar://problem/7090444>, I neglected to consider the case where the plug-in had already been started and + -start would do an early-return rather than calling -restartTimers and -addWindowObservers itself. + + * Plugins/WebBaseNetscapePluginView.mm: + (-[WebBaseNetscapePluginView viewDidMoveToWindow]): Reinstate the call to -restartTimers and -addWindowObservers, but guard them + with a check that the view is still in the window. + +2009-09-14 Brady Eidson <beidson@apple.com> + + Reviewed by Alexey Proskuryakov. + + Safari 4 cannot be used to update firmware on Linksys routers. + <rdar://problem/7174050> and https://bugs.webkit.org/show_bug.cgi?id=29160 + + Adopt the new WebCore::CredentialStorage in WebKit/Mac. + + * Misc/WebDownload.mm: + (-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]): + * Plugins/WebBaseNetscapePluginView.mm: + (WebKit::getAuthenticationInfo): + +2009-09-12 Mark Rowe <mrowe@apple.com> + + Reviewed by Anders Carlsson. + + Fix <rdar://problem/7090444> Crashes in-[WebBaseNetscapePluginView stop] handling NSWindowWillCloseNotification. + + It's not valid to call -addWindowObservers when the view is not in a window, but this can happen when -start + initializes a plug-in and the plug-in removes itself from the document during initialization. -viewDidMoveToWindow + calls -start and then calls -addWindowObservers without ensuring that the view is still in a window. + + If -[WebBaseNetscapePluginView addWindowObservers] is incorrectly called when the view is not in a window, it will + observe NSWindowWillCloseNotification on all windows. This unexpected observer registration is not balanced by an + unregistration so the notification can be delivered after the view is deallocated, causing the crash seen in + <rdar://problem/7090444>. + + * Plugins/WebBaseNetscapePluginView.mm: + (-[WebBaseNetscapePluginView start]): Only call -updateAndSetWindow if we still have a current window. + (-[WebBaseNetscapePluginView viewDidMoveToWindow]): Remove unnecessary calls to -restartTimers and -addWindowObservers + from -[WebBaseNetscapePluginView viewDidMoveToWindow]. They are already called from within -start with the extra benefit + of ensuring that the view is still in a window when they are called. + +2009-09-11 Mark Rowe <mrowe@apple.com> + + Reviewed by Jon Honeycutt. + + Fix <rdar://problem/7145242> Crashes inside WTF::HashTable below NetscapePluginInstanceProxy::disconnectStream + + * Plugins/Hosted/HostedNetscapePluginStream.mm: + (WebKit::HostedNetscapePluginStream::cancelLoad): Canceling the load can result in calling through to disconnectStream. + If the plug-in instance holds the last reference to the plug-in stream this will result in the stream being deallocated. + This leads to HostedNetscapePluginStream::cancelLoad's call to disconnectStream being passed a deallocated stream object. + Since the stream was already disconnected by the call to cancel there's no need to call disconnectStream a second time. + +2009-09-11 Eric Seidel <eric@webkit.org> + + No review, rolling out r48229. + http://trac.webkit.org/changeset/48229 + + * WebView/WebFrame.mm: + (-[WebFrame _dragSourceMovedTo:]): + +2009-09-10 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Sam Weinig. + + Update JavaScriptCore and WebKit's FeatureDefines.xcconfig so that they are in sync with WebCore as they need to be. + + * Configurations/FeatureDefines.xcconfig: + +2009-09-09 Jens Alfke <snej@chromium.org> + + Reviewed by Eric Seidel. + + Initialize DataTransfer's effectAllowed and dropEffect properties correctly + according to HTML5 spec (sec. 7.9.2-7.9.3). + https://bugs.webkit.org/show_bug.cgi?id=26700 + + * WebView/WebFrame.mm: + (-[WebFrame _dragSourceMovedTo:]): + Pass current drag operation (if known) to EventHandler::dragSourceMovedTo(). + +2009-09-09 Dave Hyatt <hyatt@apple.com> + + Reviewed by Adam Roben. + + https://bugs.webkit.org/show_bug.cgi?id=29102, add support for user stylesheet injection. This is similar + to user script injection but allows for user stylesheets to be added. The stylesheets are applied immediately + to all Frames in the PageGroup. + + Added userscripts/simple-stylesheet.html test case. + + * WebView/WebView.mm: + (+[WebView _addUserStyleSheetToGroup:source:url:worldID:patterns:]): + * WebView/WebViewPrivate.h: + +2009-09-07 Steve Block <steveblock@google.com> + + Reviewed by Adam Barth. + + Adds a mock Geolocation service. This will be used to provide predictable behavior of the + Geolocation API for use in LayoutTests. Later changes will integrate the the mock + Geolocation service with DumpRenderTree. + https://bugs.webkit.org/show_bug.cgi?id=28264 + + * WebCoreSupport/WebGeolocationMockPrivate.h: Added. + * WebCoreSupport/WebGeolocationMock.mm: Added. + (+[WebGeolocationMock setError:code:]): Added. Used by DumpRender tree to configure the mock Geolocation service. + (+[WebGeolocationMock setPosition:latitude:longitude:accuracy:]): Added. Used by DumpRender tree to configure the mock Geolocation service. + * WebKit.exp: Modified. Exports WebGeolocationMock. + +2009-09-07 Drew Wilson <atwilson@google.com> + + Reviewed by David Levin. + + Enable SHARED_WORKERS by default. + https://bugs.webkit.org/show_bug.cgi?id=28959 + + * Configurations/FeatureDefines.xcconfig: + +2009-09-06 Cameron McCormack <cam@mcc.id.au> + + Reviewed by Eric Seidel. + + Drop <definition-src> support + https://bugs.webkit.org/show_bug.cgi?id=28991 + + * MigrateHeaders.make: Remove reference to ObjC definition-src + binding class. + +2009-09-04 Mark Mentovai <mark@chromium.org> + + Reviewed by Dave Hyatt. + + https://bugs.webkit.org/show_bug.cgi?id=28614 + + Account for scrollbar state changes that occur during layout. + + * WebView/WebDynamicScrollBarsView.mm: + (-[WebDynamicScrollBarsView updateScrollers]): + + Perform a layout prior to checking whether the scrollbar modes are + off, on, or automatic. The modes may change during layout. + + * WebView/WebFrameView.mm: + (-[WebFrameView _install]): + + Eliminate duplicated (and incorrect) scrollbar mode tracking between + FrameView and ScrollView. + +2009-09-03 Dave Hyatt <hyatt@apple.com> + + Reviewed by Adam Roben. + + https://bugs.webkit.org/show_bug.cgi?id=28890, make simple user script injection work. + + This patch adds new API for adding and removing user scripts from page groups. User scripts + are bundled together in isolated worlds (you can have multiple scripts together in the same + world). + + Added userscripts/ directory for holding new tests (along with a simple test of script injection). + + * WebView/WebView.mm: + (+[WebView _addUserScriptToGroup:source:url:worldID:patterns:injectionTime:]): + (+[WebView _removeUserContentFromGroup:worldID:]): + (+[WebView _removeAllUserContentFromGroup:]): + * WebView/WebViewPrivate.h: + +2009-09-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=24696 + + Plumb mixed content notifications to WebFrameLoadDelegatePrivate. + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::didDisplayInsecureContent): + (WebFrameLoaderClient::didRunInsecureContent): + * WebView/WebDelegateImplementationCaching.h: + * WebView/WebFrameLoadDelegatePrivate.h: Added. + +2009-09-03 Adam Barth <abarth@webkit.org> + + Unreviewed build fix. + + Change notImplemented() to a FIXME. + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::didDisplayInsecureContent): + (WebFrameLoaderClient::didRunInsecureContent): + +2009-09-03 Adam Barth <abarth@webkit.org> + + Reviewed by eric@webkit.org. + + https://bugs.webkit.org/show_bug.cgi?id=24696 + + Plumb mixed content notifications to WebFrameLoadDelegatePrivate. + + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::didDisplayInsecureContent): + (WebFrameLoaderClient::didRunInsecureContent): + * WebView/WebDelegateImplementationCaching.h: + * WebView/WebFrameLoadDelegatePrivate.h: Added. + +2009-09-03 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=24696 + + Stub implementations of mixed content methods of FrameLoaderClient. + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::didDisplayInsecureContent): + (WebFrameLoaderClient::didRunInsecureContent): + +2009-09-02 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + More partial work towards "Page Cache should support pages with Frames" + https://bugs.webkit.org/show_bug.cgi?id=13631 + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _topHTMLView]): Rework the ASSERT in this method to reflect the + reality of calling this method for pages currently in the PageCache. + +2009-08-31 Dimitri Glazkov <dglazkov@chromium.org> + + Reverting http://trac.webkit.org/changeset/47904, because it caused + layout test failure. + +2009-08-31 Alexey Proskuryakov <ap@webkit.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=28852 + Rename KURL single argument constructor to avoid confusion + + * WebView/WebScriptDebugger.mm: (toNSURL): Adapt to the change. + +2009-08-31 Mark Mentovai <mark@chromium.org> + + Reviewed by Dave Hyatt. + + https://bugs.webkit.org/show_bug.cgi?id=28614 + + Perform a layout prior to checking whether the scrollbar modes are + off, on, or automatic. The modes may change during layout. + + * WebView/WebDynamicScrollBarsView.mm: + (-[WebDynamicScrollBarsView updateScrollers]): + +2009-08-28 Chris Fleizach <cfleizach@apple.com> + + Reviewed by John Sullivan. + + update-webkit-localizable-strings script can no longer complete + https://bugs.webkit.org/show_bug.cgi?id=28792 + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory AXARIAContentGroupText:]): + +2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Holger Freyther. + + https://bugs.webkit.org/show_bug.cgi?id=25889 + [GTK] scrollbar policy for main frame is not implementable + + Add empty implementation for new ChromeClient method. + + * WebCoreSupport/WebChromeClient.h: + (WebChromeClient::scrollbarsModeDidChange): + +2009-08-25 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Oliver Hunt. + + <video> and <audio> controller should be accessible + https://bugs.webkit.org/show_bug.cgi?id=28081 + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory localizedMediaControlElementString:]): + (-[WebViewFactory localizedMediaControlElementHelpText:]): + (-[WebViewFactory localizedMediaTimeDescription:]): + New. + +2009-08-24 Simon Fraser <simon.fraser@apple.com> + + Reviewed by NOBODY (build fix) + + Turn off ENABLE_3D_CANVAS in the xconfig files. + + * Configurations/FeatureDefines.xcconfig: + +2009-08-22 Adam Barth <abarth@webkit.org> + + Revert 47684. We're going to do this later once clients have had a + chance to opt into the setting they like. + + * Misc/WebKitVersionChecks.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + +2009-08-22 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Don't let local files access web URLs + https://bugs.webkit.org/show_bug.cgi?id=28480 + + * Misc/WebKitVersionChecks.m: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + +2009-08-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/7162480> + Sometimes WebKit does not layout correctly when a WebView is embedded in an HICocoaView + + Add a null check for the current context when reflectScrolledClipView: is called from outside a + draw operation. + + * WebView/WebDynamicScrollBarsView.mm: + (-[WebDynamicScrollBarsView reflectScrolledClipView:]): + +2009-08-20 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + Enable various "grouping" ARIA roles + https://bugs.webkit.org/show_bug.cgi?id=28486 + + * WebCoreSupport/WebViewFactory.mm: + (-[WebViewFactory AXARIAContentGroupText:]): + +2009-08-19 Mark Rowe <mrowe@apple.com> + + Reviewed by Dan Bernstein. + + Fix <http://webkit.org/b/28484> Plug-in-related leaks seen on the build bot + + When the plug-in data is being loaded manually there is a reference cycle between the + NetscapePluginInstanceProxy and the HostedNetscapePluginStream. We need to explicitly + break the reference cycle in NetscapePluginInstanceProxy::cleanup so that both objects + will be destroyed. + + Take the opportunity to add RefCountedLeakCounter support to HostedNetscapePluginStream + and NetscapePluginInstanceProxy to simplify tracking down leaks of these objects in the future. + + * Plugins/Hosted/HostedNetscapePluginStream.h: + * Plugins/Hosted/HostedNetscapePluginStream.mm: + (WebKit::HostedNetscapePluginStream::HostedNetscapePluginStream): + (WebKit::HostedNetscapePluginStream::~HostedNetscapePluginStream): + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::NetscapePluginInstanceProxy): + (WebKit::NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy): + (WebKit::NetscapePluginInstanceProxy::cleanup): Clear m_manualStream to break the reference + cycle. + +2009-08-19 Aaron Boodman <aa@chromium.org> + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=24853: Provide a way for WebKit clients to + specify a more granular policy for cross-origin XHR access. + + * WebView/WebView.mm: Add SPI to manipulate origin access whitelists. + (+[WebView _whiteListAccessFromOrigin:destinationProtocol:destinationHost:allowDestinationSubdomains:]): Ditto. + (+[WebView _resetOriginAccessWhiteLists]): Ditto. + * WebView/WebViewPrivate.h: Ditto. + +2009-08-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Adele Peterson. + + Mac specific part of + + <rdar://problem/7135588> HTMLMediaElement should ask WebPolicyLoadDelegate before loading resource + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + Implement shouldLoadMediaElementURL by asking the policy delegate. + + * WebView/WebPolicyDelegatePrivate.h: + Add new delegate method, remove some unused cruft. + +2009-08-18 Drew Wilson <atwilson@google.com> + + Reviewed by Eric Seidel. + + Need to extend DumpRenderTree to expose number of worker threads. + https://bugs.webkit.org/show_bug.cgi?id=28292 + + * WebKit.exp: + Exported WebWorkersPrivate so DumpRenderTree can access it. + * Workers/WebWorkersPrivate.h: Added. + * Workers/WebWorkersPrivate.mm: Added. + (+[WebWorkersPrivate workerThreadCount]): + Added WebWorkersPrivate::workerThreadCount() API for DumpRenderTree. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Use a HashMap instead of a list of if statements for the command + name exception map. + + * WebView/WebHTMLView.mm: + (createSelectorExceptionMap): Added. + (commandNameForSelector): Use createSelectorExceptionMap. + +2009-08-16 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/28366> WebHTMLViewInternal.h: add @class CALayer declaration + + Reviewed by Simon Fraser. + + Without WebKitPrefix.h, the missing @class CALayer declaration + causes a compile-time error. + + * WebView/WebHTMLViewInternal.h: Added @class CALayer + declaration with USE(ACCELERATED_COMPOSITING). + +2009-08-16 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/28355> Replace MAX()/MIN() macros with type-safe std::max()/min() templates + + Reviewed by Dan Bernstein. + + * Plugins/WebBaseNetscapePluginStream.mm: Added using std::min + statement. + (WebNetscapePluginStream::deliverData): Changed MIN() to min(). + Changed C-style cast to a static_cast. + * Plugins/WebNetscapePluginView.mm: Added using std::min + statement. + (-[WebNetscapePluginView _postURL:target:len:buf:file:notifyData:sendNotification:allowHeaders:]): + Changed MIN() to min(). Changed C-style cast to a static_cast. + * WebView/WebHTMLView.mm: Added using std::max statement. + (-[WebHTMLView _dragImageForURL:withLabel:]): Changed MAX() to + max(). + (-[WebHTMLView _scaleFactorForPrintOperation:]): Ditto. + * WebView/WebTextCompletionController.mm: Added using std::max + and using std::min statements. + (-[WebTextCompletionController _placePopupWindow:]): Changed + type of maxWidth variable from float to CGFloat to prevent a + type mismatch on x86_64. Changed MAX() to max() and MIN() to + min(). Added static_cast for a constant value since CGFloat is + defined as a float on i386 and as a double on x86_64. + +2009-08-15 Adam Bergkvist <adam.bergkvist@ericsson.com> + + Reviewed by Sam Weinig. + + Added ENABLE_EVENTSOURCE flag. + https://bugs.webkit.org/show_bug.cgi?id=14997 + + * Configurations/FeatureDefines.xcconfig: + +2009-08-14 Mark Rowe <mrowe@apple.com> + + Build fix. + + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::enumerate): Add the necessary .get() calls. + +2009-08-14 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/7091546> - Assertion failure in plugins/return-error-from-new-stream-doesnt-invoke-destroy-stream.html + on 64-bit SnowLeopard + + * Plugins/Hosted/HostedNetscapePluginStream.mm: + (WebKit::HostedNetscapePluginStream::cancelLoad): Since this might be called while the FrameLoader is switching DocumentLoaders + during the brief moment where there is no activeDocumentLoader(), accept and handle a validly null DocumentLoader. + +2009-08-14 Mark Rowe <mrowe@apple.com> + + Reviewed by Brady Eidson. + + Fix leaks of NSNumber and NSMutableArray objects seen during layout tests. + + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::enumerate): Don't leak an NSMutableArray that we allocate. + +2009-08-14 Mark Rowe <mrowe@apple.com> + + Reviewed by Anders Carlsson. + + Fix leaks of HostedNetscapePluginStream and NetscapePlugInStreamLoader objects seen during layout tests. + + * Plugins/Hosted/HostedNetscapePluginStream.mm: + (WebKit::HostedNetscapePluginStream::didFail): Disconnect the stream from the plug-in instance proxy + when the load fails. + +2009-08-13 Darin Adler <darin@apple.com> + + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: Updated includes. + * WebView/WebScriptDebugger.mm: Ditto. + +2009-08-12 Mark Rowe <mrowe@apple.com> + + Reviewed by Kevin Decker. + + <rdar://problem/6017913> Replace use of HISearchWindowShow in -[WebView _searchWithSpotlightFromMenu]. + + * WebView/WebView.mm: + (-[WebView _searchWithSpotlightFromMenu:]): Use -[NSWorkspace showSearchResultsForQueryString:] post-Leopard. + +2009-08-12 Greg Bolsinga <bolsinga@apple.com> + + Reviewed by Eric Seidel. + + Add delegate methods about focus and blur and state change + https://bugs.webkit.org/show_bug.cgi?id=27153 + + Have ObjC delegate methods match C++ method names in the ChromeClient. + + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::formDidFocus): + (WebChromeClient::formDidBlur): + * WebView/WebUIDelegatePrivate.h: + +2009-08-11 John Gregg <johnnyg@google.com> + + Reviewed by Maciej Stachowiak. + + Desktop Notifications API + https://bugs.webkit.org/show_bug.cgi?id=25643 + + Adds ENABLE_NOTIFICATION flag. + + * Configurations/FeatureDefines.xcconfig: + +2009-08-11 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Remove dead declarations. + + * WebView/WebViewInternal.h: + +2009-08-11 Dmitry Titov <dimich@chromium.org> + + Reviewed by Adam Roben. + + Originally implemented by Glenn Wilson <gwilson@chromium.org>. + + Added new methods for overriding default WebPreference values + and for resetting preferences to their defaults. + See https://bugs.webkit.org/show_bug.cgi?id=20534 + + * WebView/WebPreferences.mm: + (-[WebPreferences _setPreferenceForTestWithValue:withKey:]): added. + * WebView/WebPreferencesPrivate.h: same. + 2009-08-09 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> Reviewed by George Staikos. diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index 63c8190..ed387aa 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -28,7 +28,9 @@ // Set any ENABLE_FEATURE_NAME macro to an empty string to disable that feature. -ENABLE_3D_CANVAS = ENABLE_3D_CANVAS; +ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(MAC_OS_X_VERSION_MAJOR)); +ENABLE_3D_CANVAS_1050 = ENABLE_3D_CANVAS; +ENABLE_3D_CANVAS_1060 = ENABLE_3D_CANVAS; ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(MAC_OS_X_VERSION_MAJOR)); ENABLE_3D_RENDERING_1050 = ENABLE_3D_RENDERING; @@ -37,14 +39,18 @@ ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING; ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_DATABASE = ENABLE_DATABASE; ENABLE_DATAGRID = ENABLE_DATAGRID; +ENABLE_DATALIST = ENABLE_DATALIST; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; +ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; ENABLE_FILTERS = ; ENABLE_GEOLOCATION = ; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; +ENABLE_MATHML = ; +ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_RUBY = ENABLE_RUBY; -ENABLE_SHARED_WORKERS = ; +ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS; ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION; ENABLE_SVG_AS_IMAGE = ENABLE_SVG_AS_IMAGE; @@ -53,10 +59,10 @@ ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT; ENABLE_SVG_USE = ENABLE_SVG_USE; ENABLE_VIDEO = ENABLE_VIDEO; -ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS +ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS; ENABLE_WML = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DOM_STORAGE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(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_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(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_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index d07d57f..66d574b 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 = 532; -MINOR_VERSION = 0; +MINOR_VERSION = 2; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebKit/mac/History/WebHistory.mm b/WebKit/mac/History/WebHistory.mm index e971aba..6304fd2 100644 --- a/WebKit/mac/History/WebHistory.mm +++ b/WebKit/mac/History/WebHistory.mm @@ -148,27 +148,42 @@ private: #pragma mark MODIFYING CONTENTS -static WebHistoryDateKey timeIntervalForBeginningOfDay(NSTimeInterval interval) +static void getDayBoundaries(NSTimeInterval interval, NSTimeInterval& beginningOfDay, NSTimeInterval& beginningOfNextDay) { CFTimeZoneRef timeZone = CFTimeZoneCopyDefault(); CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(interval, timeZone); date.hour = 0; date.minute = 0; date.second = 0; - NSTimeInterval result = CFGregorianDateGetAbsoluteTime(date, timeZone); + beginningOfDay = CFGregorianDateGetAbsoluteTime(date, timeZone); + date.day += 1; + beginningOfNextDay = CFGregorianDateGetAbsoluteTime(date, timeZone); CFRelease(timeZone); +} - // Converting from double to int64_t is safe here as NSDate's useful range - // is -2**48 .. 2**47 which will safely fit in an int64_t. - return (WebHistoryDateKey)result; +static inline NSTimeInterval beginningOfDay(NSTimeInterval date) +{ + static NSTimeInterval cachedBeginningOfDay = NAN; + static NSTimeInterval cachedBeginningOfNextDay; + if (!(date >= cachedBeginningOfDay && date < cachedBeginningOfNextDay)) + getDayBoundaries(date, cachedBeginningOfDay, cachedBeginningOfNextDay); + return cachedBeginningOfDay; +} + +static inline WebHistoryDateKey dateKey(NSTimeInterval date) +{ + // Converting from double (NSTimeInterval) to int64_t (WebHistoryDateKey) is + // safe here because all sensible dates are in the range -2**48 .. 2**47 which + // safely fits in an int64_t. + return beginningOfDay(date); } // Returns whether the day is already in the list of days, // and fills in *key with the key used to access its location - (BOOL)findKey:(WebHistoryDateKey*)key forDay:(NSTimeInterval)date { - ASSERT_ARG(key, key != nil); - *key = timeIntervalForBeginningOfDay(date); + ASSERT_ARG(key, key); + *key = dateKey(date); return _entriesByDate->contains(*key); } diff --git a/WebKit/mac/MigrateHeaders.make b/WebKit/mac/MigrateHeaders.make index 7211aa3..9e78367 100644 --- a/WebKit/mac/MigrateHeaders.make +++ b/WebKit/mac/MigrateHeaders.make @@ -242,7 +242,6 @@ all : \ $(INTERNAL_HEADERS_DIR)/DOMSVGCursorElementInternal.h \ $(PRIVATE_HEADERS_DIR)/DOMSVGDefsElement.h \ $(INTERNAL_HEADERS_DIR)/DOMSVGDefsElementInternal.h \ - $(PRIVATE_HEADERS_DIR)/DOMSVGDefinitionSrcElement.h \ $(PRIVATE_HEADERS_DIR)/DOMSVGDescElement.h \ $(INTERNAL_HEADERS_DIR)/DOMSVGDescElementInternal.h \ $(PRIVATE_HEADERS_DIR)/DOMSVGDocument.h \ diff --git a/WebKit/mac/Misc/WebDownload.mm b/WebKit/mac/Misc/WebDownload.mm index 978465a..01ed767 100644 --- a/WebKit/mac/Misc/WebDownload.mm +++ b/WebKit/mac/Misc/WebDownload.mm @@ -31,6 +31,9 @@ #import <Foundation/NSURLAuthenticationChallenge.h> #import <Foundation/NSURLDownload.h> #import <WebCore/AuthenticationMac.h> +#import <WebCore/Credential.h> +#import <WebCore/CredentialStorage.h> +#import <WebCore/ProtectionSpace.h> #import <WebKit/WebPanelAuthenticationHandler.h> #import <wtf/Assertions.h> @@ -111,7 +114,7 @@ using namespace WebCore; { // Try previously stored credential first. if (![challenge previousFailureCount]) { - NSURLCredential *credential = WebCoreCredentialStorage::get([challenge protectionSpace]); + NSURLCredential *credential = mac(CredentialStorage::get(core([challenge protectionSpace]))); if (credential) { [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; return; diff --git a/WebKit/mac/Misc/WebNSFileManagerExtras.m b/WebKit/mac/Misc/WebNSFileManagerExtras.m index 5733598..fb1286f 100644 --- a/WebKit/mac/Misc/WebNSFileManagerExtras.m +++ b/WebKit/mac/Misc/WebNSFileManagerExtras.m @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,13 +28,13 @@ #import <WebKit/WebNSFileManagerExtras.h> +#import "WebKitNSStringExtras.h" +#import "WebNSURLExtras.h" #import <WebCore/FoundationExtras.h> -#import <WebKit/WebKitNSStringExtras.h> #import <WebKitSystemInterface.h> -#import <wtf/Assertions.h> - #import <pthread.h> #import <sys/mount.h> +#import <JavaScriptCore/Assertions.h> @implementation NSFileManager (WebNSFileManagerExtras) @@ -170,6 +170,10 @@ static void *setMetaData(void* context) { ASSERT(URLString); ASSERT(path); + + NSURL *URL = [NSURL _web_URLWithUserTypedString:URLString]; + if (URL) + URLString = [[URL _web_URLByRemovingUserInfo] _web_userVisibleString]; // Spawn a background thread for WKSetMetadataURL because this function will not return until mds has // journaled the data we're're trying to set. Depending on what other I/O is going on, it can take some diff --git a/WebKit/mac/Misc/WebNSURLExtras.h b/WebKit/mac/Misc/WebNSURLExtras.h index 40f7cf7..c7b266e 100644 --- a/WebKit/mac/Misc/WebNSURLExtras.h +++ b/WebKit/mac/Misc/WebNSURLExtras.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,6 +28,9 @@ #import <Foundation/Foundation.h> +// FIXME: Change method names back to _web_ from _webkit_ when identically-named +// methods are no longer present in Foundation. + @interface NSURL (WebNSURLExtras) + (NSURL *)_web_URLWithUserTypedString:(NSString *)string; @@ -52,12 +55,10 @@ - (BOOL)_web_isEmpty; -// FIXME: change these names back to _web_ when identically-named -// methods are removed from Foundation - - (NSURL *)_webkit_canonicalize; - (NSURL *)_webkit_URLByRemovingFragment; - (NSURL *)_webkit_URLByRemovingResourceSpecifier; +- (NSURL *)_web_URLByRemovingUserInfo; - (BOOL)_webkit_isJavaScriptURL; - (BOOL)_webkit_isFileURL; @@ -83,8 +84,6 @@ - (NSString *)_web_decodeHostName; // turns funny-looking ASCII form into Unicode, returns self if no decoding needed, convenient cover - (NSString *)_web_encodeHostName; // turns Unicode into funny-looking ASCII form, returns self if no decoding needed, convenient cover -// FIXME: change these names back to _web_ when identically-named -// methods are removed from or renamed in Foundation - (BOOL)_webkit_isJavaScriptURL; - (BOOL)_webkit_isFTPDirectoryURL; - (BOOL)_webkit_isFileURL; diff --git a/WebKit/mac/Misc/WebNSURLExtras.mm b/WebKit/mac/Misc/WebNSURLExtras.mm index d956f09..2affbed 100644 --- a/WebKit/mac/Misc/WebNSURLExtras.mm +++ b/WebKit/mac/Misc/WebNSURLExtras.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) * * Redistribution and use in source and binary forms, with or without @@ -619,21 +619,9 @@ static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string) return result; } -typedef struct { - NSString *scheme; - NSString *user; - NSString *password; - NSString *host; - CFIndex port; // kCFNotFound means ignore/omit - NSString *path; - NSString *query; - NSString *fragment; -} WebKitURLComponents; - -- (NSURL *)_webkit_URLByRemovingComponent:(CFURLComponentType)component +- (NSURL *)_web_URLByTruncatingOneCharacterBeforeComponent:(CFURLComponentType)component { CFRange fragRg = CFURLGetByteRangeForComponent((CFURLRef)self, component, NULL); - // Check to see if a fragment exists before decomposing the URL. if (fragRg.location == kCFNotFound) return self; @@ -656,12 +644,53 @@ typedef struct { - (NSURL *)_webkit_URLByRemovingFragment { - return [self _webkit_URLByRemovingComponent:kCFURLComponentFragment]; + return [self _web_URLByTruncatingOneCharacterBeforeComponent:kCFURLComponentFragment]; } - (NSURL *)_webkit_URLByRemovingResourceSpecifier { - return [self _webkit_URLByRemovingComponent:kCFURLComponentResourceSpecifier]; + return [self _web_URLByTruncatingOneCharacterBeforeComponent:kCFURLComponentResourceSpecifier]; +} + +- (NSURL *)_web_URLByRemovingComponentAndSubsequentCharacter:(CFURLComponentType)component +{ + CFRange range = CFURLGetByteRangeForComponent((CFURLRef)self, component, 0); + if (range.location == kCFNotFound) + return self; + + // Remove one subsequent character. + ++range.length; + + UInt8* urlBytes; + UInt8 buffer[2048]; + CFIndex numBytes = CFURLGetBytes((CFURLRef)self, buffer, 2048); + if (numBytes == -1) { + numBytes = CFURLGetBytes((CFURLRef)self, NULL, 0); + urlBytes = static_cast<UInt8*>(malloc(numBytes)); + CFURLGetBytes((CFURLRef)self, urlBytes, numBytes); + } else + urlBytes = buffer; + + if (numBytes < range.location) + return self; + if (numBytes < range.location + range.length) + range.length = numBytes - range.location; + + memmove(urlBytes + range.location, urlBytes + range.location + range.length, numBytes - range.location + range.length); + + NSURL *result = (NSURL *)CFMakeCollectable(CFURLCreateWithBytes(NULL, urlBytes, numBytes - range.length, kCFStringEncodingUTF8, NULL)); + if (!result) + result = (NSURL *)CFMakeCollectable(CFURLCreateWithBytes(NULL, urlBytes, numBytes - range.length, kCFStringEncodingISOLatin1, NULL)); + + if (urlBytes != buffer) + free(urlBytes); + + return result ? [result autorelease] : self; +} + +- (NSURL *)_web_URLByRemovingUserInfo +{ + return [self _web_URLByRemovingComponentAndSubsequentCharacter:kCFURLComponentUserInfo]; } - (BOOL)_webkit_isJavaScriptURL diff --git a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h index 72e845b..946c8ac 100644 --- a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h +++ b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h @@ -43,7 +43,7 @@ namespace WebCore { namespace WebKit { class NetscapePluginInstanceProxy; - + class HostedNetscapePluginStream : public RefCounted<HostedNetscapePluginStream> , private WebCore::NetscapePlugInStreamLoaderClient { public: @@ -55,9 +55,11 @@ public: { return adoptRef(new HostedNetscapePluginStream(instance, frameLoader)); } - + + ~HostedNetscapePluginStream(); + uint32_t streamID() const { return m_streamID; } - + void startStreamWithResponse(NSURLResponse *response); void didReceiveData(WebCore::NetscapePlugInStreamLoader*, const char* bytes, int length); void didFinishLoading(WebCore::NetscapePlugInStreamLoader*); diff --git a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm index 63e18a0..5c25ef7 100644 --- a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm +++ b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm @@ -39,12 +39,18 @@ #import <WebCore/DocumentLoader.h> #import <WebCore/Frame.h> #import <WebCore/FrameLoader.h> +#import <WebCore/SecurityOrigin.h> #import <WebCore/WebCoreURLResponse.h> +#import <wtf/RefCountedLeakCounter.h> using namespace WebCore; namespace WebKit { +#ifndef NDEBUG +static WTF::RefCountedLeakCounter hostedNetscapePluginStreamCounter("HostedNetscapePluginStream"); +#endif + HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstanceProxy* instance, uint32_t streamID, NSURLRequest *request) : m_instance(instance) , m_streamID(streamID) @@ -53,8 +59,12 @@ HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstancePro , m_requestURL([request URL]) , m_frameLoader(0) { - if (core([instance->pluginView() webFrame])->loader()->shouldHideReferrer([request URL], core([instance->pluginView() webFrame])->loader()->outgoingReferrer())) + if (SecurityOrigin::shouldHideReferrer([request URL], core([instance->pluginView() webFrame])->loader()->outgoingReferrer())) [m_request.get() _web_setHTTPReferrer:nil]; + +#ifndef NDEBUG + hostedNetscapePluginStreamCounter.increment(); +#endif } HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstanceProxy* instance, WebCore::FrameLoader* frameLoader) @@ -63,6 +73,16 @@ HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstancePro , m_isTerminated(false) , m_frameLoader(frameLoader) { +#ifndef NDEBUG + hostedNetscapePluginStreamCounter.increment(); +#endif +} + +HostedNetscapePluginStream::~HostedNetscapePluginStream() +{ +#ifndef NDEBUG + hostedNetscapePluginStreamCounter.decrement(); +#endif } void HostedNetscapePluginStream::startStreamWithResponse(NSURLResponse *response) @@ -178,8 +198,9 @@ void HostedNetscapePluginStream::didFail(WebCore::NetscapePlugInStreamLoader*, c { if (NetscapePluginHostProxy* hostProxy = m_instance->hostProxy()) _WKPHStreamDidFail(hostProxy->port(), m_instance->pluginID(), m_streamID, reasonForError(error)); + m_instance->disconnectStream(this); } - + bool HostedNetscapePluginStream::wantsAllStreams() const { // FIXME: Implement. @@ -218,17 +239,17 @@ void HostedNetscapePluginStream::cancelLoad(NSError *error) ASSERT(!m_loader); DocumentLoader* documentLoader = m_frameLoader->activeDocumentLoader(); - ASSERT(documentLoader); - - if (documentLoader->isLoadingMainResource()) + if (documentLoader && documentLoader->isLoadingMainResource()) documentLoader->cancelMainResourceLoad(error); return; } - - if (!m_loader->isDone()) + + if (!m_loader->isDone()) { + // Cancelling the load will disconnect the stream so there's no need to do it explicitly. m_loader->cancel(error); - m_instance->disconnectStream(this); -} + } else + m_instance->disconnectStream(this); +} NSError *HostedNetscapePluginStream::pluginCancelledConnectionError() const { diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h index 1841afd..280f161 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h @@ -162,6 +162,8 @@ public: void resolveURL(const char* url, const char* target, data_t& resolvedURLData, mach_msg_type_number_t& resolvedURLLength); + void didDraw(); + // Reply structs struct Reply { enum Type { @@ -307,6 +309,7 @@ private: bool m_shouldStopSoon; uint32_t m_currentRequestID; bool m_inDestroy; + bool m_pluginIsWaitingForDraw; RefPtr<HostedNetscapePluginStream> m_manualStream; }; diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm index c01ae92..21f35e2 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm @@ -33,30 +33,32 @@ #import "WebDataSourceInternal.h" #import "WebFrameInternal.h" #import "WebHostedNetscapePluginView.h" +#import "WebKitNSStringExtras.h" #import "WebNSDataExtras.h" #import "WebNSURLExtras.h" -#import "WebKitNSStringExtras.h" #import "WebPluginRequest.h" -#import "WebViewInternal.h" #import "WebUIDelegate.h" #import "WebUIDelegatePrivate.h" - -#import <mach/mach.h> -#import <WebCore/CookieJar.h> +#import "WebViewInternal.h" +#import <JavaScriptCore/JSLock.h> +#import <JavaScriptCore/PropertyNameArray.h> #import <WebCore/CString.h> +#import <WebCore/CookieJar.h> #import <WebCore/DocumentLoader.h> #import <WebCore/Frame.h> #import <WebCore/FrameLoader.h> #import <WebCore/FrameTree.h> #import <WebCore/KURL.h> -#import <WebCore/npruntime_impl.h> -#import <WebCore/runtime_object.h> +#import <WebCore/SecurityOrigin.h> #import <WebCore/ScriptController.h> #import <WebCore/ScriptValue.h> +#import <WebCore/StringSourceProvider.h> +#import <WebCore/npruntime_impl.h> +#import <WebCore/runtime_object.h> #import <WebKitSystemInterface.h> -#import <runtime/JSLock.h> -#import <runtime/PropertyNameArray.h> +#import <mach/mach.h> #import <utility> +#import <wtf/RefCountedLeakCounter.h> extern "C" { #import "WebKitPluginClientServer.h" @@ -94,6 +96,10 @@ private: static uint32_t pluginIDCounter; +#ifndef NDEBUG +static WTF::RefCountedLeakCounter netscapePluginInstanceProxyCounter("NetscapePluginInstanceProxy"); +#endif + NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy* pluginHostProxy, WebHostedNetscapePluginView *pluginView, bool fullFramePlugin) : m_pluginHostProxy(pluginHostProxy) , m_pluginView(pluginView) @@ -108,6 +114,7 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy , m_shouldStopSoon(false) , m_currentRequestID(0) , m_inDestroy(false) + , m_pluginIsWaitingForDraw(false) { ASSERT(m_pluginView); @@ -123,6 +130,10 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy } while (pluginHostProxy->pluginInstance(m_pluginID) || !m_pluginID); pluginHostProxy->addPluginInstance(this); + +#ifndef NDEBUG + netscapePluginInstanceProxyCounter.increment(); +#endif } NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy() @@ -131,6 +142,10 @@ NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy() m_pluginID = 0; deleteAllValues(m_replies); + +#ifndef NDEBUG + netscapePluginInstanceProxyCounter.decrement(); +#endif } void NetscapePluginInstanceProxy::resize(NSRect size, NSRect clipRect, bool sync) @@ -178,6 +193,7 @@ void NetscapePluginInstanceProxy::cleanup() (*it)->invalidate(); m_pluginView = nil; + m_manualStream = 0; } void NetscapePluginInstanceProxy::invalidate() @@ -583,7 +599,7 @@ NPError NetscapePluginInstanceProxy::loadRequest(NSURLRequest *request, const ch return NPERR_GENERIC_ERROR; } } else { - if (!FrameLoader::canLoad(URL, String(), core([m_pluginView webFrame])->document())) + if (!SecurityOrigin::canLoad(URL, String(), core([m_pluginView webFrame])->document())) return NPERR_GENERIC_ERROR; } @@ -1032,22 +1048,22 @@ bool NetscapePluginInstanceProxy::enumerate(uint32_t objectID, data_t& resultDat PropertyNameArray propertyNames(exec); object->getPropertyNames(exec, propertyNames); - - NSMutableArray *array = [[NSMutableArray alloc] init]; + + RetainPtr<NSMutableArray*> array(AdoptNS, [[NSMutableArray alloc] init]); for (unsigned i = 0; i < propertyNames.size(); i++) { uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(propertyNames[i].ustring().UTF8String().c_str())); - [array addObject:[NSNumber numberWithLongLong:methodName]]; + [array.get() addObject:[NSNumber numberWithLongLong:methodName]]; } - NSData *data = [NSPropertyListSerialization dataFromPropertyList:array format:NSPropertyListBinaryFormat_v1_0 errorDescription:0]; + NSData *data = [NSPropertyListSerialization dataFromPropertyList:array.get() format:NSPropertyListBinaryFormat_v1_0 errorDescription:0]; ASSERT(data); - + resultLength = [data length]; mig_allocate(reinterpret_cast<vm_address_t*>(&resultData), resultLength); - + memcpy(resultData, [data bytes], resultLength); - + exec->clearException(); return true; @@ -1271,9 +1287,19 @@ void NetscapePluginInstanceProxy::invalidateRect(double x, double y, double widt { ASSERT(m_pluginView); + m_pluginIsWaitingForDraw = true; [m_pluginView invalidatePluginContentRect:NSMakeRect(x, y, width, height)]; } +void NetscapePluginInstanceProxy::didDraw() +{ + if (!m_pluginIsWaitingForDraw) + return; + + m_pluginIsWaitingForDraw = false; + _WKPHPluginInstanceDidDraw(m_pluginHostProxy->port(), m_pluginID); +} + bool NetscapePluginInstanceProxy::getCookies(data_t urlData, mach_msg_type_number_t urlLength, data_t& cookiesData, mach_msg_type_number_t& cookiesLength) { ASSERT(m_pluginView); diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm index 75bc639..0b3a32f 100644 --- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm +++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm @@ -136,6 +136,9 @@ JSC::Bindings::Class *ProxyInstance::getClass() const JSValue ProxyInstance::invoke(JSC::ExecState* exec, InvokeType type, uint64_t identifier, const JSC::ArgList& args) { + if (!m_instanceProxy) + return jsUndefined(); + RetainPtr<NSData*> arguments(m_instanceProxy->marshalValues(exec, args)); uint32_t requestID = m_instanceProxy->nextRequestID(); @@ -162,6 +165,9 @@ JSValue ProxyInstance::invokeMethod(ExecState* exec, const MethodList& methodLis bool ProxyInstance::supportsInvokeDefaultMethod() const { + if (!m_instanceProxy) + return false; + uint32_t requestID = m_instanceProxy->nextRequestID(); if (_WKPHNPObjectHasInvokeDefaultMethod(m_instanceProxy->hostProxy()->port(), @@ -183,6 +189,9 @@ JSValue ProxyInstance::invokeDefaultMethod(ExecState* exec, const ArgList& args) bool ProxyInstance::supportsConstruct() const { + if (!m_instanceProxy) + return false; + uint32_t requestID = m_instanceProxy->nextRequestID(); if (_WKPHNPObjectHasConstructMethod(m_instanceProxy->hostProxy()->port(), @@ -236,6 +245,9 @@ JSValue ProxyInstance::valueOf(ExecState* exec) const void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray) { + if (!m_instanceProxy) + return; + uint32_t requestID = m_instanceProxy->nextRequestID(); if (_WKPHNPObjectEnumerate(m_instanceProxy->hostProxy()->port(), m_instanceProxy->pluginID(), requestID, m_objectID) != KERN_SUCCESS) @@ -266,6 +278,9 @@ void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArr MethodList ProxyInstance::methodsNamed(const Identifier& identifier) { + if (!m_instanceProxy) + return MethodList(); + // If we already have an entry in the map, use it. MethodMap::iterator existingMapEntry = m_methods.find(identifier.ustring().rep()); if (existingMapEntry != m_methods.end()) { @@ -303,6 +318,9 @@ MethodList ProxyInstance::methodsNamed(const Identifier& identifier) Field* ProxyInstance::fieldNamed(const Identifier& identifier) { + if (!m_instanceProxy) + return 0; + // If we already have an entry in the map, use it. FieldMap::iterator existingMapEntry = m_fields.find(identifier.ustring().rep()); if (existingMapEntry != m_fields.end()) @@ -332,6 +350,9 @@ Field* ProxyInstance::fieldNamed(const Identifier& identifier) JSC::JSValue ProxyInstance::fieldValue(ExecState* exec, const Field* field) const { + if (!m_instanceProxy) + return jsUndefined(); + uint64_t serverIdentifier = static_cast<const ProxyField*>(field)->serverIdentifier(); uint32_t requestID = m_instanceProxy->nextRequestID(); @@ -349,6 +370,9 @@ JSC::JSValue ProxyInstance::fieldValue(ExecState* exec, const Field* field) cons void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue value) const { + if (m_instanceProxy) + return; + uint64_t serverIdentifier = static_cast<const ProxyField*>(field)->serverIdentifier(); uint32_t requestID = m_instanceProxy->nextRequestID(); @@ -368,6 +392,8 @@ void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue v void ProxyInstance::invalidate() { + ASSERT(m_instanceProxy); + if (NetscapePluginHostProxy* hostProxy = m_instanceProxy->hostProxy()) _WKPHNPObjectRelease(hostProxy->port(), m_instanceProxy->pluginID(), m_objectID); diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm index 0cce014..34a2211 100644 --- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm +++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm @@ -330,9 +330,10 @@ extern "C" { { if (_proxy) { if (_softwareRenderer) { - if ([NSGraphicsContext currentContextDrawingToScreen]) + if ([NSGraphicsContext currentContextDrawingToScreen]) { WKSoftwareCARendererRender(_softwareRenderer, (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort], NSRectToCGRect(rect)); - else + _proxy->didDraw(); + } else _proxy->print(reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), [self bounds].size.width, [self bounds].size.height); } diff --git a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs index 41d7498..04edf64 100644 --- a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs +++ b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs @@ -220,7 +220,7 @@ simpleroutine PHNPObjectEnumerate(pluginHostPort :mach_port_t; pluginID :uint32_t; requestID :uint32_t; objectID :uint32_t); - + // Replies simpleroutine PHBooleanReply(clientPort :mach_port_t; @@ -233,3 +233,7 @@ simpleroutine PHBooleanAndDataReply(pluginHostPort :mach_port_t; requestID :uint32_t; returnValue :boolean_t; result :data_t); + +simpleroutine PHPluginInstanceDidDraw(pluginHostPort :mach_port_t; + pluginID :uint32_t); + diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm index a5a8a2d..232a6c4 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm @@ -42,6 +42,7 @@ #import <WebCore/DocumentLoader.h> #import <WebCore/Frame.h> #import <WebCore/FrameLoader.h> +#import <WebCore/SecurityOrigin.h> #import <WebCore/WebCoreObjCExtras.h> #import <WebCore/WebCoreURLResponse.h> #import <WebKitSystemInterface.h> @@ -49,6 +50,7 @@ #import <wtf/StdLibExtras.h> using namespace WebCore; +using namespace std; #define WEB_REASON_NONE -1 @@ -159,7 +161,7 @@ WebNetscapePluginStream::WebNetscapePluginStream(NSURLRequest *request, NPP plug WebNetscapePluginView *view = (WebNetscapePluginView *)plugin->ndata; // This check has already been done by the plug-in view. - ASSERT(FrameLoader::canLoad([request URL], String(), core([view webFrame])->document())); + ASSERT(SecurityOrigin::canLoad([request URL], String(), core([view webFrame])->document())); ASSERT([request URL]); ASSERT(plugin); @@ -168,7 +170,7 @@ WebNetscapePluginStream::WebNetscapePluginStream(NSURLRequest *request, NPP plug streams().add(&m_stream, plugin); - if (core([view webFrame])->loader()->shouldHideReferrer([request URL], core([view webFrame])->loader()->outgoingReferrer())) + if (SecurityOrigin::shouldHideReferrer([request URL], core([view webFrame])->loader()->outgoingReferrer())) [m_request.get() _web_setHTTPReferrer:nil]; } @@ -522,7 +524,7 @@ void WebNetscapePluginStream::deliverData() m_deliverDataTimer.startOneShot(0); break; } else { - deliveryBytes = MIN(deliveryBytes, totalBytes - totalBytesDelivered); + deliveryBytes = min(deliveryBytes, totalBytes - totalBytesDelivered); NSData *subdata = [m_deliveryData.get() subdataWithRange:NSMakeRange(totalBytesDelivered, deliveryBytes)]; PluginStopDeferrer deferrer(m_pluginView.get()); deliveryBytes = m_pluginFuncs->write(m_plugin, &m_stream, m_offset, [subdata length], (void *)[subdata bytes]); @@ -531,7 +533,7 @@ void WebNetscapePluginStream::deliverData() cancelLoadAndDestroyStreamWithError(pluginCancelledConnectionError()); return; } - deliveryBytes = MIN((unsigned)deliveryBytes, [subdata length]); + deliveryBytes = min<int32>(deliveryBytes, [subdata length]); m_offset += deliveryBytes; totalBytesDelivered += deliveryBytes; LOG(Plugins, "NPP_Write responseURL=%@ bytes=%d total-delivered=%d/%d", m_responseURL.get(), deliveryBytes, m_offset, m_stream.end); diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h index a9fb188..bd05ebe 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h @@ -31,6 +31,7 @@ #import "WebNetscapePluginPackage.h" #import "WebPluginContainerCheck.h" +#import <wtf/OwnPtr.h> #import <wtf/PassRefPtr.h> #import <wtf/RefPtr.h> #import <wtf/RetainPtr.h> @@ -45,6 +46,8 @@ namespace WebCore { class HTMLPlugInElement; } +class WebHaltablePlugin; + @interface WebBaseNetscapePluginView : NSView { RetainPtr<WebNetscapePluginPackage> _pluginPackage; @@ -65,6 +68,8 @@ namespace WebCore { RetainPtr<NSURL> _baseURL; RetainPtr<NSURL> _sourceURL; + OwnPtr<WebHaltablePlugin> _haltable; + NSTrackingRectTag _trackingTag; } @@ -101,6 +106,7 @@ namespace WebCore { - (void)startTimers; - (void)restartTimers; +- (void)start; - (void)stop; - (void)addWindowObservers; diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm index 1345fc3..e730419 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm @@ -43,13 +43,17 @@ #import <WebCore/WebCoreObjCExtras.h> #import <WebCore/AuthenticationMac.h> +#import <WebCore/Credential.h> +#import <WebCore/CredentialStorage.h> #import <WebCore/CString.h> #import <WebCore/Document.h> #import <WebCore/Element.h> #import <WebCore/Frame.h> #import <WebCore/FrameLoader.h> #import <WebCore/HTMLPlugInElement.h> +#import <WebCore/HaltablePlugin.h> #import <WebCore/Page.h> +#import <WebCore/ProtectionSpace.h> #import <WebCore/RenderView.h> #import <WebKit/DOMPrivate.h> #import <runtime/InitializeThreading.h> @@ -60,6 +64,21 @@ using namespace WebCore; +class WebHaltablePlugin : public HaltablePlugin { +public: + WebHaltablePlugin(WebBaseNetscapePluginView* view) + : m_view(view) + { + } + +private: + virtual void halt() { [m_view stop]; } + virtual void restart() { [m_view start]; } + virtual Node* node() const { return [m_view element]; } + + WebBaseNetscapePluginView* m_view; +}; + @implementation WebBaseNetscapePluginView + (void)initialize @@ -111,7 +130,7 @@ using namespace WebCore; _mode = NP_EMBED; _loadManually = loadManually; - + _haltable = new WebHaltablePlugin(self); return self; } @@ -388,10 +407,13 @@ using namespace WebCore; } _isStarted = YES; + page->didStartPlugin(_haltable.get()); + [[self webView] addPluginInstanceView:self]; - - [self updateAndSetWindow]; - + + if ([self currentWindow]) + [self updateAndSetWindow]; + if ([self window]) { [self addWindowObservers]; if ([[self window] isKeyWindow]) { @@ -414,6 +436,11 @@ using namespace WebCore; if (!_isStarted) return; + + if (Frame* frame = core([self webFrame])) { + if (Page* page = frame->page()) + page->didStopPlugin(_haltable.get()); + } _isStarted = NO; @@ -478,11 +505,16 @@ using namespace WebCore; selector:@selector(preferencesHaveChanged:) name:WebPreferencesChangedNotification object:nil]; - + // View moved to an actual window. Start it if not already started. [self start]; - [self restartTimers]; - [self addWindowObservers]; + + // Starting the plug-in can result in it removing itself from the window so we need to ensure that we're still in + // place before doing anything that requires a window. + if ([self window]) { + [self restartTimers]; + [self addWindowObservers]; + } } else if ([[self webView] hostWindow]) { // View moved out of an actual window, but still has a host window. // Call setWindow to explicitly "clip out" the plug-in from sight. @@ -868,7 +900,7 @@ bool getAuthenticationInfo(const char* protocolStr, const char* hostStr, int32_t RetainPtr<NSURLProtectionSpace> protectionSpace(AdoptNS, [[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:authenticationMethod]); - NSURLCredential *credential = WebCoreCredentialStorage::get(protectionSpace.get()); + NSURLCredential *credential = mac(CredentialStorage::get(core(protectionSpace.get()))); if (!credential) credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace.get()]; if (!credential) diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm index 24c5944..5debb97 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -69,6 +69,7 @@ #import <WebCore/Page.h> #import <WebCore/PluginMainThreadScheduler.h> #import <WebCore/ScriptController.h> +#import <WebCore/SecurityOrigin.h> #import <WebCore/SoftLinking.h> #import <WebCore/WebCoreObjCExtras.h> #import <WebCore/WebCoreURLResponse.h> @@ -78,13 +79,12 @@ #import <wtf/Assertions.h> #import <objc/objc-runtime.h> -using std::max; - #define LoginWindowDidSwitchFromUserNotification @"WebLoginWindowDidSwitchFromUserNotification" #define LoginWindowDidSwitchToUserNotification @"WebLoginWindowDidSwitchToUserNotification" using namespace WebCore; using namespace WebKit; +using namespace std; static inline bool isDrawingModelQuickDraw(NPDrawingModel drawingModel) { @@ -1683,7 +1683,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) return NPERR_INVALID_PARAM; } } else { - if (!FrameLoader::canLoad(URL, String(), core([self webFrame])->document())) + if (!SecurityOrigin::canLoad(URL, String(), core([self webFrame])->document())) return NPERR_GENERIC_ERROR; } @@ -1794,7 +1794,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) NSString *contentLength = [header objectForKey:@"Content-Length"]; if (contentLength != nil) - dataLength = MIN((unsigned)[contentLength intValue], dataLength); + dataLength = min<unsigned>([contentLength intValue], dataLength); [header removeObjectForKey:@"Content-Length"]; if ([header count] > 0) { diff --git a/WebKit/mac/Plugins/WebPluginContainerCheck.mm b/WebKit/mac/Plugins/WebPluginContainerCheck.mm index 2180b02..5609d80 100644 --- a/WebKit/mac/Plugins/WebPluginContainerCheck.mm +++ b/WebKit/mac/Plugins/WebPluginContainerCheck.mm @@ -40,6 +40,7 @@ #import <WebCore/Frame.h> #import <WebCore/FrameLoader.h> #import <WebCore/FrameLoaderTypes.h> +#import <WebCore/SecurityOrigin.h> #import <wtf/Assertions.h> #import <objc/objc-runtime.h> @@ -98,7 +99,7 @@ using namespace WebCore; { Frame* coreFrame = core([_controller webFrame]); ASSERT(coreFrame); - if (!coreFrame->loader()->canLoad([_request URL], String(), coreFrame->document())) { + if (!SecurityOrigin::canLoad([_request URL], String(), coreFrame->document())) { [self _continueWithPolicy:PolicyIgnore]; return YES; } diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h index 7a1d7b3..a8f22f6 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -93,12 +93,13 @@ public: virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect); virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const; virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const; - virtual PlatformWidget platformWindow() const; + virtual PlatformPageClient platformPageClient() const; virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const; virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const; virtual void setStatusbarText(const WebCore::String&); + virtual void scrollbarsModeDidChange() const { } virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags); virtual void setToolTip(const WebCore::String&, WebCore::TextDirection); @@ -149,6 +150,10 @@ public: virtual void scheduleCompositingLayerSync(); #endif + virtual bool supportsFullscreenForNode(const WebCore::Node*); + virtual void enterFullscreenForNode(WebCore::Node*); + virtual void exitFullscreenForNode(WebCore::Node*); + virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); private: diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm index 145255e..a3f004e 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -49,12 +49,14 @@ #import <Foundation/Foundation.h> #import <WebCore/BlockExceptions.h> #import <WebCore/Console.h> +#import <WebCore/Element.h> #import <WebCore/FileChooser.h> #import <WebCore/FloatRect.h> #import <WebCore/Frame.h> #import <WebCore/FrameLoadRequest.h> #import <WebCore/Geolocation.h> #import <WebCore/HitTestResult.h> +#import <WebCore/HTMLNames.h> #import <WebCore/IntRect.h> #import <WebCore/Page.h> #import <WebCore/PlatformScreen.h> @@ -462,7 +464,7 @@ IntRect WebChromeClient::windowToScreen(const IntRect& r) const return enclosingIntRect(tempRect); } -PlatformWidget WebChromeClient::platformWindow() const +PlatformPageClient WebChromeClient::platformPageClient() const { if ([m_webView _usesDocumentViews]) return 0; @@ -670,12 +672,12 @@ void WebChromeClient::formStateDidChange(const WebCore::Node* node) void WebChromeClient::formDidFocus(const WebCore::Node* node) { - CallUIDelegate(m_webView, @selector(webView:formStateDidFocusNode:), kit(const_cast<WebCore::Node*>(node))); + CallUIDelegate(m_webView, @selector(webView:formDidFocusNode:), kit(const_cast<WebCore::Node*>(node))); } void WebChromeClient::formDidBlur(const WebCore::Node* node) { - CallUIDelegate(m_webView, @selector(webView:formStateDidBlurNode:), kit(const_cast<WebCore::Node*>(node))); + CallUIDelegate(m_webView, @selector(webView:formDidBlurNode:), kit(const_cast<WebCore::Node*>(node))); } #if USE(ACCELERATED_COMPOSITING) @@ -715,6 +717,29 @@ void WebChromeClient::scheduleCompositingLayerSync() #endif +#if ENABLE(VIDEO) + +bool WebChromeClient::supportsFullscreenForNode(const Node* node) +{ + return node->hasTagName(WebCore::HTMLNames::videoTag); +} + +void WebChromeClient::enterFullscreenForNode(Node* node) +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + [m_webView _enterFullscreenForNode:node]; + END_BLOCK_OBJC_EXCEPTIONS; +} + +void WebChromeClient::exitFullscreenForNode(Node*) +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + [m_webView _exitFullscreen]; + END_BLOCK_OBJC_EXCEPTIONS; +} + +#endif + void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation) { BEGIN_BLOCK_OBJC_EXCEPTIONS; diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index 6f0f39f..6259c80 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -144,6 +144,9 @@ private: virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual void didDisplayInsecureContent(); + virtual void didRunInsecureContent(WebCore::SecurityOrigin*); + virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&); virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&); @@ -205,7 +208,8 @@ private: NSDictionary *actionDictionary(const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>) const; virtual bool canCachePage() const; - + virtual bool shouldLoadMediaElementURL(const WebCore::KURL&) const; + RetainPtr<WebFrame> m_webFrame; RetainPtr<WebFramePolicyListener> m_policyListener; diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 42b7ff8..ec05572 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -56,6 +56,7 @@ #import "WebKitErrorsPrivate.h" #import "WebKitLogging.h" #import "WebKitNSStringExtras.h" +#import "WebNavigationData.h" #import "WebNSURLExtras.h" #import "WebNetscapePluginView.h" #import "WebNetscapePluginPackage.h" @@ -68,6 +69,7 @@ #import "WebPolicyDelegatePrivate.h" #import "WebPreferences.h" #import "WebResourceLoadDelegate.h" +#import "WebSecurityOriginInternal.h" #import "WebUIDelegate.h" #import "WebUIDelegatePrivate.h" #import "WebViewInternal.h" @@ -716,7 +718,7 @@ void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, { id <WebFormDelegate> formDelegate = [getWebView(m_webFrame.get()) _formDelegate]; if (!formDelegate) { - (core(m_webFrame.get())->loader()->*function)(PolicyUse); + (core(m_webFrame.get())->loader()->policyChecker()->*function)(PolicyUse); return; } @@ -809,7 +811,26 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader) void WebFrameLoaderClient::updateGlobalHistory() { + WebView* view = getWebView(m_webFrame.get()); DocumentLoader* loader = core(m_webFrame.get())->loader()->documentLoader(); + + if ([view historyDelegate]) { + WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view); + if (implementations->navigatedFunc) { + WebNavigationData *data = [[WebNavigationData alloc] initWithURLString:loader->urlForHistory() + title:loader->title() + originalRequest:loader->originalRequestCopy().nsURLRequest() + response:loader->response().nsURLResponse() + hasSubstituteData:loader->substituteData().isValid() + clientRedirectSource:loader->clientRedirectSourceForHistory()]; + + CallHistoryDelegate(implementations->navigatedFunc, view, @selector(webView:didNavigateWithNavigationData:inFrame:), data, m_webFrame.get()); + [data release]; + } + + return; + } + [[WebHistory optionalSharedHistory] _visitedURL:loader->urlForHistory() withTitle:loader->title() method:loader->originalRequestCopy().httpMethod() @@ -819,16 +840,29 @@ void WebFrameLoaderClient::updateGlobalHistory() void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks() { + WebView* view = getWebView(m_webFrame.get()); + WebHistoryDelegateImplementationCache* implementations = [view historyDelegate] ? WebViewGetHistoryDelegateImplementations(view) : 0; + DocumentLoader* loader = core(m_webFrame.get())->loader()->documentLoader(); ASSERT(loader->unreachableURL().isEmpty()); if (!loader->clientRedirectSourceForHistory().isNull()) { - if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()]) + if (implementations) { + if (implementations->clientRedirectFunc) { + CallHistoryDelegate(implementations->clientRedirectFunc, view, @selector(webView:didPerformClientRedirectFromURL:toURL:inFrame:), + loader->clientRedirectSourceForHistory(), loader->clientRedirectDestinationForHistory(), m_webFrame.get()); + } + } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()]) core(item)->addRedirectURL(loader->clientRedirectDestinationForHistory()); } if (!loader->serverRedirectSourceForHistory().isNull()) { - if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->serverRedirectSourceForHistory()]) + if (implementations) { + if (implementations->serverRedirectFunc) { + CallHistoryDelegate(implementations->serverRedirectFunc, view, @selector(webView:didPerformServerRedirectFromURL:toURL:inFrame:), + loader->serverRedirectSourceForHistory(), loader->serverRedirectDestinationForHistory(), m_webFrame.get()); + } + } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->serverRedirectSourceForHistory()]) core(item)->addRedirectURL(loader->serverRedirectDestinationForHistory()); } } @@ -841,6 +875,24 @@ bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const return [[view _policyDelegateForwarder] webView:view shouldGoToHistoryItem:webItem]; } +void WebFrameLoaderClient::didDisplayInsecureContent() +{ + WebView *webView = getWebView(m_webFrame.get()); + WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView); + if (implementations->didDisplayInsecureContentFunc) + CallFrameLoadDelegate(implementations->didDisplayInsecureContentFunc, webView, @selector(webViewDidDisplayInsecureContent:)); +} + +void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin* origin) +{ + RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]); + + WebView *webView = getWebView(m_webFrame.get()); + WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView); + if (implementations->didRunInsecureContentFunc) + CallFrameLoadDelegate(implementations->didRunInsecureContentFunc, webView, @selector(webView:didRunInsecureContent:), webSecurityOrigin.get()); +} + ResourceError WebFrameLoaderClient::cancelledError(const ResourceRequest& request) { return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled URL:request.url()]; @@ -1012,15 +1064,25 @@ PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const Reso return loader.release(); } -// FIXME: <rdar://problem/4880065> - Push Global History into WebCore -// Once that task is complete, this will go away -void WebFrameLoaderClient::setTitle(const String& title, const KURL& URL) +void WebFrameLoaderClient::setTitle(const String& title, const KURL& url) { - NSURL* nsURL = URL; + WebView* view = getWebView(m_webFrame.get()); + + if ([view historyDelegate]) { + WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view); + if (!implementations->setTitleFunc) + return; + + CallHistoryDelegate(implementations->setTitleFunc, view, @selector(webView:updateHistoryTitle:forURL:), (NSString *)title, (NSString *)url); + return; + } + + NSURL* nsURL = url; nsURL = [nsURL _webkit_canonicalize]; if(!nsURL) return; NSString *titleNSString = title; + [[[WebHistory optionalSharedHistory] itemForURL:nsURL] setTitle:titleNSString]; } @@ -1145,7 +1207,7 @@ void WebFrameLoaderClient::receivedPolicyDecison(PolicyAction action) m_policyListener = nil; m_policyFunction = 0; - (core(m_webFrame.get())->loader()->*function)(action); + (core(m_webFrame.get())->loader()->policyChecker()->*function)(action); } String WebFrameLoaderClient::userAgent(const KURL& url) @@ -1676,6 +1738,16 @@ jobject WebFrameLoaderClient::javaApplet(NSView* view) } #endif +bool WebFrameLoaderClient::shouldLoadMediaElementURL(const KURL& url) const { + WebView *webView = getWebView(m_webFrame.get()); + + if (id policyDelegate = [webView policyDelegate]) { + if ([policyDelegate respondsToSelector:@selector(webView:shouldLoadMediaURL:inFrame:)]) + return [policyDelegate webView:webView shouldLoadMediaURL:url inFrame:m_webFrame.get()]; + } + return true; +} + @implementation WebFramePolicyListener + (void)initialize diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm new file mode 100644 index 0000000..95b4301 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebGeolocationMock.mm @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 "WebGeolocationMockPrivate.h" + +#import "WebGeolocationInternal.h" +#import <WebCore/GeolocationServiceMock.h> +#import <WebCore/Geoposition.h> +#import <WebCore/PositionError.h> +#import <wtf/CurrentTime.h> + + +using namespace WebCore; +using namespace WTF; + +@implementation WebGeolocationMock + ++ (void)setPosition:(double)latitude:(double)longitude:(double)accuracy +{ + RefPtr<Coordinates> coordinates = Coordinates::create(latitude, + longitude, + false, 0.0, // altitude + accuracy, + false, 0.0, // altitudeAccuracy + false, 0.0, // heading + false, 0.0); // speed + RefPtr<Geoposition> position = Geoposition::create(coordinates.release(), currentTime() * 1000.0); + GeolocationServiceMock::setPosition(position.release()); +} + ++ (void)setError:(int)code:(NSString *)message +{ + PositionError::ErrorCode codeEnum = static_cast<PositionError::ErrorCode>(code); + RefPtr<PositionError> error = PositionError::create(codeEnum, message); + GeolocationServiceMock::setError(error.release()); +} + +@end diff --git a/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h b/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h new file mode 100644 index 0000000..28895f2 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebGeolocationMockPrivate.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 <Foundation/Foundation.h> + +@interface WebGeolocationMock : NSObject { +} + ++ (void)setPosition:(double)latitude:(double)longitude:(double)accuracy; ++ (void)setError:(int)code:(NSString *)message; +@end diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm index 3f0b43d..6a4f67d 100644 --- a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm +++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm @@ -81,8 +81,9 @@ void WebInspectorClient::inspectorDestroyed() Page* WebInspectorClient::createPage() { - if (!m_windowController) - m_windowController.adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]); + if (m_windowController) + [[m_windowController.get() webView] close]; + m_windowController.adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]); return core([m_windowController.get() webView]); } @@ -325,7 +326,7 @@ void WebInspectorClient::inspectorWindowObjectCleared() _visible = YES; - // If no preference is set - default to an attached window + // If no preference is set - default to an attached window. This is important for inspector LayoutTests. InspectorController::Setting shouldAttach = [_inspectedWebView page]->inspectorController()->setting(inspectorStartsAttachedName); _shouldAttach = (shouldAttach.type() == InspectorController::Setting::BooleanType) ? shouldAttach.booleanValue() : true; diff --git a/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h new file mode 100644 index 0000000..48c655d --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 <WebCore/PluginHalterClient.h> + +namespace WebCore { + class Node; +} + +@class WebView; + +class WebPluginHalterClient : public WebCore::PluginHalterClient { +public: + WebPluginHalterClient(WebView *); + + virtual bool shouldHaltPlugin(WebCore::Node*) const; + +private: + WebView *m_webView; +}; diff --git a/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm new file mode 100644 index 0000000..2384d0b --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebPluginHalterClient.mm @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 "WebPluginHalterClient.h" + +#import "DOMNodeInternal.h" +#import "WebDelegateImplementationCaching.h" +#import "WebView.h" + +using namespace WebCore; + +WebPluginHalterClient::WebPluginHalterClient(WebView *webView) + : m_webView(webView) +{ + ASSERT_ARG(webView, webView); +} + +bool WebPluginHalterClient::shouldHaltPlugin(Node* pluginNode) const +{ + ASSERT_ARG(pluginNode, pluginNode); + return CallUIDelegateReturningBoolean(NO, m_webView, @selector(webView:shouldHaltPlugin:), kit(pluginNode)); +} diff --git a/WebKit/mac/WebCoreSupport/WebViewFactory.mm b/WebKit/mac/WebCoreSupport/WebViewFactory.mm index 96ebaa4..79b2959 100644 --- a/WebKit/mac/WebCoreSupport/WebViewFactory.mm +++ b/WebKit/mac/WebCoreSupport/WebViewFactory.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2009 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 @@ -553,6 +553,43 @@ return UI_STRING("definition", "definition phrase"); } +- (NSString *)AXARIAContentGroupText:(NSString *)ariaType +{ + if ([ariaType isEqualToString:@"ARIAApplicationLog"]) + return UI_STRING("log", "An ARIA accessibility group that acts as a console log."); + if ([ariaType isEqualToString:@"ARIAApplicationMarquee"]) + return UI_STRING("marquee", "An ARIA accessibility group that acts as a marquee."); + if ([ariaType isEqualToString:@"ARIAApplicationStatus"]) + return UI_STRING("application status", "An ARIA accessibility group that acts as a status update."); + if ([ariaType isEqualToString:@"ARIAApplicationTimer"]) + return UI_STRING("timer", "An ARIA accessibility group that acts as an updating timer."); + if ([ariaType isEqualToString:@"ARIADocument"]) + return UI_STRING("document", "An ARIA accessibility group that acts as a document."); + if ([ariaType isEqualToString:@"ARIADocumentArticle"]) + return UI_STRING("article", "An ARIA accessibility group that acts as an article."); + if ([ariaType isEqualToString:@"ARIADocumentNote"]) + return UI_STRING("note", "An ARIA accessibility group that acts as a note in a document."); + if ([ariaType isEqualToString:@"ARIADocumentRegion"]) + return UI_STRING("region", "An ARIA accessibility group that acts as a distinct region in a document."); + if ([ariaType isEqualToString:@"ARIALandmarkApplication"]) + return UI_STRING("application", "An ARIA accessibility group that acts as an application."); + if ([ariaType isEqualToString:@"ARIALandmarkBanner"]) + return UI_STRING("banner", "An ARIA accessibility group that acts as a banner."); + if ([ariaType isEqualToString:@"ARIALandmarkComplementary"]) + return UI_STRING("complementary", "An ARIA accessibility group that acts as a region of complementary information."); + if ([ariaType isEqualToString:@"ARIALandmarkContentInfo"]) + return UI_STRING("content", "An ARIA accessibility group that contains content."); + if ([ariaType isEqualToString:@"ARIALandmarkMain"]) + return UI_STRING("main", "An ARIA accessibility group that is the main portion of the website."); + if ([ariaType isEqualToString:@"ARIALandmarkNavigation"]) + return UI_STRING("navigation", "An ARIA accessibility group that contains the main navigation elements of a website."); + if ([ariaType isEqualToString:@"ARIALandmarkSearch"]) + return UI_STRING("search", "An ARIA accessibility group that contains a search feature of a website."); + if ([ariaType isEqualToString:@"ARIAUserInterfaceTooltip"]) + return UI_STRING("tooltip", "An ARIA accessibility group that acts as a tooltip."); + return nil; +} + - (NSString *)AXButtonActionVerb { return UI_STRING("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility"); @@ -608,4 +645,107 @@ return UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast"); } +- (NSString*)localizedMediaControlElementString:(NSString*)name +{ + if ([name isEqualToString:@"AudioElement"]) + return UI_STRING("audio element controller", "accessibility role description for audio element controller"); + if ([name isEqualToString:@"VideoElement"]) + return UI_STRING("video element controller", "accessibility role description for video element controller"); + + // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy. + if ([name isEqualToString:@"ControlsPanel"]) + return @""; + + if ([name isEqualToString:@"MuteButton"]) + return UI_STRING("mute", "accessibility role description for mute button"); + if ([name isEqualToString:@"UnMuteButton"]) + return UI_STRING("unmute", "accessibility role description for turn mute off button"); + if ([name isEqualToString:@"PlayButton"]) + return UI_STRING("play", "accessibility role description for play button"); + if ([name isEqualToString:@"PauseButton"]) + return UI_STRING("pause", "accessibility role description for pause button"); + if ([name isEqualToString:@"Slider"]) + return UI_STRING("movie time", "accessibility role description for timeline slider"); + if ([name isEqualToString:@"SliderThumb"]) + return UI_STRING("timeline slider thumb", "accessibility role description for timeline thumb"); + if ([name isEqualToString:@"RewindButton"]) + return UI_STRING("back 30 seconds", "accessibility role description for seek back 30 seconds button"); + if ([name isEqualToString:@"ReturnToRealtimeButton"]) + return UI_STRING("return to realtime", "accessibility role description for return to real time button"); + if ([name isEqualToString:@"CurrentTimeDisplay"]) + return UI_STRING("elapsed time", "accessibility role description for elapsed time display"); + if ([name isEqualToString:@"TimeRemainingDisplay"]) + return UI_STRING("remaining time", "accessibility role description for time remaining display"); + if ([name isEqualToString:@"StatusDisplay"]) + return UI_STRING("status", "accessibility role description for movie status"); + if ([name isEqualToString:@"FullscreenButton"]) + return UI_STRING("fullscreen", "accessibility role description for enter fullscreen button"); + if ([name isEqualToString:@"SeekForwardButton"]) + return UI_STRING("fast forward", "accessibility role description for fast forward button"); + if ([name isEqualToString:@"SeekBackButton"]) + return UI_STRING("fast reverse", "accessibility role description for fast reverse button"); + ASSERT_NOT_REACHED(); + return @""; +} + +- (NSString*)localizedMediaControlElementHelpText:(NSString*)name +{ + if ([name isEqualToString:@"AudioElement"]) + return UI_STRING("audio element playback controls and status display", "accessibility role description for audio element controller"); + if ([name isEqualToString:@"VideoElement"]) + return UI_STRING("video element playback controls and status display", "accessibility role description for video element controller"); + + if ([name isEqualToString:@"MuteButton"]) + return UI_STRING("mute audio tracks", "accessibility help text for mute button"); + if ([name isEqualToString:@"UnMuteButton"]) + return UI_STRING("unmute audio tracks", "accessibility help text for un mute button"); + if ([name isEqualToString:@"PlayButton"]) + return UI_STRING("begin playback", "accessibility help text for play button"); + if ([name isEqualToString:@"PauseButton"]) + return UI_STRING("pause playback", "accessibility help text for pause button"); + if ([name isEqualToString:@"Slider"]) + return UI_STRING("movie time scrubber", "accessibility help text for timeline slider"); + if ([name isEqualToString:@"SliderThumb"]) + return UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb"); + if ([name isEqualToString:@"RewindButton"]) + return UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button"); + if ([name isEqualToString:@"ReturnToRealtimeButton"]) + return UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button"); + if ([name isEqualToString:@"CurrentTimeDisplay"]) + return UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display"); + if ([name isEqualToString:@"TimeRemainingDisplay"]) + return UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display"); + if ([name isEqualToString:@"StatusDisplay"]) + return UI_STRING("current movie status", "accessibility help text for movie status display"); + if ([name isEqualToString:@"SeekBackButton"]) + return UI_STRING("seek quickly back", "accessibility help text for fast rewind button"); + if ([name isEqualToString:@"SeekForwardButton"]) + return UI_STRING("seek quickly forward", "accessibility help text for fast forward button"); + if ([name isEqualToString:@"FullscreenButton"]) + return UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button"); + ASSERT_NOT_REACHED(); + return @""; +} + +- (NSString*)localizedMediaTimeDescription:(float)time +{ + if (!isfinite(time)) + return UI_STRING("indefinite time", "string for an indefinite movie time"); + + int seconds = (int)fabsf(time); + int days = seconds / (60 * 60 * 24); + int hours = seconds / (60 * 60); + int minutes = (seconds / 60) % 60; + seconds %= 60; + + if (days) + return [NSString stringWithFormat:UI_STRING("date.format.for.days", "string for days, hours, minutes & seconds"), days, hours, minutes, seconds]; + else if (hours) + return [NSString stringWithFormat:UI_STRING("date.format.for.hours", "string for hours, minutes & seconds"), hours, minutes, seconds]; + else if (minutes) + return [NSString stringWithFormat:UI_STRING("date.format.for.minutes", "string for minutes & seconds"), minutes, seconds]; + + return [NSString stringWithFormat:UI_STRING("date.format.for.seconds", "string for seconds"), seconds]; +} + @end diff --git a/WebKit/mac/WebInspector/WebInspector.mm b/WebKit/mac/WebInspector/WebInspector.mm index c04a56c..ccb09c5 100644 --- a/WebKit/mac/WebInspector/WebInspector.mm +++ b/WebKit/mac/WebInspector/WebInspector.mm @@ -27,7 +27,9 @@ */ #import "WebInspector.h" + #import "WebFrameInternal.h" +#import "WebInspectorPrivate.h" #include <WebCore/Document.h> #include <WebCore/Frame.h> @@ -163,6 +165,12 @@ using namespace WebCore; if (Page* page = core(_webView)) page->inspectorController()->detachWindow(); } + +- (void)evaluateInFrontend:(id)sender callId:(long)callId script:(NSString *)script +{ + if (Page* page = core(_webView)) + page->inspectorController()->evaluateForTestInFrontend(callId, script); +} @end @implementation WebInspector (Obsolete) diff --git a/WebKit/mac/WebInspector/WebInspectorPrivate.h b/WebKit/mac/WebInspector/WebInspectorPrivate.h new file mode 100644 index 0000000..c82bb92 --- /dev/null +++ b/WebKit/mac/WebInspector/WebInspectorPrivate.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2005 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. + */ + +// This header contains the WebInspector SPI. + +#import "WebInspector.h" + +@interface WebInspector (WebPrivate) +- (void)evaluateInFrontend:(id)sender callId:(long)callId script:(NSString *)script; +@end diff --git a/WebKit/mac/WebKit.exp b/WebKit/mac/WebKit.exp index f32d1a8..12507d0 100644 --- a/WebKit/mac/WebKit.exp +++ b/WebKit/mac/WebKit.exp @@ -12,6 +12,7 @@ .objc_class_name_WebFormDelegate .objc_class_name_WebFrame .objc_class_name_WebFrameView +.objc_class_name_WebGeolocationMock .objc_class_name_WebHTMLRepresentation .objc_class_name_WebHTMLView .objc_class_name_WebHistory @@ -32,6 +33,7 @@ .objc_class_name_WebTextIterator .objc_class_name_WebURLsWithTitles .objc_class_name_WebView +.objc_class_name_WebWorkersPrivate _HIWebViewCreate _HIWebViewGetWebView _WebActionButtonKey diff --git a/WebKit/mac/WebKitPrefix.h b/WebKit/mac/WebKitPrefix.h index 0edec06..518fc1b 100644 --- a/WebKit/mac/WebKitPrefix.h +++ b/WebKit/mac/WebKitPrefix.h @@ -74,10 +74,6 @@ typedef float CGFloat; #include "EmptyProtocolDefinitions.h" -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && defined(__x86_64__) -#define WTF_USE_PLUGIN_HOST_PROCESS 1 -#endif - /* WebKit has no way to pull settings from WebCore/config.h for now */ /* so we assume WebKit is always being compiled on top of JavaScriptCore */ #define WTF_USE_JSC 1 diff --git a/WebKit/mac/WebView/WebDelegateImplementationCaching.h b/WebKit/mac/WebView/WebDelegateImplementationCaching.h index 41e44e0..907ba42 100644 --- a/WebKit/mac/WebView/WebDelegateImplementationCaching.h +++ b/WebKit/mac/WebView/WebDelegateImplementationCaching.h @@ -67,6 +67,8 @@ struct WebFrameLoadDelegateImplementationCache { IMP didFirstVisuallyNonEmptyLayoutInFrameFunc; IMP didReceiveIconForFrameFunc; IMP didFinishDocumentLoadForFrameFunc; + IMP didDisplayInsecureContentFunc; + IMP didRunInsecureContentFunc; }; struct WebScriptDebugDelegateImplementationCache { @@ -79,9 +81,17 @@ struct WebScriptDebugDelegateImplementationCache { IMP exceptionWasRaisedFunc; }; +struct WebHistoryDelegateImplementationCache { + IMP navigatedFunc; + IMP clientRedirectFunc; + IMP serverRedirectFunc; + IMP setTitleFunc; +}; + WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *); WebFrameLoadDelegateImplementationCache* WebViewGetFrameLoadDelegateImplementations(WebView *); WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplementations(WebView *); +WebHistoryDelegateImplementationCache* WebViewGetHistoryDelegateImplementations(WebView *webView); id CallFormDelegate(WebView *, SEL, id, id); id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3, id object4, id object5); @@ -119,3 +129,6 @@ id CallScriptDebugDelegate(IMP, WebView *, SEL, id, id, NSInteger, id); id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, NSInteger, id); id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, id, id); id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, NSInteger, id); + +id CallHistoryDelegate(IMP, WebView *, SEL, id, id); +id CallHistoryDelegate(IMP, WebView *, SEL, id, id, id); diff --git a/WebKit/mac/WebView/WebDelegateImplementationCaching.mm b/WebKit/mac/WebView/WebDelegateImplementationCaching.mm index 441df92..7757fc7 100644 --- a/WebKit/mac/WebView/WebDelegateImplementationCaching.mm +++ b/WebKit/mac/WebView/WebDelegateImplementationCaching.mm @@ -60,6 +60,14 @@ WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplemen return &webView->_private->scriptDebugDelegateImplementations; } +WebHistoryDelegateImplementationCache* WebViewGetHistoryDelegateImplementations(WebView *webView) +{ + static WebHistoryDelegateImplementationCache empty; + if (!webView) + return ∅ + return &webView->_private->historyDelegateImplementations; +} + // We use these functions to call the delegates and block exceptions. These functions are // declared inside a WebView category to get direct access to the delegate data memebers, // preventing more ObjC message dispatch and compensating for the expense of the @try/@catch. @@ -540,6 +548,16 @@ id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id o return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2); } +id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2) +{ + return CallDelegate(implementation, self, self->_private->historyDelegate, selector, object1, object2); +} + +id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3) +{ + return CallDelegate(implementation, self, self->_private->historyDelegate, selector, object1, object2, object3); +} + // The form delegate needs to have it's own implementation, because the first argument is never the WebView id CallFormDelegate(WebView *self, SEL selector, id object1, id object2) diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.h b/WebKit/mac/WebView/WebDynamicScrollBarsView.h index ce92b33..40aadc0 100644 --- a/WebKit/mac/WebView/WebDynamicScrollBarsView.h +++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.h @@ -43,6 +43,8 @@ extern const int WebCoreScrollbarAlwaysOn; BOOL suppressLayout; BOOL suppressScrollers; BOOL inUpdateScrollers; + BOOL verticallyPinnedByPreviousWheelEvent; + BOOL horizontallyPinnedByPreviousWheelEvent; unsigned inUpdateScrollersLayoutPass; } - (void)setAllowsHorizontalScrolling:(BOOL)flag; // This method is used by Safari, so it cannot be removed. diff --git a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm index 0cf2a98..3c28e3c 100644 --- a/WebKit/mac/WebView/WebDynamicScrollBarsView.mm +++ b/WebKit/mac/WebView/WebDynamicScrollBarsView.mm @@ -89,15 +89,26 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; - (void)updateScrollers { - BOOL hasVerticalScroller = [self hasVerticalScroller]; + NSView *documentView = [self documentView]; + + // If we came in here with the view already needing a layout, then go ahead and do that + // first. (This will be the common case, e.g., when the page changes due to window resizing for example). + // This layout will not re-enter updateScrollers and does not count towards our max layout pass total. + if (!suppressLayout && !suppressScrollers && [documentView isKindOfClass:[WebHTMLView class]]) { + WebHTMLView* htmlView = (WebHTMLView*)documentView; + if ([htmlView _needsLayout]) { + inUpdateScrollers = YES; + [(id <WebDocumentView>)documentView layout]; + inUpdateScrollers = NO; + } + } + BOOL hasHorizontalScroller = [self hasHorizontalScroller]; + BOOL hasVerticalScroller = [self hasVerticalScroller]; BOOL newHasHorizontalScroller = hasHorizontalScroller; BOOL newHasVerticalScroller = hasVerticalScroller; - BOOL needsLayout = NO; - - NSView *documentView = [self documentView]; if (!documentView) { newHasHorizontalScroller = NO; newHasVerticalScroller = NO; @@ -122,19 +133,7 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; return; } - needsLayout = NO; - - // If we came in here with the view already needing a layout, then go ahead and do that - // first. (This will be the common case, e.g., when the page changes due to window resizing for example). - // This layout will not re-enter updateScrollers and does not count towards our max layout pass total. - if ([documentView isKindOfClass:[WebHTMLView class]]) { - WebHTMLView* htmlView = (WebHTMLView*)documentView; - if ([htmlView _needsLayout]) { - inUpdateScrollers = YES; - [(id <WebDocumentView>)documentView layout]; - inUpdateScrollers = NO; - } - } + BOOL needsLayout = NO; NSSize documentSize = [documentView frame].size; NSSize visibleSize = [self documentVisibleRect].size; @@ -199,7 +198,8 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; // http://www.linuxpowered.com/archive/howto/Net-HOWTO-8.html. // The underlying cause is some problem in the NSText machinery, but I was not // able to pin it down. - if (!inUpdateScrollers && [[NSGraphicsContext currentContext] isDrawingToScreen]) + NSGraphicsContext *currentContext = [NSGraphicsContext currentContext]; + if (!inUpdateScrollers && (!currentContext || [currentContext isDrawingToScreen])) [self updateScrollers]; } @@ -328,17 +328,41 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; BOOL isContinuous; WKGetWheelEventDeltas(event, &deltaX, &deltaY, &isContinuous); + BOOL isLatchingEvent = WKIsLatchingWheelEvent(event); + if (fabsf(deltaY) > fabsf(deltaX)) { if (![self allowsVerticalScrolling]) { [[self nextResponder] scrollWheel:event]; return; } - } else if (![self allowsHorizontalScrolling]) { - [[self nextResponder] scrollWheel:event]; - return; + + if (isLatchingEvent && !verticallyPinnedByPreviousWheelEvent) { + double verticalPosition = [[self verticalScroller] doubleValue]; + if ((deltaY >= 0.0 && verticalPosition == 0.0) || (deltaY <= 0.0 && verticalPosition == 1.0)) + return; + } + } else { + if (![self allowsHorizontalScrolling]) { + [[self nextResponder] scrollWheel:event]; + return; + } + + if (isLatchingEvent && !horizontallyPinnedByPreviousWheelEvent) { + double horizontalPosition = [[self horizontalScroller] doubleValue]; + if ((deltaX >= 0.0 && horizontalPosition == 0.0) || (deltaX <= 0.0 && horizontalPosition == 1.0)) + return; + } } [super scrollWheel:event]; + + if (!isLatchingEvent) { + double verticalPosition = [[self verticalScroller] doubleValue]; + double horizontalPosition = [[self horizontalScroller] doubleValue]; + + verticallyPinnedByPreviousWheelEvent = (verticalPosition == 0.0 || verticalPosition == 1.0); + horizontallyPinnedByPreviousWheelEvent = (horizontalPosition == 0.0 || horizontalPosition == 1.0); + } } - (BOOL)accessibilityIsIgnored diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index c03ef58..27aac67 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -1174,7 +1174,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) [result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameHasPlugins]; if (DOMWindow* domWindow = _private->coreFrame->domWindow()) { - if (domWindow->hasEventListener(eventNames().unloadEvent)) + if (domWindow->hasEventListeners(eventNames().unloadEvent)) [result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameHasUnloadListener]; if (domWindow->optionalApplicationCache()) @@ -1195,6 +1195,13 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return result; } +- (BOOL)_allowsFollowingLink:(NSURL *)URL +{ + if (!_private->coreFrame) + return YES; + return SecurityOrigin::canLoad(URL, String(), _private->coreFrame->document()); +} + @end @implementation WebFrame diff --git a/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h b/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h new file mode 100644 index 0000000..80fa08a --- /dev/null +++ b/WebKit/mac/WebView/WebFrameLoadDelegatePrivate.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2009 Adam Barth. 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. + */ + +#import <WebKit/WebFrameLoadDelegate.h> + +@class WebSecurityOrigin; + +@interface NSObject (WebFrameLoadDelegatePrivate) + +- (void)webViewDidDisplayInsecureContent:(WebView *)webView; + +- (void)webView:(WebView *)webView didRunInsecureContent:(WebSecurityOrigin *)origin; + +@end diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h index 8e7a2ef..7446584 100644 --- a/WebKit/mac/WebView/WebFramePrivate.h +++ b/WebKit/mac/WebView/WebFramePrivate.h @@ -110,4 +110,6 @@ typedef enum { - (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace; - (NSMutableDictionary *)_cacheabilityDictionary; + +- (BOOL)_allowsFollowingLink:(NSURL *)URL; @end diff --git a/WebKit/mac/WebView/WebFrameView.mm b/WebKit/mac/WebView/WebFrameView.mm index 1a460ea..c300586 100644 --- a/WebKit/mac/WebView/WebFrameView.mm +++ b/WebKit/mac/WebView/WebFrameView.mm @@ -273,8 +273,6 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl owner->setWidget(view); // Now the render part owns the view, so we don't any more. } - - view->initScrollbars(); } @end diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index d58c765..102f630 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -125,6 +125,7 @@ using namespace WebCore; using namespace HTMLNames; using namespace WTF; +using namespace std; @interface NSWindow (BorderViewAccess) - (NSView*)_web_borderView; @@ -212,6 +213,9 @@ extern NSString *NSTextInputReplacementRangeAttributeName; - (void)_setDrawsOwnDescendants:(BOOL)drawsOwnDescendants; - (void)_propagateDirtyRectsToOpaqueAncestors; - (void)_windowChangedKeyState; +#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD) +- (void)_updateLayerGeometryFromView; +#endif @end @interface NSApplication (WebNSApplicationDetails) @@ -979,8 +983,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) { // FIXME: this can fail if the dataSource is nil, which happens when the WebView is tearing down from the window closing. WebHTMLView *view = (WebHTMLView *)[[[[_private->dataSource _webView] mainFrame] frameView] documentView]; - ASSERT(view); - ASSERT([view isKindOfClass:[WebHTMLView class]]); + ASSERT(!view || [view isKindOfClass:[WebHTMLView class]]); return view; } @@ -1148,8 +1151,11 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) { NSPoint origin = [[self superview] bounds].origin; if (!NSEqualPoints(_private->lastScrollPosition, origin)) { - if (Frame* coreFrame = core([self _frame])) - coreFrame->eventHandler()->sendScrollEvent(); + if (Frame* coreFrame = core([self _frame])) { + if (FrameView* coreView = coreFrame->view()) + coreView->scrollPositionChanged(); + } + [_private->completionController endRevertingChange:NO moveLeft:NO]; WebView *webView = [self _webView]; @@ -1649,10 +1655,10 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) urlStringSize.height = [urlFont ascender] - [urlFont descender]; imageSize.height += urlStringSize.height; if (urlStringSize.width > MAX_DRAG_LABEL_WIDTH) { - imageSize.width = MAX(MAX_DRAG_LABEL_WIDTH + DRAG_LABEL_BORDER_X * 2.0f, MIN_DRAG_LABEL_WIDTH_BEFORE_CLIP); + imageSize.width = max(MAX_DRAG_LABEL_WIDTH + DRAG_LABEL_BORDER_X * 2, MIN_DRAG_LABEL_WIDTH_BEFORE_CLIP); clipURLString = YES; } else { - imageSize.width = MAX(labelSize.width + DRAG_LABEL_BORDER_X * 2.0f, urlStringSize.width + DRAG_LABEL_BORDER_X * 2.0f); + imageSize.width = max(labelSize.width + DRAG_LABEL_BORDER_X * 2, urlStringSize.width + DRAG_LABEL_BORDER_X * 2); } } NSImage *dragImage = [[[NSImage alloc] initWithSize: imageSize] autorelease]; @@ -2299,24 +2305,36 @@ static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension return [[webView _editingDelegateForwarder] webView:webView doCommandBySelector:selector]; } +typedef HashMap<SEL, String> SelectorNameMap; + +// Map selectors into Editor command names. +// This is not needed for any selectors that have the same name as the Editor command. +static const SelectorNameMap* createSelectorExceptionMap() +{ + SelectorNameMap* map = new HashMap<SEL, String>; + + map->add(@selector(insertNewlineIgnoringFieldEditor:), "InsertNewline"); + map->add(@selector(insertParagraphSeparator:), "InsertNewline"); + map->add(@selector(insertTabIgnoringFieldEditor:), "InsertTab"); + map->add(@selector(pageDown:), "MovePageDown"); + map->add(@selector(pageDownAndModifySelection:), "MovePageDownAndModifySelection"); + map->add(@selector(pageUp:), "MovePageUp"); + map->add(@selector(pageUpAndModifySelection:), "MovePageUpAndModifySelection"); + + return map; +} + static String commandNameForSelector(SEL selector) { - // Change a few command names into ones supported by WebCore::Editor. - // If this list gets too long we might decide we need to use a hash table. - if (selector == @selector(insertParagraphSeparator:) || selector == @selector(insertNewlineIgnoringFieldEditor:)) - return "InsertNewline"; - if (selector == @selector(insertTabIgnoringFieldEditor:)) - return "InsertTab"; - if (selector == @selector(pageDown:)) - return "MovePageDown"; - if (selector == @selector(pageDownAndModifySelection:)) - return "MovePageDownAndModifySelection"; - if (selector == @selector(pageUp:)) - return "MovePageUp"; - if (selector == @selector(pageUpAndModifySelection:)) - return "MovePageUpAndModifySelection"; + // Check the exception map first. + static const SelectorNameMap* exceptionMap = createSelectorExceptionMap(); + SelectorNameMap::const_iterator it = exceptionMap->find(selector); + if (it != exceptionMap->end()) + return it->second; // Remove the trailing colon. + // No need to capitalize the command name since Editor command names are + // not case sensitive. const char* selectorName = sel_getName(selector); size_t selectorNameLength = strlen(selectorName); if (selectorNameLength < 2 || selectorName[selectorNameLength - 1] != ':') @@ -3160,7 +3178,8 @@ WEBCORE_COMMAND(yankAndSelect) double start = CFAbsoluteTimeGetCurrent(); #endif - if ([[self _webView] _mustDrawUnionedRect:rect singleRects:rects count:count]) + WebView *webView = [self _webView]; + if ([webView _mustDrawUnionedRect:rect singleRects:rects count:count]) [self drawSingleRect:rect]; else for (int i = 0; i < count; ++i) @@ -3175,16 +3194,19 @@ WEBCORE_COMMAND(yankAndSelect) [self _setAsideSubviews]; #if USE(ACCELERATED_COMPOSITING) - if ([[self _webView] _needsOneShotDrawingSynchronization]) { + if ([webView _needsOneShotDrawingSynchronization]) { // Disable screen updates so that any layer changes committed here // don't show up on the screen before the window flush at the end - // of the current window display. - [[self window] disableScreenUpdatesUntilFlush]; + // of the current window display, but only if a window flush is actually + // going to happen. + NSWindow *window = [self window]; + if ([window viewsNeedDisplay]) + [window disableScreenUpdatesUntilFlush]; // Make sure any layer changes that happened as a result of layout // via -viewWillDraw are committed. [CATransaction flush]; - [[self _webView] _setNeedsOneShotDrawingSynchronization:NO]; + [webView _setNeedsOneShotDrawingSynchronization:NO]; } #endif } @@ -3407,10 +3429,6 @@ done: if (!page) return NSDragOperationNone; - // FIXME: Why do we override the source provided operation here? Why not in DragController::startDrag - if (page->dragController()->sourceDragOperation() == DragOperationNone) - return NSDragOperationGeneric | NSDragOperationCopy; - return (NSDragOperation)page->dragController()->sourceDragOperation(); } @@ -3715,7 +3733,7 @@ static BOOL isInPasswordField(Frame* coreFrame) #ifdef __LP64__ // If the new bottom is equal to the old bottom (when both are treated as floats), we just copy // oldBottom over to newBottom. This prevents rounding errors that can occur when converting newBottomFloat to a double. - if (fabs((float)oldBottom - newBottomFloat) <= std::numeric_limits<float>::epsilon()) + if (fabs((float)oldBottom - newBottomFloat) <= numeric_limits<float>::epsilon()) *newBottom = oldBottom; else #endif @@ -3750,7 +3768,7 @@ static BOOL isInPasswordField(Frame* coreFrame) float maxShrinkToFitScaleFactor = 1.0f / PrintingMaximumShrinkFactor; float shrinkToFitScaleFactor = [self _availablePaperWidthForPrintOperation:printOperation]/viewWidth; float shrinkToAvoidOrphan = _private->avoidingPrintOrphan ? (1.0f / PrintingOrphanShrinkAdjustment) : 1.0f; - return userScaleFactor * MAX(maxShrinkToFitScaleFactor, shrinkToFitScaleFactor) * shrinkToAvoidOrphan; + return userScaleFactor * max(maxShrinkToFitScaleFactor, shrinkToFitScaleFactor) * shrinkToAvoidOrphan; } // FIXME 3491344: This is a secret AppKit-internal method that we need to override in order @@ -5450,13 +5468,13 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) if (!_private->layerHostingView) return; - const CGFloat maxHeight = 4096; + const CGFloat maxHeight = 2048; NSRect layerViewFrame = [self bounds]; if (layerViewFrame.size.height > maxHeight) { CGFloat documentHeight = layerViewFrame.size.height; - // Clamp the size of the view to <= 4096px to avoid the bug. + // Clamp the size of the view to <= maxHeight to avoid the bug. layerViewFrame.size.height = maxHeight; NSRect visibleRect = [[self enclosingScrollView] documentVisibleRect]; @@ -5468,7 +5486,8 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) CGFloat bottomOffset = documentHeight - layerViewFrame.size.height - topOffset; [[_private->layerHostingView layer] setSublayerTransform:CATransform3DMakeTranslation(0, -bottomOffset, 0)]; } - + + [_private->layerHostingView _updateLayerGeometryFromView]; // Workaround for <rdar://problem/7071636> [_private->layerHostingView setFrame:layerViewFrame]; } #endif // defined(BUILDING_ON_LEOPARD) diff --git a/WebKit/mac/WebView/WebHTMLViewInternal.h b/WebKit/mac/WebView/WebHTMLViewInternal.h index b5ec1c0..3f1f50d 100644 --- a/WebKit/mac/WebView/WebHTMLViewInternal.h +++ b/WebKit/mac/WebView/WebHTMLViewInternal.h @@ -30,6 +30,9 @@ #import "WebHTMLViewPrivate.h" +#if USE(ACCELERATED_COMPOSITING) +@class CALayer; +#endif @class WebFrame; namespace WebCore { diff --git a/WebKit/mac/WebView/WebHistoryDelegate.h b/WebKit/mac/WebView/WebHistoryDelegate.h new file mode 100644 index 0000000..4029eb0 --- /dev/null +++ b/WebKit/mac/WebView/WebHistoryDelegate.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 <Foundation/Foundation.h> + +@class WebFrame; +@class WebNavigationData; +@class WebView; + +@interface NSObject (WebHistoryDelegate) + +- (void)webView:(WebView *)webView didNavigateWithNavigationData:(WebNavigationData *)navigationData inFrame:(WebFrame *)webFrame; + +- (void)webView:(WebView *)webView didPerformClientRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame; + +- (void)webView:(WebView *)webView didPerformServerRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame; + +- (void)webView:(WebView *)webView updateHistoryTitle:(NSString *)title forURL:(NSString *)url; + +@end diff --git a/WebKit/mac/WebView/WebJSPDFDoc.h b/WebKit/mac/WebView/WebJSPDFDoc.h new file mode 100644 index 0000000..d3e756c --- /dev/null +++ b/WebKit/mac/WebView/WebJSPDFDoc.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 <JavaScriptCore/JSBase.h> + +@class WebDataSource; + +JSObjectRef makeJSPDFDoc(JSContextRef, WebDataSource *); diff --git a/WebKit/mac/WebView/WebJSPDFDoc.mm b/WebKit/mac/WebView/WebJSPDFDoc.mm new file mode 100644 index 0000000..24169fe --- /dev/null +++ b/WebKit/mac/WebView/WebJSPDFDoc.mm @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 "WebJSPDFDoc.h" + +#import "WebDataSource.h" +#import "WebDelegateImplementationCaching.h" +#import "WebFrame.h" +#import "WebView.h" +#import <JavaScriptCore/JSObjectRef.h> + +static void jsPDFDocInitialize(JSContextRef ctx, JSObjectRef object) +{ + WebDataSource *dataSource = (WebDataSource *)JSObjectGetPrivate(object); + CFRetain(dataSource); +} + +static void jsPDFDocFinalize(JSObjectRef object) +{ + WebDataSource *dataSource = (WebDataSource *)JSObjectGetPrivate(object); + CFRelease(dataSource); +} + +static JSValueRef jsPDFDocPrint(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + WebDataSource *dataSource = (WebDataSource *)JSObjectGetPrivate(thisObject); + + WebView *webView = [[dataSource webFrame] webView]; + CallUIDelegate(webView, @selector(webView:printFrameView:), [[dataSource webFrame] frameView]); + + return JSValueMakeUndefined(ctx); +} + +static JSStaticFunction jsPDFDocStaticFunctions[] = { + { "print", jsPDFDocPrint, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { 0, 0, 0 }, +}; + +static JSClassDefinition jsPDFDocClassDefinition = { + 0, + kJSClassAttributeNone, + "Doc", + 0, + 0, + jsPDFDocStaticFunctions, + jsPDFDocInitialize, jsPDFDocFinalize, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +JSObjectRef makeJSPDFDoc(JSContextRef ctx, WebDataSource *dataSource) +{ + static JSClassRef jsPDFDocClass = JSClassCreate(&jsPDFDocClassDefinition); + + return JSObjectMake(ctx, jsPDFDocClass, dataSource); +} diff --git a/WebKit/mac/WebView/WebNavigationData.h b/WebKit/mac/WebView/WebNavigationData.h new file mode 100644 index 0000000..227df16 --- /dev/null +++ b/WebKit/mac/WebView/WebNavigationData.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 <Foundation/Foundation.h> + +@class WebFrame; +@class WebNavigationDataPrivate; +@class WebView; + +@interface WebNavigationData : NSObject +{ +@private + WebNavigationDataPrivate *_private; +} + +- (id)initWithURLString:(NSString *)url title:(NSString *)title originalRequest:(NSURLRequest *)request response:(NSURLResponse *)response hasSubstituteData:(BOOL)hasSubstituteData clientRedirectSource:(NSString *)redirectSource; +- (NSString *)url; +- (NSString *)title; +- (NSURLRequest *)originalRequest; +- (NSURLResponse *)response; +- (BOOL)hasSubstituteData; +- (NSString *)clientRedirectSource; + +@end diff --git a/WebKit/mac/WebView/WebNavigationData.mm b/WebKit/mac/WebView/WebNavigationData.mm new file mode 100644 index 0000000..290d8b1 --- /dev/null +++ b/WebKit/mac/WebView/WebNavigationData.mm @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 "WebNavigationData.h" + +@interface WebNavigationDataPrivate : NSObject +{ +@public + NSString *url; + NSString *title; + NSURLRequest *originalRequest; + NSURLResponse *response; + BOOL hasSubstituteData; + NSString *clientRedirectSource; +} + +@end + +@implementation WebNavigationDataPrivate + +- (void)dealloc +{ + [url release]; + [title release]; + [originalRequest release]; + [response release]; + [clientRedirectSource release]; + + [super dealloc]; +} + +@end + +@implementation WebNavigationData + +- (id)initWithURLString:(NSString *)url title:(NSString *)title originalRequest:(NSURLRequest *)request response:(NSURLResponse *)response hasSubstituteData:(BOOL)hasSubstituteData clientRedirectSource:(NSString *)redirectSource; +{ + _private = [[WebNavigationDataPrivate alloc] init]; + + _private->url = [url retain]; + _private->title = [title retain]; + _private->originalRequest = [request retain]; + _private->response = [response retain]; + _private->hasSubstituteData = hasSubstituteData; + _private->clientRedirectSource = [redirectSource retain]; + + return self; +} + +- (NSString *)url +{ + return _private->url; +} + +- (NSString *)title +{ + return _private->title; +} + +- (NSURLRequest *)originalRequest +{ + return _private->originalRequest; +} + +- (NSURLResponse *)response +{ + return _private->response; +} + +- (BOOL)hasSubstituteData +{ + return _private->hasSubstituteData; +} + +- (NSString *)clientRedirectSource +{ + return _private->clientRedirectSource; +} + +- (void)dealloc +{ + [_private release]; + [super dealloc]; +} + +@end diff --git a/WebKit/mac/WebView/WebPDFDocumentExtras.h b/WebKit/mac/WebView/WebPDFDocumentExtras.h new file mode 100644 index 0000000..5a33ccf --- /dev/null +++ b/WebKit/mac/WebView/WebPDFDocumentExtras.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 <PDFKit/PDFDocument.h> + +@interface PDFDocument (WebPDFDocumentExtras) +- (NSArray *)_web_allScripts; +@end + +void addWebPDFDocumentExtras(Class); diff --git a/WebKit/mac/WebView/WebPDFDocumentExtras.mm b/WebKit/mac/WebView/WebPDFDocumentExtras.mm new file mode 100644 index 0000000..ec580ec --- /dev/null +++ b/WebKit/mac/WebView/WebPDFDocumentExtras.mm @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 "WebPDFDocumentExtras.h" + +#import "WebTypesInternal.h" +#import <JavaScriptCore/Vector.h> +#import <JavaScriptCore/RetainPtr.h> +#import <PDFKit/PDFDocument.h> +#import <objc/objc-runtime.h> + +#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) +@interface PDFDocument (Internal) +- (CGPDFDocumentRef)documentRef; +@end +#endif + +static void appendValuesInPDFNameSubtreeToVector(CGPDFDictionaryRef subtree, Vector<CGPDFObjectRef>& values) +{ + CGPDFArrayRef names; + if (CGPDFDictionaryGetArray(subtree, "Names", &names)) { + size_t nameCount = CGPDFArrayGetCount(names) / 2; + for (size_t i = 0; i < nameCount; ++i) { + CGPDFObjectRef object; + CGPDFArrayGetObject(names, 2 * i + 1, &object); + values.append(object); + } + return; + } + + CGPDFArrayRef kids; + if (!CGPDFDictionaryGetArray(subtree, "Kids", &kids)) + return; + + size_t kidCount = CGPDFArrayGetCount(kids); + for (size_t i = 0; i < kidCount; ++i) { + CGPDFDictionaryRef kid; + if (!CGPDFArrayGetDictionary(kids, i, &kid)) + continue; + appendValuesInPDFNameSubtreeToVector(kid, values); + } +} + +static void getAllValuesInPDFNameTree(CGPDFDictionaryRef tree, Vector<CGPDFObjectRef>& allValues) +{ + appendValuesInPDFNameSubtreeToVector(tree, allValues); +} + +static NSArray *web_PDFDocumentAllScripts(id self, SEL _cmd) +{ + NSMutableArray *scripts = [NSMutableArray array]; + CGPDFDocumentRef pdfDocument = [self documentRef]; + if (!pdfDocument) + return scripts; + + CGPDFDictionaryRef pdfCatalog = CGPDFDocumentGetCatalog(pdfDocument); + if (!pdfCatalog) + return scripts; + + // Get the dictionary of all document-level name trees. + CGPDFDictionaryRef namesDictionary; + if (!CGPDFDictionaryGetDictionary(pdfCatalog, "Names", &namesDictionary)) + return scripts; + + // Get the document-level "JavaScript" name tree. + CGPDFDictionaryRef javaScriptNameTree; + if (!CGPDFDictionaryGetDictionary(namesDictionary, "JavaScript", &javaScriptNameTree)) + return scripts; + + // The names are aribtrary. We are only interested in the values. + Vector<CGPDFObjectRef> objects; + getAllValuesInPDFNameTree(javaScriptNameTree, objects); + size_t objectCount = objects.size(); + + for (size_t i = 0; i < objectCount; ++i) { + CGPDFDictionaryRef javaScriptAction; + if (!CGPDFObjectGetValue(reinterpret_cast<CGPDFObjectRef>(objects[i]), kCGPDFObjectTypeDictionary, &javaScriptAction)) + continue; + + // A JavaScript action must have an action type of "JavaScript". + const char* actionType; + if (!CGPDFDictionaryGetName(javaScriptAction, "S", &actionType) || strcmp(actionType, "JavaScript")) + continue; + + const UInt8* bytes = 0; + CFIndex length; + CGPDFStreamRef stream; + CGPDFStringRef string; + RetainPtr<CFDataRef> data; + if (CGPDFDictionaryGetStream(javaScriptAction, "JS", &stream)) { + CGPDFDataFormat format; + data.adoptCF(CGPDFStreamCopyData(stream, &format)); + bytes = CFDataGetBytePtr(data.get()); + length = CFDataGetLength(data.get()); + } else if (CGPDFDictionaryGetString(javaScriptAction, "JS", &string)) { + bytes = CGPDFStringGetBytePtr(string); + length = CGPDFStringGetLength(string); + } + if (!bytes) + continue; + + NSStringEncoding encoding = (length > 1 && bytes[0] == 0xFE && bytes[1] == 0xFF) ? NSUnicodeStringEncoding : NSUTF8StringEncoding; + NSString *script = [[NSString alloc] initWithBytes:bytes length:length encoding:encoding]; + [scripts addObject:script]; + [script release]; + } + + return scripts; +} + +void addWebPDFDocumentExtras(Class pdfDocumentClass) +{ +#ifndef BUILDING_ON_TIGER + class_addMethod(pdfDocumentClass, @selector(_web_allScripts), (IMP)web_PDFDocumentAllScripts, "@@:"); +#else + static struct objc_method_list methodList = { 0, 1, { @selector(_web_allScripts), (char*)"@@:", (IMP)web_PDFDocumentAllScripts } }; + class_addMethods(pdfDocumentClass, &methodList); +#endif +} diff --git a/WebKit/mac/WebView/WebPDFRepresentation.h b/WebKit/mac/WebView/WebPDFRepresentation.h index 6b60d4c..be40ae1 100644 --- a/WebKit/mac/WebView/WebPDFRepresentation.h +++ b/WebKit/mac/WebView/WebPDFRepresentation.h @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#import <Foundation/Foundation.h> +#import "WebDocument.h" @protocol WebDocumentRepresentation; diff --git a/WebKit/mac/WebView/WebPDFRepresentation.m b/WebKit/mac/WebView/WebPDFRepresentation.mm index 7eae380..924bda8 100644 --- a/WebKit/mac/WebView/WebPDFRepresentation.m +++ b/WebKit/mac/WebView/WebPDFRepresentation.mm @@ -26,15 +26,19 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#import <WebKit/WebDataSourcePrivate.h> -#import <WebKit/WebFrame.h> -#import <WebKit/WebFrameView.h> -#import <WebKit/WebNSObjectExtras.h> -#import <WebKit/WebPDFRepresentation.h> -#import <WebKit/WebPDFView.h> -#import <wtf/Assertions.h> - -#import <PDFKit/PDFDocument.h> +#import "WebPDFRepresentation.h" + +#import "WebDataSourcePrivate.h" +#import "WebFrame.h" +#import "WebJSPDFDoc.h" +#import "WebNSObjectExtras.h" +#import "WebPDFDocumentExtras.h" +#import "WebPDFView.h" +#import "WebTypesInternal.h" +#import <JavaScriptCore/Assertions.h> +#import <JavaScriptCore/JSContextRef.h> +#import <JavaScriptCore/JSStringRef.h> +#import <JavaScriptCore/JSStringRefCF.h> @implementation WebPDFRepresentation @@ -66,6 +70,16 @@ return PDFDocumentClass; } ++ (void)initialize +{ + if (self != [WebPDFRepresentation class]) + return; + + Class pdfDocumentClass = [self PDFDocumentClass]; + if (pdfDocumentClass) + addWebPDFDocumentExtras(pdfDocumentClass); +} + - (void)setDataSource:(WebDataSource *)dataSource; { } @@ -121,9 +135,26 @@ WebPDFView *view = (WebPDFView *)[[[dataSource webFrame] frameView] documentView]; PDFDocument *doc = [[[[self class] PDFDocumentClass] alloc] initWithData:data]; [view setPDFDocument:doc]; + + NSArray *scripts = [doc _web_allScripts]; [doc release]; -} + doc = nil; + + NSUInteger scriptCount = [scripts count]; + if (!scriptCount) + return; + + JSGlobalContextRef ctx = JSGlobalContextCreate(0); + JSObjectRef jsPDFDoc = makeJSPDFDoc(ctx, dataSource); + for (NSUInteger i = 0; i < scriptCount; ++i) { + JSStringRef script = JSStringCreateWithCFString((CFStringRef)[scripts objectAtIndex:i]); + JSEvaluateScript(ctx, script, jsPDFDoc, 0, 0, 0); + JSStringRelease(script); + } + + JSGlobalContextRelease(ctx); +} - (BOOL)canProvideDocumentSource { diff --git a/WebKit/mac/WebView/WebPolicyDelegatePrivate.h b/WebKit/mac/WebView/WebPolicyDelegatePrivate.h index 45f8f45..efdf007 100644 --- a/WebKit/mac/WebView/WebPolicyDelegatePrivate.h +++ b/WebKit/mac/WebView/WebPolicyDelegatePrivate.h @@ -49,4 +49,6 @@ typedef enum { @interface NSObject (WebPolicyDelegatePrivate) // Needed for <rdar://problem/3951283> can view pages from the back/forward cache that should be disallowed by Parental Controls - (BOOL)webView:(WebView *)webView shouldGoToHistoryItem:(WebHistoryItem *)item; + +- (BOOL)webView:(WebView *)webView shouldLoadMediaURL:(NSURL *)url inFrame:(WebFrame *)frame; @end diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 6565c09..d6c9d3c 100644 --- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -55,6 +55,8 @@ #define WebKitPluginsEnabledPreferenceKey @"WebKitPluginsEnabled" #define WebKitDatabasesEnabledPreferenceKey @"WebKitDatabasesEnabledPreferenceKey" #define WebKitLocalStorageEnabledPreferenceKey @"WebKitLocalStorageEnabledPreferenceKey" +#define WebKitExperimentalNotificationsEnabledPreferenceKey @"WebKitExperimentalNotificationsEnabledPreferenceKey" +#define WebKitExperimentalWebSocketsEnabledPreferenceKey @"WebKitExperimentalWebSocketsEnabledPreferenceKey" #define WebKitAllowAnimatedImagesPreferenceKey @"WebKitAllowAnimatedImagesPreferenceKey" #define WebKitAllowAnimatedImageLoopingPreferenceKey @"WebKitAllowAnimatedImageLoopingPreferenceKey" #define WebKitDisplayImagesKey @"WebKitDisplayImagesKey" @@ -84,6 +86,9 @@ #define WebKitZoomsTextOnlyPreferenceKey @"WebKitZoomsTextOnly" #define WebKitXSSAuditorEnabledPreferenceKey @"WebKitXSSAuditorEnabled" #define WebKitAcceleratedCompositingEnabledPreferenceKey @"WebKitAcceleratedCompositingEnabled" +#define WebKitWebGLEnabledPreferenceKey @"WebKitWebGLEnabled" +#define WebKitPluginHalterEnabledPreferenceKey @"WebKitPluginHalterEnabled" +#define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime" // These are private both because callers should be using the cover methods and because the // cover methods themselves are private. diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm index 378b280..2910d27 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -320,6 +320,8 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:YES], WebKitPluginsEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitDatabasesEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitLocalStorageEnabledPreferenceKey, + [NSNumber numberWithBool:NO], WebKitExperimentalNotificationsEnabledPreferenceKey, + [NSNumber numberWithBool:NO], WebKitExperimentalWebSocketsEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitAllowAnimatedImagesPreferenceKey, [NSNumber numberWithBool:YES], WebKitAllowAnimatedImageLoopingPreferenceKey, [NSNumber numberWithBool:YES], WebKitDisplayImagesKey, @@ -350,6 +352,9 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:YES], WebKitZoomsTextOnlyPreferenceKey, [NSNumber numberWithBool:YES], WebKitXSSAuditorEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey, + [NSNumber numberWithBool:NO], WebKitWebGLEnabledPreferenceKey, + [NSNumber numberWithBool:NO], WebKitPluginHalterEnabledPreferenceKey, + [NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey, nil]; // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above @@ -1011,6 +1016,26 @@ static WebCacheModel cacheModelForMainBundle(void) [self _setBoolValue:localStorageEnabled forKey:WebKitLocalStorageEnabledPreferenceKey]; } +- (BOOL)experimentalNotificationsEnabled +{ + return [self _boolValueForKey:WebKitExperimentalNotificationsEnabledPreferenceKey]; +} + +- (void)setExperimentalNotificationsEnabled:(BOOL)experimentalNotificationsEnabled +{ + [self _setBoolValue:experimentalNotificationsEnabled forKey:WebKitExperimentalNotificationsEnabledPreferenceKey]; +} + +- (BOOL)experimentalWebSocketsEnabled +{ + return [self _boolValueForKey:WebKitExperimentalWebSocketsEnabledPreferenceKey]; +} + +- (void)setExperimentalWebSocketsEnabled:(BOOL)experimentalWebSocketsEnabled +{ + [self _setBoolValue:experimentalWebSocketsEnabled forKey:WebKitExperimentalWebSocketsEnabledPreferenceKey]; +} + + (WebPreferences *)_getInstanceForIdentifier:(NSString *)ident { LOG(Encoding, "requesting for %@\n", ident); @@ -1138,6 +1163,36 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:enabled forKey:WebKitAcceleratedCompositingEnabledPreferenceKey]; } +- (BOOL)webGLEnabled +{ + return [self _boolValueForKey:WebKitWebGLEnabledPreferenceKey]; +} + +- (void)setWebGLEnabled:(BOOL)enabled +{ + [self _setBoolValue:enabled forKey:WebKitWebGLEnabledPreferenceKey]; +} + +- (BOOL)pluginHalterEnabled +{ + return [self _boolValueForKey:WebKitPluginHalterEnabledPreferenceKey]; +} + +- (void)setPluginHalterEnabled:(BOOL)enabled +{ + [self _setBoolValue:enabled forKey:WebKitPluginHalterEnabledPreferenceKey]; +} + +- (unsigned)pluginAllowedRunTime +{ + return [self _integerValueForKey:WebKitPluginAllowedRunTimePreferenceKey]; +} + +- (void)setPluginAllowedRunTime:(unsigned)allowedRunTime +{ + return [self _setIntegerValue:allowedRunTime forKey:WebKitPluginAllowedRunTimePreferenceKey]; +} + - (void)didRemoveFromWebView { ASSERT(_private->numWebViews); @@ -1152,6 +1207,12 @@ static NSString *classIBCreatorID = nil; { ++_private->numWebViews; } + +- (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key +{ + [self _setStringValue:value forKey:key]; +} + @end @implementation WebPreferences (WebInternal) diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h index d571869..6a25921 100644 --- a/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -107,6 +107,18 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)isXSSAuditorEnabled; - (void)setXSSAuditorEnabled:(BOOL)flag; +- (BOOL)experimentalNotificationsEnabled; +- (void)setExperimentalNotificationsEnabled:(BOOL)notificationsEnabled; + +- (BOOL)experimentalWebSocketsEnabled; +- (void)setExperimentalWebSocketsEnabled:(BOOL)websocketsEnabled; + +- (BOOL)pluginHalterEnabled; +- (void)setPluginHalterEnabled:(BOOL)enabled; + +- (unsigned)pluginAllowedRunTime; +- (void)setPluginAllowedRunTime:(unsigned)allowedRunTime; + // zero means do AutoScale - (float)PDFScaleFactor; - (void)setPDFScaleFactor:(float)scale; @@ -117,6 +129,10 @@ extern NSString *WebPreferencesRemovedNotification; - (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior; - (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior; +// Used to set preference specified in the test via LayoutTestController.overridePreference(..). +// For use with DumpRenderTree only. +- (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key; + // If site-specific spoofing is enabled, some pages that do inappropriate user-agent string checks will be // passed a nonstandard user-agent string to get them to work correctly. This method might be removed in // the future when there's no more need for it. @@ -139,6 +155,9 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)acceleratedCompositingEnabled; - (void)setAcceleratedCompositingEnabled:(BOOL)enabled; +- (BOOL)webGLEnabled; +- (void)setWebGLEnabled:(BOOL)enabled; + // Other private methods - (void)_postPreferencesChangesNotification; + (WebPreferences *)_getInstanceForIdentifier:(NSString *)identifier; diff --git a/WebKit/mac/WebView/WebScriptDebugger.mm b/WebKit/mac/WebView/WebScriptDebugger.mm index 76bdf58..8deccff 100644 --- a/WebKit/mac/WebView/WebScriptDebugger.mm +++ b/WebKit/mac/WebView/WebScriptDebugger.mm @@ -32,13 +32,14 @@ #import "WebFrameInternal.h" #import "WebScriptDebugDelegate.h" #import "WebViewInternal.h" +#import <JavaScriptCore/DebuggerCallFrame.h> +#import <JavaScriptCore/JSGlobalObject.h> +#import <JavaScriptCore/SourceCode.h> #import <WebCore/DOMWindow.h> #import <WebCore/Frame.h> #import <WebCore/JSDOMWindow.h> #import <WebCore/KURL.h> #import <WebCore/ScriptController.h> -#import <debugger/DebuggerCallFrame.h> -#import <runtime/JSGlobalObject.h> using namespace JSC; using namespace WebCore; @@ -68,7 +69,7 @@ static NSURL *toNSURL(const UString& s) { if (s.isEmpty()) return nil; - return KURL(s); + return KURL(ParsedURLString, s); } static WebFrame *toWebFrame(JSGlobalObject* globalObject) diff --git a/WebKit/mac/WebView/WebTextCompletionController.mm b/WebKit/mac/WebView/WebTextCompletionController.mm index f7c172f..6c37b98 100644 --- a/WebKit/mac/WebView/WebTextCompletionController.mm +++ b/WebKit/mac/WebView/WebTextCompletionController.mm @@ -39,6 +39,7 @@ @end using namespace WebCore; +using namespace std; // This class handles the complete: operation. // It counts on its host view to call endRevertingChange: whenever the current completion needs to be aborted. @@ -131,7 +132,7 @@ using namespace WebCore; windowFrame.size.height = numberToShow * [_tableView rowHeight] + (numberToShow + 1) * [_tableView intercellSpacing].height; windowFrame.origin.y -= windowFrame.size.height; NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont systemFontOfSize:12.0f], NSFontAttributeName, nil]; - float maxWidth = 0.0f; + CGFloat maxWidth = 0; int maxIndex = -1; int i; for (i = 0; i < numberToShow; i++) { @@ -146,8 +147,8 @@ using namespace WebCore; maxWidth = ceilf([NSScrollView frameSizeForContentSize:NSMakeSize(maxWidth, 100.0f) hasHorizontalScroller:NO hasVerticalScroller:YES borderType:NSNoBorder].width); maxWidth = ceilf([NSWindow frameRectForContentRect:NSMakeRect(0.0f, 0.0f, maxWidth, 100.0f) styleMask:NSBorderlessWindowMask].size.width); maxWidth += 5.0f; - windowFrame.size.width = MAX(maxWidth, windowFrame.size.width); - maxWidth = MIN(400.0f, windowFrame.size.width); + windowFrame.size.width = max(maxWidth, windowFrame.size.width); + maxWidth = min<CGFloat>(400, windowFrame.size.width); } [_popupWindow setFrame:windowFrame display:NO]; diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h index 717cf01..0715475 100644 --- a/WebKit/mac/WebView/WebUIDelegatePrivate.h +++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h @@ -109,7 +109,7 @@ enum { - (void)webView:(WebView *)sender willPopupMenu:(NSMenu *)menu; - (void)webView:(WebView *)sender contextMenuItemSelected:(NSMenuItem *)item forElement:(NSDictionary *)element; - (void)webView:(WebView *)sender saveFrameView:(WebFrameView *)frameView showingPanel:(BOOL)showingPanel; - +- (BOOL)webView:(WebView *)sender shouldHaltPlugin:(DOMNode *)pluginNode; /*! @method webView:frame:exceededDatabaseQuotaForSecurityOrigin:database: @param sender The WebView sending the delegate method. @@ -127,8 +127,8 @@ enum { - (BOOL)webView:(WebView *)sender frame:(WebFrame *)frame requestGeolocationPermission:(WebGeolocation *)geolocation securityOrigin:(WebSecurityOrigin *)origin; - (void)webView:(WebView *)sender formStateDidChangeForNode:(DOMNode *)node; -- (void)webView:(WebView *)sender formStateDidFocusNode:(DOMNode *)node; -- (void)webView:(WebView *)sender formStateDidBlurNode:(DOMNode *)node; +- (void)webView:(WebView *)sender formDidFocusNode:(DOMNode *)node; +- (void)webView:(WebView *)sender formDidBlurNode:(DOMNode *)node; /*! @method webView:printFrame: diff --git a/WebKit/mac/WebView/WebVideoFullscreenController.h b/WebKit/mac/WebView/WebVideoFullscreenController.h new file mode 100644 index 0000000..bb6a083 --- /dev/null +++ b/WebKit/mac/WebView/WebVideoFullscreenController.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2009 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 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. + */ + +#if ENABLE(VIDEO) + +#import <Cocoa/Cocoa.h> +#import <wtf/RefPtr.h> +#import <WebCore/HTMLMediaElement.h> + +@protocol WebVideoFullscreenControllerDelegate; +@class WebVideoFullscreenHUDWindowController; +@class WebWindowFadeAnimation; + +@interface WebVideoFullscreenController : NSWindowController +{ +@private + RefPtr<WebCore::HTMLMediaElement> _mediaElement; // (retain) + id<WebVideoFullscreenControllerDelegate> _delegate; // (assign) + + NSWindow *_backgroundFullscreenWindow; // (retain) + WebVideoFullscreenHUDWindowController* _hudController; // (retain) + + WebWindowFadeAnimation *_fadeAnimation; // (retain) + + BOOL _isEndingFullscreen; + BOOL _isWindowLoaded; + BOOL _forceDisableAnimation; +} + +- (id<WebVideoFullscreenControllerDelegate>)delegate; +- (void)setDelegate:(id<WebVideoFullscreenControllerDelegate>)delegate; + +- (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement; +- (WebCore::HTMLMediaElement*)mediaElement; + +- (void)enterFullscreen:(NSScreen *)screen; +- (void)exitFullscreen; + +@end + +#endif + diff --git a/WebKit/mac/WebView/WebVideoFullscreenController.mm b/WebKit/mac/WebView/WebVideoFullscreenController.mm new file mode 100644 index 0000000..6592ad2 --- /dev/null +++ b/WebKit/mac/WebView/WebVideoFullscreenController.mm @@ -0,0 +1,444 @@ +/* + * Copyright (C) 2009 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 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. + */ + +#if ENABLE(VIDEO) + +#import <QTKit/QTKit.h> +#import <objc/objc-runtime.h> +#import <HIToolbox/HIToolbox.h> + +#import <wtf/UnusedParam.h> +#import <WebCore/SoftLinking.h> +#import <WebCore/IntRect.h> + +#import "WebVideoFullscreenController.h" +#import "WebVideoFullscreenHUDWindowController.h" +#import "WebKitSystemInterface.h" +#import "WebTypesInternal.h" +#import "WebWindowAnimation.h" + +SOFT_LINK_FRAMEWORK(QTKit) +SOFT_LINK_CLASS(QTKit, QTMovieView) + +@interface WebVideoFullscreenWindow : NSWindow +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) +<NSAnimationDelegate> +#endif +{ + SEL _controllerActionOnAnimationEnd; + WebWindowScaleAnimation *_fullscreenAnimation; // (retain) + QTMovieView *_movieView; // (retain) +} +- (void)animateFromRect:(NSRect)startRect toRect:(NSRect)endRect withSubAnimation:(NSAnimation *)subAnimation controllerAction:(SEL)controllerAction; +- (QTMovieView *)movieView; +- (void)setMovieView:(QTMovieView *)movieView; +@end + +@interface WebVideoFullscreenController(HUDWindowControllerDelegate) <WebVideoFullscreenHUDWindowControllerDelegate> +@end + +@implementation WebVideoFullscreenController +- (id)init +{ + // Do not defer window creation, to make sure -windowNumber is created (needed by WebWindowScaleAnimation). + NSWindow *window = [[WebVideoFullscreenWindow alloc] initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; + self = [super initWithWindow:window]; + [window release]; + if (!self) + return nil; + [self windowDidLoad]; + return self; + +} +- (void)dealloc +{ + ASSERT(!_backgroundFullscreenWindow); + ASSERT(!_fadeAnimation); + [super dealloc]; +} + +- (WebVideoFullscreenWindow *)fullscreenWindow +{ + return (WebVideoFullscreenWindow *)[super window]; +} + +- (void)windowDidLoad +{ + WebVideoFullscreenWindow *window = [self fullscreenWindow]; + QTMovieView *view = [[getQTMovieViewClass() alloc] init]; + [view setFillColor:[NSColor clearColor]]; + [window setMovieView:view]; + [view setControllerVisible:NO]; + [view setPreservesAspectRatio:YES]; + if (_mediaElement) + [view setMovie:_mediaElement->platformMedia().qtMovie]; + [window setHasShadow:YES]; // This is nicer with a shadow. + [window setLevel:NSPopUpMenuWindowLevel-1]; + [view release]; +} + +- (WebCore::HTMLMediaElement*)mediaElement; +{ + return _mediaElement.get(); +} + +- (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement; +{ + _mediaElement = mediaElement; + if ([self isWindowLoaded]) { + QTMovieView *movieView = [[self fullscreenWindow] movieView]; + [movieView setMovie:_mediaElement->platformMedia().qtMovie]; + } +} + +- (id<WebVideoFullscreenControllerDelegate>)delegate +{ + return _delegate; +} + +- (void)setDelegate:(id<WebVideoFullscreenControllerDelegate>)delegate; +{ + _delegate = delegate; +} + +- (CGFloat)clearFadeAnimation +{ + [_fadeAnimation stopAnimation]; + CGFloat previousAlpha = [_fadeAnimation currentAlpha]; + [_fadeAnimation setWindow:nil]; + [_fadeAnimation release]; + _fadeAnimation = nil; + return previousAlpha; +} + +- (void)windowDidExitFullscreen +{ + [self clearFadeAnimation]; + [[self window] close]; + [self setWindow:nil]; + SetSystemUIMode(kUIModeNormal, 0); + [_hudController setDelegate:nil]; + [_hudController release]; + _hudController = nil; + [_backgroundFullscreenWindow close]; + [_backgroundFullscreenWindow release]; + _backgroundFullscreenWindow = nil; + + [self autorelease]; // Associated -retain is in -exitFullscreen. + _isEndingFullscreen = NO; +} + +- (void)windowDidEnterFullscreen +{ + [self clearFadeAnimation]; + + ASSERT(!_hudController); + _hudController = [[WebVideoFullscreenHUDWindowController alloc] init]; + [_hudController setDelegate:self]; + + SetSystemUIMode(kUIModeAllSuppressed , 0); + [NSCursor setHiddenUntilMouseMoves:YES]; + + // Give the HUD keyboard focus initially + [_hudController fadeWindowIn]; +} + +- (NSRect)mediaElementRect +{ + return _mediaElement->screenRect(); +} + +#pragma mark - +#pragma mark Exposed Interface + +static void constrainFrameToRatioOfFrame(NSRect *frameToConstrain, const NSRect *frame) +{ + // Keep a constrained aspect ratio for the destination window + double originalRatio = frame->size.width / frame->size.height; + double newRatio = frameToConstrain->size.width / frameToConstrain->size.height; + if (newRatio > originalRatio) { + double newWidth = originalRatio * frameToConstrain->size.height; + double diff = frameToConstrain->size.width - newWidth; + frameToConstrain->size.width = newWidth; + frameToConstrain->origin.x += diff / 2; + } else { + double newHeight = frameToConstrain->size.width / originalRatio; + double diff = frameToConstrain->size.height - newHeight; + frameToConstrain->size.height = newHeight; + frameToConstrain->origin.y += diff / 2; + } +} + +static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level) +{ + NSWindow *window = [[NSWindow alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; + [window setOpaque:YES]; + [window setBackgroundColor:[NSColor blackColor]]; + [window setLevel:level]; + [window setHidesOnDeactivate:YES]; + [window setReleasedWhenClosed:NO]; + return window; +} + +- (void)setupFadeAnimationIfNeededAndFadeIn:(BOOL)fadeIn +{ + CGFloat initialAlpha = fadeIn ? 0 : 1; + if (_fadeAnimation) { + // Make sure we support queuing animation if the previous one isn't over yet + initialAlpha = [self clearFadeAnimation]; + } + if (!_forceDisableAnimation) + _fadeAnimation = [[WebWindowFadeAnimation alloc] initWithDuration:0.2 window:_backgroundFullscreenWindow initialAlpha:initialAlpha finalAlpha:fadeIn ? 1 : 0]; +} + +- (void)enterFullscreen:(NSScreen *)screen; +{ + if (!screen) + screen = [NSScreen mainScreen]; + + NSRect frame = [self mediaElementRect]; + NSRect endFrame = [screen frame]; + constrainFrameToRatioOfFrame(&endFrame, &frame); + + // Create a black window if needed + if (!_backgroundFullscreenWindow) + _backgroundFullscreenWindow = createBackgroundFullscreenWindow([screen frame], [[self window] level]-1); + else + [_backgroundFullscreenWindow setFrame:[screen frame] display:NO]; + + [self setupFadeAnimationIfNeededAndFadeIn:YES]; + if (_forceDisableAnimation) { + // This will disable scale animation + frame = NSZeroRect; + } + [[self fullscreenWindow] animateFromRect:frame toRect:endFrame withSubAnimation:_fadeAnimation controllerAction:@selector(windowDidEnterFullscreen)]; + + [_backgroundFullscreenWindow orderWindow:NSWindowBelow relativeTo:[[self fullscreenWindow] windowNumber]]; +} + +- (void)exitFullscreen +{ + if (_isEndingFullscreen) + return; + _isEndingFullscreen = YES; + [_hudController closeWindow]; + + NSRect endFrame = [self mediaElementRect]; + + [self setupFadeAnimationIfNeededAndFadeIn:NO]; + if (_forceDisableAnimation) { + // This will disable scale animation + endFrame = NSZeroRect; + } + + // We have to retain ourselves because we want to be alive for the end of the animation. + // If our owner releases us we could crash if this is not the case. + // Balanced in windowDidExitFullscreen + [self retain]; + + [[self fullscreenWindow] animateFromRect:[[self window] frame] toRect:endFrame withSubAnimation:_fadeAnimation controllerAction:@selector(windowDidExitFullscreen)]; +} + +#pragma mark - +#pragma mark Window callback + +- (void)requestExitFullscreenWithAnimation:(BOOL)animation +{ + if (_isEndingFullscreen) + return; + + _forceDisableAnimation = !animation; + _mediaElement->exitFullscreen(); + _forceDisableAnimation = NO; +} + +- (void)requestExitFullscreen +{ + [self requestExitFullscreenWithAnimation:YES]; +} + +- (void)fadeHUDIn +{ + [_hudController fadeWindowIn]; +} +@end + +@implementation WebVideoFullscreenWindow + +- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag +{ + UNUSED_PARAM(aStyle); + self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag]; + if (!self) + return nil; + [self setOpaque:NO]; + [self setBackgroundColor:[NSColor clearColor]]; + [self setHidesOnDeactivate:YES]; + [self setIgnoresMouseEvents:NO]; + [self setAcceptsMouseMovedEvents:YES]; + return self; +} + +- (void)dealloc +{ + ASSERT(!_fullscreenAnimation); + [super dealloc]; +} + +- (QTMovieView *)movieView +{ + return _movieView; +} + +- (void)setMovieView:(QTMovieView *)movieView +{ + if (_movieView == movieView) + return; + [_movieView release]; + _movieView = [movieView retain]; + [self setContentView:_movieView]; +} + +- (BOOL)resignFirstResponder +{ + return NO; +} + +- (BOOL)canBecomeKeyWindow +{ + return NO; +} + +- (void)mouseDown:(NSEvent *)theEvent +{ + UNUSED_PARAM(theEvent); +} + +- (void)cancelOperation:(id)sender +{ + UNUSED_PARAM(sender); + [[self windowController] requestExitFullscreen]; +} + +- (void)animatedResizeDidEnd +{ + // Call our windowController. + if (_controllerActionOnAnimationEnd) + [[self windowController] performSelector:_controllerActionOnAnimationEnd]; + _controllerActionOnAnimationEnd = NULL; +} + +// +// This function will animate a change of frame rectangle +// We support queuing animation, that means that we'll correctly +// interrupt the running animation, and queue the next one. +// +- (void)animateFromRect:(NSRect)startRect toRect:(NSRect)endRect withSubAnimation:(NSAnimation *)subAnimation controllerAction:(SEL)controllerAction +{ + _controllerActionOnAnimationEnd = controllerAction; + + BOOL wasAnimating = NO; + if (_fullscreenAnimation) { + wasAnimating = YES; + + // Interrupt any running animation. + [_fullscreenAnimation stopAnimation]; + + // Save the current rect to ensure a smooth transition. + startRect = [_fullscreenAnimation currentFrame]; + [_fullscreenAnimation release]; + _fullscreenAnimation = nil; + } + + if (NSIsEmptyRect(startRect) || NSIsEmptyRect(endRect)) { + // Fakely end the subanimation. + [subAnimation setCurrentProgress:1.0]; + // And remove the weak link to the window. + [subAnimation stopAnimation]; + + [self setFrame:endRect display:NO]; + [self makeKeyAndOrderFront:self]; + [self animatedResizeDidEnd]; + return; + } + + if (!wasAnimating) { + // We'll downscale the window during the animation based on the higher resolution rect + BOOL higherResolutionIsEndRect = startRect.size.width < endRect.size.width && startRect.size.height < endRect.size.height; + [self setFrame:higherResolutionIsEndRect ? endRect : startRect display:NO]; + } + + ASSERT(!_fullscreenAnimation); + _fullscreenAnimation = [[WebWindowScaleAnimation alloc] initWithHintedDuration:0.2 window:self initalFrame:startRect finalFrame:endRect]; + [_fullscreenAnimation setSubAnimation:subAnimation]; + [_fullscreenAnimation setDelegate:self]; + + // Make sure the animation has scaled the window before showing it. + [_fullscreenAnimation setCurrentProgress:0]; + [self makeKeyAndOrderFront:self]; + + [_fullscreenAnimation startAnimation]; +} + +- (void)animationDidEnd:(NSAnimation *)animation +{ +#if !defined(BUILDING_ON_TIGER) // Animations are never threaded on Tiger. + if (![NSThread isMainThread]) { + [self performSelectorOnMainThread:@selector(animationDidEnd:) withObject:animation waitUntilDone:NO]; + return; + } +#endif + if (animation != _fullscreenAnimation) + return; + + // The animation is not really over and was interrupted + // Don't send completion events. + if ([animation currentProgress] < 1.0) + return; + + // Ensure that animation (and subanimation) don't keep + // the weak reference to the window ivar that may be destroyed from + // now on. + [_fullscreenAnimation setWindow:nil]; + + [_fullscreenAnimation autorelease]; + _fullscreenAnimation = nil; + + [self animatedResizeDidEnd]; +} + +- (void)mouseMoved:(NSEvent *)theEvent +{ + [[self windowController] fadeHUDIn]; +} + +- (void)resignKeyWindow +{ + [super resignKeyWindow]; + [[self windowController] requestExitFullscreenWithAnimation:NO]; +} +@end + +#endif /* ENABLE(VIDEO) */ diff --git a/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h new file mode 100644 index 0000000..8b06c1c --- /dev/null +++ b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009 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 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. + */ + +#if ENABLE(VIDEO) + +#import <Cocoa/Cocoa.h> +#import <WebCore/HTMLMediaElement.h> + +@protocol WebVideoFullscreenHUDWindowControllerDelegate; + +@interface WebVideoFullscreenHUDWindowController : NSWindowController { +@private + id<WebVideoFullscreenHUDWindowControllerDelegate> _delegate; + NSTimer *_timelineUpdateTimer; +#if !defined(BUILDING_ON_TIGER) + NSTrackingArea *_area; +#endif + BOOL _mouseIsInHUD; + + NSControl *_timeline; + NSTextField *_remainingTimeText; + NSTextField *_elapsedTimeText; + NSControl *_volumeSlider; + NSControl *_playButton; +} +- (id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate; +- (void)setDelegate:(id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate; +- (void)fadeWindowIn; +- (void)fadeWindowOut; +- (void)closeWindow; + +@end + +@protocol WebVideoFullscreenHUDWindowControllerDelegate <NSObject> +- (void)requestExitFullscreen; +- (WebCore::HTMLMediaElement*)mediaElement; +@end + +#endif diff --git a/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm new file mode 100644 index 0000000..2edfccc --- /dev/null +++ b/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm @@ -0,0 +1,583 @@ +/* + * Copyright (C) 2009 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 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. + */ + +#if ENABLE(VIDEO) + +#import "WebVideoFullscreenHUDWindowController.h" + +#import <QTKit/QTKit.h> +#import "WebKitSystemInterface.h" +#import "WebTypesInternal.h" +#import <wtf/RetainPtr.h> + +#define HAVE_MEDIA_CONTROL (!defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)) + +@interface WebVideoFullscreenHUDWindowController (Private) <NSWindowDelegate> + +- (void)updateTime; +- (void)timelinePositionChanged:(id)sender; +- (float)currentTime; +- (void)setCurrentTime:(float)currentTime; +- (double)duration; + +- (double)maxVolume; +- (void)volumeChanged:(id)sender; +- (double)volume; +- (void)setVolume:(double)volume; + +- (void)playingChanged:(id)sender; +- (BOOL)playing; +- (void)setPlaying:(BOOL)playing; + +- (void)rewind:(id)sender; +- (void)fastForward:(id)sender; + +- (NSString *)remainingTimeText; +- (NSString *)elapsedTimeText; + +- (void)exitFullscreen:(id)sender; +@end + + +// +// HUD Window +// + +@interface WebVideoFullscreenHUDWindow : NSWindow +@end + +@implementation WebVideoFullscreenHUDWindow + +- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag +{ + UNUSED_PARAM(aStyle); + self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag]; + if (!self) + return nil; + + [self setOpaque:NO]; + [self setBackgroundColor:[NSColor clearColor]]; + [self setLevel:NSPopUpMenuWindowLevel]; + [self setAcceptsMouseMovedEvents:YES]; + [self setIgnoresMouseEvents:NO]; + [self setMovableByWindowBackground:YES]; + [self setHidesOnDeactivate:YES]; + + return self; +} + +- (BOOL)canBecomeKeyWindow +{ + return YES; +} + +- (void)cancelOperation:(id)sender +{ + [[self windowController] exitFullscreen:self]; +} + +- (void)center +{ + NSRect hudFrame = [self frame]; + NSRect screenFrame = [[NSScreen mainScreen] frame]; + [self setFrameTopLeftPoint:NSMakePoint(screenFrame.origin.x + (screenFrame.size.width - hudFrame.size.width) / 2, + screenFrame.origin.y + (screenFrame.size.height - hudFrame.size.height) / 6)]; +} + +- (void)keyDown:(NSEvent *)event +{ + [super keyDown:event]; + [[self windowController] fadeWindowIn]; +} + +@end + +// +// HUD Window Controller +// + +static const CGFloat windowHeight = 59; +static const CGFloat windowWidth = 438; + +static const NSTimeInterval HUDWindowFadeOutDelay = 3; + +@implementation WebVideoFullscreenHUDWindowController + +- (id)init +{ + NSWindow* window = [[WebVideoFullscreenHUDWindow alloc] initWithContentRect:NSMakeRect(0, 0, windowWidth, windowHeight) + styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; + self = [super initWithWindow:window]; + [window setDelegate:self]; + [window release]; + if (!self) + return nil; + [self windowDidLoad]; + return self; +} + +- (void)dealloc +{ + ASSERT(!_timelineUpdateTimer); +#if !defined(BUILDING_ON_TIGER) + ASSERT(!_area); +#endif + [_timeline release]; + [_remainingTimeText release]; + [_elapsedTimeText release]; + [_volumeSlider release]; + [_playButton release]; + [super dealloc]; +} + +#if !defined(BUILDING_ON_TIGER) +- (void)setArea:(NSTrackingArea *)area +{ + if (area == _area) + return; + [_area release]; + _area = [area retain]; +} +#endif + +- (id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate +{ + return _delegate; +} + +- (void)setDelegate:(id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate +{ + _delegate = delegate; +} + +- (void)scheduleTimeUpdate +{ + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(unscheduleTimeUpdate) object:self]; + + // First, update right away, then schedule future update + [self updateTime]; + + [_timelineUpdateTimer invalidate]; + [_timelineUpdateTimer release]; + + // Note that this creates a retain cycle between the window and us. + _timelineUpdateTimer = [[NSTimer timerWithTimeInterval:0.25 target:self selector:@selector(updateTime) userInfo:nil repeats:YES] retain]; +#if defined(BUILDING_ON_TIGER) + [[NSRunLoop currentRunLoop] addTimer:_timelineUpdateTimer forMode:(NSString*)kCFRunLoopCommonModes]; +#else + [[NSRunLoop currentRunLoop] addTimer:_timelineUpdateTimer forMode:NSRunLoopCommonModes]; +#endif +} + +- (void)unscheduleTimeUpdate +{ + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(unscheduleTimeUpdate) object:nil]; + + [_timelineUpdateTimer invalidate]; + [_timelineUpdateTimer release]; + _timelineUpdateTimer = nil; +} + +- (void)fadeWindowIn +{ + NSWindow *window = [self window]; + if (![window isVisible]) + [window setAlphaValue:0]; + + [window makeKeyAndOrderFront:self]; +#if defined(BUILDING_ON_TIGER) + [window setAlphaValue:1]; +#else + [[window animator] setAlphaValue:1]; +#endif + [self scheduleTimeUpdate]; + + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fadeWindowOut) object:nil]; + if (!_mouseIsInHUD && [self playing]) // Don't fade out when paused. + [self performSelector:@selector(fadeWindowOut) withObject:nil afterDelay:HUDWindowFadeOutDelay]; +} + +- (void)fadeWindowOut +{ + [NSCursor setHiddenUntilMouseMoves:YES]; +#if defined(BUILDING_ON_TIGER) + [[self window] setAlphaValue:0]; +#else + [[[self window] animator] setAlphaValue:0]; +#endif + [self performSelector:@selector(unscheduleTimeUpdate) withObject:nil afterDelay:1]; +} + +- (void)closeWindow +{ + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fadeWindowOut) object:nil]; + [self unscheduleTimeUpdate]; + NSWindow *window = [self window]; +#if !defined(BUILDING_ON_TIGER) + [[window contentView] removeTrackingArea:_area]; + [self setArea:nil]; +#endif + [window close]; + [window setDelegate:nil]; + [self setWindow:nil]; +} + +#ifndef HAVE_MEDIA_CONTROL +enum { + WKMediaUIControlPlayPauseButton, + WKMediaUIControlRewindButton, + WKMediaUIControlFastForwardButton, + WKMediaUIControlExitFullscreenButton, + WKMediaUIControlVolumeDownButton, + WKMediaUIControlSlider, + WKMediaUIControlVolumeUpButton, + WKMediaUIControlTimeline +}; +#endif + +static NSControl *createControlWithMediaUIControlType(int controlType, NSRect frame) +{ +#ifdef HAVE_MEDIA_CONTROL + NSControl *control = WKCreateMediaUIControl(controlType); + [control setFrame:frame]; + return control; +#else + if (controlType == WKMediaUIControlSlider) + return [[NSSlider alloc] initWithFrame:frame]; + return [[NSControl alloc] initWithFrame:frame]; +#endif +} + +static NSTextField *createTimeTextField(NSRect frame) +{ + NSTextField *textField = [[NSTextField alloc] initWithFrame:frame]; + [textField setTextColor:[NSColor whiteColor]]; + [textField setBordered:NO]; + [textField setFont:[NSFont systemFontOfSize:10]]; + [textField setDrawsBackground:NO]; + [textField setBezeled:NO]; + [textField setEditable:NO]; + [textField setSelectable:NO]; + return textField; +} + +- (void)windowDidLoad +{ + static const CGFloat kMargin = 9; + static const CGFloat kMarginTop = 9; + static const CGFloat kButtonSize = 25; + static const CGFloat kButtonMiniSize = 16; + + NSWindow *window = [self window]; + ASSERT(window); + +#ifdef HAVE_MEDIA_CONTROL + NSView *background = WKCreateMediaUIBackgroundView(); +#else + NSView *background = [[NSView alloc] init]; +#endif + [window setContentView:background]; +#if !defined(BUILDING_ON_TIGER) + _area = [[NSTrackingArea alloc] initWithRect:[background bounds] options:NSTrackingMouseEnteredAndExited|NSTrackingActiveAlways owner:self userInfo:nil]; + [background addTrackingArea:_area]; +#endif + [background release]; + + NSView *contentView = [[self window] contentView]; + + CGFloat top = windowHeight - kMarginTop; + CGFloat center = (windowWidth - kButtonSize) / 2; + _playButton = createControlWithMediaUIControlType(WKMediaUIControlPlayPauseButton, NSMakeRect(center, top - kButtonSize, kButtonSize, kButtonSize)); + [_playButton setTarget:self]; + [_playButton setAction:@selector(playingChanged:)]; + [contentView addSubview:_playButton]; + + CGFloat closeToRight = windowWidth - 2 * kMargin - kButtonMiniSize; + NSControl *exitFullscreenButton = createControlWithMediaUIControlType(WKMediaUIControlExitFullscreenButton, NSMakeRect(closeToRight, top - kButtonSize / 2 - kButtonMiniSize / 2, kButtonMiniSize, kButtonMiniSize)); + [exitFullscreenButton setAction:@selector(exitFullscreen:)]; + [exitFullscreenButton setTarget:self]; + [contentView addSubview:exitFullscreenButton]; + [exitFullscreenButton release]; + + CGFloat left = kMargin; + NSControl *volumeDownButton = createControlWithMediaUIControlType(WKMediaUIControlVolumeDownButton, NSMakeRect(left, top - kButtonSize / 2 - kButtonMiniSize / 2, kButtonMiniSize, kButtonMiniSize)); + [contentView addSubview:volumeDownButton]; + [volumeDownButton release]; + + static const int volumeSliderWidth = 50; + + left = kMargin + kButtonMiniSize; + _volumeSlider = createControlWithMediaUIControlType(WKMediaUIControlSlider, NSMakeRect(left, top - kButtonSize / 2 - kButtonMiniSize / 2, volumeSliderWidth, kButtonMiniSize)); + [_volumeSlider setValue:[NSNumber numberWithDouble:[self maxVolume]] forKey:@"maxValue"]; + [_volumeSlider setTarget:self]; + [_volumeSlider setAction:@selector(volumeChanged:)]; + [contentView addSubview:_volumeSlider]; + + left = kMargin + kButtonMiniSize + volumeSliderWidth + kButtonMiniSize / 2; + NSControl *button = createControlWithMediaUIControlType(WKMediaUIControlVolumeUpButton, NSMakeRect(left, top - kButtonSize / 2 - kButtonMiniSize / 2, kButtonMiniSize, kButtonMiniSize)); + [contentView addSubview:button]; + [button release]; + + static const int timeTextWidth = 50; + static const int sliderHeight = 13; + static const int sliderMarginFixup = 4; + +#ifdef HAVE_MEDIA_CONTROL + _timeline = WKCreateMediaUIControl(WKMediaUIControlTimeline); +#else + _timeline = [[NSSlider alloc] init]; +#endif + [_timeline setTarget:self]; + [_timeline setAction:@selector(timelinePositionChanged:)]; + [_timeline setFrame:NSMakeRect(kMargin + timeTextWidth + kMargin/2, kMargin - sliderMarginFixup, windowWidth - 2 * (kMargin - sliderMarginFixup) - kMargin * 2 - 2 * timeTextWidth, sliderHeight)]; + [contentView addSubview:_timeline]; + + static const int timeTextHeight = 11; + + _elapsedTimeText = createTimeTextField(NSMakeRect(kMargin, kMargin, timeTextWidth, timeTextHeight)); + [contentView addSubview:_elapsedTimeText]; + + _remainingTimeText = createTimeTextField(NSMakeRect(windowWidth - kMargin - timeTextWidth, kMargin, timeTextWidth, timeTextHeight)); + [contentView addSubview:_remainingTimeText]; + + [window recalculateKeyViewLoop]; + [window setInitialFirstResponder:_playButton]; + [window center]; +} + +/* + * Bindings + * + */ + +- (void)updateVolume +{ + [_volumeSlider setDoubleValue:[self volume]]; +} + +- (void)updateTime +{ + [self updateVolume]; + + [_timeline setFloatValue:[self currentTime]]; + [(NSSlider*)_timeline setMaxValue:[self duration]]; + + [_remainingTimeText setStringValue:[self remainingTimeText]]; + [_elapsedTimeText setStringValue:[self elapsedTimeText]]; +} + +- (void)fastForward +{ +} + +- (void)timelinePositionChanged:(id)sender +{ + [self setCurrentTime:[_timeline floatValue]]; +} + +- (float)currentTime +{ + return [_delegate mediaElement] ? [_delegate mediaElement]->currentTime() : 0; +} + +- (void)setCurrentTime:(float)currentTime +{ + if (![_delegate mediaElement]) + return; + WebCore::ExceptionCode e; + [_delegate mediaElement]->setCurrentTime(currentTime, e); +} + +- (double)duration +{ + return [_delegate mediaElement] ? [_delegate mediaElement]->duration() : 0; +} + +- (double)maxVolume +{ + // Set the volume slider resolution + return 100; +} + +- (void)volumeChanged:(id)sender +{ + [self setVolume:[_volumeSlider doubleValue]]; +} + +- (double)volume +{ + return [_delegate mediaElement] ? [_delegate mediaElement]->volume() * [self maxVolume] : 0; +} + +- (void)setVolume:(double)volume +{ + if (![_delegate mediaElement]) + return; + WebCore::ExceptionCode e; + [_delegate mediaElement]->setVolume(volume / [self maxVolume], e); +} + +- (void)playingChanged:(id)sender +{ + [self setPlaying:![self playing]]; + + // Keep HUD visible when paused + if (![self playing]) + [self fadeWindowIn]; + else if (!_mouseIsInHUD) { + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fadeWindowOut) object:nil]; + [self performSelector:@selector(fadeWindowOut) withObject:nil afterDelay:HUDWindowFadeOutDelay]; + } +} + +- (BOOL)playing +{ + if (![_delegate mediaElement]) + return false; + return ![_delegate mediaElement]->canPlay(); +} + +- (void)setPlaying:(BOOL)playing +{ + if (![_delegate mediaElement]) + return; + + if (playing) + [_delegate mediaElement]->play(); + else + [_delegate mediaElement]->pause(); +} + +static NSString *timeToString(double time) +{ + if (!isfinite(time)) + time = 0; + int seconds = (int)fabsf(time); + int hours = seconds / (60 * 60); + int minutes = (seconds / 60) % 60; + seconds %= 60; + if (hours) { + if (hours > 9) + return [NSString stringWithFormat:@"%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds]; + else + return [NSString stringWithFormat:@"%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds]; + } + else + return [NSString stringWithFormat:@"%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds]; + +} + +static NSString *stringToTimeTextAttributed(NSString *string, NSTextAlignment align) +{ + NSShadow *blackShadow = [[NSShadow alloc] init]; + [blackShadow setShadowColor:[NSColor blackColor]]; + [blackShadow setShadowBlurRadius:0]; + [blackShadow setShadowOffset:NSMakeSize(0, -1)]; + NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; + [style setAlignment:align]; + NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:blackShadow, NSShadowAttributeName, style, NSParagraphStyleAttributeName, nil]; + [style release]; + [blackShadow release]; + + NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:string attributes:dict]; + return [attrString autorelease]; +} + +- (NSString *)remainingTimeText +{ + if (![_delegate mediaElement]) + return @""; + + // Negative number + return stringToTimeTextAttributed(timeToString([_delegate mediaElement]->currentTime() - [_delegate mediaElement]->duration()), NSLeftTextAlignment); +} + +- (NSString *)elapsedTimeText +{ + if (![_delegate mediaElement]) + return @""; + + return stringToTimeTextAttributed(timeToString([_delegate mediaElement]->currentTime()), NSRightTextAlignment); +} + +/* + * Tracking area callbacks + * + */ + +- (void)mouseEntered:(NSEvent *)theEvent +{ + // Make sure the HUD won't be hidden from now + _mouseIsInHUD = YES; + [self fadeWindowIn]; +} + +- (void)mouseExited:(NSEvent *)theEvent +{ + _mouseIsInHUD = NO; + [self fadeWindowIn]; +} + +/* + * Other Interface callbacks + * + */ + +- (void)rewind:(id)sender +{ + if (![_delegate mediaElement]) + return; + [_delegate mediaElement]->rewind(30); +} + +- (void)fastForward:(id)sender +{ + if (![_delegate mediaElement]) + return; +} + +- (void)exitFullscreen:(id)sender +{ + [_delegate requestExitFullscreen]; +} + +/* + * Window callback + * + */ + +- (void)windowDidExpose:(NSNotification *)notification +{ + [self scheduleTimeUpdate]; +} + +- (void)windowDidClose:(NSNotification *)notification +{ + [self unscheduleTimeUpdate]; +} + +@end + +#endif diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 20f2712..83c7e20 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -84,6 +84,7 @@ #import "WebPanelAuthenticationHandler.h" #import "WebPasteboardHelper.h" #import "WebPluginDatabase.h" +#import "WebPluginHalterClient.h" #import "WebPolicyDelegate.h" #import "WebPreferenceKeysPrivate.h" #import "WebPreferencesPrivate.h" @@ -93,6 +94,7 @@ #import "WebTextIterator.h" #import "WebUIDelegate.h" #import "WebUIDelegatePrivate.h" +#import "WebVideoFullscreenController.h" #import <CoreFoundation/CFSet.h> #import <Foundation/NSURLConnection.h> #import <WebCore/ApplicationCacheStorage.h> @@ -619,7 +621,7 @@ static bool runningTigerMail() didOneTimeInitialization = true; } - _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self)); + _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self)); _private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]); @@ -661,11 +663,11 @@ static bool runningTigerMail() if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION)) { // Originally, we allowed all local loads. - FrameLoader::setLocalLoadPolicy(FrameLoader::AllowLocalLoadsForAll); + SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForAll); } else if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_MORE_STRICT_LOCAL_RESOURCE_SECURITY_RESTRICTION)) { // Later, we allowed local loads for local URLs and documents loaded // with substitute data. - FrameLoader::setLocalLoadPolicy(FrameLoader::AllowLocalLoadsForLocalAndSubstituteData); + SecurityOrigin::setLocalLoadPolicy(SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData); } if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_CONTENT_SNIFFING_FOR_FILE_URLS)) @@ -997,6 +999,8 @@ static bool fastDocumentTeardownEnabled() return; } + [self _exitFullscreen]; + if (Frame* mainFrame = [self _mainCoreFrame]) mainFrame->loader()->detachFromParent(); @@ -1277,6 +1281,8 @@ static bool fastDocumentTeardownEnabled() settings->setPluginsEnabled([preferences arePlugInsEnabled]); settings->setDatabasesEnabled([preferences databasesEnabled]); settings->setLocalStorageEnabled([preferences localStorageEnabled]); + settings->setExperimentalNotificationsEnabled([preferences experimentalNotificationsEnabled]); + settings->setExperimentalWebSocketsEnabled([preferences experimentalWebSocketsEnabled]); settings->setPrivateBrowsingEnabled([preferences privateBrowsingEnabled]); settings->setSansSerifFontFamily([preferences sansSerifFontFamily]); settings->setSerifFontFamily([preferences serifFontFamily]); @@ -1311,6 +1317,9 @@ static bool fastDocumentTeardownEnabled() settings->setXSSAuditorEnabled([preferences isXSSAuditorEnabled]); settings->setEnforceCSSMIMETypeInStrictMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1)); settings->setAcceleratedCompositingEnabled([preferences acceleratedCompositingEnabled]); + settings->setPluginHalterEnabled([preferences pluginHalterEnabled]); + settings->setPluginAllowedRunTime([preferences pluginAllowedRunTime]); + settings->setWebGLEnabled([preferences webGLEnabled]); } static inline IMP getMethod(id o, SEL s) @@ -1371,6 +1380,8 @@ static inline IMP getMethod(id o, SEL s) cache->willCloseFrameFunc = getMethod(delegate, @selector(webView:willCloseFrame:)); cache->willPerformClientRedirectToURLDelayFireDateForFrameFunc = getMethod(delegate, @selector(webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:)); cache->windowScriptObjectAvailableFunc = getMethod(delegate, @selector(webView:windowScriptObjectAvailable:)); + cache->didDisplayInsecureContentFunc = getMethod(delegate, @selector(webViewDidDisplayInsecureContent:)); + cache->didRunInsecureContentFunc = getMethod(delegate, @selector(webView:didRunInsecureContent:)); } - (void)_cacheScriptDebugDelegateImplementations @@ -1396,6 +1407,22 @@ static inline IMP getMethod(id o, SEL s) cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:)); } +- (void)_cacheHistoryDelegateImplementations +{ + WebHistoryDelegateImplementationCache *cache = &_private->historyDelegateImplementations; + id delegate = _private->historyDelegate; + + if (!delegate) { + bzero(cache, sizeof(WebHistoryDelegateImplementationCache)); + return; + } + + cache->navigatedFunc = getMethod(delegate, @selector(webView:didNavigateWithNavigationData:inFrame:)); + cache->clientRedirectFunc = getMethod(delegate, @selector(webView:didPerformClientRedirectFromURL:toURL:inFrame:)); + cache->serverRedirectFunc = getMethod(delegate, @selector(webView:didPerformServerRedirectFromURL:toURL:inFrame:)); + cache->setTitleFunc = getMethod(delegate, @selector(webView:updateHistoryTitle:forURL:)); +} + - (id)_policyDelegateForwarder { if (!_private->policyDelegateForwarder) @@ -2092,6 +2119,15 @@ static inline IMP getMethod(id o, SEL s) return _private ? _private->insertionPasteboard : nil; } ++ (void)_whiteListAccessFromOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains +{ + SecurityOrigin::whiteListAccessFromOrigin(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains); +} + ++(void)_resetOriginAccessWhiteLists +{ + SecurityOrigin::resetOriginAccessWhiteLists(); +} - (void)_updateActiveState { @@ -2099,6 +2135,108 @@ static inline IMP getMethod(id o, SEL s) _private->page->focusController()->setActive([[self window] isKeyWindow]); } +static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) +{ + // Convert the patterns into Vectors. + NSUInteger count = [patterns count]; + if (count == 0) + return 0; + Vector<String>* patternsVector = new Vector<String>; + for (NSUInteger i = 0; i < count; ++i) { + id entry = [patterns objectAtIndex:i]; + if ([entry isKindOfClass:[NSString class]]) + patternsVector->append(String((NSString*)entry)); + } + return patternsVector; +} + ++ (void)_addUserScriptToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID + whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime +{ + String group(groupName); + if (group.isEmpty() || worldID == UINT_MAX) + return; + + PageGroup* pageGroup = PageGroup::pageGroup(group); + if (!pageGroup) + return; + + pageGroup->addUserScript(source, url, toStringVector(whitelist), toStringVector(blacklist), worldID, + injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd); +} + ++ (void)_addUserStyleSheetToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID + whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist +{ + String group(groupName); + if (group.isEmpty() || worldID == UINT_MAX) + return; + + PageGroup* pageGroup = PageGroup::pageGroup(group); + if (!pageGroup) + return; + + pageGroup->addUserStyleSheet(source, url, toStringVector(whitelist), toStringVector(blacklist), worldID); +} + ++ (void)_removeUserContentFromGroup:(NSString *)groupName url:(NSURL *)url worldID:(unsigned)worldID +{ + String group(groupName); + if (group.isEmpty()) + return; + + PageGroup* pageGroup = PageGroup::pageGroup(group); + if (!pageGroup) + return; + + pageGroup->removeUserContentWithURLForWorld(url, worldID); +} + ++ (void)_removeUserContentFromGroup:(NSString *)groupName worldID:(unsigned)worldID +{ + String group(groupName); + if (group.isEmpty()) + return; + + PageGroup* pageGroup = PageGroup::pageGroup(group); + if (!pageGroup) + return; + + pageGroup->removeUserContentForWorld(worldID); +} + ++ (void)_removeAllUserContentFromGroup:(NSString *)groupName +{ + String group(groupName); + if (group.isEmpty()) + return; + + PageGroup* pageGroup = PageGroup::pageGroup(group); + if (!pageGroup) + return; + + pageGroup->removeAllUserContent(); +} + +- (BOOL)cssAnimationsSuspended +{ + return _private->cssAnimationsSuspended; +} + +- (void)setCSSAnimationsSuspended:(BOOL)suspended +{ + if (suspended == _private->cssAnimationsSuspended) + return; + + _private->cssAnimationsSuspended = suspended; + + Frame* frame = core([self mainFrame]); + if (suspended) + frame->animation()->suspendAnimations(frame->document()); + else + frame->animation()->resumeAnimations(frame->document()); +} + @end @implementation _WebSafeForwarder @@ -3875,6 +4013,17 @@ done: { return _private->scriptDebugDelegate; } + +- (void)setHistoryDelegate:(id)delegate +{ + _private->historyDelegate = delegate; + [self _cacheHistoryDelegateImplementations]; +} + +- (id)historyDelegate +{ + return _private->historyDelegate; +} - (BOOL)shouldClose { @@ -5091,13 +5240,16 @@ static WebFrameView *containingFrameView(NSView *view) id documentView = [[[self selectedFrame] frameView] documentView]; if (![documentView conformsToProtocol:@protocol(WebDocumentText)]) return; - + NSString *selectedString = [(id <WebDocumentText>)documentView selectedString]; - if ([selectedString length] == 0) { + if (![selectedString length]) return; - } +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + [[NSWorkspace sharedWorkspace] showSearchResultsForQueryString:selectedString]; +#else (void)HISearchWindowShow((CFStringRef)selectedString, kNilOptions); +#endif } #if USE(ACCELERATED_COMPOSITING) @@ -5469,6 +5621,45 @@ static void layerSyncRunLoopObserverCallBack(CFRunLoopObserverRef, CFRunLoopActi #endif +#if ENABLE(VIDEO) + +- (void)_enterFullscreenForNode:(WebCore::Node*)node +{ + ASSERT(node->hasTagName(WebCore::HTMLNames::videoTag)); + HTMLMediaElement* videoElement = static_cast<HTMLMediaElement*>(node); + + if (_private->fullscreenController) { + if ([_private->fullscreenController mediaElement] == videoElement) { + // The backend may just warn us that the underlaying plaftormMovie() + // has changed. Just force an update. + [_private->fullscreenController setMediaElement:videoElement]; + return; // No more to do. + } + + // First exit Fullscreen for the old mediaElement. + [_private->fullscreenController mediaElement]->exitFullscreen(); + // This previous call has to trigger _exitFullscreen, + // which has to clear _private->fullscreenController. + ASSERT(!_private->fullscreenController); + } + if (!_private->fullscreenController) { + _private->fullscreenController = [[WebVideoFullscreenController alloc] init]; + [_private->fullscreenController setMediaElement:videoElement]; + [_private->fullscreenController enterFullscreen:[[self window] screen]]; + } + else + [_private->fullscreenController setMediaElement:videoElement]; +} + +- (void)_exitFullscreen +{ + [_private->fullscreenController exitFullscreen]; + [_private->fullscreenController release]; + _private->fullscreenController = nil; +} + +#endif + @end #ifdef BUILDING_ON_LEOPARD diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h index 91d83a7..6ec94a7 100644 --- a/WebKit/mac/WebView/WebViewData.h +++ b/WebKit/mac/WebView/WebViewData.h @@ -43,6 +43,9 @@ namespace WebCore { @class WebPreferences; @class WebTextCompletionController; @protocol WebFormDelegate; +#if ENABLE(VIDEO) +@class WebVideoFullscreenController; +#endif extern BOOL applicationIsTerminating; extern int pluginDatabaseClientCount; @@ -64,6 +67,7 @@ extern int pluginDatabaseClientCount; id editingDelegate; id editingDelegateForwarder; id scriptDebugDelegate; + id historyDelegate; WebInspector *inspector; WebNodeHighlight *currentNodeHighlight; @@ -86,6 +90,7 @@ extern int pluginDatabaseClientCount; WebResourceDelegateImplementationCache resourceLoadDelegateImplementations; WebFrameLoadDelegateImplementationCache frameLoadDelegateImplementations; WebScriptDebugDelegateImplementationCache scriptDebugDelegateImplementations; + WebHistoryDelegateImplementationCache historyDelegateImplementations; void *observationInfo; @@ -100,6 +105,7 @@ extern int pluginDatabaseClientCount; BOOL hoverFeedbackSuspended; BOOL usesPageCache; BOOL catchesDelegateExceptions; + BOOL cssAnimationsSuspended; NSColor *backgroundColor; @@ -157,5 +163,8 @@ extern int pluginDatabaseClientCount; NSEvent *autoscrollTriggerEvent; CFRunLoopTimerRef updateMouseoverTimer; +#if ENABLE(VIDEO) + WebVideoFullscreenController *fullscreenController; +#endif } @end diff --git a/WebKit/mac/WebView/WebViewData.mm b/WebKit/mac/WebView/WebViewData.mm index 48e7f6c..835f46e 100644 --- a/WebKit/mac/WebView/WebViewData.mm +++ b/WebKit/mac/WebView/WebViewData.mm @@ -57,6 +57,7 @@ int pluginDatabaseClientCount = 0; allowsUndo = YES; usesPageCache = YES; shouldUpdateWhileOffscreen = YES; + cssAnimationsSuspended = NO; zoomMultiplier = 1; @@ -80,6 +81,7 @@ int pluginDatabaseClientCount = 0; ASSERT(applicationIsTerminating || !page); ASSERT(applicationIsTerminating || !preferences); ASSERT(!insertionPasteboard); + ASSERT(!fullscreenController); [applicationNameForUserAgent release]; [backgroundColor release]; @@ -99,6 +101,7 @@ int pluginDatabaseClientCount = 0; { ASSERT_MAIN_THREAD(); ASSERT(!insertionPasteboard); + ASSERT(!fullscreenController); [super finalize]; } diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h index b8266c5..521aeee 100644 --- a/WebKit/mac/WebView/WebViewInternal.h +++ b/WebKit/mac/WebView/WebViewInternal.h @@ -41,6 +41,7 @@ namespace WebCore { class KURL; class KeyboardEvent; class Page; + class Node; } #endif @@ -110,10 +111,6 @@ namespace WebCore { - (id)_policyDelegateForwarder; - (void)_pushPerformingProgrammaticFocus; - (void)_popPerformingProgrammaticFocus; -- (void)_incrementProgressForIdentifier:(id)identifier response:(NSURLResponse *)response; -- (void)_incrementProgressForIdentifier:(id)identifier length:(int)length; -- (void)_completeProgressForIdentifier:(id)identifer; -- (void)_progressStarted:(WebFrame *)frame; - (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame; + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType; - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType; @@ -138,7 +135,6 @@ namespace WebCore { - (void)_didChangeValueForKey:(NSString *)key; - (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType; - (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension; -- (BOOL)_isMIMETypeRegisteredAsPlugin:(NSString *)MIMEType; - (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight; - (WebNodeHighlight *)currentNodeHighlight; @@ -168,4 +164,9 @@ namespace WebCore { - (void)_setInsertionPasteboard:(NSPasteboard *)pasteboard; +#if ENABLE(VIDEO) && defined(__cplusplus) +- (void)_enterFullscreenForNode:(WebCore::Node*)node; +- (void)_exitFullscreen; +#endif + @end diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h index 362b2e6..fa5d28c 100644 --- a/WebKit/mac/WebView/WebViewPrivate.h +++ b/WebKit/mac/WebView/WebViewPrivate.h @@ -76,6 +76,11 @@ typedef enum { } WebDashboardBehavior; #endif +typedef enum { + WebInjectAtDocumentStart, + WebInjectAtDocumentEnd, +} WebUserScriptInjectionTime; + @interface WebController : NSTreeController { IBOutlet WebView *webView; } @@ -134,6 +139,20 @@ typedef enum { */ - (id)scriptDebugDelegate; +/*! + @method setHistoryDelegate: + @abstract Set the WebView's WebHistoryDelegate delegate. + @param delegate The WebHistoryDelegate to set as the delegate. +*/ +- (void)setHistoryDelegate:(id)delegate; + +/*! + @method historyDelegate + @abstract Return the WebView's WebHistoryDelegate delegate. + @result The WebView's WebHistoryDelegate delegate. +*/ +- (id)historyDelegate; + - (BOOL)shouldClose; /*! @@ -443,6 +462,35 @@ Could be worth adding to the API. // Which pasteboard text is coming from in editing delegate methods such as shouldInsertNode. - (NSPasteboard *)_insertionPasteboard; +// Whitelists access from an origin (sourceOrigin) to a set of one or more origins described by the parameters: +// - destinationProtocol: The protocol to grant access to. +// - destinationHost: The host to grant access to. +// - allowDestinationSubdomains: If host is a domain, setting this to YES will whitelist host and all its subdomains, recursively. ++ (void)_whiteListAccessFromOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains; + +// Removes all white list entries created with _whiteListAccessFromOrigin. ++ (void)_resetOriginAccessWhiteLists; + ++ (void)_addUserScriptToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime; ++ (void)_addUserStyleSheetToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist; ++ (void)_removeUserContentFromGroup:(NSString *)groupName url:(NSURL *)url worldID:(unsigned)worldID; ++ (void)_removeUserContentFromGroup:(NSString *)groupName worldID:(unsigned)worldID; ++ (void)_removeAllUserContentFromGroup:(NSString *)groupName; + +/*! + @method cssAnimationsSuspended + @abstract Returns whether or not CSS Animations are suspended. + @result YES if CSS Animations are suspended. +*/ +- (BOOL)cssAnimationsSuspended; + +/*! + @method setCSSAnimationsSuspended + @param paused YES to suspend animations, NO to resume animations. + @discussion Suspends or resumes all running animations and transitions in the page. +*/ +- (void)setCSSAnimationsSuspended:(BOOL)suspended; + @end @interface WebView (WebViewPrintingPrivate) diff --git a/WebKit/mac/WebView/WebWindowAnimation.h b/WebKit/mac/WebView/WebWindowAnimation.h new file mode 100644 index 0000000..c73dcce --- /dev/null +++ b/WebKit/mac/WebView/WebWindowAnimation.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2009 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 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. + */ + +#import <Cocoa/Cocoa.h> + +@interface WebWindowScaleAnimation : NSAnimation { +@private + NSRect _initialFrame, _finalFrame, _realFrame; + NSWindow *_window; // (assign) + NSAnimation *_subAnimation; // (retain) + NSTimeInterval _hintedDuration; +} +- (id)initWithHintedDuration:(NSTimeInterval)duration window:(NSWindow *)window initalFrame:(NSRect)initialFrame finalFrame:(NSRect)finalFrame; + +- (void)setSubAnimation:(NSAnimation *)animation; + +- (NSRect)currentFrame; + +// Be sure to call setWindow:nil to clear the weak link _window when appropriate +- (void)setWindow:(NSWindow *)window; +@end + + +@interface WebWindowFadeAnimation : NSAnimation { +@private + CGFloat _initialAlpha, _finalAlpha; + NSWindow *_window; // (retain) + BOOL _isStopped; + +} +- (id)initWithDuration:(NSTimeInterval)duration window:(NSWindow *)window initialAlpha:(CGFloat)initialAlpha finalAlpha:(CGFloat)finalAlpha; + +- (CGFloat)currentAlpha; + +// Be sure to call setWindow:nil to clear the weak link _window when appropriate +- (void)setWindow:(NSWindow *)window; +@end diff --git a/WebKit/mac/WebView/WebWindowAnimation.m b/WebKit/mac/WebView/WebWindowAnimation.m new file mode 100644 index 0000000..3ab64bf --- /dev/null +++ b/WebKit/mac/WebView/WebWindowAnimation.m @@ -0,0 +1,239 @@ +/* + * Copyright (C) 2009 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 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. + */ + +#import "WebWindowAnimation.h" +#import "WebKitSystemInterface.h" +#import <wtf/Assertions.h> + +static const CGFloat slowMotionFactor = 10.; + +static NSTimeInterval WebWindowAnimationDurationFromDuration(NSTimeInterval duration) +{ + return ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask) ? duration * slowMotionFactor : duration; +} + +static NSRect scaledRect(NSRect _initialFrame, NSRect _finalFrame, double factor) +{ + NSRect currentRect = _initialFrame; + currentRect.origin.x += (NSMinX(_finalFrame) - NSMinX(_initialFrame)) * factor; + currentRect.origin.y += (NSMinY(_finalFrame) - NSMinY(_initialFrame)) * factor; + currentRect.size.width += (NSWidth(_finalFrame) - NSWidth(_initialFrame)) * factor; + currentRect.size.height += (NSHeight(_finalFrame) - NSHeight(_initialFrame)) * factor; + return currentRect; +} + +static CGFloat squaredDistance(NSPoint point1, NSPoint point2) +{ + CGFloat deltaX = point1.x - point2.x; + CGFloat deltaY = point1.y - point2.y; + return deltaX * deltaX + deltaY * deltaY; +} + +@implementation WebWindowScaleAnimation + +- (id)init +{ + self = [super init]; + if (!self) + return nil; +#ifndef BUILDING_ON_TIGER + [self setAnimationBlockingMode:NSAnimationNonblockingThreaded]; +#endif + [self setFrameRate:60.]; + return self; +} + +- (id)initWithHintedDuration:(NSTimeInterval)duration window:(NSWindow *)window initalFrame:(NSRect)initialFrame finalFrame:(NSRect)finalFrame +{ + self = [self init]; + if (!self) + return nil; + _hintedDuration = duration; + _window = window; + _initialFrame = initialFrame; + _finalFrame = finalFrame; + _realFrame = [window frame]; + return self; +} + +- (void) dealloc +{ + [_window release]; + [_subAnimation release]; + [super dealloc]; +} + +- (void)setDuration:(NSTimeInterval)duration +{ + [super setDuration:WebWindowAnimationDurationFromDuration(duration)]; +} + +- (void)setWindow:(NSWindow *)window +{ + _window = window; +} + +- (float)currentValue +{ + return 0.5 - 0.5 * cos(M_PI * (1 - [self currentProgress])); +} + +- (NSRect)currentFrame +{ + return scaledRect(_finalFrame, _initialFrame, [self currentValue]); +} + +- (void)setCurrentProgress:(NSAnimationProgress)progress +{ + if (!_window) + return; + + [super setCurrentProgress:progress]; + + NSRect currentRect = [self currentFrame]; +#ifndef BUILDING_ON_TIGER + WKWindowSetScaledFrame(_window, currentRect, _realFrame); +#else + [_window setFrame:currentRect display:YES]; +#endif + [_subAnimation setCurrentProgress:progress]; +} + +- (void)setSubAnimation:(NSAnimation *)animation +{ + id oldAnimation = _subAnimation; + _subAnimation = [animation retain]; + [oldAnimation release]; +} + +- (NSTimeInterval)additionalDurationNeededToReachFinalFrame +{ + static const CGFloat maxAdditionalDuration = 1.0; + static const CGFloat speedFactor = 0.0001; + + CGFloat maxDist = squaredDistance(_initialFrame.origin, _finalFrame.origin); + CGFloat dist; + + dist = squaredDistance(NSMakePoint(NSMaxX(_initialFrame), NSMinY(_initialFrame)), NSMakePoint(NSMaxX(_finalFrame), NSMinY(_finalFrame))); + if (dist > maxDist) + maxDist = dist; + + dist = squaredDistance(NSMakePoint(NSMaxX(_initialFrame), NSMaxY(_initialFrame)), NSMakePoint(NSMaxX(_finalFrame), NSMaxY(_finalFrame))); + if (dist > maxDist) + maxDist = dist; + + dist = squaredDistance(NSMakePoint(NSMinX(_initialFrame), NSMinY(_initialFrame)), NSMakePoint(NSMinX(_finalFrame), NSMinY(_finalFrame))); + if (dist > maxDist) + maxDist = dist; + + return MIN(sqrt(maxDist) * speedFactor, maxAdditionalDuration); +} + +- (void)startAnimation +{ + // Compute extra time + if (_hintedDuration) + [self setDuration:_hintedDuration + [self additionalDurationNeededToReachFinalFrame]]; + [super startAnimation]; +} + +- (void)stopAnimation +{ + _window = nil; + [super stopAnimation]; + [_subAnimation stopAnimation]; +} + +@end + +@implementation WebWindowFadeAnimation + +- (id)init +{ + self = [super init]; + if (!self) + return nil; +#ifndef BUILDING_ON_TIGER + [self setAnimationBlockingMode:NSAnimationNonblockingThreaded]; +#endif + [self setFrameRate:60]; + [self setAnimationCurve:NSAnimationEaseInOut]; + return self; +} + +- (id)initWithDuration:(NSTimeInterval)duration window:(NSWindow *)window initialAlpha:(CGFloat)initialAlpha finalAlpha:(CGFloat)finalAlpha +{ + self = [self init]; + if (!self) + return nil; + _window = window; + _initialAlpha = initialAlpha; + _finalAlpha = finalAlpha; + return self; +} + +- (void)setDuration:(NSTimeInterval)duration +{ + [super setDuration:WebWindowAnimationDurationFromDuration(duration)]; +} + +- (CGFloat)currentAlpha +{ + return MAX(0.0, MIN(1.0, _initialAlpha + [self currentValue] * (_finalAlpha - _initialAlpha))); +} + +- (void)setCurrentProgress:(NSAnimationProgress)progress +{ + if (_isStopped) + return; + + ASSERT(_window); + [super setCurrentProgress:progress]; + +#ifndef BUILDING_ON_TIGER + WKWindowSetAlpha(_window, [self currentAlpha]); +#else + [_window setAlphaValue:[self currentAlpha]]; +#endif +} + +- (void)setWindow:(NSWindow*)window +{ + _window = window; +} + +- (void)stopAnimation +{ + // This is relevant when we are a sub animation of a scale animation. + // In this case we are hosted in the animated thread of the parent + // and even after [super stopAnimation], the parent might call + // setCurrrentProgress. + _isStopped = YES; + + [super stopAnimation]; +} + +@end + diff --git a/WebKit/mac/Workers/WebWorkersPrivate.h b/WebKit/mac/Workers/WebWorkersPrivate.h new file mode 100644 index 0000000..0ff60d5 --- /dev/null +++ b/WebKit/mac/Workers/WebWorkersPrivate.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2009 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. + */ + +@interface WebWorkersPrivate : NSObject { +} + +// Returns the total number of currently executing worker threads (shared + dedicated). ++ (unsigned) workerThreadCount; + +@end diff --git a/WebKit/mac/Workers/WebWorkersPrivate.mm b/WebKit/mac/Workers/WebWorkersPrivate.mm new file mode 100644 index 0000000..2c14ad1 --- /dev/null +++ b/WebKit/mac/Workers/WebWorkersPrivate.mm @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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 "WebWorkersPrivate.h" + +#import <WebCore/WorkerThread.h> + +@implementation WebWorkersPrivate + ++ (unsigned) workerThreadCount +{ +#if ENABLE_WORKERS + return WebCore::WorkerThread::workerThreadCount(); +#else + return 0; +#endif +} + +@end diff --git a/WebKit/qt/Api/headers.pri b/WebKit/qt/Api/headers.pri index 92a120d..5a95c67 100644 --- a/WebKit/qt/Api/headers.pri +++ b/WebKit/qt/Api/headers.pri @@ -1,4 +1,5 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \ + $$PWD/qgraphicswebview.h \ $$PWD/qwebkitglobal.h \ $$PWD/qwebpage.h \ $$PWD/qwebview.h \ @@ -10,4 +11,5 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \ $$PWD/qwebplugindatabase.h \ $$PWD/qwebpluginfactory.h \ $$PWD/qwebhistory.h \ + $$PWD/qwebinspector.h \ $$PWD/qwebkitversion.h diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp new file mode 100644 index 0000000..c267745 --- /dev/null +++ b/WebKit/qt/Api/qgraphicswebview.cpp @@ -0,0 +1,832 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "qgraphicswebview.h" + +#include "qwebframe.h" +#include "qwebpage.h" +#include "qwebpage_p.h" +#include "QWebPageClient.h" +#include <QtGui/QGraphicsScene> +#include <QtGui/QGraphicsView> +#include <QtGui/qapplication.h> +#include <QtGui/qgraphicssceneevent.h> +#include <QtGui/qstyleoption.h> +#if defined(Q_WS_X11) +#include <QX11Info> +#endif + +class QGraphicsWebViewPrivate : public QWebPageClient { +public: + QGraphicsWebViewPrivate(QGraphicsWebView* parent) + : q(parent) + , page(0) + , interactive(true) + , progress(1.0) + {} + + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + +#ifndef QT_NO_CURSOR + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); +#endif + + virtual int screenNumber() const; + virtual WId winId() const; + + virtual QObject* pluginParent() const; + + void _q_doLoadProgress(int progress); + void _q_doLoadFinished(bool success); + void _q_setStatusBarMessage(const QString& message); + + QGraphicsWebView* q; + QWebPage* page; + + QString statusBarMessage; + bool interactive; + qreal progress; +}; + +void QGraphicsWebViewPrivate::_q_doLoadProgress(int progress) +{ + if (qFuzzyCompare(this->progress, qreal(progress / 100.))) + return; + + this->progress = progress / 100.; + + emit q->progressChanged(this->progress); +} + +void QGraphicsWebViewPrivate::_q_doLoadFinished(bool success) +{ + // If the page had no title, still make sure it gets the signal + if (q->title().isEmpty()) + emit q->urlChanged(q->url()); + + emit q->loadFinished(success); +} + +void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) +{ + q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll)); +} + +void QGraphicsWebViewPrivate::update(const QRect & dirtyRect) +{ + q->update(QRectF(dirtyRect)); +} + +#ifndef QT_NO_CURSOR +QCursor QGraphicsWebViewPrivate::cursor() const +{ + return q->cursor(); +} + +void QGraphicsWebViewPrivate::updateCursor(const QCursor& cursor) +{ + q->setCursor(cursor); +} +#endif + +int QGraphicsWebViewPrivate::screenNumber() const +{ +#if defined(Q_WS_X11) + const QList<QGraphicsView*> views = q->scene()->views(); + + if (!views.isEmpty()) + return views.at(0)->x11Info().screen(); +#endif + + return 0; +} + +WId QGraphicsWebViewPrivate::winId() const +{ + const QList<QGraphicsView*> views = q->scene()->views(); + + if (!views.isEmpty()) + return views.at(0)->winId(); + + return 0; +} + +QObject* QGraphicsWebViewPrivate::pluginParent() const +{ + return q; +} + +void QGraphicsWebViewPrivate::_q_setStatusBarMessage(const QString& s) +{ + statusBarMessage = s; + emit q->statusChanged(); +} + +/*! + \class QGraphicsWebView + \brief The QGraphicsWebView class allows web content to be added to a GraphicsView. + \since 4.6 + + A WebGraphicsItem renders web content based on a URL or set data. + + If the width and height of the item is not set, they will + dynamically adjust to a size appropriate for the content. + This width may be large (eg. 980) for typical online web pages. +*/ + +/*! + Constructs an empty QGraphicsWebView with parent \a parent. + + \sa load() +*/ +QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) + : QGraphicsWidget(parent) + , d(new QGraphicsWebViewPrivate(this)) +{ +#if QT_VERSION >= 0x040600 + setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true); +#endif + setAcceptHoverEvents(true); + setFocusPolicy(Qt::StrongFocus); +} + +/*! + Destroys the web graphicsitem. +*/ +QGraphicsWebView::~QGraphicsWebView() +{ + if (d->page) + d->page->d->view = 0; + + if (d->page && d->page->parent() == this) + delete d->page; + + delete d; +} + +/*! + Returns a pointer to the underlying web page. + + \sa setPage() +*/ +QWebPage* QGraphicsWebView::page() const +{ + if (!d->page) { + QGraphicsWebView* that = const_cast<QGraphicsWebView*>(this); + QWebPage* page = new QWebPage(that); + + // Default to not having a background, in the case + // the page doesn't provide one. + QPalette palette = QApplication::palette(); + palette.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0)); + page->setPalette(palette); + + that->setPage(page); + } + + return d->page; +} + +/*! \reimp +*/ +void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*) +{ + page()->mainFrame()->render(painter, option->exposedRect.toRect()); +} + +/*! \reimp +*/ +bool QGraphicsWebView::sceneEvent(QEvent* event) +{ + // Re-implemented in order to allows fixing event-related bugs in patch releases. + return QGraphicsWidget::sceneEvent(event); +} + +/*! \reimp +*/ +bool QGraphicsWebView::event(QEvent* event) +{ + // Re-implemented in order to allows fixing event-related bugs in patch releases. + + if (d->page) { +#ifndef QT_NO_CURSOR +#if QT_VERSION >= 0x040400 + } else if (event->type() == QEvent::CursorChange) { + // An unsetCursor will set the cursor to Qt::ArrowCursor. + // Thus this cursor change might be a QWidget::unsetCursor() + // If this is not the case and it came from WebCore, the + // QWebPageClient already has set its cursor internally + // to Qt::ArrowCursor, so updating the cursor is always + // right, as it falls back to the last cursor set by + // WebCore. + // FIXME: Add a QEvent::CursorUnset or similar to Qt. + if (cursor().shape() == Qt::ArrowCursor) + d->resetCursor(); +#endif +#endif + } + return QGraphicsWidget::event(event); +} + +/*! + Makes \a page the new web page of the web graphicsitem. + + The parent QObject of the provided page remains the owner + of the object. If the current document is a child of the web + view, it will be deleted. + + \sa page() +*/ +void QGraphicsWebView::setPage(QWebPage* page) +{ + if (d->page == page) + return; + + if (d->page) { + d->page->d->client = 0; // unset the page client + if (d->page->parent() == this) + delete d->page; + else + d->page->disconnect(this); + } + + d->page = page; + if (!d->page) + return; + d->page->d->client = d; // set the page client + + QSize size = geometry().size().toSize(); + page->setViewportSize(size); + + QWebFrame* mainFrame = d->page->mainFrame(); + + connect(mainFrame, SIGNAL(titleChanged(const QString&)), + this, SIGNAL(titleChanged(const QString&))); + connect(mainFrame, SIGNAL(iconChanged()), + this, SIGNAL(iconChanged())); + connect(mainFrame, SIGNAL(urlChanged(const QUrl&)), + this, SIGNAL(urlChanged(const QUrl&))); + connect(d->page, SIGNAL(loadStarted()), + this, SIGNAL(loadStarted())); + connect(d->page, SIGNAL(loadProgress(int)), + this, SLOT(_q_doLoadProgress(int))); + connect(d->page, SIGNAL(loadFinished(bool)), + this, SLOT(_q_doLoadFinished(bool))); + connect(d->page, SIGNAL(statusBarMessage(const QString&)), + this, SLOT(_q_setStatusBarMessage(const QString&))); +} + +/*! + \property QGraphicsWebView::url + \brief the url of the web page currently viewed + + Setting this property clears the view and loads the URL. + + By default, this property contains an empty, invalid URL. + + \sa load(), urlChanged() +*/ + +void QGraphicsWebView::setUrl(const QUrl &url) +{ + page()->mainFrame()->setUrl(url); +} + +QUrl QGraphicsWebView::url() const +{ + if (d->page) + return d->page->mainFrame()->url(); + + return QUrl(); +} + +/*! + \property QGraphicsWebView::title + \brief the title of the web page currently viewed + + By default, this property contains an empty string. + + \sa titleChanged() +*/ +QString QGraphicsWebView::title() const +{ + if (d->page) + return d->page->mainFrame()->title(); + + return QString(); +} + +/*! + \property QGraphicsWebView::icon + \brief the icon associated with the web page currently viewed + + By default, this property contains a null icon. + + \sa iconChanged(), QWebSettings::iconForUrl() +*/ +QIcon QGraphicsWebView::icon() const +{ + if (d->page) + return d->page->mainFrame()->icon(); + + return QIcon(); +} + +/*! + \property QGraphicsWebView::zoomFactor + \since 4.5 + \brief the zoom factor for the view +*/ + +void QGraphicsWebView::setZoomFactor(qreal factor) +{ + if (factor == page()->mainFrame()->zoomFactor()) + return; + + page()->mainFrame()->setZoomFactor(factor); + emit zoomFactorChanged(); +} + +qreal QGraphicsWebView::zoomFactor() const +{ + return page()->mainFrame()->zoomFactor(); +} + +/*! \reimp +*/ +void QGraphicsWebView::updateGeometry() +{ + QGraphicsWidget::updateGeometry(); + + if (!d->page) + return; + + QSize size = geometry().size().toSize(); + d->page->setViewportSize(size); +} + +/*! \reimp +*/ +void QGraphicsWebView::setGeometry(const QRectF& rect) +{ + QGraphicsWidget::setGeometry(rect); + + if (!d->page) + return; + + // NOTE: call geometry() as setGeometry ensures that + // the geometry is within legal bounds (minimumSize, maximumSize) + QSize size = geometry().size().toSize(); + d->page->setViewportSize(size); +} + +/*! + \property QGraphicsWebView::status + \brief the load status message. + + Provides the latest status message set during the load of a URL. + Commonly shown by Status Bar widgets. + + \sa statusChanged() +*/ + +QString QGraphicsWebView::status() const +{ + return d->statusBarMessage; +} + +/*! + Convenience slot that stops loading the document. + + \sa reload(), loadFinished() +*/ +void QGraphicsWebView::stop() +{ + if (d->page) + d->page->triggerAction(QWebPage::Stop); +} + +/*! + Convenience slot that loads the previous document in the list of documents + built by navigating links. Does nothing if there is no previous document. + + \sa forward() +*/ +void QGraphicsWebView::back() +{ + if (d->page) + d->page->triggerAction(QWebPage::Back); +} + +/*! + Convenience slot that loads the next document in the list of documents + built by navigating links. Does nothing if there is no next document. + + \sa back() +*/ +void QGraphicsWebView::forward() +{ + if (d->page) + d->page->triggerAction(QWebPage::Forward); +} + +/*! + Reloads the current document. + + \sa stop(), loadStarted() +*/ +void QGraphicsWebView::reload() +{ + if (d->page) + d->page->triggerAction(QWebPage::Reload); +} + +/*! + \property QGraphicsWebView::progress + \brief the progress of loading the current URL, from 0 to 1. +*/ +qreal QGraphicsWebView::progress() const +{ + return d->progress; +} + +/*! + Loads the specified \a url and displays it. + + \note The view remains the same until enough data has arrived to display the new \a url. + + \sa setUrl(), url(), urlChanged() +*/ +void QGraphicsWebView::load(const QUrl& url) +{ + page()->mainFrame()->load(url); +} + +/*! + \fn void QGraphicsWebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &body) + + Loads a network request, \a request, using the method specified in \a operation. + + \a body is optional and is only used for POST operations. + + \note The view remains the same until enough data has arrived to display the new url. + + \sa url(), urlChanged() +*/ + +void QGraphicsWebView::load(const QNetworkRequest& request, + QNetworkAccessManager::Operation operation, + const QByteArray& body) +{ + page()->mainFrame()->load(request, operation, body); +} + +/*! + \property QGraphicsWebView::html + This property provides an HTML interface to the text in the webview. + + When setting this property, external objects such as stylesheets or images + referenced in the HTML document are located relative to \a baseUrl. + + The \a html is loaded immediately; external objects are loaded asynchronously. + + When using these methods, WebKit assumes that external resources such as + JavaScript programs or style sheets are encoded in UTF-8 unless otherwise + specified. For example, the encoding of an external script can be specified + through the charset attribute of the HTML script tag. Alternatively, the + encoding can also be specified by the web server. + + \sa load(), setContent(), QWebFrame::toHtml() +*/ +void QGraphicsWebView::setHtml(const QString& html, const QUrl& baseUrl) +{ + page()->mainFrame()->setHtml(html, baseUrl); +} + +QString QGraphicsWebView::toHtml() const +{ + return page()->mainFrame()->toHtml(); +} + +/*! + Sets the content of the web graphicsitem to the specified content \a data. If the \a mimeType argument + is empty it is currently assumed that the content is HTML but in future versions we may introduce + auto-detection. + + External objects referenced in the content are located relative to \a baseUrl. + + The \a data is loaded immediately; external objects are loaded asynchronously. + + \sa load(), setHtml(), QWebFrame::toHtml() +*/ +void QGraphicsWebView::setContent(const QByteArray& data, const QString& mimeType, const QUrl& baseUrl) +{ + page()->mainFrame()->setContent(data, mimeType, baseUrl); +} + +/*! + Returns a pointer to the view's history of navigated web pages. + + It is equivalent to + + \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 0 +*/ +QWebHistory* QGraphicsWebView::history() const +{ + return page()->history(); +} + +/*! + \property QGraphicsWebView::interactive + \brief controls whether the item responds to mouse and key events. +*/ + +bool QGraphicsWebView::isInteractive() const +{ + return d->interactive; +} + +void QGraphicsWebView::setInteractive(bool allowed) +{ + if (d->interactive == allowed) + return; + + d->interactive = allowed; + emit interactivityChanged(); +} + +/*! + Returns a pointer to the view/page specific settings object. + + It is equivalent to + + \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 1 + + \sa QWebSettings::globalSettings() +*/ +QWebSettings* QGraphicsWebView::settings() const +{ + return page()->settings(); +} + +/*! \reimp +*/ +void QGraphicsWebView::hoverMoveEvent(QGraphicsSceneHoverEvent* ev) +{ + if (d->interactive && d->page) { + const bool accepted = ev->isAccepted(); + QMouseEvent me = QMouseEvent(QEvent::MouseMove, + ev->pos().toPoint(), Qt::NoButton, + Qt::NoButton, Qt::NoModifier); + d->page->setView(ev->widget()); + d->page->event(&me); + ev->setAccepted(accepted); + } + + if (!ev->isAccepted()) + QGraphicsItem::hoverMoveEvent(ev); +} + +/*! \reimp +*/ +void QGraphicsWebView::hoverLeaveEvent(QGraphicsSceneHoverEvent* ev) +{ + Q_UNUSED(ev); +} + +/*! \reimp +*/ +void QGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* ev) +{ + if (d->interactive && d->page) { + const bool accepted = ev->isAccepted(); + d->page->event(ev); + ev->setAccepted(accepted); + } + + if (!ev->isAccepted()) + QGraphicsItem::mouseMoveEvent(ev); +} + +/*! \reimp +*/ +void QGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent* ev) +{ + if (d->interactive && d->page) { + const bool accepted = ev->isAccepted(); + d->page->event(ev); + ev->setAccepted(accepted); + } + + if (!ev->isAccepted()) + QGraphicsItem::mousePressEvent(ev); +} + +/*! \reimp +*/ +void QGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) +{ + if (d->interactive && d->page) { + const bool accepted = ev->isAccepted(); + d->page->event(ev); + ev->setAccepted(accepted); + } + + if (!ev->isAccepted()) + QGraphicsItem::mouseReleaseEvent(ev); +} + +/*! \reimp +*/ +void QGraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev) +{ + if (d->interactive && d->page) { + const bool accepted = ev->isAccepted(); + d->page->event(ev); + ev->setAccepted(accepted); + } + + if (!ev->isAccepted()) + QGraphicsItem::mouseDoubleClickEvent(ev); +} + +/*! \reimp +*/ +void QGraphicsWebView::keyPressEvent(QKeyEvent* ev) +{ + if (d->interactive && d->page) + d->page->event(ev); + + if (!ev->isAccepted()) + QGraphicsItem::keyPressEvent(ev); +} + +/*! \reimp +*/ +void QGraphicsWebView::keyReleaseEvent(QKeyEvent* ev) +{ + if (d->interactive && d->page) + d->page->event(ev); + + if (!ev->isAccepted()) + QGraphicsItem::keyReleaseEvent(ev); +} + +/*! \reimp +*/ +void QGraphicsWebView::focusInEvent(QFocusEvent* ev) +{ + if (d->page) + d->page->event(ev); + else + QGraphicsItem::focusInEvent(ev); +} + +/*! \reimp +*/ +void QGraphicsWebView::focusOutEvent(QFocusEvent* ev) +{ + if (d->page) + d->page->event(ev); + else + QGraphicsItem::focusOutEvent(ev); +} + +/*! \reimp +*/ +bool QGraphicsWebView::focusNextPrevChild(bool next) +{ + if (d->page) + return d->page->focusNextPrevChild(next); + + return QGraphicsWidget::focusNextPrevChild(next); +} + +/*! \reimp +*/ +void QGraphicsWebView::dragEnterEvent(QGraphicsSceneDragDropEvent* ev) +{ +#ifndef QT_NO_DRAGANDDROP + //if (d->page) + // d->page->event(ev); + //Just remove this line below when the code above is working + Q_UNUSED(ev); +#else + Q_UNUSED(ev); +#endif +} + +/*! \reimp +*/ +void QGraphicsWebView::dragLeaveEvent(QGraphicsSceneDragDropEvent* ev) +{ +#ifndef QT_NO_DRAGANDDROP + if (d->interactive && d->page) { + const bool accepted = ev->isAccepted(); + d->page->event(ev); + ev->setAccepted(accepted); + } + + if (!ev->isAccepted()) + QGraphicsWidget::dragLeaveEvent(ev); +#else + Q_UNUSED(ev); +#endif +} + +/*! \reimp +*/ +void QGraphicsWebView::dragMoveEvent(QGraphicsSceneDragDropEvent* ev) +{ +#ifndef QT_NO_DRAGANDDROP + if (d->interactive && d->page) { + const bool accepted = ev->isAccepted(); + d->page->event(ev); + ev->setAccepted(accepted); + } + + if (!ev->isAccepted()) + QGraphicsWidget::dragMoveEvent(ev); +#else + Q_UNUSED(ev); +#endif +} + +/*! \reimp +*/ +void QGraphicsWebView::dropEvent(QGraphicsSceneDragDropEvent* ev) +{ +#ifndef QT_NO_DRAGANDDROP + if (d->interactive && d->page) { + const bool accepted = ev->isAccepted(); + d->page->event(ev); + ev->setAccepted(accepted); + } + + if (!ev->isAccepted()) + QGraphicsWidget::dropEvent(ev); +#else + Q_UNUSED(ev); +#endif +} + +#ifndef QT_NO_CONTEXTMENU +/*! \reimp +*/ +void QGraphicsWebView::contextMenuEvent(QGraphicsSceneContextMenuEvent* ev) +{ + if (d->page) { + const bool accepted = ev->isAccepted(); + d->page->event(ev); + ev->setAccepted(accepted); + } +} +#endif // QT_NO_CONTEXTMENU + +#ifndef QT_NO_WHEELEVENT +/*! \reimp +*/ +void QGraphicsWebView::wheelEvent(QGraphicsSceneWheelEvent* ev) +{ + if (d->interactive && d->page) { + const bool accepted = ev->isAccepted(); + d->page->event(ev); + ev->setAccepted(accepted); + } + + if (!ev->isAccepted()) + QGraphicsItem::wheelEvent(ev); +} +#endif // QT_NO_WHEELEVENT + +/*! \reimp +*/ +void QGraphicsWebView::inputMethodEvent(QInputMethodEvent* ev) +{ + if (d->interactive && d->page) + d->page->event(ev); + + if (!ev->isAccepted()) + QGraphicsItem::inputMethodEvent(ev); +} + +#include "moc_qgraphicswebview.cpp" diff --git a/WebKit/qt/Api/qgraphicswebview.h b/WebKit/qt/Api/qgraphicswebview.h new file mode 100644 index 0000000..26f7374 --- /dev/null +++ b/WebKit/qt/Api/qgraphicswebview.h @@ -0,0 +1,143 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QGraphicsWebView_h +#define QGraphicsWebView_h + +#include "qwebkitglobal.h" +#include <QtCore/qurl.h> +#include <QtGui/qevent.h> +#include <QtGui/qgraphicswidget.h> +#include <QtGui/qicon.h> +#include <QtGui/qpainter.h> +#include <QtNetwork/qnetworkaccessmanager.h> + +class QWebPage; +class QWebHistory; +class QWebSettings; + +class QGraphicsWebViewPrivate; + +class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget { + Q_OBJECT + + Q_PROPERTY(QString title READ title NOTIFY titleChanged) + Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged) + Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) + Q_PROPERTY(QString status READ status NOTIFY statusChanged) + + Q_PROPERTY(QString html READ toHtml WRITE setHtml) + Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) + Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) + + Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactivityChanged) + +public: + QGraphicsWebView(QGraphicsItem* parent = 0); + ~QGraphicsWebView(); + + QWebPage* page() const; + void setPage(QWebPage*); + + QUrl url() const; + void setUrl(const QUrl&); + + QString title() const; + QIcon icon() const; + + qreal zoomFactor() const; + void setZoomFactor(qreal); + + bool isInteractive() const; + void setInteractive(bool); + + qreal progress() const; + + void load(const QUrl &url); + void load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray& body = QByteArray()); + + QString toHtml() const; + void setHtml(const QString& html, const QUrl& baseUrl = QUrl()); + // FIXME: Consider rename to setHtml? + void setContent(const QByteArray& data, const QString& mimeType = QString(), const QUrl& baseUrl = QUrl()); + + QWebHistory* history() const; + QWebSettings* settings() const; + + QString status() const; + + virtual void setGeometry(const QRectF& rect); + virtual void updateGeometry(); + virtual void paint(QPainter*, const QStyleOptionGraphicsItem* options, QWidget* widget = 0); + virtual bool event(QEvent*); + +public Q_SLOTS: + void stop(); + void back(); + void forward(); + void reload(); + +Q_SIGNALS: + void loadStarted(); + void loadFinished(bool); + + void progressChanged(qreal); + void interactivityChanged(); + void urlChanged(const QUrl&); + void titleChanged(const QString&); + void iconChanged(); + void statusChanged(); + void zoomFactorChanged(); + +protected: + virtual void mousePressEvent(QGraphicsSceneMouseEvent*); + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent*); + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent*); +#ifndef QT_NO_WHEELEVENT + virtual void wheelEvent(QGraphicsSceneWheelEvent*); +#endif + virtual void keyPressEvent(QKeyEvent*); + virtual void keyReleaseEvent(QKeyEvent*); +#ifndef QT_NO_CONTEXTMENU + virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*); +#endif + virtual void dragEnterEvent(QGraphicsSceneDragDropEvent*); + virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent*); + virtual void dragMoveEvent(QGraphicsSceneDragDropEvent*); + virtual void dropEvent(QGraphicsSceneDragDropEvent*); + virtual void focusInEvent(QFocusEvent*); + virtual void focusOutEvent(QFocusEvent*); + virtual void inputMethodEvent(QInputMethodEvent*); + virtual bool focusNextPrevChild(bool next); + + virtual bool sceneEvent(QEvent*); + +private: + Q_PRIVATE_SLOT(d, void _q_doLoadProgress(int progress)) + Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success)) + Q_PRIVATE_SLOT(d, void _q_setStatusBarMessage(const QString& message)) + + QGraphicsWebViewPrivate* const d; + friend class QGraphicsWebViewPrivate; +}; + +#endif // QGraphicsWebView_h diff --git a/WebKit/qt/Api/qwebdatabase.cpp b/WebKit/qt/Api/qwebdatabase.cpp index d51e4e6..4e8fd30 100644 --- a/WebKit/qt/Api/qwebdatabase.cpp +++ b/WebKit/qt/Api/qwebdatabase.cpp @@ -33,6 +33,8 @@ using namespace WebCore; \since 4.5 \brief The QWebDatabase class provides access to HTML 5 databases created with JavaScript. + \inmodule QtWebKit + The upcoming HTML 5 standard includes support for SQL databases that web sites can create and access on a local computer through JavaScript. QWebDatabase is the C++ interface to these databases. diff --git a/WebKit/qt/Api/qwebelement.cpp b/WebKit/qt/Api/qwebelement.cpp index 14b2811..939d881 100644 --- a/WebKit/qt/Api/qwebelement.cpp +++ b/WebKit/qt/Api/qwebelement.cpp @@ -23,8 +23,8 @@ #include "CSSComputedStyleDeclaration.h" #include "CSSMutableStyleDeclaration.h" #include "CSSParser.h" -#include "CSSRuleList.h" #include "CSSRule.h" +#include "CSSRuleList.h" #include "CSSStyleRule.h" #include "CString.h" #include "Document.h" @@ -42,6 +42,7 @@ #include "qwebframe.h" #include "qwebframe_p.h" #include "runtime_root.h" +#include <parser/SourceCode.h> #include <wtf/Vector.h> using namespace WebCore; @@ -53,45 +54,47 @@ public: /*! \class QWebElement \since 4.6 - \brief The QWebElement class provides convenient access to DOM elements in a QWebFrame. + \brief The QWebElement class provides convenient access to DOM elements in + a QWebFrame. + \inmodule QtWebKit - QWebElement is the main class to easily access to the document model. - The document model is represented by a tree-like structure of DOM elements. - The root of the tree is called the document element and can be accessed using QWebFrame::documentElement(). + A QWebElement object allows easy access to the document model, represented + by a tree-like structure of DOM elements. The root of the tree is called + the document element and can be accessed using + QWebFrame::documentElement(). - You can reach specific elements using findAll() and findFirst(); the elements - are identified through CSS selectors. + Specific elements can be accessed using findAll() and findFirst(). These + elements are identified using CSS selectors. The code snippet below + demonstrates the use of findAll(). \snippet webkitsnippets/webelement/main.cpp FindAll - The first list contains all \c span elements in the document. The second list contains - \c span elements that are children of \c p, classified with \c intro. + The first list contains all \c span elements in the document. The second + list contains \c span elements that are children of \c p, classified with + \c intro. - Using findFirst() is more efficient than calling findAll() and extracting the first element - only in the returned list. + Using findFirst() is more efficient than calling findAll(), and extracting + the first element only in the list returned. - Alternatively you can manually traverse the document using firstChild() and nextSibling(): + Alternatively you can traverse the document manually using firstChild() and + nextSibling(): \snippet webkitsnippets/webelement/main.cpp Traversing with QWebElement - The underlying content of QWebElement is explicitly shared. Creating a copy of a QWebElement - does not create a copy of the content. Instead, both instances point to the same element. - - The element's attributes can be read using attribute() and modified with setAttribute(). - - The contents of child elements can be converted to plain text with toPlainText() and to - XHTML using toInnerXml(). To also include the element's tag in the output, use toOuterXml(). + The underlying content of QWebElement is explicitly shared. Creating a copy + of a QWebElement does not create a copy of the content. Instead, both + instances point to the same element. - It is possible to replace the contents using setPlainText() and setInnerXml(). To replace - the element itself and its contents, use setOuterXml(). + The element's attributes can be read using attribute() and modified with + setAttribute(). - In the JavaScript DOM interfaces, elements can have additional functions depending on their - type. For example an HTML form element can be triggered to submit the entire form to the - web server using the submit() function. A list of these special functions can be obtained - in QWebElement using functions(); they can be invoked using callFunction(). + The contents of child elements can be converted to plain text with + toPlainText(); to XHTML using toInnerXml(). To include the element's tag in + the output, use toOuterXml(). - Similarly element specific properties can be obtained using scriptableProperties() and - read/written using scriptableProperty()/setScriptableProperty(). + It is possible to replace the contents of child elements using + setPlainText() and setInnerXml(). To replace the element itself and its + contents, use setOuterXml(). */ /*! @@ -156,7 +159,7 @@ QWebElement &QWebElement::operator=(const QWebElement &other) } /*! - Destroys the element. The underlying DOM element is not destroyed. + Destroys the element. However, the underlying DOM element is not destroyed. */ QWebElement::~QWebElement() { @@ -176,7 +179,7 @@ bool QWebElement::operator!=(const QWebElement& o) const } /*! - Returns true if the element is a null element; false otherwise. + Returns true if the element is a null element; otherwise returns false. */ bool QWebElement::isNull() const { @@ -184,13 +187,16 @@ bool QWebElement::isNull() const } /*! - Returns a new list of child elements matching the given CSS selector \a selectorQuery. - If there are no matching elements, an empty list is returned. + Returns a new list of child elements matching the given CSS selector + \a selectorQuery. If there are no matching elements, an empty list is + returned. - \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} syntax is - used for the query. + \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} + syntax is used for the query. \note This search is performed recursively. + + \sa findFirst() */ QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const { @@ -203,7 +209,7 @@ QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const if (!nodes) return elements; - for (int i = 0; i < nodes->length(); ++i) { + for (unsigned i = 0; i < nodes->length(); ++i) { WebCore::Node* n = nodes->item(i); elements.append(QWebElement(static_cast<Element*>(n))); } @@ -212,12 +218,15 @@ QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const } /*! - Returns the first child element that matches the given CSS selector \a selectorQuery. + Returns the first child element that matches the given CSS selector + \a selectorQuery. - \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} syntax is - used for the query. + \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} + syntax is used for the query. \note This search is performed recursively. + + \sa findAll() */ QWebElement QWebElement::findFirst(const QString &selectorQuery) const { @@ -231,6 +240,8 @@ QWebElement QWebElement::findFirst(const QString &selectorQuery) const Replaces the existing content of this element with \a text. This is equivalent to setting the HTML innerText property. + + \sa toPlainText() */ void QWebElement::setPlainText(const QString &text) { @@ -245,6 +256,8 @@ void QWebElement::setPlainText(const QString &text) element. This is equivalent to reading the HTML innerText property. + + \sa setPlainText() */ QString QWebElement::toPlainText() const { @@ -254,11 +267,13 @@ QString QWebElement::toPlainText() const } /*! - Replaces the contents of this element as well as its own tag with \a markup. - The string may contain HTML or XML tags, which is parsed and formatted - before insertion into the document. + Replaces the contents of this element as well as its own tag with + \a markup. The string may contain HTML or XML tags, which is parsed and + formatted before insertion into the document. \note This is currently only implemented for (X)HTML elements. + + \sa toOuterXml(), toInnerXml(), setInnerXml() */ void QWebElement::setOuterXml(const QString &markup) { @@ -272,9 +287,11 @@ void QWebElement::setOuterXml(const QString &markup) /*! Returns this element converted to XML, including the start and the end - tag of this element and its attributes. + tags as well as its attributes. - \note This is currently only implemented for (X)HTML elements. + \note This is currently implemented for (X)HTML elements only. + + \sa setOuterXml(), setInnerXml(), toInnerXml() */ QString QWebElement::toOuterXml() const { @@ -285,11 +302,13 @@ QString QWebElement::toOuterXml() const } /*! - Replaces the content of this element with \a markup. - The string may contain HTML or XML tags, which is parsed and formatted - before insertion into the document. + Replaces the contents of this element with \a markup. The string may + contain HTML or XML tags, which is parsed and formatted before insertion + into the document. - \note This is currently only implemented for (X)HTML elements. + \note This is currently implemented for (X)HTML elements only. + + \sa toInnerXml(), toOuterXml(), setOuterXml() */ void QWebElement::setInnerXml(const QString &markup) { @@ -302,10 +321,11 @@ void QWebElement::setInnerXml(const QString &markup) } /*! - Returns the XML between the start and the end tag of this - element. + Returns the XML content between the element's start and end tags. - \note This is currently only implemented for (X)HTML elements. + \note This is currently implemented for (X)HTML elements only. + + \sa setInnerXml(), setOuterXml(), toOuterXml() */ QString QWebElement::toInnerXml() const { @@ -316,8 +336,10 @@ QString QWebElement::toInnerXml() const } /*! - Adds an attribute called \a name with the value \a value. If an attribute - with the same name exists, its value is replaced by \a value. + Adds an attribute with the given \a name and \a value. If an attribute with + the same name exists, its value is replaced by \a value. + + \sa attribute(), attributeNS(), setAttributeNS() */ void QWebElement::setAttribute(const QString &name, const QString &value) { @@ -328,9 +350,11 @@ void QWebElement::setAttribute(const QString &name, const QString &value) } /*! - Adds an attribute called \a name in the namespace described with \a namespaceUri - with the value \a value. If an attribute with the same name exists, its value is - replaced by \a value. + Adds an attribute with the given \a name in \a namespaceUri with \a value. + If an attribute with the same name exists, its value is replaced by + \a value. + + \sa attributeNS(), attribute(), setAttribute() */ void QWebElement::setAttributeNS(const QString &namespaceUri, const QString &name, const QString &value) { @@ -341,8 +365,10 @@ void QWebElement::setAttributeNS(const QString &namespaceUri, const QString &nam } /*! - Returns the attributed called \a name. If the attribute does not exist \a defaultValue is - returned. + Returns the attribute with the given \a name. If the attribute does not + exist, \a defaultValue is returned. + + \sa setAttribute(), setAttributeNS(), attributeNS() */ QString QWebElement::attribute(const QString &name, const QString &defaultValue) const { @@ -355,8 +381,10 @@ QString QWebElement::attribute(const QString &name, const QString &defaultValue) } /*! - Returns the attributed called \a name in the namespace described with \a namespaceUri. - If the attribute does not exist \a defaultValue is returned. + Returns the attribute with the given \a name in \a namespaceUri. If the + attribute does not exist, \a defaultValue is returned. + + \sa setAttributeNS(), setAttribute(), attribute() */ QString QWebElement::attributeNS(const QString &namespaceUri, const QString &name, const QString &defaultValue) const { @@ -369,7 +397,10 @@ QString QWebElement::attributeNS(const QString &namespaceUri, const QString &nam } /*! - Returns true if this element has an attribute called \a name; otherwise returns false. + Returns true if this element has an attribute with the given \a name; + otherwise returns false. + + \sa attribute(), setAttribute() */ bool QWebElement::hasAttribute(const QString &name) const { @@ -379,8 +410,10 @@ bool QWebElement::hasAttribute(const QString &name) const } /*! - Returns true if this element has an attribute called \a name in the namespace described - with \a namespaceUri; otherwise returns false. + Returns true if this element has an attribute with the given \a name, in + \a namespaceUri; otherwise returns false. + + \sa attributeNS(), setAttributeNS() */ bool QWebElement::hasAttributeNS(const QString &namespaceUri, const QString &name) const { @@ -390,7 +423,9 @@ bool QWebElement::hasAttributeNS(const QString &namespaceUri, const QString &nam } /*! - Removes the attribute called \a name from this element. + Removes the attribute with the given \a name from this element. + + \sa attribute(), setAttribute(), hasAttribute() */ void QWebElement::removeAttribute(const QString &name) { @@ -401,8 +436,10 @@ void QWebElement::removeAttribute(const QString &name) } /*! - Removes the attribute called \a name in the namespace described with \a namespaceUri - from this element. + Removes the attribute with the given \a name, in \a namespaceUri, from this + element. + + \sa attributeNS(), setAttributeNS(), hasAttributeNS() */ void QWebElement::removeAttributeNS(const QString &namespaceUri, const QString &name) { @@ -413,7 +450,10 @@ void QWebElement::removeAttributeNS(const QString &namespaceUri, const QString & } /*! - Returns true if the element has any attributes defined; otherwise returns false; + Returns true if the element has any attributes defined; otherwise returns + false; + + \sa attribute(), setAttribute() */ bool QWebElement::hasAttributes() const { @@ -423,7 +463,36 @@ bool QWebElement::hasAttributes() const } /*! + Returns true if the element has keyboard input focus; otherwise, returns false + + \sa setFocus() +*/ +bool QWebElement::hasFocus() const +{ + if (!m_element) + return false; + if (m_element->document()) + return m_element == m_element->document()->focusedNode(); + return false; +} + +/*! + Gives keyboard input focus to this element + + \sa hasFocus() +*/ +void QWebElement::setFocus() +{ + if (!m_element) + return; + if (m_element->document() && m_element->isFocusable()) + m_element->document()->setFocusedNode(m_element); +} + +/*! Returns the geometry of this element, relative to its containing frame. + + \sa tagName() */ QRect QWebElement::geometry() const { @@ -434,6 +503,8 @@ QRect QWebElement::geometry() const /*! Returns the tag name of this element. + + \sa geometry() */ QString QWebElement::tagName() const { @@ -443,7 +514,8 @@ QString QWebElement::tagName() const } /*! - Returns the namespace prefix of the element or an empty string if the element has no namespace prefix. + Returns the namespace prefix of the element. If the element has no\ + namespace prefix, empty string is returned. */ QString QWebElement::prefix() const { @@ -453,8 +525,8 @@ QString QWebElement::prefix() const } /*! - If the element uses namespaces, this function returns the local name of the element; - otherwise it returns an empty string. + Returns the local name of the element. If the element does not use + namespaces, an empty string is returned. */ QString QWebElement::localName() const { @@ -464,7 +536,8 @@ QString QWebElement::localName() const } /*! - Returns the namespace URI of this element or an empty string if the element has no namespace URI. + Returns the namespace URI of this element. If the element has no namespace + URI, an empty string is returned. */ QString QWebElement::namespaceUri() const { @@ -474,8 +547,8 @@ QString QWebElement::namespaceUri() const } /*! - Returns the parent element of this element or a null element if this element - is the root document element. + Returns the parent element of this elemen. If this element is the root + document element, a null element is returned. */ QWebElement QWebElement::parent() const { @@ -485,9 +558,9 @@ QWebElement QWebElement::parent() const } /*! - Returns the first child element of this element. + Returns the element's first child. - \sa lastChild() previousSibling() nextSibling() + \sa lastChild(), previousSibling(), nextSibling() */ QWebElement QWebElement::firstChild() const { @@ -503,9 +576,9 @@ QWebElement QWebElement::firstChild() const } /*! - Returns the last child element of this element. + Returns the element's last child. - \sa firstChild() previousSibling() nextSibling() + \sa firstChild(), previousSibling(), nextSibling() */ QWebElement QWebElement::lastChild() const { @@ -521,9 +594,9 @@ QWebElement QWebElement::lastChild() const } /*! - Returns the next sibling element of this element. + Returns the element's next sibling. - \sa firstChild() previousSibling() lastChild() + \sa firstChild(), previousSibling(), lastChild() */ QWebElement QWebElement::nextSibling() const { @@ -539,9 +612,9 @@ QWebElement QWebElement::nextSibling() const } /*! - Returns the previous sibling element of this element. + Returns the element's previous sibling. - \sa firstChild() nextSibling() lastChild() + \sa firstChild(), nextSibling(), lastChild() */ QWebElement QWebElement::previousSibling() const { @@ -557,7 +630,7 @@ QWebElement QWebElement::previousSibling() const } /*! - Returns the document this element belongs to. + Returns the document which this element belongs to. */ QWebElement QWebElement::document() const { @@ -570,8 +643,8 @@ QWebElement QWebElement::document() const } /*! - Returns the web frame this elements is a part of. If the element is - a null element null is returned. + Returns the web frame which this element is a part of. If the element is a + null element, null is returned. */ QWebFrame *QWebElement::webFrame() const { @@ -617,41 +690,10 @@ static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValu } -static bool setupScriptObject(WebCore::Element* element, ScriptObject& object, ScriptState*& state, ScriptController*& scriptController) -{ - if (!element) - return false; - - Document* document = element->document(); - if (!document) - return false; - - Frame* frame = document->frame(); - if (!frame) - return false; - - scriptController = frame->script(); - - state = scriptController->globalObject()->globalExec(); - - JSC::JSValue thisValue = toJS(state, element); - if (!thisValue) - return false; - - JSC::JSObject* thisObject = thisValue.toObject(state); - if (!thisObject) - return false; - - object = ScriptObject(state, thisObject); - return true; -} - /*! - Executes the \a scriptSource with this element as the `this' object. - - \sa callFunction() + Executes \a scriptSource with this element as \c this object. */ -QVariant QWebElement::evaluateScript(const QString& scriptSource) +QVariant QWebElement::evaluateJavaScript(const QString& scriptSource) { if (scriptSource.isEmpty()) return QVariant(); @@ -678,263 +720,40 @@ QVariant QWebElement::evaluateScript(const QString& scriptSource) } /*! - Calls the function with the given \a name and \a arguments. - - The underlying DOM element that QWebElement wraps may have dedicated functions depending - on its type. For example a form element can have the "submit" function, that would submit - the form to the destination specified in the HTML. - - \sa functions() -*/ -QVariant QWebElement::callFunction(const QString &name, const QVariantList &arguments) -{ - ScriptState* state = 0; - ScriptObject thisObject; - ScriptController* scriptController = 0; - - if (!setupScriptObject(m_element, thisObject, state, scriptController)) - return QVariant(); - - ScriptFunctionCall functionCall(state, thisObject, name); - - for (QVariantList::ConstIterator it = arguments.constBegin(), end = arguments.constEnd(); - it != end; ++it) - functionCall.appendArgument(JSC::Bindings::convertQVariantToValue(state, scriptController->bindingRootObject(), *it)); - - bool hadException = false; - ScriptValue result = functionCall.call(hadException); - if (hadException) - return QVariant(); - - int distance = 0; - return JSC::Bindings::convertValueToQVariant(state, result.jsValue(), QMetaType::Void, &distance); -} - -/*! - Returns a list of function names this element supports. - - The function names returned are the same functions that are callable from the DOM - element's JavaScript binding. - - \sa callFunction() -*/ -QStringList QWebElement::functions() const -{ - ScriptState* state = 0; - ScriptObject thisObject; - ScriptController* scriptController = 0; - - if (!setupScriptObject(m_element, thisObject, state, scriptController)) - return QStringList(); - - JSC::JSObject* object = thisObject.jsObject(); - if (!object) - return QStringList(); - - QStringList names; - - // Enumerate the contents of the object - JSC::PropertyNameArray properties(state); - object->getPropertyNames(state, properties); - for (JSC::PropertyNameArray::const_iterator it = properties.begin(); - it != properties.end(); ++it) { - - JSC::JSValue property = object->get(state, *it); - if (!property) - continue; - - JSC::JSObject* function = property.toObject(state); - if (!function) - continue; - - JSC::CallData callData; - JSC::CallType callType = function->getCallData(callData); - if (callType == JSC::CallTypeNone) - continue; - - JSC::UString ustring = (*it).ustring(); - names << QString::fromUtf16((const ushort*)ustring.rep()->data(), ustring.size()); - } - - if (state->hadException()) - state->clearException(); - - return names; -} - -/*! - Returns the value of the element's \a name property. - - If no such property exists, the returned variant is invalid. - - The return property has the same value as the corresponding property - in the element's JavaScript binding with the same name. - - Information about all available properties is provided through scriptProperties(). - - \sa setScriptableProperty(), scriptableProperties() -*/ -QVariant QWebElement::scriptableProperty(const QString &name) const -{ - ScriptState* state = 0; - ScriptObject thisObject; - ScriptController *scriptController = 0; - - if (!setupScriptObject(m_element, thisObject, state, scriptController)) - return QVariant(); - - String wcName(name); - JSC::JSValue property = thisObject.jsObject()->get(state, JSC::Identifier(state, wcName)); - - // ### - if (state->hadException()) - state->clearException(); - - int distance = 0; - return JSC::Bindings::convertValueToQVariant(state, property, QMetaType::Void, &distance); -} - -/*! - Sets the value of the element's \a name property to \a value. - - Information about all available properties is provided through scriptProperties(). - - Setting the property will affect the corresponding property - in the element's JavaScript binding with the same name. - - \sa scriptableProperty(), scriptableProperties() -*/ -void QWebElement::setScriptableProperty(const QString &name, const QVariant &value) -{ - ScriptState* state = 0; - ScriptObject thisObject; - ScriptController* scriptController = 0; - - if (!setupScriptObject(m_element, thisObject, state, scriptController)) - return; - - JSC::JSValue jsValue = JSC::Bindings::convertQVariantToValue(state, scriptController->bindingRootObject(), value); - if (!jsValue) - return; - - String wcName(name); - JSC::PutPropertySlot slot; - thisObject.jsObject()->put(state, JSC::Identifier(state, wcName), jsValue, slot); - if (state->hadException()) - state->clearException(); -} - -/*! - Returns a list of property names this element supports. - - The function names returned are the same properties that are accessible from the DOM - element's JavaScript binding. - - \sa setScriptableProperty(), scriptableProperty() -*/ -QStringList QWebElement::scriptableProperties() const -{ - if (!m_element) - return QStringList(); - - Document* document = m_element->document(); - if (!document) - return QStringList(); - - Frame* frame = document->frame(); - if (!frame) - return QStringList(); - - ScriptController* script = frame->script(); - JSC::ExecState* exec = script->globalObject()->globalExec(); - - JSC::JSValue thisValue = toJS(exec, m_element); - if (!thisValue) - return QStringList(); - - JSC::JSObject* object = thisValue.toObject(exec); - if (!object) - return QStringList(); - - QStringList names; - - // Enumerate the contents of the object - JSC::PropertyNameArray properties(exec); - object->getPropertyNames(exec, properties); - for (JSC::PropertyNameArray::const_iterator it = properties.begin(); - it != properties.end(); ++it) { - - JSC::JSValue property = object->get(exec, *it); - if (!property) - continue; - - JSC::JSObject* function = property.toObject(exec); - if (!function) - continue; - - JSC::CallData callData; - JSC::CallType callType = function->getCallData(callData); - if (callType != JSC::CallTypeNone) - continue; - - JSC::UString ustring = (*it).ustring(); - names << QString::fromUtf16((const ushort*)ustring.rep()->data(), ustring.size()); - } - - if (exec->hadException()) - exec->clearException(); - - return names; -} - -/*! - \enum QWebElement::ResolveRule - \since 4.6 + \enum QWebElement::StyleResolveStrategy This enum describes how QWebElement's styleProperty resolves the given property name. - \value IgnoreCascadingStyles Return the property value as it is defined - in the element, without respecting style inheritance and other CSS rules. - \value RespectCascadingStyles The property's value is determined using - the inheritance and importance rules defined in the document's stylesheet. -*/ - -/*! - \enum QWebElement::StylePriority - \since 4.6 - - This enum describes the priority newly set CSS properties should have when - set using QWebElement::setStyleProperty(). - - \value NormalStylePriority Define the property without important - priority even if "!important" is explicitly set in \a value. - \value DeclaredStylePriority Define the property respecting the - priority specified in \a value. - \value ImportantStylePriority Define the property to have - an important priority, this is equal to appending "!important" to the value. + \value InlineStyle Return the property value as it is defined in + the element, without respecting style inheritance and other CSS + rules. + \value CascadedStyle The property's value is determined using the + inheritance and importance rules defined in the document's + stylesheet. + \value ComputedStyle The property's value is the absolute value + of the style property resolved from the environment. */ /*! - Returns the value of the style named \a name or an empty string if such one - does not exist. - - If \a rule is IgnoreCascadingStyles, the value defined inside the element - (inline in CSS terminology) is returned. + Returns the value of the style with the given \a name using the specified + \a strategy. If a style with \a name does not exist, an empty string is + returned. - if \a rule is RespectCascadingStyles, the actual style applied to the - element is returned. + In CSS, the cascading part depends on which CSS rule has priority and is + thus applied. Generally, the last defined rule has priority. Thus, an + inline style rule has priority over an embedded block style rule, which + in return has priority over an external style rule. - In CSS, the cascading part has to do with which CSS rule has priority and - is thus applied. Generally speaking, the last defined rule has priority, - thus an inline style rule has priority over an embedded block style rule, - which in return has priority over an external style rule. + If the "!important" declaration is set on one of those, the declaration + receives highest priority, unless other declarations also use the + "!important" declaration. Then, the last "!important" declaration takes + predecence. - If the !important declaration is set on one of those, the declaration gets - highest priority, unless other declarations also use the !important - declaration, in which the last !important declaration takes predecence. + \sa setStyleProperty() */ -QString QWebElement::styleProperty(const QString &name, ResolveRule rule) const + +QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy strategy) const { if (!m_element || !m_element->isStyledElement()) return QString(); @@ -946,10 +765,10 @@ QString QWebElement::styleProperty(const QString &name, ResolveRule rule) const CSSStyleDeclaration* style = static_cast<StyledElement*>(m_element)->style(); - if (rule == IgnoreCascadingStyles) + if (strategy == InlineStyle) return style->getPropertyValue(propID); - if (rule == RespectCascadingStyles) { + if (strategy == CascadedStyle) { if (style->getPropertyPriority(propID)) return style->getPropertyValue(propID); @@ -977,32 +796,33 @@ QString QWebElement::styleProperty(const QString &name, ResolveRule rule) const return style->getPropertyValue(propID); } + if (strategy == ComputedStyle) { + if (!m_element || !m_element->isStyledElement()) + return QString(); + + int propID = cssPropertyID(name); + + RefPtr<CSSComputedStyleDeclaration> style = computedStyle(m_element); + if (!propID || !style) + return QString(); + + return style->getPropertyValue(propID); + } + return QString(); } /*! - Sets the value of the style named \a name to \a value. + Sets the value of the inline style with the given \a name to \a value. - Setting a value, doesn't necessarily mean that it will become the applied + Setting a value, does not necessarily mean that it will become the applied value, due to the fact that the style property's value might have been set - earlier with priority in external or embedded style declarations. + earlier with a higher priority in external or embedded style declarations. - In order to ensure that the value will be applied, ImportantStylePriority - should be used as \a priority. - - Following the CSS syntax for property values, this is equal to appending + In order to ensure that the value will be applied, you may have to append "!important" to the value. - - This syntax is supported when using DeclaredStylePriority as \a priority. - - Using NormalStylePriority as \a priority, the property will have normal - priority, and any "!important" declaration will be ignored. On the other - hand, using ImportantStylePriority sets the important priority even when - not explicit passed in \a value. - By using DeclaredStylePriority as \a priority the property will respect the - priority specified in \a value. */ -void QWebElement::setStyleProperty(const QString &name, const QString &value, StylePriority priority) +void QWebElement::setStyleProperty(const QString &name, const QString &value) { if (!m_element || !m_element->isStyledElement()) return; @@ -1013,42 +833,7 @@ void QWebElement::setStyleProperty(const QString &name, const QString &value, St return; ExceptionCode exception = 0; - - const QRegExp hasImportantTest(QLatin1String("!\\s*important")); - int index = value.indexOf(hasImportantTest); - - QString newValue = (index != -1) ? value.left(index - 1) : value; - - switch (priority) { - case NormalStylePriority: - style->setProperty(name, newValue, "", exception); - break; - case DeclaredStylePriority: - style->setProperty(name, newValue, (index != -1) ? "important" : "", exception); - break; - case ImportantStylePriority: - style->setProperty(name, newValue, "important", exception); - break; - default: - break; - } -} - -/*! - Returns the computed value for style named \a name or an empty string if the style has no such name. -*/ -QString QWebElement::computedStyleProperty(const QString &name) const -{ - if (!m_element || !m_element->isStyledElement()) - return QString(); - - int propID = cssPropertyID(name); - - RefPtr<CSSComputedStyleDeclaration> style = computedStyle(m_element); - if (!propID || !style) - return QString(); - - return style->getPropertyValue(propID); + style->setProperty(name, value, exception); } /*! @@ -1083,7 +868,8 @@ QStringList QWebElement::classes() const } /*! - Returns true if this element has a class called \a name; otherwise returns false. + Returns true if this element has a class with the given \a name; otherwise + returns false. */ bool QWebElement::hasClass(const QString &name) const { @@ -1092,7 +878,7 @@ bool QWebElement::hasClass(const QString &name) const } /*! - Adds the specified class \a name to the element. + Adds the specified class with the given \a name to the element. */ void QWebElement::addClass(const QString &name) { @@ -1105,7 +891,7 @@ void QWebElement::addClass(const QString &name) } /*! - Removes the specified class \a name from the element. + Removes the specified class with the given \a name from the element. */ void QWebElement::removeClass(const QString &name) { @@ -1118,8 +904,8 @@ void QWebElement::removeClass(const QString &name) } /*! - Adds the specified class \a name if it is not present, - removes it if it is already present. + Adds the specified class with the given \a name if it is not present. If + the class is already present, it will be removed. */ void QWebElement::toggleClass(const QString &name) { @@ -1134,11 +920,11 @@ void QWebElement::toggleClass(const QString &name) } /*! - Appends \a element as the element's last child. + Appends the given \a element as the element's last child. - If \a element is the child of another element, it is re-parented - to this element. If \a element is a child of this element, then - its position in the list of children is changed. + If \a element is the child of another element, it is re-parented to this + element. If \a element is a child of this element, then its position in + the list of children is changed. Calling this function on a null element does nothing. @@ -1178,9 +964,9 @@ void QWebElement::appendInside(const QString &markup) /*! Prepends \a element as the element's first child. - If \a element is the child of another element, it is re-parented - to this element. If \a element is a child of this element, then - its position in the list of children is changed. + If \a element is the child of another element, it is re-parented to this + element. If \a element is a child of this element, then its position in + the list of children is changed. Calling this function on a null element does nothing. @@ -1227,10 +1013,10 @@ void QWebElement::prependInside(const QString &markup) /*! - Inserts \a element before this element. + Inserts the given \a element before this element. - If \a element is the child of another element, it is re-parented - to the parent of this element. + If \a element is the child of another element, it is re-parented to the + parent of this element. Calling this function on a null element does nothing. @@ -1274,10 +1060,10 @@ void QWebElement::prependOutside(const QString &markup) } /*! - Inserts \a element after this element. + Inserts the given \a element after this element. - If \a element is the child of another element, it is re-parented - to the parent of this element. + If \a element is the child of another element, it is re-parented to the + parent of this element. Calling this function on a null element does nothing. @@ -1342,11 +1128,10 @@ QWebElement QWebElement::clone() const } /*! - Removes this element from the document and returns a reference - to this. + Removes this element from the document and returns a reference to it. - The element is still valid after removal, and can be inserted into - other parts of the document. + The element is still valid after removal, and can be inserted into other + parts of the document. \sa removeChildren(), removeFromDocument() */ @@ -1362,8 +1147,7 @@ QWebElement &QWebElement::takeFromDocument() } /*! - Removes this element from the document and makes this - a null element. + Removes this element from the document and makes it a null element. \sa removeChildren(), takeFromDocument() */ @@ -1414,9 +1198,10 @@ static RefPtr<Node> findInsertionPoint(PassRefPtr<Node> root) } /*! - Enclose the contents of this element in \a element as the child - of the deepest descendant element within the structure of the - first element provided. + Encloses the contents of this element with \a element. This element becomes + the child of the deepest descendant within \a element. + + ### illustration \sa encloseWith() */ @@ -1446,9 +1231,8 @@ void QWebElement::encloseContentsWith(const QWebElement &element) } /*! - Enclose the contents of this element in the result of parsing - \a markup as the child of the deepest descendant element within - the structure of the first element provided. + Encloses the contents of this element with the result of parsing \a markup. + This element becomes the child of the deepest descendant within \a markup. \sa encloseWith() */ @@ -1490,9 +1274,8 @@ void QWebElement::encloseContentsWith(const QString &markup) } /*! - Enclose this element in \a element as the child of the deepest - descendant element within the structure of the first element - provided. + Encloses this element with \a element. This element becomes the child of + the deepest descendant within \a element. \sa replace() */ @@ -1523,8 +1306,8 @@ void QWebElement::encloseWith(const QWebElement &element) } /*! - Enclose this element in the result of parsing \a markup, - as the last child. + Encloses this element with the result of parsing \a markup. This element + becomes the child of the deepest descendant within \a markup. \sa replace() */ @@ -1569,8 +1352,7 @@ void QWebElement::encloseWith(const QString &markup) /*! Replaces this element with \a element. - It is not possible to replace the <html>, <head>, or <body> - elements using this method. + This method will not replace the <html>, <head> or <body> elements. \sa encloseWith() */ @@ -1586,8 +1368,7 @@ void QWebElement::replace(const QWebElement &element) /*! Replaces this element with the result of parsing \a markup. - It is not possible to replace the <html>, <head>, or <body> - elements using this method. + This method will not replace the <html>, <head> or <body> elements. \sa encloseWith() */ @@ -1601,13 +1382,32 @@ void QWebElement::replace(const QString &markup) } /*! + \internal + Walk \a node's parents until a valid QWebElement is found. + For example, a WebCore::Text node is not a valid Html QWebElement, but its + enclosing p tag is. +*/ +QWebElement QWebElement::enclosingElement(WebCore::Node* node) +{ + QWebElement element(node); + + while (element.isNull() && node) { + node = node->parentNode(); + element = QWebElement(node); + } + return element; +} + +/*! \fn inline bool QWebElement::operator==(const QWebElement& o) const; - Returns true if this element points to the same underlying DOM object than \a o; otherwise returns false. + Returns true if this element points to the same underlying DOM object as + \a o; otherwise returns false. */ /*! \fn inline bool QWebElement::operator!=(const QWebElement& o) const; - Returns true if this element points to a different underlying DOM object than \a o; otherwise returns false. + Returns true if this element points to a different underlying DOM object + than \a o; otherwise returns false. */ diff --git a/WebKit/qt/Api/qwebelement.h b/WebKit/qt/Api/qwebelement.h index bc6f8a9..3db4637 100644 --- a/WebKit/qt/Api/qwebelement.h +++ b/WebKit/qt/Api/qwebelement.h @@ -74,6 +74,9 @@ public: void removeClass(const QString& name); void toggleClass(const QString& name); + bool hasFocus() const; + void setFocus(); + QRect geometry() const; QString tagName() const; @@ -120,30 +123,26 @@ public: void removeFromDocument(); void removeChildren(); - QVariant evaluateScript(const QString& scriptSource); - - QVariant callFunction(const QString& functionName, const QVariantList& arguments = QVariantList()); - QStringList functions() const; - - QVariant scriptableProperty(const QString& name) const; - void setScriptableProperty(const QString& name, const QVariant& value); - QStringList scriptableProperties() const; + QVariant evaluateJavaScript(const QString& scriptSource); - enum ResolveRule { IgnoreCascadingStyles, RespectCascadingStyles }; - QString styleProperty(const QString& name, ResolveRule = IgnoreCascadingStyles) const; - - enum StylePriority { NormalStylePriority, DeclaredStylePriority, ImportantStylePriority }; - void setStyleProperty(const QString& name, const QString& value, StylePriority = DeclaredStylePriority); - - QString computedStyleProperty(const QString& name) const; + enum StyleResolveStrategy { + InlineStyle, + CascadedStyle, + ComputedStyle, + }; + QString styleProperty(const QString& name, StyleResolveStrategy strategy) const; + void setStyleProperty(const QString& name, const QString& value); private: explicit QWebElement(WebCore::Element*); explicit QWebElement(WebCore::Node*); + static QWebElement enclosingElement(WebCore::Node*); + friend class QWebFrame; friend class QWebHitTestResult; friend class QWebHitTestResultPrivate; + friend class QWebPage; QWebElementPrivate* d; WebCore::Element* m_element; diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index c857df2..1777cc8 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -268,6 +268,8 @@ void QWebFramePrivate::renderPrivate(QPainter *painter, const QRegion &clip) \since 4.4 \brief The QWebFrame class represents a frame in a web page. + \inmodule QtWebKit + QWebFrame represents a frame inside a web page. Each QWebPage object contains at least one frame, the main frame, obtained using QWebPage::mainFrame(). Additional frames will be created for HTML @@ -542,7 +544,7 @@ QUrl QWebFrame::requestedUrl() const // loader does not get commited by the frame loader) it is // safer to rely on outgoingReferrer than originalRequest. if (!d->frame->loader()->activeDocumentLoader() - || (!d->frameLoaderClient->m_loadSucceeded + || (!d->frameLoaderClient->m_loadError.isNull() && !d->frame->loader()->outgoingReferrer().isEmpty())) return QUrl(d->frame->loader()->outgoingReferrer()); @@ -708,7 +710,9 @@ void QWebFrame::load(const QNetworkRequest &req, script can be specified through the charset attribute of the HTML script tag. It is also possible for the encoding to be specified by web server. - \sa toHtml() + \note This method will not affect session or global history for the frame. + + \sa toHtml(), setContent() */ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) { @@ -716,7 +720,7 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) WebCore::ResourceRequest request(kurl); const QByteArray utf8 = html.toUtf8(); WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length()); - WebCore::SubstituteData substituteData(data, WebCore::String("text/html"), WebCore::String("utf-8"), kurl); + WebCore::SubstituteData substituteData(data, WebCore::String("text/html"), WebCore::String("utf-8"), KURL()); d->frame->loader()->load(request, substituteData, false); } @@ -729,7 +733,9 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) The \a data is loaded immediately; external objects are loaded asynchronously. - \sa toHtml() + \note This method will not affect session or global history for the frame. + + \sa toHtml(), setHtml() */ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) { @@ -739,11 +745,10 @@ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, cons QString actualMimeType = mimeType; if (actualMimeType.isEmpty()) actualMimeType = QLatin1String("text/html"); - WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), WebCore::String(), kurl); + WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), WebCore::String(), KURL()); d->frame->loader()->load(request, substituteData, false); } - /*! Returns the parent frame of this frame, or 0 if the frame is the web pages main frame. @@ -801,13 +806,11 @@ void QWebFrame::setScrollBarPolicy(Qt::Orientation orientation, Qt::ScrollBarPol d->horizontalScrollBarPolicy = policy; if (d->frame->view()) { d->frame->view()->setHorizontalScrollbarMode((ScrollbarMode)policy); - d->frame->view()->updateDefaultScrollbarState(); } } else { d->verticalScrollBarPolicy = policy; if (d->frame->view()) { d->frame->view()->setVerticalScrollbarMode((ScrollbarMode)policy); - d->frame->view()->updateDefaultScrollbarState(); } } } @@ -873,6 +876,7 @@ int QWebFrame::scrollBarMaximum(Qt::Orientation orientation) const */ int QWebFrame::scrollBarMinimum(Qt::Orientation orientation) const { + Q_UNUSED(orientation) return 0; } @@ -1024,7 +1028,8 @@ qreal QWebFrame::zoomFactor() const */ bool QWebFrame::hasFocus() const { - return QWebFramePrivate::kit(d->frame->page()->focusController()->focusedFrame()) == this; + WebCore::Frame* ff = d->frame->page()->focusController()->focusedFrame(); + return ff && QWebFramePrivate::kit(ff) == this; } /*! @@ -1246,7 +1251,7 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) ScriptController *proxy = d->frame->script(); QVariant rc; if (proxy) { - JSC::JSValue v = proxy->evaluate(ScriptSourceCode(scriptSource)).jsValue(); + JSC::JSValue v = d->frame->loader()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); int distance = 0; rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject()->globalExec(), v, QMetaType::Void, &distance); } @@ -1364,6 +1369,8 @@ QWebFrame* QWebFramePrivate::kit(WebCore::Frame* coreFrame) \brief The QWebHitTestResult class provides information about the web page content after a hit test. + \inmodule QtWebKit + QWebHitTestResult is returned by QWebFrame::hitTestContent() to provide information about the content of the web page at the specified position. */ diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h index d6afc01..632f83a 100644 --- a/WebKit/qt/Api/qwebframe_p.h +++ b/WebKit/qt/Api/qwebframe_p.h @@ -79,15 +79,14 @@ public: WebCore::Scrollbar* horizontalScrollBar() const; WebCore::Scrollbar* verticalScrollBar() const; - Qt::ScrollBarPolicy horizontalScrollBarPolicy; - Qt::ScrollBarPolicy verticalScrollBarPolicy; - static WebCore::Frame* core(QWebFrame*); static QWebFrame* kit(WebCore::Frame*); void renderPrivate(QPainter *painter, const QRegion &clip); QWebFrame *q; + Qt::ScrollBarPolicy horizontalScrollBarPolicy; + Qt::ScrollBarPolicy verticalScrollBarPolicy; WebCore::FrameLoaderClientQt *frameLoaderClient; WebCore::Frame *frame; QWebPage *page; diff --git a/WebKit/qt/Api/qwebhistory.cpp b/WebKit/qt/Api/qwebhistory.cpp index 1c1c72a..5752d66 100644 --- a/WebKit/qt/Api/qwebhistory.cpp +++ b/WebKit/qt/Api/qwebhistory.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "qwebhistory.h" #include "qwebhistory_p.h" +#include "qwebframe_p.h" #include "PlatformString.h" #include "Image.h" @@ -35,6 +36,8 @@ \since 4.4 \brief The QWebHistoryItem class represents one item in the history of a QWebPage + \inmodule QtWebKit + Each QWebHistoryItem instance represents an entry in the history stack of a Web page, containing information about the page, its location, and when it was last visited. @@ -201,6 +204,8 @@ bool QWebHistoryItem::isValid() const \since 4.4 \brief The QWebHistory class represents the history of a QWebPage + \inmodule QtWebKit + Each QWebPage instance contains a history of visited pages that can be accessed by QWebPage::history(). QWebHistory represents this history and makes it possible to navigate it. @@ -244,17 +249,27 @@ QWebHistory::~QWebHistory() */ void QWebHistory::clear() { - RefPtr<WebCore::HistoryItem> current = d->lst->currentItem(); - int capacity = d->lst->capacity(); - d->lst->setCapacity(0); + //shortcut to private BackForwardList + WebCore::BackForwardList* lst = d->lst; - WebCore::Page* page = d->lst->page(); + //clear visited links + WebCore::Page* page = lst->page(); if (page && page->groupPtr()) page->groupPtr()->removeVisitedLinks(); - d->lst->setCapacity(capacity); - d->lst->addItem(current.get()); - d->lst->goToItem(current.get()); + //if count() == 0 then just return + if (!lst->entries().size()) + return; + + RefPtr<WebCore::HistoryItem> current = lst->currentItem(); + int capacity = lst->capacity(); + lst->setCapacity(0); + + lst->setCapacity(capacity); //revert capacity + lst->addItem(current.get()); //insert old current item + lst->goToItem(current.get()); //and set it as current again + + d->page()->updateNavigationActions(); } /*! @@ -267,7 +282,7 @@ QList<QWebHistoryItem> QWebHistory::items() const const WebCore::HistoryItemVector &items = d->lst->entries(); QList<QWebHistoryItem> ret; - for (int i = 0; i < items.size(); ++i) { + for (unsigned i = 0; i < items.size(); ++i) { QWebHistoryItemPrivate *priv = new QWebHistoryItemPrivate(items[i].get()); ret.append(QWebHistoryItem(priv)); } @@ -286,7 +301,7 @@ QList<QWebHistoryItem> QWebHistory::backItems(int maxItems) const d->lst->backListWithLimit(maxItems, items); QList<QWebHistoryItem> ret; - for (int i = 0; i < items.size(); ++i) { + for (unsigned i = 0; i < items.size(); ++i) { QWebHistoryItemPrivate *priv = new QWebHistoryItemPrivate(items[i].get()); ret.append(QWebHistoryItem(priv)); } @@ -305,7 +320,7 @@ QList<QWebHistoryItem> QWebHistory::forwardItems(int maxItems) const d->lst->forwardListWithLimit(maxItems, items); QList<QWebHistoryItem> ret; - for (int i = 0; i < items.size(); ++i) { + for (unsigned i = 0; i < items.size(); ++i) { QWebHistoryItemPrivate *priv = new QWebHistoryItemPrivate(items[i].get()); ret.append(QWebHistoryItem(priv)); } @@ -341,9 +356,11 @@ bool QWebHistory::canGoForward() const */ void QWebHistory::back() { - d->lst->goBack(); - WebCore::Page* page = d->lst->page(); - page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + if (canGoBack()) { + d->lst->goBack(); + WebCore::Page* page = d->lst->page(); + page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + } } /*! @@ -354,9 +371,11 @@ void QWebHistory::back() */ void QWebHistory::forward() { - d->lst->goForward(); - WebCore::Page* page = d->lst->page(); - page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + if (canGoForward()) { + d->lst->goForward(); + WebCore::Page* page = d->lst->page(); + page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + } } /*! @@ -504,6 +523,8 @@ bool QWebHistory::restoreState(const QByteArray& buffer) default: {} // result is false; } + d->page()->updateNavigationActions(); + return result; }; @@ -529,7 +550,7 @@ QByteArray QWebHistory::saveState(HistoryStateVersion version) const stream << count() << currentItemIndex(); const WebCore::HistoryItemVector &items = d->lst->entries(); - for (int i = 0; i < items.size(); i++) + for (unsigned i = 0; i < items.size(); i++) items[i].get()->saveState(stream, version); if (stream.status() != QDataStream::Ok) @@ -549,8 +570,11 @@ QByteArray QWebHistory::saveState(HistoryStateVersion version) const \fn QDataStream& operator<<(QDataStream& stream, const QWebHistory& history) \relates QWebHistory - Saves the given \a history into the specified \a stream. This is a convenience function - and is equivalent to calling the saveState() method. + \brief The operator<< function streams a history into a data stream. + + It saves the \a history into the specified \a stream. This is a + convenience function and is equivalent to calling the saveState() + method. \sa QWebHistory::saveState() */ @@ -565,6 +589,8 @@ QDataStream& operator<<(QDataStream& stream, const QWebHistory& history) \relates QWebHistory \since 4.6 + \brief The operator>> function loads a history from a data stream. + Loads a QWebHistory from the specified \a stream into the given \a history. This is a convenience function and it is equivalent to calling the restoreState() method. @@ -580,4 +606,7 @@ QDataStream& operator>>(QDataStream& stream, QWebHistory& history) return stream; } - +QWebPagePrivate* QWebHistoryPrivate::page() +{ + return QWebFramePrivate::kit(lst->page()->mainFrame())->page()->handle(); +} diff --git a/WebKit/qt/Api/qwebhistory_p.h b/WebKit/qt/Api/qwebhistory_p.h index e77adef..a6682cd 100644 --- a/WebKit/qt/Api/qwebhistory_p.h +++ b/WebKit/qt/Api/qwebhistory_p.h @@ -25,13 +25,15 @@ #include <QtCore/qglobal.h> #include <QtCore/qshareddata.h> +class QWebPagePrivate; + class Q_AUTOTEST_EXPORT QWebHistoryItemPrivate : public QSharedData { public: - static QExplicitlySharedDataPointer<QWebHistoryItemPrivate> get(QWebHistoryItem *q) + static QExplicitlySharedDataPointer<QWebHistoryItemPrivate> get(QWebHistoryItem* q) { return q->d; } - QWebHistoryItemPrivate(WebCore::HistoryItem *i) + QWebHistoryItemPrivate(WebCore::HistoryItem* i) { if (i) i->ref(); @@ -43,30 +45,12 @@ public: item->deref(); } - /* QByteArray saveStateWithoutVersionControl(QWebHistory::HistoryStateVersion version) - { - QByteArray buffer; - switch(version){ - case QWebHistory::HistoryVersion1: - buffer=item->saveState(version); - break; - default:{} - } - return buffer; - } - - bool restoreStateWithoutVersionControl(QWebHistory::HistoryStateVersion version,QDataStream& stream) - { - - } -*/ - - WebCore::HistoryItem *item; + WebCore::HistoryItem* item; }; class QWebHistoryPrivate : public QSharedData { public: - QWebHistoryPrivate(WebCore::BackForwardList *l) + QWebHistoryPrivate(WebCore::BackForwardList* l) { l->ref(); lst = l; @@ -75,7 +59,10 @@ public: { lst->deref(); } - WebCore::BackForwardList *lst; + + QWebPagePrivate* page(); + + WebCore::BackForwardList* lst; }; diff --git a/WebKit/qt/Api/qwebhistoryinterface.cpp b/WebKit/qt/Api/qwebhistoryinterface.cpp index 87d52ce..80567d1 100644 --- a/WebKit/qt/Api/qwebhistoryinterface.cpp +++ b/WebKit/qt/Api/qwebhistoryinterface.cpp @@ -81,6 +81,8 @@ QWebHistoryInterface* QWebHistoryInterface::defaultInterface() \since 4.4 \brief The QWebHistoryInterface class provides an interface to implement link history. + \inmodule QtWebKit + The QWebHistoryInterface is an interface that can be used to implement link history. It contains two pure virtual methods that are called by the WebKit engine. addHistoryEntry() is used to add diff --git a/WebKit/qt/Api/qwebinspector.cpp b/WebKit/qt/Api/qwebinspector.cpp new file mode 100644 index 0000000..4578dc9 --- /dev/null +++ b/WebKit/qt/Api/qwebinspector.cpp @@ -0,0 +1,196 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "qwebinspector.h" + +#include "Element.h" +#include "InspectorController.h" +#include "qwebelement.h" +#include "qwebinspector_p.h" +#include "qwebpage_p.h" + +#include <QResizeEvent> + +/*! + \class QWebInspector + \since 4.6 + \brief The QWebInspector class allows the placement and control of a + QWebPage's inspector. + The inspector allows you to see a page current hierarchy and loading + statistics. + + The QWebPage to be inspected is determined with the setPage() method. + + A typical use of QWebInspector follows: + + \snippet webkitsnippets/qtwebkit_qwebinspector_snippet.cpp 0 + + \note A QWebInspector will display a blank widget if either: + \list + \o page() is null + \o QWebSettings::DeveloperExtrasEnabled is false + \endlist + + \section1 Resources + + Most of the resources needed by the inspector are owned by the associated + QWebPage and are allocated the first time that: + \list + \o an element is inspected + \o the QWebInspector is shown. + \endlist + + This class acts mostly as a container and a controller for the inspector. + You can defer the creation and association of the QWebInspector until + the first emission of QWebPage::webInspectorTriggered() to save additional + resources. + + \section1 Inspector configuration persistence + + The inspector allows the user to configure some options through its + interface (e.g. the resource tracking "Always enable" option). + These settings are persisted automatically by QtWebKit using QSettings. + + However since the QSettings object is instantiated using the empty + constructor, QCoreApplication::setOrganizationName() and + QCoreApplication::setApplicationName() must be called within your + application to enable the persistence of these options. +*/ + +/*! + Constructs an empty QWebInspector with parent \a parent. +*/ +QWebInspector::QWebInspector(QWidget* parent) + : QWidget(parent) + , d(new QWebInspectorPrivate(this)) +{ +} + +/*! + Destroys the inspector. +*/ +QWebInspector::~QWebInspector() +{ + // Remove association principally to prevent deleting a child frontend + setPage(0); +} + +/*! + Sets the QWebPage to be inspected. + + There can only be one QWebInspector associated with a QWebPage + and vices versa. + + Calling with \a page as null will break the current association, if any. + + If \a page is already associated to another QWebInspector, the association + will be replaced and the previous QWebInspector will have no page + associated. + + \sa page() +*/ +void QWebInspector::setPage(QWebPage* page) +{ + if (d->page) { + // Break currentPage-->this + d->page->d->setInspector(0); + } + if (page && page->d->inspector && page->d->inspector != this) { + // Break newPage<->newPageCurrentInspector + page->d->inspector->setPage(0); + } + + d->page = page; + + if (page) { + // Setup the reciprocal association + page->d->setInspector(this); + } +} + +/*! + Returns the inspected QWebPage. + If no web page is currently associated, a null pointer is returned. +*/ +QWebPage* QWebInspector::page() const +{ + return d->page; +} + +/*! \reimp */ +QSize QWebInspector::sizeHint() const +{ + return QSize(450, 300); +} + +/*! \reimp */ +bool QWebInspector::event(QEvent* ev) +{ + return QWidget::event(ev); +} + +/*! \reimp */ +void QWebInspector::resizeEvent(QResizeEvent* event) +{ + d->adjustFrontendSize(event->size()); +} + +/*! \reimp */ +void QWebInspector::showEvent(QShowEvent* event) +{ + // Allows QWebInspector::show() to init the inspector. + if (d->page) + d->page->d->inspectorController()->show(); +} + +/*! \reimp */ +void QWebInspector::hideEvent(QHideEvent* event) +{ + if (d->page) + d->page->d->inspectorController()->setWindowVisible(false); +} + +/*! \internal */ +void QWebInspectorPrivate::setFrontend(QWidget* newFrontend) +{ + if (frontend) + frontend->setParent(0); + + frontend = newFrontend; + + if (frontend) { + frontend->setParent(q); + frontend->show(); + adjustFrontendSize(q->size()); + } +} + +void QWebInspectorPrivate::adjustFrontendSize(const QSize& size) +{ + if (frontend) + frontend->resize(size); +} + +/*! + \fn void QWebInspector::windowTitleChanged(const QString& newTitle); + + This is emitted to signal that this widget's title changed to \a newTitle. +*/ + diff --git a/WebKit/qt/Api/qwebinspector.h b/WebKit/qt/Api/qwebinspector.h new file mode 100644 index 0000000..bb5bd64 --- /dev/null +++ b/WebKit/qt/Api/qwebinspector.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef QWEBINSPECTOR_H +#define QWEBINSPECTOR_H + +#include "qwebkitglobal.h" +#include "qwebpage.h" + +#include "qwebview.h" + +class QWebInspectorPrivate; + +class QWEBKIT_EXPORT QWebInspector : public QWidget { + Q_OBJECT +public: + QWebInspector(QWidget* parent = 0); + ~QWebInspector(); + + void setPage(QWebPage* page); + QWebPage* page() const; + + QSize sizeHint() const; + bool event(QEvent*); + +Q_SIGNALS: + void windowTitleChanged(const QString& newTitle); + +protected: + void resizeEvent(QResizeEvent* event); + void showEvent(QShowEvent* event); + void hideEvent(QHideEvent* event); + +private: + QWebInspectorPrivate* d; + + friend class QWebInspectorPrivate; + friend class QWebPage; + friend class QWebPagePrivate; + friend class WebCore::InspectorClientQt; +}; +#endif diff --git a/WebKit/qt/Api/qwebplugindatabase_p.h b/WebKit/qt/Api/qwebinspector_p.h index 714458f..4d327cc 100644 --- a/WebKit/qt/Api/qwebplugindatabase_p.h +++ b/WebKit/qt/Api/qwebinspector_p.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Jakub Wieczorek <faw217@gmail.com> + Copyright (C) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -17,30 +17,30 @@ Boston, MA 02110-1301, USA. */ -#ifndef QWEBPLUGINDATABASE_P_H -#define QWEBPLUGINDATABASE_P_H +#ifndef QWEBINSPECTOR_P_H +#define QWEBINSPECTOR_P_H -#include "qwebkitglobal.h" +QT_BEGIN_NAMESPACE +class QSize; +class QWidget; +QT_END_NAMESPACE +class QWebInspector; +class QWebPage; -#include <wtf/RefPtr.h> - -namespace WebCore { - class PluginPackage; - class PluginDatabase; -}; - -class QWebPluginInfoPrivate { -public: - QWebPluginInfoPrivate(RefPtr<WebCore::PluginPackage> pluginPackage); - - RefPtr<WebCore::PluginPackage> plugin; -}; - -class QWebPluginDatabasePrivate { +class QWebInspectorPrivate { public: - QWebPluginDatabasePrivate(WebCore::PluginDatabase* pluginDatabase); - - WebCore::PluginDatabase* database; + QWebInspectorPrivate(QWebInspector* qq) + : q(qq) + , page(0) + , frontend(0) + {} + + void setFrontend(QWidget* newFrontend); + void adjustFrontendSize(const QSize& size); + + QWebInspector* q; + QWebPage* page; + QWidget* frontend; }; -#endif // QWEBPLUGINDATABASE_P_H +#endif diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 8e40339..0acec48 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -27,6 +27,8 @@ #include "qwebframe_p.h" #include "qwebhistory.h" #include "qwebhistory_p.h" +#include "qwebinspector.h" +#include "qwebinspector_p.h" #include "qwebsettings.h" #include "qwebkitversion.h" @@ -64,8 +66,12 @@ #include "PluginDatabase.h" #include "ProgressTracker.h" #include "RefPtr.h" +#include "RenderTextControl.h" +#include "TextIterator.h" #include "HashMap.h" #include "HTMLFormElement.h" +#include "HTMLInputElement.h" +#include "HTMLNames.h" #include "HitTestResult.h" #include "WindowFeatures.h" #include "LocalizedStrings.h" @@ -76,7 +82,6 @@ #include <QBasicTimer> #include <QBitArray> #include <QDebug> -#include <QDesktopServices> #include <QDragEnterEvent> #include <QDragLeaveEvent> #include <QDragMoveEvent> @@ -94,6 +99,7 @@ #include <QSslSocket> #include <QStyle> #include <QSysInfo> +#include <QTextCharFormat> #if QT_VERSION >= 0x040400 #include <QNetworkAccessManager> #include <QNetworkRequest> @@ -108,7 +114,7 @@ void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories() PluginDatabase* db = PluginDatabase::installedPlugins(/* populate */ false); Vector<String> paths; - String qtPath(getenv("QTWEBKIT_PLUGIN_PATH")); + String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").data()); qtPath.split(UChar(':'), /* allowEmptyEntries */ false, paths); db->setPluginDirectories(paths); @@ -226,18 +232,6 @@ const char* QWebPagePrivate::editorCommandForWebActions(QWebPage::WebAction acti return 0; } -#ifndef QT_NO_CURSOR -SetCursorEvent::SetCursorEvent(const QCursor& cursor) - : QEvent(static_cast<QEvent::Type>(EventType)) - , m_cursor(cursor) -{} - -QCursor SetCursorEvent::cursor() const -{ - return m_cursor; -} -#endif - // If you change this make sure to also adjust the docs for QWebPage::userAgentForUrl #define WEBKIT_VERSION "527+" @@ -265,45 +259,25 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions) return result; } -static void initializeApplicationCachePathIfNecessary() -{ -#if ENABLE(OFFLINE_WEB_APPLICATIONS) - static bool initialized = false; - - if (initialized) - return; - - // Determine the path for HTML5 Application Cache DB - QString appCachePath; -#if QT_VERSION >= 0x040500 - appCachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); -#else - appCachePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); -#endif - - if (appCachePath.isEmpty()) - appCachePath = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); - - WebCore::cacheStorage().setCacheDirectory(appCachePath); - initialized = true; -#endif -} - QWebPagePrivate::QWebPagePrivate(QWebPage *qq) : q(qq) + , client(0) , view(0) + , inspectorFrontend(0) + , inspector(0) + , inspectorIsInternalOnly(false) , viewportSize(QSize(0, 0)) + , clickCausedFocus(false) { WebCore::InitializeLoggingChannelsIfNecessary(); JSC::initializeThreading(); - WebCore::FrameLoader::setLocalLoadPolicy(WebCore::FrameLoader::AllowLocalLoadsForLocalAndSubstituteData); - initializeApplicationCachePathIfNecessary(); + WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData); chromeClient = new ChromeClientQt(q); contextMenuClient = new ContextMenuClientQt(); editorClient = new EditorClientQt(q); page = new Page(chromeClient, contextMenuClient, editorClient, - new DragClientQt(q), new InspectorClientQt(q)); + new DragClientQt(q), new InspectorClientQt(q), 0); // ### should be configurable page->settings()->setDefaultTextEncodingName("iso-8859-1"); @@ -465,13 +439,13 @@ void QWebPagePrivate::_q_webActionTriggered(bool checked) q->triggerAction(action, checked); } -#ifndef NDEBUG void QWebPagePrivate::_q_cleanupLeakMessages() { +#ifndef NDEBUG // Need this to make leak messages accurate. cache()->setCapacities(0, 0, 0); -} #endif +} void QWebPagePrivate::updateAction(QWebPage::WebAction action) { @@ -487,10 +461,10 @@ void QWebPagePrivate::updateAction(QWebPage::WebAction action) switch (action) { case QWebPage::Back: - enabled = loader->canGoBackOrForward(-1); + enabled = page->canGoBackOrForward(-1); break; case QWebPage::Forward: - enabled = loader->canGoBackOrForward(1); + enabled = page->canGoBackOrForward(1); break; case QWebPage::Stop: enabled = loader->isLoading(); @@ -608,6 +582,18 @@ void QWebPagePrivate::timerEvent(QTimerEvent *ev) q->QObject::timerEvent(ev); } +void QWebPagePrivate::mouseMoveEvent(QGraphicsSceneMouseEvent* ev) +{ + q->setView(ev->widget()); + + WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); + if (!frame->view()) + return; + + bool accepted = frame->eventHandler()->mouseMoved(PlatformMouseEvent(ev, 0)); + ev->setAccepted(accepted); +} + void QWebPagePrivate::mouseMoveEvent(QMouseEvent *ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); @@ -618,12 +604,40 @@ void QWebPagePrivate::mouseMoveEvent(QMouseEvent *ev) ev->setAccepted(accepted); } +void QWebPagePrivate::mousePressEvent(QGraphicsSceneMouseEvent* ev) +{ + q->setView(ev->widget()); + + WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); + if (!frame->view()) + return; + + if (tripleClickTimer.isActive() + && (ev->pos().toPoint() - tripleClick).manhattanLength() + < QApplication::startDragDistance()) { + mouseTripleClickEvent(ev); + return; + } + + bool accepted = false; + PlatformMouseEvent mev(ev, 1); + // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton + if (mev.button() != NoButton) + accepted = frame->eventHandler()->handleMousePressEvent(mev); + ev->setAccepted(accepted); +} + void QWebPagePrivate::mousePressEvent(QMouseEvent *ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; + RefPtr<WebCore::Node> oldNode; + if (page->focusController()->focusedFrame() + && page->focusController()->focusedFrame()->document()) + oldNode = page->focusController()->focusedFrame()->document()->focusedNode(); + if (tripleClickTimer.isActive() && (ev->pos() - tripleClick).manhattanLength() < QApplication::startDragDistance()) { @@ -637,6 +651,33 @@ void QWebPagePrivate::mousePressEvent(QMouseEvent *ev) if (mev.button() != NoButton) accepted = frame->eventHandler()->handleMousePressEvent(mev); ev->setAccepted(accepted); + + RefPtr<WebCore::Node> newNode; + if (page->focusController()->focusedFrame() + && page->focusController()->focusedFrame()->document()) + newNode = page->focusController()->focusedFrame()->document()->focusedNode(); + + if (newNode && oldNode != newNode) + clickCausedFocus = true; +} + +void QWebPagePrivate::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *ev) +{ + q->setView(ev->widget()); + + WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); + if (!frame->view()) + return; + + bool accepted = false; + PlatformMouseEvent mev(ev, 2); + // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton + if (mev.button() != NoButton) + accepted = frame->eventHandler()->handleMousePressEvent(mev); + ev->setAccepted(accepted); + + tripleClickTimer.start(QApplication::doubleClickInterval(), q); + tripleClick = ev->pos().toPoint(); } void QWebPagePrivate::mouseDoubleClickEvent(QMouseEvent *ev) @@ -656,7 +697,7 @@ void QWebPagePrivate::mouseDoubleClickEvent(QMouseEvent *ev) tripleClick = ev->pos(); } -void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev) +void QWebPagePrivate::mouseTripleClickEvent(QGraphicsSceneMouseEvent *ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) @@ -670,30 +711,33 @@ void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev) ev->setAccepted(accepted); } -void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev) +void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; bool accepted = false; - PlatformMouseEvent mev(ev, 0); + PlatformMouseEvent mev(ev, 3); // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton if (mev.button() != NoButton) - accepted = frame->eventHandler()->handleMouseReleaseEvent(mev); + accepted = frame->eventHandler()->handleMousePressEvent(mev); ev->setAccepted(accepted); +} +void QWebPagePrivate::handleClipboard(QEvent* ev, Qt::MouseButton button) +{ #ifndef QT_NO_CLIPBOARD if (QApplication::clipboard()->supportsSelection()) { bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode(); Pasteboard::generalPasteboard()->setSelectionMode(true); WebCore::Frame* focusFrame = page->focusController()->focusedOrMainFrame(); - if (ev->button() == Qt::LeftButton) { + if (button == Qt::LeftButton) { if (focusFrame && (focusFrame->editor()->canCopy() || focusFrame->editor()->canDHTMLCopy())) { focusFrame->editor()->copy(); ev->setAccepted(true); } - } else if (ev->button() == Qt::MidButton) { + } else if (button == Qt::MidButton) { if (focusFrame && (focusFrame->editor()->canPaste() || focusFrame->editor()->canDHTMLPaste())) { focusFrame->editor()->paste(); ev->setAccepted(true); @@ -704,12 +748,65 @@ void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev) #endif } +void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) +{ + q->setView(ev->widget()); + + WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); + if (!frame->view()) + return; + + bool accepted = false; + PlatformMouseEvent mev(ev, 0); + // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton + if (mev.button() != NoButton) + accepted = frame->eventHandler()->handleMouseReleaseEvent(mev); + ev->setAccepted(accepted); + + handleClipboard(ev, ev->button()); + handleSoftwareInputPanel(ev->button()); +} + +void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button) +{ +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + if (view && view->testAttribute(Qt::WA_InputMethodEnabled) + && button == Qt::LeftButton && qApp->autoSipEnabled()) { + QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( + view->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) { + QEvent event(QEvent::RequestSoftwareInputPanel); + QApplication::sendEvent(view, &event); + } + } + + clickCausedFocus = false; +#endif +} + +void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev) +{ + WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); + if (!frame->view()) + return; + + bool accepted = false; + PlatformMouseEvent mev(ev, 0); + // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton + if (mev.button() != NoButton) + accepted = frame->eventHandler()->handleMouseReleaseEvent(mev); + ev->setAccepted(accepted); + + handleClipboard(ev, ev->button()); + handleSoftwareInputPanel(ev->button()); +} + #ifndef QT_NO_CONTEXTMENU -void QWebPagePrivate::contextMenuEvent(QContextMenuEvent *ev) +void QWebPagePrivate::contextMenuEvent(const QPoint& globalPos) { QMenu *menu = q->createStandardContextMenu(); if (menu) { - menu->exec(ev->globalPos()); + menu->exec(globalPos); delete menu; } } @@ -734,6 +831,19 @@ QMenu *QWebPage::createStandardContextMenu() } #ifndef QT_NO_WHEELEVENT +void QWebPagePrivate::wheelEvent(QGraphicsSceneWheelEvent* ev) +{ + q->setView(ev->widget()); + + WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); + if (!frame->view()) + return; + + WebCore::PlatformWheelEvent pev(ev); + bool accepted = frame->eventHandler()->handleWheelEvent(pev); + ev->setAccepted(accepted); +} + void QWebPagePrivate::wheelEvent(QWheelEvent *ev) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); @@ -804,7 +914,6 @@ void QWebPagePrivate::keyPressEvent(QKeyEvent *ev) { bool handled = false; WebCore::Frame* frame = page->focusController()->focusedOrMainFrame(); - WebCore::Editor* editor = frame->editor(); // we forward the key event to WebCore first to handle potential DOM // defined event handlers and later on end up in EditorClientQt::handleKeyboardEvent // to trigger editor commands via triggerAction(). @@ -816,7 +925,6 @@ void QWebPagePrivate::keyPressEvent(QKeyEvent *ev) if (view) defaultFont = view->font(); QFontMetrics fm(defaultFont); - int fontHeight = fm.height(); if (!handleScrolling(ev, frame)) { switch (ev->key()) { case Qt::Key_Back: @@ -859,7 +967,7 @@ void QWebPagePrivate::keyReleaseEvent(QKeyEvent *ev) ev->setAccepted(handled); } -void QWebPagePrivate::focusInEvent(QFocusEvent *ev) +void QWebPagePrivate::focusInEvent(QFocusEvent*) { FocusController *focusController = page->focusController(); Frame *frame = focusController->focusedFrame(); @@ -870,7 +978,7 @@ void QWebPagePrivate::focusInEvent(QFocusEvent *ev) focusController->setFocusedFrame(QWebFramePrivate::core(mainFrame)); } -void QWebPagePrivate::focusOutEvent(QFocusEvent *ev) +void QWebPagePrivate::focusOutEvent(QFocusEvent*) { // only set the focused frame inactive so that we stop painting the caret // and the focus frame. But don't tell the focus controller so that upon @@ -880,7 +988,21 @@ void QWebPagePrivate::focusOutEvent(QFocusEvent *ev) focusController->setFocused(false); } -void QWebPagePrivate::dragEnterEvent(QDragEnterEvent *ev) +void QWebPagePrivate::dragEnterEvent(QGraphicsSceneDragDropEvent* ev) +{ + q->setView(ev->widget()); + +#ifndef QT_NO_DRAGANDDROP + DragData dragData(ev->mimeData(), ev->pos().toPoint(), + QCursor::pos(), dropActionToDragOp(ev->possibleActions())); + Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData)); + ev->setDropAction(action); + if (action != Qt::IgnoreAction) + ev->accept(); +#endif +} + +void QWebPagePrivate::dragEnterEvent(QDragEnterEvent* ev) { #ifndef QT_NO_DRAGANDDROP DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(), @@ -892,7 +1014,18 @@ void QWebPagePrivate::dragEnterEvent(QDragEnterEvent *ev) #endif } -void QWebPagePrivate::dragLeaveEvent(QDragLeaveEvent *ev) +void QWebPagePrivate::dragLeaveEvent(QGraphicsSceneDragDropEvent* ev) +{ + q->setView(ev->widget()); + +#ifndef QT_NO_DRAGANDDROP + DragData dragData(0, IntPoint(), QCursor::pos(), DragOperationNone); + page->dragController()->dragExited(&dragData); + ev->accept(); +#endif +} + +void QWebPagePrivate::dragLeaveEvent(QDragLeaveEvent* ev) { #ifndef QT_NO_DRAGANDDROP DragData dragData(0, IntPoint(), QCursor::pos(), DragOperationNone); @@ -901,7 +1034,21 @@ void QWebPagePrivate::dragLeaveEvent(QDragLeaveEvent *ev) #endif } -void QWebPagePrivate::dragMoveEvent(QDragMoveEvent *ev) +void QWebPagePrivate::dragMoveEvent(QGraphicsSceneDragDropEvent* ev) +{ + q->setView(ev->widget()); + +#ifndef QT_NO_DRAGANDDROP + DragData dragData(ev->mimeData(), ev->pos().toPoint(), + QCursor::pos(), dropActionToDragOp(ev->possibleActions())); + Qt::DropAction action = dragOpToDropAction(page->dragController()->dragUpdated(&dragData)); + ev->setDropAction(action); + if (action != Qt::IgnoreAction) + ev->accept(); +#endif +} + +void QWebPagePrivate::dragMoveEvent(QDragMoveEvent* ev) { #ifndef QT_NO_DRAGANDDROP DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(), @@ -913,7 +1060,18 @@ void QWebPagePrivate::dragMoveEvent(QDragMoveEvent *ev) #endif } -void QWebPagePrivate::dropEvent(QDropEvent *ev) +void QWebPagePrivate::dropEvent(QGraphicsSceneDragDropEvent* ev) +{ +#ifndef QT_NO_DRAGANDDROP + DragData dragData(ev->mimeData(), ev->pos().toPoint(), + QCursor::pos(), dropActionToDragOp(ev->possibleActions())); + Qt::DropAction action = dragOpToDropAction(page->dragController()->performDrag(&dragData)); + if (action != Qt::IgnoreAction) + ev->accept(); +#endif +} + +void QWebPagePrivate::dropEvent(QDropEvent* ev) { #ifndef QT_NO_DRAGANDDROP DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(), @@ -924,7 +1082,7 @@ void QWebPagePrivate::dropEvent(QDropEvent *ev) #endif } -void QWebPagePrivate::leaveEvent(QEvent *ev) +void QWebPagePrivate::leaveEvent(QEvent*) { // Fake a mouse move event just outside of the widget, since all // the interesting mouse-out behavior like invalidating scrollbars @@ -967,13 +1125,53 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) return; } + RenderObject* renderer = 0; + RenderTextControl* renderTextControl = 0; + + if (frame->selection()->rootEditableElement()) + renderer = frame->selection()->rootEditableElement()->shadowAncestorNode()->renderer(); + + if (renderer && renderer->isTextControl()) + renderTextControl = toRenderTextControl(renderer); + + Vector<CompositionUnderline> underlines; + + for (int i = 0; i < ev->attributes().size(); ++i) { + const QInputMethodEvent::Attribute& a = ev->attributes().at(i); + switch (a.type) { + case QInputMethodEvent::TextFormat: { + QTextCharFormat textCharFormat = a.value.value<QTextFormat>().toCharFormat(); + QColor qcolor = textCharFormat.underlineColor(); + underlines.append(CompositionUnderline(a.start, a.length, Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha())), false)); + break; + } + case QInputMethodEvent::Cursor: { + frame->setCaretVisible(a.length); //if length is 0 cursor is invisible + if (a.length > 0) { + RenderObject* caretRenderer = frame->selection()->caretRenderer(); + if (caretRenderer) { + QColor qcolor = a.value.value<QColor>(); + caretRenderer->style()->setColor(Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha()))); + } + } + break; + } +#if QT_VERSION >= 0x040600 + case QInputMethodEvent::Selection: { + if (renderTextControl) { + renderTextControl->setSelectionStart(a.start); + renderTextControl->setSelectionEnd(a.start + a.length); + } + break; + } +#endif + } + } + if (!ev->commitString().isEmpty()) editor->confirmComposition(ev->commitString()); - else { + else if (!ev->preeditString().isEmpty()) { QString preedit = ev->preeditString(); - // ### FIXME: use the provided QTextCharFormat (use color at least) - Vector<CompositionUnderline> underlines; - underlines.append(CompositionUnderline(0, preedit.length(), Color(0, 0, 0), false)); editor->setComposition(preedit, underlines, preedit.length(), 0); } ev->accept(); @@ -1076,44 +1274,140 @@ bool QWebPagePrivate::handleScrolling(QKeyEvent *ev, Frame *frame) */ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const { + Frame* frame = d->page->focusController()->focusedFrame(); + if (!frame) + return QVariant(); + + WebCore::Editor* editor = frame->editor(); + + RenderObject* renderer = 0; + RenderTextControl* renderTextControl = 0; + + if (frame->selection()->rootEditableElement()) + renderer = frame->selection()->rootEditableElement()->shadowAncestorNode()->renderer(); + + if (renderer && renderer->isTextControl()) + renderTextControl = toRenderTextControl(renderer); + switch (property) { - case Qt::ImMicroFocus: { - Frame *frame = d->page->focusController()->focusedFrame(); - if (frame) + case Qt::ImMicroFocus: { return QVariant(frame->selection()->absoluteCaretBounds()); - return QVariant(); - } - case Qt::ImFont: { - QWebView *webView = qobject_cast<QWebView *>(d->view); - if (webView) - return QVariant(webView->font()); - return QVariant(); - } - case Qt::ImCursorPosition: { - Frame *frame = d->page->focusController()->focusedFrame(); - if (frame) { - VisibleSelection selection = frame->selection()->selection(); - if (selection.isCaret()) - return QVariant(selection.start().deprecatedEditingOffset()); } - return QVariant(); - } - case Qt::ImSurroundingText: { - Frame *frame = d->page->focusController()->focusedFrame(); - if (frame) { - Document *document = frame->document(); - if (document->focusedNode()) - return QVariant(document->focusedNode()->nodeValue()); + case Qt::ImFont: { + if (renderTextControl) { + RenderStyle* renderStyle = renderTextControl->style(); + return QVariant(QFont(renderStyle->font().font())); + } + return QVariant(QFont()); } - return QVariant(); + case Qt::ImCursorPosition: { + if (renderTextControl) { + if (editor->hasComposition()) { + RefPtr<Range> range = editor->compositionRange(); + return QVariant(renderTextControl->selectionEnd() - TextIterator::rangeLength(range.get())); + } + return QVariant(renderTextControl->selectionEnd()); + } + return QVariant(); + } + case Qt::ImSurroundingText: { + if (renderTextControl) { + QString text = renderTextControl->text(); + RefPtr<Range> range = editor->compositionRange(); + if (range) { + text.remove(range->startPosition().offsetInContainerNode(), TextIterator::rangeLength(range.get())); + } + return QVariant(text); + } + return QVariant(); + } + case Qt::ImCurrentSelection: { + if (renderTextControl) { + int start = renderTextControl->selectionStart(); + int end = renderTextControl->selectionEnd(); + if (end > start) + return QVariant(QString(renderTextControl->text()).mid(start,end-start)); + } + return QVariant(); + + } +#if QT_VERSION >= 0x040600 + case Qt::ImAnchorPosition: { + if (renderTextControl) { + if (editor->hasComposition()) { + RefPtr<Range> range = editor->compositionRange(); + return QVariant(renderTextControl->selectionStart() - TextIterator::rangeLength(range.get())); + } + return QVariant(renderTextControl->selectionStart()); + } + return QVariant(); + } + case Qt::ImMaximumTextLength: { + if (frame->selection()->isContentEditable()) { + if (frame->document() && frame->document()->focusedNode()) { + if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) { + HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode()); + return QVariant(inputElement->maxLength()); + } + } + return QVariant(InputElement::s_maximumLength); + } + return QVariant(0); + } +#endif + default: + return QVariant(); } - case Qt::ImCurrentSelection: - return QVariant(selectedText()); - default: - return QVariant(); +} + +/*! + \internal +*/ +void QWebPagePrivate::setInspector(QWebInspector* insp) +{ + if (inspector) + inspector->d->setFrontend(0); + + if (inspectorIsInternalOnly) { + QWebInspector* inspToDelete = inspector; + inspector = 0; + inspectorIsInternalOnly = false; + delete inspToDelete; // Delete after to prevent infinite recursion + } + + inspector = insp; + + // Give inspector frontend web view if previously created + if (inspector && inspectorFrontend) + inspector->d->setFrontend(inspectorFrontend); +} + +/*! + \internal + Returns the inspector and creates it if it wasn't created yet. + The instance created here will not be available through QWebPage's API. +*/ +QWebInspector* QWebPagePrivate::getOrCreateInspector() +{ + if (!inspector) { + QWebInspector* insp = new QWebInspector; + insp->setPage(q); + insp->connect(q, SIGNAL(webInspectorTriggered(const QWebElement&)), SLOT(show())); + insp->show(); // The inspector is expected to be shown on inspection + inspectorIsInternalOnly = true; + + Q_ASSERT(inspector); // Associated through QWebInspector::setPage(q) } + return inspector; } +/*! \internal */ +InspectorController* QWebPagePrivate::inspectorController() +{ + return page->inspectorController(); +} + + /*! \enum QWebPage::FindFlag @@ -1252,6 +1546,8 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const \since 4.4 \brief The QWebPage class provides an object to view and edit web documents. + \inmodule QtWebKit + QWebPage holds a main frame responsible for web content, settings, the history of navigated links and actions. This class can be used, together with QWebFrame, to provide functionality like QWebView in a widget-less environment. @@ -1321,9 +1617,12 @@ QWebPage::QWebPage(QObject *parent) */ QWebPage::~QWebPage() { + d->createMainFrame(); FrameLoader *loader = d->mainFrame->d->frame->loader(); if (loader) loader->detachFromParent(); + if (d->inspector) + d->inspector->setPage(0); delete d; } @@ -1348,6 +1647,7 @@ QWebFrame *QWebPage::mainFrame() const */ QWebFrame *QWebPage::currentFrame() const { + d->createMainFrame(); return static_cast<WebCore::FrameLoaderClientQt *>(d->page->focusController()->focusedOrMainFrame()->loader()->client())->webFrame(); } @@ -1373,6 +1673,7 @@ QWebFrame* QWebPage::frameAt(const QPoint& pos) const */ QWebHistory *QWebPage::history() const { + d->createMainFrame(); return &d->history; } @@ -1383,8 +1684,10 @@ QWebHistory *QWebPage::history() const */ void QWebPage::setView(QWidget *view) { - d->view = view; - setViewportSize(view ? view->size() : QSize(0, 0)); + if (d->view != view) { + d->view = view; + setViewportSize(view ? view->size() : QSize(0, 0)); + } } /*! @@ -1419,6 +1722,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, */ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg) { + Q_UNUSED(frame) #ifndef QT_NO_MESSAGEBOX QMessageBox::information(d->view, tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Ok); #endif @@ -1432,6 +1736,7 @@ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg) */ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) { + Q_UNUSED(frame) #ifdef QT_NO_MESSAGEBOX return true; #else @@ -1450,6 +1755,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) */ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QString& defaultValue, QString* result) { + Q_UNUSED(frame) bool ok = false; #ifndef QT_NO_INPUTDIALOG QString x = QInputDialog::getText(d->view, tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), msg, QLineEdit::Normal, defaultValue, &ok); @@ -1543,7 +1849,7 @@ static void openNewWindow(const QUrl& url, WebCore::Frame* frame) \sa action() */ -void QWebPage::triggerAction(WebAction action, bool checked) +void QWebPage::triggerAction(WebAction action, bool) { WebCore::Frame *frame = d->page->focusController()->focusedOrMainFrame(); if (!frame) @@ -1619,12 +1925,16 @@ void QWebPage::triggerAction(WebAction action, bool checked) case SetTextDirectionRightToLeft: editor->setBaseWritingDirection(RightToLeftWritingDirection); break; - case InspectElement: - if (!d->hitTestResult.isNull()) + case InspectElement: { + QWebElement inspectedElement(QWebElement::enclosingElement(d->hitTestResult.d->innerNonSharedNode.get())); + emit webInspectorTriggered(inspectedElement); + + if (!d->hitTestResult.isNull()) { + d->getOrCreateInspector(); // Make sure the inspector is created d->page->inspectorController()->inspect(d->hitTestResult.d->innerNonSharedNode.get()); - else - d->page->inspectorController()->show(); + } break; + } default: command = QWebPagePrivate::editorCommandForWebActions(action); break; @@ -1725,6 +2035,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest & bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type) #endif { + Q_UNUSED(frame) if (type == NavigationTypeLinkClicked) { switch (d->linkPolicy) { case DontDelegateLinks: @@ -1754,6 +2065,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkReques */ QString QWebPage::selectedText() const { + d->createMainFrame(); return d->page->focusController()->focusedOrMainFrame()->selectedText(); } @@ -2079,24 +2391,42 @@ bool QWebPage::event(QEvent *ev) case QEvent::MouseMove: d->mouseMoveEvent(static_cast<QMouseEvent*>(ev)); break; + case QEvent::GraphicsSceneMouseMove: + d->mouseMoveEvent(static_cast<QGraphicsSceneMouseEvent*>(ev)); + break; case QEvent::MouseButtonPress: d->mousePressEvent(static_cast<QMouseEvent*>(ev)); break; + case QEvent::GraphicsSceneMousePress: + d->mousePressEvent(static_cast<QGraphicsSceneMouseEvent*>(ev)); + break; case QEvent::MouseButtonDblClick: d->mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev)); break; + case QEvent::GraphicsSceneMouseDoubleClick: + d->mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent*>(ev)); + break; case QEvent::MouseButtonRelease: d->mouseReleaseEvent(static_cast<QMouseEvent*>(ev)); break; + case QEvent::GraphicsSceneMouseRelease: + d->mouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent*>(ev)); + break; #ifndef QT_NO_CONTEXTMENU case QEvent::ContextMenu: - d->contextMenuEvent(static_cast<QContextMenuEvent*>(ev)); + d->contextMenuEvent(static_cast<QContextMenuEvent*>(ev)->globalPos()); + break; + case QEvent::GraphicsSceneContextMenu: + d->contextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent*>(ev)->screenPos()); break; #endif #ifndef QT_NO_WHEELEVENT case QEvent::Wheel: d->wheelEvent(static_cast<QWheelEvent*>(ev)); break; + case QEvent::GraphicsSceneWheel: + d->wheelEvent(static_cast<QGraphicsSceneWheelEvent*>(ev)); + break; #endif case QEvent::KeyPress: d->keyPressEvent(static_cast<QKeyEvent*>(ev)); @@ -2114,15 +2444,27 @@ bool QWebPage::event(QEvent *ev) case QEvent::DragEnter: d->dragEnterEvent(static_cast<QDragEnterEvent*>(ev)); break; + case QEvent::GraphicsSceneDragEnter: + d->dragEnterEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev)); + break; case QEvent::DragLeave: d->dragLeaveEvent(static_cast<QDragLeaveEvent*>(ev)); break; + case QEvent::GraphicsSceneDragLeave: + d->dragLeaveEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev)); + break; case QEvent::DragMove: d->dragMoveEvent(static_cast<QDragMoveEvent*>(ev)); break; + case QEvent::GraphicsSceneDragMove: + d->dragMoveEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev)); + break; case QEvent::Drop: d->dropEvent(static_cast<QDropEvent*>(ev)); break; + case QEvent::GraphicsSceneDrop: + d->dropEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev)); + break; #endif case QEvent::InputMethod: d->inputMethodEvent(static_cast<QInputMethodEvent*>(ev)); @@ -2279,6 +2621,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) } } + d->createMainFrame(); WebCore::Frame* focusedFrame = d->page->focusController()->focusedOrMainFrame(); HitTestResult result = focusedFrame->eventHandler()->hitTestResultAtPoint(focusedFrame->view()->windowToContents(pos), /*allowShadowContent*/ false); @@ -2335,15 +2678,56 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) \since 4.4 \brief The ExtensionOption class provides an extended input argument to QWebPage's extension support. + \inmodule QtWebKit + \sa QWebPage::extension() */ /*! + \class QWebPage::ErrorPageExtensionOption + \since 4.6 + \brief The ErrorPageExtensionOption class describes the option + for the error page extension. + + \inmodule QtWebKit + + The ErrorPageExtensionOption class holds the \a url for which an error occoured as well as + the associated \a frame. + + The error itself is reported by an error \a domain, the \a error code as well as \a errorString. + + \sa QWebPage::ErrorPageExtensionReturn +*/ + +/*! + \class QWebPage::ErrorPageExtensionReturn + \since 4.6 + \brief The ErrorPageExtensionReturn describes the error page, which will be shown for the + frame for which the error occured. + + \inmodule QtWebKit + + The ErrorPageExtensionReturn class holds the data needed for creating an error page. Some are + optional such as \a contentType, which defaults to "text/html", as well as the \a encoding, which + is assumed to be UTF-8 if not indicated otherwise. + + The error page is stored in the \a content byte array, as HTML content. In order to convert a + QString to a byte array, the QString::toUtf8() method can be used. + + External objects such as stylesheets or images referenced in the HTML are located relative to + \a baseUrl. + + \sa QWebPage::ErrorPageExtensionOption, QString::toUtf8() +*/ + +/*! \class QWebPage::ChooseMultipleFilesExtensionOption \since 4.5 \brief The ChooseMultipleFilesExtensionOption class describes the option for the multiple files selection extension. + \inmodule QtWebKit + The ChooseMultipleFilesExtensionOption class holds the frame originating the request and the suggested filenames which might be provided. @@ -2356,6 +2740,8 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) \brief The ChooseMultipleFilesExtensionReturn describes the return value for the multiple files selection extension. + \inmodule QtWebKit + The ChooseMultipleFilesExtensionReturn class holds the filenames selected by the user when the extension is invoked. @@ -2460,6 +2846,7 @@ QWebSettings *QWebPage::settings() const */ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFile) { + Q_UNUSED(parentFrame) #ifndef QT_NO_FILEDIALOG return QFileDialog::getOpenFileName(d->view, QString::null, suggestedFile); #else @@ -2698,6 +3085,11 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const case QSysInfo::WV_VISTA: ver = "Windows NT 6.0"; break; +#if QT_VERSION > 0x040500 + case QSysInfo::WV_WINDOWS7: + ver = "Windows NT 6.1"; + break; +#endif case QSysInfo::WV_CE: ver = "Windows CE"; break; @@ -2936,6 +3328,24 @@ quint64 QWebPage::bytesReceived() const */ /*! + \fn void QWebPage::webInspectorTriggered(const QWebElement& inspectedElement); + \since 4.6 + + This signal is emitted when the user triggered an inspection through the + context menu. If a QWebInspector is associated to this page, it should be + visible to the user after this signal has been emitted. + + If still no QWebInspector is associated to this QWebPage after the emission + of this signal, a privately owned inspector will be shown to the user. + + \note \a inspectedElement contains the QWebElement under the context menu. + It is not garanteed to be the same as the focused element in the web + inspector. + + \sa QWebInspector +*/ + +/*! \fn void QWebPage::toolBarVisibilityChangeRequested(bool visible) This signal is emitted whenever the visibility of the toolbar in a web browser @@ -2986,6 +3396,16 @@ quint64 QWebPage::bytesReceived() const */ /*! + \since 4.6 + \fn void QWebPage::networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); + \preliminary + + This signal is emitted when a \a frame of the current page requests a web resource. The application + may want to associate the \a request with the \a frame that initiated it by storing the \a frame + as an attribute of the \a request. +*/ + +/*! \fn QWebPagePrivate* QWebPage::handle() const \internal */ diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h index 24741a1..d77656c 100644 --- a/WebKit/qt/Api/qwebpage.h +++ b/WebKit/qt/Api/qwebpage.h @@ -25,18 +25,19 @@ #include "qwebkitglobal.h" #include <QtCore/qobject.h> +#include <QtCore/qurl.h> #include <QtGui/qwidget.h> QT_BEGIN_NAMESPACE class QNetworkProxy; class QUndoStack; -class QUrl; class QMenu; class QNetworkRequest; class QNetworkReply; class QNetworkAccessManager; QT_END_NAMESPACE +class QWebElement; class QWebFrame; class QWebNetworkRequest; class QWebHistory; @@ -55,6 +56,7 @@ namespace WebCore { class InspectorClientQt; class ResourceHandle; class HitTestResult; + class QNetworkReplyHandler; struct FrameLoadRequest; } @@ -265,7 +267,8 @@ public: QMenu *createStandardContextMenu(); enum Extension { - ChooseMultipleFilesExtension + ChooseMultipleFilesExtension, + ErrorPageExtension }; class ExtensionOption {}; @@ -283,6 +286,26 @@ public: QStringList fileNames; }; + enum ErrorDomain { QtNetwork, Http, WebKit }; + class ErrorPageExtensionOption : public ExtensionOption { + public: + QUrl url; + QWebFrame* frame; + ErrorDomain domain; + int error; + QString errorString; + }; + + class ErrorPageExtensionReturn : public ExtensionReturn { + public: + ErrorPageExtensionReturn() : contentType(QLatin1String("text/html")), encoding(QLatin1String("utf-8")) {}; + QString contentType; + QString encoding; + QUrl baseUrl; + QByteArray content; + }; + + virtual bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0); virtual bool supportsExtension(Extension extension) const; @@ -306,6 +329,7 @@ Q_SIGNALS: void windowCloseRequested(); void printRequested(QWebFrame *frame); void linkClicked(const QUrl &url); + void webInspectorTriggered(const QWebElement& inspectedElement); void toolBarVisibilityChangeRequested(bool visible); void statusBarVisibilityChangeRequested(bool visible); @@ -323,6 +347,8 @@ Q_SIGNALS: void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item); void restoreFrameStateRequested(QWebFrame* frame); + void networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); + protected: virtual QWebPage *createWindow(WebWindowType type); virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); @@ -343,19 +369,21 @@ protected: private: Q_PRIVATE_SLOT(d, void _q_onLoadProgressChanged(int)) Q_PRIVATE_SLOT(d, void _q_webActionTriggered(bool checked)) -#ifndef NDEBUG Q_PRIVATE_SLOT(d, void _q_cleanupLeakMessages()) -#endif + QWebPagePrivate *d; friend class QWebFrame; friend class QWebPagePrivate; friend class QWebView; + friend class QGraphicsWebView; + friend class QWebInspector; friend class WebCore::ChromeClientQt; friend class WebCore::EditorClientQt; friend class WebCore::FrameLoaderClientQt; friend class WebCore::InspectorClientQt; friend class WebCore::ResourceHandle; + friend class WebCore::QNetworkReplyHandler; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QWebPage::FindFlags) diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index 87c624d..b9571fa 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -25,6 +25,7 @@ #include <qnetworkproxy.h> #include <qpointer.h> #include <qevent.h> +#include <qgraphicssceneevent.h> #include "qwebpage.h" #include "qwebhistory.h" @@ -42,21 +43,10 @@ namespace WebCore { class ContextMenu; class EditorClientQt; class Element; + class InspectorController; class Node; class Page; class Frame; - -#ifndef QT_NO_CURSOR - class SetCursorEvent : public QEvent { - public: - static const int EventType = 724; - SetCursorEvent(const QCursor&); - - QCursor cursor() const; - private: - QCursor m_cursor; - }; -#endif } QT_BEGIN_NAMESPACE @@ -65,6 +55,9 @@ class QMenu; class QBitArray; QT_END_NAMESPACE +class QWebInspector; +class QWebPageClient; + class QWebPagePrivate { public: QWebPagePrivate(QWebPage*); @@ -75,9 +68,7 @@ public: #endif void _q_onLoadProgressChanged(int); void _q_webActionTriggered(bool checked); -#ifndef NDEBUG void _q_cleanupLeakMessages(); -#endif void updateAction(QWebPage::WebAction action); void updateNavigationActions(); void updateEditorActions(); @@ -85,32 +76,48 @@ public: void timerEvent(QTimerEvent*); void mouseMoveEvent(QMouseEvent*); + void mouseMoveEvent(QGraphicsSceneMouseEvent*); void mousePressEvent(QMouseEvent*); + void mousePressEvent(QGraphicsSceneMouseEvent*); void mouseDoubleClickEvent(QMouseEvent*); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*); void mouseTripleClickEvent(QMouseEvent*); + void mouseTripleClickEvent(QGraphicsSceneMouseEvent*); void mouseReleaseEvent(QMouseEvent*); + void mouseReleaseEvent(QGraphicsSceneMouseEvent*); #ifndef QT_NO_CONTEXTMENU - void contextMenuEvent(QContextMenuEvent*); + void contextMenuEvent(const QPoint& globalPos); #endif #ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent*); + void wheelEvent(QGraphicsSceneWheelEvent*); #endif void keyPressEvent(QKeyEvent*); void keyReleaseEvent(QKeyEvent*); void focusInEvent(QFocusEvent*); void focusOutEvent(QFocusEvent*); - void dragEnterEvent(QDragEnterEvent *); - void dragLeaveEvent(QDragLeaveEvent *); - void dragMoveEvent(QDragMoveEvent *); - void dropEvent(QDropEvent *); + void dragEnterEvent(QDragEnterEvent*); + void dragEnterEvent(QGraphicsSceneDragDropEvent*); + void dragLeaveEvent(QDragLeaveEvent*); + void dragLeaveEvent(QGraphicsSceneDragDropEvent*); + void dragMoveEvent(QDragMoveEvent*); + void dragMoveEvent(QGraphicsSceneDragDropEvent*); + void dropEvent(QDropEvent*); + void dropEvent(QGraphicsSceneDragDropEvent*); void inputMethodEvent(QInputMethodEvent*); void shortcutOverrideEvent(QKeyEvent*); - void leaveEvent(QEvent *); + void leaveEvent(QEvent*); + void handleClipboard(QEvent*, Qt::MouseButton); + void handleSoftwareInputPanel(Qt::MouseButton); bool handleScrolling(QKeyEvent*, WebCore::Frame*); + void setInspector(QWebInspector*); + QWebInspector* getOrCreateInspector(); + WebCore::InspectorController* inspectorController(); + #ifndef QT_NO_SHORTCUT static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event); #endif @@ -124,10 +131,11 @@ public: QPointer<QWebFrame> mainFrame; QWebPage *q; + QWebPageClient* client; #ifndef QT_NO_UNDOSTACK QUndoStack *undoStack; #endif - QWidget *view; + QWidget* view; bool insideOpenCall; quint64 m_totalBytes; @@ -136,6 +144,8 @@ public: QPoint tripleClick; QBasicTimer tripleClickTimer; + bool clickCausedFocus; + #if QT_VERSION < 0x040400 bool acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type); @@ -168,6 +178,10 @@ public: QWebPluginFactory *pluginFactory; + QWidget* inspectorFrontend; + QWebInspector* inspector; + bool inspectorIsInternalOnly; // True if created through the Inspect context menu action + static bool drtRun; }; diff --git a/WebKit/qt/Api/qwebplugindatabase.cpp b/WebKit/qt/Api/qwebplugindatabase.cpp index 8758c60..623895f 100644 --- a/WebKit/qt/Api/qwebplugindatabase.cpp +++ b/WebKit/qt/Api/qwebplugindatabase.cpp @@ -19,7 +19,6 @@ #include "config.h" #include "qwebplugindatabase.h" -#include "qwebplugindatabase_p.h" #include "PluginDatabase.h" #include "PluginPackage.h" @@ -32,16 +31,6 @@ using namespace WebCore; \brief Represents a single MIME type supported by a plugin. */ -QWebPluginInfoPrivate::QWebPluginInfoPrivate(RefPtr<PluginPackage> pluginPackage) - : plugin(pluginPackage) -{ -} - -QWebPluginDatabasePrivate::QWebPluginDatabasePrivate(PluginDatabase* pluginDatabase) - : database(pluginDatabase) -{ -} - /*! \class QWebPluginInfo \since 4.6 @@ -64,21 +53,25 @@ QWebPluginDatabasePrivate::QWebPluginDatabasePrivate(PluginDatabase* pluginDatab Constructs a null QWebPluginInfo. */ QWebPluginInfo::QWebPluginInfo() - : d(new QWebPluginInfoPrivate(0)) + : m_package(0) { } -QWebPluginInfo::QWebPluginInfo(PluginPackage* plugin) - : d(new QWebPluginInfoPrivate(plugin)) +QWebPluginInfo::QWebPluginInfo(PluginPackage* package) + : m_package(package) { + if (m_package) + m_package->ref(); } /*! Contructs a copy of \a other. */ QWebPluginInfo::QWebPluginInfo(const QWebPluginInfo& other) - : d(new QWebPluginInfoPrivate(other.d->plugin)) + : m_package(other.m_package) { + if (m_package) + m_package->ref(); } /*! @@ -86,7 +79,8 @@ QWebPluginInfo::QWebPluginInfo(const QWebPluginInfo& other) */ QWebPluginInfo::~QWebPluginInfo() { - delete d; + if (m_package) + m_package->deref(); } /*! @@ -96,9 +90,9 @@ QWebPluginInfo::~QWebPluginInfo() */ QString QWebPluginInfo::name() const { - if (!d->plugin) + if (!m_package) return QString(); - return d->plugin->name(); + return m_package->name(); } /*! @@ -108,9 +102,9 @@ QString QWebPluginInfo::name() const */ QString QWebPluginInfo::description() const { - if (!d->plugin) + if (!m_package) return QString(); - return d->plugin->description(); + return m_package->description(); } /*! @@ -120,28 +114,27 @@ QString QWebPluginInfo::description() const */ QList<QWebPluginInfo::MimeType> QWebPluginInfo::mimeTypes() const { - if (!d->plugin) - return QList<MimeType>(); + if (m_package && m_mimeTypes.isEmpty()) { + const MIMEToDescriptionsMap& mimeToDescriptions = m_package->mimeToDescriptions(); + MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end(); - QList<MimeType> mimeTypes; - const MIMEToDescriptionsMap& mimeToDescriptions = d->plugin->mimeToDescriptions(); - MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end(); - for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) { - MimeType mimeType; - mimeType.name = it->first; - mimeType.description = it->second; + for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) { + MimeType mimeType; + mimeType.name = it->first; + mimeType.description = it->second; - QStringList fileExtensions; - Vector<String> extensions = d->plugin->mimeToExtensions().get(mimeType.name); + QStringList fileExtensions; + Vector<String> extensions = m_package->mimeToExtensions().get(mimeType.name); - for (unsigned i = 0; i < extensions.size(); ++i) - fileExtensions.append(extensions[i]); + for (unsigned i = 0; i < extensions.size(); ++i) + fileExtensions.append(extensions[i]); - mimeType.fileExtensions = fileExtensions; - mimeTypes.append(mimeType); + mimeType.fileExtensions = fileExtensions; + m_mimeTypes.append(mimeType); + } } - return mimeTypes; + return m_mimeTypes; } /*! @@ -152,13 +145,9 @@ QList<QWebPluginInfo::MimeType> QWebPluginInfo::mimeTypes() const */ bool QWebPluginInfo::supportsMimeType(const QString& mimeType) const { - QList<MimeType> types = mimeTypes(); - foreach (const MimeType& type, types) { - if (type.name == mimeType) - return true; - } - - return false; + if (!m_package) + return false; + return m_package->mimeToDescriptions().contains(mimeType); } /*! @@ -166,9 +155,9 @@ bool QWebPluginInfo::supportsMimeType(const QString& mimeType) const */ QString QWebPluginInfo::path() const { - if (!d->plugin) + if (!m_package) return QString(); - return d->plugin->path(); + return m_package->path(); } /*! @@ -176,7 +165,7 @@ QString QWebPluginInfo::path() const */ bool QWebPluginInfo::isNull() const { - return !d->plugin; + return !m_package; } /*! @@ -189,9 +178,9 @@ bool QWebPluginInfo::isNull() const */ void QWebPluginInfo::setEnabled(bool enabled) { - if (!d->plugin) + if (!m_package) return; - d->plugin->setEnabled(enabled); + m_package->setEnabled(enabled); } /*! @@ -201,27 +190,43 @@ void QWebPluginInfo::setEnabled(bool enabled) */ bool QWebPluginInfo::isEnabled() const { - if (!d->plugin) + if (!m_package) return false; - return d->plugin->isEnabled(); + return m_package->isEnabled(); } +/*! + Returns true if this plugin info is the same as the \a other plugin info. +*/ bool QWebPluginInfo::operator==(const QWebPluginInfo& other) const { - return d->plugin == other.d->plugin; + return m_package == other.m_package; } +/*! + Returns true if this plugin info is different from the \a other plugin info. +*/ bool QWebPluginInfo::operator!=(const QWebPluginInfo& other) const { - return d->plugin != other.d->plugin; + return m_package != other.m_package; } +/*! + Assigns the \a other plugin info to this plugin info, and returns a reference + to this plugin info. +*/ QWebPluginInfo &QWebPluginInfo::operator=(const QWebPluginInfo& other) { if (this == &other) return *this; - d->plugin = other.d->plugin; + if (m_package) + m_package->deref(); + m_package = other.m_package; + if (m_package) + m_package->ref(); + m_mimeTypes = other.m_mimeTypes; + return *this; } @@ -253,13 +258,12 @@ QWebPluginInfo &QWebPluginInfo::operator=(const QWebPluginInfo& other) QWebPluginDatabase::QWebPluginDatabase(QObject* parent) : QObject(parent) - , d(new QWebPluginDatabasePrivate(PluginDatabase::installedPlugins())) + , m_database(PluginDatabase::installedPlugins()) { } QWebPluginDatabase::~QWebPluginDatabase() { - delete d; } /*! @@ -273,7 +277,7 @@ QWebPluginDatabase::~QWebPluginDatabase() QList<QWebPluginInfo> QWebPluginDatabase::plugins() const { QList<QWebPluginInfo> qwebplugins; - const Vector<PluginPackage*>& plugins = d->database->plugins(); + const Vector<PluginPackage*>& plugins = m_database->plugins(); for (unsigned int i = 0; i < plugins.size(); ++i) { PluginPackage* plugin = plugins[i]; @@ -308,7 +312,7 @@ QStringList QWebPluginDatabase::searchPaths() const { QStringList paths; - const Vector<String>& directories = d->database->pluginDirectories(); + const Vector<String>& directories = m_database->pluginDirectories(); for (unsigned int i = 0; i < directories.size(); ++i) paths.append(directories[i]); @@ -325,12 +329,12 @@ void QWebPluginDatabase::setSearchPaths(const QStringList& paths) { Vector<String> directories; - for (unsigned int i = 0; i < paths.count(); ++i) + for (int i = 0; i < paths.count(); ++i) directories.append(paths.at(i)); - d->database->setPluginDirectories(directories); + m_database->setPluginDirectories(directories); // PluginDatabase::setPluginDirectories() does not refresh the database. - d->database->refresh(); + m_database->refresh(); } /*! @@ -341,7 +345,7 @@ void QWebPluginDatabase::setSearchPaths(const QStringList& paths) */ void QWebPluginDatabase::addSearchPath(const QString& path) { - d->database->addExtraPluginDirectory(path); + m_database->addExtraPluginDirectory(path); // PluginDatabase::addExtraPluginDirectory() does refresh the database. } @@ -355,7 +359,7 @@ void QWebPluginDatabase::addSearchPath(const QString& path) */ void QWebPluginDatabase::refresh() { - d->database->refresh(); + m_database->refresh(); } /*! @@ -365,7 +369,7 @@ void QWebPluginDatabase::refresh() */ QWebPluginInfo QWebPluginDatabase::pluginForMimeType(const QString& mimeType) { - return QWebPluginInfo(d->database->pluginForMIMEType(mimeType)); + return QWebPluginInfo(m_database->pluginForMIMEType(mimeType)); } /*! @@ -378,5 +382,5 @@ QWebPluginInfo QWebPluginDatabase::pluginForMimeType(const QString& mimeType) */ void QWebPluginDatabase::setPreferredPluginForMimeType(const QString& mimeType, const QWebPluginInfo& plugin) { - d->database->setPreferredPluginForMIMEType(mimeType, plugin.d->plugin.get()); + m_database->setPreferredPluginForMIMEType(mimeType, plugin.m_package); } diff --git a/WebKit/qt/Api/qwebplugindatabase.h b/WebKit/qt/Api/qwebplugindatabase.h index 4b50119..b22c3de 100644 --- a/WebKit/qt/Api/qwebplugindatabase.h +++ b/WebKit/qt/Api/qwebplugindatabase.h @@ -27,6 +27,7 @@ #include <QtCore/qstringlist.h> namespace WebCore { + class PluginDatabase; class PluginPackage; } @@ -39,7 +40,7 @@ public: ~QWebPluginInfo(); private: - QWebPluginInfo(WebCore::PluginPackage* plugin); + QWebPluginInfo(WebCore::PluginPackage* package); public: typedef QWebPluginFactory::MimeType MimeType; @@ -61,7 +62,9 @@ public: friend class QWebPluginDatabase; private: - QWebPluginInfoPrivate *d; + QWebPluginInfoPrivate* d; + WebCore::PluginPackage* m_package; + mutable QList<MimeType> m_mimeTypes; }; class QWebPluginDatabasePrivate; @@ -88,7 +91,8 @@ public: friend class QWebSettings; private: - QWebPluginDatabasePrivate *d; + QWebPluginDatabasePrivate* d; + WebCore::PluginDatabase* m_database; }; #endif // QWEBPLUGINDATABASE_H diff --git a/WebKit/qt/Api/qwebpluginfactory.cpp b/WebKit/qt/Api/qwebpluginfactory.cpp index 7a8cabe..8ff13b1 100644 --- a/WebKit/qt/Api/qwebpluginfactory.cpp +++ b/WebKit/qt/Api/qwebpluginfactory.cpp @@ -26,6 +26,8 @@ \brief The QWebPluginFactory class creates plugins to be embedded into web pages. + \inmodule QtWebKit + QWebPluginFactory is a factory for creating plugins for QWebPage. A plugin factory can be installed on a QWebPage using QWebPage::setPluginFactory(). @@ -47,6 +49,8 @@ \class QWebPluginFactory::Plugin \since 4.4 \brief the QWebPluginFactory::Plugin structure describes the properties of a plugin a QWebPluginFactory can create. + + \inmodule QtWebKit */ /*! @@ -68,8 +72,13 @@ \class QWebPluginFactory::MimeType \since 4.4 \brief The QWebPluginFactory::MimeType structure describes a mime type supported by a plugin. + + \inmodule QtWebKit */ +/*! + Returns true if this mimetype is the same as the \a other mime type. +*/ bool QWebPluginFactory::MimeType::operator==(const MimeType& other) const { return name == other.name @@ -78,6 +87,12 @@ bool QWebPluginFactory::MimeType::operator==(const MimeType& other) const } /*! + \fn bool QWebPluginFactory::MimeType::operator!=(const MimeType& other) const + + Returns true if this mimetype is different from the \a other mime type. +*/ + +/*! \variable QWebPluginFactory::MimeType::name The full name of the MIME type; e.g., \c{text/plain} or \c{image/png}. @@ -143,7 +158,7 @@ void QWebPluginFactory::refreshPlugins() For example: \code - <object type="application/x-pdf" data="http://qtsoftware.com/document.pdf" width="500" height="400"> + <object type="application/x-pdf" data="http://qt.nokia.com/document.pdf" width="500" height="400"> <param name="showTableOfContents" value="true" /> <param name="hideThumbnails" value="false" /> </object> @@ -156,7 +171,7 @@ void QWebPluginFactory::refreshPlugins() \row \o mimeType \o "application/x-pdf" \row \o url - \o "http://qtsoftware.com/document.pdf" + \o "http://qt.nokia.com/document.pdf" \row \o argumentNames \o "showTableOfContents" "hideThumbnails" \row \o argumentVaues @@ -180,6 +195,8 @@ void QWebPluginFactory::refreshPlugins() \since 4.4 \brief The ExtensionOption class provides an extended input argument to QWebPluginFactory's extension support. + \inmodule QtWebKit + \sa QWebPluginFactory::extension() */ @@ -188,6 +205,8 @@ void QWebPluginFactory::refreshPlugins() \since 4.4 \brief The ExtensionOption class provides an extended output argument to QWebPluginFactory's extension support. + \inmodule QtWebKit + \sa QWebPluginFactory::extension() */ diff --git a/WebKit/qt/Api/qwebsecurityorigin.cpp b/WebKit/qt/Api/qwebsecurityorigin.cpp index d2eaf10..7c44e37 100644 --- a/WebKit/qt/Api/qwebsecurityorigin.cpp +++ b/WebKit/qt/Api/qwebsecurityorigin.cpp @@ -35,6 +35,8 @@ using namespace WebCore; \since 4.5 \brief The QWebSecurityOrigin class defines a security boundary for web sites. + \inmodule QtWebKit + QWebSecurityOrigin provides access to the security domains defined by web sites. An origin consists of a host name, a scheme, and a port number. Web sites with the same security origin can access each other's resources for client-side @@ -198,3 +200,60 @@ QList<QWebDatabase> QWebSecurityOrigin::databases() const return databases; } +/*! + \since 4.6 + + Adds the given \a scheme to the list of schemes that are considered equivalent + to the \c file: scheme. They are not subject to cross domain restrictions. +*/ +void QWebSecurityOrigin::addLocalScheme(const QString& scheme) +{ + SecurityOrigin::registerURLSchemeAsLocal(scheme); +} + +/*! + \since 4.6 + + Removes the given \a scheme from the list of local schemes. + + \sa addLocalScheme() +*/ +void QWebSecurityOrigin::removeLocalScheme(const QString& scheme) +{ + SecurityOrigin::removeURLSchemeRegisteredAsLocal(scheme); +} + +/*! + \since 4.6 + Returns a list of all the schemes that were set by the application as local schemes, + \sa addLocalScheme(), removeLocalScheme() +*/ +QStringList QWebSecurityOrigin::localSchemes() +{ + QStringList list; + const URLSchemesMap& map = SecurityOrigin::localURLSchemes(); + URLSchemesMap::const_iterator end = map.end(); + for (URLSchemesMap::const_iterator i = map.begin(); i != end; ++i) { + const QString scheme = *i; + list.append(scheme); + } + return list; +} + +/*! + \since 4.6 + \internal +*/ +void QWebSecurityOrigin::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) +{ + SecurityOrigin::whiteListAccessFromOrigin(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains); +} + +/*! + \since 4.6 + \internal +*/ +void QWebSecurityOrigin::resetOriginAccessWhiteLists() +{ + SecurityOrigin::resetOriginAccessWhiteLists(); +} diff --git a/WebKit/qt/Api/qwebsecurityorigin.h b/WebKit/qt/Api/qwebsecurityorigin.h index 3cfb0f4..94b96f0 100644 --- a/WebKit/qt/Api/qwebsecurityorigin.h +++ b/WebKit/qt/Api/qwebsecurityorigin.h @@ -37,6 +37,11 @@ class QWebFrame; class QWEBKIT_EXPORT QWebSecurityOrigin { public: static QList<QWebSecurityOrigin> allOrigins(); + static void addLocalScheme(const QString& scheme); + static void removeLocalScheme(const QString& scheme); + static QStringList localSchemes(); + static void whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); + static void resetOriginAccessWhiteLists(); ~QWebSecurityOrigin(); diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index 47b2818..abd7036 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -37,7 +37,11 @@ #include "IntSize.h" #include "ApplicationCacheStorage.h" #include "DatabaseTracker.h" +#include "FileSystem.h" +#include <QApplication> +#include <QDesktopServices> +#include <QDir> #include <QHash> #include <QSharedData> #include <QUrl> @@ -55,7 +59,7 @@ public: QHash<int, bool> attributes; QUrl userStyleSheetLocation; QString defaultTextEncoding; - QString localStorageDatabasePath; + QString localStoragePath; QString offlineWebApplicationCachePath; qint64 offlineStorageDefaultQuota; @@ -167,8 +171,8 @@ void QWebSettingsPrivate::apply() QString encoding = !defaultTextEncoding.isEmpty() ? defaultTextEncoding: global->defaultTextEncoding; settings->setDefaultTextEncodingName(encoding); - QString localStoragePath = !localStorageDatabasePath.isEmpty() ? localStorageDatabasePath : global->localStorageDatabasePath; - settings->setLocalStorageDatabasePath(localStoragePath); + QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath; + settings->setLocalStorageDatabasePath(storagePath); value = attributes.value(QWebSettings::ZoomTextOnly, global->attributes.value(QWebSettings::ZoomTextOnly)); @@ -186,13 +190,18 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled)); settings->setOfflineWebApplicationCacheEnabled(value); - value = attributes.value(QWebSettings::LocalStorageDatabaseEnabled, - global->attributes.value(QWebSettings::LocalStorageDatabaseEnabled)); + value = attributes.value(QWebSettings::LocalStorageEnabled, + global->attributes.value(QWebSettings::LocalStorageEnabled)); + settings->setLocalStorageEnabled(value); value = attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls, global->attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls)); settings->setAllowUniversalAccessFromFileURLs(value); + + value = attributes.value(QWebSettings::SessionStorageEnabled, + global->attributes.value(QWebSettings::SessionStorageEnabled)); + settings->setSessionStorageEnabled(value); } else { QList<QWebSettingsPrivate*> settings = *::allSettings(); for (int i = 0; i < settings.count(); ++i) @@ -220,6 +229,8 @@ QWebSettings* QWebSettings::globalSettings() \brief The QWebSettings class provides an object to store the settings used by QWebPage and QWebFrame. + \inmodule QtWebKit + Each QWebPage object has its own QWebSettings object, which configures the settings for that page. If a setting is not configured, then it is looked up in the global settings object, which can be accessed using @@ -302,6 +313,8 @@ QWebSettings* QWebSettings::globalSettings() \value AutoLoadImages Specifies whether images are automatically loaded in web pages. + \value DnsPrefetchEnabled Specifies whether QtWebkit will try to pre-fetch DNS entries to + speed up browsing. This only works as a global attribute. Only for Qt 4.6 and later. \value JavascriptEnabled Enables or disables the running of JavaScript programs. \value JavaEnabled Enables or disables Java applets. @@ -314,8 +327,9 @@ QWebSettings* QWebSettings::globalSettings() \value JavascriptCanAccessClipboard Specifies whether JavaScript programs can read or write to the clipboard. \value DeveloperExtrasEnabled Enables extra tools for Web developers. - Currently this enables the "Inspect" element in the context menu, - which shows the WebKit WebInspector for web site debugging. + Currently this enables the "Inspect" element in the context menu as + well as the use of QWebInspector which controls the WebKit WebInspector + for web site debugging. \value LinksIncludedInFocusChain Specifies whether hyperlinks should be included in the keyboard focus chain. \value ZoomTextOnly Specifies whether the zoom factor on a frame applies to @@ -323,12 +337,14 @@ QWebSettings* QWebSettings::globalSettings() \value PrintElementBackgrounds Specifies whether the background color and images are also drawn when the page is printed. \value OfflineStorageDatabaseEnabled Specifies whether support for the HTML 5 - offline storage feature is enabled or not. + offline storage feature is enabled or not. Disabled by default. \value OfflineWebApplicationCacheEnabled Specifies whether support for the HTML 5 - web application cache feature is enabled or not. - \value LocalStorageDatabaseEnabled Specifies whether support for the HTML 5 - local storage feature is enabled or not. + web application cache feature is enabled or not. Disabled by default. + \value LocalStorageEnabled Specifies whether support for the HTML 5 + local storage feature is enabled or not. Disabled by default. \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are allowed to access remote urls. + \value SessionStorageEnabled Specifies whether support for the HTML 5 + session storage feature is enabled or not. Enabled by default. */ /*! @@ -340,8 +356,8 @@ QWebSettings::QWebSettings() // Initialize our global defaults d->fontSizes.insert(QWebSettings::MinimumFontSize, 0); d->fontSizes.insert(QWebSettings::MinimumLogicalFontSize, 0); - d->fontSizes.insert(QWebSettings::DefaultFontSize, 14); - d->fontSizes.insert(QWebSettings::DefaultFixedFontSize, 14); + d->fontSizes.insert(QWebSettings::DefaultFontSize, 16); + d->fontSizes.insert(QWebSettings::DefaultFixedFontSize, 13); d->fontFamilies.insert(QWebSettings::StandardFont, QLatin1String("Arial")); d->fontFamilies.insert(QWebSettings::FixedFont, QLatin1String("Courier New")); d->fontFamilies.insert(QWebSettings::SerifFont, QLatin1String("Times New Roman")); @@ -350,14 +366,16 @@ QWebSettings::QWebSettings() d->fontFamilies.insert(QWebSettings::FantasyFont, QLatin1String("Arial")); d->attributes.insert(QWebSettings::AutoLoadImages, true); + d->attributes.insert(QWebSettings::DnsPrefetchEnabled, false); d->attributes.insert(QWebSettings::JavascriptEnabled, true); d->attributes.insert(QWebSettings::LinksIncludedInFocusChain, true); d->attributes.insert(QWebSettings::ZoomTextOnly, false); d->attributes.insert(QWebSettings::PrintElementBackgrounds, true); - d->attributes.insert(QWebSettings::OfflineStorageDatabaseEnabled, true); - d->attributes.insert(QWebSettings::OfflineWebApplicationCacheEnabled, true); - d->attributes.insert(QWebSettings::LocalStorageDatabaseEnabled, true); - d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, true); + d->attributes.insert(QWebSettings::OfflineStorageDatabaseEnabled, false); + d->attributes.insert(QWebSettings::OfflineWebApplicationCacheEnabled, false); + d->attributes.insert(QWebSettings::LocalStorageEnabled, false); + d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, false); + d->attributes.insert(QWebSettings::SessionStorageEnabled, true); d->offlineStorageDefaultQuota = 5 * 1024 * 1024; } @@ -422,7 +440,10 @@ void QWebSettings::resetFontSize(FontSize type) /*! Specifies the location of a user stylesheet to load with every web page. - The \a location can be a URL or a path on the local filesystem. + The \a location must be either a path on the local filesystem, or a data URL + with UTF-8 and Base64 encoded data, such as: + + "data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow==;" \sa userStyleSheetUrl() */ @@ -607,17 +628,20 @@ void QWebSettings::clearMemoryCaches() // Invalidating the font cache and freeing all inactive font data. WebCore::fontCache()->invalidate(); -#if ENABLE(OFFLINE_WEB_APPLICATIONS) - // Empty the application cache. - WebCore::cacheStorage().empty(); -#endif - // Empty the Cross-Origin Preflight cache WebCore::CrossOriginPreflightResultCache::shared().empty(); } /*! - Sets the maximum number of pages to hold in the memory cache to \a pages. + Sets the maximum number of pages to hold in the memory page cache to \a pages. + + The Page Cache allows for a nicer user experience when navigating forth or back + to pages in the forward/back history, by pausing and resuming up to \a pages + per page group. + + For more information about the feature, please refer to: + + http://webkit.org/blog/427/webkit-page-cache-i-the-basics/ */ void QWebSettings::setMaximumPagesInCache(int pages) { @@ -867,37 +891,71 @@ qint64 QWebSettings::offlineWebApplicationCacheQuota() #endif } -/* - \since 4.5 +/*! + \since 4.6 \relates QWebSettings - Sets the path for HTML5 local storage databases to \a path. - - \a path must point to an existing directory where the cache is stored. - - Setting an empty path disables the feature. + Sets the path for HTML5 local storage to \a path. + + For more information on HTML5 local storage see the + \l{http://www.w3.org/TR/webstorage/#the-localstorage-attribute}{Web Storage standard}. + + Support for local storage can enabled by setting the + \l{QWebSettings::LocalStorageEnabled}{LocalStorageEnabled} attribute. - \sa localStorageDatabasePath() + \sa localStoragePath() */ -void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path) +void QWebSettings::setLocalStoragePath(const QString& path) { - QWebSettingsPrivate* d = settings->handle(); - d->localStorageDatabasePath = path; + d->localStoragePath = path; d->apply(); } -/* - \since 4.5 +/*! + \since 4.6 \relates QWebSettings - Returns the path for HTML5 local storage databases - or an empty string if the feature is disabled. + Returns the path for HTML5 local storage. + + \sa setLocalStoragePath() +*/ +QString QWebSettings::localStoragePath() const +{ + return d->localStoragePath; +} - \sa setLocalStorageDatabasePath() +/*! + \since 4.6 + \relates QWebSettings + + Enables WebKit persistent data and sets the path to \a path. + If the \a path is empty the path for persistent data is set to the + user-specific data location specified by + \l{QDesktopServices::DataLocation}{DataLocation}. + + \sa localStoragePath() */ -QString QWEBKIT_EXPORT qt_websettings_localStorageDatabasePath(QWebSettings* settings) +void QWebSettings::enablePersistentStorage(const QString& path) { - return settings->handle()->localStorageDatabasePath; + QString storagePath; + + if (path.isEmpty()) { + storagePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); + + if (storagePath.isEmpty()) + storagePath = WebCore::pathByAppendingComponent(QDir::homePath(), QCoreApplication::applicationName()); + } else + storagePath = path; + + WebCore::makeAllDirectories(storagePath); + + QWebSettings::setIconDatabasePath(storagePath); + QWebSettings::setOfflineWebApplicationCachePath(storagePath); + QWebSettings::setOfflineStoragePath(WebCore::pathByAppendingComponent(storagePath, "Databases")); + QWebSettings::globalSettings()->setLocalStoragePath(WebCore::pathByAppendingComponent(storagePath, "LocalStorage")); + QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true); + QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); + QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true); } /*! diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h index b7ea54b..4790823 100644 --- a/WebKit/qt/Api/qwebsettings.h +++ b/WebKit/qt/Api/qwebsettings.h @@ -62,8 +62,13 @@ public: PrintElementBackgrounds, OfflineStorageDatabaseEnabled, OfflineWebApplicationCacheEnabled, - LocalStorageDatabaseEnabled, - LocalContentCanAccessRemoteUrls + LocalStorageEnabled, +#ifdef QT_DEPRECATED + LocalStorageDatabaseEnabled = LocalStorageEnabled, +#endif + LocalContentCanAccessRemoteUrls, + SessionStorageEnabled, + DnsPrefetchEnabled }; enum WebGraphic { MissingImageGraphic, @@ -121,9 +126,14 @@ public: static QString offlineWebApplicationCachePath(); static void setOfflineWebApplicationCacheQuota(qint64 maximumSize); static qint64 offlineWebApplicationCacheQuota(); + + void setLocalStoragePath(const QString& path); + QString localStoragePath() const; static void clearMemoryCaches(); + static void enablePersistentStorage(const QString& path = QString()); + inline QWebSettingsPrivate* handle() const { return d; } private: diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp index e1a0c98..ce8b923 100644 --- a/WebKit/qt/Api/qwebview.cpp +++ b/WebKit/qt/Api/qwebview.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "qwebview.h" + +#include "QWebPageClient.h" #include "qwebframe.h" #include "qwebpage_p.h" @@ -29,46 +31,91 @@ #include "qprinter.h" #include "qdir.h" #include "qfile.h" +#if defined(Q_WS_X11) +#include <QX11Info> +#endif -class QWebViewPrivate { +class QWebViewPrivate : public QWebPageClient { public: QWebViewPrivate(QWebView *view) : view(view) , page(0) , renderHints(QPainter::TextAntialiasing) + { + Q_ASSERT(view); + } + + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + #ifndef QT_NO_CURSOR - , cursorSetByWebCore(false) - , usesWebCoreCursor(true) + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); #endif - {} + + virtual int screenNumber() const; + virtual WId winId() const; + + virtual QObject* pluginParent() const; + + void _q_pageDestroyed(); QWebView *view; QWebPage *page; QPainter::RenderHints renderHints; +}; + +void QWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) +{ + view->scroll(qreal(dx), qreal(dy), rectToScroll); +} + +void QWebViewPrivate::update(const QRect & dirtyRect) +{ + view->update(dirtyRect); +} #ifndef QT_NO_CURSOR - /* - * We keep track of if we have called setCursor and if the CursorChange - * event is sent due our setCursor call and if we currently use the WebCore - * Cursor and use it to decide if we can update to another WebCore Cursor. - */ - bool cursorSetByWebCore; - bool usesWebCoreCursor; - - void setCursor(const QCursor& newCursor) - { - webCoreCursor = newCursor; +QCursor QWebViewPrivate::cursor() const +{ + return view->cursor(); +} - if (usesWebCoreCursor) { - cursorSetByWebCore = true; - view->setCursor(webCoreCursor); - } - } +void QWebViewPrivate::updateCursor(const QCursor& cursor) +{ + view->setCursor(cursor); +} +#endif - QCursor webCoreCursor; +int QWebViewPrivate::screenNumber() const +{ +#if defined(Q_WS_X11) + if (view) + return view->x11Info().screen(); #endif -}; + + return 0; +} + +WId QWebViewPrivate::winId() const +{ + if (view) + return view->winId(); + + return 0; +} + +QObject* QWebViewPrivate::pluginParent() const +{ + return view; +} + +void QWebViewPrivate::_q_pageDestroyed() +{ + page = 0; + view->setPage(0); +} /*! \class QWebView @@ -77,6 +124,8 @@ public: web documents. \ingroup advanced + \inmodule QtWebKit + QWebView is the main widget component of the QtWebKit web browsing module. It can be used in various applications to display web content live from the Internet. @@ -160,7 +209,7 @@ QWebView::QWebView(QWidget *parent) { d = new QWebViewPrivate(this); -#if !defined(Q_WS_QWS) +#if !defined(Q_WS_QWS) && !defined(Q_OS_SYMBIAN) setAttribute(Qt::WA_InputMethodEnabled); #endif @@ -211,6 +260,7 @@ void QWebView::setPage(QWebPage* page) if (d->page == page) return; if (d->page) { + d->page->d->client = 0; // unset the page client if (d->page->parent() == this) delete d->page; else @@ -219,6 +269,7 @@ void QWebView::setPage(QWebPage* page) d->page = page; if (d->page) { d->page->setView(this); + d->page->d->client = d; // set the page client d->page->setPalette(palette()); // #### connect signals QWebFrame *mainFrame = d->page->mainFrame(); @@ -242,6 +293,8 @@ void QWebView::setPage(QWebPage* page) connect(d->page, SIGNAL(microFocusChanged()), this, SLOT(updateMicroFocus())); + connect(d->page, SIGNAL(destroyed()), + this, SLOT(_q_pageDestroyed())); } setAttribute(Qt::WA_OpaquePaintEvent, d->page); update(); @@ -608,6 +661,7 @@ qreal QWebView::textSizeMultiplier() const return page()->mainFrame()->textSizeMultiplier(); } +#if !defined(Q_OS_SYMBIAN) /*! \property QWebView::renderHints \since 4.6 @@ -619,6 +673,7 @@ qreal QWebView::textSizeMultiplier() const \sa QPainter::renderHints() */ +#endif QPainter::RenderHints QWebView::renderHints() const { return d->renderHints; @@ -694,19 +749,18 @@ bool QWebView::event(QEvent *e) if (e->type() == QEvent::ShortcutOverride) { d->page->event(e); #ifndef QT_NO_CURSOR - } else if (e->type() == static_cast<QEvent::Type>(WebCore::SetCursorEvent::EventType)) { - d->setCursor(static_cast<WebCore::SetCursorEvent*>(e)->cursor()); #if QT_VERSION >= 0x040400 } else if (e->type() == QEvent::CursorChange) { - // Okay we might use the WebCore Cursor now. - d->usesWebCoreCursor = d->cursorSetByWebCore; - d->cursorSetByWebCore = false; - - // Go back to the WebCore Cursor. QWidget::unsetCursor is appromixated with this - if (!d->usesWebCoreCursor && cursor().shape() == Qt::ArrowCursor) { - d->usesWebCoreCursor = true; - d->setCursor(d->webCoreCursor); - } + // An unsetCursor will set the cursor to Qt::ArrowCursor. + // Thus this cursor change might be a QWidget::unsetCursor() + // If this is not the case and it came from WebCore, the + // QWebPageClient already has set its cursor internally + // to Qt::ArrowCursor, so updating the cursor is always + // right, as it falls back to the last cursor set by + // WebCore. + // FIXME: Add a QEvent::CursorUnset or similar to Qt. + if (cursor().shape() == Qt::ArrowCursor) + d->resetCursor(); #endif #endif } else if (e->type() == QEvent::Leave) @@ -1094,3 +1148,6 @@ void QWebView::changeEvent(QEvent *e) \sa QWebPage::linkDelegationPolicy() */ + +#include "moc_qwebview.cpp" + diff --git a/WebKit/qt/Api/qwebview.h b/WebKit/qt/Api/qwebview.h index e886144..15b5836 100644 --- a/WebKit/qt/Api/qwebview.h +++ b/WebKit/qt/Api/qwebview.h @@ -50,7 +50,14 @@ class QWEBKIT_EXPORT QWebView : public QWidget { //Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) Q_PROPERTY(qreal textSizeMultiplier READ textSizeMultiplier WRITE setTextSizeMultiplier DESIGNABLE false) Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) + +// FIXME: temporary work around for elftran issue that it couldn't find the QPainter::staticMetaObject +// symbol from Qt lib; it should be reverted after the right symbol is exported. +// remember to revert the qdoc \property comment as well. +// See bug: http://qt.nokia.com/developer/task-tracker/index_html?method=entry&id=258893 +#if !defined(Q_OS_SYMBIAN) Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints) +#endif Q_FLAGS(QPainter::RenderHints) public: explicit QWebView(QWidget* parent = 0); @@ -162,6 +169,7 @@ protected: private: friend class QWebPage; QWebViewPrivate* d; + Q_PRIVATE_SLOT(d, void _q_pageDestroyed()) }; #endif // QWEBVIEW_H diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 6b05b18..5aff018 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,1689 @@ +2009-10-08 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + Part of testOptionalJSObjects autotest was marked as "expect to fail". + + Two places in tst_QWebPage::testOptionalJSObjects were marked as + expected to fail. The problem concern checking if a feature is enabled + or disabled. According to discussion on webkit dev mailing list + a disabled feature should be invisible from java script level, but + there are exceptions from the rule. So we decided to disable the test + for now. + + https://bugs.webkit.org/show_bug.cgi?id=29867 + + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::testOptionalJSObjects): + +2009-10-07 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Factor PolicyChecker out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=30155 + + Move the policy callback to the policy object. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::callPolicyFunction): + +2009-10-07 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Get rid of useless loadFailed signal in QGraphicsWebView + https://bugs.webkit.org/show_bug.cgi?id=30166 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::_q_doLoadFinished): + * Api/qgraphicswebview.h: + * QGVLauncher/main.cpp: + (MainWindow::init): + (MainWindow::loadFinished): + +2009-10-07 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Simon Hausmann. + + Add a simple rotation effect to QGVLauncher + + https://bugs.webkit.org/show_bug.cgi?id=30162 + + * QGVLauncher/main.cpp: + (MainView::animatedFlip): + (MainWindow::animatedFlip): + (MainWindow::buildUI): + +2009-10-07 Volker Hilsheimer <volker.hilsheimer@nokia.com> + + Reviewed by Simon Hausmann. + + Doc: Document HTML and status as properties. + + * Api/qgraphicswebview.cpp: + +2009-10-07 Martin Smith <msmith@trolltech.com> + + Reviewed by Simon Hausmann. + + Fix qdoc warning about disabled renderHints property + on Symbian. + + * Api/qwebview.cpp: + * Api/qwebview.h: + +2009-10-06 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move setLocalLoadPolicy and friends to SecurityOrigin + https://bugs.webkit.org/show_bug.cgi?id=30110 + + Call the new API. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + +2009-10-06 Benjamin C Meyer <bmeyer@rim.com> + + Reviewed by Ariya Hidayat. + + When the drag data contains an image set it on the QDrag so it will be visible to the user. + + * WebCoreSupport/DragClientQt.cpp: + (WebCore::DragClientQt::startDrag): + +2009-10-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: close inspector client view on + InspectorController::close API call. + + In order to run batch web inspector layout tests (and not affect + subsequent tests) we should close inspector client's view upon + InspectorController::close API call. + + https://bugs.webkit.org/show_bug.cgi?id=30009 + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::createPage): + +2009-10-06 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Simon Hausmann. + + [Qt] don't enable input methods on Symbian by default. + https://bugs.webkit.org/show_bug.cgi?id=30117 + + If input methods are enabled Symbian FEP will be launched on every + pointer event making webpage navigation impossible with QWebView. + + * Api/qwebview.cpp: + (QWebView::QWebView): + +2009-10-05 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Hausmann. + + QtLauncher: print the number of loaded urls + + When using the -r mode print the number of URLs loaded so far. This + is extremly useful when opening the same URL over and over again and + one wants to see the progress. + + * QtLauncher/main.cpp: + (URLLoader::URLLoader): + (URLLoader::loadNext): + +2009-10-05 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Simon Hausmann. + + Add screenshot option to menubar + + https://bugs.webkit.org/show_bug.cgi?id=30067 + + * QtLauncher/main.cpp: + (MainWindow::screenshot): + (MainWindow::setupUI): + +2009-10-05 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Simon Hausmann. + + Setting the env QTLAUNCHER_USE_ARGB_VISUALS makes Qt use WA_TranslucentWindow. + + https://bugs.webkit.org/show_bug.cgi?id=30068 + + * QtLauncher/main.cpp: + (MainWindow::MainWindow): + +2009-10-05 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Rubberstamped by Simon Hausmann. + + Add documentation to the ErrorPageExtension. + + * Api/qwebpage.cpp: + +2009-10-02 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Inform the application when a new request is created + https://bugs.webkit.org/show_bug.cgi?id=29975 + + Add a signal to QWebPage, to inform the application when a request is created. + + * Api/qwebpage.cpp: + * Api/qwebpage.h: + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::loadFinished): + +2009-10-05 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + ErrorPageExtension: Add a pointer to the QWebFrame that had + an error. + + * Api/qwebpage.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::callErrorPageExtension): + +2009-10-05 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Do not empty the offline web appcache when clearing + memory caches. That one is not in memory, but stored + in sqlite. + + * Api/qwebsettings.cpp: + (QWebSettings::clearMemoryCaches): + +2009-10-05 J-P Nurmi <jpnurmi@gmail.com> + + Reviewed by Simon Hausmann. + + Added QGraphicsWidget-plugins support to FrameLoaderClientQt. + + https://bugs.webkit.org/show_bug.cgi?id=29710 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::pluginParent): + * Api/qwebview.cpp: + (QWebViewPrivate::pluginParent): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::): + (WebCore::FrameLoaderClientQt::createPlugin): + +2009-10-03 Adam Barth <abarth@webkit.org> + + Unreview build fix. I wish I had a try server... + + * Api/qwebpage.cpp: + (QWebPagePrivate::updateAction): + +2009-10-02 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Simon Hausmann. + + Conditionally guard cursor code (cursor and updateCursor functions) with !QT_NO_CURSOR. + Otherwise, it is inconsistent with class declaration of QCursor. + + * Api/qgraphicswebview.cpp: + * Api/qwebview.cpp: + +2009-10-02 Prasanth Ullattil <prasanth.ullattil@nokia.com> + + Reviewed by Simon Hausmann. + + Fix compiler warnings about unused function arguments. + + * Api/qwebframe.cpp: + (QWebFrame::scrollBarMinimum): + * Api/qwebpage.cpp: + (QWebPagePrivate::focusInEvent): + (QWebPagePrivate::focusOutEvent): + (QWebPagePrivate::leaveEvent): + (QWebPage::javaScriptAlert): + (QWebPage::javaScriptConfirm): + (QWebPage::javaScriptPrompt): + (QWebPage::triggerAction): + (QWebPage::acceptNavigationRequest): + (QWebPage::chooseFile): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::repaint): + (WebCore::ChromeClientQt::mouseDidMoveOverElement): + (WebCore::ChromeClientQt::reachedMaxAppCacheSize): + * WebCoreSupport/ContextMenuClientQt.cpp: + (WebCore::ContextMenuClientQt::downloadURL): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchWillPerformClientRedirect): + (WebCore::FrameLoaderClientQt::setMainFrameDocumentReady): + (WebCore::FrameLoaderClientQt::representationExistsForURLScheme): + (WebCore::FrameLoaderClientQt::generatedMIMETypeForURLScheme): + (WebCore::FrameLoaderClientQt::shouldGoToHistoryItem): + (WebCore::FrameLoaderClientQt::pluginWillHandleLoadError): + (WebCore::FrameLoaderClientQt::assignIdentifierToInitialRequest): + (WebCore::FrameLoaderClientQt::dispatchDidFinishLoading): + (WebCore::FrameLoaderClientQt::createJavaAppletWidget): + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::setAttachedWindowHeight): + (WebCore::InspectorClientQt::highlight): + (WebCore::InspectorClientQt::removeSetting): + +2009-10-01 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Make Software Input Panel requests work with QGraphicsWebView + _and_ QWebView by sharing the event code in handleSoftwareInputPanel(). + + * Api/qwebpage.cpp: + (QWebPagePrivate::mouseReleaseEvent): + (QWebPagePrivate::handleSoftwareInputPanel): + * Api/qwebpage_p.h: + +2009-10-01 Alexis Menard <alexis.menard@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Rename QWebGraphicsItem to QGraphicsWebView + + * Api/headers.pri: + * Api/qwebpage.h: + * Api/qwebgraphicsitem.cpp: Renamed. + * Api/qwebgraphicsitem.h: Renamed. + * WebKit/qt/QGVLauncher/main.cpp: + * tests/tests.pro: + * tests/qwebgraphicsitem/qwebgraphicsitem.pro: Renamed. + * tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Renamed. + +2009-10-01 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29248 + [Qt] [API] Make it possible to have 'invisible' loads + + Make QWebFrame's setHtml and setContent methods to not change + session and global history at all. + + * Api/qwebframe.cpp: + (QWebFrame::setHtml): + (QWebFrame::setContent): + * tests/qwebframe/qwebframe.pro: + * tests/qwebframe/tst_qwebframe.cpp: + +2009-10-01 Kristian Amlie <kristian.amlie@nokia.com> + + Reviewed by Simon Hausmann. + + Fixed software input panel support on web input elements. + + Send the RequestSoftwareInputPanel event if the element supports focus + and the element is clicked. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + (QWebPagePrivate::mousePressEvent): + (QWebPagePrivate::mouseReleaseEvent): + * Api/qwebpage_p.h: + +2009-10-01 Joe Ligman <joseph.ligman@nokia.com> + + Reviewed by Simon Hausmann. + + Implementation for QWebPage::inputMethodQuery and QWebPagePrivate::inputMethodEvent + + https://bugs.webkit.org/show_bug.cgi?id=29681 + + Some additional changes from Kristian Amlie <kristian.amlie@nokia.com>: + + * Fixed surrounding text to exclude preedit string + * Avoid emission of microFocusChanged during setComposition() + + * Api/qwebpage.cpp: + (QWebPagePrivate::inputMethodEvent): + (QWebPage::inputMethodQuery): + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::respondToChangedSelection): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2009-09-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by David Hyatt. + + Add the failed URL to the ErrorPageExtension, as it is quite + useful for creating error pages. + + * Api/qwebpage.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::callErrorPageExtension): + +2009-09-29 Andras Becsi <becsi.andras@stud.u-szeged.hu> + + Reviewed by Tor Arne Vestbø. + + [Qt] Default font size reconciliation to 16px/13px to match other platform's de-facto standard. + This fixes https://bugs.webkit.org/show_bug.cgi?id=19674. + + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + +2009-09-29 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29844 + + QWebPage dependency autotest fix. + + Fix for database() autotest. All opened databases should be removed at + end of test. + + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::database): + +2009-09-29 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + Some QWebHistory and QWebPage autotest crash fixes. + + Some checking for m_mainFrame were added. MainFrame should be created + at some point of QWebPage live cicle. + + https://bugs.webkit.org/show_bug.cgi?id=29803 + + * Api/qwebpage.cpp: + (QWebPage::~QWebPage): + (QWebPage::currentFrame): + (QWebPage::history): + (QWebPage::selectedText): + (QWebPage::updatePositionDependentActions): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::crashTests_LazyInitializationOfMainFrame): + +2009-09-29 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann and Tor Arne Vestbø. + + Implement QWebPage Extension for error pages, incl. + an example on how to use it in QtLauncher. + + Correct our use of ResourceError. + + * Api/qwebpage.h: + (ExtensionOption::): + (ExtensionOption::ErrorPageExtensionReturn::ErrorPageExtensionReturn): + * QtLauncher/main.cpp: + (WebPage::supportsExtension): + (MainWindow::MainWindow): + (MainWindow::selectElements): + (WebPage::extension): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::cancelledError): + (WebCore::FrameLoaderClientQt::blockedError): + (WebCore::FrameLoaderClientQt::cannotShowURLError): + (WebCore::FrameLoaderClientQt::interruptForPolicyChangeError): + (WebCore::FrameLoaderClientQt::cannotShowMIMETypeError): + (WebCore::FrameLoaderClientQt::fileDoesNotExistError): + (WebCore::FrameLoaderClientQt::callErrorPageExtension): + (WebCore::FrameLoaderClientQt::dispatchDidFailProvisionalLoad): + (WebCore::FrameLoaderClientQt::dispatchDidFailLoad): + * WebCoreSupport/FrameLoaderClientQt.h: + +2009-09-28 Andre Poenitz <andre.poenitz@trolltech.com> + + Reviewed by Simon Hausmann. + + Compile fix with namespaced Qt. + + * Api/qwebinspector_p.h: + +2009-09-27 Joe Ligman <joseph.ligman@mindspring.com> + + Reviewed by Simon Hausmann. + + [Qt] Adding API setFocus and hasFocus to QWebElement. This API is needed for + clients that want to check/set the focus node of the document. + https://bugs.webkit.org/show_bug.cgi?id=29682 + + * Api/qwebelement.cpp: + (QWebElement::hasFocus): + (QWebElement::setFocus): + * Api/qwebelement.h: + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::hasSetFocus): + +2009-09-25 Csaba Osztrogonac <oszi@inf.u-szeged.hu> + + Reviewed by Simon Hausmann. + + [Qt] Make tst_qwebframe work if Qt built without SSL support + https://bugs.webkit.org/show_bug.cgi?id=29735 + + * tests/qwebframe/tst_qwebframe.cpp: Missing #ifndef blocks added. + +2009-09-24 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Update QWebElement API to remove script related methods. + QWebElement::evaluateScript is the only one kept, these are + removed to postpone most of the QtWebKit<->JavaScript API design + after 4.6. + https://bugs.webkit.org/show_bug.cgi?id=29708 + + * Api/qwebelement.cpp: + * Api/qwebelement.h: + Methods removed: + - QWebElement::callFunction + - QWebElement::functions + - QWebElement::scriptableProperty + - QWebElement::setScriptableProperty + - QWebElement::scriptableProperties + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::evaluateScript): + +2009-09-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Rename QWebElement::evaluateScript + to QWebElement::evaluateJavaScript. + https://bugs.webkit.org/show_bug.cgi?id=29709 + + * Api/qwebelement.cpp: + (QWebElement::evaluateJavaScript): + * Api/qwebelement.h: + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::evaluateJavaScript): + +2009-09-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Update the stypeProperty API of QWebElement. + https://bugs.webkit.org/show_bug.cgi?id=29711 + + * Api/qwebelement.cpp: + (QWebElement::styleProperty): + - Merge the stypeProperty and the computedStyleProperty methods + - Remove the default value for the style resolving enum + - Rename ResolveRule to StyleResolveStrategy + (QWebElement::setStyleProperty): + - Remove the priority argument since it is possible to control the + behaviour by adding !important or removing in the value. + * Api/qwebelement.h: + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::style): + (tst_QWebElement::computedStyle): + * tests/qwebframe/tst_qwebframe.cpp: + +2009-09-24 Jon Honeycutt <jhoneycutt@apple.com> + + Reviewed by Alice Liu. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + Pass 0 for new Page constructor argument. + +2009-09-24 Martin Smith <msmith@trolltech.com> + + Reviewed by Simon Hausmann. + + qdoc: Added \brief texts to all the since 4.6 functions. + + * Api/qwebhistory.cpp: + +2009-09-23 J-P Nurmi <jpnurmi@gmail.com> + + Reviewed by Simon Hausmann. + + Prevent QWebPage::setView() from changing the viewport size on the fly + in case the view doesn't actually change. QWebPage::setView() is + called upon every QWebGraphicsItem::hoverMoveEvent(), which forced + the viewport size to be equal to the size of the whole graphics view. + + https://bugs.webkit.org/show_bug.cgi?id=29676 + + * Api/qwebpage.cpp: + (QWebPage::setView): + +2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Crash fix in QWebHistory back and forward methods. + + QWebHistory::back() and QWebHistory::forward() were crashing on + ASSERT in WebCore::BackForwardList. The methods should check + canGoBack() and canGoForward() at the beginning. + + https://bugs.webkit.org/show_bug.cgi?id=29675 + + * Api/qwebhistory.cpp: + (QWebHistory::back): + (QWebHistory::forward): + +2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Bug fix. QWebHistory should call QWebPage::updateNavigationActions + + In QWebHistory's methods that change item count or current item call + to QWebPage::updateNavigationActions should be executed. + QWebHistory::clear() and QWebHistory::restorState() were changed. + New helper method, QWebPagePrivate accesor, were created in + QWebHistoryPrivate class. + Two autotest were developed. + + https://bugs.webkit.org/show_bug.cgi?id=29246 + + * Api/qwebhistory.cpp: + (QWebHistory::clear): + (QWebHistory::restoreState): + (QWebHistoryPrivate::page): + * Api/qwebhistory_p.h: + * tests/qwebhistory/tst_qwebhistory.cpp: + (tst_QWebHistory::saveAndRestore_1): + (tst_QWebHistory::clear): + +2009-09-23 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Need to guard QX11Info include with Q_WS_X11. + That class may not be available (in QT 4.5 for Symbian, for instance). + Completes fixes in r48627 and r48604. + + * Api/qwebgraphicsitem.cpp: + * Api/qwebview.cpp: + +2009-09-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Add default timeout while waiting for signals in QWebPage auto + tests. + https://bugs.webkit.org/show_bug.cgi?id=29637 + + * tests/qwebpage/tst_qwebpage.cpp: + (waitForSignal): + +2009-09-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reivewed by Simon Hausmann. + + Fix the Qt/Mac build after r48604 (Implement new QWebPageClient class) + + There's no QWidget::x11Info() on Mac, and setPlatformPluginWidget() + takes a QWidget*, not a QWebPageClient* + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItemPrivate::screenNumber): + * Api/qwebview.cpp: + (QWebViewPrivate::screenNumber): + +2009-09-21 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + For Qt, platformPageClient() will now return a class derived from + the QWebPageClient, so the patch adapts our Qt hooks to go though + this class and not depend on the QWebView. + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItemPrivate::scroll): + (QWebGraphicsItemPrivate::update): + (QWebGraphicsItemPrivate::cursor): + (QWebGraphicsItemPrivate::updateCursor): + (QWebGraphicsItemPrivate::screenNumber): + (QWebGraphicsItemPrivate::winId): + (QWebGraphicsItem::event): + (QWebGraphicsItem::setPage): + * Api/qwebgraphicsitem.h: + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + * Api/qwebpage_p.h: + * Api/qwebview.cpp: + (QWebViewPrivate::scroll): + (QWebViewPrivate::update): + (QWebViewPrivate::cursor): + (QWebViewPrivate::updateCursor): + (QWebViewPrivate::screenNumber): + (QWebViewPrivate::winId): + (QWebView::setPage): + (QWebView::event): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::repaint): + (WebCore::ChromeClientQt::scroll): + (WebCore::ChromeClientQt::platformPageClient): + +2009-09-21 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29609 + Build fix for windows when using Qt 4.5.0. + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): + +2009-09-19 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29345 + The tests of QWebFrame did not use QTRY_VERIFY for + tests involving the event loop. + + * tests/qwebframe/tst_qwebframe.cpp: + * tests/util.h: Added. Copy of tests/shared/util.h of Qt + +2009-09-19 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] Add an autotest stub for QWebGraphicsItem. + + It just calls all the functions and makes sure they don't crash. + + * tests/qwebgraphicsitem/qwebgraphicsitem.pro: Added. + * tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Added. + (tst_QWebGraphicsItem::qwebgraphicsitem): + * tests/tests.pro: + +2009-09-18 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Eric Seidel. + + Corrected the Symbian specific UID3 values to be assigned + from the "unprotected" pool that permits self-signing of + those test and demo executables. (Added new UID3 values + where they were missing for new components.) + + * QGVLauncher/QGVLauncher.pro: + * QtLauncher/QtLauncher.pro: + * tests/benchmarks/loading/tst_loading.pro: + * tests/benchmarks/painting/tst_painting.pro: + * tests/qwebelement/qwebelement.pro: + * tests/qwebframe/qwebframe.pro: + * tests/qwebhistory/qwebhistory.pro: + * tests/qwebhistoryinterface/qwebhistoryinterface.pro: + * tests/qwebpage/qwebpage.pro: + * tests/qwebplugindatabase/qwebplugindatabase.pro: + * tests/qwebview/qwebview.pro: + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Reflect the rename of platformWindow and it's return type. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::platformPageClient): + * WebCoreSupport/ChromeClientQt.h: + +2009-09-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Add persistence support for configuration options in the + inspector. + + * Api/qwebinspector.cpp: + * QtLauncher/main.cpp: + (main): + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::populateSetting): + (WebCore::InspectorClientQt::storeSetting): + (WebCore::variantToSetting): + (WebCore::settingToVariant): + +2009-09-18 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Ariya Hidayat. + + Fixed a bunch of documentation warnings. + + * Api/qwebgraphicsitem.cpp: + * Api/qwebplugindatabase.cpp: + * Api/qwebpluginfactory.cpp: + * Api/qwebsecurityorigin.cpp: + +2009-09-18 Warwick Allison <warwick.allison@nokia.com> + + Reviewed by Simon Hausmann. + + Added a test that console output works. + + * tests/qwebpage/tst_qwebpage.cpp: + (ConsolePage::ConsolePage): + (ConsolePage::javaScriptConsoleMessage): + (tst_QWebPage::consoleOutput): + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Improve documentation for Page Cache. + + * Api/qwebsettings.cpp: + +2009-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Update QWebSettings::setUserStyleSheetUrl() docs and test + + https://bugs.webkit.org/show_bug.cgi?id=29081 + + The documentation now specifies that the URL has to be a local file + or a a data-URL (with utf-8 and base64-encoded data), as these are the + only two schemes that the current code path accepts. + + The auto-test has been updated to reflect this limitation. + + At a later point we should concider adding API for the new way of + doing both user defined stylesheets and scripts. + + * Api/qwebsettings.cpp: + * tests/qwebpage/tst_qwebpage.cpp: + +2009-09-17 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Simon Hausmann. + + Symbian build fix. + + Moved the #ifdefs around _q_cleanupLeakMessages() into the function + definition. + + QMake is not being able to distinguish between release and debug builds + in Symbian build. This is a Symbian toolchain issue. + + * Api/qwebpage.cpp: + (QWebPagePrivate::_q_cleanupLeakMessages): + * Api/qwebpage.h: + * Api/qwebpage_p.h: + +2009-09-17 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + Small cosmetic documentation fixlet in the QWebInspector. + + * Api/qwebinspector.cpp: + +2009-09-16 Benjamin C Meyer <benjamin.meyer@torchmobile.com> + + Reviewed by Eric Seidel. + + Detect and add Windows7 properly to the user agent. + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): + +2009-09-16 Andras Becsi <andrewbecsi@yahoo.co.uk> + + Rubberstamped by Kenneth Christiansen. + + [Qt] Build fix for previous changes. + + * QGVLauncher/main.cpp: + (MainView::flip): + +2009-09-16 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed potential Qt < 4.6 build fix. + + * QGVLauncher/main.cpp: + (MainView::flip): + +2009-09-16 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Add a "Flip effect" to our GraphicsView based launcher. + + * QGVLauncher/main.cpp: + (MainView::resizeEvent): + (MainView::flip): + (MainWindow::flip): + (MainWindow::buildUI): + +2009-09-16 Zoltan Herczeg <zherczeg@inf.u-szeged.hu> + + Rubber-stamped by Simon Hausmann. + + [Qt] Typo fix. Pass the window object to the Format + menu. In this way Qt can free its internal graphical + objects during exit. + + * QtLauncher/main.cpp: + (MainWindow::setupUI): + +2009-09-16 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Build break fix on gcc ARM. + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItemPrivate::_q_doLoadProgress): + +2009-09-16 Warwick Allison <warwick.allison@nokia.com> + + Reviewed by Simon Hausmann. + + Fix a crash in QWebFrame::hasFocus() with a simple null pointer check + when the focused frame is null. We do the same check in other places + where we call kit(). + + * Api/qwebframe.cpp: + (QWebFrame::hasFocus): + +2009-09-16 Jure Repinc <jlp@holodeck1.com> + + Reviewed by Simon Hausmann. + + Fixed a typo found during translation. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::interruptForPolicyChangeError): + +2009-09-14 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] QWebGraphicsItem should check for null QWebPage. + https://bugs.webkit.org/show_bug.cgi?id=29185 + + Don't crash in QWebGraphicsItem when the page is still null, by + either checking if it's the case or constructing the default one. + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItem::icon): + (QWebGraphicsItem::setZoomFactor): + (QWebGraphicsItem::zoomFactor): + (QWebGraphicsItem::setGeometry): + (QWebGraphicsItem::load): + (QWebGraphicsItem::setHtml): + (QWebGraphicsItem::toHtml): + (QWebGraphicsItem::setContent): + (QWebGraphicsItem::history): + (QWebGraphicsItem::settings): + +2009-09-11 David Boddie <dboddie@trolltech.com> + + Reviewed by Simon Hausmann. + + Doc: Note that Netscape plugins are only available on desktop platforms. + + * docs/qtwebkit.qdoc: + +2009-09-11 Martin Smith <msmith@trolltech.com> + + Reviewed by Simon Hausmann. + + Adjust the name of the contentspage for the documentation + to the new name used in Qt 4.6. + + * docs/qtwebkit.qdoc: + +2009-09-11 Ariya Hidayat <ariya.hidayat@nokia.com> + + Reviewed by Simon Hausmann. + + Changed URLs from qtsoftware.com to qt.nokia.com, as part of a general + renaming. + + * Api/qwebpluginfactory.cpp: + * docs/webkitsnippets/simple/main.cpp: + (main): + * docs/webkitsnippets/webpage/main.cpp: + (main): + +2009-09-11 Volker Hilsheimer <volker.hilsheimer@nokia.com> + + Reviewed by Simon Hausmann. + + Restructure the documentation, both on a file and on a content level. + + * Api/qwebdatabase.cpp: + * Api/qwebelement.cpp: + * Api/qwebframe.cpp: + * Api/qwebhistory.cpp: + * Api/qwebhistoryinterface.cpp: + * Api/qwebpage.cpp: + * Api/qwebpluginfactory.cpp: + * Api/qwebsecurityorigin.cpp: + * Api/qwebsettings.cpp: + * Api/qwebview.cpp: + * docs/qtwebkit.qdoc: + +2009-09-11 Yongjun Zhang <yongjun.zhang@nokia.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29136 + [Qt] emit microFocusChanged() signal when no QWidget-based view is present. + + emit microFocusChange() signal regardless of view. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + +2009-09-11 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=28806 + + [Qt] Make the WebInspector available as a QWidget. + + * Api/headers.pri: + * Api/qwebelement.cpp: + (QWebElement::enclosingElement): + * Api/qwebelement.h: + * Api/qwebinspector.cpp: Added. + * Api/qwebinspector.h: Added. + * Api/qwebinspector_p.h: Added. + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + (QWebPagePrivate::setInspector): + (QWebPagePrivate::getOrCreateInspector): + (QWebPagePrivate::inspectorController): + (QWebPage::~QWebPage): + (QWebPage::triggerAction): + * Api/qwebpage.h: + * Api/qwebpage_p.h: + * Api/qwebsettings.cpp: + * QtLauncher/main.cpp: + (MainWindow::MainWindow): + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientWebPage::InspectorClientWebPage): + (WebCore::InspectorClientWebPage::createWindow): + (WebCore::InspectorClientQt::createPage): + (WebCore::InspectorClientQt::showWindow): + (WebCore::InspectorClientQt::closeWindow): + (WebCore::InspectorClientQt::attachWindow): + (WebCore::InspectorClientQt::detachWindow): + (WebCore::InspectorClientQt::updateWindowTitle): + * WebCoreSupport/InspectorClientQt.h: + * docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp: Added. + +2009-09-10 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Eric Seidel. + + [Qt] Fix comparison between signed and unsigned integer warnings + https://bugs.webkit.org/show_bug.cgi?id=29162 + + No functional change. + + * Api/qwebelement.cpp: + (QWebElement::findAll): + * Api/qwebhistory.cpp: + (QWebHistory::items): + (QWebHistory::backItems): + (QWebHistory::forwardItems): + (QWebHistory::saveState): + * Api/qwebplugindatabase.cpp: + (QWebPluginDatabase::setSearchPaths): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::runOpenPanel): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + +2009-09-10 Simon Hausmann <hausmann@webkit.org> + + Rubber-stamped by Ariya Hidayat. + + Fix a bunch of qdoc warnings: Invalid references, non-standard + wording, etc. + + * Api/qwebelement.cpp: + * Api/qwebgraphicsitem.cpp: + * Api/qwebsecurityorigin.cpp: + +2009-09-10 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Ariya Hidayat. + + Fix context menu event delivery with QWebGraphicsItem. + + Re-implement the correct context menu virtual function using + a QGraphicsSceneContextMenuEvent and forward & handle it in + QWebPage. + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItem::contextMenuEvent): + * Api/qwebgraphicsitem.h: + * Api/qwebpage.cpp: + (QWebPagePrivate::contextMenuEvent): + (QWebPage::event): + * Api/qwebpage_p.h: + +2009-09-10 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed. + + Build fix for QtWebKit for Mac after r48219. + + qevent and qstyleoption are QtGui interfaces. + + * Api/qwebgraphicsitem.cpp: + * Api/qwebgraphicsitem.h: + +2009-09-09 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Call the right base class function QGraphicsWidget::event() instead + of skipping it and using QObject::event() instead. + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItem::event): + +2009-09-09 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed. + + Fix comment at Tor Arne Vestbø's request. + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItem::sceneEvent): + (QWebGraphicsItem::event): + +2009-09-09 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Implement some virtual event methods so that we can fix + event-related bugs in Qt patch releases. + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItem::sceneEvent): + (QWebGraphicsItem::event): + * Api/qwebgraphicsitem.h: + +2009-09-09 Kenneth Rohde Christiansen <kenneth@webkit.org>, Antonio Gomes <antonio.gomes@openbossa.org> + + Reviewed by Simon Hausmann. + + Add a new QGraphicsWidget based version of the "QWebView" + under the name "QWebGraphicsItem". + + https://bugs.webkit.org/show_bug.cgi?id=28862 + + Includes an alternative Qt launcher using the QGraphicsView. + + * Api/headers.pri: + * Api/qwebgraphicsitem.cpp: Added. + * Api/qwebgraphicsitem.h: Added. + * Api/qwebpage.h: + * QGVLauncher/QGVLauncher.pro: Copied from WebKit/qt/QtLauncher/QtLauncher.pro. + * QGVLauncher/main.cpp: Added. + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::repaint): + (WebCore::ChromeClientQt::scroll): + +2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed build fix. + + Potential build fix for Qt 4.5 + + * Api/qwebpage.cpp: + (QWebPagePrivate::mousePressEvent): + +2009-09-08 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29007 + Add a test for the signal QWebFrame::javaScriptWindowObjectCleared() + + * tests/qwebframe/tst_qwebframe.cpp: + +2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix unused variable warnings + https://bugs.webkit.org/show_bug.cgi?id=29018 + + * Api/qwebpage.cpp: + (QWebPagePrivate::keyPressEvent): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::startDownload): + (WebCore::FrameLoaderClientQt::createFrame): + +2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Ariya Hidayat. + + [Qt] Use the declaration order in initializer lists + https://bugs.webkit.org/show_bug.cgi?id=29017 + + * Api/qwebframe_p.h: + +2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Add support for handling QGraphicsScene events. + + * Api/qwebpage.cpp: + (QWebPagePrivate::mouseMoveEvent): + (QWebPagePrivate::mousePressEvent): + (QWebPagePrivate::mouseDoubleClickEvent): + (QWebPagePrivate::mouseTripleClickEvent): + (QWebPagePrivate::handleClipboard): + (QWebPagePrivate::mouseReleaseEvent): + (QWebPagePrivate::wheelEvent): + (QWebPagePrivate::dragEnterEvent): + (QWebPagePrivate::dragLeaveEvent): + (QWebPagePrivate::dragMoveEvent): + (QWebPagePrivate::dropEvent): + (QWebPage::event): + * Api/qwebpage_p.h: + +2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Make cursor set cleaner in QtWebKit Api: eliminate SetCursorEvent hack. + https://bugs.webkit.org/show_bug.cgi?id=28865 + + Clean up the unserCursor hack to use the QCursor set + as a property of the QWidget by WebCore::WidgetQt. + + Remove all code that are no longer necessary for getting + cursor change events. + + Patch by Kenneth Rohde Christiansen <kenneth@webkit.org> and + Antonio Gomes <antonio.gomes@openbossa.org> on 2009-09-07 + + * Api/qwebpage.cpp: + * Api/qwebpage_p.h: + * Api/qwebview.cpp: + (QWebViewPrivate::QWebViewPrivate): + (QWebView::event): + +2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] QtWebKit single API to enable persistency + https://bugs.webkit.org/show_bug.cgi?id=28682 + + Disable LocalStorage, ApplicationCache, HTML5 offline storage by + default. + + If persistency is enabled the default directory for LocalStorage and + ApplicationCache is now based on QDesktopServices::DataLocation and not + QDesktopServices::CacheLocation (as it is expected to keep this data + around after a reboot). + + If persistency is enabled initialize HTML5 offline storage as well - this + fixed offline Storage for QtLauncher. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + (QWebSettings::enablePersistentStorage): + * Api/qwebsettings.h: Add a new API called enablePersistentStorage + * QtLauncher/main.cpp: Use the new enablePersistentStorage API + (main): + +2009-09-07 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Simon Hausmann. + + Speed up the QWebPluginInfo::supportsMimeType() function. + https://bugs.webkit.org/show_bug.cgi?id=27651 + + Instead of going through the MIME types list constructed with + mimeTypes() function, look up the internal mimeToDescriptions map. + + * Api/qwebplugindatabase.cpp: + (QWebPluginInfo::supportsMimeType): + +2009-09-07 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Simon Hausmann. + + Speed up the QWebPluginInfo::mimeTypes() function. + https://bugs.webkit.org/show_bug.cgi?id=27651 + + Instead of constructing a list of MIME types every time it is called, + do this only once. + + * Api/qwebplugindatabase.cpp: + (QWebPluginInfo::mimeTypes): + (QWebPluginInfo::operator=): + * Api/qwebplugindatabase.h: + * tests/qwebplugindatabase/tst_qwebplugindatabase.cpp: + (tst_QWebPluginDatabase::operatorassign_data): + (tst_QWebPluginDatabase::operatorassign): + +2009-09-07 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Simon Hausmann. + + Remove the private classes from QWebPluginDatabase. + https://bugs.webkit.org/show_bug.cgi?id=27651 + + Instead, hold the PluginDatabase and PluginPackage objects as class + members and take care of refcounting on our own instead of using RefPtr. + + This way we not only made the code cleaner but also got rid of + redundant allocations when constructing null QWebPluginInfo objects. + + The private classes have been forward-declared and the d-pointers left + to be on the safe side. + + * Api/qwebplugindatabase.cpp: + (QWebPluginInfo::QWebPluginInfo): + (QWebPluginInfo::~QWebPluginInfo): + (QWebPluginInfo::name): + (QWebPluginInfo::description): + (QWebPluginInfo::mimeTypes): + (QWebPluginInfo::path): + (QWebPluginInfo::isNull): + (QWebPluginInfo::setEnabled): + (QWebPluginInfo::isEnabled): + (QWebPluginInfo::operator==): + (QWebPluginInfo::operator!=): + (QWebPluginInfo::operator=): + (QWebPluginDatabase::QWebPluginDatabase): + (QWebPluginDatabase::~QWebPluginDatabase): + (QWebPluginDatabase::plugins): + (QWebPluginDatabase::searchPaths): + (QWebPluginDatabase::setSearchPaths): + (QWebPluginDatabase::addSearchPath): + (QWebPluginDatabase::refresh): + (QWebPluginDatabase::pluginForMimeType): + (QWebPluginDatabase::setPreferredPluginForMimeType): + * Api/qwebplugindatabase.h: + * Api/qwebplugindatabase_p.h: Removed. + +2009-09-05 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Eric Seidel. + + [Qt] r47424 broke binary compatibility + https://bugs.webkit.org/show_bug.cgi?id=28996 + + Append the new DnsPrefetchEnabled attribute at the end of the enum. + + * Api/qwebsettings.h: + +2009-09-04 Mark Mentovai <mark@chromium.org> + + Reviewed by Dave Hyatt. + + https://bugs.webkit.org/show_bug.cgi?id=28614 + + Account for scrollbar state changes that occur during layout. + + * Api/qwebframe.cpp: + (QWebFrame::setScrollBarPolicy): + + Eliminate duplicated (and incorrect) scrollbar mode tracking between + FrameView and ScrollView. + +2009-09-04 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Eric Seidel. + + [Qt] Fix tst_QWebPage::database autotest failure + https://bugs.webkit.org/show_bug.cgi?id=28961 + + Make sure that the test case enables the feature before + the feature gets tested + + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::database): + +2009-09-04 Benjamin C Meyer <benjamin.meyer@torchmobile.com> + + Reviewed by Eric Seidel. + + Any QtWebKit application crashes on exit if the inspector is + used during the session rather then exiting. + + If a QWebView has a QWebPage that is destroyed the QWebView + does not update its pointer and will crash the next time + it access the page pointers (such as in its destructor). + + InspectorClientView should not call deleteLater when the page + is destroyed because it does not have a parent and is a top + level widget. close() needs to be called so that QApplication + can exit the application if quitOnLastWindowClosed is set + and a InspectorClientView is the last window, otherwise + the application will never exit. + + * Api/qwebview.cpp: + (QWebViewPrivate::_q_pageDestroyed): + (QWebView::setPage): + * Api/qwebview.h: + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientView::InspectorClientView): + +2009-09-03 Adam Barth <abarth@webkit.org> + + Reviewed by eric@webkit.org. + + https://bugs.webkit.org/show_bug.cgi?id=24696 + + Stub implementations of mixed content methods of FrameLoaderClient. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::didDisplayInsecureContent): + (WebCore::FrameLoaderClientQt::didRunInsecureContent): + * WebCoreSupport/FrameLoaderClientQt.h: + +2009-09-03 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Eric Seidel. + + [Qt] Add a setting to turn SessionStorage on/off + https://bugs.webkit.org/show_bug.cgi?id=28836 + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + (QWebSettings::QWebSettings): + * Api/qwebsettings.h: + * tests/qwebpage/tst_qwebpage.cpp: + (testFlag): + (tst_QWebPage::testOptionalJSObjects): + +2009-09-02 Richard Moore <rich@kde.org> + + Reviewed by Tor Arne Vestbø. + + [Qt] Make sure we relayout the page after evaluating JS + + https://bugs.webkit.org/show_bug.cgi?id=28235 + + QtWebKit does not always seem to reflow the page when evaluating + javascript. This patch changes the way evaluateJavaScript works to + use the frameloader which ensures that this is done properly. + + * Api/qwebframe.cpp: + (QWebFrame::evaluateJavaScript): + * tests/qwebframe/tst_qwebframe.cpp: + +2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Holger Freyther. + + https://bugs.webkit.org/show_bug.cgi?id=25889 + [GTK] scrollbar policy for main frame is not implementable + + Add empty implementation for new ChromeClient method. + + * WebCoreSupport/ChromeClientQt.h: + (WebCore::ChromeClientQt::scrollbarsModeDidChange): + +2009-08-27 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Ariya Hidayat. + + QWebHistory::clear() modifications. + + Clear() method was changed. If QWebHistory is empty (there is no + elements even current) clear() do nothing. If there at least one + element clear() will delete everything apart of current. + + New autotests in QWebHistory + + New autotests were added to QWebHistory. They should check some crashes + in save and restore state process and clear() method and general + behavior on where QWebHistory::count() == 0 or QWebHistory::count() == 1 + + Bugzilla: https://bugs.webkit.org/show_bug.cgi?id=28711 + + * Api/qwebhistory.cpp: + (QWebHistory::clear): + * tests/qwebhistory/tst_qwebhistory.cpp: + (tst_QWebHistory::back): + (tst_QWebHistory::forward): + (tst_QWebHistory::saveAndRestore_crash_1): + (tst_QWebHistory::saveAndRestore_crash_2): + (tst_QWebHistory::saveAndRestore_crash_3): + (tst_QWebHistory::clear): + +2009-08-27 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Ariya Hidayat. + + [Qt] Cleanup, old and commented part of source code was removed. + Fix some formatting problems. + + https://bugs.webkit.org/show_bug.cgi?id=28712 + + * Api/qwebhistory_p.h: + (QWebHistoryPrivate::QWebHistoryPrivate): + +2009-08-26 Adam Barth <abarth@webkit.org> + + Reviewed by Oliver Hunt. + + Don't let local files access web URLs + https://bugs.webkit.org/show_bug.cgi?id=28480 + + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + +2009-08-25 Antonio Gomes <antonio.gomes@openbossa.org> + + Reviewed by Ariya Hidayat. + + Bug 28708 - Make possible to better use ResourceError in FrameLoaderClientQt class. + + * Api/qwebframe.cpp: + (QWebFrame::requestedUrl): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::FrameLoaderClientQt): + (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad): + (WebCore::FrameLoaderClientQt::postProgressFinishedNotification): + (WebCore::FrameLoaderClientQt::dispatchDidFailProvisionalLoad): + (WebCore::FrameLoaderClientQt::dispatchDidFailLoad): + * WebCoreSupport/FrameLoaderClientQt.h: + +2009-08-22 Adam Barth <abarth@webkit.org> + + Revert 47684. We're going to do this later once clients have had a + chance to opt into the setting they like. + + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + +2009-08-22 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Don't let local files access web URLs + https://bugs.webkit.org/show_bug.cgi?id=28480 + + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + +2009-08-19 Aaron Boodman <aa@chromium.org> + + Speculative build break fix for qt. + + * Api/qwebsecurityorigin.cpp: + (QWebSecurityOrigin::whiteListAccessFromOrigin): + * Api/qwebsecurityorigin.h: + +2009-08-19 Aaron Boodman <aa@chromium.org> + + Reviewed by David Levin. + + https://bugs.webkit.org/show_bug.cgi?id=24853: Provide a way for WebKit clients to + specify a more granular policy for cross-origin XHR access. + + * Api/qwebsecurityorigin.cpp: Add API to manipulate origin access whitelists. + (QWebSecurityOrigin::whiteListAccessFromOrigin): Ditto. + (QWebSecurityOrigin::resetOriginAccessWhiteLists): Ditto. + * Api/qwebsecurityorigin.h: Ditto. + +2009-08-18 Markus Goetz <Markus.Goetz@nokia.com> + + Reviwed by Ariya Hidayat. + + [Qt] For prefecthDNS, the pre-fetching has to be enabled in the + WebSettings. + + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + * Api/qwebsettings.h: + +2009-08-17 Darin Adler <darin@apple.com> + + Try to fix Qt build again. + + * WebCoreSupport/EditorClientQt.cpp: Move "using namespace". + +2009-08-17 Darin Adler <darin@apple.com> + + Try to fix Qt build. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::shouldShowDeleteInterface): + Use getAttribute(classAttr) instead of className() function. + +2009-08-14 Yongjun Zhang <yongjun.zhang@nokia.com> + + Reviewed by Simon Hausmann. + + RVCT elftran fails to resolve QPainter::staticMetaObject coming with + QWebView::RenderHints property. + + This is a temporary fix and will be revereted when the right symbols + exported from Qt lib in S60. + + https://bugs.webkit.org/show_bug.cgi?id=28181 + + * Api/qwebview.h: + +2009-08-14 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Public API to configure the storage path for HTML5 localStorage + https://bugs.webkit.org/show_bug.cgi?id=28036 + + Disables LocalStorage for QtWebKit by default by setting + QWebSettings::LocalStorageEnabled to false. + + Sets up a default for the LocalStorage path so that clients would only + need to enable the LocalStorageEnabled setting to turn on LocalStoragre + support. + + Turn on LocalStorage support for QtLauncher and the relevant test + since LocalStorage is now disabled by default for QtWebkit. + + * Api/qwebpage.cpp: + (defaultCachePath): + (initializeApplicationCachePathIfNecessary): + (QWebPagePrivate::QWebPagePrivate): + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + (QWebSettings::QWebSettings): + (QWebSettings::setLocalStoragePath): + (QWebSettings::localStoragePath): + * Api/qwebsettings.h: + * QtLauncher/main.cpp: + (main): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::multiplePageGroupsAndLocalStorage): + +2009-08-14 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Allow applications to register their own local URL scheme. + https://bugs.webkit.org/show_bug.cgi?id=28240 + + * Api/qwebsecurityorigin.cpp: + (QWebSecurityOrigin::addLocalScheme): + (QWebSecurityOrigin::removeLocalScheme): + (QWebSecurityOrigin::localSchemes): + * Api/qwebsecurityorigin.h: + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::localURLSchemes): + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Try and fix the Qt build. + + * Api/qwebelement.cpp: + +2009-08-13 Kavindra Devi Palaraja <kavindra.palaraja@nokia.com> + + Reviewed by Simon Hausmann. + + Doc - Some cleanup on the documentation of QWebElement + + * Api/qwebelement.cpp: + +2009-08-13 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Simon Hausmann. + + Symbian target components (library and executable files) + require Unique Identifiers (i.e., UID3). + These identifiers are defined in the respective project + files, conditionally for "symbian" platform. + + * QtLauncher/QtLauncher.pro: + * tests/qwebelement/qwebelement.pro: + * tests/qwebframe/qwebframe.pro: + * tests/qwebhistory/qwebhistory.pro: + * tests/qwebhistoryinterface/qwebhistoryinterface.pro: + * tests/qwebpage/qwebpage.pro: + * tests/qwebview/qwebview.pro: + +2009-08-12 George Wright <george.wright@torchmobile.com> + + Reviewed by Adam Treat. + + Initialise zoom levels independent of whether a URL is valid or not to + fix https://bugs.webkit.org/show_bug.cgi?id=28162 + + * QtLauncher/main.cpp: + (MainWindow::MainWindow): + +2009-08-12 Joerg Bornemann <joerg.bornemann@trolltech.com> + + Reviewed by Simon Hausmann. + + QtWebKit compile fix for Windows CE + + There's no getenv on Windows CE, use qgetenv instead. + + * Api/qwebpage.cpp: + (qt_drt_overwritePluginDirectories): + 2009-08-10 Kavindra Palaraja <kavindra.palaraja@nokia.com> Reviewed by Simon Hausmann. @@ -2956,7 +4642,7 @@ Reviewed by Simon Hausmann. - http://www.qtsoftware.com/developer/task-tracker/index_html?id=238391&method=entry + http://qt.nokia.com/developer/task-tracker/index_html?id=238391&method=entry [Qt] If QPainter fails to start on a QPrinter instance, do not continue printing. @@ -3149,7 +4835,7 @@ Rubber-stamped by Simon Hausmann. - http://www.qtsoftware.com/developer/task-tracker/index_html?id=219344&method=entry + http://qt.nokia.com/developer/task-tracker/index_html?id=219344&method=entry [Qt] API documentation for QWebPage::WebAction enum. @@ -3204,7 +4890,7 @@ Reviewed by Simon Hausmann. - http://www.qtsoftware.com/developer/task-tracker/index_html?id=241144&method=entry + http://qt.nokia.com/developer/task-tracker/index_html?id=241144&method=entry [Qt] Create actions for text selection and editing for QWebPage. Also properly disable and enable them when contentEditable is toggled. diff --git a/WebKit/qt/QGVLauncher/QGVLauncher.pro b/WebKit/qt/QGVLauncher/QGVLauncher.pro new file mode 100644 index 0000000..dec1c9b --- /dev/null +++ b/WebKit/qt/QGVLauncher/QGVLauncher.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +SOURCES += main.cpp +CONFIG -= app_bundle +CONFIG += uitools +DESTDIR = ../../../bin + +include(../../../WebKit.pri) + +QT += network +macx:QT+=xml +QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E544 diff --git a/WebKit/qt/QGVLauncher/main.cpp b/WebKit/qt/QGVLauncher/main.cpp new file mode 100644 index 0000000..1d67c35 --- /dev/null +++ b/WebKit/qt/QGVLauncher/main.cpp @@ -0,0 +1,337 @@ +/* + * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2006 George Staikos <staikos@kde.org> + * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org> + * Copyright (C) 2009 Kenneth Christiansen <kenneth@webkit.org> + * Copyright (C) 2009 Antonio Gomes <antonio.gomes@openbossa.org> + * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> + * + * 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 <QDebug> +#include <QFile> +#include <QGraphicsScene> +#include <QGraphicsView> +#include <QGraphicsWidget> +#include <QNetworkRequest> +#include <QTextStream> +#include <QVector> +#include <QtGui> +#include <QtNetwork/QNetworkProxy> +#include <cstdio> +#include <qwebelement.h> +#include <qwebframe.h> +#include <qgraphicswebview.h> +#include <qwebpage.h> +#include <qwebsettings.h> +#include <qwebview.h> + +class WebPage : public QWebPage { + Q_OBJECT + +public: + WebPage(QWidget* parent = 0) : QWebPage(parent) + { + applyProxy(); + } + virtual QWebPage* createWindow(QWebPage::WebWindowType); + +private: + void applyProxy(); +}; + +class MainView : public QGraphicsView { + Q_OBJECT + +public: + MainView(QWidget* parent) : QGraphicsView(parent), m_mainWidget(0) + { + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + } + + void setMainWidget(QGraphicsWidget* widget) + { + QRectF rect(QRect(QPoint(0, 0), size())); + widget->setGeometry(rect); + m_mainWidget = widget; + } + + void resizeEvent(QResizeEvent* event) + { + QGraphicsView::resizeEvent(event); + if (!m_mainWidget) + return; + QRectF rect(QPoint(0, 0), event->size()); + m_mainWidget->setGeometry(rect); + } + +public slots: + void flip() + { +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QSizeF center = m_mainWidget->boundingRect().size() / 2; + QPointF centerPoint = QPointF(center.width(), center.height()); + m_mainWidget->setTransformOriginPoint(centerPoint); + + m_mainWidget->setRotation(m_mainWidget->rotation() ? 0 : 180); +#endif + } + + void animatedFlip() + { +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QSizeF center = m_mainWidget->boundingRect().size() / 2; + QPointF centerPoint = QPointF(center.width(), center.height()); + m_mainWidget->setTransformOriginPoint(centerPoint); + + QPropertyAnimation* animation = new QPropertyAnimation(m_mainWidget, "rotation", this); + animation->setDuration(1000); + animation->setStartValue(m_mainWidget->rotation()); + animation->setEndValue(m_mainWidget->rotation() + 180); + animation->start(QAbstractAnimation::DeleteWhenStopped); +#endif + } +private: + QGraphicsWidget* m_mainWidget; +}; + +class SharedScene : public QSharedData { +public: + SharedScene() + { + m_scene = new QGraphicsScene; + + m_item = new QGraphicsWebView; + m_item->setPage(new WebPage()); + + m_scene->addItem(m_item); + m_scene->setActiveWindow(m_item); + } + + ~SharedScene() + { + delete m_item; + delete m_scene; + } + + QGraphicsScene* scene() const { return m_scene; } + QGraphicsWebView* webView() const { return m_item; } + +private: + QGraphicsScene* m_scene; + QGraphicsWebView* m_item; +}; + + +class MainWindow : public QMainWindow { + Q_OBJECT + +public: + MainWindow(QExplicitlySharedDataPointer<SharedScene> other) + : QMainWindow(), view(new MainView(this)), scene(other) + { + init(); + } + + MainWindow() + : QMainWindow(), view(new MainView(this)), scene(new SharedScene()) + { + init(); + } + + void init() + { + setAttribute(Qt::WA_DeleteOnClose); + + view->setScene(scene->scene()); + view->setFrameShape(QFrame::NoFrame); + view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setCentralWidget(view); + + view->setMainWidget(scene->webView()); + + connect(scene->webView(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); + connect(scene->webView(), SIGNAL(titleChanged(const QString&)), this, SLOT(setWindowTitle(const QString&))); + connect(scene->webView()->page(), SIGNAL(windowCloseRequested()), this, SLOT(close())); + + resize(640, 480); + buildUI(); + } + + void load(const QString& url) + { + QUrl deducedUrl = guessUrlFromString(url); + if (!deducedUrl.isValid()) + deducedUrl = QUrl("http://" + url + "/"); + + urlEdit->setText(deducedUrl.toEncoded()); + scene->webView()->load(deducedUrl); + scene->webView()->setFocus(Qt::OtherFocusReason); + } + + QUrl guessUrlFromString(const QString& string) + { + QString input(string); + QFileInfo fi(input); + if (fi.exists() && fi.isRelative()) + input = fi.absoluteFilePath(); + + return QWebView::guessUrlFromString(input); + } + + QWebPage* page() const + { + return scene->webView()->page(); + } + +protected slots: + void changeLocation() + { + load(urlEdit->text()); + } + + void loadFinished(bool) + { + QUrl url = scene->webView()->url(); + urlEdit->setText(url.toString()); + + QUrl::FormattingOptions opts; + opts |= QUrl::RemoveScheme; + opts |= QUrl::RemoveUserInfo; + opts |= QUrl::StripTrailingSlash; + QString s = url.toString(opts); + s = s.mid(2); + if (s.isEmpty()) + return; + //FIXME: something missing here + } + +public slots: + void newWindow(const QString &url = QString()) + { + MainWindow* mw = new MainWindow(); + mw->load(url); + mw->show(); + } + + void clone() + { + MainWindow* mw = new MainWindow(scene); + mw->show(); + } + + void flip() + { + view->flip(); + } + + void animatedFlip() + { + view->animatedFlip(); + } +private: + void buildUI() + { + QWebPage* page = scene->webView()->page(); + urlEdit = new QLineEdit(this); + urlEdit->setSizePolicy(QSizePolicy::Expanding, urlEdit->sizePolicy().verticalPolicy()); + connect(urlEdit, SIGNAL(returnPressed()), SLOT(changeLocation())); + + QToolBar* bar = addToolBar("Navigation"); + bar->addAction(page->action(QWebPage::Back)); + bar->addAction(page->action(QWebPage::Forward)); + bar->addAction(page->action(QWebPage::Reload)); + bar->addAction(page->action(QWebPage::Stop)); + bar->addWidget(urlEdit); + + QMenu* fileMenu = menuBar()->addMenu("&File"); + fileMenu->addAction("New Window", this, SLOT(newWindow())); + fileMenu->addAction("Clone view", this, SLOT(clone())); + fileMenu->addAction("Close", this, SLOT(close())); + + QMenu* viewMenu = menuBar()->addMenu("&View"); + viewMenu->addAction(page->action(QWebPage::Stop)); + viewMenu->addAction(page->action(QWebPage::Reload)); + + QMenu* fxMenu = menuBar()->addMenu("&Effects"); + fxMenu->addAction("Flip", this, SLOT(flip())); + fxMenu->addAction("Animated Flip", this, SLOT(animatedFlip())); + } + +private: + MainView* view; + QExplicitlySharedDataPointer<SharedScene> scene; + + QLineEdit* urlEdit; +}; + +QWebPage* WebPage::createWindow(QWebPage::WebWindowType) +{ + MainWindow* mw = new MainWindow; + mw->show(); + return mw->page(); +} + +void WebPage::applyProxy() +{ + QUrl proxyUrl = QWebView::guessUrlFromString(qgetenv("http_proxy")); + + if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) { + int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080; + networkAccessManager()->setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort)); + } +} + +int main(int argc, char** argv) +{ + QApplication app(argc, argv); + QString url = QString("file://%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html")); + + app.setApplicationName("GQVLauncher"); + + QWebSettings::setObjectCacheCapacities((16 * 1024 * 1024) / 8, (16 * 1024 * 1024) / 8, 16 * 1024 * 1024); + QWebSettings::setMaximumPagesInCache(4); + QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true); + QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); + QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true); + + const QStringList args = app.arguments(); + if (args.count() > 1) + url = args.at(1); + + MainWindow* window = new MainWindow; + window->load(url); + + for (int i = 2; i < args.count(); i++) + window->newWindow(args.at(i)); + + window->show(); + return app.exec(); +} + +#include "main.moc" diff --git a/WebKit/qt/QtLauncher/QtLauncher.pro b/WebKit/qt/QtLauncher/QtLauncher.pro index 42138c8..5b10dea 100644 --- a/WebKit/qt/QtLauncher/QtLauncher.pro +++ b/WebKit/qt/QtLauncher/QtLauncher.pro @@ -9,3 +9,5 @@ include(../../../WebKit.pri) QT += network macx:QT+=xml QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E543 diff --git a/WebKit/qt/QtLauncher/main.cpp b/WebKit/qt/QtLauncher/main.cpp index 9cbab53..8cc8a09 100644 --- a/WebKit/qt/QtLauncher/main.cpp +++ b/WebKit/qt/QtLauncher/main.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> * Copyright (C) 2006 George Staikos <staikos@kde.org> * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> * Copyright (C) 2006 Zack Rusin <zack@kde.org> @@ -34,6 +35,7 @@ #include <qwebframe.h> #include <qwebsettings.h> #include <qwebelement.h> +#include <qwebinspector.h> #include <QtGui> #include <QDebug> @@ -62,6 +64,13 @@ public: virtual QWebPage *createWindow(QWebPage::WebWindowType); virtual QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&); + virtual bool supportsExtension(QWebPage::Extension extension) const + { + if (extension == QWebPage::ErrorPageExtension) + return true; + return false; + } + virtual bool extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output); }; class MainWindow : public QMainWindow @@ -70,13 +79,15 @@ class MainWindow : public QMainWindow public: MainWindow(QString url = QString()): currentZoom(100) { setAttribute(Qt::WA_DeleteOnClose); + if (qgetenv("QTLAUNCHER_USE_ARGB_VISUALS").toInt() == 1) + setAttribute(Qt::WA_TranslucentBackground); - view = new QWebView(this); - setCentralWidget(view); + QSplitter* splitter = new QSplitter(Qt::Vertical, this); + setCentralWidget(splitter); + view = new QWebView(splitter); WebPage* page = new WebPage(view); view->setPage(page); - connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); connect(view, SIGNAL(titleChanged(const QString&)), @@ -85,9 +96,15 @@ public: this, SLOT(showLinkHover(const QString&, const QString&))); connect(view->page(), SIGNAL(windowCloseRequested()), this, SLOT(close())); + inspector = new QWebInspector(splitter); + inspector->setPage(page); + inspector->hide(); + connect(this, SIGNAL(destroyed()), inspector, SLOT(deleteLater())); + connect(page, SIGNAL(webInspectorTriggered(const QWebElement&)), inspector, SLOT(show())); + setupUI(); - // set the proxy to the http_proxy env variable - if present + // set the proxy to the http_proxy env variable - if present QUrl proxyUrl = view->guessUrlFromString(qgetenv("http_proxy")); if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) { int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080; @@ -103,11 +120,12 @@ public: urlEdit->setText(qurl.toEncoded()); view->load(qurl); - // the zoom values are chosen to be like in Mozilla Firefox 3 - zoomLevels << 30 << 50 << 67 << 80 << 90; - zoomLevels << 100; - zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300; } + + // the zoom values are chosen to be like in Mozilla Firefox 3 + zoomLevels << 30 << 50 << 67 << 80 << 90; + zoomLevels << 100; + zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300; } QWebPage* webPage() const { @@ -193,6 +211,22 @@ protected slots: #endif } + void screenshot() + { + QPixmap pixmap = QPixmap::grabWidget(view); + QLabel* label = new QLabel; + label->setAttribute(Qt::WA_DeleteOnClose); + label->setWindowTitle("Screenshot - Preview"); + label->setPixmap(pixmap); + label->show(); + + QString fileName = QFileDialog::getSaveFileName(label, "Screenshot"); + if (!fileName.isEmpty()) { + pixmap.save(fileName, "png"); + label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName)); + } + } + void setEditable(bool on) { view->page()->setContentEditable(on); formatMenuAction->setVisible(on); @@ -206,6 +240,7 @@ protected slots: bool ok; QString str = QInputDialog::getText(this, "Select elements", "Choose elements", QLineEdit::Normal, "a", &ok); + if (ok && !str.isEmpty()) { QList<QWebElement> result = view->page()->mainFrame()->findAllElements(str); foreach (QWebElement e, result) @@ -259,6 +294,7 @@ private: #if QT_VERSION >= 0x040400 fileMenu->addAction(tr("Print"), this, SLOT(print())); #endif + QAction* screenshot = fileMenu->addAction("Screenshot", this, SLOT(screenshot())); fileMenu->addAction("Close", this, SLOT(close())); QMenu *editMenu = menuBar()->addMenu("&Edit"); @@ -285,7 +321,7 @@ private: viewMenu->addSeparator(); viewMenu->addAction("Dump HTML", this, SLOT(dumpHtml())); - QMenu *formatMenu = new QMenu("F&ormat"); + QMenu *formatMenu = new QMenu("F&ormat", this); formatMenuAction = menuBar()->addMenu(formatMenu); formatMenuAction->setVisible(false); formatMenu->addAction(view->pageAction(QWebPage::ToggleBold)); @@ -297,6 +333,7 @@ private: writingMenu->addAction(view->pageAction(QWebPage::SetTextDirectionRightToLeft)); newWindow->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N)); + screenshot->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S)); view->pageAction(QWebPage::Back)->setShortcut(QKeySequence::Back); view->pageAction(QWebPage::Stop)->setShortcut(Qt::Key_Escape); view->pageAction(QWebPage::Forward)->setShortcut(QKeySequence::Forward); @@ -321,6 +358,7 @@ private: QWebView *view; QLineEdit *urlEdit; QProgressBar *progress; + QWebInspector* inspector; QAction *formatMenuAction; @@ -328,6 +366,17 @@ private: QStringListModel urlModel; }; +bool WebPage::extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output) +{ + const QWebPage::ErrorPageExtensionOption* info = static_cast<const QWebPage::ErrorPageExtensionOption*>(option); + QWebPage::ErrorPageExtensionReturn* errorPage = static_cast<QWebPage::ErrorPageExtensionReturn*>(output); + + errorPage->content = QString("<html><head><title>Failed loading page</title></head><body>%1</body></html>") + .arg(info->errorString).toUtf8(); + + return true; +} + QWebPage *WebPage::createWindow(QWebPage::WebWindowType) { MainWindow *mw = new MainWindow; @@ -356,6 +405,7 @@ public: URLLoader(QWebView* view, const QString& inputFileName) : m_view(view) , m_stdOut(stdout) + , m_loaded(0) { init(inputFileName); } @@ -367,7 +417,7 @@ public slots: if (getUrl(qstr)) { QUrl url(qstr, QUrl::StrictMode); if (url.isValid()) { - m_stdOut << "Loading " << qstr << " ......" << endl; + m_stdOut << "Loading " << qstr << " ......" << ++m_loaded << endl; m_view->load(url); } else loadNext(); @@ -410,6 +460,7 @@ private: int m_index; QWebView* m_view; QTextStream m_stdOut; + int m_loaded; }; #include "main.moc" @@ -442,6 +493,11 @@ int main(int argc, char **argv) QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true); QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); + QWebSettings::enablePersistentStorage(); + + // To allow QWebInspector's configuration persistence + QCoreApplication::setOrganizationName("Nokia"); + QCoreApplication::setApplicationName("QtLauncher"); const QStringList args = app.arguments(); diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index d659833..26cf6f6 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -39,12 +39,14 @@ #include "WindowFeatures.h" #include "DatabaseTracker.h" #include "SecurityOrigin.h" +#include "QWebPageClient.h" #include "qwebpage.h" #include "qwebpage_p.h" #include "qwebframe_p.h" #include "qwebsecurityorigin.h" #include "qwebsecurityorigin_p.h" +#include "qwebview.h" #include <qtooltip.h> #include <qtextdocument.h> @@ -303,16 +305,15 @@ IntRect ChromeClientQt::windowResizerRect() const return IntRect(); } -void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, bool immediate, bool repaintContentOnly) +void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, bool, bool) { // No double buffer, so only update the QWidget if content changed. if (contentChanged) { - QWidget* view = m_webPage->view(); - if (view) { + if (platformPageClient()) { QRect rect(windowRect); rect = rect.intersected(QRect(QPoint(0, 0), m_webPage->viewportSize())); if (!rect.isEmpty()) - view->update(rect); + platformPageClient()->update(rect); } emit m_webPage->repaintRequested(windowRect); } @@ -323,9 +324,8 @@ void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, boo void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect, const IntRect&) { - QWidget* view = m_webPage->view(); - if (view) - view->scroll(delta.width(), delta.height(), scrollViewRect); + if (platformPageClient()) + platformPageClient()->scroll(delta.width(), delta.height(), scrollViewRect); emit m_webPage->scrollRequested(delta.width(), delta.height(), scrollViewRect); } @@ -341,9 +341,9 @@ IntPoint ChromeClientQt::screenToWindow(const IntPoint& point) const return point; } -PlatformWidget ChromeClientQt::platformWindow() const +PlatformPageClient ChromeClientQt::platformPageClient() const { - return m_webPage->view(); + return m_webPage->d->client; } void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const @@ -351,7 +351,7 @@ void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) cons emit QWebFramePrivate::kit(frame)->contentsSizeChanged(size); } -void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags) +void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned) { TextDirection dir; if (result.absoluteLinkURL() != lastHoverURL @@ -402,7 +402,7 @@ void ChromeClientQt::exceededDatabaseQuota(Frame* frame, const String& databaseN #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) -void ChromeClientQt::reachedMaxAppCacheSize(int64_t spaceNeeded) +void ChromeClientQt::reachedMaxAppCacheSize(int64_t) { // FIXME: Free some space. notImplemented(); @@ -419,7 +419,7 @@ void ChromeClientQt::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileC option.parentFrame = QWebFramePrivate::kit(frame); if (!fileChooser->filenames().isEmpty()) - for (int i = 0; i < fileChooser->filenames().size(); ++i) + for (unsigned i = 0; i < fileChooser->filenames().size(); ++i) option.suggestedFileNames += fileChooser->filenames()[i]; QWebPage::ChooseMultipleFilesExtensionReturn output; diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 96c7fab..196c4fc 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -105,9 +105,10 @@ namespace WebCore { virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); virtual IntPoint screenToWindow(const IntPoint&) const; virtual IntRect windowToScreen(const IntRect&) const; - virtual PlatformWidget platformWindow() const; + virtual PlatformPageClient platformPageClient() const; virtual void contentsSizeChanged(Frame*, const IntSize&) const; + virtual void scrollbarsModeDidChange() const { } virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); virtual void setToolTip(const String&, TextDirection); diff --git a/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp b/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp index ed79946..b4400ff 100644 --- a/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp @@ -52,7 +52,7 @@ void ContextMenuClientQt::contextMenuItemSelected(ContextMenuItem*, const Contex notImplemented(); } -void ContextMenuClientQt::downloadURL(const KURL& url) +void ContextMenuClientQt::downloadURL(const KURL&) { notImplemented(); } diff --git a/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/WebKit/qt/WebCoreSupport/DragClientQt.cpp index 0df0768..99e438d 100644 --- a/WebKit/qt/WebCoreSupport/DragClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/DragClientQt.cpp @@ -66,6 +66,8 @@ void DragClientQt::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Cli QWidget* view = m_webPage->view(); if (view) { QDrag *drag = new QDrag(view); + if (clipboardData->hasImage()) + drag->setPixmap(qvariant_cast<QPixmap>(clipboardData->imageData())); drag->setMimeData(clipboardData); drag->start(); } diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 995d61d..5d5df97 100644 --- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -41,6 +41,7 @@ #include "FocusController.h" #include "Frame.h" #include "HTMLElement.h" +#include "HTMLNames.h" #include "KeyboardCodes.h" #include "KeyboardEvent.h" #include "NotImplemented.h" @@ -96,6 +97,7 @@ static QString dumpRange(WebCore::Range *range) namespace WebCore { +using namespace HTMLNames; bool EditorClientQt::shouldDeleteRange(Range* range) { @@ -108,7 +110,7 @@ bool EditorClientQt::shouldDeleteRange(Range* range) bool EditorClientQt::shouldShowDeleteInterface(HTMLElement* element) { if (QWebPagePrivate::drtRun) - return element->className() == "needsDeletionUI"; + return element->getAttribute(classAttr) == "needsDeletionUI"; return false; } @@ -218,7 +220,9 @@ void EditorClientQt::respondToChangedSelection() m_page->d->updateEditorActions(); emit m_page->selectionChanged(); - emit m_page->microFocusChanged(); + Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame(); + if (!frame->editor()->ignoreCompositionSelectionChange()) + emit m_page->microFocusChanged(); } void EditorClientQt::didEndEditing() @@ -593,10 +597,10 @@ bool EditorClientQt::isEditing() const void EditorClientQt::setInputMethodState(bool active) { QWidget *view = m_page->view(); - if (view) { + if (view) view->setAttribute(Qt::WA_InputMethodEnabled, active); - emit m_page->microFocusChanged(); - } + + emit m_page->microFocusChanged(); } } diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 5cf86b1..665f16a 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -55,8 +55,10 @@ #include "ResourceHandle.h" #include "Settings.h" #include "ScriptString.h" +#include "QWebPageClient.h" #include "qwebpage.h" +#include "qwebpage_p.h" #include "qwebframe.h" #include "qwebframe_p.h" #include "qwebhistoryinterface.h" @@ -67,6 +69,8 @@ #include <QCoreApplication> #include <QDebug> #if QT_VERSION >= 0x040400 +#include <QGraphicsScene> +#include <QGraphicsWidget> #include <QNetworkRequest> #include <QNetworkReply> #else @@ -144,7 +148,7 @@ FrameLoaderClientQt::FrameLoaderClientQt() , m_pluginView(0) , m_hasSentResponseToPlugin(false) , m_firstData(false) - , m_loadSucceeded(false) + , m_loadError (ResourceError()) { } @@ -183,7 +187,7 @@ QWebFrame* FrameLoaderClientQt::webFrame() const void FrameLoaderClientQt::callPolicyFunction(FramePolicyFunction function, PolicyAction action) { - (m_frame->loader()->*function)(action); + (m_frame->loader()->policyChecker()->*function)(action); } bool FrameLoaderClientQt::hasWebView() const @@ -282,9 +286,7 @@ void FrameLoaderClientQt::dispatchDidCancelClientRedirect() } -void FrameLoaderClientQt::dispatchWillPerformClientRedirect(const KURL& url, - double interval, - double fireDate) +void FrameLoaderClientQt::dispatchWillPerformClientRedirect(const KURL& url, double, double) { if (dumpFrameLoaderCallbacks) printf("%s - willPerformClientRedirectToURL: %s \n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)), qPrintable(drtDescriptionSuitableForTestResult(url))); @@ -376,7 +378,7 @@ void FrameLoaderClientQt::dispatchDidFinishLoad() if (dumpFrameLoaderCallbacks) printf("%s - didFinishLoadForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); - m_loadSucceeded = true; + m_loadError = ResourceError(); // clears the previous error if (!m_webFrame) return; @@ -461,10 +463,10 @@ void FrameLoaderClientQt::postProgressFinishedNotification() } if (m_webFrame && m_frame->page()) - emit loadFinished(m_loadSucceeded); + emit loadFinished(m_loadError.isNull()); } -void FrameLoaderClientQt::setMainFrameDocumentReady(bool b) +void FrameLoaderClientQt::setMainFrameDocumentReady(bool) { // this is only interesting once we provide an external API for the DOM } @@ -514,13 +516,13 @@ bool FrameLoaderClientQt::canShowMIMEType(const String& MIMEType) const return false; } -bool FrameLoaderClientQt::representationExistsForURLScheme(const String& URLScheme) const +bool FrameLoaderClientQt::representationExistsForURLScheme(const String&) const { return false; } -String FrameLoaderClientQt::generatedMIMETypeForURLScheme(const String& URLScheme) const +String FrameLoaderClientQt::generatedMIMETypeForURLScheme(const String&) const { notImplemented(); return String(); @@ -632,11 +634,21 @@ void FrameLoaderClientQt::updateGlobalHistoryRedirectLinks() { } -bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem *item) const +bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem *) const { return true; } +void FrameLoaderClientQt::didDisplayInsecureContent() +{ + notImplemented(); +} + +void FrameLoaderClientQt::didRunInsecureContent(WebCore::SecurityOrigin*) +{ + notImplemented(); +} + void FrameLoaderClientQt::saveViewStateToItem(WebCore::HistoryItem* item) { QWebHistoryItem historyItem(new QWebHistoryItemPrivate(item)); @@ -692,8 +704,10 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c WebCore::ResourceError FrameLoaderClientQt::cancelledError(const WebCore::ResourceRequest& request) { - return ResourceError("Error", -999, request.url().prettyURL(), + ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().prettyURL(), QCoreApplication::translate("QWebFrame", "Request cancelled", 0, QCoreApplication::UnicodeUTF8)); + error.setIsCancellation(true); + return error; } // copied from WebKit/Misc/WebKitErrors[Private].h @@ -709,36 +723,36 @@ enum { WebCore::ResourceError FrameLoaderClientQt::blockedError(const WebCore::ResourceRequest& request) { - return ResourceError("Error", WebKitErrorCannotUseRestrictedPort, request.url().prettyURL(), + return ResourceError("WebKit", WebKitErrorCannotUseRestrictedPort, request.url().prettyURL(), QCoreApplication::translate("QWebFrame", "Request blocked", 0, QCoreApplication::UnicodeUTF8)); } WebCore::ResourceError FrameLoaderClientQt::cannotShowURLError(const WebCore::ResourceRequest& request) { - return ResourceError("Error", WebKitErrorCannotShowURL, request.url().string(), + return ResourceError("WebKit", WebKitErrorCannotShowURL, request.url().string(), QCoreApplication::translate("QWebFrame", "Cannot show URL", 0, QCoreApplication::UnicodeUTF8)); } WebCore::ResourceError FrameLoaderClientQt::interruptForPolicyChangeError(const WebCore::ResourceRequest& request) { - return ResourceError("Error", WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), - QCoreApplication::translate("QWebFrame", "Frame load interruped by policy change", 0, QCoreApplication::UnicodeUTF8)); + return ResourceError("WebKit", WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), + QCoreApplication::translate("QWebFrame", "Frame load interrupted by policy change", 0, QCoreApplication::UnicodeUTF8)); } WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response) { - return ResourceError("Error", WebKitErrorCannotShowMIMEType, response.url().string(), + return ResourceError("WebKit", WebKitErrorCannotShowMIMEType, response.url().string(), QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0, QCoreApplication::UnicodeUTF8)); } WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response) { - return ResourceError("Error", -998 /* ### */, response.url().string(), + return ResourceError("QtNetwork", QNetworkReply::ContentNotFoundError, response.url().string(), QCoreApplication::translate("QWebFrame", "File does not exist", 0, QCoreApplication::UnicodeUTF8)); } -WebCore::ResourceError FrameLoaderClientQt::pluginWillHandleLoadError(const WebCore::ResourceResponse& response) +WebCore::ResourceError FrameLoaderClientQt::pluginWillHandleLoadError(const WebCore::ResourceResponse&) { notImplemented(); return ResourceError(); @@ -776,7 +790,7 @@ void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCor #endif } -void FrameLoaderClientQt::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader* loader, const WebCore::ResourceRequest& request) +void FrameLoaderClientQt::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest& request) { if (dumpResourceLoadCallbacks) dumpAssignedUrls[identifier] = drtDescriptionSuitableForTestResult(request.url()); @@ -823,7 +837,7 @@ void FrameLoaderClientQt::dispatchDidReceiveContentLength(WebCore::DocumentLoade { } -void FrameLoaderClientQt::dispatchDidFinishLoading(WebCore::DocumentLoader* loader, unsigned long) +void FrameLoaderClientQt::dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long) { } @@ -850,20 +864,58 @@ void FrameLoaderClientQt::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, notImplemented(); } -void FrameLoaderClientQt::dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) +void FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& error) +{ + QWebPage* page = m_webFrame->page(); + if (page->supportsExtension(QWebPage::ErrorPageExtension)) { + QWebPage::ErrorPageExtensionOption option; + + if (error.domain() == "QtNetwork") + option.domain = QWebPage::QtNetwork; + else if (error.domain() == "HTTP") + option.domain = QWebPage::Http; + else if (error.domain() == "WebKit") + option.domain = QWebPage::WebKit; + else + return; + + option.url = QUrl(error.failingURL()); + option.frame = m_webFrame; + option.error = error.errorCode(); + option.errorString = error.localizedDescription(); + + QWebPage::ErrorPageExtensionReturn output; + if (!page->extension(QWebPage::ErrorPageExtension, &option, &output)) + return; + + KURL baseUrl(output.baseUrl); + KURL failingUrl(option.url); + + WebCore::ResourceRequest request(baseUrl); + WTF::RefPtr<WebCore::SharedBuffer> buffer = WebCore::SharedBuffer::create(output.content.constData(), output.content.length()); + WebCore::SubstituteData substituteData(buffer, output.contentType, output.encoding, failingUrl); + m_frame->loader()->load(request, substituteData, false); + } +} + +void FrameLoaderClientQt::dispatchDidFailProvisionalLoad(const WebCore::ResourceError& error) { if (dumpFrameLoaderCallbacks) printf("%s - didFailProvisionalLoadWithError\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); - m_loadSucceeded = false; + m_loadError = error; + if (!error.isNull() && !error.isCancellation()) + callErrorPageExtension(error); } -void FrameLoaderClientQt::dispatchDidFailLoad(const WebCore::ResourceError&) +void FrameLoaderClientQt::dispatchDidFailLoad(const WebCore::ResourceError& error) { if (dumpFrameLoaderCallbacks) printf("%s - didFailLoadWithError\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); - m_loadSucceeded = false; + m_loadError = error; + if (!error.isNull() && !error.isCancellation()) + callErrorPageExtension(error); } WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage() @@ -946,7 +998,6 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request) if (!m_webFrame) return; - QWebPage *page = m_webFrame->page(); emit m_webFrame->page()->downloadRequested(request.toNetworkRequest()); #endif } @@ -976,9 +1027,6 @@ PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String // ### set override encoding if we have one - FrameLoadType loadType = m_frame->loader()->loadType(); - FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedBackForwardList; - frameData.frame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, frameData.frame.get()); // The frame's onload handler may have removed it from the document. @@ -1074,6 +1122,53 @@ public: } }; +#if QT_VERSION >= 0x040600 +class QtPluginGraphicsWidget: public Widget +{ +public: + static RefPtr<QtPluginGraphicsWidget> create(QGraphicsWidget* w = 0) + { + return adoptRef(new QtPluginGraphicsWidget(w)); + } + + ~QtPluginGraphicsWidget() + { + if (graphicsWidget) + graphicsWidget->deleteLater(); + } + virtual void invalidateRect(const IntRect& r) + { + QGraphicsScene* scene = graphicsWidget ? graphicsWidget->scene() : 0; + if (scene) + scene->update(QRect(r)); + } + virtual void frameRectsChanged() + { + if (!graphicsWidget) + return; + + IntRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height())); + graphicsWidget->setGeometry(QRect(windowRect)); + + // FIXME: clipping of graphics widgets + } + virtual void show() + { + if (graphicsWidget) + graphicsWidget->show(); + } + virtual void hide() + { + if (graphicsWidget) + graphicsWidget->hide(); + } +private: + QtPluginGraphicsWidget(QGraphicsWidget* w = 0): Widget(0), graphicsWidget(w) {} + + QGraphicsWidget* graphicsWidget; +}; +#endif + PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) { @@ -1087,12 +1182,12 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, QStringList values; QString classid(element->getAttribute("classid")); - for (int i = 0; i < paramNames.size(); ++i) { + for (unsigned i = 0; i < paramNames.size(); ++i) { params.append(paramNames[i]); if (paramNames[i] == "classid") classid = paramValues[i]; } - for (int i = 0; i < paramValues.size(); ++i) + for (unsigned i = 0; i < paramValues.size(); ++i) values.append(paramValues[i]); QString urlStr(url.string()); @@ -1110,7 +1205,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, if (!styleSheet.isEmpty()) styleSheet += QLatin1Char(';'); - for (int i = 0; i < numqStyleSheetProperties; ++i) { + for (unsigned i = 0; i < numqStyleSheetProperties; ++i) { CSSPropertyID property = qstyleSheetProperties[i]; styleSheet += QString::fromLatin1(::getPropertyName(property)); @@ -1135,15 +1230,26 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, if (object) { QWidget* widget = qobject_cast<QWidget*>(object); if (widget) { - QWidget* view = m_webFrame->page()->view(); - if (view) - widget->setParent(view); + QWidget* parentWidget = qobject_cast<QWidget*>(m_webFrame->page()->d->client->pluginParent()); + if (parentWidget) + widget->setParent(parentWidget); RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget()); w->setPlatformWidget(widget); // Make sure it's invisible until properly placed into the layout w->setFrameRect(IntRect(0, 0, 0, 0)); return w; } +#if QT_VERSION >= 0x040600 + QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(object); + if (graphicsWidget) { + graphicsWidget->hide(); + graphicsWidget->setParentItem(qobject_cast<QGraphicsObject*>(m_webFrame->page()->d->client->pluginParent())); + RefPtr<QtPluginGraphicsWidget> w = QtPluginGraphicsWidget::create(graphicsWidget); + // Make sure it's invisible until properly placed into the layout + w->setFrameRect(IntRect(0, 0, 0, 0)); + return w; + } +#endif // FIXME: make things work for widgetless plugins as well delete object; } else { // NPAPI Plugins @@ -1162,8 +1268,8 @@ void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget) m_hasSentResponseToPlugin = false; } -PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, - const Vector<String>& paramNames, const Vector<String>& paramValues) +PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, + const Vector<String>&, const Vector<String>&) { notImplemented(); return 0; diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index 754d8bc..66c4252 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -59,6 +59,7 @@ namespace WebCore { friend class ::QWebFrame; void callPolicyFunction(FramePolicyFunction function, PolicyAction action); + void callErrorPageExtension(const ResourceError&); signals: void loadStarted(); void loadProgress(int d); @@ -148,6 +149,9 @@ namespace WebCore { virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(HistoryItem*) const; + virtual void didDisplayInsecureContent(); + virtual void didRunInsecureContent(SecurityOrigin*); + virtual ResourceError cancelledError(const ResourceRequest&); virtual ResourceError blockedError(const ResourceRequest&); virtual ResourceError cannotShowURLError(const ResourceRequest&); @@ -211,7 +215,7 @@ namespace WebCore { WebCore::PluginView* m_pluginView; bool m_hasSentResponseToPlugin; - bool m_loadSucceeded; + ResourceError m_loadError; }; } diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index d7f03d1..12f405c 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -31,10 +31,13 @@ #include "config.h" #include "InspectorClientQt.h" +#include "qwebinspector.h" +#include "qwebinspector_p.h" #include "qwebpage.h" #include "qwebpage_p.h" #include "qwebview.h" +#include <QtCore/QSettings> #include <QtCore/QCoreApplication> #include "InspectorController.h" @@ -44,49 +47,32 @@ namespace WebCore { -class InspectorClientWebPage : public QWebPage -{ - Q_OBJECT - friend class InspectorClientQt; -public: - QWebPage* createWindow(QWebPage::WebWindowType) - { - QWidget *w = new QWebView(0); - QWebPage *page = new QWebPage(w); - page->setView(w); - connect(page, SIGNAL(destroyed()), w, SLOT(deleteLater())); - return page; - } - -Q_SIGNALS: - void attachRequested(); - void detachRequested(); -}; +static const QLatin1String settingStoragePrefix("Qt/QtWebKit/QWebInspector/"); +static const QLatin1String settingStorageTypeSuffix(".type"); +static InspectorController::Setting variantToSetting(const QVariant& qvariant); +static QVariant settingToVariant(const InspectorController::Setting& icSetting); -class InspectorClientView : public QWebView { +class InspectorClientWebPage : public QWebPage { + Q_OBJECT + friend class InspectorClientQt; public: - InspectorClientView(InspectorController* controller) - : QWebView(0) - , m_controller(controller) + InspectorClientWebPage(QObject* parent = 0) + : QWebPage(parent) { - setPage(new InspectorClientWebPage); - connect(page(), SIGNAL(destroyed()), SLOT(deleteLater())); + settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false); } -protected: - - void closeEvent(QCloseEvent* ev) + QWebPage* createWindow(QWebPage::WebWindowType) { - QWidget::closeEvent(ev); - m_controller->setWindowVisible(false); + QWebView* view = new QWebView; + QWebPage* page = new QWebPage; + view->setPage(page); + view->setAttribute(Qt::WA_DeleteOnClose); + return page; } - -private: - InspectorController* m_controller; }; - InspectorClientQt::InspectorClientQt(QWebPage* page) : m_inspectedWebPage(page) {} @@ -98,14 +84,16 @@ void InspectorClientQt::inspectorDestroyed() Page* InspectorClientQt::createPage() { - if (m_webPage) - return m_webPage->d->page; + QWebView* inspectorView = new QWebView; + InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView); + inspectorView->setPage(inspectorPage); + m_inspectorView.set(inspectorView); + + inspectorPage->mainFrame()->load(QString::fromLatin1("qrc:/webkit/inspector/inspector.html")); + m_inspectedWebPage->d->inspectorFrontend = inspectorView; + m_inspectedWebPage->d->getOrCreateInspector()->d->setFrontend(inspectorView); - InspectorClientView* view = new InspectorClientView(m_inspectedWebPage->d->page->inspectorController()); - m_webPage.set(qobject_cast<InspectorClientWebPage*>(view->page())); - m_webPage->mainFrame()->load(QString::fromLatin1("qrc:/webkit/inspector/inspector.html")); - m_webPage->view()->setMinimumSize(400,300); - return m_webPage->d->page; + return m_inspectorView->page()->d->page; } String InspectorClientQt::localizedStringsURL() @@ -122,52 +110,37 @@ String InspectorClientQt::hiddenPanels() void InspectorClientQt::showWindow() { - if (!m_webPage) - return; - updateWindowTitle(); - m_webPage->view()->show(); - m_inspectedWebPage->d->page->inspectorController()->setWindowVisible(true); -} -void InspectorClientQt::closeWindow() -{ - if (!m_webPage) - return; - - m_webPage->view()->hide(); - m_inspectedWebPage->d->page->inspectorController()->setWindowVisible(false); + m_inspectedWebPage->d->inspectorController()->setWindowVisible(true, true); + // We don't allow the inspector to ask for widget visibility itself because showWindow is + // not always called when we want. + // Inspecting an element or calling QWebInspector::show() should already have made the + // widget visible. } -bool InspectorClientQt::windowVisible() +void InspectorClientQt::closeWindow() { - if (!m_webPage) - return false; - return m_webPage->view()->isVisible(); + if (m_inspectedWebPage->d->inspector) + m_inspectedWebPage->d->inspector->close(); } void InspectorClientQt::attachWindow() { - if (!m_webPage) - return; - - emit m_webPage->attachRequested(); + notImplemented(); } void InspectorClientQt::detachWindow() { - if (!m_webPage) - return; - - emit m_webPage->detachRequested(); + notImplemented(); } -void InspectorClientQt::setAttachedWindowHeight(unsigned height) +void InspectorClientQt::setAttachedWindowHeight(unsigned) { notImplemented(); } -void InspectorClientQt::highlight(Node* node) +void InspectorClientQt::highlight(Node*) { notImplemented(); } @@ -190,28 +163,112 @@ void InspectorClientQt::inspectorWindowObjectCleared() void InspectorClientQt::updateWindowTitle() { - if (!m_webPage) - return; - - QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2"); - m_webPage->view()->setWindowTitle(caption.arg(m_inspectedURL)); + if (m_inspectedWebPage->d->inspector) { + QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL); + m_inspectedWebPage->d->inspector->setWindowTitle(caption); + emit m_inspectedWebPage->d->inspector->windowTitleChanged(caption); + } } void InspectorClientQt::populateSetting(const String& key, InspectorController::Setting& setting) { - notImplemented(); + QSettings qsettings; + if (qsettings.status() == QSettings::AccessError) { + // QCoreApplication::setOrganizationName and QCoreApplication::setApplicationName haven't been called + qWarning("QWebInspector: QSettings couldn't read configuration setting [%s].", + qPrintable(static_cast<QString>(key))); + return; + } + + QString settingKey(settingStoragePrefix + key); + QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString(); + QVariant storedValue = qsettings.value(settingKey); + storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data())); + setting = variantToSetting(storedValue); } void InspectorClientQt::storeSetting(const String& key, const InspectorController::Setting& setting) { - notImplemented(); + QSettings qsettings; + if (qsettings.status() == QSettings::AccessError) { + qWarning("QWebInspector: QSettings couldn't persist configuration setting [%s].", + qPrintable(static_cast<QString>(key))); + return; + } + + QVariant valueToStore = settingToVariant(setting); + QString settingKey(settingStoragePrefix + key); + qsettings.setValue(settingKey, valueToStore); + qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type())); } -void InspectorClientQt::removeSetting(const String& key) +void InspectorClientQt::removeSetting(const String&) { notImplemented(); } +static InspectorController::Setting variantToSetting(const QVariant& qvariant) +{ + InspectorController::Setting retVal; + + switch (qvariant.type()) { + case QVariant::Bool: + retVal.set(qvariant.toBool()); + break; + case QVariant::Double: + retVal.set(qvariant.toDouble()); + break; + case QVariant::Int: + retVal.set((long)qvariant.toInt()); + break; + case QVariant::String: + retVal.set(qvariant.toString()); + break; + case QVariant::StringList: { + QStringList qsList = qvariant.toStringList(); + int listCount = qsList.count(); + Vector<String> vector(listCount); + for (int i = 0; i < listCount; ++i) + vector[i] = qsList[i]; + retVal.set(vector); + break; + } + } + + return retVal; +} + +static QVariant settingToVariant(const InspectorController::Setting& icSetting) +{ + QVariant retVal; + + switch (icSetting.type()) { + case InspectorController::Setting::StringType: + retVal.setValue(static_cast<QString>(icSetting.string())); + break; + case InspectorController::Setting::StringVectorType: { + const Vector<String>& vector = icSetting.stringVector(); + Vector<String>::const_iterator iter; + QStringList qsList; + for (iter = vector.begin(); iter != vector.end(); ++iter) + qsList << *iter; + retVal.setValue(qsList); + break; + } + case InspectorController::Setting::DoubleType: + retVal.setValue(icSetting.doubleValue()); + break; + case InspectorController::Setting::IntegerType: + retVal.setValue((int)icSetting.integerValue()); + break; + case InspectorController::Setting::BooleanType: + retVal.setValue(icSetting.booleanValue()); + break; + } + + return retVal; +} + } #include "InspectorClientQt.moc" diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/WebKit/qt/WebCoreSupport/InspectorClientQt.h index 03c684a..ccf8b69 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.h +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.h @@ -35,12 +35,12 @@ #include <QtCore/QString> class QWebPage; +class QWebView; namespace WebCore { class Node; class Page; class String; - class InspectorClientWebPage; class InspectorClientQt : public InspectorClient { public: @@ -56,7 +56,6 @@ namespace WebCore { virtual void showWindow(); virtual void closeWindow(); - virtual bool windowVisible(); virtual void attachWindow(); virtual void detachWindow(); @@ -76,7 +75,7 @@ namespace WebCore { private: void updateWindowTitle(); QWebPage* m_inspectedWebPage; - OwnPtr<InspectorClientWebPage> m_webPage; + OwnPtr<QWebView> m_inspectorView; QString m_inspectedURL; }; } diff --git a/WebKit/qt/docs/qtwebkit.qdoc b/WebKit/qt/docs/qtwebkit.qdoc index f3681ee..09dfae5 100644 --- a/WebKit/qt/docs/qtwebkit.qdoc +++ b/WebKit/qt/docs/qtwebkit.qdoc @@ -1,18 +1,70 @@ /*! \module QtWebKit \title QtWebKit Module - \contentspage Qt's Modules + \contentspage All Qt Modules \previouspage QtSvg \nextpage QtXml - \ingroup architecture \ingroup modules - \brief An introduction to the QtWebKit module. + \brief The QtWebKit module provides a web browser engine as well as + classes to render and interact with web content. - \keyword Browser - \keyword Web Browser + To include the definitions of the module's classes, use the + following directive: + + \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 1 + + To link against the module, add this line to your \l qmake \c + .pro file: + + \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 0 + + \section1 License Information + + This is a snapshot of the Qt port of WebKit. The exact version information + can be found in the \c{src/3rdparty/webkit/VERSION} file supplied with Qt. + Qt Commercial Edition licensees that wish to distribute applications that + use the QtWebKit module need to be aware of their obligations under the + GNU Lesser General Public License (LGPL). + + Developers using the Open Source Edition can choose to redistribute + the module under the appropriate version of the GNU LGPL; version 2.1 + for applications and libraries licensed under the GNU GPL version 2, + or version 3 for applications and libraries licensed under the GNU + GPL version 2. + + \legalese + WebKit is licensed under the GNU Library General Public License. + Individual contributor names and copyright dates can be found + inline in the code. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + \endlegalese +*/ + +/*! + \page webintegration.html + \title Integrating Web Content with QtWebKit \since 4.4 + \ingroup frameworks-technologies + + \keyword Browser + \keyword Web Browser + QtWebKit provides a Web browser engine that makes it easy to embed content from the World Wide Web into your Qt application. At the same time Web content can be enhanced with native controls. @@ -55,20 +107,6 @@ \tableofcontents - \section1 Configuring the Build Process - - Applications using QtWebKit's classes need to be configured to be built - against the QtWebKit module. The following declaration in a \c qmake - project file ensures that an application is compiled and linked - appropriately: - - \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 0 - - To include the definitions of the module's classes, use the following - directive: - - \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 1 - \section1 Architecture The easiest way to render content is through the QWebView class. As a @@ -101,15 +139,18 @@ \section1 Netscape Plugin Support + \note Netscape plugin support is only available on desktop platforms. + Since WebKit supports the Netscape Plugin API, Qt applications can display - Web pages that embed common plugins, as long as the user has the appropriate + Web pages that embed common plugins on platforms for which those plugins + are available. To enable plugin support, the user must have the appropriate binary files for those plugins installed and the \l{QWebSettings::PluginsEnabled} - attribute is enabled for the application. + attribute must be enabled for the application. The following locations are searched for plugins: \table - \header \o Linux/Unix \o Windows + \header \o Linux/Unix (X11) \o Windows \row \o{1,3} \list \o \c{.mozilla/plugins} in the user's home directory @@ -158,40 +199,4 @@ \o The system \c{/Library/Internet Plug-Ins} directory \endlist \endtable - - \section1 License Information - - This is a snapshot of the Qt port of WebKit. The exact version information - can be found in the \c{src/3rdparty/webkit/VERSION} file supplied with Qt. - - Qt Commercial Edition licensees that wish to distribute applications that - use the QtWebKit module need to be aware of their obligations under the - GNU Lesser General Public License (LGPL). - - Developers using the Open Source Edition can choose to redistribute - the module under the appropriate version of the GNU LGPL; version 2.1 - for applications and libraries licensed under the GNU GPL version 2, - or version 3 for applications and libraries licensed under the GNU - GPL version 2. - - \legalese - WebKit is licensed under the GNU Library General Public License. - Individual contributor names and copyright dates can be found - inline in the code. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - \endlegalese */ diff --git a/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp b/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp new file mode 100644 index 0000000..0ba1cad --- /dev/null +++ b/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp @@ -0,0 +1,17 @@ + +void wrapInFunction() +{ + +//! [0] + // ... + QWebPage *page = new QWebPage; + // ... + + QWebInspector *inspector = new QWebInspector; + inspector->setPage(page); + + connect(page, SIGNAL(webInspectorTriggered(const QWebElement&)), inspector, SLOT(show())); +//! [0] + +} + diff --git a/WebKit/qt/docs/webkitsnippets/simple/main.cpp b/WebKit/qt/docs/webkitsnippets/simple/main.cpp index 82f5b6c..408630e 100644 --- a/WebKit/qt/docs/webkitsnippets/simple/main.cpp +++ b/WebKit/qt/docs/webkitsnippets/simple/main.cpp @@ -27,7 +27,7 @@ int main(int argc, char *argv[]) QWidget *parent = 0; //! [Using QWebView] QWebView *view = new QWebView(parent); - view->load(QUrl("http://qtsoftware.com/")); + view->load(QUrl("http://qt.nokia.com/")); view->show(); //! [Using QWebView] return app.exec(); diff --git a/WebKit/qt/docs/webkitsnippets/webpage/main.cpp b/WebKit/qt/docs/webkitsnippets/webpage/main.cpp index b91bc30..393b16a 100644 --- a/WebKit/qt/docs/webkitsnippets/webpage/main.cpp +++ b/WebKit/qt/docs/webkitsnippets/webpage/main.cpp @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - Thumbnailer thumbnail(QUrl("http://qtsoftware.com")); + Thumbnailer thumbnail(QUrl("http://qt.nokia.com")); QObject::connect(&thumbnail, SIGNAL(finished()), &app, SLOT(quit())); diff --git a/WebKit/qt/tests/benchmarks/loading/tst_loading.pro b/WebKit/qt/tests/benchmarks/loading/tst_loading.pro index af0387e..80717c2 100644 --- a/WebKit/qt/tests/benchmarks/loading/tst_loading.pro +++ b/WebKit/qt/tests/benchmarks/loading/tst_loading.pro @@ -4,3 +4,5 @@ include(../../../../../WebKit.pri) SOURCES += tst_loading.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E541 diff --git a/WebKit/qt/tests/benchmarks/painting/tst_painting.pro b/WebKit/qt/tests/benchmarks/painting/tst_painting.pro index 496210e..f45d804 100644 --- a/WebKit/qt/tests/benchmarks/painting/tst_painting.pro +++ b/WebKit/qt/tests/benchmarks/painting/tst_painting.pro @@ -4,3 +4,5 @@ include(../../../../../WebKit.pri) SOURCES += tst_painting.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E542 diff --git a/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro b/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro new file mode 100644 index 0000000..cba6f11 --- /dev/null +++ b/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro @@ -0,0 +1,6 @@ +TEMPLATE = app +TARGET = tst_qgraphicswebview +include(../../../../WebKit.pri) +SOURCES += tst_qgraphicswebview.cpp +QT += testlib network +QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR diff --git a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp new file mode 100644 index 0000000..1a57286 --- /dev/null +++ b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp @@ -0,0 +1,58 @@ +/* + Copyright (C) 2009 Jakub Wieczorek <faw217@gmail.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <QtTest/QtTest> + +#include <qgraphicswebview.h> + +class tst_QGraphicsWebView : public QObject +{ + Q_OBJECT + +private slots: + void qgraphicswebview(); +}; + +void tst_QGraphicsWebView::qgraphicswebview() +{ + QGraphicsWebView item; + item.url(); + item.title(); + item.icon(); + item.zoomFactor(); + item.isInteractive(); + item.progress(); + item.toHtml(); + item.history(); + item.settings(); + item.status(); + item.page(); + item.setPage(0); + item.page(); + item.setUrl(QUrl()); + item.setZoomFactor(0); + item.setInteractive(true); + item.load(QUrl()); + item.setHtml(QString()); + item.setContent(QByteArray()); +} + +QTEST_MAIN(tst_QGraphicsWebView) + +#include "tst_qgraphicswebview.moc" diff --git a/WebKit/qt/tests/qwebelement/qwebelement.pro b/WebKit/qt/tests/qwebelement/qwebelement.pro index dd0b88a..0a140ad 100644 --- a/WebKit/qt/tests/qwebelement/qwebelement.pro +++ b/WebKit/qt/tests/qwebelement/qwebelement.pro @@ -5,3 +5,5 @@ SOURCES += tst_qwebelement.cpp RESOURCES += qwebelement.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E53A diff --git a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp index 0819a3a..00783d1 100644 --- a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp +++ b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp @@ -71,15 +71,11 @@ private slots: void classes(); void namespaceURI(); void foreachManipulation(); - void evaluateScript(); - void callFunction(); - void callFunctionSubmitForm(); - void functionNames(); + void evaluateJavaScript(); void documentElement(); void frame(); void style(); void computedStyle(); - void properties(); void appendAndPrepend(); void insertBeforeAndAfter(); void remove(); @@ -90,6 +86,7 @@ private slots: void nullSelect(); void firstChildNextSibling(); void lastChildPreviousSibling(); + void hasSetFocus(); private: QWebView* m_view; @@ -282,69 +279,31 @@ void tst_QWebElement::foreachManipulation() QCOMPARE(body.findAll("div").count(), 4); } -void tst_QWebElement::evaluateScript() +void tst_QWebElement::evaluateJavaScript() { QVariant result; m_mainFrame->setHtml("<body><p>test"); QWebElement para = m_mainFrame->findFirstElement("p"); - result = para.evaluateScript("this.tagName"); + result = para.evaluateJavaScript("this.tagName"); QVERIFY(result.isValid()); QVERIFY(result.type() == QVariant::String); QCOMPARE(result.toString(), QLatin1String("P")); - QVERIFY(para.functions().contains("hasAttributes")); - result = para.evaluateScript("this.hasAttributes()"); + result = para.evaluateJavaScript("this.hasAttributes()"); QVERIFY(result.isValid()); QVERIFY(result.type() == QVariant::Bool); QVERIFY(!result.toBool()); - para.evaluateScript("this.setAttribute('align', 'left');"); + para.evaluateJavaScript("this.setAttribute('align', 'left');"); QCOMPARE(para.attribute("align"), QLatin1String("left")); - result = para.evaluateScript("this.hasAttributes()"); + result = para.evaluateJavaScript("this.hasAttributes()"); QVERIFY(result.isValid()); QVERIFY(result.type() == QVariant::Bool); QVERIFY(result.toBool()); } -void tst_QWebElement::callFunction() -{ - m_mainFrame->setHtml("<body><p>test"); - QWebElement body = m_mainFrame->documentElement(); - QVERIFY(body.functions().contains("hasChildNodes")); - QVariant result = body.callFunction("hasChildNodes"); - QVERIFY(result.isValid()); - QVERIFY(result.type() == QVariant::Bool); - QVERIFY(result.toBool()); - - body.callFunction("setAttribute", QVariantList() << "foo" << "bar"); - QCOMPARE(body.attribute("foo"), QString("bar")); -} - -void tst_QWebElement::callFunctionSubmitForm() -{ - m_mainFrame->setHtml(QString("<html><body><form name='tstform' action='data:text/html,foo'method='get'>" - "<input type='text'><input type='submit'></form></body></html>"), QUrl()); - - QWebElement form = m_mainFrame->documentElement().findAll("form").at(0); - QVERIFY(form.functions().contains("submit")); - QVERIFY(!form.isNull()); - form.callFunction("submit"); - - waitForSignal(m_page, SIGNAL(loadFinished(bool))); - QCOMPARE(m_mainFrame->url().toString(), QString("data:text/html,foo?")); -} - -void tst_QWebElement::functionNames() -{ - m_mainFrame->setHtml("<body><p>Test"); - - QWebElement body = m_mainFrame->documentElement(); - - QVERIFY(body.functions().contains("setAttribute")); -} - void tst_QWebElement::documentElement() { m_mainFrame->setHtml("<body><p>Test"); @@ -398,27 +357,27 @@ void tst_QWebElement::style() m_mainFrame->setHtml(html); QWebElement p = m_mainFrame->documentElement().findAll("p").at(0); - QCOMPARE(p.styleProperty("color"), QLatin1String("blue")); - QVERIFY(p.styleProperty("cursor").isEmpty()); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue")); + QVERIFY(p.styleProperty("cursor", QWebElement::InlineStyle).isEmpty()); p.setStyleProperty("color", "red"); p.setStyleProperty("cursor", "auto"); - QCOMPARE(p.styleProperty("color"), QLatin1String("red")); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("yellow")); - QCOMPARE(p.styleProperty("cursor"), QLatin1String("auto")); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("red")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("yellow")); + QCOMPARE(p.styleProperty("cursor", QWebElement::InlineStyle), QLatin1String("auto")); p.setStyleProperty("color", "green !important"); - QCOMPARE(p.styleProperty("color"), QLatin1String("green")); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("green")); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("green")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("green")); p.setStyleProperty("color", "blue"); - QCOMPARE(p.styleProperty("color"), QLatin1String("green")); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("green")); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("green")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("green")); - p.setStyleProperty("color", "blue", QWebElement::ImportantStylePriority); - QCOMPARE(p.styleProperty("color"), QLatin1String("blue")); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("blue")); + p.setStyleProperty("color", "blue !important"); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("blue")); QString html2 = "<head>" "<style type='text/css'>" @@ -434,8 +393,8 @@ void tst_QWebElement::style() m_mainFrame->setHtml(html2); p = m_mainFrame->documentElement().findAll("p").at(0); - QCOMPARE(p.styleProperty("color"), QLatin1String("blue")); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("blue")); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("blue")); QString html3 = "<head>" "<style type='text/css'>" @@ -451,8 +410,8 @@ void tst_QWebElement::style() m_mainFrame->setHtml(html3); p = m_mainFrame->documentElement().findAll("p").at(0); - QCOMPARE(p.styleProperty("color"), QLatin1String("blue")); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("blue")); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("blue")); QString html5 = "<head>" "<style type='text/css'>" @@ -468,8 +427,8 @@ void tst_QWebElement::style() m_mainFrame->setHtml(html5); p = m_mainFrame->documentElement().findAll("p").at(0); - QCOMPARE(p.styleProperty("color"), QLatin1String("")); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("red")); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red")); QString html6 = "<head>" "<link rel='stylesheet' href='qrc:/style.css' type='text/css' />" @@ -489,8 +448,8 @@ void tst_QWebElement::style() QTest::qWait(200); p = m_mainFrame->documentElement().findAll("p").at(0); - QCOMPARE(p.styleProperty("color"), QLatin1String("blue")); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("black")); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("black")); QString html7 = "<head>" "<style type='text/css'>" @@ -507,15 +466,15 @@ void tst_QWebElement::style() QTest::qWait(200); p = m_mainFrame->documentElement().findAll("p").at(0); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("black")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("black")); QString html8 = "<body><p>some text</p></body>"; m_mainFrame->setHtml(html8); p = m_mainFrame->documentElement().findAll("p").at(0); - QCOMPARE(p.styleProperty("color"), QLatin1String("")); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("")); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("")); } void tst_QWebElement::computedStyle() @@ -524,47 +483,16 @@ void tst_QWebElement::computedStyle() m_mainFrame->setHtml(html); QWebElement p = m_mainFrame->documentElement().findAll("p").at(0); - QCOMPARE(p.computedStyleProperty("cursor"), QLatin1String("auto")); - QVERIFY(!p.computedStyleProperty("cursor").isEmpty()); - QVERIFY(p.styleProperty("cursor").isEmpty()); + QCOMPARE(p.styleProperty("cursor", QWebElement::ComputedStyle), QLatin1String("auto")); + QVERIFY(!p.styleProperty("cursor", QWebElement::ComputedStyle).isEmpty()); + QVERIFY(p.styleProperty("cursor", QWebElement::InlineStyle).isEmpty()); p.setStyleProperty("cursor", "text"); p.setStyleProperty("color", "red"); - QCOMPARE(p.computedStyleProperty("cursor"), QLatin1String("text")); - QCOMPARE(p.computedStyleProperty("color"), QLatin1String("rgb(255, 0, 0)")); - QCOMPARE(p.styleProperty("color"), QLatin1String("red")); -} - -void tst_QWebElement::properties() -{ - m_mainFrame->setHtml("<body><form><input type=checkbox id=ourcheckbox checked=true>"); - - QWebElement checkBox = m_mainFrame->findFirstElement("#ourcheckbox"); - QVERIFY(!checkBox.isNull()); - - QVERIFY(checkBox.scriptableProperties().contains("checked")); - - QCOMPARE(checkBox.scriptableProperty("checked"), QVariant(true)); - checkBox.setScriptableProperty("checked", false); - QCOMPARE(checkBox.scriptableProperty("checked"), QVariant(false)); - - QVERIFY(!checkBox.scriptableProperties().contains("non_existant")); - QCOMPARE(checkBox.scriptableProperty("non_existant"), QVariant()); - - checkBox.setScriptableProperty("non_existant", "test"); - - QCOMPARE(checkBox.scriptableProperty("non_existant"), QVariant("test")); - QVERIFY(checkBox.scriptableProperties().contains("non_existant")); - - // removing scriptableProperties is currently not supported. We should look into this - // and consider the option of just allowing through the QtScript API only. -#if 0 - checkBox.setScriptableProperty("non_existant", QVariant()); - - QCOMPARE(checkBox.scriptableProperty("non_existant"), QVariant()); - QVERIFY(!checkBox.scriptableProperties().contains("non_existant")); -#endif + QCOMPARE(p.styleProperty("cursor", QWebElement::ComputedStyle), QLatin1String("text")); + QCOMPARE(p.styleProperty("color", QWebElement::ComputedStyle), QLatin1String("rgb(255, 0, 0)")); + QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("red")); } void tst_QWebElement::appendAndPrepend() @@ -878,5 +806,24 @@ void tst_QWebElement::lastChildPreviousSibling() QVERIFY(p.previousSibling().isNull()); } +void tst_QWebElement::hasSetFocus() +{ + m_mainFrame->setHtml("<html><body>" \ + "<input type='text' id='input1'/>" \ + "<br>"\ + "<input type='text' id='input2'/>" \ + "</body></html>"); + + QList<QWebElement> inputs = m_mainFrame->documentElement().findAll("input"); + QWebElement input1 = inputs.at(0); + input1.setFocus(); + QVERIFY(input1.hasFocus()); + + QWebElement input2 = inputs.at(1); + input2.setFocus(); + QVERIFY(!input1.hasFocus()); + QVERIFY(input2.hasFocus()); +} + QTEST_MAIN(tst_QWebElement) #include "tst_qwebelement.moc" diff --git a/WebKit/qt/tests/qwebframe/qwebframe.pro b/WebKit/qt/tests/qwebframe/qwebframe.pro index e45e6dc..4c92e91 100644 --- a/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -5,3 +5,6 @@ SOURCES += tst_qwebframe.cpp RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR +DEFINES += SRCDIR=\\\"$$PWD/resources\\\" + +symbian:TARGET.UID3 = 0xA000E53D diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 17dea99..80c9d72 100644 --- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -33,7 +33,10 @@ #include <QRegExp> #include <QNetworkRequest> #include <QNetworkReply> +#ifndef QT_NO_OPENSSL #include <qsslerror.h> +#endif +#include "../util.h" //TESTED_CLASS= //TESTED_FILES= @@ -578,8 +581,12 @@ private slots: void urlChange(); void domCycles(); void requestedUrl(); + void javaScriptWindowObjectCleared_data(); + void javaScriptWindowObjectCleared(); + void javaScriptWindowObjectClearedOnEvaluate(); void setHtml(); void setHtmlWithResource(); + void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); void popupFocus(); @@ -592,6 +599,7 @@ private slots: void hasSetFocus(); void render(); void scrollPosition(); + void evaluateWillCauseRepaint(); private: QString evalJS(const QString&s) { @@ -692,6 +700,7 @@ void tst_QWebFrame::init() m_page = m_view->page(); m_myObject = new MyQObject(); m_page->mainFrame()->addToJavaScriptWindowObject("myObject", m_myObject); + QDir::setCurrent(SRCDIR); } void tst_QWebFrame::cleanup() @@ -2178,8 +2187,11 @@ public: if (request.url() == QUrl("qrc:/test1.html")) { setHeader(QNetworkRequest::LocationHeader, QString("qrc:/test2.html")); setAttribute(QNetworkRequest::RedirectionTargetAttribute, QUrl("qrc:/test2.html")); - } else if (request.url() == QUrl("qrc:/fake-ssl-error.html")) + } +#ifndef QT_NO_OPENSSL + else if (request.url() == QUrl("qrc:/fake-ssl-error.html")) setError(QNetworkReply::SslHandshakeFailedError, tr("Fake error !")); // force a ssl error +#endif else if (request.url() == QUrl("http://abcdef.abcdef/")) setError(QNetworkReply::HostNotFoundError, tr("Invalid URL")); @@ -2206,8 +2218,10 @@ private slots: emit error(this->error()); else if (request().url() == QUrl("http://abcdef.abcdef/")) emit metaDataChanged(); +#ifndef QT_NO_OPENSSL else if (request().url() == QUrl("qrc:/fake-ssl-error.html")) return; +#endif emit readyRead(); emit finished(); @@ -2227,12 +2241,14 @@ protected: if (op == QNetworkAccessManager::GetOperation) if (url == "qrc:/test1.html" || url == "http://abcdef.abcdef/") return new FakeReply(request, this); +#ifndef QT_NO_OPENSSL else if (url == "qrc:/fake-ssl-error.html") { FakeReply* reply = new FakeReply(request, this); QList<QSslError> errors; emit sslErrors(reply, errors << QSslError(QSslError::UnspecifiedError)); return reply; } +#endif return QNetworkAccessManager::createRequest(op, request, outgoingData); } @@ -2266,6 +2282,7 @@ void tst_QWebFrame::requestedUrl() QCOMPARE(frame->requestedUrl(), QUrl("http://abcdef.abcdef/")); QCOMPARE(frame->url(), QUrl("http://abcdef.abcdef/")); +#ifndef QT_NO_OPENSSL qRegisterMetaType<QList<QSslError> >("QList<QSslError>"); qRegisterMetaType<QNetworkReply* >("QNetworkReply*"); @@ -2275,6 +2292,41 @@ void tst_QWebFrame::requestedUrl() QCOMPARE(spy2.count(), 1); QCOMPARE(frame->requestedUrl(), QUrl("qrc:/fake-ssl-error.html")); QCOMPARE(frame->url(), QUrl("qrc:/fake-ssl-error.html")); +#endif +} + +void tst_QWebFrame::javaScriptWindowObjectCleared_data() +{ + QTest::addColumn<QString>("html"); + QTest::addColumn<int>("signalCount"); + QTest::newRow("with <script>") << "<html><body><script></script><p>hello world</p></body></html>" << 1; + QTest::newRow("without <script>") << "<html><body><p>hello world</p></body></html>" << 0; +} + +void tst_QWebFrame::javaScriptWindowObjectCleared() +{ + QWebPage page; + QWebFrame* frame = page.mainFrame(); + QSignalSpy spy(frame, SIGNAL(javaScriptWindowObjectCleared())); + QFETCH(QString, html); + frame->setHtml(html); + + QFETCH(int, signalCount); + QCOMPARE(spy.count(), signalCount); +} + +void tst_QWebFrame::javaScriptWindowObjectClearedOnEvaluate() +{ + QWebPage page; + QWebFrame* frame = page.mainFrame(); + QSignalSpy spy(frame, SIGNAL(javaScriptWindowObjectCleared())); + frame->setHtml("<html></html>"); + QCOMPARE(spy.count(), 0); + frame->evaluateJavaScript("var a = 'a';"); + QCOMPARE(spy.count(), 1); + // no new clear for a new script: + frame->evaluateJavaScript("var a = 1;"); + QCOMPARE(spy.count(), 1); } void tst_QWebFrame::setHtml() @@ -2317,7 +2369,29 @@ void tst_QWebFrame::setHtmlWithResource() QCOMPARE(spy.size(), 2); QWebElement p = frame->documentElement().findAll("p").at(0); - QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("red")); + QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red")); +} + +void tst_QWebFrame::setHtmlWithBaseURL() +{ + QString html("<html><body><p>hello world</p><img src='resources/image2.png'/></body></html>"); + + QWebPage page; + QWebFrame* frame = page.mainFrame(); + + // in few seconds, the image should be completey loaded + QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); + + frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); + QTest::qWait(200); + QCOMPARE(spy.count(), 1); + + QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1); + QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 128); + QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 128); + + // no history item has to be added. + QCOMPARE(m_view->page()->history()->count(), 0); } class TestNetworkManager : public QNetworkAccessManager @@ -2408,23 +2482,17 @@ void tst_QWebFrame::popupFocus() view.resize(400, 100); view.show(); view.setFocus(); - QTest::qWait(200); - QVERIFY2(view.hasFocus(), - "The WebView should be created"); + QTRY_VERIFY(view.hasFocus()); // open the popup by clicking. check if focus is on the popup QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25)); QObject* webpopup = firstChildByClassName(&view, "WebCore::QWebPopup"); QComboBox* combo = qobject_cast<QComboBox*>(webpopup); - QTest::qWait(500); - QVERIFY2(!view.hasFocus() && combo->view()->hasFocus(), - "Focus sould be on the Popup"); + QTRY_VERIFY(!view.hasFocus() && combo->view()->hasFocus()); // Focus should be on the popup // hide the popup and check if focus is on the page combo->hidePopup(); - QTest::qWait(500); - QVERIFY2(view.hasFocus() && !combo->view()->hasFocus(), - "Focus sould be back on the WebView"); + QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView // triple the flashing time, should at least blink twice already int delay = qApp->cursorFlashTime() * 3; @@ -2592,16 +2660,16 @@ void tst_QWebFrame::hasSetFocus() QCOMPARE(loadSpy.size(), 2); m_page->mainFrame()->setFocus(); - QVERIFY(m_page->mainFrame()->hasFocus()); + QTRY_VERIFY(m_page->mainFrame()->hasFocus()); for (int i = 0; i < children.size(); ++i) { children.at(i)->setFocus(); - QVERIFY(children.at(i)->hasFocus()); + QTRY_VERIFY(children.at(i)->hasFocus()); QVERIFY(!m_page->mainFrame()->hasFocus()); } m_page->mainFrame()->setFocus(); - QVERIFY(m_page->mainFrame()->hasFocus()); + QTRY_VERIFY(m_page->mainFrame()->hasFocus()); } void tst_QWebFrame::render() @@ -2669,5 +2737,24 @@ void tst_QWebFrame::scrollPosition() QCOMPARE(y, 29); } +void tst_QWebFrame::evaluateWillCauseRepaint() +{ + QWebView view; + QString html("<html><body>top<div id=\"junk\" style=\"display: block;\">" + "junk</div>bottom</body></html>"); + view.setHtml(html); + view.show(); + + QTest::qWait(200); + + view.page()->mainFrame()->evaluateJavaScript( + "document.getElementById('junk').style.display = 'none';"); + + ::waitForSignal(view.page(), SIGNAL(repaintRequested( const QRect &))); + + QTest::qWait(2000); +} + + QTEST_MAIN(tst_QWebFrame) #include "tst_qwebframe.moc" diff --git a/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/WebKit/qt/tests/qwebhistory/qwebhistory.pro index fd1074c..8ee63cc 100644 --- a/WebKit/qt/tests/qwebhistory/qwebhistory.pro +++ b/WebKit/qt/tests/qwebhistory/qwebhistory.pro @@ -5,3 +5,5 @@ SOURCES += tst_qwebhistory.cpp RESOURCES += tst_qwebhistory.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E53B diff --git a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp index 5b55613..4f4d3c4 100644 --- a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp +++ b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp @@ -18,6 +18,7 @@ */ #include <QtTest/QtTest> +#include <QAction> #include "qwebpage.h" #include "qwebview.h" @@ -58,6 +59,11 @@ private slots: void saveAndRestore_1(); //simple checks saveState and restoreState void saveAndRestore_2(); //bad parameters saveState and restoreState void saveAndRestore_3(); //try use different version + void saveAndRestore_crash_1(); + void saveAndRestore_crash_2(); + void saveAndRestore_crash_3(); + void clear(); + private: QWebPage* page; @@ -119,6 +125,8 @@ void tst_QWebHistory::back() hist->back(); waitForLoadFinished.exec(); } + //try one more time (too many). crash test + hist->back(); } /** @@ -137,6 +145,8 @@ void tst_QWebHistory::forward() hist->forward(); waitForLoadFinished.exec(); } + //try one more time (too many). crash test + hist->forward(); } /** @@ -287,10 +297,13 @@ void tst_QWebHistory::serialize_3() /** Simple checks should be a bit redundant to streaming operators */ void tst_QWebHistory::saveAndRestore_1() { + QAction* actionBack = page->action(QWebPage::Back); hist->back(); waitForLoadFinished.exec(); + QVERIFY(actionBack->isEnabled()); QByteArray buffer(hist->saveState()); hist->clear(); + QVERIFY(!actionBack->isEnabled()); QVERIFY(hist->count() == 1); hist->restoreState(buffer); @@ -301,6 +314,7 @@ void tst_QWebHistory::saveAndRestore_1() QCOMPARE(hist->currentItemIndex(), histsize - 2); QCOMPARE(hist->itemAt(0).title(), QString("page1")); QCOMPARE(hist->itemAt(histsize - 1).title(), QString("page") + QString::number(histsize)); + QVERIFY(actionBack->isEnabled()); } /** Check returns value if there are bad parameters. Actually, result @@ -322,5 +336,67 @@ void tst_QWebHistory::saveAndRestore_3() QVERIFY(hist->itemAt(3).isValid()); } +/** The test shouldn't crash */ +void tst_QWebHistory::saveAndRestore_crash_1() +{ + QByteArray tmp = hist->saveState(); + for (unsigned i = 0; i < 5; i++){ + hist->restoreState(tmp); + hist->saveState(); + } +} + +/** The test shouldn't crash */ +void tst_QWebHistory::saveAndRestore_crash_2() +{ + QByteArray tmp = hist->saveState(); + QWebPage* page2 = new QWebPage(this); + QWebHistory* hist2 = page2->history(); + for (unsigned i = 0; i < 5; i++){ + hist2->restoreState(tmp); + hist2->saveState(); + } + delete page2; +} + +/** The test shouldn't crash */ +void tst_QWebHistory::saveAndRestore_crash_3() +{ + QByteArray tmp = hist->saveState(); + QWebPage* page2 = new QWebPage(this); + QWebHistory* hist1 = hist; + QWebHistory* hist2 = page2->history(); + for (unsigned i = 0; i < 5; i++){ + hist1->restoreState(tmp); + hist2->restoreState(tmp); + QVERIFY(hist1->count() == hist2->count()); + QVERIFY(hist1->count() == histsize); + hist2->back(); + tmp = hist2->saveState(); + hist2->clear(); + } + delete page2; +} + +/** ::clear */ +void tst_QWebHistory::clear() +{ + QAction* actionBack = page->action(QWebPage::Back); + QVERIFY(actionBack->isEnabled()); + hist->saveState(); + QVERIFY(hist->count() > 1); + hist->clear(); + QVERIFY(hist->count() == 1); // Leave current item. + QVERIFY(!actionBack->isEnabled()); + + + QWebPage* page2 = new QWebPage(this); + QWebHistory* hist2 = page2->history(); + QVERIFY(hist2->count() == 0); + hist2->clear(); + QVERIFY(hist2->count() == 0); // Do not change anything. + delete page2; +} + QTEST_MAIN(tst_QWebHistory) #include "tst_qwebhistory.moc" diff --git a/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro index af3b348..53e1afe 100644 --- a/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro +++ b/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro @@ -4,3 +4,5 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebhistoryinterface.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E53C diff --git a/WebKit/qt/tests/qwebpage/qwebpage.pro b/WebKit/qt/tests/qwebpage/qwebpage.pro index 2f3a108..82ffac6 100644 --- a/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -5,3 +5,5 @@ SOURCES += tst_qwebpage.cpp RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E53E diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 966f049..a9f9f16 100644 --- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -20,6 +20,7 @@ #include <QtTest/QtTest> +#include <qwebelement.h> #include <qwebpage.h> #include <qwidget.h> #include <qwebview.h> @@ -59,7 +60,7 @@ * \return \p true if the requested signal was received * \p false on timeout */ -static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0) +static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) { QEventLoop loop; QObject::connect(obj, signal, &loop, SLOT(quit())); @@ -110,9 +111,13 @@ private slots: void frameAt(); void requestCache(); void protectBindingsRuntimeObjectsFromCollector(); + void localURLSchemes(); + void testOptionalJSObjects(); + void testEnablePersistentStorage(); + void consoleOutput(); + void inputMethods(); -private: - + void crashTests_LazyInitializationOfMainFrame(); private: QWebView* m_view; @@ -217,6 +222,9 @@ void tst_QWebPage::infiniteLoopJS() void tst_QWebPage::loadFinished() { + qRegisterMetaType<QWebFrame*>("QWebFrame*"); + qRegisterMetaType<QNetworkRequest*>("QNetworkRequest*"); + QSignalSpy spyNetworkRequestStarted(m_page, SIGNAL(networkRequestStarted(QWebFrame*, QNetworkRequest*))); QSignalSpy spyLoadStarted(m_view, SIGNAL(loadStarted())); QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); @@ -227,6 +235,7 @@ void tst_QWebPage::loadFinished() QTest::qWait(3000); + QVERIFY(spyNetworkRequestStarted.count() > 1); QVERIFY(spyLoadStarted.count() > 1); QVERIFY(spyLoadFinished.count() > 1); @@ -238,6 +247,31 @@ void tst_QWebPage::loadFinished() QCOMPARE(spyLoadFinished.count(), 1); } +class ConsolePage : public QWebPage +{ +public: + ConsolePage(QObject* parent = 0) : QWebPage(parent) {} + + virtual void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) + { + messages.append(message); + lineNumbers.append(lineNumber); + sourceIDs.append(sourceID); + } + + QStringList messages; + QList<int> lineNumbers; + QStringList sourceIDs; +}; + +void tst_QWebPage::consoleOutput() +{ + ConsolePage page; + page.mainFrame()->evaluateJavaScript("this is not valid JavaScript"); + QCOMPARE(page.messages.count(), 1); + QCOMPARE(page.lineNumbers.at(0), 1); +} + class TestPage : public QWebPage { public: @@ -316,13 +350,13 @@ void tst_QWebPage::userStyleSheet() m_page->setNetworkAccessManager(networkManager); networkManager->requestedUrls.clear(); - m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}")); + m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css;charset=utf-8;base64," + + QByteArray("p { background-image: url('http://does.not/exist.png');}").toBase64())); m_view->setHtml("<p>hello world</p>"); QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)))); - QVERIFY(networkManager->requestedUrls.count() >= 2); - QCOMPARE(networkManager->requestedUrls.at(0), QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}")); - QCOMPARE(networkManager->requestedUrls.at(1), QUrl("http://does.not/exist.png")); + QVERIFY(networkManager->requestedUrls.count() >= 1); + QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png")); } void tst_QWebPage::modified() @@ -405,6 +439,10 @@ void tst_QWebPage::database() QWebSettings::setOfflineStorageDefaultQuota(1024 * 1024); QVERIFY(QWebSettings::offlineStorageDefaultQuota() == 1024 * 1024); + m_page->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); + m_page->settings()->setAttribute(QWebSettings::SessionStorageEnabled, true); + m_page->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); + QString dbFileName = path + "Databases.db"; if (QFile::exists(dbFileName)) @@ -432,14 +470,19 @@ void tst_QWebPage::database() m_page->mainFrame()->evaluateJavaScript("var db3; db3=openDatabase('testdb', '1.0', 'test database API', 50000);db3.transaction(function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS Test (text TEXT)', []); }, function(tx, result) { }, function(tx, error) { });"); QTest::qWait(200); + // Remove all databases. QWebSecurityOrigin origin = m_page->mainFrame()->securityOrigin(); QList<QWebDatabase> dbs = origin.databases(); - if (dbs.count() > 0) { - QString fileName = dbs[0].fileName(); + for (int i = 0; i < dbs.count(); i++) { + QString fileName = dbs[i].fileName(); QVERIFY(QFile::exists(fileName)); - QWebDatabase::removeDatabase(dbs[0]); + QWebDatabase::removeDatabase(dbs[i]); QVERIFY(!QFile::exists(fileName)); } + QVERIFY(!origin.databases().size()); + // Remove removed test :-) + QWebDatabase::removeAllDatabases(); + QVERIFY(!origin.databases().size()); QTest::qWait(1000); } @@ -627,7 +670,6 @@ void tst_QWebPage::createViewlessPlugin() // import private API void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName); QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page); -void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path); void tst_QWebPage::multiplePageGroupsAndLocalStorage() { @@ -638,9 +680,11 @@ void tst_QWebPage::multiplePageGroupsAndLocalStorage() QWebView view1; QWebView view2; - qt_websettings_setLocalStorageDatabasePath(view1.page()->settings(), QDir::toNativeSeparators(QDir::currentPath() + "/path1")); + view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); + view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path1")); qt_webpage_setGroupName(view1.page(), "group1"); - qt_websettings_setLocalStorageDatabasePath(view2.page()->settings(), QDir::toNativeSeparators(QDir::currentPath() + "/path2")); + view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); + view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path2")); qt_webpage_setGroupName(view2.page(), "group2"); QCOMPARE(qt_webpage_groupName(view1.page()), QString("group1")); QCOMPARE(qt_webpage_groupName(view2.page()), QString("group2")); @@ -1165,6 +1209,94 @@ void tst_QWebPage::frameAt() frameAtHelper(webPage, webPage->mainFrame(), webPage->mainFrame()->pos()); } +void tst_QWebPage::inputMethods() +{ + m_view->page()->mainFrame()->setHtml("<html><body>" \ + "<input type='text' id='input1' style='font-family: serif' value='' maxlength='20'/>" \ + "</body></html>"); + m_view->page()->mainFrame()->setFocus(); + + QList<QWebElement> inputs = m_view->page()->mainFrame()->documentElement().findAll("input"); + + QMouseEvent evpres(QEvent::MouseButtonPress, inputs.at(0).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + m_view->page()->event(&evpres); + QMouseEvent evrel(QEvent::MouseButtonRelease, inputs.at(0).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + m_view->page()->event(&evrel); + + //ImMicroFocus + QVariant variant = m_view->page()->inputMethodQuery(Qt::ImMicroFocus); + QRect focusRect = variant.toRect(); + QVERIFY(inputs.at(0).geometry().contains(variant.toRect().topLeft())); + + //ImFont + variant = m_view->page()->inputMethodQuery(Qt::ImFont); + QFont font = variant.value<QFont>(); + QCOMPARE(QString("-webkit-serif"), font.family()); + + QList<QInputMethodEvent::Attribute> inputAttributes; + + //Insert text. + { + QInputMethodEvent eventText("QtWebKit", inputAttributes); + QSignalSpy signalSpy(m_view->page(), SIGNAL(microFocusChanged())); + m_view->page()->event(&eventText); + QCOMPARE(signalSpy.count(), 0); + } + + { + QInputMethodEvent eventText("", inputAttributes); + eventText.setCommitString(QString("QtWebKit"), 0, 0); + m_view->page()->event(&eventText); + } + +#if QT_VERSION >= 0x040600 + //ImMaximumTextLength + variant = m_view->page()->inputMethodQuery(Qt::ImMaximumTextLength); + QCOMPARE(20, variant.toInt()); + + //Set selection + inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 3, 2, QVariant()); + QInputMethodEvent eventSelection("",inputAttributes); + m_view->page()->event(&eventSelection); + + //ImAnchorPosition + variant = m_view->page()->inputMethodQuery(Qt::ImAnchorPosition); + int anchorPosition = variant.toInt(); + QCOMPARE(anchorPosition, 3); + + //ImCursorPosition + variant = m_view->page()->inputMethodQuery(Qt::ImCursorPosition); + int cursorPosition = variant.toInt(); + QCOMPARE(cursorPosition, 5); + + //ImCurrentSelection + variant = m_view->page()->inputMethodQuery(Qt::ImCurrentSelection); + QString selectionValue = variant.value<QString>(); + QCOMPARE(selectionValue, QString("eb")); +#endif + + //ImSurroundingText + variant = m_view->page()->inputMethodQuery(Qt::ImSurroundingText); + QString value = variant.value<QString>(); + QCOMPARE(value, QString("QtWebKit")); + +#if QT_VERSION >= 0x040600 + { + QList<QInputMethodEvent::Attribute> attributes; + // Clear the selection, so the next test does not clear any contents. + QInputMethodEvent::Attribute newSelection(QInputMethodEvent::Selection, 0, 0, QVariant()); + attributes.append(newSelection); + QInputMethodEvent event("composition", attributes); + m_view->page()->event(&event); + } + + // A ongoing composition should not change the surrounding text before it is committed. + variant = m_view->page()->inputMethodQuery(Qt::ImSurroundingText); + value = variant.value<QString>(); + QCOMPARE(value, QString("QtWebKit")); +#endif +} + // import a little DRT helper function to trigger the garbage collector void QWEBKIT_EXPORT qt_drt_garbageCollector_collect(); @@ -1190,5 +1322,104 @@ void tst_QWebPage::protectBindingsRuntimeObjectsFromCollector() newPage->mainFrame()->evaluateJavaScript("testme('bar')"); } +void tst_QWebPage::localURLSchemes() +{ + int i = QWebSecurityOrigin::localSchemes().size(); + QWebSecurityOrigin::removeLocalScheme("file"); + QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i); + QWebSecurityOrigin::addLocalScheme("file"); + QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i); + QString myscheme = "myscheme"; + QWebSecurityOrigin::addLocalScheme(myscheme); + QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i + 1); + QVERIFY(QWebSecurityOrigin::localSchemes().contains(myscheme)); + QWebSecurityOrigin::removeLocalScheme(myscheme); + QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i); + QWebSecurityOrigin::removeLocalScheme(myscheme); + QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i); +} + +static inline bool testFlag(QWebPage& webPage, QWebSettings::WebAttribute settingAttribute, const QString& jsObjectName, bool settingValue) +{ + webPage.settings()->setAttribute(settingAttribute, settingValue); + return webPage.mainFrame()->evaluateJavaScript(QString("(window.%1 != undefined)").arg(jsObjectName)).toBool(); +} + +void tst_QWebPage::testOptionalJSObjects() +{ + // Once a feature is enabled and the JS object is accessed turning off the setting will not turn off + // the visibility of the JS object any more. For this reason this test uses two QWebPage instances. + // Part of the test is to make sure that the QWebPage instances do not interfere with each other so turning on + // a feature for one instance will not turn it on for another. + + QWebPage webPage1; + QWebPage webPage2; + + webPage1.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl()); + webPage2.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl()); + + QEXPECT_FAIL("","Feature enabled/disabled checking problem. Look at bugs.webkit.org/show_bug.cgi?id=29867", Continue); + QCOMPARE(testFlag(webPage1, QWebSettings::OfflineWebApplicationCacheEnabled, "applicationCache", false), false); + QCOMPARE(testFlag(webPage2, QWebSettings::OfflineWebApplicationCacheEnabled, "applicationCache", true), true); + QEXPECT_FAIL("","Feature enabled/disabled checking problem. Look at bugs.webkit.org/show_bug.cgi?id=29867", Continue); + QCOMPARE(testFlag(webPage1, QWebSettings::OfflineWebApplicationCacheEnabled, "applicationCache", false), false); + QCOMPARE(testFlag(webPage2, QWebSettings::OfflineWebApplicationCacheEnabled, "applicationCache", false), true); + + QCOMPARE(testFlag(webPage1, QWebSettings::LocalStorageEnabled, "localStorage", false), false); + QCOMPARE(testFlag(webPage2, QWebSettings::LocalStorageEnabled, "localStorage", true), true); + QCOMPARE(testFlag(webPage1, QWebSettings::LocalStorageEnabled, "localStorage", false), false); + QCOMPARE(testFlag(webPage2, QWebSettings::LocalStorageEnabled, "localStorage", false), true); + + QCOMPARE(testFlag(webPage1, QWebSettings::SessionStorageEnabled, "sessionStorage", false), false); + QCOMPARE(testFlag(webPage2, QWebSettings::SessionStorageEnabled, "sessionStorage", true), true); + QCOMPARE(testFlag(webPage1, QWebSettings::SessionStorageEnabled, "sessionStorage", false), false); + QCOMPARE(testFlag(webPage2, QWebSettings::SessionStorageEnabled, "sessionStorage", false), true); +} + +void tst_QWebPage::testEnablePersistentStorage() +{ + QWebPage webPage; + + // By default all persistent options should be disabled + QCOMPARE(webPage.settings()->testAttribute(QWebSettings::LocalStorageEnabled), false); + QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled), false); + QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled), false); + QVERIFY(webPage.settings()->iconDatabasePath().isEmpty()); + + QWebSettings::enablePersistentStorage(); + + // Give it some time to initialize - icon database needs it + QTest::qWait(1000); + + QCOMPARE(webPage.settings()->testAttribute(QWebSettings::LocalStorageEnabled), true); + QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled), true); + QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled), true); + + QVERIFY(!webPage.settings()->offlineStoragePath().isEmpty()); + QVERIFY(!webPage.settings()->offlineWebApplicationCachePath().isEmpty()); + QVERIFY(!webPage.settings()->iconDatabasePath().isEmpty()); +} + +void tst_QWebPage::crashTests_LazyInitializationOfMainFrame() +{ + { + QWebPage webPage; + } + { + QWebPage webPage; + webPage.selectedText(); + } + { + QWebPage webPage; + webPage.triggerAction(QWebPage::Back, true); + } + { + QWebPage webPage; + QPoint pos(10,10); + webPage.updatePositionDependentActions(pos); + } +} + + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro index 5d10993..1376ca5 100644 --- a/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro +++ b/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro @@ -4,3 +4,5 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebplugindatabase.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E540 diff --git a/WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp b/WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp index c0533ad..1ee6206 100644 --- a/WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp +++ b/WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp @@ -40,6 +40,8 @@ private slots: void operatorequal_data(); void operatorequal(); void preferredPlugin(); + void operatorassign_data(); + void operatorassign(); }; typedef QWebPluginInfo::MimeType MimeType; @@ -396,6 +398,40 @@ void tst_QWebPluginDatabase::preferredPlugin() } } +void tst_QWebPluginDatabase::operatorassign_data() +{ + QTest::addColumn<QWebPluginInfo>("first"); + QTest::addColumn<QWebPluginInfo>("second"); + + QWebPluginDatabase* database = QWebSettings::pluginDatabase(); + QTest::newRow("null") << QWebPluginInfo() << QWebPluginInfo(); + + QList<QWebPluginInfo> plugins = database->plugins(); + for (int i = 0; i < (plugins.count() - 1); ++i) { + QWebPluginInfo first = plugins.at(i); + QWebPluginInfo second = plugins.at(i + 1); + + QTest::newRow(QString("%1=%2").arg(first.name(), second.name()).toUtf8().constData()) << first << second; + } +} + +void tst_QWebPluginDatabase::operatorassign() +{ + QFETCH(QWebPluginInfo, first); + QFETCH(QWebPluginInfo, second); + + QWebPluginInfo info; + QCOMPARE(info.mimeTypes(), QList<MimeType>()); + QCOMPARE(info = first, first); + QCOMPARE(info, first); + QCOMPARE(info.mimeTypes(), first.mimeTypes()); + QCOMPARE(info = second, second); + QCOMPARE(info, second); + QCOMPARE(info.mimeTypes(), second.mimeTypes()); + QCOMPARE(info = QWebPluginInfo(), QWebPluginInfo()); + QCOMPARE(info.mimeTypes(), QList<MimeType>()); +} + QTEST_MAIN(tst_QWebPluginDatabase) #include "tst_qwebplugindatabase.moc" diff --git a/WebKit/qt/tests/qwebview/qwebview.pro b/WebKit/qt/tests/qwebview/qwebview.pro index 799ccfb..d9d122c 100644 --- a/WebKit/qt/tests/qwebview/qwebview.pro +++ b/WebKit/qt/tests/qwebview/qwebview.pro @@ -4,3 +4,5 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E53F diff --git a/WebKit/qt/tests/tests.pro b/WebKit/qt/tests/tests.pro index b5f66ee..81cc8f3 100644 --- a/WebKit/qt/tests/tests.pro +++ b/WebKit/qt/tests/tests.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qwebframe qwebpage qwebelement qwebhistoryinterface qwebplugindatabase qwebview qwebhistory +SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebplugindatabase qwebview qwebhistory greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro diff --git a/WebKit/qt/tests/util.h b/WebKit/qt/tests/util.h new file mode 100644 index 0000000..7f7e613 --- /dev/null +++ b/WebKit/qt/tests/util.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +// Functions and macros that really need to be in QTestLib + +// Will try to wait for the condition while allowing event processing +#define QTRY_VERIFY(__expr) \ + do { \ + const int __step = 50; \ + const int __timeout = 5000; \ + if (!(__expr)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QVERIFY(__expr); \ + } while(0) + +// Will try to wait for the condition while allowing event processing +#define QTRY_COMPARE(__expr, __expected) \ + do { \ + const int __step = 50; \ + const int __timeout = 5000; \ + if ((__expr) != (__expected)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QCOMPARE(__expr, __expected); \ + } while(0) + diff --git a/WebKit/win/AccessibleBase.cpp b/WebKit/win/AccessibleBase.cpp index df91151..d02ec7e 100644 --- a/WebKit/win/AccessibleBase.cpp +++ b/WebKit/win/AccessibleBase.cpp @@ -105,7 +105,7 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::get_accParent(IDispatch** parent) if (!m_object || !m_object->topDocumentFrameView()) return E_FAIL; - return WebView::AccessibleObjectFromWindow(m_object->topDocumentFrameView()->hostWindow()->platformWindow(), + return WebView::AccessibleObjectFromWindow(m_object->topDocumentFrameView()->hostWindow()->platformPageClient(), OBJID_WINDOW, __uuidof(IAccessible), reinterpret_cast<void**>(parent)); } @@ -592,7 +592,15 @@ HRESULT AccessibleBase::getAccessibilityObjectForChild(VARIANT vChild, Accessibi if (vChild.lVal == CHILDID_SELF) childObj = m_object; - else { + else if (vChild.lVal < 0) { + // When broadcasting MSAA events, we negate the AXID and pass it as the + // child ID. + Document* document = m_object->document(); + if (!document) + return E_FAIL; + + childObj = document->axObjectCache()->objectFromAXID(-vChild.lVal); + } else { size_t childIndex = static_cast<size_t>(vChild.lVal - 1); if (childIndex >= m_object->children().size()) diff --git a/WebKit/win/COMVariantSetter.h b/WebKit/win/COMVariantSetter.h index 76ca927..22c20e4 100644 --- a/WebKit/win/COMVariantSetter.h +++ b/WebKit/win/COMVariantSetter.h @@ -57,6 +57,19 @@ template<> struct COMVariantSetter<WebCore::String> : COMVariantSetterBase<WebCo }
};
+template<> struct COMVariantSetter<bool> : COMVariantSetterBase<bool>
+{
+ static const VARENUM VariantType = VT_BOOL;
+
+ static void setVariant(VARIANT* variant, bool value)
+ {
+ ASSERT(V_VT(variant) == VT_EMPTY);
+
+ V_VT(variant) = VariantType;
+ V_BOOL(variant) = value;
+ }
+};
+
template<> struct COMVariantSetter<unsigned long long> : COMVariantSetterBase<unsigned long long>
{
static const VARENUM VariantType = VT_UI8;
@@ -83,6 +96,19 @@ template<> struct COMVariantSetter<int> : COMVariantSetterBase<int> }
};
+template<> struct COMVariantSetter<float> : COMVariantSetterBase<float>
+{
+ static const VARENUM VariantType = VT_R4;
+
+ static void setVariant(VARIANT* variant, float value)
+ {
+ ASSERT(V_VT(variant) == VT_EMPTY);
+
+ V_VT(variant) = VariantType;
+ V_R4(variant) = value;
+ }
+};
+
template<typename T> struct COMVariantSetter<COMPtr<T> > : COMVariantSetterBase<COMPtr<T> >
{
static const VARENUM VariantType = VT_UNKNOWN;
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index 479d81b..354f82f 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,1160 @@ +2009-10-08 Adam Roben <aroben@apple.com> + + Make IWebInspectorPrivate be accessed in a more standard way + + IWebViewPrivate::inspectorPrivate has been removed. Callers should + instead use IWebViewPrivate::inspector and then use QueryInterface to + get the IWebInspectorPrivate interface. This matches how our other COM + classes work. + + Fixes <http://webkit.org/b/30215> Make IWebInspectorPrivate be + accessed in a more standard way + + Reviewed by John Sullivan and Tim Hatcher. + + * Interfaces/IWebViewPrivate.idl: Removed inspectorPrivate. + + * WebInspector.cpp: + (WebInspector::QueryInterface): Support querying to + IWebInspectorPrivate. + + * WebView.cpp: + * WebView.h: + Removed inspectorPrivate. + +2009-10-08 Adam Roben <aroben@apple.com> + + Move the new IWebViewPrivate::inspectorPrivate function after all + functions that existed when Safari 4.0.3 was released + + Fixes <http://webkit.org/b/30085> REGRESSION (r49091): run-safari + crashes in Safari.dll + + Reviewed by John Sullivan. + + * Interfaces/IWebViewPrivate.idl: Moved inspectorPrivate to the end of + the interface, so it won't modify the vtable that Safari 4.0.3 sees. + +2009-10-07 Adam Roben <aroben@apple.com> + + Expose origin whitelisting in the WebKit API on Windows + + Fixes <http://webkit.org/b/30185>. + + Reviewed by Eric Seidel. + + * Interfaces/IWebViewPrivate.idl: Added whiteListAccessFromOrigin and + resetOriginAccessWhiteLists, to match the Mac SPI. + + * WebView.cpp: + (WebView::whiteListAccessFromOrigin): + (WebView::resetOriginAccessWhiteLists): + * WebView.h: + Added. These just call through to SecurityOrigin. + +2009-10-07 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Factor PolicyChecker out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=30155 + + Move the policy callback to the policy object. + + * WebFrame.cpp: + (WebFrame::dispatchWillSubmitForm): + (WebFrame::receivedPolicyDecision): + (WebFrame::dispatchDecidePolicyForMIMEType): + (WebFrame::dispatchDecidePolicyForNewWindowAction): + (WebFrame::dispatchDecidePolicyForNavigationAction): + +2009-10-07 Daniel Bates <dbates@webkit.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=30102 + And + <rdar://problem/5015957> + + Fixes an issue (in the Windows build) where the cursor does not change to the + not-allowed cursor when the drag-and-drop operation is not allowed. + + The allowed effects in WebDragClient::startDrag are hard-coded to be + DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE. Instead, the list of + allowed drop effects should be determined by the allowed operations of the + drag source. + + We cannot test this using DRT because DRT looks at the programmatic drop + cursor and until bug #24731 is fixed this value is hard-coded to DragOperationCopy. + That is, there is a discrepancy in the Windows build between the Windows API-based + drop effect and the WebKit drop effect. Because DRT cannot read the screen buffer + to determine the cursor, a manual test is needed. + + * WebCoreSupport/WebDragClient.cpp: + (draggingSourceOperationMaskToDragCursors): Added method. + (WebDragClient::startDrag): + +2009-10-07 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=30176 + <rdar://problem/7281553> Extra information in UA causes problems with gmail + + * WebKit.vcproj/WebKit.rc: Restore PRODUCTVERSION to build number only. Remove extra space. + +2009-10-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: default to an attached inspector window on Windows (as on Mac). + + https://bugs.webkit.org/show_bug.cgi?id=30134 + + * WebCoreSupport/WebInspectorClient.cpp: + (WebInspectorClient::showWindowWithoutNotifications): + +2009-10-06 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move FrameLoader::canLoad to SecurityOrigin + https://bugs.webkit.org/show_bug.cgi?id=30111 + + * WebFrame.cpp: + (WebFrame::allowsFollowingLink): + +2009-10-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: close inspector client view on + InspectorController::close API call. + + In order to run batch web inspector layout tests (and not affect + subsequent tests) we should close inspector client's view upon + InspectorController::close API call. + + https://bugs.webkit.org/show_bug.cgi?id=30009 + + * WebCoreSupport/WebInspectorClient.cpp: + (WebInspectorClient::createPage): + +2009-10-06 David Levin <levin@chromium.org> + + Reviewed by NOBODY (windows build fix). + + Speculative build fix for windows (due to r49160). + + * WebDownloadCFNet.cpp: + (WebDownload::initToResumeWithBundle): + * WebIconDatabase.cpp: + (WebIconDatabase::dispatchDidAddIconForPageURL): + +2009-10-05 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: add testing harness for Web Inspector. + + https://bugs.webkit.org/show_bug.cgi?id=30010 + + * Interfaces/IWebInspectorPrivate.idl: Added. + * Interfaces/IWebViewPrivate.idl: + * Interfaces/WebKit.idl: + * WebInspector.cpp: + (WebInspector::evaluateInFrontend): + * WebInspector.h: + * WebView.cpp: + (WebView::inspectorPrivate): + * WebView.h: + +2009-10-02 Dave Hyatt <hyatt@apple.com> + + Reviewed by Adam Roben. + + Add support for blacklist patterns to user stylesheets and scripts in addition to whitelist patterns. + + * Interfaces/IWebViewPrivate.idl: + * WebView.cpp: + (toStringVector): + (WebView::addUserScriptToGroup): + (WebView::addUserStyleSheetToGroup): + * WebView.h: + +2009-10-02 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Mark Rowe. + + <https://bugs.webkit.org/show_bug.cgi?id=29989> + Safari version number shouldn't be exposed in WebKit code + + For a WebKit version of 532.3.4: + Product version is: 5.32.3.4 (was 4.0.3.0) + File version is: 5.32.3.4 (was 4.532.3.4) + + * WebKit.vcproj/WebKit.rc: + +2009-09-30 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Fix for <rdar://problem/7259706> + Need WebKit API or SPI on Mac and Windows to test whether it's safe to load a page in a new tab/window + + * Interfaces/IWebFramePrivate.idl: + * WebFrame.cpp: + (WebFrame::allowsFollowingLink): + * WebFrame.h: + +2009-09-30 Dave Hyatt <hyatt@apple.com> + + Reviewed by Adam Roben. + + Add the ability to remove user stylesheets and scripts by URL. + + * Interfaces/IWebViewPrivate.idl: + * WebView.cpp: + (WebView::removeUserContentWithURLFromGroup): + * WebView.h: + +2009-09-29 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Add support for run-time flag for 3D canvas + https://bugs.webkit.org/show_bug.cgi?id=29826 + + * WebView.cpp: + (WebView::notifyPreferencesChanged): Enable experimental WebGL + flag when 3D_CANVAS is enabled in the build. + +2009-09-28 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler and Sam Weinig. + + Onclick not fired for an element copied with cloneContents() or cloneNode() + https://bugs.webkit.org/show_bug.cgi?id=25130 + + * DOMCreateInstance.cpp: GEN_DOMEventListener is a pure interface now. + + * WebKit.vcproj/WebKit.vcproj: Removed GEN_DOMEventListener.cpp. + +2009-09-28 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Eric Seidel. + + Add experimentalWebSocketsEnabled in WebPreferences. + https://bugs.webkit.org/show_bug.cgi?id=28941 + + * Interfaces/IWebPreferencesPrivate.idl: + * WebPreferenceKeysPrivate.h: + * WebPreferences.cpp: + (WebPreferences::initializeDefaultSettings): + (WebPreferences::setExperimentalWebSocketsEnabled): + (WebPreferences::experimentalWebSocketsEnabled): + * WebPreferences.h: + * WebView.cpp: + (WebView::notifyPreferencesChanged): + (core): + +2009-09-25 Darin Adler <darin@apple.com> + + Reviewed by Steve Falkenburg. + + Speed up access to history items by caching date computation. + + * History/WebHistory.mm: + (getDayBoundaries): Refactored from timeIntervalForBeginningOfDay. + Returns the beginning of the day that the passed time is within and + the beginning of the next day. + (beginningOfDay): Added. Uses getDayBoundaries so it can be fast for + multiple dates within the same day, which is the common case. + (dateKey): Added. Calls beginningOfDay and converts to an integer. + (WebHistory::findKey): Changed to call dateKey instead of + timeIntervalForBeginningOfDay. + +2009-09-25 Adam Roben <aroben@apple.com> + + Add SPI to invalidate a WebView's backing store + + This is useful in conjunction with + IWebUIDelegatePrivate2::drawBackground. This provides a way for the UI + delegate to force WebView to get its background redrawn. + + Fixes <http://webkit.org/b/29737> Need SPI to invalidate a WebView's + backing store + + Reviewed by Anders Carlsson. + + * Interfaces/IWebViewPrivate.idl: Added invalidateBackingStore. + * WebView.cpp: + (WebView::invalidateBackingStore): If rect is 0, invalidate our whole + client rect. Otherwise invalidate the intersection of rect with our + client rect. + * WebView.h: + +2009-09-24 Jon Honeycutt <jhoneycutt@apple.com> + + Add a mechanism for automatically halting plug-ins. + + Reviewed by Oliver Hunt. + + * Interfaces/IWebPluginHalterDelegate.idl: Added. Defines an interface + for a delegate that determines whether plug-ins should be halted. + + * Interfaces/IWebPreferencesPrivate.idl: + Declare functions to get and set the enabled state of the plug-in + halter and the plug-in allowed run time. + + * Interfaces/IWebViewPrivate.idl: + Declare functions to get and set the IWebPluginHalterDelegate. + + * Interfaces/WebKit.idl: + + * WebCoreSupport/WebPluginHalterClient.cpp: Added. + (WebPluginHalterClient::WebPluginHalterClient): + (WebPluginHalterClient::shouldHaltPlugin): + Get the IWebPluginHalterDelegate for the WebView. Create a WebKit + DOMNode for the WebCore Node. Call the delegate's shouldHaltPlugin(). + If the call fails, return false. Otherwise, return the result of the + call. + + * WebCoreSupport/WebPluginHalterClient.h: Added. + + * WebKit.vcproj/Interfaces.vcproj: + Add IWebPluginHalterDelegate.idl. + + * WebKit.vcproj/WebKit.vcproj: + Add WebPluginHalterClient.{h,cpp}. + + * WebPreferenceKeysPrivate.h: + Define WebKitPluginHalterEnabledPreferenceKey and + WebKitPluginAllowedRunTimePreferenceKey. + + * WebPreferences.cpp: + (WebPreferences::initializeDefaultSettings): + Leave plug-in halting disabled by default. Set the default value for + the plug-in allowed run time to the max value of an unsigned int. + (WebPreferences::setPluginHalterEnabled): + (WebPreferences::pluginHalterEnabled): + (WebPreferences::setPluginAllowedRunTime): + (WebPreferences::pluginAllowedRunTime): + + * WebPreferences.h: + + * WebView.cpp: + (WebView::close): + Clear the IWebPluginHalterDelegate. + (WebView::initWithFrame): + Pass a WebPluginHalterClient when creating the Page. + (WebView::notifyPreferencesChanged): + Set the new settings when the preferences changed notification is + received. + (WebView::setPluginHalterDelegate): + (WebView::pluginHalterDelegate): + + * WebView.h: + Declare overrides of setPluginHalterDelegate() and + pluginHalterDelegate(). Added a member to track the + IWebPluginHalterDelegate. + +2009-09-14 John Gregg <johnnyg@google.com> + + Reviewed by Eric Seidel. + + Enable switch for notifications (experimental) in Page Settings + https://bugs.webkit.org/show_bug.cgi?id=28930 + + Adds support for the experimentalNotificationsEnabled flag in Settings through + WebPreferencesPrivate interface. Also cleans up some issues accessing the + notification delegate through DumpRenderTree. + + * Interfaces/IWebPreferencesPrivate.idl: + * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: + (WebDesktopNotificationsDelegate::hasNotificationDelegate): + (WebDesktopNotificationsDelegate::notificationDelegate): + * WebPreferenceKeysPrivate.h: + * WebPreferences.cpp: + (WebPreferences::initializeDefaultSettings): + (WebPreferences::setExperimentalNotificationsEnabled): + (WebPreferences::experimentalNotificationsEnabled): + * WebPreferences.h: + * WebView.cpp: + (WebView::notifyPreferencesChanged): + +2009-09-23 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + <rdar://problem/7243354> + REGRESSION(48580-48636): Crash clicking embedded QT preview button on apple.com/trailers + + Check for a null IWebPolicyDelegatePrivate. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::shouldLoadMediaElementURL): + +2009-09-22 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Adam Roben. + + Remove accidentally left in declaration of reloadFromOrigin in IWebFramePrivate.idl + + * Interfaces/IWebFramePrivate.idl: + +2009-09-22 Sam Weinig <sam@webkit.org> + + Reviewed by Steve Falkenburg. + + Fix for <rdar://problem/6451745> + Windows WebKit needs to implement reloadFromOrigin() + + * Interfaces/IWebFrame.idl: + * Interfaces/IWebFramePrivate.idl: + * Interfaces/IWebView.idl: + * WebFrame.cpp: + (WebFrame::reloadFromOrigin): + * WebFrame.h: + * WebView.cpp: + (WebView::reloadFromOrigin): + * WebView.h: + +2009-09-22 Adam Roben <aroben@apple.com> + + Manage refcounts correctly in DefaultDownloadDelegate::willSendRequest + + Fixes <http://webkit.org/b/29650> Crash in + WebDownload::willSendRequest when using DefaultDownloadDelegate + + Reviewed by Brady Eidson. + + * DefaultDownloadDelegate.cpp: + (DefaultDownloadDelegate::willSendRequest): Call AddRef() on the + object we're returning via the finalRequest out-parameter. + +2009-09-21 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + <rdar://problem/7135588> HTMLMediaElement should ask WebPolicyLoadDelegate before loading resource + + Implement WebFrameLoaderClient::shouldLoadMediaElementURL and have it call the new private policy + delegate method. + + * Interfaces/IWebPolicyDelegatePrivate.idl: Added. + * Interfaces/WebKit.idl: + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::shouldLoadMediaElementURL): + * WebCoreSupport/WebFrameLoaderClient.h: + * WebKit.vcproj/Interfaces.vcproj: + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Reflect the rename of platformWindow and it's return type. + + * AccessibleBase.cpp: + (AccessibleBase::get_accParent): + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::platformPageClient): + * WebCoreSupport/WebChromeClient.h: + +2009-09-17 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + Remove assertions that were being hit by calls to + m_verticalScrollbar->invalidate(). These assertions were valid, + but they were causing tests to fail, so replacing with a FIXME + until we can find out the real cause/solution that is being tracked + by http://webkit.org/b/29350. + + * WebView.cpp: + (WebView::addToDirtyRegion): + (WebView::paintIntoBackingStore): + +2009-09-17 Ada Chan <adachan@apple.com> + + Post WebViewDidChangeSelectionNotification when the text selection changes. + + Fixes <http://webkit.org/b/29321> + + Reviewed by Adam Roben. + + * Interfaces/IWebView.idl: + * WebCoreSupport/WebEditorClient.cpp: + (WebEditorClient::respondToChangedSelection): + +2009-09-17 Adam Roben <aroben@apple.com> + + Fix a crash when a WebView's HWND is destroyed before IWebView::close + is called + + WebView's HWND was being sent a WM_TIMER message after the WebView was + destroyed. This normally isn't possible (we call DestroyWindow inside + WebView's destructor to ensure the HWND doesn't outlive the WebView), + but r48060 changed WebView to call SetParent(m_viewWindow, + HWND_MESSAGE) while handling WM_DESTROY, and apparently this puts the + HWND into some weird half-destroyed state where it can still receive + WM_TIMER messages. + + Fixes <http://webkit.org/b/29337> <rdar://problem/7209897> REGRESSION + (r48060): unrepro but frequent crash in WebViewWndProc + + Reviewed by Steve Falkenburg. + + * WebView.cpp: + (WebViewWndProc): When handling WM_DESTROY, call setIsBeingDestroyed() + before calling close(). This allows setHostWindow to detect that we're + handling WM_DESTROY. No other code in close() cared whether + isBeingDestroyed() was true or not. + (WebView::setHostWindow): If our host window is being set to 0 and + we're being destroyed, don't become a message-only window. Doing this + while handling WM_DESTROY seems to lead to crashes. + +2009-09-16 Adam Roben <aroben@apple.com> + + Add a UI delegate callback to let the delegate draw a WebView's + background + + Fixes <http://webkit.org/b/29315>. + + Reviewed by Dave Hyatt. + + * Interfaces/IWebUIDelegatePrivate.idl: Added + IWebUIDelegatePrivate2::drawBackground. + + * WebView.cpp: + (WebView::paintIntoBackingStore): After clearing or filling with + white, let the delegate draw whatever background it wants. Also added + an assertion that the dirty rect is within our bounds. + +2009-09-16 Adam Roben <aroben@apple.com> + + Prevent WebView from painting over sibling windows + + Fixes <http://webkit.org/b/29300> <rdar://problem/7227960> WebView can + paint over sibling windows + + Reviewed by Darin Adler. + + * WebView.cpp: + (WebView::initWithFrame): Create the WebView's HWND with the + WS_CLIPSIBLINGS style. + +2009-09-14 Brady Eidson <beidson@apple.com> + + Reviewed by Alexey Proskuryakov. + + Safari 4 cannot be used to update firmware on Linksys routers. + <rdar://problem/7174050> and https://bugs.webkit.org/show_bug.cgi?id=29160 + + Adopt the new WebCore::CredentialStorage in WebKit/Win. + + * WebDownloadCFNet.cpp: + (WebDownload::didReceiveAuthenticationChallenge): + +2009-09-11 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Dan Bernstein. + + Properly propagate preference from WebPreferences to WebCore::Settings. + https://bugs.webkit.org/show_bug.cgi?id=29192 + + * WebView.cpp: + (WebView::initWithFrame): Apply setting when creating a new WebView. + (WebView::notifyPreferencesChanged): Apply setting when preferences change. + +2009-09-11 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Darin Adler. + + Allow WebKit clients to opt out of high resolution timers on Windows. + https://bugs.webkit.org/show_bug.cgi?id=29192 + + * Interfaces/IWebPreferencesPrivate.idl: Added getter/setter. + Put this just after last 4.0.3 method for future merging. + * Interfaces/WebKit.idl: Touched to force a rebuild. + * WebPreferenceKeysPrivate.h: Added prefs key for high res timers. + * WebPreferences.cpp: + (WebPreferences::initializeDefaultSettings): Initialize high res timers to enabled. + (WebPreferences::setShouldUseHighResolutionTimers): Added. + (WebPreferences::shouldUseHighResolutionTimers): Added. + * WebPreferences.h: Added getter/setter. + +2009-09-11 Adam Roben <aroben@apple.com> + + Get user script/stylesheet tests running on Windows + + Fixes <http://webkit.org/b/29181> User script/stylesheet tests are + skipped on Windows + + Reviewed by John Sullivan. + + * Interfaces/IWebViewPrivate.idl: Added addUserScriptToGroup, + addUserStyleSheetToGroup, removeUserContentFromGroup, + removeAllUserContentFromGropu to match the Mac SPI. + + * WebView.cpp: + (WebView::addUserScriptToGroup): + (WebView::addUserStyleSheetToGroup): + (WebView::removeUserContentFromGroup): + (WebView::removeAllUserContentFromGroup): + * WebView.h: + Added. Implementation was based on similar methods in WebView.mm. + +2009-09-11 Jon Honeycutt <jhoneycutt@apple.com> + + Fix crash on launch on Windows. + + Rubber-stamped by Mark Rowe. + + * WebKit.vcproj/WebKit.vcproj: + Define ENABLE_WEB_SOCKETS for all configurations. + +2009-09-07 Drew Wilson <atwilson@google.com> + + Reviewed by David Levin. + + Enable SHARED_WORKERS by default. + https://bugs.webkit.org/show_bug.cgi?id=28959 + + * WebKit.vcproj/WebKit.vcproj: + +2009-09-04 Adam Roben <aroben@apple.com> + + Make WebView function without a parent window + + When WebView has no parent window, it becomes a message-only window, + which hides it from the screen and prevents it from appearing on the + taskbar. + + Fixes <http://webkit.org/b/28971> <rdar://problem/4976998> + WebView::initWithFrame fails if there's no host window + + Reviewed by Dave Hyatt. + + * WebView.cpp: + (WebView::initWithFrame): m_hostWindow is null, use HWND_MESSAGE as + our parent window, which will make us a message-only window. + (WebView::setHostWindow): If he new host window is null, use + HWND_MESSAGE as our parent window, which will make us a message-only + window. + +2009-09-04 Adam Barth <abarth@webkit.org> + + Unreviewed attempt at a build fix. + + Added missing include. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + +2009-09-04 Adam Barth <abarth@webkit.org> + + Unreviewed attempt at a build fix. + + Fix typo of IWebFrameLoadDelegatePrivate2 and make + IWebFrameLoadDelegatePrivate inherit from IWebFrameLoadDelegatePrivate + as requestd by Adam Roben. + + * Interfaces/IWebFrameLoadDelegatePrivate2.idl: + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::didDisplayInsecureContent): + (WebFrameLoaderClient::didRunInsecureContent): + +2009-09-04 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=24696 + + Plumb mixed content notifications to IWebFrameLoadDelegatePrivate. + + * Interfaces/IWebFrameLoadDelegatePrivate2.idl: Added. + * Interfaces/WebKit.idl: + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::didDisplayInsecureContent): + (WebFrameLoaderClient::didRunInsecureContent): + * WebKit.vcproj/Interfaces.vcproj: + +2009-09-03 Adam Barth <abarth@webkit.org> + + Reviewed by eric@webkit.org. + + https://bugs.webkit.org/show_bug.cgi?id=24696 + + Stub implementations of mixed content methods of FrameLoaderClient. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::didDisplayInsecureContent): + (WebFrameLoaderClient::didRunInsecureContent): + * WebCoreSupport/WebFrameLoaderClient.h: + +2009-09-01 Adam Roben <aroben@apple.com> + + Post a notification when a WebView is closing + + This is useful for situations where some code wants to react to the + WebView closing but isn't in charge of the WebView and can't otherwise + be notified. This notification could replace + IWebUIDelegatePrivate::webViewClosing if we decide that the + notification system isn't too burdensome. + + <http://webkit.org/b/28875> + + Reviewed by John Sullivan. + + * Interfaces/IWebViewPrivate.idl: Added the + WebViewWillCloseNotification string constant. + * WebKit.vcproj/WebKit.vcproj: Link against comsuppw.lib in all + configurations so that we can use _bstr_t. + * WebView.cpp: + (WebView::close): Post the WebViewWillCloseNotification. + +2009-08-31 Alexey Proskuryakov <ap@webkit.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=28852 + Rename KURL single argument constructor to avoid confusion + + * WebURLResponse.cpp: (WebURLResponse::createInstance): Adapt to the change. + +2009-08-20 Adam Roben <aroben@apple.com> + + Give WebKit clients access to the window features specified in + window.open + + Reviewed by Steve Falkenburg. + + * COMVariantSetter.h: Added COMVariantSetters for bool and float. + + * Interfaces/IWebUIDelegatePrivate.idl: Added IWebUIDelegatePrivate2, + which contains a new version of createWebViewWithRequest that also + passes the window features as an IPropertyBag. This is analagous to + the -createWebViewWithRequest:windowFeatures: method added to + WebUIDelegate on Mac in r27452. Also added key strings for use with + the window features property bag. + + * WebCoreSupport/WebChromeClient.cpp: + (createWindowFeaturesPropertyBag): Added this helper function to turn + a WebCore::WindowFeatures into an IPropertyBag for passing to WebKit + clients. + (WebChromeClient::createWindow): If the UI delegate implements + IWebUIDelegatePrivate2, call the new createWebViewWithRequest function + that takes a window features property bag. If the delegate doesn't + implement the new function, fall back to the old functions. + +2009-08-20 Adam Roben <aroben@apple.com> + + A little clean-up in WebChromeClient::createWindow + + Reviewed by Steve Falkenburg. + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::createWindow): Refactored to share more code between + the dialog and non-dialog cases. + +2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Holger Freyther. + + https://bugs.webkit.org/show_bug.cgi?id=25889 + [GTK] scrollbar policy for main frame is not implementable + + Add empty implementation for new ChromeClient method. + + * WebCoreSupport/WebChromeClient.h: + (WebChromeClient::scrollbarsModeDidChange): + +2009-08-27 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Adam Roben. + + Modify Release_Cairo target to build testapi using the + Release_CFLite target so that the correct CoreFoundation + (in this case, CFLite.dll) is linked. + + * WebKit.vcproj/WebKit.sln: + +2009-08-26 Adam Barth <abarth@webkit.org> + + Reviewed by Oliver Hunt. + + Don't let local files access web URLs + https://bugs.webkit.org/show_bug.cgi?id=28480 + + * WebPreferences.cpp: + (WebPreferences::initializeDefaultSettings): + +2009-08-26 David Levin <levin@chromium.org> + + Reviewed by Darin Fisher. + + ResourceRequestBase::*[Aa]llowHTTPCookies shouldn't mention http. + https://bugs.webkit.org/show_bug.cgi?id=28735 + + * WebMutableURLRequest.cpp: + (WebMutableURLRequest::setHTTPShouldHandleCookies): + +2009-08-25 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Oliver Hunt. + + <video> and <audio> controller should be accessible + https://bugs.webkit.org/show_bug.cgi?id=28081 + + * WebCoreLocalizedStrings.cpp: + (WebCore::localizedMediaControlElementString): + (WebCore::localizedMediaControlElementHelpText): + (WebCore::localizedMediaTimeDescription): + New. + +2009-08-25 Brent Fulgham <bfulgham@webkit.org> + + Build fix for Windows. + + Revise Debug_Cairo build target to build testapi, jsc, WinLauncher, + DumpRenderTree, and TestNetscapeAPI using WinCairo debug build + settings so they link against the proper libraries. + + * WebKit.vcproj/WebKit.sln: + +2009-08-25 David Levin <levin@chromium.org> + + Reviewed by Adam Roben. + + PLATFORM(CFNETWORK) should be USE(CFNETWORK). + https://bugs.webkit.org/show_bug.cgi?id=28713 + + Also, moved the #if header section after the other #includes. + + * WebError.cpp: + (WebError::localizedDescription): + +2009-08-24 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Steve Falkenburg. + + Revise CFLite Debug build to emit DLL's with _debug label. + https://bugs.webkit.org/show_bug.cgi?id=28695. + + * WebKit.vcproj/WebKit.vcproj: Modify Debug_Cairo target to + inherit from new debug_wincairo property sheet, instead of + the current debug sheet. + +2009-08-22 Adam Barth <abarth@webkit.org> + + Revert 47684. We're going to do this later once clients have had a + chance to opt into the setting they like. + + * WebPreferences.cpp: + (WebPreferences::initializeDefaultSettings): + +2009-08-22 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Don't let local files access web URLs + https://bugs.webkit.org/show_bug.cgi?id=28480 + + * WebPreferences.cpp: + (WebPreferences::initializeDefaultSettings): + +2009-08-20 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + Fix of <http://webkit.org/b/27850>. Panning by emulating Mouse Wheel Events breaks Google Maps. + + Switched to using RenderLayer::scrollByRecursively instead of emulating a mouse wheel, + and switched to handling the hit testing in WebView from doing it as part of the mouse wheel event. + One downside of this fix is that panning will not jump out of frames anymore (same behavior as pan-scrolling), but + this is tracked in <http://webkit.org/b/28237>. + + * WebView.cpp: + (WebView::gestureNotify): Added hit testing here to figure out the node the user started the gesture on. + (WebView::gesture): Switched from emulating mouse wheel events for panning to calling RenderLayer::scrollByRecursively. + * WebView.h: + +2009-08-18 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Oliver Hunt. + + Fix of <https://bugs.webkit.org/show_bug.cgi?id=28326> DRT on Windows doesn't support + LayoutTestController::setQuota or print a callback on UIDelegate::exceededDatabaseQuota. + + Added a setQuota interface method to IWebDatabaseManager and implemented it. + + * Interfaces/IWebDatabaseManager.idl: + * WebDatabaseManager.cpp: + (WebDatabaseManager::setQuota): + * WebDatabaseManager.h: + +2009-08-18 Drew Wilson <atwilson@google.com> + + Unreviewed (build break). + + Added missing include for WebWorkersPrivate.h. + + * WebKitClassFactory.cpp: + +2009-08-18 Peter Kasting <pkasting@google.com> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=28415 + Set svn:eol-style CRLF on all .sln and .vcproj files that don't already + have it. + + * WebKit.vcproj/InterfacesGenerated.vcproj: + +2009-08-18 Drew Wilson <atwilson@google.com> + + Reviewed by Eric Seidel. + + Need to extend DumpRenderTree to expose number of worker threads + https://bugs.webkit.org/show_bug.cgi?id=28292 + + Defined/implemented COM interfaces to expose WorkerThread::workerThreadCount() for DumpRenderTree. + + * ForEachCoClass.h: + Added WebWorkersPrivate. + * Interfaces/IWebWorkersPrivate.idl: Added. + * Interfaces/WebKit.idl: + Added WebWorkersPrivate. + * WebKit.vcproj/Interfaces.vcproj: + * WebKit.vcproj/WebKit.vcproj: + * WebWorkersPrivate.cpp: Added. + Implementation of the IWebWorkersPrivate COM interface, to expose workerThreadCount() for DumpRenderTree. + (WebWorkersPrivate::QueryInterface): + (WebWorkersPrivate::AddRef): + (WebWorkersPrivate::Release): + (WebWorkersPrivate::workerThreadCount): + (WebWorkersPrivate::createInstance): + (WebWorkersPrivate::WebWorkersPrivate): + (WebWorkersPrivate::~WebWorkersPrivate): + * WebWorkersPrivate.h: Added. + +2009-08-17 Peter Kasting <pkasting@google.com> + + Reviewed by Steve Falkenburg. + + https://bugs.webkit.org/show_bug.cgi?id=27323 + Only add Cygwin to the path when it isn't already there. This avoids + causing problems for people who purposefully have non-Cygwin versions of + executables like svn in front of the Cygwin ones in their paths. + + * WebKit.vcproj/Interfaces.vcproj: + * WebKit.vcproj/InterfacesGenerated.vcproj: + * WebKit.vcproj/WebKit.vcproj: + * WebKit.vcproj/WebKitGUID.vcproj: + +2009-08-17 Simon Fraser <simon.fraser@apple.com> + + Speculative fix for Windows build bustage. + + * DOMHTMLClasses.cpp: + (DOMHTMLElement::idName): + +2009-08-13 Jon Honeycutt <jhoneycutt@apple.com> + + Part of <rdar://problem/6218721> No MSAA focus events fired for Webkit + nightly (20866) + + https://bugs.webkit.org/show_bug.cgi?id=20866 + + Reviewed by Oliver Hunt. + + * AccessibleBase.cpp: + (AccessibleBase::getAccessibilityObjectForChild): + If the child ID is negative, negate it and treat it as an AXID. + +2009-08-12 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + Fix of <rdar://6728361> Mouse wheel scrolling on a page with expanded drop down + list detaches drop down. + + Added a check in mouseWheel to see if our focus is currently in a popup, if so, close + the popup (matches other browser behavior). + + * WebView.cpp: + (WebView::mouseWheel): + +2009-08-12 Adam Roben <aroben@apple.com> + + Make WebPreferenceKeysPrivate.h available for client use + + Reviewed by Dave Hyatt. + + Fixes <http://webkit.org/b/28227>. + + * WebKit.vcproj/WebKit.vcproj: Copy WebPreferenceKeysPrivate.h to + $WebKitOutputDir, just like we do for a few other headers. Also let VS + reorder some XML attributes. + + * WebPreferenceKeysPrivate.h: Touched this file to force a build. + +2009-08-11 Adam Roben <aroben@apple.com> + + Remove support for a window resizer within the WebView + + Starting with Safari 4, there is never a window resizer inside the + WebView, so we no longer need to support that functionality. + + Fixes <http://webkit.org/b/28190> Remove support for a window resizer + within the WebView + + Reviewed by Dave Hyatt. + + * Interfaces/IWebUIDelegatePrivate.idl: Replaced the delegate + functions related to the window resizer with unused*() functions. We + can't remove them entirely because we need to keep the vtable + unchanged so new versions of WebKit will work with old versions of + Safari (e.g., for nightlies and WebKit development). + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::windowResizerRect): Now always returns an empty + rect. + + * WebView.cpp: + (WebView::paint): + (WebView::handleMouseEvent): + * WebView.h: + Removed window-resizer-related code. + +2009-08-11 John Gregg <johnnyg@google.com> + + Reviewed by Maciej Stachowiak. + + Move the accessor for notifications presenter from WebUIDelegate + to WebUIDelegate2 which extends it. When making this call from + WebCoreSupport, check using QueryInterface before calling. + + https://bugs.webkit.org/show_bug.cgi?id=28198 + + * Interfaces/IWebUIDelegate.idl: + * Interfaces/IWebUIDelegate2.idl: Added. + * Interfaces/WebKit.idl: + * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: + (WebDesktopNotificationsDelegate::show): + (WebDesktopNotificationsDelegate::cancel): + (WebDesktopNotificationsDelegate::notificationObjectDestroyed): + (WebDesktopNotificationsDelegate::requestPermission): + (WebDesktopNotificationsDelegate::checkPermission): + (WebDesktopNotificationsDelegate::hasNotificationDelegate): + (WebDesktopNotificationsDelegate::notificationDelegate): + * WebCoreSupport/WebDesktopNotificationsDelegate.h: + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by NOBODY (build break). + + Speculative Windows build fix - undo previous unnecessary change. + + * WebCoreSupport/WebDesktopNotificationsDelegate.h: + +2009-08-11 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Steve Falkenburg. + + Refactored MIMETypeforExtension to be a member of IWebViewPrivate + instead of IWebView. + + * Interfaces/IWebView.idl: + * Interfaces/IWebViewPrivate.idl: + * WebView.cpp: + (WebView::MIMETypeForExtension): + * WebView.h: + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by NOBODY (build break) + + Speculative fix for windows build break. + + * WebKitSupport/WebDesktopNotificationsDelegate.h: + WebCore/Notification*.h => WebCore/notifications/Notification*.h + +2009-08-11 John Gregg <johnnyg@google.com> + + Reviewed by Maciej Stachowiak. + + Desktop Notifications API + https://bugs.webkit.org/show_bug.cgi?id=25643 + + Adds test hooks for notification features to WebCoreSupport for + use in DumpRenderTree. + + * Interfaces/IWebDesktopNotificationsDelegate.idl: Added. + * Interfaces/IWebUIDelegate.idl: + * Interfaces/WebKit.idl: + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::WebChromeClient): + * WebCoreSupport/WebChromeClient.h: + (WebChromeClient::notificationPresenter): + * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: Added. + (NotificationCOMWrapper::create): + (NotificationCOMWrapper::NotificationCOMWrapper): + (NotificationCOMWrapper::QueryInterface): + (NotificationCOMWrapper::AddRef): + (NotificationCOMWrapper::Release): + (NotificationCOMWrapper::isHTML): + (NotificationCOMWrapper::contentsURL): + (NotificationCOMWrapper::iconURL): + (NotificationCOMWrapper::title): + (NotificationCOMWrapper::text): + (NotificationCOMWrapper::notifyDisplay): + (NotificationCOMWrapper::notifyError): + (NotificationCOMWrapper::notifyClose): + (WebDesktopNotificationsDelegate::WebDesktopNotificationsDelegate): + (WebDesktopNotificationsDelegate::show): + (WebDesktopNotificationsDelegate::cancel): + (WebDesktopNotificationsDelegate::notificationObjectDestroyed): + (WebDesktopNotificationsDelegate::requestPermission): + (WebDesktopNotificationsDelegate::checkPermission): + (WebDesktopNotificationsDelegate::notificationDelegate): + * WebCoreSupport/WebDesktopNotificationsDelegate.h: Added. + * WebCoreSupport/WebInspectorDelegate.h: + (WebInspectorDelegate::desktopNotificationsDelegate): + * WebKit.vcproj/Interfaces.vcproj: + * WebKit.vcproj/WebKit.vcproj: + +2009-08-11 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + Fix of <rdar://5016504> SVG file cannot be dragged to webview, + but can be opened via Open File. + + Added a new function to IWebView that gets the MIME type for a given + extension from the MIMETypeRegistry. + + * Interfaces/IWebView.idl: + * WebView.cpp: + (WebView::MIMETypeForExtension): + * WebView.h: + +2009-08-11 Dmitry Titov <dimich@chromium.org> + + Reviewed by Adam Roben. + + Originally implemented by Glenn Wilson <gwilson@chromium.org>. + + Added support for overriding default preferences per-test. + See https://bugs.webkit.org/show_bug.cgi?id=20534 + + * Interfaces/IWebPreferencesPrivate.idl: added new method setPreferenceForTest + * WebPreferences.cpp: same. + * WebPreferences.h: same. + 2009-08-10 Dan Bernstein <mitz@apple.com> Reviewed by Darin Adler. diff --git a/WebKit/win/DOMCreateInstance.cpp b/WebKit/win/DOMCreateInstance.cpp index 78b2d4e..ebaa4ce 100644 --- a/WebKit/win/DOMCreateInstance.cpp +++ b/WebKit/win/DOMCreateInstance.cpp @@ -72,7 +72,6 @@ #include "GEN_DOMStyleSheet.h" #include "GEN_DOMStyleSheetList.h" #include "GEN_DOMEvent.h" -#include "GEN_DOMEventListener.h" #include "GEN_DOMEvent.h" #include <wtf/HashMap.h> @@ -249,7 +248,6 @@ CREATE_ONLY_SELF(NodeList) // FIXME: Add the subclasses for Event when they get generated. CREATE_ONLY_SELF(Event) -CREATE_ONLY_SELF(EventListener) // CSS diff --git a/WebKit/win/DOMHTMLClasses.cpp b/WebKit/win/DOMHTMLClasses.cpp index a216c1f..9ce6004 100644 --- a/WebKit/win/DOMHTMLClasses.cpp +++ b/WebKit/win/DOMHTMLClasses.cpp @@ -367,7 +367,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLElement::idName( return E_POINTER; ASSERT(m_element && m_element->isHTMLElement()); - String idString = static_cast<HTMLElement*>(m_element)->id(); + String idString = static_cast<HTMLElement*>(m_element)->getAttribute(idAttr); *result = BString(idString).release(); return S_OK; } diff --git a/WebKit/win/DefaultDownloadDelegate.cpp b/WebKit/win/DefaultDownloadDelegate.cpp index a50d119..cf443b5 100644 --- a/WebKit/win/DefaultDownloadDelegate.cpp +++ b/WebKit/win/DefaultDownloadDelegate.cpp @@ -203,6 +203,7 @@ HRESULT STDMETHODCALLTYPE DefaultDownloadDelegate::willSendRequest(IWebDownload* download = 0; redirectResponse = 0; *finalRequest = request; + (*finalRequest)->AddRef(); return S_OK; } diff --git a/WebKit/win/ForEachCoClass.h b/WebKit/win/ForEachCoClass.h index 05a81ff..26f4a6c 100644 --- a/WebKit/win/ForEachCoClass.h +++ b/WebKit/win/ForEachCoClass.h @@ -62,6 +62,7 @@ macro(WebArchive) \ macro(WebCoreStatistics) \ macro(WebCookieManager) \ + macro(WebWorkersPrivate) \ // end of macro // Everything below this point is deprecated. Please do not use. diff --git a/WebKit/win/Interfaces/IWebDatabaseManager.idl b/WebKit/win/Interfaces/IWebDatabaseManager.idl index c877c03..4292dc6 100644 --- a/WebKit/win/Interfaces/IWebDatabaseManager.idl +++ b/WebKit/win/Interfaces/IWebDatabaseManager.idl @@ -59,4 +59,6 @@ interface IWebDatabaseManager : IUnknown HRESULT deleteAllDatabases(); HRESULT deleteOrigin([in] IWebSecurityOrigin* origin); HRESULT deleteDatabase([in] BSTR databaseName, [in] IWebSecurityOrigin* origin); + + HRESULT setQuota([in] BSTR originName, [in] unsigned long long quota); } diff --git a/WebKit/win/Interfaces/IWebDesktopNotificationsDelegate.idl b/WebKit/win/Interfaces/IWebDesktopNotificationsDelegate.idl new file mode 100644 index 0000000..20bb541 --- /dev/null +++ b/WebKit/win/Interfaces/IWebDesktopNotificationsDelegate.idl @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2009 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. + */ + +#ifndef DO_NO_IMPORTS +import "oaidl.idl"; +import "ocidl.idl"; +#endif + +/*! + @category WebDesktopNotification + @discussion A class that represents a notification being shown + on the user's desktop. It provides the contents of the notification + and receives events related to the display. + @interface NSObject (WebDesktopNotificationProvider) +*/ +[ + object, + oleautomation, + uuid(0A0AAFA8-C698-4cff-BD28-39614622EEA4), + pointer_default(unique) +] +interface IWebDesktopNotification : IUnknown +{ + HRESULT isHTML([out, retval] BOOL* result); + HRESULT contentsURL([out, retval] BSTR* result); + HRESULT iconURL([out, retval] BSTR* result); + HRESULT title([out, retval] BSTR* result); + HRESULT text([out, retval] BSTR* result); + + HRESULT notifyDisplay(); + HRESULT notifyError(); + HRESULT notifyClose([in] BOOL xplicit); +} + +/*! + @category WebDesktopNotificationsDelegate + @discussion A class that implements WebDesktopNotificationProvider provides + methods that may be used by Javascript to display notifications ("toasts") + on the user's desktop. + @interface NSObject (WebDesktopNotificationProvider) +*/ +[ + object, + oleautomation, + uuid(09DA073E-38B3-466a-9828-B2915FDD2ECB), + pointer_default(unique) +] + +interface IWebDesktopNotificationsDelegate : IUnknown +{ + /*! + @method showDesktopNotification: + @abstract Show a notification. + @param notification The Notification to be shown. + */ + HRESULT showDesktopNotification([in] IWebDesktopNotification* notification); + + /*! + @method cancelDesktopNotification: + @abstract Cancel showing a notification (or take it down if it's shown). + @param notification The Notification to be canceled. + */ + HRESULT cancelDesktopNotification([in] IWebDesktopNotification* notification); + + /*! + @method notificationDestroyed: + @abstract Notify the presenter that the object has been destroyed. The + notification need not be un-shown, but events should not be invoked. + @param notification The Notification that was destroyed. + */ + HRESULT notificationDestroyed([in] IWebDesktopNotification* notification); + + /*! + @method checkNotificationPermission: + @abstract See if the origin context is allowed to show notifications. + @param origin The origin to be checked. + @param result A value from WebCore::NotificationProvider::Permission enum. + */ + HRESULT checkNotificationPermission([in] BSTR origin, [out, retval] int* result); + + /*! + @method requestNotificationPermission: + @abstract Request permission to show notifications on a given origin. + @param origin The origin to be requested. + */ + HRESULT requestNotificationPermission([in] BSTR origin); +} diff --git a/WebKit/win/Interfaces/IWebFrame.idl b/WebKit/win/Interfaces/IWebFrame.idl index 30af7b9..da2a78f 100644 --- a/WebKit/win/Interfaces/IWebFrame.idl +++ b/WebKit/win/Interfaces/IWebFrame.idl @@ -254,4 +254,10 @@ interface IWebFrame : IUnknown @param flag YES to mark the frame as not searchable */ HRESULT setExcludeFromTextSearch([in] BOOL flag); + + /*! + @method reloadFromOrigin + @discussion Performs HTTP/1.1 end-to-end reload. + */ + HRESULT reloadFromOrigin(); } diff --git a/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate2.idl b/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate2.idl new file mode 100644 index 0000000..d646528 --- /dev/null +++ b/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate2.idl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 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 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 DO_NO_IMPORTS +import "oaidl.idl"; +import "ocidl.idl"; +import "IWebFrame.idl"; +import "IWebView.idl"; +#endif + +interface IWebFrame; +interface IWebView; +interface IWebSecurityOrigin; + +[ + object, + oleautomation, + uuid(4148C9F8-94D9-479A-BCF1-C15E5269CCC1), + pointer_default(unique) +] +interface IWebFrameLoadDelegatePrivate2 : IWebFrameLoadDelegatePrivate +{ + HRESULT didDisplayInsecureContent([in] IWebView* sender); + + HRESULT didRunInsecureContent([in] IWebView* sender, [in] IWebSecurityOrigin* origin); +} diff --git a/WebKit/win/Interfaces/IWebFramePrivate.idl b/WebKit/win/Interfaces/IWebFramePrivate.idl index 96b42ab..a3366da 100755 --- a/WebKit/win/Interfaces/IWebFramePrivate.idl +++ b/WebKit/win/Interfaces/IWebFramePrivate.idl @@ -91,4 +91,6 @@ interface IWebFramePrivate : IUnknown HRESULT numberOfActiveAnimations([out, retval] UINT* number); HRESULT isDisplayingStandaloneImage([out, retval] BOOL* result); + + HRESULT allowsFollowingLink([in] BSTR url, [out, retval] BOOL* result); } diff --git a/WebKit/win/Interfaces/IWebInspectorPrivate.idl b/WebKit/win/Interfaces/IWebInspectorPrivate.idl new file mode 100644 index 0000000..74421bd --- /dev/null +++ b/WebKit/win/Interfaces/IWebInspectorPrivate.idl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2007, 2008 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 DO_NO_IMPORTS +import "oaidl.idl"; +import "ocidl.idl"; +#endif + +[ + object, + oleautomation, + uuid(A5A31CD0-AEA9-11de-8A39-0800200C9A66), + pointer_default(unique) +] +interface IWebInspectorPrivate : IUnknown +{ + HRESULT evaluateInFrontend([in] ULONG callId, [in] BSTR script); +} diff --git a/WebKit/win/Interfaces/IWebPluginHalterDelegate.idl b/WebKit/win/Interfaces/IWebPluginHalterDelegate.idl new file mode 100644 index 0000000..f79e304 --- /dev/null +++ b/WebKit/win/Interfaces/IWebPluginHalterDelegate.idl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 DO_NO_IMPORTS +import "oaidl.idl"; +import "ocidl.idl"; +#endif + +interface IDOMNode; +interface IWebView; + +[ + object, + oleautomation, + uuid(2e0e5d9e-ffc9-4185-aa15-e66868d548ee), + pointer_default(unique) +] +interface IWebPluginHalterDelegate : IUnknown +{ + HRESULT shouldHaltPlugin([in] IWebView* webView, [in] IDOMNode*, [out, retval] BOOL* result); +} diff --git a/WebKit/win/Interfaces/IWebPolicyDelegatePrivate.idl b/WebKit/win/Interfaces/IWebPolicyDelegatePrivate.idl new file mode 100644 index 0000000..4bb052c --- /dev/null +++ b/WebKit/win/Interfaces/IWebPolicyDelegatePrivate.idl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 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 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 DO_NO_IMPORTS +import "oaidl.idl"; +import "ocidl.idl"; +import "IWebFrame.idl" +import "IWebView.idl" +#endif + +interface IWebView; +interface IWebFrame; + +[ + object, + oleautomation, + uuid(BA053E15-559F-46ee-A1D4-F8003EFFB658), + pointer_default(unique) +] +interface IWebPolicyDelegatePrivate : IUnknown +{ + HRESULT shouldLoadMediaURL([in] IWebView* webView, [in] BSTR url, [in] IWebFrame* frame, [out, retval] BOOL* retval); +} diff --git a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl index 562a75b..d994211 100644 --- a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl +++ b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl @@ -78,4 +78,23 @@ interface IWebPreferencesPrivate : IUnknown HRESULT isXSSAuditorEnabled([out, retval] BOOL *enabled); HRESULT setXSSAuditorEnabled([in] BOOL enabled); + + HRESULT experimentalNotificationsEnabled([out, retval] BOOL *enabled); + HRESULT setExperimentalNotificationsEnabled([in] BOOL enabled); + + HRESULT experimentalWebSocketsEnabled([out, retval] BOOL *enabled); + HRESULT setExperimentalWebSocketsEnabled([in] BOOL enabled); + + HRESULT setShouldUseHighResolutionTimers([in] BOOL useHighResolutionTimers); + HRESULT shouldUseHighResolutionTimers([out, retval] BOOL* useHighResolutionTimers); + + // Used to set preference specified by a test via LayoutTestController.overridePreference(..). + // Used by DumpRenderTree. + HRESULT setPreferenceForTest([in] BSTR key, [in] BSTR value); + + HRESULT setPluginHalterEnabled([in] BOOL enabled); + HRESULT pluginHalterEnabled([out, retval] BOOL* enabled); + + HRESULT setPluginAllowedRunTime([in] UINT allowedRunTime); + HRESULT pluginAllowedRunTime([out, retval] UINT* allowedRunTime); } diff --git a/WebKit/win/Interfaces/IWebUIDelegate2.idl b/WebKit/win/Interfaces/IWebUIDelegate2.idl new file mode 100644 index 0000000..a413389 --- /dev/null +++ b/WebKit/win/Interfaces/IWebUIDelegate2.idl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2009 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. + */ + +#ifndef DO_NO_IMPORTS +import "oaidl.idl"; +import "ocidl.idl"; +#endif + +/*! + @category WebUIDelegate2 + @discussion An extension of WebUIDelegate which additionally + provides access to a notification presenter. + @interface NSObject (WebUIDelegate2) +*/ +[ + object, + oleautomation, + uuid(C6DEF152-86CD-11de-8BF4-ADD456D89593), + pointer_default(unique) +] + +interface IWebUIDelegate2 : IWebUIDelegate +{ + /*! + @method desktopNotificationsDelegate: + @abstract Returns the notifications delegate object. + */ + HRESULT desktopNotificationsDelegate([out, retval] IWebDesktopNotificationsDelegate** result); +} diff --git a/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl b/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl index da8269b..e09aac4 100755 --- a/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl +++ b/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl @@ -48,8 +48,8 @@ interface IWebView; ] interface IWebUIDelegatePrivate : IUnknown { - HRESULT webViewResizerRect([in] IWebView* sender, [out, retval] RECT* rect); - HRESULT webViewDrawResizer([in] IWebView* sender, [in] HDC dc, [in] BOOL overlapsContent, [in] RECT* rect); + HRESULT unused1(); + HRESULT unused2(); HRESULT webViewScrolled([in] IWebView* sender); HRESULT webViewAddMessageToConsole([in] IWebView* sender, [in] BSTR message, [in] int lineNumber, [in] BSTR url, [in] BOOL isError); HRESULT webViewShouldInterruptJavaScript([in] IWebView* sender, [out, retval] BOOL* result); @@ -60,8 +60,38 @@ interface IWebUIDelegatePrivate : IUnknown HRESULT webViewPainted([in] IWebView* sender); HRESULT exceededDatabaseQuota([in] IWebView* sender, [in] IWebFrame* frame, [in] IWebSecurityOrigin* origin, [in] BSTR databaseIdentifier); HRESULT embeddedViewWithArguments([in] IWebView* sender, [in] IWebFrame* frame, [in] IPropertyBag* arguments, [out, retval] IWebEmbeddedView** view); - HRESULT webViewSendResizeMessage([in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam); + HRESULT unused3(); HRESULT webViewClosing([in] IWebView* sender); HRESULT webViewSetCursor([in] IWebView* sender, [in] OLE_HANDLE cursor); HRESULT webViewDidInvalidate([in] IWebView* sender); } + +cpp_quote("#define WebWindowFeaturesXKey L\"x\"") +cpp_quote("#define WebWindowFeaturesYKey L\"y\"") +cpp_quote("#define WebWindowFeaturesWidthKey L\"width\"") +cpp_quote("#define WebWindowFeaturesHeightKey L\"height\"") +cpp_quote("#define WebWindowFeaturesMenuBarVisibleKey L\"menuBarVisible\"") +cpp_quote("#define WebWindowFeaturesStatusBarVisibleKey L\"statusBarVisible\"") +cpp_quote("#define WebWindowFeaturesToolBarVisibleKey L\"toolBarVisible\"") +cpp_quote("#define WebWindowFeaturesScrollbarsVisibleKey L\"scrollbarsVisible\"") +cpp_quote("#define WebWindowFeaturesResizableKey L\"resizable\"") +cpp_quote("#define WebWindowFeaturesFullscreenKey L\"fullscreen\"") +cpp_quote("#define WebWindowFeaturesDialogKey L\"dialog\"") + +[ + object, + oleautomation, + uuid(b7d6a98e-9c4f-43f2-b6a7-0975a0b18421), + pointer_default(unique) +] +interface IWebUIDelegatePrivate2 : IWebUIDelegatePrivate +{ + // This function obsoletes IWebUIDelegate::createWebViewWithRequest and + // IWebUIDelegate::createModalDialog. Clients should determine whether to create a modal dialog + // based on whether WebWindowFeaturesDialogKey returns a TRUE value from the windowFeatures + // IPropertyBag. The keys of the windowFeatures IPropertyBag are the WebWindowFeatures*Key + // strings above. + HRESULT createWebViewWithRequest([in] IWebView* sender, [in] IWebURLRequest* request, [in] IPropertyBag* windowFeatures, [out, retval] IWebView** newWebView); + + HRESULT drawBackground([in] IWebView* sender, [in] OLE_HANDLE hdc, [in] const RECT* dirtyRect); +} diff --git a/WebKit/win/Interfaces/IWebView.idl b/WebKit/win/Interfaces/IWebView.idl index 04e996c..bec4df5 100644 --- a/WebKit/win/Interfaces/IWebView.idl +++ b/WebKit/win/Interfaces/IWebView.idl @@ -29,6 +29,7 @@ cpp_quote("enum WebViewCmd { Cut = 100, Copy, Paste, ForwardDelete, SelectAll, U cpp_quote("#define WebViewProgressStartedNotification TEXT(\"WebProgressStartedNotification\")") cpp_quote("#define WebViewProgressEstimateChangedNotification TEXT(\"WebProgressEstimateChangedNotification\")") cpp_quote("#define WebViewProgressFinishedNotification TEXT(\"WebProgressFinishedNotification\")") +cpp_quote("#define WebViewDidChangeSelectionNotification TEXT(\"WebViewDidChangeSelectionNotification\")") #ifndef DO_NO_IMPORTS import "oaidl.idl"; @@ -872,6 +873,11 @@ interface IWebIBActions : IUnknown - (IBAction)resetPageZoom:(id)sender; */ HRESULT resetPageZoom([in] IUnknown* sender); + + /* + - (IBAction)reloadFromOrigin:(id)sender; + */ + HRESULT reloadFromOrigin([in] IUnknown* sender); } /* diff --git a/WebKit/win/Interfaces/IWebViewPrivate.idl b/WebKit/win/Interfaces/IWebViewPrivate.idl index e4680a1..465d804 100644 --- a/WebKit/win/Interfaces/IWebViewPrivate.idl +++ b/WebKit/win/Interfaces/IWebViewPrivate.idl @@ -29,15 +29,26 @@ import "ocidl.idl"; import "IWebFormDelegate.idl"; import "IWebFrameLoadDelegatePrivate.idl"; import "IWebInspector.idl"; +import "IWebInspectorPrivate.idl"; #endif +// Sent when IWebView::close is called. No userInfo is associated with this notification. +cpp_quote("#define WebViewWillCloseNotification L\"WebViewWillCloseNotification\"") + interface IEnumTextMatches; interface IWebFormDelegate; interface IWebFrameLoadDelegatePrivate; interface IWebInspector; +interface IWebInspectorPrivate; +interface IWebPluginHalterDelegate; interface IWebURLRequest; interface IWebView; +typedef enum { + WebInjectAtDocumentStart = 0, + WebInjectAtDocumentEnd, +} WebUserScriptInjectionTime; + [ object, oleautomation, @@ -161,4 +172,40 @@ interface IWebViewPrivate : IUnknown HRESULT setJavaScriptURLsAreAllowed([in] BOOL areAllowed); HRESULT setCanStartPlugins([in] BOOL canStartPlugins); + + /*! + @method MIMETypeForExtension: + @abstract Returns the mime type for a certian file extension. + @param path The extension of the file to check. + @result The mime type of the specified extension. + + (BSTR)MIMETypeForPath:(NSString *)path; + */ + HRESULT MIMETypeForExtension([in] BSTR extension, [out, retval] BSTR* mimeType); + + // For the following functions, 0 < worldID < UINT_MAX. + HRESULT addUserScriptToGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR source, [in] BSTR url, + [in] unsigned whitelistCount, [in, size_is(whitelistCount)] BSTR* whitelist, + [in] unsigned blacklistCount, [in, size_is(blacklistCount)] BSTR* blacklist, + [in] WebUserScriptInjectionTime injectionTime); + HRESULT addUserStyleSheetToGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR source, [in] BSTR url, + [in] unsigned whitelistCount, [in, size_is(whitelistCount)] BSTR* whitelist, + [in] unsigned blacklistCount, [in, size_is(blacklistCount)] BSTR* blacklist); + HRESULT removeUserContentWithURLFromGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR url); + HRESULT removeUserContentFromGroup([in] BSTR groupName, [in] unsigned worldID); + HRESULT removeAllUserContentFromGroup([in] BSTR groupName); + + HRESULT setPluginHalterDelegate([in] IWebPluginHalterDelegate* d); + HRESULT pluginHalterDelegate([retval, out] IWebPluginHalterDelegate** d); + + // If rect is 0, the entire backing store will be invalidated. + HRESULT invalidateBackingStore([in] const RECT* rect); + + // Whitelists access from an origin (sourceOrigin) to a set of one or more origins described by the parameters: + // - destinationProtocol: The protocol to grant access to. + // - destinationHost: The host to grant access to. + // - allowDestinationSubdomains: If host is a domain, setting this to YES will whitelist host and all its subdomains, recursively. + HRESULT whiteListAccessFromOrigin([in] BSTR sourceOrigin, [in] BSTR destinationProtocol, [in] BSTR destinationHost, [in] BOOL allowDestinationSubdomains); + + // Removes all white list entries created with whiteListAccessFromOrigin. + HRESULT resetOriginAccessWhiteLists(); } diff --git a/WebKit/win/Interfaces/IWebWorkersPrivate.idl b/WebKit/win/Interfaces/IWebWorkersPrivate.idl new file mode 100644 index 0000000..990b8f7 --- /dev/null +++ b/WebKit/win/Interfaces/IWebWorkersPrivate.idl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. + */ + +#ifndef DO_NO_IMPORTS +import "oaidl.idl"; +import "ocidl.idl"; +#endif + +/*! + @class WebWorkersPrivate + @discussion WebWorkersPrivate exposes internals about WebWorkers for use in + layout tests. +*/ +[ + object, + oleautomation, + hidden, + uuid(537069C5-389C-41ae-9A82-423ACA8B2C02), + pointer_default(unique) +] + +interface IWebWorkersPrivate : IUnknown +{ + HRESULT workerThreadCount([out, retval] UINT* number); +} diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl index 3a6fd8d..c9b33cc 100644 --- a/WebKit/win/Interfaces/WebKit.idl +++ b/WebKit/win/Interfaces/WebKit.idl @@ -73,6 +73,7 @@ import "ocidl.idl"; #include "IWebCoreStatistics.idl" #include "IWebDataSource.idl" #include "IWebDatabaseManager.idl" +#include "IWebDesktopNotificationsDelegate.idl" #include "IWebDocument.idl" #include "IWebDownload.idl" #include "IWebEditingDelegate.idl" @@ -83,6 +84,7 @@ import "ocidl.idl"; #include "IWebFrame.idl" #include "IWebFrameLoadDelegate.idl" #include "IWebFrameLoadDelegatePrivate.idl" +#include "IWebFrameLoadDelegatePrivate2.idl" #include "IWebFramePrivate.idl" #include "IWebFrameView.idl" #include "IWebHTMLRepresentation.idl" @@ -94,13 +96,16 @@ import "ocidl.idl"; #include "IWebIconDatabase.idl" #include "IWebIconFetcher.idl" #include "IWebInspector.idl" +#include "IWebInspectorPrivate.idl" #include "IWebJavaScriptCollector.idl" #include "IWebKitStatistics.idl" #include "IWebMutableURLRequestPrivate.idl" #include "IWebNotification.idl" #include "IWebNotificationCenter.idl" #include "IWebNotificationObserver.idl" +#include "IWebPluginHalterDelegate.idl" #include "IWebPolicyDelegate.idl" +#include "IWebPolicyDelegatePrivate.idl" #include "IWebPreferences.idl" #include "IWebPreferencesPrivate.idl" #include "IWebResource.idl" @@ -111,6 +116,7 @@ import "ocidl.idl"; #include "IWebSecurityOrigin.idl" #include "IWebTextRenderer.idl" #include "IWebUIDelegate.idl" +#include "IWebUIDelegate2.idl" #include "IWebUIDelegatePrivate.idl" #include "IWebURLAuthenticationChallenge.idl" #include "IWebURLRequest.idl" @@ -121,6 +127,7 @@ import "ocidl.idl"; #include "IWebUndoTarget.idl" #include "IWebView.idl" #include "IWebViewPrivate.idl" +#include "IWebWorkersPrivate.idl" #include "IGEN_DOMObject.idl" #include "IGEN_DOMCharacterData.idl" @@ -357,6 +364,10 @@ library WebKit coclass WebCookieManager{ [default] interface IWebCookieManager; } -} + [uuid(0967AAFF-2FFE-4fcc-81F3-3FF2A9C6DCE2)] + coclass WebWorkersPrivate{ + [default] interface IWebWorkersPrivate; + } +} diff --git a/WebKit/win/WebCoreLocalizedStrings.cpp b/WebKit/win/WebCoreLocalizedStrings.cpp index 389b1c0..03d03e7 100644 --- a/WebKit/win/WebCoreLocalizedStrings.cpp +++ b/WebKit/win/WebCoreLocalizedStrings.cpp @@ -94,8 +94,6 @@ String WebCore::AXLinkActionVerb() { return String(LPCTSTR_UI_STRING("jump", "Ve String WebCore::unknownFileSizeText() { return String(LPCTSTR_UI_STRING("Unknown", "Unknown filesize FTP directory listing item")); } String WebCore::uploadFileText() { return String(LPCTSTR_UI_STRING("Upload file", "(Windows) Form submit file upload dialog title")); } String WebCore::allFilesText() { return String(LPCTSTR_UI_STRING("All Files", "(Windows) Form submit file upload all files pop-up")); } -String WebCore::mediaElementLoadingStateText() { return String(LPCTSTR_UI_STRING("Loading...", "Media controller status message when the media is loading")); } -String WebCore::mediaElementLiveBroadcastStateText() { return String(LPCTSTR_UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast")); } String WebCore::imageTitle(const String& filename, const IntSize& size) { @@ -114,3 +112,122 @@ String multipleFileUploadText(unsigned numberOfFiles) return result.get(); } + +#if ENABLE(VIDEO) +String WebCore::mediaElementLoadingStateText() { return String(LPCTSTR_UI_STRING("Loading...", "Media controller status message when the media is loading")); } +String WebCore::mediaElementLiveBroadcastStateText() { return String(LPCTSTR_UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast")); } + +String WebCore::localizedMediaControlElementString(const String& name) +{ + if (name == "AudioElement") + return String(LPCTSTR_UI_STRING("audio element controller", "accessibility role description for audio element controller")); + if (name == "VideoElement") + return String(LPCTSTR_UI_STRING("video element controller", "accessibility role description for video element controller")); + if (name == "MuteButton") + return String(LPCTSTR_UI_STRING("mute", "accessibility role description for mute button")); + if (name == "UnMuteButton") + return String(LPCTSTR_UI_STRING("unmute", "accessibility role description for turn mute off button")); + if (name == "PlayButton") + return String(LPCTSTR_UI_STRING("play", "accessibility role description for play button")); + if (name == "PauseButton") + return String(LPCTSTR_UI_STRING("pause", "accessibility role description for pause button")); + if (name == "Slider") + return String(LPCTSTR_UI_STRING("movie time", "accessibility role description for timeline slider")); + if (name == "SliderThumb") + return String(LPCTSTR_UI_STRING("timeline slider thumb", "accessibility role description for timeline thumb")); + if (name == "RewindButton") + return String(LPCTSTR_UI_STRING("back 30 seconds", "accessibility role description for seek back 30 seconds button")); + if (name == "ReturnToRealtimeButton") + return String(LPCTSTR_UI_STRING("return to realtime", "accessibility role description for return to real time button")); + if (name == "CurrentTimeDisplay") + return String(LPCTSTR_UI_STRING("elapsed time", "accessibility role description for elapsed time display")); + if (name == "TimeRemainingDisplay") + return String(LPCTSTR_UI_STRING("remaining time", "accessibility role description for time remaining display")); + if (name == "StatusDisplay") + return String(LPCTSTR_UI_STRING("status", "accessibility role description for movie status")); + if (name == "FullscreenButton") + return String(LPCTSTR_UI_STRING("fullscreen", "accessibility role description for enter fullscreen button")); + if (name == "SeekForwardButton") + return String(LPCTSTR_UI_STRING("fast forward", "accessibility role description for fast forward button")); + if (name == "SeekBackButton") + return String(LPCTSTR_UI_STRING("fast reverse", "accessibility role description for fast reverse button")); + + ASSERT_NOT_REACHED(); + return String(); +} + +String WebCore::localizedMediaControlElementHelpText(const String& name) +{ + if (name == "AudioElement") + return String(LPCTSTR_UI_STRING("audio element playback controls and status display", "accessibility role description for audio element controller")); + if (name == "VideoElement") + return String(LPCTSTR_UI_STRING("video element playback controls and status display", "accessibility role description for video element controller")); + if (name == "MuteButton") + return String(LPCTSTR_UI_STRING("mute audio tracks", "accessibility help text for mute button")); + if (name == "UnMuteButton") + return String(LPCTSTR_UI_STRING("unmute audio tracks", "accessibility help text for un mute button")); + if (name == "PlayButton") + return String(LPCTSTR_UI_STRING("begin playback", "accessibility help text for play button")); + if (name == "PauseButton") + return String(LPCTSTR_UI_STRING("pause playback", "accessibility help text for pause button")); + if (name == "Slider") + return String(LPCTSTR_UI_STRING("movie time scrubber", "accessibility help text for timeline slider")); + if (name == "SliderThumb") + return String(LPCTSTR_UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb")); + if (name == "RewindButton") + return String(LPCTSTR_UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button")); + if (name == "ReturnToRealtimeButton") + return String(LPCTSTR_UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button")); + if (name == "CurrentTimeDisplay") + return String(LPCTSTR_UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display")); + if (name == "TimeRemainingDisplay") + return String(LPCTSTR_UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display")); + if (name == "StatusDisplay") + return String(LPCTSTR_UI_STRING("current movie status", "accessibility help text for movie status display")); + if (name == "SeekBackButton") + return String(LPCTSTR_UI_STRING("seek quickly back", "accessibility help text for fast rewind button")); + if (name == "SeekForwardButton") + return String(LPCTSTR_UI_STRING("seek quickly forward", "accessibility help text for fast forward button")); + if (name == "FullscreenButton") + return String(LPCTSTR_UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button")); + + ASSERT_NOT_REACHED(); + return String(); +} + +String WebCore::localizedMediaTimeDescription(float time) +{ + if (!isfinite(time)) + return String(LPCTSTR_UI_STRING("indefinite time", "string for an indefinite movie time")); + + int seconds = (int)fabsf(time); + int days = seconds / (60 * 60 * 24); + int hours = seconds / (60 * 60); + int minutes = (seconds / 60) % 60; + seconds %= 60; + + if (days) { + static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.days", "string for days, hours, minutes & seconds")); + RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), days, hours, minutes, seconds)); + return result.get(); + } + + if (hours) { + static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.hours", "string for hours, minutes & seconds")); + RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), hours, minutes, seconds)); + return result.get(); + } + + if (minutes) { + static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.minutes", "string for minutes & seconds")); + RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), minutes, seconds)); + return result.get(); + } + + static RetainPtr<CFStringRef> format(AdoptCF, UI_STRING("date.format.for.seconds", "string for seconds")); + RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormat(0, 0, format.get(), seconds)); + return result.get(); +} + +#endif // ENABLE(VIDEO) + diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp index 1c0401f..5d39452 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.cpp +++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp @@ -26,10 +26,13 @@ #include "config.h" #include "WebChromeClient.h" +#include "COMPropertyBag.h" +#include "COMVariantSetter.h" #include "WebElementPropertyBag.h" #include "WebFrame.h" #include "WebHistory.h" #include "WebMutableURLRequest.h" +#include "WebDesktopNotificationsDelegate.h" #include "WebSecurityOrigin.h" #include "WebView.h" #pragma warning(push, 0) @@ -58,6 +61,9 @@ static const size_t maxFilePathsListSize = USHRT_MAX; WebChromeClient::WebChromeClient(WebView* webView) : m_webView(webView) +#if ENABLE(NOTIFICATIONS) + , m_notificationsDelegate(new WebDesktopNotificationsDelegate(webView)) +#endif { } @@ -150,35 +156,59 @@ void WebChromeClient::takeFocus(FocusDirection direction) } } +static COMPtr<IPropertyBag> createWindowFeaturesPropertyBag(const WindowFeatures& features) +{ + HashMap<String, COMVariant> map; + if (features.xSet) + map.set(WebWindowFeaturesXKey, features.x); + if (features.ySet) + map.set(WebWindowFeaturesYKey, features.y); + if (features.widthSet) + map.set(WebWindowFeaturesWidthKey, features.width); + if (features.heightSet) + map.set(WebWindowFeaturesHeightKey, features.height); + map.set(WebWindowFeaturesMenuBarVisibleKey, features.menuBarVisible); + map.set(WebWindowFeaturesStatusBarVisibleKey, features.statusBarVisible); + map.set(WebWindowFeaturesToolBarVisibleKey, features.toolBarVisible); + map.set(WebWindowFeaturesScrollbarsVisibleKey, features.scrollbarsVisible); + map.set(WebWindowFeaturesResizableKey, features.resizable); + map.set(WebWindowFeaturesFullscreenKey, features.fullscreen); + map.set(WebWindowFeaturesDialogKey, features.dialog); + + return COMPtr<IPropertyBag>(AdoptCOM, COMPropertyBag<COMVariant>::adopt(map)); +} + Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& frameLoadRequest, const WindowFeatures& features) { - if (features.dialog) { - COMPtr<IWebUIDelegate> delegate = uiDelegate(); - if (!delegate) - return 0; - COMPtr<IWebMutableURLRequest> request(AdoptCOM, WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest())); - COMPtr<IWebView> dialog; - if (FAILED(delegate->createModalDialog(m_webView, request.get(), &dialog))) + COMPtr<IWebUIDelegate> delegate = uiDelegate(); + if (!delegate) + return 0; + + COMPtr<IWebMutableURLRequest> request(AdoptCOM, WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest())); + + COMPtr<IWebUIDelegatePrivate2> delegatePrivate(Query, delegate); + if (delegatePrivate) { + COMPtr<IWebView> newWebView; + HRESULT hr = delegatePrivate->createWebViewWithRequest(m_webView, request.get(), createWindowFeaturesPropertyBag(features).get(), &newWebView); + + if (SUCCEEDED(hr) && newWebView) + return core(newWebView.get()); + + // If the delegate doesn't implement the IWebUIDelegatePrivate2 version of the call, fall back + // to the old versions (even if they support the IWebUIDelegatePrivate2 interface). + if (hr != E_NOTIMPL) return 0; - return core(dialog.get()); } - Page* page = 0; - IWebUIDelegate* uiDelegate = 0; - IWebMutableURLRequest* request = WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest()); + COMPtr<IWebView> newWebView; - if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) { - IWebView* webView = 0; - if (SUCCEEDED(uiDelegate->createWebViewWithRequest(m_webView, request, &webView))) { - page = core(webView); - webView->Release(); - } - - uiDelegate->Release(); - } + if (features.dialog) { + if (FAILED(delegate->createModalDialog(m_webView, request.get(), &newWebView))) + return 0; + } else if (FAILED(delegate->createWebViewWithRequest(m_webView, request.get(), &newWebView))) + return 0; - request->Release(); - return page; + return newWebView ? core(newWebView.get()) : 0; } void WebChromeClient::show() @@ -411,20 +441,7 @@ bool WebChromeClient::tabsToLinks() const IntRect WebChromeClient::windowResizerRect() const { - IntRect intRect; - - IWebUIDelegate* ui; - if (SUCCEEDED(m_webView->uiDelegate(&ui)) && ui) { - IWebUIDelegatePrivate* uiPrivate; - if (SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegatePrivate, (void**)&uiPrivate))) { - RECT r; - if (SUCCEEDED(uiPrivate->webViewResizerRect(m_webView, &r))) - intRect = IntRect(r.left, r.top, r.right-r.left, r.bottom-r.top); - uiPrivate->Release(); - } - ui->Release(); - } - return intRect; + return IntRect(); } void WebChromeClient::repaint(const IntRect& windowRect, bool contentChanged, bool immediate, bool repaintContentOnly) @@ -469,7 +486,7 @@ IntPoint WebChromeClient::screenToWindow(const IntPoint& point) const return result; } -PlatformWidget WebChromeClient::platformWindow() const +PlatformPageClient WebChromeClient::platformPageClient() const { HWND viewWindow; if (FAILED(m_webView->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow)))) diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.h b/WebKit/win/WebCoreSupport/WebChromeClient.h index c601c8e..d01e47d 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.h +++ b/WebKit/win/WebCoreSupport/WebChromeClient.h @@ -29,8 +29,10 @@ #include <WebCore/FocusDirection.h> #include <WebCore/ScrollTypes.h> #include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> class WebView; +class WebDesktopNotificationsDelegate; interface IWebUIDelegate; @@ -93,9 +95,10 @@ public: virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect); virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint& p) const; virtual WebCore::IntRect windowToScreen(const WebCore::IntRect& r) const; - virtual PlatformWidget platformWindow() const; + virtual PlatformPageClient platformPageClient() const; virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const; + virtual void scrollbarsModeDidChange() const { } virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags); virtual void setToolTip(const WebCore::String&, WebCore::TextDirection); @@ -131,8 +134,16 @@ public: virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); +#if ENABLE(NOTIFICATIONS) + virtual WebCore::NotificationPresenter* notificationPresenter() const { return reinterpret_cast<WebCore::NotificationPresenter*>(m_notificationsDelegate.get()); } +#endif + private: COMPtr<IWebUIDelegate> uiDelegate(); WebView* m_webView; + +#if ENABLE(NOTIFICATIONS) + OwnPtr<WebDesktopNotificationsDelegate> m_notificationsDelegate; +#endif }; diff --git a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp new file mode 100644 index 0000000..f822bfe --- /dev/null +++ b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp @@ -0,0 +1,204 @@ +/* + * Copyright (C) 2009 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. + */ + +#include "config.h" +#include "WebDesktopNotificationsDelegate.h" +#include "WebSecurityOrigin.h" +#include "WebView.h" +#include <WebCore/BString.h> + +#if ENABLE(NOTIFICATIONS) + +using namespace WebCore; + +class NotificationCOMWrapper : public IWebDesktopNotification { +public: + static NotificationCOMWrapper* create(Notification* inner) { return new NotificationCOMWrapper(inner); } + + // IUnknown + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef(); + virtual ULONG STDMETHODCALLTYPE Release(); + + // IWebDesktopNotification + HRESULT STDMETHODCALLTYPE isHTML(BOOL* result); + HRESULT STDMETHODCALLTYPE contentsURL(BSTR* result); + HRESULT STDMETHODCALLTYPE iconURL(BSTR* result); + HRESULT STDMETHODCALLTYPE title(BSTR* result); + HRESULT STDMETHODCALLTYPE text(BSTR* result); + HRESULT STDMETHODCALLTYPE notifyDisplay(); + HRESULT STDMETHODCALLTYPE notifyError(); + HRESULT STDMETHODCALLTYPE notifyClose(BOOL xplicit); + +private: + NotificationCOMWrapper(Notification* inner) : m_refCount(1), m_inner(inner) {} + + int m_refCount; + Notification* m_inner; +}; + +HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualGUID(riid, IID_IUnknown)) + *ppvObject = static_cast<NotificationCOMWrapper*>(this); + else if (IsEqualGUID(riid, IID_IWebDesktopNotification)) + *ppvObject = static_cast<NotificationCOMWrapper*>(this); + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +ULONG STDMETHODCALLTYPE NotificationCOMWrapper::AddRef() +{ + return ++m_refCount; +} + +ULONG STDMETHODCALLTYPE NotificationCOMWrapper::Release() +{ + ULONG newRef = --m_refCount; + if (!newRef) + delete(this); + return newRef; +} + +HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::isHTML(BOOL* result) +{ + *result = m_inner->isHTML(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::contentsURL(BSTR* result) +{ + *result = BString(m_inner->url()).release(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::iconURL(BSTR* result) +{ + *result = BString(m_inner->contents().icon()).release(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::title(BSTR* result) +{ + *result = BString(m_inner->contents().title()).release(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::text(BSTR* result) +{ + *result = BString(m_inner->contents().body()).release(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::notifyDisplay() +{ + m_inner->dispatchDisplayEvent(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::notifyError() +{ + m_inner->dispatchErrorEvent(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE NotificationCOMWrapper::notifyClose(BOOL xplicit) +{ + m_inner->dispatchCloseEvent(); + return S_OK; +} + +WebDesktopNotificationsDelegate::WebDesktopNotificationsDelegate(WebView* webView) + : m_webView(webView) +{ +} + +bool WebDesktopNotificationsDelegate::show(Notification* object) +{ + if (hasNotificationDelegate()) + notificationDelegate()->showDesktopNotification(NotificationCOMWrapper::create(object)); + return true; +} + +void WebDesktopNotificationsDelegate::cancel(Notification* object) +{ + if (hasNotificationDelegate()) + notificationDelegate()->cancelDesktopNotification(NotificationCOMWrapper::create(object)); +} + +void WebDesktopNotificationsDelegate::notificationObjectDestroyed(Notification* object) +{ + if (hasNotificationDelegate()) + notificationDelegate()->notificationDestroyed(NotificationCOMWrapper::create(object)); +} + +void WebDesktopNotificationsDelegate::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback) +{ + BString org(origin->toString()); + if (hasNotificationDelegate()) + notificationDelegate()->requestNotificationPermission(org); +} + +NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(SecurityOrigin* origin) +{ + int out = 0; + BString org(origin->toString()); + if (hasNotificationDelegate()) + notificationDelegate()->checkNotificationPermission(org, &out); + return (NotificationPresenter::Permission) out; +} + +bool WebDesktopNotificationsDelegate::hasNotificationDelegate() +{ + COMPtr<IWebUIDelegate> ui; + m_webView->uiDelegate(&ui); + + COMPtr<IWebUIDelegate2> ui2; + return SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegate2, (void**) &ui2)); +} + +COMPtr<IWebDesktopNotificationsDelegate> WebDesktopNotificationsDelegate::notificationDelegate() +{ + COMPtr<IWebUIDelegate> ui; + m_webView->uiDelegate(&ui); + + COMPtr<IWebUIDelegate2> ui2; + COMPtr<IWebDesktopNotificationsDelegate> delegate; + if (SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegate2, (void**) &ui2))) + ui2->desktopNotificationsDelegate(&delegate); + + return delegate; +} + +#endif // ENABLE(NOTIFICATIONS) diff --git a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h new file mode 100644 index 0000000..00c00d5 --- /dev/null +++ b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. + */ + +#include <WebCore/COMPtr.h> +#include <WebCore/Notification.h> +#include <WebCore/NotificationPresenter.h> + +#if ENABLE(NOTIFICATIONS) + +interface IWebDesktopNotificationPresenter; + +class WebDesktopNotificationsDelegate : public WebCore::NotificationPresenter { +public: + WebDesktopNotificationsDelegate(WebView* view); + + /* WebCore::NotificationPresenter interface */ + virtual bool show(WebCore::Notification* object); + virtual void cancel(WebCore::Notification* object); + virtual void notificationObjectDestroyed(WebCore::Notification* object); + virtual void requestPermission(WebCore::SecurityOrigin* origin, PassRefPtr<WebCore::VoidCallback> callback); + virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::SecurityOrigin* origin); + +private: + bool hasNotificationDelegate(); + COMPtr<IWebDesktopNotificationsDelegate> notificationDelegate(); + + WebView* m_webView; +}; + +#endif diff --git a/WebKit/win/WebCoreSupport/WebDragClient.cpp b/WebKit/win/WebCoreSupport/WebDragClient.cpp index e5c5a20..840fca1 100644 --- a/WebKit/win/WebCoreSupport/WebDragClient.cpp +++ b/WebKit/win/WebCoreSupport/WebDragClient.cpp @@ -33,6 +33,7 @@ #pragma warning(push, 0) #include <WebCore/ClipboardWin.h> +#include <WebCore/DragController.h> #include <WebCore/DragData.h> #include <WebCore/Font.h> #include <WebCore/FontDescription.h> @@ -68,6 +69,22 @@ namespace WebCore { using namespace WebCore; +static DWORD draggingSourceOperationMaskToDragCursors(DragOperation op) +{ + DWORD result = DROPEFFECT_NONE; + if (op == DragOperationEvery) + return DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE; + if (op & DragOperationCopy) + result |= DROPEFFECT_COPY; + if (op & DragOperationLink) + result |= DROPEFFECT_LINK; + if (op & DragOperationMove) + result |= DROPEFFECT_MOVE; + if (op & DragOperationGeneric) + result |= DROPEFFECT_MOVE; + return result; +} + WebDragClient::WebDragClient(WebView* webView) : m_webView(webView) { @@ -154,8 +171,7 @@ void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, c } } - //FIXME: Ensure correct drag ops are available <rdar://problem/5015957> - DWORD okEffect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE; + DWORD okEffect = draggingSourceOperationMaskToDragCursors(m_webView->page()->dragController()->sourceDragOperation()); DWORD effect; COMPtr<IWebUIDelegate> ui; if (SUCCEEDED(m_webView->uiDelegate(&ui))) { diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.cpp b/WebKit/win/WebCoreSupport/WebEditorClient.cpp index e626178..c9118e5 100644 --- a/WebKit/win/WebCoreSupport/WebEditorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebEditorClient.cpp @@ -29,6 +29,8 @@ #include "WebKit.h" #include "WebLocalizableStrings.h" +#include "WebNotification.h" +#include "WebNotificationCenter.h" #include "WebView.h" #include "DOMCoreClasses.h" #pragma warning(push, 0) @@ -209,6 +211,10 @@ void WebEditorClient::respondToChangedContents() void WebEditorClient::respondToChangedSelection() { m_webView->selectionChanged(); + + static BSTR webViewDidChangeSelectionNotificationName = SysAllocString(WebViewDidChangeSelectionNotification); + IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal(); + notifyCenter->postNotificationName(webViewDidChangeSelectionNotificationName, static_cast<IWebView*>(m_webView), 0); } void WebEditorClient::didEndEditing() diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp index 0fea348..1281420 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp @@ -44,6 +44,7 @@ #include "WebHistoryItem.h" #include "WebMutableURLRequest.h" #include "WebNotificationCenter.h" +#include "WebSecurityOrigin.h" #include "WebURLAuthenticationChallenge.h" #include "WebURLResponse.h" #include "WebView.h" @@ -529,6 +530,36 @@ bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const return true; } +void WebFrameLoaderClient::didDisplayInsecureContent() +{ + WebView* webView = m_webFrame->webView(); + COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv; + if (FAILED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) || !frameLoadDelegatePriv) + return; + + COMPtr<IWebFrameLoadDelegatePrivate2> frameLoadDelegatePriv2(Query, frameLoadDelegatePriv); + if (!frameLoadDelegatePriv2) + return; + + frameLoadDelegatePriv2->didDisplayInsecureContent(webView); +} + +void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin* origin) +{ + COMPtr<IWebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createInstance(origin); + + WebView* webView = m_webFrame->webView(); + COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv; + if (FAILED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) || !frameLoadDelegatePriv) + return; + + COMPtr<IWebFrameLoadDelegatePrivate2> frameLoadDelegatePriv2(Query, frameLoadDelegatePriv); + if (!frameLoadDelegatePriv2) + return; + + frameLoadDelegatePriv2->didRunInsecureContent(webView, webSecurityOrigin.get()); +} + PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) { RefPtr<WebDocumentLoader> loader = WebDocumentLoader::create(request, substituteData); @@ -764,3 +795,24 @@ bool WebFrameLoaderClient::shouldUsePluginDocument(const String& mimeType) const return webView->shouldUseEmbeddedView(mimeType); } + +bool WebFrameLoaderClient::shouldLoadMediaElementURL(const KURL& url) const +{ + WebView* webView = m_webFrame->webView(); + if (!webView) + return true; + + COMPtr<IWebPolicyDelegate> policyDelegate; + if (FAILED(webView->policyDelegate(&policyDelegate)) || !policyDelegate) + return true; + + COMPtr<IWebPolicyDelegatePrivate> policyDelegatePrivate(Query, policyDelegate); + if (!policyDelegatePrivate) + return true; + + BOOL retval; + if (FAILED(policyDelegatePrivate->shouldLoadMediaURL(webView, BString(url), m_webFrame, &retval))) + return true; + + return retval; +} diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h index ef7e982..a215cf9 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h @@ -92,6 +92,9 @@ public: virtual void updateGlobalHistoryRedirectLinks(); virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual void didDisplayInsecureContent(); + virtual void didRunInsecureContent(WebCore::SecurityOrigin*); + virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); virtual void setTitle(const WebCore::String& title, const WebCore::KURL&); @@ -109,6 +112,7 @@ public: virtual bool shouldUsePluginDocument(const WebCore::String& mimeType) const; virtual void dispatchDidFailToStartPlugin(const WebCore::PluginView*) const; + virtual bool shouldLoadMediaElementURL(const WebCore::KURL&) const; protected: WebFrameLoaderClient(WebFrame*); diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp index ba724b4..75a76f2 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp @@ -99,13 +99,11 @@ void WebInspectorClient::inspectorDestroyed() Page* WebInspectorClient::createPage() { - if (m_webView) - return core(m_webView.get()); - - ASSERT(!m_hwnd); - registerWindowClass(); + if (m_hwnd) + ::DestroyWindow(m_hwnd); + m_hwnd = ::CreateWindowEx(0, kWebInspectorWindowClassName, 0, WS_OVERLAPPEDWINDOW, defaultWindowRect().x(), defaultWindowRect().y(), defaultWindowRect().width(), defaultWindowRect().height(), 0, 0, 0, 0); @@ -351,8 +349,9 @@ void WebInspectorClient::showWindowWithoutNotifications() ASSERT(m_webView); ASSERT(m_inspectedWebViewHwnd); + // If no preference is set - default to an attached window. This is important for inspector LayoutTests. InspectorController::Setting shouldAttach = m_inspectedWebView->page()->inspectorController()->setting(inspectorStartsAttachedName); - m_shouldAttachWhenShown = shouldAttach.type() == InspectorController::Setting::BooleanType ? shouldAttach.booleanValue() : false; + m_shouldAttachWhenShown = shouldAttach.type() == InspectorController::Setting::BooleanType ? shouldAttach.booleanValue() : true; if (!m_shouldAttachWhenShown) { // Put the Inspector's WebView inside our window and show it. diff --git a/WebKit/win/WebCoreSupport/WebInspectorDelegate.h b/WebKit/win/WebCoreSupport/WebInspectorDelegate.h index 85f14b2..7561d5a 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorDelegate.h +++ b/WebKit/win/WebCoreSupport/WebInspectorDelegate.h @@ -324,6 +324,9 @@ public: /* [in] */ HDC hDC,
/* [in] */ RECT rect) { return E_NOTIMPL; }
+ virtual HRESULT STDMETHODCALLTYPE desktopNotificationsDelegate(
+ /* [retval][out] */ IWebDesktopNotificationsDelegate **result) { return E_NOTIMPL; }
+
private:
WebInspectorDelegate();
diff --git a/WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp b/WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp new file mode 100644 index 0000000..aef313b --- /dev/null +++ b/WebKit/win/WebCoreSupport/WebPluginHalterClient.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 "WebPluginHalterClient.h" + +#include "DOMCoreClasses.h" +#include "WebView.h" +#include <WebCore/Node.h> +#include <wtf/Assertions.h> + +using WebCore::Node; + +WebPluginHalterClient::WebPluginHalterClient(WebView* webView) + : m_webView(webView) +{ + ASSERT_ARG(webView, webView); +} + +bool WebPluginHalterClient::shouldHaltPlugin(WebCore::Node* n) const +{ + ASSERT_ARG(n, n); + + IWebPluginHalterDelegate* d; + if (FAILED(m_webView->pluginHalterDelegate(&d)) || !d) + return false; + + COMPtr<IDOMNode> domNode(AdoptCOM, DOMNode::createInstance(n)); + + BOOL shouldHalt; + if (FAILED(d->shouldHaltPlugin(m_webView, domNode.get(), &shouldHalt))) + return false; + + return shouldHalt; +} diff --git a/WebKit/win/WebCoreSupport/WebPluginHalterClient.h b/WebKit/win/WebCoreSupport/WebPluginHalterClient.h new file mode 100644 index 0000000..1752444 --- /dev/null +++ b/WebKit/win/WebCoreSupport/WebPluginHalterClient.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 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. ``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 + * 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 WebPluginHalterClient_h +#define WebPluginHalterClient_h + +#include <WebCore/PluginHalterClient.h> + +namespace WebCore { + class Node; +} + +class WebView; + +class WebPluginHalterClient : public WebCore::PluginHalterClient { +public: + WebPluginHalterClient(WebView* webView); + + virtual bool shouldHaltPlugin(WebCore::Node* n) const; + +private: + WebView* m_webView; +}; + +#endif // WebPluginHalterClient_h diff --git a/WebKit/win/WebDatabaseManager.cpp b/WebKit/win/WebDatabaseManager.cpp index 969bde7..a531997 100644 --- a/WebKit/win/WebDatabaseManager.cpp +++ b/WebKit/win/WebDatabaseManager.cpp @@ -286,7 +286,7 @@ HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteAllDatabases() return S_OK; } - + HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteOrigin( /* [in] */ IWebSecurityOrigin* origin) { @@ -336,6 +336,21 @@ void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin) notifyCenter->postNotificationName(databaseDidModifyOriginName, securityOrigin.get(), 0); } +HRESULT STDMETHODCALLTYPE WebDatabaseManager::setQuota( + /* [in] */ BSTR origin, + /* [in] */ unsigned long long quota) +{ + if (!origin) + return E_POINTER; + + if (this != s_sharedWebDatabaseManager) + return E_FAIL; + + DatabaseTracker::tracker().setQuota(SecurityOrigin::createFromString(origin).get(), quota); + + return S_OK; +} + void WebDatabaseManager::dispatchDidModifyDatabase(SecurityOrigin* origin, const String& databaseName) { static BSTR databaseDidModifyOriginName = SysAllocString(WebDatabaseDidModifyDatabaseNotification); diff --git a/WebKit/win/WebDatabaseManager.h b/WebKit/win/WebDatabaseManager.h index f7084ba..c932986 100644 --- a/WebKit/win/WebDatabaseManager.h +++ b/WebKit/win/WebDatabaseManager.h @@ -73,6 +73,10 @@ public: /* [in] */ BSTR databaseName, /* [in] */ IWebSecurityOrigin* origin); + virtual HRESULT STDMETHODCALLTYPE setQuota( + /* [in] */ BSTR origin, + /* [in] */ unsigned long long quota); + // DatabaseTrackerClient virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*); virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const WebCore::String& databaseName); diff --git a/WebKit/win/WebDownloadCFNet.cpp b/WebKit/win/WebDownloadCFNet.cpp index 0df738e..144a6a5 100644 --- a/WebKit/win/WebDownloadCFNet.cpp +++ b/WebKit/win/WebDownloadCFNet.cpp @@ -47,6 +47,7 @@ #pragma warning(push, 0) #include <WebCore/AuthenticationCF.h> #include <WebCore/BString.h> +#include <WebCore/CredentialStorage.h> #include <WebCore/ResourceError.h> #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceRequest.h> @@ -193,7 +194,7 @@ HRESULT STDMETHODCALLTYPE WebDownload::initToResumeWithBundle( // Attempt to remove the ".download" extension from the bundle for the final file destination // Failing that, we clear m_destination and will ask the delegate later once the download starts if (m_bundlePath.endsWith(bundleExtension(), false)) { - m_destination = m_bundlePath.copy(); + m_destination = m_bundlePath.threadsafeCopy(); m_destination.truncate(m_destination.length() - bundleExtension().length()); } else m_destination = String(); @@ -381,9 +382,10 @@ void WebDownload::didReceiveAuthenticationChallenge(CFURLAuthChallengeRef challe { // Try previously stored credential first. if (!CFURLAuthChallengeGetPreviousFailureCount(challenge)) { - CFURLCredentialRef credential = WebCoreCredentialStorage::get(CFURLAuthChallengeGetProtectionSpace(challenge)); - if (credential) { - CFURLDownloadUseCredential(m_download.get(), credential, challenge); + Credential credential = CredentialStorage::get(core(CFURLAuthChallengeGetProtectionSpace(challenge))); + if (!credential.isEmpty()) { + RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(credential)); + CFURLDownloadUseCredential(m_download.get(), cfCredential.get(), challenge); return; } } diff --git a/WebKit/win/WebError.cpp b/WebKit/win/WebError.cpp index 8514fd6..c9f1dff 100644 --- a/WebKit/win/WebError.cpp +++ b/WebKit/win/WebError.cpp @@ -137,7 +137,7 @@ HRESULT STDMETHODCALLTYPE WebError::localizedDescription( *result = BString(m_error.localizedDescription()).release(); -#if PLATFORM(CFNETWORK) +#if USE(CFNETWORK) if (!*result) { if (int code = m_error.errorCode()) *result = BString(wkCFNetworkErrorGetLocalizedDescription(code)).release(); diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp index e50a830..6bdf51e 100644 --- a/WebKit/win/WebFrame.cpp +++ b/WebKit/win/WebFrame.cpp @@ -94,6 +94,7 @@ #include <WebCore/TextIterator.h> #include <WebCore/JSDOMBinding.h> #include <WebCore/ScriptController.h> +#include <WebCore/SecurityOrigin.h> #include <JavaScriptCore/APICast.h> #include <wtf/MathExtras.h> #pragma warning(pop) @@ -304,6 +305,16 @@ HRESULT STDMETHODCALLTYPE WebFrame::setExcludeFromTextSearch( return E_FAIL; } +HRESULT WebFrame::reloadFromOrigin() +{ + Frame* coreFrame = core(this); + if (!coreFrame) + return E_FAIL; + + coreFrame->loader()->reload(true); + return S_OK; +} + HRESULT STDMETHODCALLTYPE WebFrame::paintDocumentRectToContext( /* [in] */ RECT rect, /* [in] */ OLE_HANDLE deviceContext) @@ -1138,6 +1149,21 @@ HRESULT WebFrame::isDisplayingStandaloneImage(BOOL* result) return S_OK; } +HRESULT WebFrame::allowsFollowingLink(BSTR url, BOOL* result) +{ + if (!result) + return E_POINTER; + + *result = TRUE; + + Frame* frame = core(this); + if (!frame) + return E_FAIL; + + *result = SecurityOrigin::canLoad(MarshallingHelpers::BSTRToKURL(url), String(), frame->document()); + return S_OK; +} + HRESULT WebFrame::controlsInForm(IDOMElement* form, IDOMElement** controls, int* cControls) { if (!form) @@ -1315,7 +1341,7 @@ void WebFrame::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<F COMPtr<IWebFormDelegate> formDelegate; if (FAILED(d->webView->formDelegate(&formDelegate))) { - (coreFrame->loader()->*function)(PolicyUse); + (coreFrame->loader()->policyChecker()->*function)(PolicyUse); return; } @@ -1334,7 +1360,7 @@ void WebFrame::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<F return; // FIXME: Add a sane default implementation - (coreFrame->loader()->*function)(PolicyUse); + (coreFrame->loader()->policyChecker()->*function)(PolicyUse); } void WebFrame::revertToProvisionalState(DocumentLoader*) @@ -1500,7 +1526,7 @@ void WebFrame::receivedPolicyDecision(PolicyAction action) Frame* coreFrame = core(this); ASSERT(coreFrame); - (coreFrame->loader()->*function)(action); + (coreFrame->loader()->policyChecker()->*function)(action); } void WebFrame::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& mimeType, const ResourceRequest& request) @@ -1517,7 +1543,7 @@ void WebFrame::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, con if (SUCCEEDED(policyDelegate->decidePolicyForMIMEType(d->webView, BString(mimeType), urlRequest.get(), this, setUpPolicyListener(function).get()))) return; - (coreFrame->loader()->*function)(PolicyUse); + (coreFrame->loader()->policyChecker()->*function)(PolicyUse); } void WebFrame::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState> formState, const String& frameName) @@ -1535,7 +1561,7 @@ void WebFrame::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction functi if (SUCCEEDED(policyDelegate->decidePolicyForNewWindowAction(d->webView, actionInformation.get(), urlRequest.get(), BString(frameName), setUpPolicyListener(function).get()))) return; - (coreFrame->loader()->*function)(PolicyUse); + (coreFrame->loader()->policyChecker()->*function)(PolicyUse); } void WebFrame::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState> formState) @@ -1553,7 +1579,7 @@ void WebFrame::dispatchDecidePolicyForNavigationAction(FramePolicyFunction funct if (SUCCEEDED(policyDelegate->decidePolicyForNavigationAction(d->webView, actionInformation.get(), urlRequest.get(), this, setUpPolicyListener(function).get()))) return; - (coreFrame->loader()->*function)(PolicyUse); + (coreFrame->loader()->policyChecker()->*function)(PolicyUse); } void WebFrame::dispatchUnableToImplementPolicy(const ResourceError& error) diff --git a/WebKit/win/WebFrame.h b/WebKit/win/WebFrame.h index 7af72d4..8edc81a 100644 --- a/WebKit/win/WebFrame.h +++ b/WebKit/win/WebFrame.h @@ -224,6 +224,8 @@ public: virtual HRESULT STDMETHODCALLTYPE setExcludeFromTextSearch( /* [in] */ BOOL flag); + virtual HRESULT STDMETHODCALLTYPE reloadFromOrigin(); + virtual HRESULT STDMETHODCALLTYPE paintDocumentRectToContext( /* [in] */ RECT rect, /* [in] */ OLE_HANDLE deviceContext); @@ -238,6 +240,10 @@ public: virtual HRESULT STDMETHODCALLTYPE isDisplayingStandaloneImage(BOOL*); + virtual HRESULT STDMETHODCALLTYPE allowsFollowingLink( + /* [in] */ BSTR url, + /* [retval][out] */ BOOL* result); + // IWebDocumentText virtual HRESULT STDMETHODCALLTYPE supportsTextEncoding( /* [retval][out] */ BOOL* result); diff --git a/WebKit/win/WebHistory.cpp b/WebKit/win/WebHistory.cpp index 095a74b..854031a 100644 --- a/WebKit/win/WebHistory.cpp +++ b/WebKit/win/WebHistory.cpp @@ -855,18 +855,33 @@ HRESULT WebHistory::removeItemFromDateCaches(IWebHistoryItem* entry) return hr; } -WebHistory::DateKey timeIntervalForBeginningOfDay(CFAbsoluteTime day) +static void getDayBoundaries(CFAbsoluteTime day, CFAbsoluteTime& beginningOfDay, CFAbsoluteTime& beginningOfNextDay) { RetainPtr<CFTimeZoneRef> timeZone(AdoptCF, CFTimeZoneCopyDefault()); CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(day, timeZone.get()); date.hour = 0; date.minute = 0; date.second = 0; - CFAbsoluteTime result = CFGregorianDateGetAbsoluteTime(date, timeZone.get()); + beginningOfDay = CFGregorianDateGetAbsoluteTime(date, timeZone.get()); + date.day += 1; + beginningOfNextDay = CFGregorianDateGetAbsoluteTime(date, timeZone.get()); +} - // Converting from double to int64_t is safe here as NSDate's useful range - // is -2**48 .. 2**47 which will safely fit in an int64_t. - return static_cast<WebHistory::DateKey>(result); +static inline CFAbsoluteTime beginningOfDay(CFAbsoluteTime date) +{ + static CFAbsoluteTime cachedBeginningOfDay = numeric_limits<CFAbsoluteTime>::quiet_NaN(); + static CFAbsoluteTime cachedBeginningOfNextDay; + if (!(date >= cachedBeginningOfDay && date < cachedBeginningOfNextDay)) + getDayBoundaries(date, cachedBeginningOfDay, cachedBeginningOfNextDay); + return cachedBeginningOfDay; +} + +static inline WebHistory::DateKey dateKey(CFAbsoluteTime date) +{ + // Converting from double (CFAbsoluteTime) to int64_t (WebHistoryDateKey) is + // safe here because all sensible dates are in the range -2**48 .. 2**47 which + // safely fits in an int64_t. + return beginningOfDay(date); } // Returns whether the day is already in the list of days, @@ -875,7 +890,7 @@ bool WebHistory::findKey(DateKey* key, CFAbsoluteTime forDay) { ASSERT_ARG(key, key); - *key = timeIntervalForBeginningOfDay(forDay); + *key = dateKey(forDay); return m_entriesByDate.contains(*key); } diff --git a/WebKit/win/WebIconDatabase.cpp b/WebKit/win/WebIconDatabase.cpp index 8aab6af..315db9e 100644 --- a/WebKit/win/WebIconDatabase.cpp +++ b/WebKit/win/WebIconDatabase.cpp @@ -311,7 +311,7 @@ void WebIconDatabase::dispatchDidRemoveAllIcons() void WebIconDatabase::dispatchDidAddIconForPageURL(const String& pageURL) { MutexLocker locker(m_notificationMutex); - m_notificationQueue.append(pageURL.copy()); + m_notificationQueue.append(pageURL.threadsafeCopy()); scheduleNotificationDelivery(); } diff --git a/WebKit/win/WebInspector.cpp b/WebKit/win/WebInspector.cpp index 1ddbdd8..97587f9 100644 --- a/WebKit/win/WebInspector.cpp +++ b/WebKit/win/WebInspector.cpp @@ -72,6 +72,8 @@ HRESULT STDMETHODCALLTYPE WebInspector::QueryInterface(REFIID riid, void** ppvOb *ppvObject = 0; if (IsEqualGUID(riid, IID_IWebInspector)) *ppvObject = static_cast<IWebInspector*>(this); + else if (IsEqualGUID(riid, IID_IWebInspectorPrivate)) + *ppvObject = static_cast<IWebInspectorPrivate*>(this); else if (IsEqualGUID(riid, IID_IUnknown)) *ppvObject = static_cast<IWebInspector*>(this); else @@ -256,3 +258,17 @@ HRESULT STDMETHODCALLTYPE WebInspector::setJavaScriptProfilingEnabled(BOOL enabl return S_OK; } + +HRESULT STDMETHODCALLTYPE WebInspector::evaluateInFrontend(ULONG callId, BSTR bScript) +{ + if (!m_webView) + return S_OK; + + Page* page = m_webView->page(); + if (!page) + return S_OK; + + String script(bScript, SysStringLen(bScript)); + page->inspectorController()->evaluateForTestInFrontend(callId, script); + return S_OK; +} diff --git a/WebKit/win/WebInspector.h b/WebKit/win/WebInspector.h index 5303a61..4f9bedb 100644 --- a/WebKit/win/WebInspector.h +++ b/WebKit/win/WebInspector.h @@ -34,7 +34,7 @@ class WebView; -class WebInspector : public IWebInspector, public Noncopyable { +class WebInspector : public IWebInspector, public IWebInspectorPrivate, public Noncopyable { public: static WebInspector* createInstance(WebView*); @@ -59,6 +59,8 @@ public: virtual HRESULT STDMETHODCALLTYPE isJavaScriptProfilingEnabled(BOOL* isProfilingEnabled); virtual HRESULT STDMETHODCALLTYPE setJavaScriptProfilingEnabled(BOOL); + + virtual HRESULT STDMETHODCALLTYPE evaluateInFrontend(ULONG callId, BSTR script); private: WebInspector(WebView*); diff --git a/WebKit/win/WebKit.vcproj/Interfaces.vcproj b/WebKit/win/WebKit.vcproj/Interfaces.vcproj index fe2a470..cbc8231 100644 --- a/WebKit/win/WebKit.vcproj/Interfaces.vcproj +++ b/WebKit/win/WebKit.vcproj/Interfaces.vcproj @@ -24,7 +24,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\obj\WebKit\$(ProjectName)"
bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\obj\WebKit\$(ProjectName)"
bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
/>
<Tool
Name="VCCustomBuildTool"
@@ -79,7 +79,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

perl FixMIDLHeaders.pl "$(WebkitOutputDir)/include/webkit/"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

perl FixMIDLHeaders.pl "$(WebkitOutputDir)/include/webkit/"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
<Configuration
@@ -92,7 +92,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\obj\WebKit\$(ProjectName)"
bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

mkdir 2>NUL "$(WebKitOutputDir)\obj\WebKit\$(ProjectName)"
bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
/>
<Tool
Name="VCCustomBuildTool"
@@ -144,7 +144,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

perl FixMIDLHeaders.pl "$(WebkitOutputDir)/include/webkit/"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

perl FixMIDLHeaders.pl "$(WebkitOutputDir)/include/webkit/"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
</Configurations>
@@ -492,6 +492,18 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\Interfaces\IWebDesktopNotificationsDelegate.idl"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\Interfaces\IWebDocument.idl"
>
<FileConfiguration
@@ -692,6 +704,26 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\Interfaces\IWebFrameLoadDelegatePrivate2.idl"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\Interfaces\IWebFramePrivate.idl"
>
<FileConfiguration
@@ -912,6 +944,26 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\Interfaces\IWebInspectorPrivate.idl"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\Interfaces\IWebJavaScriptCollector.idl"
>
<FileConfiguration
@@ -1052,6 +1104,26 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\Interfaces\IWebPluginHalterDelegate.idl"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\Interfaces\IWebPolicyDelegate.idl"
>
<FileConfiguration
@@ -1072,6 +1144,26 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\Interfaces\IWebPolicyDelegatePrivate.idl"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\Interfaces\IWebPreferences.idl"
>
<FileConfiguration
@@ -1472,6 +1564,26 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\Interfaces\IWebWorkersPrivate.idl"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCMIDLTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\Interfaces\WebKit.idl"
>
<FileConfiguration
diff --git a/WebKit/win/WebKit.vcproj/InterfacesGenerated.vcproj b/WebKit/win/WebKit.vcproj/InterfacesGenerated.vcproj index 3eb83df..f6cc1d4 100644 --- a/WebKit/win/WebKit.vcproj/InterfacesGenerated.vcproj +++ b/WebKit/win/WebKit.vcproj/InterfacesGenerated.vcproj @@ -1,48 +1,48 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="InterfacesGenerated" - ProjectGUID="{62C897BE-E207-4BC4-B37D-6F9F9116F166}" - Keyword="MakeFileProj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Release|Win32" - OutputDirectory="$(WebKitOutputDir)\lib" - IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)" - ConfigurationType="0" - > - <Tool - Name="VCNMakeTool" - BuildCommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash build-generated-files.sh "$(WebKitOutputDir)"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" - ReBuildCommandLine="echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

del /s /q "$(WebKitOutputDir)\obj\WebKit\DerivedSources"
set PATH=%SystemDrive%\cygwin\bin;%PATH%
bash build-generated-files.sh "$(WebKitOutputDir)"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" - CleanCommandLine="del /s /q "$(WebKitOutputDir)\obj\WebKit\DerivedSources"
if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" - Output="" - PreprocessorDefinitions="" - IncludeSearchPath="" - ForcedIncludes="" - AssemblySearchPath="" - ForcedUsingAssemblies="" - CompileAsManaged="" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <File - RelativePath=".\build-generated-files.sh" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="InterfacesGenerated"
+ ProjectGUID="{62C897BE-E207-4BC4-B37D-6F9F9116F166}"
+ Keyword="MakeFileProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash build-generated-files.sh "$(WebKitOutputDir)"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ ReBuildCommandLine="echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

del /s /q "$(WebKitOutputDir)\obj\WebKit\DerivedSources"
%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
bash build-generated-files.sh "$(WebKitOutputDir)"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CleanCommandLine="del /s /q "$(WebKitOutputDir)\obj\WebKit\DerivedSources"
if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ Output=""
+ PreprocessorDefinitions=""
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\build-generated-files.sh"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/WebKit/win/WebKit.vcproj/WebKit.rc b/WebKit/win/WebKit.vcproj/WebKit.rc index 1c4e4f5..a7cbfd3 100644 --- a/WebKit/win/WebKit.vcproj/WebKit.rc +++ b/WebKit/win/WebKit.vcproj/WebKit.rc @@ -22,8 +22,8 @@ IDR_WEBKIT TYPELIB "WebKit.tlb" // VS_VERSION_INFO VERSIONINFO - FILEVERSION __VERSION_MAJOR__,__BUILD_NUMBER_MAJOR__,__BUILD_NUMBER_MINOR__,__BUILD_NUMBER_VARIANT__ - PRODUCTVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,0 + FILEVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,__VERSION_BUILD__ + PRODUCTVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,__VERSION_BUILD__ FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -44,7 +44,7 @@ BEGIN VALUE "InternalName", "WebKit" VALUE "LegalCopyright", "Copyright Apple Inc. 2003-2009" VALUE "OriginalFilename", "WebKit.dll" - VALUE "ProductName", " WebKit" + VALUE "ProductName", "WebKit" VALUE "ProductVersion", __BUILD_NUMBER_SHORT__ END END diff --git a/WebKit/win/WebKit.vcproj/WebKit.sln b/WebKit/win/WebKit.vcproj/WebKit.sln index 3babb13..79dff87 100644 --- a/WebKit/win/WebKit.vcproj/WebKit.sln +++ b/WebKit/win/WebKit.vcproj/WebKit.sln @@ -144,8 +144,8 @@ Global {6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release_Cairo|Win32.Build.0 = Release_Cairo|Win32
{6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release|Win32.ActiveCfg = Release|Win32
{6567DFD4-D6DE-4CD5-825D-17E353D160E1}.Release|Win32.Build.0 = Release|Win32
- {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_Cairo|Win32.ActiveCfg = Debug|Win32
- {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_Cairo|Win32.Build.0 = Debug|Win32
+ {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_Cairo|Win32.ActiveCfg = Debug_Cairo|Win32
+ {C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_Cairo|Win32.Build.0 = Debug_Cairo|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
{C0737398-3565-439E-A2B8-AB2BE4D5430C}.Debug|Win32.ActiveCfg = Debug|Win32
@@ -164,8 +164,8 @@ Global {011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release_Cairo|Win32.Build.0 = Release_CFLite|Win32
{011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release|Win32.ActiveCfg = Release|Win32
{011D10F1-B656-4A1B-A0C3-3842F02122C5}.Release|Win32.Build.0 = Release|Win32
- {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_Cairo|Win32.ActiveCfg = Debug|Win32
- {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_Cairo|Win32.Build.0 = Debug|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_Cairo|Win32.ActiveCfg = Debug_CFLite|Win32
+ {C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_Cairo|Win32.Build.0 = Debug_CFLite|Win32
{C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
{C59E5129-B453-49B7-A52B-1E104715F76E}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
{C59E5129-B453-49B7-A52B-1E104715F76E}.Debug|Win32.ActiveCfg = Debug|Win32
@@ -242,8 +242,8 @@ Global {E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Release_Cairo|Win32.ActiveCfg = Release|Win32
{E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Release|Win32.ActiveCfg = Release|Win32
{E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Release|Win32.Build.0 = Release|Win32
- {114FCA11-216B-4C8C-957E-30A75AE80443}.Debug_Cairo|Win32.ActiveCfg = Debug|Win32
- {114FCA11-216B-4C8C-957E-30A75AE80443}.Debug_Cairo|Win32.Build.0 = Debug|Win32
+ {114FCA11-216B-4C8C-957E-30A75AE80443}.Debug_Cairo|Win32.ActiveCfg = Debug_Cairo|Win32
+ {114FCA11-216B-4C8C-957E-30A75AE80443}.Debug_Cairo|Win32.Build.0 = Debug_Cairo|Win32
{114FCA11-216B-4C8C-957E-30A75AE80443}.Debug_Internal|Win32.ActiveCfg = Debug|Win32
{114FCA11-216B-4C8C-957E-30A75AE80443}.Debug_Internal|Win32.Build.0 = Debug|Win32
{114FCA11-216B-4C8C-957E-30A75AE80443}.Debug|Win32.ActiveCfg = Debug|Win32
@@ -252,14 +252,14 @@ Global {114FCA11-216B-4C8C-957E-30A75AE80443}.Release_Cairo|Win32.Build.0 = Release|Win32
{114FCA11-216B-4C8C-957E-30A75AE80443}.Release|Win32.ActiveCfg = Release|Win32
{114FCA11-216B-4C8C-957E-30A75AE80443}.Release|Win32.Build.0 = Release|Win32
- {1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Debug_Cairo|Win32.ActiveCfg = Debug|Win32
- {1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Debug_Cairo|Win32.Build.0 = Debug|Win32
+ {1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Debug_Cairo|Win32.ActiveCfg = Debug_CFLite|Win32
+ {1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Debug_Cairo|Win32.Build.0 = Debug_CFLite|Win32
{1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
{1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
{1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Debug|Win32.ActiveCfg = Debug|Win32
{1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Debug|Win32.Build.0 = Debug|Win32
- {1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Release_Cairo|Win32.ActiveCfg = Release|Win32
- {1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Release_Cairo|Win32.Build.0 = Release|Win32
+ {1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Release_Cairo|Win32.ActiveCfg = Release_CFLite|Win32
+ {1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Release_Cairo|Win32.Build.0 = Release_CFLite|Win32
{1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Release|Win32.ActiveCfg = Release|Win32
{1AFD081F-1AC7-4A97-8EFA-6DF97761A3A2}.Release|Win32.Build.0 = Release|Win32
{44B9C152-1870-4035-B94D-7B3285AA0C12}.Debug_Cairo|Win32.ActiveCfg = Release|Win32
diff --git a/WebKit/win/WebKit.vcproj/WebKit.vcproj b/WebKit/win/WebKit.vcproj/WebKit.vcproj index 9a70440..021dc94 100644 --- a/WebKit/win/WebKit.vcproj/WebKit.vcproj +++ b/WebKit/win/WebKit.vcproj/WebKit.vcproj @@ -23,7 +23,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore"
xcopy /y /d "$(WebKitLibrariesDir)\include\JavaScriptCore\*" "$(WebKitOutputDir)\include\JavaScriptCore"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore"
xcopy /y /d "$(WebKitLibrariesDir)\include\JavaScriptCore\*" "$(WebKitOutputDir)\include\JavaScriptCore"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
/>
<Tool
Name="VCCustomBuildTool"
@@ -40,11 +40,11 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
- ForcedIncludeFiles="WebKitPrefix.h"
DisableSpecificWarnings="4819"
+ ForcedIncludeFiles="WebKitPrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -59,7 +59,7 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitDLLConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitDLLConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib comsuppw.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
AdditionalLibraryDirectories=""
ModuleDefinitionFile="WebKit$(WebKitDLLConfigSuffix).def"
@@ -88,7 +88,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(ProjectDir)\..\WebLocalizableStrings.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitGraphics.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitCOMAPI.h" "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npfunctions.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npapi.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime_internal.h" "$(WebKitOutputDir)\include\WebKit"

mkdir 2>NUL "$(OutDir)\WebKit.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"
mkdir 2>NUL "$(OutDir)\WebKit.resources\en.lproj"
xcopy /y /d "$(ProjectDir)..\..\English.lproj\Localizable.strings" "$(OutDir)\WebKit.resources\en.lproj\"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(ProjectDir)\..\WebLocalizableStrings.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitGraphics.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitCOMAPI.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebPreferenceKeysPrivate.h" "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npfunctions.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npapi.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime_internal.h" "$(WebKitOutputDir)\include\WebKit"

mkdir 2>NUL "$(OutDir)\WebKit.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"
mkdir 2>NUL "$(OutDir)\WebKit.resources\en.lproj"
xcopy /y /d "$(ProjectDir)..\..\English.lproj\Localizable.strings" "$(OutDir)\WebKit.resources\en.lproj\"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
<Configuration
@@ -100,7 +100,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore"
xcopy /y /d "$(WebKitLibrariesDir)\include\JavaScriptCore\*" "$(WebKitOutputDir)\include\JavaScriptCore"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore"
xcopy /y /d "$(WebKitLibrariesDir)\include\JavaScriptCore\*" "$(WebKitOutputDir)\include\JavaScriptCore"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
/>
<Tool
Name="VCCustomBuildTool"
@@ -117,11 +117,11 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
- ForcedIncludeFiles="WebKitPrefix.h"
DisableSpecificWarnings="4819"
+ ForcedIncludeFiles="WebKitPrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -136,7 +136,7 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitDLLConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitDLLConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib comsuppw.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
AdditionalLibraryDirectories=""
ModuleDefinitionFile="WebKit$(WebKitDLLConfigSuffix).def"
@@ -165,7 +165,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(ProjectDir)\..\WebLocalizableStrings.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitGraphics.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitCOMAPI.h" "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npfunctions.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npapi.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime_internal.h" "$(WebKitOutputDir)\include\WebKit"

mkdir 2>NUL "$(OutDir)\WebKit.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"
mkdir 2>NUL "$(OutDir)\WebKit.resources\en.lproj"
xcopy /y /d "$(ProjectDir)..\..\English.lproj\Localizable.strings" "$(OutDir)\WebKit.resources\en.lproj\"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(ProjectDir)\..\WebLocalizableStrings.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitGraphics.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitCOMAPI.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebPreferenceKeysPrivate.h" "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npfunctions.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npapi.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime_internal.h" "$(WebKitOutputDir)\include\WebKit"

mkdir 2>NUL "$(OutDir)\WebKit.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"
mkdir 2>NUL "$(OutDir)\WebKit.resources\en.lproj"
xcopy /y /d "$(ProjectDir)..\..\English.lproj\Localizable.strings" "$(OutDir)\WebKit.resources\en.lproj\"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
<Configuration
@@ -176,7 +176,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore"
xcopy /y /d "$(WebKitLibrariesDir)\include\JavaScriptCore\*" "$(WebKitOutputDir)\include\JavaScriptCore"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore"
xcopy /y /d "$(WebKitLibrariesDir)\include\JavaScriptCore\*" "$(WebKitOutputDir)\include\JavaScriptCore"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
/>
<Tool
Name="VCCustomBuildTool"
@@ -193,12 +193,12 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
Detect64BitPortabilityProblems="false"
- ForcedIncludeFiles="WebKitPrefix.h"
DisableSpecificWarnings="4819"
+ ForcedIncludeFiles="WebKitPrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -213,7 +213,7 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitDLLConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitDLLConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib comsuppw.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
AdditionalLibraryDirectories=""
ModuleDefinitionFile="WebKit$(WebKitDLLConfigSuffix).def"
@@ -242,7 +242,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(ProjectDir)\..\WebLocalizableStrings.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitGraphics.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitCOMAPI.h" "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npfunctions.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npapi.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime_internal.h" "$(WebKitOutputDir)\include\WebKit"

mkdir 2>NUL "$(OutDir)\WebKit.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"
mkdir 2>NUL "$(OutDir)\WebKit.resources\en.lproj"
xcopy /y /d "$(ProjectDir)..\..\English.lproj\Localizable.strings" "$(OutDir)\WebKit.resources\en.lproj\"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(ProjectDir)\..\WebLocalizableStrings.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitGraphics.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitCOMAPI.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebPreferenceKeysPrivate.h" "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npfunctions.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npapi.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime_internal.h" "$(WebKitOutputDir)\include\WebKit"

mkdir 2>NUL "$(OutDir)\WebKit.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"
mkdir 2>NUL "$(OutDir)\WebKit.resources\en.lproj"
xcopy /y /d "$(ProjectDir)..\..\English.lproj\Localizable.strings" "$(OutDir)\WebKit.resources\en.lproj\"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
<Configuration
@@ -250,12 +250,12 @@ OutputDirectory="$(WebKitOutputDir)\bin"
IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="2"
- InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\WinCairo.vsprops;$(WebKitLibrariesDir)\tools\vsprops\cURL.vsprops"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_wincairo.vsprops;$(WebKitLibrariesDir)\tools\vsprops\WinCairo.vsprops;$(WebKitLibrariesDir)\tools\vsprops\cURL.vsprops"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore"
xcopy /y /d "$(WebKitLibrariesDir)\include\JavaScriptCore\*" "$(WebKitOutputDir)\include\JavaScriptCore"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore"
xcopy /y /d "$(WebKitLibrariesDir)\include\JavaScriptCore\*" "$(WebKitOutputDir)\include\JavaScriptCore"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
/>
<Tool
Name="VCCustomBuildTool"
@@ -272,11 +272,11 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
- ForcedIncludeFiles="WebKitPrefix.h"
DisableSpecificWarnings="4819"
+ ForcedIncludeFiles="WebKitPrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -291,7 +291,7 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CFLite_Debug.lib JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib msimg32.lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CFLite_Debug.lib JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib msimg32.lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib comsuppw.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
AdditionalLibraryDirectories=""
ModuleDefinitionFile="WebKit_Cairo$(WebKitDLLConfigSuffix).def"
@@ -321,7 +321,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(ProjectDir)\..\WebLocalizableStrings.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitGraphics.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitCOMAPI.h" "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npfunctions.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npapi.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime_internal.h" "$(WebKitOutputDir)\include\WebKit"

mkdir 2>NUL "$(OutDir)\WebKit.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"
mkdir 2>NUL "$(OutDir)\WebKit.resources\en.lproj"
xcopy /y /d "$(ProjectDir)..\..\English.lproj\Localizable.strings" "$(OutDir)\WebKit.resources\en.lproj\"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(ProjectDir)\..\WebLocalizableStrings.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitGraphics.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitCOMAPI.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebPreferenceKeysPrivate.h" "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npfunctions.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npapi.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime_internal.h" "$(WebKitOutputDir)\include\WebKit"

mkdir 2>NUL "$(OutDir)\WebKit.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"
mkdir 2>NUL "$(OutDir)\WebKit.resources\en.lproj"
xcopy /y /d "$(ProjectDir)..\..\English.lproj\Localizable.strings" "$(OutDir)\WebKit.resources\en.lproj\"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
<Configuration
@@ -335,7 +335,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore"
xcopy /y /d "$(WebKitLibrariesDir)\include\JavaScriptCore\*" "$(WebKitOutputDir)\include\JavaScriptCore"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore"
xcopy /y /d "$(WebKitLibrariesDir)\include\JavaScriptCore\*" "$(WebKitOutputDir)\include\JavaScriptCore"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
/>
<Tool
Name="VCCustomBuildTool"
@@ -352,11 +352,11 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\private";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\private";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\private\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\private\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SHARED_WORKERS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
- ForcedIncludeFiles="WebKitPrefix.h"
DisableSpecificWarnings="4819"
+ ForcedIncludeFiles="WebKitPrefix.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -371,7 +371,7 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CFLite.lib JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib msimg32.lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CFLite.lib JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib msimg32.lib crypt32.lib iphlpapi.lib winmm.lib rpcrt4.lib comsuppw.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
AdditionalLibraryDirectories=""
ModuleDefinitionFile="WebKit_Cairo$(WebKitDLLConfigSuffix).def"
@@ -400,7 +400,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(ProjectDir)\..\WebLocalizableStrings.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitGraphics.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitCOMAPI.h" "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npfunctions.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npapi.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime_internal.h" "$(WebKitOutputDir)\include\WebKit"

mkdir 2>NUL "$(OutDir)\WebKit.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"
mkdir 2>NUL "$(OutDir)\WebKit.resources\en.lproj"
xcopy /y /d "$(ProjectDir)..\..\English.lproj\Localizable.strings" "$(OutDir)\WebKit.resources\en.lproj\"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(ProjectDir)\..\WebLocalizableStrings.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitGraphics.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebKitCOMAPI.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(ProjectDir)\..\WebPreferenceKeysPrivate.h" "$(WebKitOutputDir)\include\WebKit"

xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npfunctions.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npapi.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime.h" "$(WebKitOutputDir)\include\WebKit"
xcopy /y /d "$(WebKitOutputDir)\include\WebCore\npruntime_internal.h" "$(WebKitOutputDir)\include\WebKit"

mkdir 2>NUL "$(OutDir)\WebKit.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"
mkdir 2>NUL "$(OutDir)\WebKit.resources\en.lproj"
xcopy /y /d "$(ProjectDir)..\..\English.lproj\Localizable.strings" "$(OutDir)\WebKit.resources\en.lproj\"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
</Configurations>
@@ -743,6 +743,10 @@ >
</File>
<File
+ RelativePath="..\WebWorkersPrivate.h"
+ >
+ </File>
+ <File
RelativePath="..\WindowsTouch.h"
>
</File>
@@ -1094,6 +1098,10 @@ RelativePath="..\WebView.cpp"
>
</File>
+ <File
+ RelativePath="..\WebWorkersPrivate.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Resources"
@@ -1470,10 +1478,6 @@ >
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEventListener.cpp"
- >
- </File>
- <File
RelativePath="$(WebKitOutputDir)\obj\WebKit\DerivedSources\GEN_DOMEventListener.h"
>
</File>
@@ -2063,6 +2067,14 @@ >
</File>
<File
+ RelativePath="..\WebCoreSupport\WebDesktopNotificationsDelegate.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebDesktopNotificationsDelegate.h"
+ >
+ </File>
+ <File
RelativePath="..\WebCoreSupport\WebDragClient.cpp"
>
</File>
@@ -2106,6 +2118,14 @@ RelativePath="..\WebCoreSupport\WebInspectorDelegate.h"
>
</File>
+ <File
+ RelativePath="..\WebCoreSupport\WebPluginHalterClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebCoreSupport\WebPluginHalterClient.h"
+ >
+ </File>
</Filter>
<File
RelativePath="..\WebKitPrefix.cpp"
diff --git a/WebKit/win/WebKit.vcproj/WebKitGUID.vcproj b/WebKit/win/WebKit.vcproj/WebKitGUID.vcproj index 8e5af7e..309a021 100644 --- a/WebKit/win/WebKit.vcproj/WebKitGUID.vcproj +++ b/WebKit/win/WebKit.vcproj/WebKitGUID.vcproj @@ -24,7 +24,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
/>
<Tool
Name="VCCustomBuildTool"
@@ -85,7 +85,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
/>
<Tool
Name="VCCustomBuildTool"
@@ -145,7 +145,7 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
"
/>
<Tool
Name="VCCustomBuildTool"
diff --git a/WebKit/win/WebKitClassFactory.cpp b/WebKit/win/WebKitClassFactory.cpp index ab3c406..d1c4b72 100644 --- a/WebKit/win/WebKitClassFactory.cpp +++ b/WebKit/win/WebKitClassFactory.cpp @@ -52,6 +52,7 @@ #include "WebURLProtectionSpace.h" #include "WebURLResponse.h" #include "WebView.h" +#include "WebWorkersPrivate.h" #pragma warning(push, 0) #include <JavaScriptCore/InitializeThreading.h> #include <WebCore/FontDatabase.h> diff --git a/WebKit/win/WebMutableURLRequest.cpp b/WebKit/win/WebMutableURLRequest.cpp index e529993..69555c8 100644 --- a/WebKit/win/WebMutableURLRequest.cpp +++ b/WebKit/win/WebMutableURLRequest.cpp @@ -308,7 +308,7 @@ HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setHTTPMethod( HRESULT STDMETHODCALLTYPE WebMutableURLRequest::setHTTPShouldHandleCookies( /* [in] */ BOOL handleCookies) { - m_request.setAllowHTTPCookies(handleCookies); + m_request.setAllowCookies(handleCookies); return S_OK; } diff --git a/WebKit/win/WebPreferenceKeysPrivate.h b/WebKit/win/WebPreferenceKeysPrivate.h index d9bb5c3..e0c2b6f 100644 --- a/WebKit/win/WebPreferenceKeysPrivate.h +++ b/WebKit/win/WebPreferenceKeysPrivate.h @@ -53,6 +53,8 @@ #define WebKitPluginsEnabledPreferenceKey "WebKitPluginsEnabled" #define WebKitDatabasesEnabledPreferenceKey "WebKitDatabasesEnabled" #define WebKitLocalStorageEnabledPreferenceKey "WebKitLocalStorageEnabled" +#define WebKitExperimentalNotificationsEnabledPreferenceKey "WebKitExperimentalNotificationsEnabled" +#define WebKitExperimentalWebSocketsEnabledPreferenceKey "WebKitExperimentalWebSocketsEnabled" #define WebKitAllowAnimatedImagesPreferenceKey "WebKitAllowAnimatedImagesPreferenceKey" #define WebKitAllowAnimatedImageLoopingPreferenceKey "WebKitAllowAnimatedImageLoopingPreferenceKey" #define WebKitDisplayImagesKey "WebKitDisplayImagesKey" @@ -125,3 +127,8 @@ #define WebKitXSSAuditorEnabledPreferenceKey "WebKitXSSAuditorEnabled" +#define WebKitUseHighResolutionTimersPreferenceKey "WebKitUseHighResolutionTimers" + +#define WebKitPluginHalterEnabledPreferenceKey "WebKitPluginHalterEnabled" + +#define WebKitPluginAllowedRunTimePreferenceKey "WebKitPluginAllowedRunTime" diff --git a/WebKit/win/WebPreferences.cpp b/WebKit/win/WebPreferences.cpp index 8ea0319..e37177e 100644 --- a/WebKit/win/WebPreferences.cpp +++ b/WebKit/win/WebPreferences.cpp @@ -42,6 +42,7 @@ #pragma warning( pop ) #include <CoreFoundation/CoreFoundation.h> +#include <limits> #include <shlobj.h> #include <shfolder.h> #include <tchar.h> @@ -54,6 +55,7 @@ #endif using namespace WebCore; +using std::numeric_limits; static const String& oldPreferencesPath() { @@ -204,12 +206,14 @@ void WebPreferences::initializeDefaultSettings() CFDictionaryAddValue(defaults, CFSTR(WebKitJavaEnabledPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptEnabledPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitWebSecurityEnabledPreferenceKey), kCFBooleanTrue); - CFDictionaryAddValue(defaults, CFSTR(WebKitAllowUniversalAccessFromFileURLsPreferenceKey), kCFBooleanTrue); + CFDictionaryAddValue(defaults, CFSTR(WebKitAllowUniversalAccessFromFileURLsPreferenceKey), kCFBooleanFalse); CFDictionaryAddValue(defaults, CFSTR(WebKitXSSAuditorEnabledPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitPluginsEnabledPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitDatabasesEnabledPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitLocalStorageEnabledPreferenceKey), kCFBooleanTrue); + CFDictionaryAddValue(defaults, CFSTR(WebKitExperimentalNotificationsEnabledPreferenceKey), kCFBooleanFalse); + CFDictionaryAddValue(defaults, CFSTR(WebKitExperimentalWebSocketsEnabledPreferenceKey), kCFBooleanFalse); CFDictionaryAddValue(defaults, CFSTR(WebKitAllowAnimatedImagesPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitAllowAnimatedImageLoopingPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitDisplayImagesKey), kCFBooleanTrue); @@ -247,6 +251,13 @@ void WebPreferences::initializeDefaultSettings() CFDictionaryAddValue(defaults, CFSTR(WebKitPaintNativeControlsPreferenceKey), kCFBooleanTrue); + CFDictionaryAddValue(defaults, CFSTR(WebKitUseHighResolutionTimersPreferenceKey), kCFBooleanTrue); + + CFDictionaryAddValue(defaults, CFSTR(WebKitPluginHalterEnabledPreferenceKey), kCFBooleanFalse); + + RetainPtr<CFStringRef> pluginAllowedRunTime(AdoptCF, CFStringCreateWithFormat(0, 0, CFSTR("%u"), numeric_limits<unsigned>::max())); + CFDictionaryAddValue(defaults, CFSTR(WebKitPluginAllowedRunTimePreferenceKey), pluginAllowedRunTime.get()); + defaultSettings = defaults; } @@ -1289,6 +1300,30 @@ HRESULT STDMETHODCALLTYPE WebPreferences::setLocalStorageDatabasePath(BSTR locat return S_OK; } +HRESULT STDMETHODCALLTYPE WebPreferences::setExperimentalNotificationsEnabled(BOOL enabled) +{ + setBoolValue(CFSTR(WebKitExperimentalNotificationsEnabledPreferenceKey), enabled); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::experimentalNotificationsEnabled(BOOL* enabled) +{ + *enabled = boolValueForKey(CFSTR(WebKitExperimentalNotificationsEnabledPreferenceKey)); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::setExperimentalWebSocketsEnabled(BOOL enabled) +{ + setBoolValue(CFSTR(WebKitExperimentalWebSocketsEnabledPreferenceKey), enabled); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::experimentalWebSocketsEnabled(BOOL* enabled) +{ + *enabled = boolValueForKey(CFSTR(WebKitExperimentalWebSocketsEnabledPreferenceKey)); + return S_OK; +} + HRESULT WebPreferences::setZoomsTextOnly(BOOL zoomsTextOnly) { setBoolValue(CFSTR(WebKitZoomsTextOnlyPreferenceKey), zoomsTextOnly); @@ -1301,6 +1336,54 @@ HRESULT WebPreferences::zoomsTextOnly(BOOL* zoomsTextOnly) return S_OK; } +HRESULT STDMETHODCALLTYPE WebPreferences::setShouldUseHighResolutionTimers(BOOL useHighResolutionTimers) +{ + setBoolValue(CFSTR(WebKitUseHighResolutionTimersPreferenceKey), useHighResolutionTimers); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::shouldUseHighResolutionTimers(BOOL* useHighResolutionTimers) +{ + *useHighResolutionTimers = boolValueForKey(CFSTR(WebKitUseHighResolutionTimersPreferenceKey)); + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE WebPreferences::setPluginHalterEnabled(BOOL enabled) +{ + setBoolValue(CFSTR(WebKitPluginHalterEnabledPreferenceKey), enabled); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::pluginHalterEnabled(BOOL* enabled) +{ + *enabled = boolValueForKey(CFSTR(WebKitPluginHalterEnabledPreferenceKey)); + return S_OK; +} + +HRESULT WebPreferences::setPluginAllowedRunTime(UINT allowedRunTime) +{ + setIntegerValue(CFSTR(WebKitPluginAllowedRunTimePreferenceKey), allowedRunTime); + return S_OK; +} + +HRESULT WebPreferences::pluginAllowedRunTime(UINT* allowedRunTime) +{ + *allowedRunTime = integerValueForKey(CFSTR(WebKitPluginAllowedRunTimePreferenceKey)); + return S_OK; +} + +HRESULT WebPreferences::setPreferenceForTest(BSTR key, BSTR value) +{ + if (!SysStringLen(key) || !SysStringLen(value)) + return E_FAIL; + RetainPtr<CFStringRef> keyString(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<UniChar*>(key), SysStringLen(key))); + RetainPtr<CFStringRef> valueString(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<UniChar*>(value), SysStringLen(value))); + setValueForKey(keyString.get(), valueString.get()); + postPreferencesChangesNotification(); + return S_OK; +} + void WebPreferences::willAddToWebView() { ++m_numWebViews; diff --git a/WebKit/win/WebPreferences.h b/WebKit/win/WebPreferences.h index 2f94382..14035d0 100644 --- a/WebKit/win/WebPreferences.h +++ b/WebKit/win/WebPreferences.h @@ -325,7 +325,19 @@ public: virtual HRESULT STDMETHODCALLTYPE setLocalStorageDatabasePath( /* [in] */ BSTR location); - + + virtual HRESULT STDMETHODCALLTYPE experimentalNotificationsEnabled( + /* [retval][out] */ BOOL *enabled); + + virtual HRESULT STDMETHODCALLTYPE setExperimentalNotificationsEnabled( + /* [in] */ BOOL enabled); + + virtual HRESULT STDMETHODCALLTYPE experimentalWebSocketsEnabled( + /* [retval][out] */ BOOL *enabled); + + virtual HRESULT STDMETHODCALLTYPE setExperimentalWebSocketsEnabled( + /* [in] */ BOOL enabled); + virtual HRESULT STDMETHODCALLTYPE setShouldPaintNativeControls( /* [in] */ BOOL shouldPaint); @@ -340,7 +352,7 @@ public: virtual HRESULT STDMETHODCALLTYPE fontSmoothingContrast( /* [retval][out] */ float* contrast); - + virtual HRESULT STDMETHODCALLTYPE setFontSmoothingContrast( /* [in] */ float contrast); @@ -362,6 +374,29 @@ public: virtual HRESULT STDMETHODCALLTYPE setXSSAuditorEnabled( /* [in] */ BOOL enabled); + virtual HRESULT STDMETHODCALLTYPE setShouldUseHighResolutionTimers( + /* [in] */ BOOL useHighResolutionTimers); + + virtual HRESULT STDMETHODCALLTYPE shouldUseHighResolutionTimers( + /* [retval][out] */ BOOL* useHighResolutionTimers); + + virtual HRESULT STDMETHODCALLTYPE setPluginHalterEnabled( + /* [in] */ BOOL enabled); + + virtual HRESULT STDMETHODCALLTYPE pluginHalterEnabled( + /* [retval][out] */ BOOL* enabled); + + virtual HRESULT STDMETHODCALLTYPE setPluginAllowedRunTime( + /* [in] */ UINT allowedRunTime); + + virtual HRESULT STDMETHODCALLTYPE pluginAllowedRunTime( + /* [retval][out] */ UINT* allowedRunTime); + + virtual HRESULT STDMETHODCALLTYPE setPreferenceForTest( + /* [in] */ BSTR key, + /* [in] */ BSTR value); + + // WebPreferences // This method accesses a different preference key than developerExtrasEnabled. diff --git a/WebKit/win/WebURLResponse.cpp b/WebKit/win/WebURLResponse.cpp index b1f4488..644e1d8 100644 --- a/WebKit/win/WebURLResponse.cpp +++ b/WebKit/win/WebURLResponse.cpp @@ -228,7 +228,7 @@ WebURLResponse* WebURLResponse::createInstance() { WebURLResponse* instance = new WebURLResponse(); // fake an http response - so it has the IWebHTTPURLResponse interface - instance->m_response = ResourceResponse(KURL("http://"), String(), 0, String(), String()); + instance->m_response = ResourceResponse(KURL(ParsedURLString, "http://"), String(), 0, String(), String()); instance->AddRef(); return instance; } diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp index b51af67..85b2ac2 100644 --- a/WebKit/win/WebView.cpp +++ b/WebKit/win/WebView.cpp @@ -50,6 +50,7 @@ #include "WebKitSystemBits.h" #include "WebMutableURLRequest.h" #include "WebNotificationCenter.h" +#include "WebPluginHalterClient.h" #include "WebPreferences.h" #include "WindowsTouch.h" #pragma warning( push, 0 ) @@ -88,12 +89,14 @@ #include <WebCore/MIMETypeRegistry.h> #include <WebCore/Page.h> #include <WebCore/PageCache.h> +#include <WebCore/PageGroup.h> #include <WebCore/PlatformKeyboardEvent.h> #include <WebCore/PlatformMouseEvent.h> #include <WebCore/PlatformWheelEvent.h> #include <WebCore/PluginDatabase.h> #include <WebCore/PluginInfoStore.h> #include <WebCore/PluginView.h> +#include <WebCore/PopupMenu.h> #include <WebCore/ProgressTracker.h> #include <WebCore/RenderTheme.h> #include <WebCore/RenderView.h> @@ -128,6 +131,7 @@ #endif #include <wtf/HashSet.h> +#include <comutil.h> #include <dimm.h> #include <oleacc.h> #include <ShlObj.h> @@ -145,9 +149,8 @@ SOFT_LINK_OPTIONAL(Uxtheme, EndPanningFeedback, BOOL, WINAPI, (HWND, BOOL)); SOFT_LINK_OPTIONAL(Uxtheme, UpdatePanningFeedback, BOOL, WINAPI, (HWND, LONG, LONG, BOOL)); using namespace WebCore; +using namespace std; using JSC::JSLock; -using std::min; -using std::max; static HMODULE accessibilityLib; static HashSet<WebView*> pendingDeleteBackingStoreSet; @@ -613,6 +616,8 @@ HRESULT STDMETHODCALLTYPE WebView::close() m_didClose = true; + WebNotificationCenter::defaultCenterInternal()->postNotificationName(_bstr_t(WebViewWillCloseNotification).GetBSTR(), static_cast<IWebView*>(this), 0); + if (m_uiDelegatePrivate) m_uiDelegatePrivate->webViewClosing(this); @@ -638,6 +643,7 @@ HRESULT STDMETHODCALLTYPE WebView::close() setResourceLoadDelegate(0); setUIDelegate(0); setFormDelegate(0); + setPluginHalterDelegate(0); if (m_webInspector) m_webInspector->webViewClosed(); @@ -719,6 +725,10 @@ bool WebView::ensureBackingStore() void WebView::addToDirtyRegion(const IntRect& dirtyRect) { + // FIXME: We want an assert here saying that the dirtyRect is inside the clienRect, + // but it was being hit during our layout tests, and is being investigated in + // http://webkit.org/b/29350. + HRGN newRegion = ::CreateRectRgn(dirtyRect.x(), dirtyRect.y(), dirtyRect.right(), dirtyRect.bottom()); addToDirtyRegion(newRegion); @@ -930,19 +940,6 @@ void WebView::paint(HDC dc, LPARAM options) ::DeleteDC(bitmapDC); - // Paint the gripper. - COMPtr<IWebUIDelegate> ui; - if (SUCCEEDED(uiDelegate(&ui))) { - COMPtr<IWebUIDelegatePrivate> uiPrivate; - if (SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegatePrivate, (void**)&uiPrivate))) { - RECT r; - if (SUCCEEDED(uiPrivate->webViewResizerRect(this, &r))) { - LOCAL_GDI_COUNTER(2, __FUNCTION__" webViewDrawResizer delegate call"); - uiPrivate->webViewDrawResizer(this, hdc, (frameView->containsScrollbarsAvoidingResizer() ? true : false), &r); - } - } - } - if (!dc) EndPaint(m_viewWindow, &ps); @@ -958,6 +955,10 @@ void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const In { LOCAL_GDI_COUNTER(0, __FUNCTION__); + // FIXME: We want an assert here saying that the dirtyRect is inside the clienRect, + // but it was being hit during our layout tests, and is being investigated in + // http://webkit.org/b/29350. + RECT rect = dirtyRect; #if FLASH_BACKING_STORE_REDRAW @@ -977,6 +978,11 @@ void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const In gc.clearRect(dirtyRect); else FillRect(bitmapDC, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH)); + + COMPtr<IWebUIDelegatePrivate2> uiPrivate(Query, m_uiDelegate); + if (uiPrivate) + uiPrivate->drawBackground(this, reinterpret_cast<OLE_HANDLE>(bitmapDC), &rect); + if (frameView && frameView->frame() && frameView->frame()->contentRenderer()) { gc.clip(dirtyRect); frameView->paint(&gc, dirtyRect); @@ -1270,12 +1276,6 @@ bool WebView::handleMouseEvent(UINT message, WPARAM wParam, LPARAM lParam) abs(globalPrevPoint.y() - mouseEvent.pos().y()) < ::GetSystemMetrics(SM_CYDOUBLECLK); LONG messageTime = ::GetMessageTime(); - if (inResizer(position)) { - if (m_uiDelegatePrivate) - m_uiDelegatePrivate->webViewSendResizeMessage(message, wParam, position); - return true; - } - bool handled = false; if (message == WM_LBUTTONDOWN || message == WM_MBUTTONDOWN || message == WM_RBUTTONDOWN) { @@ -1349,25 +1349,65 @@ bool WebView::gestureNotify(WPARAM wParam, LPARAM lParam) // If we don't have this function, we shouldn't be receiving this message ASSERT(SetGestureConfigPtr()); - DWORD dwPanWant; - DWORD dwPanBlock; - - // Translate gesture location to client to hit test on scrollbars + bool hitScrollbar = false; POINT gestureBeginPoint = {gn->ptsLocation.x, gn->ptsLocation.y}; - IntPoint eventHandlerPoint = m_page->mainFrame()->view()->screenToContents(gestureBeginPoint); + HitTestRequest request(HitTestRequest::ReadOnly); + for (Frame* childFrame = m_page->mainFrame(); childFrame; childFrame = EventHandler::subframeForTargetNode(m_gestureTargetNode.get())) { + FrameView* frameView = childFrame->view(); + if (!frameView) + break; + RenderView* renderView = childFrame->document()->renderView(); + if (!renderView) + break; + RenderLayer* layer = renderView->layer(); + if (!layer) + break; + + HitTestResult result(frameView->screenToContents(gestureBeginPoint)); + layer->hitTest(request, result); + m_gestureTargetNode = result.innerNode(); - HitTestResult scrollbarTest = m_page->mainFrame()->eventHandler()->hitTestResultAtPoint(eventHandlerPoint, true, false, ShouldHitTestScrollbars); + if (!hitScrollbar) + hitScrollbar = result.scrollbar(); + } + + if (!hitScrollbar) { + // The hit testing above won't detect if we've hit the main frame's vertical scrollbar. Check that manually now. + RECT webViewRect; + GetWindowRect(m_viewWindow, &webViewRect); + hitScrollbar = view->verticalScrollbar() && (gestureBeginPoint.x > (webViewRect.right - view->verticalScrollbar()->theme()->scrollbarThickness())); + } - if (eventHandlerPoint.x() > view->visibleWidth() || scrollbarTest.scrollbar()) { - // We are in the scrollbar, turn off panning, need to be able to drag the scrollbar - dwPanWant = GC_PAN | GC_PAN_WITH_INERTIA | GC_PAN_WITH_GUTTER; - dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY | GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; + bool canBeScrolled = false; + if (m_gestureTargetNode) { + for (RenderObject* renderer = m_gestureTargetNode->renderer(); renderer; renderer = renderer->parent()) { + if (renderer->isBox() && toRenderBox(renderer)->canBeScrolledAndHasScrollableArea()) { + canBeScrolled = true; + break; + } + } + } + + // We always allow two-fingered panning with inertia and a gutter (which limits movement to one + // direction in most cases). + DWORD dwPanWant = GC_PAN | GC_PAN_WITH_INERTIA | GC_PAN_WITH_GUTTER; + // We never allow single-fingered horizontal panning. That gesture is reserved for creating text + // selections. This matches IE. + DWORD dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; + + if (hitScrollbar || !canBeScrolled) { + // The part of the page under the gesture can't be scrolled, or the gesture is on a scrollbar. + // Disallow single-fingered vertical panning in this case, too, so we'll fall back to the default + // behavior (which allows the scrollbar thumb to be dragged, text selections to be made, etc.). + dwPanBlock |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; } else { - dwPanWant = GC_PAN | GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_INERTIA | GC_PAN_WITH_GUTTER; - dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; + // The part of the page the gesture is under can be scrolled, and we're not under a scrollbar. + // Allow single-fingered vertical panning in this case, so the user will be able to pan the page + // with one or two fingers. + dwPanWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; } - GESTURECONFIG gc = { GID_PAN, dwPanWant , dwPanBlock } ; + GESTURECONFIG gc = { GID_PAN, dwPanWant, dwPanBlock }; return SetGestureConfigPtr()(m_viewWindow, 0, 1, &gc, sizeof(GESTURECONFIG)); } @@ -1390,21 +1430,20 @@ bool WebView::gesture(WPARAM wParam, LPARAM lParam) m_lastPanX = gi.ptsLocation.x; m_lastPanY = gi.ptsLocation.y; - CloseGestureInfoHandlePtr()(gestureHandle); + break; + case GID_END: + m_gestureTargetNode = 0; break; case GID_PAN: { // Where are the fingers currently? long currentX = gi.ptsLocation.x; long currentY = gi.ptsLocation.y; - // How far did we pan in each direction? long deltaX = currentX - m_lastPanX; long deltaY = currentY - m_lastPanY; - // Calculate the overpan for window bounce m_yOverpan -= m_lastPanY - currentY; m_xOverpan -= m_lastPanX - currentX; - // Update our class variables with updated values m_lastPanX = currentX; m_lastPanY = currentY; @@ -1414,10 +1453,13 @@ bool WebView::gesture(WPARAM wParam, LPARAM lParam) CloseGestureInfoHandlePtr()(gestureHandle); return false; } - // Represent the pan gesture as a mouse wheel event - PlatformWheelEvent wheelEvent(m_viewWindow, FloatSize(deltaX, deltaY), FloatPoint(currentX, currentY)); - coreFrame->eventHandler()->handleWheelEvent(wheelEvent); + if (!m_gestureTargetNode || !m_gestureTargetNode->renderer()) + return false; + + // We negate here since panning up moves the content up, but moves the scrollbar down. + m_gestureTargetNode->renderer()->enclosingLayer()->scrollByRecursively(-deltaX, -deltaY); + if (!(UpdatePanningFeedbackPtr() && BeginPanningFeedbackPtr() && EndPanningFeedbackPtr())) { CloseGestureInfoHandlePtr()(gestureHandle); return true; @@ -1434,7 +1476,7 @@ bool WebView::gesture(WPARAM wParam, LPARAM lParam) ScrollView* view = coreFrame->view(); if (!view) { CloseGestureInfoHandlePtr()(gestureHandle); - return false; + return true; } Scrollbar* vertScrollbar = view->verticalScrollbar(); if (!vertScrollbar) { @@ -1442,22 +1484,26 @@ bool WebView::gesture(WPARAM wParam, LPARAM lParam) return true; } - // FIXME: Support Horizontal Window Bounce + // FIXME: Support Horizontal Window Bounce. <https://webkit.org/b/28500>. + // FIXME: If the user starts panning down after a window bounce has started, the window doesn't bounce back + // until they release their finger. <https://webkit.org/b/28501>. if (vertScrollbar->currentPos() == 0) UpdatePanningFeedbackPtr()(m_viewWindow, 0, m_yOverpan, gi.dwFlags & GF_INERTIA); else if (vertScrollbar->currentPos() >= vertScrollbar->maximum()) UpdatePanningFeedbackPtr()(m_viewWindow, 0, m_yOverpan, gi.dwFlags & GF_INERTIA); CloseGestureInfoHandlePtr()(gestureHandle); - break; + return true; } default: - // We have encountered an unknown gesture - return false to pass it to DefWindowProc - CloseGestureInfoHandlePtr()(gestureHandle); break; } - return true; + // If we get to this point, the gesture has not been handled. We forward + // the call to DefWindowProc by returning false, and we don't need to + // to call CloseGestureInfoHandle. + // http://msdn.microsoft.com/en-us/library/dd353228(VS.85).aspx + return false; } bool WebView::mouseWheel(WPARAM wParam, LPARAM lParam, bool isMouseHWheel) @@ -1473,6 +1519,23 @@ bool WebView::mouseWheel(WPARAM wParam, LPARAM lParam, bool isMouseHWheel) makeTextLarger(0); return true; } + + // FIXME: This doesn't fix https://bugs.webkit.org/show_bug.cgi?id=28217. This only fixes https://bugs.webkit.org/show_bug.cgi?id=28203. + HWND focusedWindow = GetFocus(); + if (focusedWindow && focusedWindow != m_viewWindow) { + // Our focus is on a different hwnd, see if it's a PopupMenu and if so, set the focus back on us (which will hide the popup). + TCHAR className[256]; + + // Make sure truncation won't affect the comparison. + ASSERT(ARRAYSIZE(className) > _tcslen(PopupMenu::popupClassName())); + + if (GetClassName(focusedWindow, className, ARRAYSIZE(className)) && !_tcscmp(className, PopupMenu::popupClassName())) { + // We don't let the WebView scroll here for two reasons - 1) To match Firefox behavior, 2) If we do scroll, we lose the + // focus ring around the select menu. + SetFocus(m_viewWindow); + return true; + } + } PlatformWheelEvent wheelEvent(m_viewWindow, wParam, lParam, isMouseHWheel); Frame* coreFrame = core(m_mainFrame); @@ -1740,21 +1803,6 @@ bool WebView::keyPress(WPARAM charCode, LPARAM keyData, bool systemKeyDown) return frame->eventHandler()->keyEvent(keyEvent); } -bool WebView::inResizer(LPARAM lParam) -{ - if (!m_uiDelegatePrivate) - return false; - - RECT r; - if (FAILED(m_uiDelegatePrivate->webViewResizerRect(this, &r))) - return false; - - POINT pt; - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - return !!PtInRect(&r, pt); -} - static bool registerWebViewWindowClass() { static bool haveRegisteredWindowClass = false; @@ -1834,8 +1882,8 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L webView->paint((HDC)wParam, lParam); break; case WM_DESTROY: - webView->close(); webView->setIsBeingDestroyed(); + webView->close(); webView->revokeDragDrop(); break; case WM_GESTURENOTIFY: @@ -2281,13 +2329,8 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame( registerWebViewWindowClass(); - if (!::IsWindow(m_hostWindow)) { - ASSERT_NOT_REACHED(); - return E_FAIL; - } - - m_viewWindow = CreateWindowEx(0, kWebViewWindowClassName, 0, WS_CHILD | WS_CLIPCHILDREN, - frame.left, frame.top, frame.right - frame.left, frame.bottom - frame.top, m_hostWindow, 0, gInstance, 0); + m_viewWindow = CreateWindowEx(0, kWebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + frame.left, frame.top, frame.right - frame.left, frame.bottom - frame.top, m_hostWindow ? m_hostWindow : HWND_MESSAGE, 0, gInstance, 0); ASSERT(::IsWindow(m_viewWindow)); hr = registerDragDrop(); @@ -2310,7 +2353,11 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame( Settings::setShouldPaintNativeControls(shouldPaintNativeControls); #endif - m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this)); + BOOL useHighResolutionTimer; + if (SUCCEEDED(m_preferences->shouldUseHighResolutionTimers(&useHighResolutionTimer))) + Settings::setShouldUseHighResolutionTimers(useHighResolutionTimer); + + m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this)); BSTR localStoragePath; if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) { @@ -2952,8 +2999,17 @@ HRESULT STDMETHODCALLTYPE WebView::setHostWindow( /* [in] */ OLE_HANDLE oleWindow) { HWND window = (HWND)(ULONG64)oleWindow; - if (m_viewWindow && window) - SetParent(m_viewWindow, window); + if (m_viewWindow) { + if (window) + SetParent(m_viewWindow, window); + else if (!isBeingDestroyed()) { + // Turn the WebView into a message-only window so it will no longer be a child of the + // old host window and will be hidden from screen. We only do this when + // isBeingDestroyed() is false because doing this while handling WM_DESTROY can leave + // m_viewWindow in a weird state (see <http://webkit.org/b/29337>). + SetParent(m_viewWindow, HWND_MESSAGE); + } + } m_hostWindow = window; @@ -3569,6 +3625,15 @@ HRESULT STDMETHODCALLTYPE WebView::toggleGrammarChecking( return setGrammarCheckingEnabled(enabled ? FALSE : TRUE); } +HRESULT STDMETHODCALLTYPE WebView::reloadFromOrigin( + /* [in] */ IUnknown* /*sender*/) +{ + if (!m_mainFrame) + return E_FAIL; + + return m_mainFrame->reloadFromOrigin(); +} + // IWebViewCSS ----------------------------------------------------------------- HRESULT STDMETHODCALLTYPE WebView::computedStyleForElement( @@ -4339,6 +4404,16 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification) return hr; settings->setLocalStorageEnabled(enabled); + hr = prefsPrivate->experimentalNotificationsEnabled(&enabled); + if (FAILED(hr)) + return hr; + settings->setExperimentalNotificationsEnabled(enabled); + + hr = prefsPrivate->experimentalWebSocketsEnabled(&enabled); + if (FAILED(hr)) + return hr; + settings->setExperimentalWebSocketsEnabled(enabled); + hr = prefsPrivate->isWebSecurityEnabled(&enabled); if (FAILED(hr)) return hr; @@ -4361,6 +4436,26 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification) settings->setShouldPaintNativeControls(!!enabled); #endif + hr = prefsPrivate->shouldUseHighResolutionTimers(&enabled); + if (FAILED(hr)) + return hr; + settings->setShouldUseHighResolutionTimers(enabled); + + hr = prefsPrivate->pluginHalterEnabled(&enabled); + if (FAILED(hr)) + return hr; + settings->setPluginHalterEnabled(enabled); + + UINT runTime; + hr = prefsPrivate->pluginAllowedRunTime(&runTime); + if (FAILED(hr)) + return hr; + settings->setPluginAllowedRunTime(runTime); + +#if ENABLE(3D_CANVAS) + settings->setExperimentalWebGLEnabled(true); +#endif // ENABLE(3D_CANVAS) + if (!m_closeWindowTimer.isActive()) m_mainFrame->invalidate(); // FIXME @@ -4392,6 +4487,20 @@ HRESULT updateSharedSettingsFromPreferencesIfNeeded(IWebPreferences* preferences // IWebViewPrivate ------------------------------------------------------------ +HRESULT STDMETHODCALLTYPE WebView::MIMETypeForExtension( + /* [in] */ BSTR extension, + /* [retval][out] */ BSTR* mimeType) +{ + if (!mimeType) + return E_POINTER; + + String extensionStr(extension, SysStringLen(extension)); + + *mimeType = BString(MIMETypeRegistry::getMIMETypeForExtension(extensionStr)).release(); + + return S_OK; +} + HRESULT STDMETHODCALLTYPE WebView::setCustomDropTarget( /* [in] */ IDropTarget* dt) { @@ -5324,6 +5433,134 @@ HRESULT WebView::setCanStartPlugins(BOOL canStartPlugins) return S_OK; } +static PassOwnPtr<Vector<String> > toStringVector(unsigned patternsCount, BSTR* patterns) +{ + // Convert the patterns into a Vector. + if (patternsCount == 0) + return 0; + Vector<String>* patternsVector = new Vector<String>; + for (unsigned i = 0; i < patternsCount; ++i) + patternsVector->append(String(patterns[i], SysStringLen(patterns[i]))); + return patternsVector; +} + +HRESULT WebView::addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, + unsigned whitelistCount, BSTR* whitelist, + unsigned blacklistCount, BSTR* blacklist, + WebUserScriptInjectionTime injectionTime) +{ + String group(groupName, SysStringLen(groupName)); + if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) + return E_INVALIDARG; + + PageGroup* pageGroup = PageGroup::pageGroup(group); + ASSERT(pageGroup); + if (!pageGroup) + return E_FAIL; + + pageGroup->addUserScript(String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))), + toStringVector(whitelistCount, whitelist), toStringVector(blacklistCount, blacklist), worldID, + injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd); + + return S_OK; +} + +HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, + unsigned whitelistCount, BSTR* whitelist, + unsigned blacklistCount, BSTR* blacklist) +{ + String group(groupName, SysStringLen(groupName)); + if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) + return E_INVALIDARG; + + PageGroup* pageGroup = PageGroup::pageGroup(group); + ASSERT(pageGroup); + if (!pageGroup) + return E_FAIL; + + pageGroup->addUserStyleSheet(String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))), + toStringVector(whitelistCount, whitelist), toStringVector(blacklistCount, blacklist), worldID); + + return S_OK; +} + +HRESULT WebView::removeUserContentWithURLFromGroup(BSTR groupName, unsigned worldID, BSTR url) +{ + String group(groupName, SysStringLen(groupName)); + if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) + return E_INVALIDARG; + + PageGroup* pageGroup = PageGroup::pageGroup(group); + ASSERT(pageGroup); + if (!pageGroup) + return E_FAIL; + + pageGroup->removeUserContentWithURLForWorld(KURL(KURL(), String(url, SysStringLen(url))), worldID); + + return S_OK; +} + +HRESULT WebView::removeUserContentFromGroup(BSTR groupName, unsigned worldID) +{ + String group(groupName, SysStringLen(groupName)); + if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) + return E_INVALIDARG; + + PageGroup* pageGroup = PageGroup::pageGroup(group); + ASSERT(pageGroup); + if (!pageGroup) + return E_FAIL; + + pageGroup->removeUserContentForWorld(worldID); + return S_OK; +} + +HRESULT WebView::removeAllUserContentFromGroup(BSTR groupName) +{ + String group(groupName, SysStringLen(groupName)); + if (group.isEmpty()) + return E_INVALIDARG; + + PageGroup* pageGroup = PageGroup::pageGroup(group); + ASSERT(pageGroup); + if (!pageGroup) + return E_FAIL; + + pageGroup->removeAllUserContent(); + return S_OK; +} + +HRESULT WebView::invalidateBackingStore(const RECT* rect) +{ + if (!IsWindow(m_viewWindow)) + return S_OK; + + RECT clientRect; + if (!GetClientRect(m_viewWindow, &clientRect)) + return E_FAIL; + + RECT rectToInvalidate; + if (!rect) + rectToInvalidate = clientRect; + else if (!IntersectRect(&rectToInvalidate, &clientRect, rect)) + return S_OK; + + repaint(rectToInvalidate, true); + return S_OK; +} + +HRESULT WebView::whiteListAccessFromOrigin(BSTR sourceOrigin, BSTR destinationProtocol, BSTR destinationHost, BOOL allowDestinationSubdomains) +{ + SecurityOrigin::whiteListAccessFromOrigin(*SecurityOrigin::createFromString(String(sourceOrigin, SysStringLen(sourceOrigin))), String(destinationProtocol, SysStringLen(destinationProtocol)), String(destinationHost, SysStringLen(destinationHost)), allowDestinationSubdomains); + return S_OK; +} + +HRESULT WebView::resetOriginAccessWhiteLists() +{ + SecurityOrigin::resetOriginAccessWhiteLists(); + return S_OK; +} + void WebView::downloadURL(const KURL& url) { // It's the delegate's job to ref the WebDownload to keep it alive - otherwise it will be @@ -5332,6 +5569,24 @@ void WebView::downloadURL(const KURL& url) download->start(); } + +HRESULT STDMETHODCALLTYPE WebView::setPluginHalterDelegate(IWebPluginHalterDelegate* d) +{ + m_pluginHalterDelegate = d; + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebView::pluginHalterDelegate(IWebPluginHalterDelegate** d) +{ + if (!d) + return E_POINTER; + + if (!m_pluginHalterDelegate) + return E_FAIL; + + return m_pluginHalterDelegate.copyRefTo(d); +} + class EnumTextMatches : public IEnumTextMatches { long m_ref; @@ -5415,4 +5670,3 @@ Page* core(IWebView* iWebView) return page; } - diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h index a97dd94..3f20c69 100644 --- a/WebKit/win/WebView.h +++ b/WebKit/win/WebView.h @@ -76,11 +76,11 @@ public: virtual HRESULT STDMETHODCALLTYPE canShowMIMEType( /* [in] */ BSTR mimeType, /* [retval][out] */ BOOL *canShow); - + virtual HRESULT STDMETHODCALLTYPE canShowMIMETypeAsHTML( /* [in] */ BSTR mimeType, /* [retval][out] */ BOOL *canShow); - + virtual HRESULT STDMETHODCALLTYPE MIMETypesShownAsHTML( /* [retval][out] */ IEnumVARIANT **enumVariant); @@ -353,6 +353,9 @@ public: virtual HRESULT STDMETHODCALLTYPE toggleGrammarChecking( /* [in] */ IUnknown *sender); + virtual HRESULT STDMETHODCALLTYPE reloadFromOrigin( + /* [in] */ IUnknown *sender); + // IWebViewCSS virtual HRESULT STDMETHODCALLTYPE computedStyleForElement( @@ -568,6 +571,11 @@ public: /* [in] */ IWebNotification *notification); // IWebViewPrivate + + virtual HRESULT STDMETHODCALLTYPE MIMETypeForExtension( + /* [in] */ BSTR extension, + /* [retval][out] */ BSTR *mimeType); + virtual HRESULT STDMETHODCALLTYPE setCustomDropTarget( /* [in] */ IDropTarget* dt); @@ -732,6 +740,25 @@ public: virtual HRESULT STDMETHODCALLTYPE setCanStartPlugins( /* [in] */ BOOL canStartPlugins); + virtual HRESULT STDMETHODCALLTYPE addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, + unsigned whitelistCount, BSTR* whitelist, + unsigned blacklistCount, BSTR* blacklist, + WebUserScriptInjectionTime); + virtual HRESULT STDMETHODCALLTYPE addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, + unsigned whitelistCount, BSTR* whitelist, + unsigned blacklistCount, BSTR* blacklist); + virtual HRESULT STDMETHODCALLTYPE removeUserContentWithURLFromGroup(BSTR groupName, unsigned worldID, BSTR url); + virtual HRESULT STDMETHODCALLTYPE removeUserContentFromGroup(BSTR groupName, unsigned worldID); + virtual HRESULT STDMETHODCALLTYPE removeAllUserContentFromGroup(BSTR groupName); + + virtual HRESULT STDMETHODCALLTYPE setPluginHalterDelegate(IWebPluginHalterDelegate*); + virtual HRESULT STDMETHODCALLTYPE pluginHalterDelegate(IWebPluginHalterDelegate**); + + virtual HRESULT STDMETHODCALLTYPE invalidateBackingStore(const RECT*); + + virtual HRESULT STDMETHODCALLTYPE whiteListAccessFromOrigin(BSTR sourceOrigin, BSTR destinationProtocol, BSTR destinationHost, BOOL allowDestinationSubdomains); + virtual HRESULT STDMETHODCALLTYPE resetOriginAccessWhiteLists(); + // WebView bool shouldUseEmbeddedView(const WebCore::String& mimeType) const; @@ -751,7 +778,6 @@ public: bool keyDown(WPARAM, LPARAM, bool systemKeyDown = false); bool keyUp(WPARAM, LPARAM, bool systemKeyDown = false); bool keyPress(WPARAM, LPARAM, bool systemKeyDown = false); - bool inResizer(LPARAM lParam); void paint(HDC, LPARAM); void paintIntoWindow(HDC bitmapDC, HDC windowDC, const WebCore::IntRect& dirtyRect); bool ensureBackingStore(); @@ -880,6 +906,7 @@ protected: COMPtr<IWebDownloadDelegate> m_downloadDelegate; COMPtr<WebPreferences> m_preferences; COMPtr<WebInspector> m_webInspector; + COMPtr<IWebPluginHalterDelegate> m_pluginHalterDelegate; bool m_userAgentOverridden; bool m_useBackForwardList; @@ -918,6 +945,7 @@ protected: OwnPtr<HashSet<WebCore::String> > m_embeddedViewMIMETypes; //Variables needed to store gesture information + RefPtr<WebCore::Node> m_gestureTargetNode; long m_lastPanX; long m_lastPanY; long m_xOverpan; diff --git a/WebKit/win/WebWorkersPrivate.cpp b/WebKit/win/WebWorkersPrivate.cpp new file mode 100644 index 0000000..f55c27c --- /dev/null +++ b/WebKit/win/WebWorkersPrivate.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2009 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. + */ + +#include "config.h" +#include "WebKitDLL.h" +#include "WebWorkersPrivate.h" + +#include <WebCore/WorkerThread.h> + +// IUnknown ------------------------------------------------------------------- + +HRESULT STDMETHODCALLTYPE WebWorkersPrivate::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualGUID(riid, __uuidof(IWebWorkersPrivate))) + *ppvObject = this; + else if (IsEqualGUID(riid, IID_IUnknown)) + *ppvObject = static_cast<IWebWorkersPrivate*>(this); + else if (IsEqualGUID(riid, IID_IWebWorkersPrivate)) + *ppvObject = static_cast<IWebWorkersPrivate*>(this); + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +ULONG STDMETHODCALLTYPE WebWorkersPrivate::AddRef(void) +{ + return ++m_refCount; +} + +ULONG STDMETHODCALLTYPE WebWorkersPrivate::Release(void) +{ + ULONG newRef = --m_refCount; + if (!newRef) + delete(this); + + return newRef; +} + +// IWebWorkersPrivate --------------------------------------------------------- + +HRESULT WebWorkersPrivate::workerThreadCount(UINT* number) +{ + if (!number) + return E_POINTER; + +#if ENABLE(WORKERS) + *number = WebCore::WorkerThread::workerThreadCount(); +#else + *number = 0; +#endif + return S_OK; +} + +// WebWorkersPrivate ---------------------------------------------------------- + +WebWorkersPrivate* WebWorkersPrivate::createInstance() +{ + WebWorkersPrivate* instance = new WebWorkersPrivate(); + instance->AddRef(); + return instance; +} + +WebWorkersPrivate::WebWorkersPrivate() + : m_refCount(0) +{ + gClassCount++; + gClassNameCount.add("WebWorkersPrivate"); +} + +WebWorkersPrivate::~WebWorkersPrivate() +{ + gClassCount--; + gClassNameCount.remove("WebWorkersPrivate"); +} diff --git a/WebKit/win/WebWorkersPrivate.h b/WebKit/win/WebWorkersPrivate.h new file mode 100644 index 0000000..231c11c --- /dev/null +++ b/WebKit/win/WebWorkersPrivate.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2009 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 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. + */ + +#ifndef WebWorkersPrivate_h +#define WebWorkersPrivate_h + +#include "WebKit.h" + +class WebWorkersPrivate : public IWebWorkersPrivate { +public: + static WebWorkersPrivate* createInstance(); +private: + WebWorkersPrivate(); + ~WebWorkersPrivate(); + +public: + // IUnknown + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef(void); + virtual ULONG STDMETHODCALLTYPE Release(void); + + // IWebWorkersPrivate + virtual HRESULT STDMETHODCALLTYPE workerThreadCount(UINT*); + +private: + ULONG m_refCount; +}; + +#endif // WebWorkersPrivate_h diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index 455aebd..76f4533 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,234 @@ +2009-10-07 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Factor PolicyChecker out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=30155 + + Move the policy callback to the policy object. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchWillSubmitForm): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForMIMEType): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): + +2009-09-25 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Add EmptyPluginHalterClient when creating the Page. + + * WebView.cpp: + (wxWebView::Create): + +2009-09-22 Kevin Ollivier <kevino@theolliviers.com> + + Build fix to ensure the import library gets properly installed on Windows. + + * wscript: + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Reflect the rename of platformWindow and it's return type. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::platformPageClient): + * WebKitSupport/ChromeClientWx.h: + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::isEditable): + (WebCore::EditorClientWx::registerCommandForUndo): + (WebCore::EditorClientWx::registerCommandForRedo): + (WebCore::EditorClientWx::clearUndoRedoOperations): + (WebCore::EditorClientWx::canUndo): + (WebCore::EditorClientWx::canRedo): + (WebCore::EditorClientWx::undo): + (WebCore::EditorClientWx::redo): + +2009-09-16 Kevin Ollivier <kevino@theolliviers.com> + + wxPython bindings build fixes after recent changes. + + * WebView.h: + * bindings/python/wscript: + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Allow a way to set the cache policy via wx API. + + https://bugs.webkit.org/show_bug.cgi?id=29200 + + * WebView.cpp: + (wxWebView::SetCachePolicy): + (wxWebView::GetCachePolicy): + * WebView.h: + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Allow the user to query Frame::shouldClose via wx API. + + https://bugs.webkit.org/show_bug.cgi?id=29199 + + * WebFrame.cpp: + (wxWebFrame::ShouldClose): + * WebFrame.h: + * WebView.cpp: + (wxWebView::ShouldClose): + * WebView.h: + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Fix mouse handling when the mouse leaves the window during mouse down. + + https://bugs.webkit.org/show_bug.cgi?id=29198 + + * WebView.cpp: + (wxWebView::OnMouseEvents): + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add support for console MessageLevel at wx API level. + + https://bugs.webkit.org/show_bug.cgi?id=29197 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::addMessageToConsole): + * WebView.h: + +2009-09-03 Adam Barth <abarth@webkit.org> + + Reviewed by eric@webkit.org. + + https://bugs.webkit.org/show_bug.cgi?id=24696 + + Stub implementations of mixed content methods of FrameLoaderClient. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::didDisplayInsecureContent): + (WebCore::FrameLoaderClientWx::didRunInsecureContent): + * WebKitSupport/FrameLoaderClientWx.h: + +2009-09-03 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + [wx] Frames support + https://bugs.webkit.org/show_bug.cgi?id=19041 + + * WebFrame.cpp: + (wxWebFrame::wxWebFrame): + (wxWebFrame::~wxWebFrame): + (wxWebFrame::GetFrame): + * WebFrame.h: + * WebFramePrivate.h: + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::platformWindow): + (WebCore::ChromeClientWx::scroll): + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::isEditable): + (WebCore::EditorClientWx::registerCommandForUndo): + (WebCore::EditorClientWx::registerCommandForRedo): + (WebCore::EditorClientWx::clearUndoRedoOperations): + (WebCore::EditorClientWx::canUndo): + (WebCore::EditorClientWx::canRedo): + (WebCore::EditorClientWx::undo): + (WebCore::EditorClientWx::redo): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::FrameLoaderClientWx): + (WebCore::FrameLoaderClientWx::setFrame): + (WebCore::FrameLoaderClientWx::dispatchWillSubmitForm): + (WebCore::FrameLoaderClientWx::frameLoaderDestroyed): + (WebCore::FrameLoaderClientWx::committedLoad): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForMIMEType): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): + (WebCore::FrameLoaderClientWx::createFrame): + (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): + * WebKitSupport/FrameLoaderClientWx.h: + * WebView.h: + * WebViewPrivate.h: + +2009-09-02 Kevin Ollivier <kevino@theolliviers.com> + + waf build fixes for Windows/MSVC. + + * bindings/python/wscript: + * wscript: + +2009-09-02 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + wx port: Call WTF::initializeThreading(). + https://bugs.webkit.org/show_bug.cgi?id=28912 + + * WebView.cpp: + (wxWebView::Create): call WTF::initializeThreading() + +2009-09-02 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Use the 2 param KURL constructor. + + * WebFrame.cpp: + (wxWebFrame::SetPageSource): + +2009-08-31 Alexey Proskuryakov <ap@webkit.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=28852 + Rename KURL single argument constructor to avoid confusion + + * WebFrame.cpp: (wxWebFrame::SetPageSource): Adapt to the change. + +2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Holger Freyther. + + https://bugs.webkit.org/show_bug.cgi?id=25889 + [GTK] scrollbar policy for main frame is not implementable + + Add empty implementation for new ChromeClient method. + + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::scrollbarsModeDidChange): + +2009-08-19 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Use FrameLoader::load() for loading pages from a HTML page string to address + bugs with using begin/write/end loading. + + https://bugs.webkit.org/show_bug.cgi?id=28488 + + * WebFrame.cpp: + (wxWebFrame::SetPageSource): + +2009-08-13 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Make sure that the wxWebKit dynamic library is rebuilt whenever + webcore or jscore libs change. + + * wscript: + +2009-08-12 Kevin Ollivier <kevino@theolliviers.com> + + wxPython build fix, the SWIG defines must also be available when compiling. + + * bindings/python/wscript: + 2009-08-05 Kevin Ollivier <kevino@theolliviers.com> Reviewed by Eric Seidel. diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp index 630eb8f..f205152 100644 --- a/WebKit/wx/WebFrame.cpp +++ b/WebKit/wx/WebFrame.cpp @@ -42,6 +42,7 @@ #include "RenderView.h" #include "ScriptController.h" #include "ScriptValue.h" +#include "SubstituteData.h" #include "TextEncoding.h" #include "JSDOMBinding.h" @@ -73,8 +74,7 @@ wxWebFrame::wxWebFrame(wxWebView* container, wxWebFrame* parent, WebViewFrameDat m_textMagnifier(1.0), m_isEditable(false), m_isInitialized(false), - m_beingDestroyed(false), - m_title(wxEmptyString) + m_beingDestroyed(false) { m_impl = new WebFramePrivate(); @@ -86,13 +86,16 @@ wxWebFrame::wxWebFrame(wxWebView* container, wxWebFrame* parent, WebViewFrameDat } WebCore::FrameLoaderClientWx* loaderClient = new WebCore::FrameLoaderClientWx(); - - m_impl->frame = WebCore::Frame::create(container->m_impl->page, parentFrame, loaderClient); - m_impl->frame->deref(); + RefPtr<WebCore::Frame> newFrame = WebCore::Frame::create(container->m_impl->page, parentFrame, loaderClient); + + m_impl->frame = newFrame.get(); - loaderClient->setFrame(m_impl->frame.get()); + loaderClient->setFrame(this); loaderClient->setWebView(container); + if (data && data->ownerElement) + m_impl->frame->ref(); + m_impl->frame->init(); m_isInitialized = true; @@ -100,13 +103,14 @@ wxWebFrame::wxWebFrame(wxWebView* container, wxWebFrame* parent, WebViewFrameDat wxWebFrame::~wxWebFrame() { - m_impl->frame->loader()->detachFromParent(); + if (m_impl) + delete m_impl; } WebCore::Frame* wxWebFrame::GetFrame() { if (m_impl) - return m_impl->frame.get(); + return m_impl->frame; return 0; } @@ -142,10 +146,16 @@ wxString wxWebFrame::GetPageSource() void wxWebFrame::SetPageSource(const wxString& source, const wxString& baseUrl) { if (m_impl->frame && m_impl->frame->loader()) { - WebCore::FrameLoader* loader = m_impl->frame->loader(); - loader->begin(WebCore::KURL(WebCore::KURL(), static_cast<const char*>(baseUrl.mb_str(wxConvUTF8)), WebCore::UTF8Encoding())); - loader->write(static_cast<const WebCore::String>(source)); - loader->end(); + WebCore::KURL url(WebCore::KURL(), static_cast<const char*>(baseUrl.mb_str(wxConvUTF8))); + + wxCharBuffer charBuffer(source.mb_str(wxConvUTF8)); + const char* contents = charBuffer; + + WTF::PassRefPtr<WebCore::SharedBuffer> sharedBuffer = WebCore::SharedBuffer::create(contents, strlen(contents)); + WebCore::SubstituteData substituteData(sharedBuffer, WebCore::String("text/html"), WebCore::String("UTF-8"), WebCore::blankURL(), url); + + m_impl->frame->loader()->stop(); + m_impl->frame->loader()->load(WebCore::ResourceRequest(url), substituteData, false); } } @@ -383,3 +393,10 @@ wxWebViewDOMElementInfo wxWebFrame::HitTest(const wxPoint& pos) const return domInfo; } +bool wxWebFrame::ShouldClose() const +{ + if (m_impl->frame) + return m_impl->frame->shouldClose(); + + return true; +} diff --git a/WebKit/wx/WebFrame.h b/WebKit/wx/WebFrame.h index 9bf21cd..bd4bdb0 100644 --- a/WebKit/wx/WebFrame.h +++ b/WebKit/wx/WebFrame.h @@ -146,21 +146,19 @@ public: void ResetTextSize(); void MakeEditable(bool enable); bool IsEditable() const { return m_isEditable; } - - wxString GetPageTitle() const { return m_title; } - void SetPageTitle(const wxString& title) { m_title = title; } WebCore::Frame* GetFrame(); wxWebViewDOMElementInfo HitTest(const wxPoint& post) const; + bool ShouldClose() const; + private: float m_textMagnifier; bool m_isEditable; bool m_isInitialized; bool m_beingDestroyed; WebFramePrivate* m_impl; - wxString m_title; }; diff --git a/WebKit/wx/WebFramePrivate.h b/WebKit/wx/WebFramePrivate.h index 7af70a8..58bc40a 100644 --- a/WebKit/wx/WebFramePrivate.h +++ b/WebKit/wx/WebFramePrivate.h @@ -30,11 +30,9 @@ #define WXWEBFRAMEPRIVATE_H #include "config.h" -#include "EditCommand.h" -#include "EditCommandWx.h" #include "Frame.h" -#include "wtf/RefPtr.h" -#include "wtf/Vector.h" +#include "HTMLFrameOwnerElement.h" +#include "KURL.h" class WebFramePrivate { @@ -42,11 +40,21 @@ public: WebFramePrivate() : frame(0) {} + + WebCore::Frame* frame; +}; - WTF::Vector<EditCommandWx> undoStack; - WTF::Vector<EditCommandWx> redoStack; +class WebViewFrameData +{ +public: + WebCore::KURL url; + WebCore::String name; + WebCore::HTMLFrameOwnerElement* ownerElement; - WTF::RefPtr<WebCore::Frame> frame; + WebCore::String referrer; + bool allowsScrolling; + int marginWidth; + int marginHeight; }; #endif diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp index b25fce9..9b2f264 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp @@ -212,6 +212,7 @@ void ChromeClientWx::addMessageToConsole(MessageSource source, wkEvent.SetMessage(message); wkEvent.SetLineNumber(lineNumber); wkEvent.SetSourceID(sourceID); + wkEvent.SetLevel(static_cast<wxWebViewConsoleMessageLevel>(level)); m_webView->GetEventHandler()->ProcessEvent(wkEvent); } } @@ -338,9 +339,9 @@ IntPoint ChromeClientWx::screenToWindow(const IntPoint& point) const return point; } -PlatformWidget ChromeClientWx::platformWindow() const +PlatformPageClient ChromeClientWx::platformPageClient() const { - return 0; + return m_webView; } void ChromeClientWx::contentsSizeChanged(Frame*, const IntSize&) const @@ -393,6 +394,7 @@ void ChromeClientWx::reachedMaxAppCacheSize(int64_t spaceNeeded) void ChromeClientWx::scroll(const IntSize&, const IntRect&, const IntRect&) { + m_webView->Refresh(); notImplemented(); } diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.h b/WebKit/wx/WebKitSupport/ChromeClientWx.h index 85335c8..07f70a8 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.h +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.h @@ -104,9 +104,10 @@ public: virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); virtual IntPoint screenToWindow(const IntPoint&) const; virtual IntRect windowToScreen(const IntRect&) const; - virtual PlatformWidget platformWindow() const; + virtual PlatformPageClient platformPageClient() const; virtual void contentsSizeChanged(Frame*, const IntSize&) const; + virtual void scrollbarsModeDidChange() const { } virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); virtual void setToolTip(const String&, TextDirection); diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.cpp b/WebKit/wx/WebKitSupport/EditorClientWx.cpp index 3808bfe..bd3af48 100644 --- a/WebKit/wx/WebKitSupport/EditorClientWx.cpp +++ b/WebKit/wx/WebKitSupport/EditorClientWx.cpp @@ -202,7 +202,7 @@ bool EditorClientWx::isEditable() Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); if (webKitWin) return webKitWin->IsEditable(); } @@ -285,9 +285,9 @@ void EditorClientWx::registerCommandForUndo(PassRefPtr<EditCommand> command) Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); if (webKitWin) { - webKitWin->GetMainFrame()->m_impl->undoStack.append(EditCommandWx(command)); + webKitWin->m_impl->undoStack.append(EditCommandWx(command)); } } } @@ -297,16 +297,24 @@ void EditorClientWx::registerCommandForRedo(PassRefPtr<EditCommand> command) Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); if (webKitWin) { - webKitWin->GetMainFrame()->m_impl->redoStack.insert(0, EditCommandWx(command)); + webKitWin->m_impl->redoStack.insert(0, EditCommandWx(command)); } } } void EditorClientWx::clearUndoRedoOperations() { - notImplemented(); + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + + if (frame) { + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); + if (webKitWin) { + webKitWin->m_impl->redoStack.clear(); + webKitWin->m_impl->undoStack.clear(); + } + } } bool EditorClientWx::canUndo() const @@ -314,9 +322,9 @@ bool EditorClientWx::canUndo() const Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); - if (webKitWin && webKitWin->GetMainFrame()) { - return webKitWin->GetMainFrame()->m_impl->undoStack.size() != 0; + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); + if (webKitWin) { + return webKitWin->m_impl->undoStack.size() != 0; } } return false; @@ -327,9 +335,9 @@ bool EditorClientWx::canRedo() const Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); - if (webKitWin && webKitWin->GetMainFrame()) { - return webKitWin->GetMainFrame()->m_impl->redoStack.size() != 0; + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); + if (webKitWin && webKitWin) { + return webKitWin->m_impl->redoStack.size() != 0; } } return false; @@ -340,10 +348,10 @@ void EditorClientWx::undo() Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); - if (webKitWin && webKitWin->GetMainFrame()) { - webKitWin->GetMainFrame()->m_impl->undoStack.last().editCommand()->unapply(); - webKitWin->GetMainFrame()->m_impl->undoStack.removeLast(); + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); + if (webKitWin) { + webKitWin->m_impl->undoStack.last().editCommand()->unapply(); + webKitWin->m_impl->undoStack.removeLast(); } } } @@ -352,11 +360,11 @@ void EditorClientWx::redo() { Frame* frame = m_page->focusController()->focusedOrMainFrame(); - if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); - if (webKitWin && webKitWin->GetMainFrame()) { - webKitWin->GetMainFrame()->m_impl->redoStack.first().editCommand()->reapply(); - webKitWin->GetMainFrame()->m_impl->redoStack.remove(0); + if (frame) { + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); + if (webKitWin) { + webKitWin->m_impl->redoStack.first().editCommand()->reapply(); + webKitWin->m_impl->redoStack.remove(0); } } } diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp index 9603bd5..0a5eeaf 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -48,10 +48,13 @@ #include "ResourceResponse.h" #include "ScriptController.h" #include "ScriptString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> #include <stdio.h> #include "WebFrame.h" +#include "WebFramePrivate.h" #include "WebView.h" #include "WebViewPrivate.h" @@ -77,7 +80,7 @@ inline int wxNavTypeFromWebNavType(NavigationType type){ } FrameLoaderClientWx::FrameLoaderClientWx() - : m_frame(0) + : m_webFrame(0) { } @@ -86,9 +89,10 @@ FrameLoaderClientWx::~FrameLoaderClientWx() { } -void FrameLoaderClientWx::setFrame(Frame *frame) +void FrameLoaderClientWx::setFrame(wxWebFrame *frame) { - m_frame = frame; + m_webFrame = frame; + m_frame = m_webFrame->m_impl->frame; } void FrameLoaderClientWx::setWebView(wxWebView *webview) @@ -96,11 +100,6 @@ void FrameLoaderClientWx::setWebView(wxWebView *webview) m_webView = webview; } -void FrameLoaderClientWx::detachFrameLoader() -{ - m_frame = 0; -} - bool FrameLoaderClientWx::hasWebView() const { return m_webView != NULL; @@ -339,9 +338,9 @@ void FrameLoaderClientWx::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>) { // FIXME: Send an event to allow for alerts and cancellation - if (!m_frame) + if (!m_webFrame) return; - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } @@ -505,6 +504,9 @@ void FrameLoaderClientWx::dispatchDidReceiveIcon() void FrameLoaderClientWx::frameLoaderDestroyed() { + if (m_webFrame) + delete m_webFrame; + m_webFrame = 0; m_frame = 0; delete this; } @@ -536,6 +538,16 @@ bool FrameLoaderClientWx::shouldGoToHistoryItem(WebCore::HistoryItem*) const return true; } +void FrameLoaderClientWx::didDisplayInsecureContent() +{ + notImplemented(); +} + +void FrameLoaderClientWx::didRunInsecureContent(WebCore::SecurityOrigin*) +{ + notImplemented(); +} + void FrameLoaderClientWx::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*) { notImplemented(); @@ -553,7 +565,7 @@ void FrameLoaderClientWx::setMainDocumentError(WebCore::DocumentLoader*, const W void FrameLoaderClientWx::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) { - if (!m_frame) + if (!m_webFrame) return; FrameLoader* fl = loader->frameLoader(); fl->setEncoding(m_response.textEncodingName(), false); @@ -693,16 +705,16 @@ Frame* FrameLoaderClientWx::dispatchCreatePage() void FrameLoaderClientWx::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& mimetype, const ResourceRequest& request) { - if (!m_frame) + if (!m_webFrame) return; notImplemented(); - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest& request, PassRefPtr<FormState>, const String& targetName) { - if (!m_frame) + if (!m_webFrame) return; if (m_webView) { @@ -712,17 +724,17 @@ void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc if (m_webView->GetEventHandler()->ProcessEvent(wkEvent)) { // if the app handles and doesn't skip the event, // from WebKit's perspective treat it as blocked / ignored - (m_frame->loader()->*function)(PolicyIgnore); + (m_frame->loader()->policyChecker()->*function)(PolicyIgnore); return; } } - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState>) { - if (!m_frame) + if (!m_webFrame) return; if (m_webView) { @@ -732,9 +744,9 @@ void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFun m_webView->GetEventHandler()->ProcessEvent(wkEvent); if (wkEvent.IsCancelled()) - (m_frame->loader()->*function)(PolicyIgnore); + (m_frame->loader()->policyChecker()->*function)(PolicyIgnore); else - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } } @@ -752,56 +764,34 @@ void FrameLoaderClientWx::startDownload(const ResourceRequest&) PassRefPtr<Frame> FrameLoaderClientWx::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) { -/* - FIXME: Temporarily disabling code for loading subframes. While most - (i)frames load and are destroyed properly, the iframe created by - google.com in its new homepage does not get destroyed when - document()->detach() is called, as other (i)frames do. It is destroyed on - app shutdown, but until that point, this 'in limbo' frame will do things - like steal keyboard focus and crash when clicked on. (On some platforms, - it is actually a visible object, even though it's not in a valid state.) - - Since just about every user is probably going to test against Google at - some point, I'm disabling this functionality until I have time to track down - why it is not being destroyed. -*/ - -/* - wxWindow* parent = m_webView; - WebViewFrameData* data = new WebViewFrameData(); data->name = name; data->ownerElement = ownerElement; data->url = url; data->referrer = referrer; + data->allowsScrolling = allowsScrolling; data->marginWidth = marginWidth; data->marginHeight = marginHeight; - wxWebView* newWin = new wxWebView(parent, -1, wxDefaultPosition, wxDefaultSize, data); + wxWebFrame* newFrame = new wxWebFrame(m_webView, m_webFrame, data); - RefPtr<Frame> childFrame = newWin->m_impl->frame; + RefPtr<Frame> childFrame = adoptRef(newFrame->m_impl->frame); - // FIXME: All of the below should probably be moved over into WebCore - childFrame->tree()->setName(name); m_frame->tree()->appendChild(childFrame); - // ### set override encoding if we have one + childFrame->tree()->setName(name); + childFrame->init(); - FrameLoadType loadType = m_frame->loader()->loadType(); - FrameLoadType childLoadType = FrameLoadTypeInternal; + // The creation of the frame may have run arbitrary JavaScript that removed it from the page already. + if (!childFrame->page()) + return 0; - childFrame->loader()->load(url, referrer, childLoadType, - String(), 0, 0); + childFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get()); // The frame's onload handler may have removed it from the document. if (!childFrame->tree()->parent()) return 0; - delete data; - - return childFrame.get(); -*/ - notImplemented(); - return 0; + return childFrame.release(); } ObjectContentType FrameLoaderClientWx::objectContentType(const KURL& url, const String& mimeType) @@ -880,29 +870,19 @@ void FrameLoaderClientWx::transitionToCommittedFromCachedFrame(CachedFrame*) void FrameLoaderClientWx::transitionToCommittedForNewPage() { + ASSERT(m_webFrame); ASSERT(m_frame); ASSERT(m_webView); - Page* page = m_frame->page(); - ASSERT(page); - - bool isMainFrame = m_frame == page->mainFrame(); - - m_frame->setView(0); - - RefPtr<FrameView> frameView; - if (isMainFrame) - frameView = FrameView::create(m_frame, IntRect(m_webView->GetRect()).size()); - else - frameView = FrameView::create(m_frame); - - ASSERT(frameView); - m_frame->setView(frameView); - - frameView->setPlatformWidget(m_webView); - - if (HTMLFrameOwnerElement* owner = m_frame->ownerElement()) - m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode()); + IntSize size = IntRect(m_webView->GetRect()).size(); + // FIXME: This value should be gotten from m_webView->IsTransparent(); + // but transitionToCommittedForNewPage() can be called while m_webView is + // still being initialized. + bool transparent = false; + Color backgroundColor = transparent ? WebCore::Color::transparent : WebCore::Color::white; + + if (m_frame) + m_frame->createView(size, backgroundColor, transparent, IntSize(), false); } } diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h index 7b44149..bfa162f 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h @@ -33,6 +33,7 @@ #include "KURL.h" #include "ResourceResponse.h" +class wxWebFrame; class wxWebView; namespace WebCore { @@ -51,9 +52,8 @@ namespace WebCore { public: FrameLoaderClientWx(); ~FrameLoaderClientWx(); - void setFrame(Frame *frame); + void setFrame(wxWebFrame *frame); void setWebView(wxWebView *webview); - virtual void detachFrameLoader(); virtual bool hasWebView() const; // mainly for assertions @@ -150,6 +150,9 @@ namespace WebCore { virtual void saveScrollPositionAndViewStateToItem(HistoryItem*); virtual bool canCachePage() const; + virtual void didDisplayInsecureContent(); + virtual void didRunInsecureContent(SecurityOrigin*); + virtual void setMainDocumentError(DocumentLoader*, const ResourceError&); virtual void committedLoad(DocumentLoader*, const char*, int); virtual ResourceError cancelledError(const ResourceRequest&); @@ -207,7 +210,8 @@ namespace WebCore { virtual void registerForIconNotification(bool listen = true); private: - Frame *m_frame; + wxWebFrame *m_webFrame; + Frame* m_frame; wxWebView *m_webView; ResourceResponse m_response; bool m_firstData; diff --git a/WebKit/wx/WebView.cpp b/WebKit/wx/WebView.cpp index 6bb1f7c..88b5990 100644 --- a/WebKit/wx/WebView.cpp +++ b/WebKit/wx/WebView.cpp @@ -24,10 +24,15 @@ */ #include "config.h" +#include "Cache.h" +#include "ContextMenu.h" +#include "ContextMenuItem.h" +#include "ContextMenuController.h" #include "CString.h" #include "Document.h" #include "Element.h" #include "Editor.h" +#include "EmptyClients.h" #include "EventHandler.h" #include "FocusController.h" #include "Frame.h" @@ -37,19 +42,18 @@ #include "Logging.h" #include "markup.h" #include "Page.h" -#include "ContextMenu.h" -#include "ContextMenuItem.h" -#include "ContextMenuController.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" #include "PlatformString.h" #include "PlatformWheelEvent.h" +#include "PluginHalterClient.h" #include "RenderObject.h" #include "RenderView.h" #include "Scrollbar.h" #include "SelectionController.h" #include "Settings.h" #include "SubstituteData.h" +#include "Threading.h" #include "ChromeClientWx.h" #include "ContextMenuClientWx.h" @@ -222,6 +226,26 @@ wxWebViewDOMElementInfo::wxWebViewDOMElementInfo() : { } +static wxWebViewCachePolicy gs_cachePolicy; + +/* static */ +void wxWebView::SetCachePolicy(const wxWebViewCachePolicy& cachePolicy) +{ + WebCore::Cache* globalCache = WebCore::cache(); + globalCache->setCapacities(cachePolicy.GetMinDeadCapacity(), + cachePolicy.GetMaxDeadCapacity(), + cachePolicy.GetCapacity()); + + // store a copy since there is no getter for Cache values + gs_cachePolicy = cachePolicy; +} + +/* static */ +wxWebViewCachePolicy wxWebView::GetCachePolicy() +{ + return gs_cachePolicy; +} + BEGIN_EVENT_TABLE(wxWebView, wxWindow) EVT_PAINT(wxWebView::OnPaint) EVT_SIZE(wxWebView::OnSize) @@ -233,7 +257,6 @@ BEGIN_EVENT_TABLE(wxWebView, wxWindow) EVT_CHAR(wxWebView::OnKeyEvents) EVT_SET_FOCUS(wxWebView::OnSetFocus) EVT_KILL_FOCUS(wxWebView::OnKillFocus) - EVT_ACTIVATE(wxWebView::OnActivate) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxWebView, wxWindow) @@ -265,11 +288,12 @@ bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position, { if ( (style & wxBORDER_MASK) == 0) style |= wxBORDER_NONE; - style |= wxHSCROLL | wxVSCROLL; if (!wxWindow::Create(parent, id, position, size, style, name)) return false; + WTF::initializeThreading(); + // This is necessary because we are using SharedTimerWin.cpp on Windows, // due to a problem with exceptions getting eaten when using the callback // approach to timers (which wx itself uses). @@ -286,7 +310,7 @@ bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position, WebCore::HTMLFrameOwnerElement* parentFrame = 0; WebCore::EditorClientWx* editorClient = new WebCore::EditorClientWx(); - m_impl->page = new WebCore::Page(new WebCore::ChromeClientWx(this), new WebCore::ContextMenuClientWx(), editorClient, new WebCore::DragClientWx(), new WebCore::InspectorClientWx()); + m_impl->page = new WebCore::Page(new WebCore::ChromeClientWx(this), new WebCore::ContextMenuClientWx(), editorClient, new WebCore::DragClientWx(), new WebCore::InspectorClientWx(), new WebCore::EmptyPluginHalterClient()); editorClient->setPage(m_impl->page); m_mainFrame = new wxWebFrame(this); @@ -312,7 +336,8 @@ wxWebView::~wxWebView() { m_beingDestroyed = true; - delete m_mainFrame; + if (m_mainFrame && m_mainFrame->GetFrame()) + m_mainFrame->GetFrame()->loader()->detachFromParent(); delete m_impl->page; m_impl->page = 0; @@ -484,10 +509,16 @@ void wxWebView::MakeEditable(bool enable) void wxWebView::OnPaint(wxPaintEvent& event) { - if (m_beingDestroyed || !m_mainFrame) return; - + + // WebView active state is based on TLW active state. + wxTopLevelWindow* tlw = dynamic_cast<wxTopLevelWindow*>(wxGetTopLevelParent(this)); + if (tlw && tlw->IsActive()) + m_impl->page->focusController()->setActive(true); + else { + m_impl->page->focusController()->setActive(false); + } WebCore::Frame* frame = m_mainFrame->GetFrame(); if (!frame || !frame->view()) return; @@ -502,23 +533,14 @@ void wxWebView::OnPaint(wxPaintEvent& event) if (dc.IsOk()) { wxRect paintRect = GetUpdateRegion().GetBox(); - WebCore::IntSize offset = frame->view()->scrollOffset(); -#if USE(WXGC) - gcdc.SetDeviceOrigin(-offset.width(), -offset.height()); -#endif - dc.SetDeviceOrigin(-offset.width(), -offset.height()); - paintRect.Offset(offset.width(), offset.height()); - #if USE(WXGC) WebCore::GraphicsContext gc(&gcdc); #else WebCore::GraphicsContext gc(&dc); #endif if (frame->contentRenderer()) { - if (frame->view()->needsLayout()) - frame->view()->layout(); - - frame->view()->paintContents(&gc, paintRect); + frame->view()->layoutIfNeededRecursive(); + frame->view()->paint(&gc, paintRect); } } } @@ -536,9 +558,9 @@ void wxWebView::OnSize(wxSizeEvent& event) { if (m_isInitialized && m_mainFrame) { WebCore::Frame* frame = m_mainFrame->GetFrame(); - frame->eventHandler()->sendResizeEvent(); - frame->view()->layout(); - frame->view()->adjustScrollbars(); + frame->view()->setFrameRect(wxRect(wxPoint(0,0), event.GetSize())); + frame->view()->forceLayout(); + frame->view()->adjustViewSize(); } event.Skip(); @@ -557,10 +579,7 @@ void wxWebView::OnMouseEvents(wxMouseEvent& event) { event.Skip(); - if (m_beingDestroyed) - return; - - if (!m_mainFrame) + if (!m_impl->page) return; WebCore::Frame* frame = m_mainFrame->GetFrame(); @@ -593,13 +612,15 @@ void wxWebView::OnMouseEvents(wxMouseEvent& event) WebCore::PlatformMouseEvent wkEvent(event, globalPoint, clickCount); if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN || - type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) + type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) { frame->eventHandler()->handleMousePressEvent(wkEvent); - - else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) + if (!HasCapture()) + CaptureMouse(); + } else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) { frame->eventHandler()->handleMouseReleaseEvent(wkEvent); - - else if (type == wxEVT_MOTION) + while (HasCapture()) + ReleaseMouse(); + } else if (type == wxEVT_MOTION || type == wxEVT_ENTER_WINDOW || type == wxEVT_LEAVE_WINDOW) frame->eventHandler()->mouseMoved(wkEvent); } @@ -608,10 +629,10 @@ void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event) m_impl->page->contextMenuController()->clearContextMenu(); wxPoint localEventPoint = ScreenToClient(event.GetPosition()); - if (!m_mainFrame) + if (!m_impl->page) return; - WebCore::Frame* focusedFrame = m_mainFrame->GetFrame(); + WebCore::Frame* focusedFrame = m_impl->page->focusController()->focusedOrMainFrame(); if (!focusedFrame->view()) return; @@ -691,8 +712,8 @@ void wxWebView::Paste() void wxWebView::OnKeyEvents(wxKeyEvent& event) { WebCore::Frame* frame = 0; - if (m_mainFrame) - frame = m_mainFrame->GetFrame(); + if (m_impl->page) + frame = m_impl->page->focusController()->focusedOrMainFrame(); if (!(frame && frame->view())) return; @@ -833,7 +854,6 @@ void wxWebView::OnSetFocus(wxFocusEvent& event) frame = m_mainFrame->GetFrame(); if (frame) { - m_impl->page->focusController()->setActive(true); frame->selection()->setFocused(true); } @@ -847,20 +867,11 @@ void wxWebView::OnKillFocus(wxFocusEvent& event) frame = m_mainFrame->GetFrame(); if (frame) { - m_impl->page->focusController()->setActive(false); frame->selection()->setFocused(false); } event.Skip(); } -void wxWebView::OnActivate(wxActivateEvent& event) -{ - if (m_impl->page) - m_impl->page->focusController()->setActive(event.GetActive()); - - event.Skip(); -} - wxWebViewDOMElementInfo wxWebView::HitTest(const wxPoint& pos) const { if (m_mainFrame) @@ -869,3 +880,10 @@ wxWebViewDOMElementInfo wxWebView::HitTest(const wxPoint& pos) const return wxWebViewDOMElementInfo(); } +bool wxWebView::ShouldClose() const +{ + if (m_mainFrame) + return m_mainFrame->ShouldClose(); + + return true; +} diff --git a/WebKit/wx/WebView.h b/WebKit/wx/WebView.h index 3e6b8f2..e83c420 100644 --- a/WebKit/wx/WebView.h +++ b/WebKit/wx/WebView.h @@ -65,6 +65,35 @@ namespace WebCore { extern WXDLLIMPEXP_WEBKIT const wxChar* wxWebViewNameStr; #endif +static const int defaultCacheCapacity = 8192 * 1024; // mirrors Cache.cpp + +class WXDLLIMPEXP_WEBKIT wxWebViewCachePolicy +{ +public: + wxWebViewCachePolicy(unsigned minDead = 0, unsigned maxDead = defaultCacheCapacity, unsigned totalCapacity = defaultCacheCapacity) + : m_minDeadCapacity(minDead) + , m_maxDeadCapacity(maxDead) + , m_capacity(totalCapacity) + {} + + ~wxWebViewCachePolicy() {} + + unsigned GetCapacity() const { return m_capacity; } + void SetCapacity(int capacity) { m_capacity = capacity; } + + unsigned GetMinDeadCapacity() const { return m_minDeadCapacity; } + void SetMinDeadCapacity(unsigned minDeadCapacity) { m_minDeadCapacity = minDeadCapacity; } + + unsigned GetMaxDeadCapacity() const { return m_maxDeadCapacity; } + void SetMaxDeadCapacity(unsigned maxDeadCapacity) { m_maxDeadCapacity = maxDeadCapacity; } + +protected: + unsigned m_capacity; + unsigned m_minDeadCapacity; + unsigned m_maxDeadCapacity; +}; + + // copied from WebKit/mac/Misc/WebKitErrors[Private].h enum { WebKitErrorCannotShowMIMEType = 100, @@ -159,6 +188,11 @@ public: wxWebFrame* GetMainFrame() { return m_mainFrame; } wxWebViewDOMElementInfo HitTest(const wxPoint& pos) const; + + bool ShouldClose() const; + + static void SetCachePolicy(const wxWebViewCachePolicy& cachePolicy); + static wxWebViewCachePolicy GetCachePolicy(); protected: @@ -171,7 +205,6 @@ protected: void OnKeyEvents(wxKeyEvent& event); void OnSetFocus(wxFocusEvent& event); void OnKillFocus(wxFocusEvent& event); - void OnActivate(wxActivateEvent& event); private: // any class wishing to process wxWindows events must use this macro @@ -299,6 +332,14 @@ private: wxPoint m_position; }; +// copied from page/Console.h +enum wxWebViewConsoleMessageLevel { + TipMessageLevel, + LogMessageLevel, + WarningMessageLevel, + ErrorMessageLevel +}; + class WXDLLIMPEXP_WEBKIT wxWebViewConsoleMessageEvent : public wxCommandEvent { #ifndef SWIG @@ -318,10 +359,14 @@ public: wxWebViewConsoleMessageEvent( wxWindow* win = (wxWindow*) NULL ); wxEvent *Clone(void) const { return new wxWebViewConsoleMessageEvent(*this); } + wxWebViewConsoleMessageLevel GetLevel() const { return m_level; } + void SetLevel(wxWebViewConsoleMessageLevel level) { m_level = level; } + private: unsigned int m_lineNumber; wxString m_message; wxString m_sourceID; + wxWebViewConsoleMessageLevel m_level; }; class WXDLLIMPEXP_WEBKIT wxWebViewAlertEvent : public wxCommandEvent diff --git a/WebKit/wx/WebViewPrivate.h b/WebKit/wx/WebViewPrivate.h index c6f24d1..989a579 100644 --- a/WebKit/wx/WebViewPrivate.h +++ b/WebKit/wx/WebViewPrivate.h @@ -30,10 +30,10 @@ #define WXWEBVIEWPRIVATE_H #include "config.h" -#include "HTMLFrameOwnerElement.h" +#include "EditCommand.h" +#include "EditCommandWx.h" #include "Page.h" -#include "wtf/RefPtr.h" -#include "KURL.h" +#include "wtf/Vector.h" #include <wx/timer.h> @@ -48,19 +48,9 @@ public: wxTimer tripleClickTimer; wxPoint tripleClickPos; -}; - -class WebViewFrameData -{ -public: - WebCore::KURL url; - WebCore::String name; - WebCore::HTMLFrameOwnerElement* ownerElement; - WebCore::String referrer; - bool allowsScrolling; - int marginWidth; - int marginHeight; + WTF::Vector<EditCommandWx> undoStack; + WTF::Vector<EditCommandWx> redoStack; }; #endif diff --git a/WebKit/wx/bindings/python/wscript b/WebKit/wx/bindings/python/wscript index f9d73c3..41e5d41 100644 --- a/WebKit/wx/bindings/python/wscript +++ b/WebKit/wx/bindings/python/wscript @@ -55,13 +55,18 @@ def set_options(opt): common_set_options(opt) def configure(conf): - common_configure(conf) - conf.check_tool('swig', tooldir='.') - conf.check_swig_version('1.3.29') + if Options.options.wxpython: + common_configure(conf) + conf.check_tool('swig', tooldir='.') + conf.check_swig_version('1.3.29') def build(bld): if Options.options.wxpython: - wx_swig_args = ['-DSWIG_TYPE_TABLE=_wxPython_table', '-DWXP_USE_THREAD=1', '-DSWIG_PYTHON_OUTPUT_TUPLE'] + defines = ['SWIG_TYPE_TABLE=_wxPython_table', 'WXP_USE_THREAD=1', 'SWIG_PYTHON_OUTPUT_TUPLE'] + wx_swig_args = [] + for define in defines: + wx_swig_args.append('-D%s' % define) + try: import wx.build.config wx_swig_args += wx.build.config.swig_args @@ -76,13 +81,17 @@ def build(bld): Logs.warn("Cannot find location of wxPython .i files, wxPython extension will not be built.") return + for inc_path in include_paths: + wx_swig_args.append('-I' + inc_path) + obj = bld.new_task_gen( features = 'cxx cshlib pyext', includes = ' '.join(include_paths), source = 'webview.i', swig_flags = ' '.join(wx_swig_args), + defines = defines, target = '_webview', - uselib = 'WX CURL ICU XSLT XML SQLITE3 WXWEBKIT ' + waf_configname, + uselib = 'WX CURL ICU XSLT XML SQLITE3 WXWEBKIT ' + get_config(), libpath = [output_dir], uselib_local = '', diff --git a/WebKit/wx/wscript b/WebKit/wx/wscript index 695ddc3..b5ba580 100644 --- a/WebKit/wx/wscript +++ b/WebKit/wx/wscript @@ -40,6 +40,13 @@ include_paths = webkit_dirs + common_includes + ['.', '..', os.path.join(wk_root, 'WebCore', 'platform', 'graphics', 'wx'), ] +windows_deps = [ + 'lib/pthreadVC2.dll', + 'bin/icuuc40.dll', 'bin/icudt40.dll', 'bin/icuin40.dll', + 'bin/libcurl.dll', 'bin/libeay32.dll', 'bin/ssleay32.dll', 'bin/zlib1.dll', + 'lib/sqlite3.dll', 'bin/libxml2.dll', 'bin/libxslt.dll', 'bin/iconv.dll', + ] + webcore_include_dirs = [] for dir in webcore_dirs + ['DerivedSources']: include_paths.append(os.path.join(wk_root, 'WebCore', dir)) @@ -54,15 +61,47 @@ def set_options(opt): def configure(conf): common_configure(conf) +def pre_build(bld): + """ + The wxWebKit library should be rebuilt if jscore or webcore changes, + so we make those static libs as dependencies. + """ + + ext = '.a' + if sys.platform.startswith('win'): + ext = '.lib' + + libjscore = os.path.join(output_dir, 'libjscore%s' % ext) + libwebcore = os.path.join(output_dir, 'libwebcore%s' % ext) + + assert os.path.exists(libjscore) + assert os.path.exists(libwebcore) + + bld.env.CXXDEPS_JSCORE = Utils.h_file(libjscore) + bld.env.CXXDEPS_WEBCORE = Utils.h_file(libwebcore) + def build(bld): + bld.add_pre_fun(pre_build) + + bld.env.LIBDIR = output_dir + obj = bld.new_task_gen( features = 'cxx cshlib implib', includes = ' '.join(include_paths + js_include_dirs), target = 'wxwebkit', defines = ['WXMAKINGDLL_WEBKIT'], - uselib = 'WX CURL ICU XSLT XML SQLITE3 WEBCORE JSCORE ' + waf_configname, + uselib = 'WX CURL ICU XSLT XML SQLITE3 WEBCORE JSCORE ' + get_config(), libpath = [output_dir], uselib_local = '', install_path = output_dir) obj.find_sources_in_dirs(webkit_dirs) + + if building_on_win32: + for wxlib in bld.env['LIB_WX']: + wxlibname = os.path.join(bld.env['LIBPATH_WX'][0], wxlib + '_vc.dll') + if os.path.exists(wxlibname): + bld.install_files(obj.install_path, [wxlibname]) + + for dep in windows_deps: + bld.install_files(obj.install_path, [os.path.join(msvclibs_dir, dep)]) |