diff options
Diffstat (limited to 'WebKit')
193 files changed, 8130 insertions, 2022 deletions
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog index bdddda0..c6da648 100644 --- a/WebKit/ChangeLog +++ b/WebKit/ChangeLog @@ -1,3 +1,36 @@ +2010-09-17 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/45989> Add WebArchiveInternal.h to Xcode project + + Reviewed by Joseph Pecoraro. + + * WebKit.xcodeproj/project.pbxproj: Added missing + WebArchiveInternal.h header file to the project. It has been + missing since r31281! + +2010-09-16 Dan Bernstein <mitz@apple.com> + + Reverted the previous change because r67628 has been reverted. + + * English.lproj/Localizable.strings: + +2010-09-16 Dan Bernstein <mitz@apple.com> + + Updated localizable strings. + + * English.lproj/Localizable.strings: + +2010-09-10 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Move some Dashboard stuff from WebCore to WebKit along with a bit more FrameMac cleanup + https://bugs.webkit.org/show_bug.cgi?id=45582 + + * WebKit.xcodeproj/project.pbxproj: Added WebDashboardRegion.h/mm and + also gave the header private visibility so it will get installed in the + PrivateHeaders directory. + 2010-09-02 Steve Block <steveblock@google.com> Reviewed by Adam Barth. diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj index 5b44054..a2a6091 100644 --- a/WebKit/WebKit.xcodeproj/project.pbxproj +++ b/WebKit/WebKit.xcodeproj/project.pbxproj @@ -91,6 +91,7 @@ 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 */; }; + 44BB8B141241A022001E3A22 /* WebArchiveInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 44BB8B131241A022001E3A22 /* WebArchiveInternal.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 */; }; 511F3FD50CECC88F00852565 /* WebDatabaseManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */; }; @@ -321,6 +322,8 @@ 9398112C0824BF01008DF038 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F738C9EA03FAD3DF0321FBE0 /* WebCore.framework */; }; 9398112E0824BF01008DF038 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 93D623DD051E791F002F47DD /* libicucore.dylib */; }; 9398112F0824BF01008DF038 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 830E81E005853AC000AD0891 /* Security.framework */; }; + 93E2A1A4123B0B3C009FE12A /* WebDashboardRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E2A1A2123B0B3C009FE12A /* WebDashboardRegion.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 93E2A1A5123B0B3C009FE12A /* WebDashboardRegion.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93E2A1A3123B0B3C009FE12A /* WebDashboardRegion.mm */; }; 93EB178D09F88D460091F8FF /* WebSystemInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93EB178C09F88D460091F8FF /* WebSystemInterface.mm */; }; 93EB178F09F88D510091F8FF /* WebSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EB178E09F88D510091F8FF /* WebSystemInterface.h */; }; 93FDE9330D79CAF30074F029 /* WebHistoryInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FDE9320D79CAF30074F029 /* WebHistoryInternal.h */; }; @@ -488,6 +491,7 @@ 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>"; }; + 44BB8B131241A022001E3A22 /* WebArchiveInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebArchiveInternal.h; sourceTree = "<group>"; }; 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebEditorClient.h; sourceTree = "<group>"; }; 4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEditorClient.mm; sourceTree = "<group>"; }; 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseManager.mm; sourceTree = "<group>"; }; @@ -627,6 +631,8 @@ 93C6F14507920B93002449CD /* WebFrameViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameViewPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 93D1FE13067EB10B009CE68A /* WebNSObjectExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSObjectExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 93D623DD051E791F002F47DD /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = "<absolute>"; }; + 93E2A1A2123B0B3C009FE12A /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; }; + 93E2A1A3123B0B3C009FE12A /* WebDashboardRegion.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDashboardRegion.mm; sourceTree = "<group>"; }; 93EB178C09F88D460091F8FF /* WebSystemInterface.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSystemInterface.mm; sourceTree = "<group>"; }; 93EB178E09F88D510091F8FF /* WebSystemInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSystemInterface.h; sourceTree = "<group>"; }; 93FDE9320D79CAF30074F029 /* WebHistoryInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryInternal.h; sourceTree = "<group>"; }; @@ -1142,25 +1148,28 @@ 9C7CABBB0190A37C0ECA16EA /* WebView */ = { isa = PBXGroup; children = ( - 598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */, - 598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */, - 598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */, - 598AD9251201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h */, - 598AD9231201CF1900ABAE4E /* WebDeviceOrientationInternal.h */, - 598AD9211201CF1000ABAE4E /* WebDeviceOrientation.mm */, - 598AD91F1201CF0700ABAE4E /* WebDeviceOrientation.h */, F52CA6BD02DF9D0F018635CA /* HTML */, 51E94C0706C02CA300A9B09E /* PDF */, 8373435A0624EE0D00F3B289 /* WebArchive.h */, 8373435B0624EE0D00F3B289 /* WebArchive.mm */, + 44BB8B131241A022001E3A22 /* WebArchiveInternal.h */, 933D659903413FF2008635CE /* WebClipView.h */, 933D659A03413FF2008635CE /* WebClipView.mm */, + 93E2A1A2123B0B3C009FE12A /* WebDashboardRegion.h */, + 93E2A1A3123B0B3C009FE12A /* WebDashboardRegion.mm */, 39446070020F50ED0ECA1767 /* WebDataSource.h */, 39446071020F50ED0ECA1767 /* WebDataSource.mm */, 658A40950A14853B005E6987 /* WebDataSourceInternal.h */, 39446072020F50ED0ECA1767 /* WebDataSourcePrivate.h */, BC542C400FD7766F00D8AB5D /* WebDelegateImplementationCaching.h */, BC542C410FD7766F00D8AB5D /* WebDelegateImplementationCaching.mm */, + 598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */, + 598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */, + 598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */, + 598AD9251201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h */, + 598AD9231201CF1900ABAE4E /* WebDeviceOrientationInternal.h */, + 598AD9211201CF1000ABAE4E /* WebDeviceOrientation.mm */, + 598AD91F1201CF0700ABAE4E /* WebDeviceOrientation.h */, 35081DAE02B6D4F50ACA2ACA /* WebDocument.h */, ED21B9810528F7AA003299AC /* WebDocumentInternal.h */, 65FFB7FA0AD0B7D30048CD05 /* WebDocumentLoaderMac.h */, @@ -1425,6 +1434,7 @@ E169836211346D1B00894115 /* ProxyRuntimeObject.h in Headers */, B6CE5C25100BC5F500219936 /* WebApplicationCache.h in Headers */, 9398109A0824BF01008DF038 /* WebArchive.h in Headers */, + 44BB8B141241A022001E3A22 /* WebArchiveInternal.h in Headers */, 5DE92FEF0BD7017E0059A5FD /* WebAssertions.h in Headers */, 939810290824BF01008DF038 /* WebAuthenticationPanel.h in Headers */, 939810110824BF01008DF038 /* WebBackForwardList.h in Headers */, @@ -1622,6 +1632,7 @@ 598AD9261201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h in Headers */, 598AD92A1201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h in Headers */, 598ADA461202275000ABAE4E /* WebDeviceOrientationProvider.h in Headers */, + 93E2A1A4123B0B3C009FE12A /* WebDashboardRegion.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1988,6 +1999,7 @@ 598AD91E1201CECF00ABAE4E /* WebDeviceOrientationClient.mm in Sources */, 598AD9221201CF1000ABAE4E /* WebDeviceOrientation.mm in Sources */, 598AD9281201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm in Sources */, + 93E2A1A5123B0B3C009FE12A /* WebDashboardRegion.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog index e9f6354..dd23f6f 100644 --- a/WebKit/chromium/ChangeLog +++ b/WebKit/chromium/ChangeLog @@ -1,3 +1,961 @@ +2010-09-20 Darin Adler <darin@apple.com> + + Reviewed by James Robinson. + + Deprecate the inputType function on HTMLInputElement + https://bugs.webkit.org/show_bug.cgi?id=46023 + + * src/WebInputElement.cpp: + (WebKit::WebInputElement::inputType): + * src/WebPasswordFormUtils.cpp: + (WebKit::findPasswordFormFields): + * src/WebSearchableFormData.cpp: + (WebCore::HasSuitableTextElement): + Use deprecatedInputType instead of inputType. + +2010-09-20 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + [chromium] Change compositor to use GraphicsContext3D rather than GLES2Context + https://bugs.webkit.org/show_bug.cgi?id=45912 + + Switched Chromium's compositor to use GraphicsContext3D to issue + its OpenGL rendering calls rather than the Chromium-specific + GLES2Context and command buffer OpenGL implementation. + + The in-process software rendering path for GraphicsContext3D does + not yet work with the compositor, at least not on Mac OS X. This + will be worked on in subsequent bugs. + + Tested manually with 3D CSS, WebGL and video content on Mac OS X + and Linux. No new tests. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::initialize): + (WebCore::GraphicsContext3DInternal::extractWebGraphicsContext3D): + (WebCore::GraphicsContext3D::create): + * src/GraphicsContext3DInternal.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::resize): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit::WebViewImpl::gles2Context): + (WebKit::WebViewImpl::graphicsContext3D): + * src/WebViewImpl.h: + +2010-09-20 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + [chromium] Roll forward Chromium DEPS to pick up WebGraphicsContext3D implementation changes + https://bugs.webkit.org/show_bug.cgi?id=46115 + + * DEPS: + +2010-09-20 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: merge Inspector client runtime events into the serialized inspector state object. + + Drive-by rename getBackendSettings -> getInspectorState to better reflect the nature of the data. + + https://bugs.webkit.org/show_bug.cgi?id=45974 + + * src/InspectorClientImpl.cpp: + (WebKit::InspectorClientImpl::updateInspectorStateCookie): + * src/InspectorClientImpl.h: + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setRuntimeProperty): + (WebKit::WebDevToolsAgentImpl::setApuAgentEnabled): + (WebKit::WebDevToolsAgentImpl::updateInspectorStateCookie): + * src/WebDevToolsAgentImpl.h: + +2010-09-19 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r67749. + http://trac.webkit.org/changeset/67749 + https://bugs.webkit.org/show_bug.cgi?id=46068 + + breaking ToT chromium canary build (Requested by shans on + #webkit). + + * public/WebFrameClient.h: + * public/WebScriptController.h: + * src/FrameLoaderClientImpl.cpp: + * src/FrameLoaderClientImpl.h: + * src/WebScriptController.cpp: + (WebKit::WebScriptController::registerExtension): + +2010-09-19 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [Chromium] Add is<input type>() functions to WebInputElement + https://bugs.webkit.org/show_bug.cgi?id=46035 + + We're going to stop exposing HTMLInputElemnt::InputType. So, add + isFoo() functions in order to remove WebInputElement::InputType. + + * public/WebInputElement.h: + * src/WebInputElement.cpp: + (WebKit::WebInputElement::isTextField): + (WebKit::WebInputElement::isText): + (WebKit::WebInputElement::isPasswordField): + (WebKit::WebInputElement::isImageButton): + +2010-09-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (r60104): Zoom level is unexpectedly reset on page reload + https://bugs.webkit.org/show_bug.cgi?id=42863 + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::createPlugin): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setZoomLevel): + Call functions on Frame instead of FrameView. + +2010-09-17 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + [chromium] Roll forward Chromium DEPS to pick up Mesa DRT changes + https://bugs.webkit.org/show_bug.cgi?id=46006 + + * DEPS: + +2010-09-17 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + [chromium] Add mesa as DumpRenderTree dependency + https://bugs.webkit.org/show_bug.cgi?id=46001 + + * WebKit.gyp: + +2010-09-13 Matt Perry <mpcomplete@chromium.org> + + Reviewed by Darin Fisher. + + Have V8DOMWindowShell ask the embedder whether to run a V8 extension + in a particular script context. + https://bugs.webkit.org/show_bug.cgi?id=45721 + + * public/WebFrameClient.h: + (WebKit::WebFrameClient::allowScriptExtension): + * public/WebScriptController.h: + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::allowScriptExtension): + * src/FrameLoaderClientImpl.h: + * src/WebScriptController.cpp: + (WebKit::WebScriptController::registerExtension): + +2010-09-17 Eric Uhrhane <ericu@chromium.org> + + Reviewed by David Levin. + + Remove unimplemented destructor declaration to fix Chromium build. + https://bugs.webkit.org/show_bug.cgi?id=45987 + + * src/AsyncFileWriterChromium.h: + +2010-09-16 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r67693. + http://trac.webkit.org/changeset/67693 + https://bugs.webkit.org/show_bug.cgi?id=45946 + + "Need to pick up a chromium change first" (Requested by dumi + on #webkit). + + * public/WebHTTPBody.h: + * src/WebHTTPBody.cpp: + (WebKit::WebHTTPBody::elementAt): + (WebKit::WebHTTPBody::appendFileRange): + +2010-09-15 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Darin Fisher. + + Remove WebHTTPBody::appendFileRange(..., const WebFileInfo&). + + * public/WebHTTPBody.h: + * src/WebHTTPBody.cpp: + (WebKit::WebHTTPBody::elementAt): + +2010-09-16 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + Add entry points to GraphicsContext3D needed for Chromium compositor port + https://bugs.webkit.org/show_bug.cgi?id=45939 + + Added entry points for two Chromium-specific extensions, and added + a flag to the GraphicsContext3D constructor, currently unsupported + by all ports (including Chromium), indicating whether the context + should render directly to the passed HostWindow or off-screen per + the current semantics. The switch to use GraphicsContext3D in + Chromium's compositor will follow in a subsequent patch. + + No new tests; functionality is unchanged. Built and tested + Chromium and WebKit on Mac OS X. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3D::GraphicsContext3D): + (WebCore::GraphicsContext3D::create): + * src/GraphicsContext3DInternal.h: + +2010-09-16 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + [chromium] Add needed entry points to WebGraphicsContext3D for compositor + https://bugs.webkit.org/show_bug.cgi?id=45921 + + * public/WebGraphicsContext3D.h: + * src/WebGraphicsContext3DDefaultImpl.cpp: + (WebKit::WebGraphicsContext3DDefaultImpl::initialize): + (WebKit::WebGraphicsContext3DDefaultImpl::supportsMapSubCHROMIUM): + (WebKit::WebGraphicsContext3DDefaultImpl::mapBufferSubDataCHROMIUM): + (WebKit::WebGraphicsContext3DDefaultImpl::unmapBufferSubDataCHROMIUM): + (WebKit::WebGraphicsContext3DDefaultImpl::mapTexSubImage2DCHROMIUM): + (WebKit::WebGraphicsContext3DDefaultImpl::unmapTexSubImage2DCHROMIUM): + (WebKit::WebGraphicsContext3DDefaultImpl::supportsCopyTextureToParentTextureCHROMIUM): + (WebKit::WebGraphicsContext3DDefaultImpl::copyTextureToParentTextureCHROMIUM): + * src/WebGraphicsContext3DDefaultImpl.h: + +2010-09-15 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [Chromium] Needs DRT queueLoadHTMLString and setDeferMainResourceLoad-implementations + https://bugs.webkit.org/show_bug.cgi?id=42151 + + * public/WebDataSource.h: + * src/WebDataSourceImpl.cpp: + (WebKit::WebDataSourceImpl::applicationCacheHost): + (WebKit::WebDataSourceImpl::setDeferMainResourceDataLoad): Added so DRT can set this flag before a load. + * src/WebDataSourceImpl.h: + +2010-09-16 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + Roll forward Chromium DEPS to r59706 + https://bugs.webkit.org/show_bug.cgi?id=45916 + + * DEPS: + +2010-09-16 Darin Adler <darin@apple.com> + + Reviewed by Andreas Kling. + + Reduce use of HTMLInputElement::inputType so we can remove it later + https://bugs.webkit.org/show_bug.cgi?id=45903 + + * src/DOMUtilitiesPrivate.cpp: + (WebKit::elementHasLegalLinkAttribute): Use isImageButton. + * src/WebPasswordFormUtils.cpp: + (WebKit::findPasswordFormFields): Use isPasswordField. + * src/WebSearchableFormData.cpp: + (WebCore::IsInDefaultState): Use isCheckbox and isRadioButton. + (WebCore::HasSuitableTextElement): Use isFileUpload and isPasswordField. + +2010-09-16 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + [chromium] Expose separate GraphicsContext3DInternal.h + https://bugs.webkit.org/show_bug.cgi?id=45914 + + * WebKit.gyp: + * src/GraphicsContext3D.cpp: + * src/GraphicsContext3DInternal.h: Added. + +2010-09-16 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + [chromium] Add WebGraphicsContext3D accessor to WebView + https://bugs.webkit.org/show_bug.cgi?id=45913 + + * public/WebView.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::graphicsContext3D): + * src/WebViewImpl.h: + +2010-09-16 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: move resourceTracking flag under control of BackendSettings. + + Four Inspector API methods about resourceTracking flag were removed. + Actual state of the flag is transfered as the response of setResourceTracking request. + Initial state of the flag on the frontend side is obtained from settings.backend. + + https://bugs.webkit.org/show_bug.cgi?id=45887 + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setRuntimeProperty): + (WebKit::WebDevToolsAgentImpl::setApuAgentEnabled): + +2010-09-16 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: [REGRESSION] Scripts disappear from scripts panel after navigation + https://bugs.webkit.org/show_bug.cgi?id=45890 + + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::setRuntimeProperty): make sure debugger and profiler + are initialized when inspected page navigation leads to renderer process change. + +2010-09-16 Eric Uhrhane <ericu@chromium.org> + + Reviewed by Jian Li. + + Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM. + https://bugs.webkit.org/show_bug.cgi?id=45798 + + * src/AsyncFileWriterChromium.h: + * src/AsyncFileWriterChromium.cpp: + +2010-09-16 Nat Duca <nduca@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Make compositor obey finish flag + https://bugs.webkit.org/show_bug.cgi?id=45552 + + The compositor should obey the finish flag on doComposite. This + flag causes the compositor to finish rendering before returning, + which is needed when resizing the window to avoid flashes of green. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::composite): + +2010-09-15 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Allow the embedder to specify the base path for IndexedDB. + https://bugs.webkit.org/show_bug.cgi?id=45815 + + Need to add the extra .open() parameter to make this all work. + + * public/WebIDBFactory.h: + (WebKit::WebIDBFactory::open): + * src/IDBFactoryBackendProxy.cpp: + (WebCore::IDBFactoryBackendProxy::open): + * src/IDBFactoryBackendProxy.h: + * src/WebIDBFactoryImpl.cpp: + (WebKit::WebIDBFactoryImpl::open): + * src/WebIDBFactoryImpl.h: + +2010-09-16 Jeremy Orlow <jorlow@chromium.org> + + Speculative build fix. + + * src/IDBIndexBackendProxy.cpp: + +2010-09-08 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Complete index support for IndexedDB + https://bugs.webkit.org/show_bug.cgi?id=45386 + + * public/WebIDBCursor.h: + (WebKit::WebIDBCursor::direction): + (WebKit::WebIDBCursor::key): + (WebKit::WebIDBCursor::value): + (WebKit::WebIDBCursor::update): + (WebKit::WebIDBCursor::continueFunction): + (WebKit::WebIDBCursor::remove): + * public/WebIDBIndex.h: + (WebKit::WebIDBIndex::storeName): + (WebKit::WebIDBIndex::openObjectCursor): + (WebKit::WebIDBIndex::openCursor): + (WebKit::WebIDBIndex::getObject): + (WebKit::WebIDBIndex::get): + * public/WebIDBKey.h: + * src/IDBCursorBackendProxy.cpp: + (WebCore::IDBCursorBackendProxy::value): + * src/IDBCursorBackendProxy.h: + * src/IDBIndexBackendProxy.cpp: + (WebCore::IDBIndexBackendProxy::storeName): + (WebCore::IDBIndexBackendProxy::openObjectCursor): + (WebCore::IDBIndexBackendProxy::openCursor): + (WebCore::IDBIndexBackendProxy::getObject): + (WebCore::IDBIndexBackendProxy::get): + * src/IDBIndexBackendProxy.h: + * src/WebIDBCursorImpl.cpp: + (WebKit::WebIDBCursorImpl::value): + * src/WebIDBCursorImpl.h: + * src/WebIDBIndexImpl.cpp: + (WebKit::WebIDBIndexImpl::storeName): + (WebKit::WebIDBIndexImpl::openCursor): + (WebKit::WebIDBIndexImpl::openObjectCursor): + (WebKit::WebIDBIndexImpl::getObject): + (WebKit::WebIDBIndexImpl::get): + * src/WebIDBIndexImpl.h: + +2010-09-15 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Darin Fisher. + + Overload WebHTTPBody::appendFileRange() to take a double modification time argument. + https://bugs.webkit.org/show_bug.cgi?id=45829 + + The plan is to change all callers of + WebHTTPBody::appendFileRange(..., const WebFileInfo&) to use the + new method, and then remove it. + + * public/WebHTTPBody.h: + * src/WebHTTPBody.cpp: + (WebKit::WebHTTPBody::elementAt): + (WebKit::WebHTTPBody::appendFileRange): + +2010-09-14 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Provide network-based load timing. + Before this change, inspector used timers taken from + within WebCore notifications (that are by definition + synchronous and serialized). As a result, timing was + affected by the routines running on the main thread + (JavaScript and such). + https://bugs.webkit.org/show_bug.cgi?id=45664 + + * public/WebURLLoadTiming.h: + * public/WebURLLoaderClient.h: + (WebKit::WebURLLoaderClient::didFinishLoading): + * src/ResourceHandle.cpp: + (WebCore::ResourceHandleInternal::didFinishLoading): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::didFinishLoading): + * src/WebURLLoadTiming.cpp: + (WebKit::WebURLLoadTiming::receiveHeadersStart): + (WebKit::WebURLLoadTiming::setReceiveHeadersStart): + +2010-09-15 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r67551. + http://trac.webkit.org/changeset/67551 + https://bugs.webkit.org/show_bug.cgi?id=45816 + + "Plugin tests fail" (Requested by yurys on #webkit). + + * public/WebURLLoaderClient.h: + (WebKit::WebURLLoaderClient::didFinishLoading): + * src/ResourceHandle.cpp: + (WebCore::ResourceHandleInternal::didFinishLoading): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::didFinishLoading): + +2010-09-14 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Provide network-based load timing. + Before this change, inspector used timers taken from + within WebCore notifications (that are by definition + synchronous and serialized). As a result, timing was + affected by the routines running on the main thread + (JavaScript and such). + https://bugs.webkit.org/show_bug.cgi?id=45664 + + * public/WebURLLoadTiming.h: + * public/WebURLLoaderClient.h: + (WebKit::WebURLLoaderClient::didFinishLoading): + * src/ResourceHandle.cpp: + (WebCore::ResourceHandleInternal::didFinishLoading): + * src/WebDevToolsAgentImpl.cpp: + (WebKit::WebDevToolsAgentImpl::didFinishLoading): + * src/WebURLLoadTiming.cpp: + (WebKit::WebURLLoadTiming::receiveHeadersStart): + (WebKit::WebURLLoadTiming::setReceiveHeadersStart): + +2010-09-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r67503. + http://trac.webkit.org/changeset/67503 + https://bugs.webkit.org/show_bug.cgi?id=45802 + + This patch broke GTK builds (Requested by jianli_ on #webkit). + + * src/ResourceHandle.cpp: + +2010-09-14 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Links from "Profiles" don't lead to "Scripts" + https://bugs.webkit.org/show_bug.cgi?id=45756 + + * src/js/DevTools.js: remove obsolete code + +2010-09-14 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] fix http/tests/security/local-user-CSS-from-remote.html + https://bugs.webkit.org/show_bug.cgi?id=45788 + + * DEPS: Include webkit_support::LocalFileToDataURL + +2010-09-14 Tony Chang <tony@chromium.org> + + Reviewed by Ojan Vafai. + + [chromium] Remove WebKit::areLayoutTestImagesOpaque since it's no longer needed + https://bugs.webkit.org/show_bug.cgi?id=45768 + + * public/WebKit.h: + * src/WebKit.cpp: + +2010-09-14 Mihai Parparita <mihaip@chromium.org> + + Reviewed by Tony Chang. + + blob: URL scheme does not work with Chromium DRT + https://bugs.webkit.org/show_bug.cgi?id=45772 + + Roll Chromium forward to r59406, which registers the blob + URL scheme for the Chromium DRT too. + + * DEPS: + +2010-09-14 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + fast/files/apply-blob-url-to-img.html timeout on Leopard + https://bugs.webkit.org/show_bug.cgi?id=45576 + + * src/ResourceHandle.cpp: Remove the no longer applicable static comment. + +2010-09-14 Chris Guillory <chris.guillory@google.com> + + Reviewed by Chris Fleizach. + + Send all accessibility notifications to Chromium. + https://bugs.webkit.org/show_bug.cgi?id=45156 + + Use postAccessibilityNotification to pass accessibility notifications + to chromium. + + * WebKit.gyp: + * public/WebAccessibilityNotification.h: Added. + * public/WebViewClient.h: + (WebKit::WebViewClient::postAccessibilityNotification): + * src/AssertMatchingEnums.h: Added. + * src/ChromeClientImpl.cpp: + (WebKit::toWebAccessibilityNotification): + (WebKit::ChromeClientImpl::didChangeAccessibilityObjectChildren): + (WebKit::ChromeClientImpl::postAccessibilityNotification): + * src/ChromeClientImpl.h: + +2010-09-14 Tony Chang <tony@chromium.org> + + Unreviewed, fix chromium win compile. + + * public/WebView.h: + +2010-09-14 Tony Chang <tony@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] implement layoutTestController.setDomainRelaxationForbiddenForURLScheme + https://bugs.webkit.org/show_bug.cgi?id=45762 + + * public/WebView.h: add WebView::setDomainRelaxationForbidden + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setDomainRelaxationForbidden): + * src/WebViewImpl.h: + +2010-09-14 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Andreas Kling. + + Move DebuggerScript.js from WebKit/chromium/src/js to WebCore/bindings/v8 + https://bugs.webkit.org/show_bug.cgi?id=45739 + + * WebKit.grd: + * WebKit.gypi: + * src/js/DebuggerScript.js: Removed. + * src/js/DevToolsHostStub.js: Removed. + +2010-09-14 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + Make WebDeviceOrientationClientMock constructor private. + https://bugs.webkit.org/show_bug.cgi?id=45743 + + Clients should use the create member function instead. DumpRenderTree + and the Chromium test_shell have previously been updated to call create. + + * public/WebDeviceOrientationClientMock.h: + (WebKit::WebDeviceOrientationClientMock::WebDeviceOrientationClientMock): + +2010-09-13 Eric Uhrhane <ericu@chromium.org> + + Reviewed by Darin Fisher. + + Add Chromium API for FileWriter + https://bugs.webkit.org/show_bug.cgi?id=44360 + + Build file changes. + * WebKit.gyp: + + Added a way to get a WebFileWriter. + * public/WebFileSystem.h: + (WebKit::WebFileSystem::createFileWriter): + + WebFileWriter writes and truncates files. + * public/WebFileWriter.h: Added. + + WebFileWriterClient reports success/failure and progress events. + * public/WebFileWriterClient.h: Added. + + AsyncFileWriterChromium is a connector that links FileWriter and WebFileWriter, FileWriterClient and WebFileWriterClient. + * src/AsyncFileWriterChromium.cpp: Added. + * src/AsyncFileWriterChromium.h: Added. + +2010-09-13 W. James MacLean <wjmaclean@google.com> + + Reviewed by Darin Fisher. + + [chromium] Thumbnails not generated for GPU Rendered Pages + https://bugs.webkit.org/show_bug.cgi?id=44127 + + Modified WebViewImpl::paint() to detect non-null canvas pointers when + accelerated compositing is active, and instead fills the pixel buffer + from the GPU framebuffer. Includes re-scaling support when provided + canvas does not match size of current render layer. Limits pixel + readback to rect passed to paint(), clipped by size of rootLayerTexture. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::doPixelReadbackToCanvas): + (WebKit::WebViewImpl::paint): + * src/WebViewImpl.h: + +2010-09-13 James Robinson <jamesr@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] Return NULL from getSharedGraphicsContext3D if we couldn't initialize + https://bugs.webkit.org/show_bug.cgi?id=45731 + + If we can't create a GraphicsContext3D, return NULL from getSharedGraphicsContext3D rather + than an object with NULL internal pointers. Callers know how to handle a null return value + but not one that has inconsistent internal state. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::getSharedGraphicsContext3D): + +2010-09-13 Chris Guillory <chris.guillory@google.com> + + Reviewed by Chris Fleizach. + + WebAccessibilityCacheImpl needs to handle invalid accessibility object ids. + https://bugs.webkit.org/show_bug.cgi?id=45572 + + * public/WebAccessibilityObject.h: + * src/WebAccessibilityCacheImpl.cpp: + (WebKit::WebAccessibilityCacheImpl::addOrGetId): + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::isAxObjectIdValid): + +2010-09-13 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Dimitri Glazkov. + + [Chromium] fix broken dependency in ImageDiff + https://bugs.webkit.org/show_bug.cgi?id=45684 + + * WebKit.gyp: + +2010-09-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Paste should be implemented in WebCore like Copy and Cut for Mac also. + https://bugs.webkit.org/show_bug.cgi?id=45494 + <rdar://problem/7660537> + + On the Mac platform, the implementation of the paste operation is all done + at the WebKit level. In order to support it on WebKit2 it is necessary to + refactor the code and move this functionality at the level of WebCore like + we already have on Windows. + The original code relies on some in AppKit functions that call back into + WebKit causing problems in WebKit2. All this functionality has been moved + at the level of the editor client where it can be dealt with appropriately. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::canShowMIMETypeAsHTML): Added stub. + * src/FrameLoaderClientImpl.h: + +2010-09-13 Jonathan Dixon <joth@chromium.org> + + Reviewed by Steve Block. + + [chromium] Port test shell geolocation fixes to DRT + https://bugs.webkit.org/show_bug.cgi?id=45313 + + Ports over fixes from test shell: + - http://codereview.chromium.org/3294007 + - http://codereview.chromium.org/333800 + + Resets state between service instances, which fixes delayed-permission-allowed-for-multiple-requests.html + + Also re-apply rolled out patch http://trac.webkit.org/changeset/66886 :- + Access to out-of-scope WebGeolocationServiceBridgeImpl + https://bugs.webkit.org/show_bug.cgi?id=45112 + + Keep the WebGeolocationService pointer for lifetime of the bridge, to + ensure it can be detached reliably + + Includes follow-up review comment to rename onWebGeolocationServiceDestroyed to didDestroyGeolocationService + + * public/WebGeolocationService.h: + (WebKit::WebGeolocationService::~WebGeolocationService): + * public/WebGeolocationServiceBridge.h: + (WebKit::WebGeolocationServiceBridge::onWebGeolocationServiceDestroyed): + * public/WebGeolocationServiceMock.h: + * src/WebGeolocationServiceBridgeImpl.cpp: + (WebKit::WebGeolocationServiceBridgeImpl::WebGeolocationServiceBridgeImpl): + (WebKit::WebGeolocationServiceBridgeImpl::~WebGeolocationServiceBridgeImpl): + (WebKit::WebGeolocationServiceBridgeImpl::startUpdating): + (WebKit::WebGeolocationServiceBridgeImpl::stopUpdating): + (WebKit::WebGeolocationServiceBridgeImpl::suspend): + (WebKit::WebGeolocationServiceBridgeImpl::resume): + (WebKit::WebGeolocationServiceBridgeImpl::attachBridgeIfNeeded): + (WebKit::WebGeolocationServiceBridgeImpl::setIsAllowed): + (WebKit::WebGeolocationServiceBridgeImpl::setLastPosition): + (WebKit::WebGeolocationServiceBridgeImpl::setLastError): + (WebKit::WebGeolocationServiceBridgeImpl::didDestroyGeolocationService): + (WebKit::WebGeolocationServiceBridgeImpl::isAttached): + * src/WebGeolocationServiceMock.cpp: + (WebKit::WebGeolocationServiceMock::setMockGeolocationPermission): + (WebKit::WebGeolocationServiceMockImpl::WebGeolocationServiceMockImpl): + (WebKit::WebGeolocationServiceMockImpl::~WebGeolocationServiceMockImpl): + (WebKit::WebGeolocationServiceMockImpl::setMockGeolocationPermission): + (WebKit::WebGeolocationServiceMockImpl::requestPermissionForFrame): + (WebKit::WebGeolocationServiceMockImpl::notifyPendingPermissions): + +2010-09-13 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: upstream testExpandScope debugger test + https://bugs.webkit.org/show_bug.cgi?id=45260 + + * src/js/DebuggerScript.js: copy scope variables into a new object, but for global scope object, + with statement parameter and catch block exception variable pass the object itself to the injected + script. + * src/js/Tests.js: moved testExpandScope to LayoutTests + +2010-09-13 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + Add WebDeviceOrientationClientMock::create() and use it from DRT. + https://bugs.webkit.org/show_bug.cgi?id=45650 + + Since the virtual member functions of WebDeviceOrientationClientMock + are not exported from the DLL, construction of the object must be done inside + the DLL, or else the linker will complain (because the vtable cannot + be set up). Clients should use the create() member function, and the constructor + will be made private in a subsequent patch. + + * public/WebDeviceOrientationClientMock.h: + (WebKit::WebDeviceOrientationClientMock::WebDeviceOrientationClientMock): + * src/WebDeviceOrientationClientMock.cpp: + (WebKit::WebDeviceOrientationClientMock::create): + +2010-09-12 Kent Tamura <tkent@chromium.org> + + Reviewed by Tony Chang. + + [DRT/Chromium] Remove dependency to base/string16.h and gfx/codec/png_codec.h + https://bugs.webkit.org/show_bug.cgi?id=45517 + + * DEPS: Roll Chromium revision to r59033 to have webkit_support_gfx.h. + * WebKit.gyp: + +2010-09-10 MORITA Hajime <morrita@google.com> + + Reviewed by Tony Chang. + + [Chromium] Implement textInputController.hasSpellingMarker() for Chromium + https://bugs.webkit.org/show_bug.cgi?id=45441 + + Exported Frame::selectionStartHasSpellingMarkerFor() for DRT use. + + * public/WebFrame.h: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::selectionStartHasSpellingMarkerFor): + * src/WebFrameImpl.h: + +2010-09-10 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Darin Adler. + + Add NetworkingContext to avoid layer violations + https://bugs.webkit.org/show_bug.cgi?id=42292 + + * src/ResourceHandle.cpp: + (WebCore::ResourceHandle::create): + (WebCore::ResourceHandle::start): + (WebCore::ResourceHandle::loadResourceSynchronously): + +2010-09-10 Sam Weinig <sam@webkit.org> + + Fix chromium build. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setZoomLevel): + +2010-09-10 Ryosuke Niwa <rniwa@webkit.org> + + Unreviewed, speculative chromium build fix. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setZoomLevel): + +2010-09-10 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Remove unnecessary constraint in WebCore of choosing either text zoom or full page zoom. + Precursor to <rdar://problem/7660657> + https://bugs.webkit.org/show_bug.cgi?id=45522 + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::createPlugin): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::setZoomLevel): + * src/WebViewImpl.h: + (WebKit::WebViewImpl::zoomTextOnly): + Move tracking of text only zoom here from WebCore. + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Move code from WebKit-layer to DocumentLoader + https://bugs.webkit.org/show_bug.cgi?id=45569 + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::committedLoad): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::commitDocumentData): + +2010-09-10 Tony Chang <tony@chromium.org> + + Unreviewed, fix chromium compile after r67238. + + shouldChangeSelection was removed from Frame. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::selectWordAroundPosition): + +2010-09-10 Nat Duca <nduca@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Accelerated Compositing: screen garbage when scrolling + https://bugs.webkit.org/show_bug.cgi?id=45092 + + Introduce a new API on WebWidget for painting with accelerated + compositing that allows the compositor to properly distingiush + scrolling, invalidation and repainting from one another. The key + change is that in accelerated rendering case, invalidates and + scrolling pass directly to the compositor, rather than passing up + to the client as was the case in the software path. For + accelerated rendering, the previous paint() method is replaced by + composite(). + + * public/WebWidget.h: + * public/WebWidgetClient.h: + (WebKit::WebWidgetClient::scheduleComposite): + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::invalidateContentsAndWindow): + (WebKit::ChromeClientImpl::scroll): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::themeChanged): + (WebKit::WebPopupMenuImpl::composite): + * src/WebPopupMenuImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::resize): + (WebKit::WebViewImpl::paint): + (WebKit::WebViewImpl::themeChanged): + (WebKit::WebViewImpl::composite): + (WebKit::WebViewImpl::setRootGraphicsLayer): + (WebKit::WebViewImpl::setRootLayerNeedsDisplay): + (WebKit::WebViewImpl::scrollRootLayerRect): + (WebKit::WebViewImpl::invalidateRootLayerRect): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit::WebViewImpl::updateRootLayerContents): + (WebKit::WebViewImpl::doComposite): + * src/WebViewImpl.h: + * tests/PopupMenuTest.cpp: + (WebKit::TestWebWidget::themeChanged): + (WebKit::TestWebWidget::composite): + +2010-09-10 David Holloway <dhollowa@chromium.org> + + Reviewed by Adam Barth. + + Change WebKit::WebFormElement::wasUserSubmitted to use WebCore::HTMLFormElement::submittedByUserGesture + instead of WebCore::HTMLFormElement::submissionTrigger. + Chromium AutoFill feature semantics changed with respect to what we mean by "user submitted" form. A + more accurate measure of the user manually submitting a form is via user gesture. + https://bugs.webkit.org/show_bug.cgi?id=45128 + + * src/WebFormElement.cpp: + (WebKit::WebFormElement::wasUserSubmitted): + +2010-09-09 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to SelectionController as planned + https://bugs.webkit.org/show_bug.cgi?id=45508 + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::selectionBoundsRect): + Call functions on selection(). + +2010-09-10 Adam Barth <abarth@webkit.org> + + Chromium build fix (one hopes!) + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::commitDocumentData): + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Main resource bytes shouldn't bounce through FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=45496 + + Now return the bytes to the DocumentLoader. + + Also, removed comment about wrong code in the Mac port. + + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::commitDocumentData): + 2010-09-08 Darin Adler <darin@apple.com> Reviewed by Adam Barth. @@ -53,13 +1011,22 @@ * src/WebKit.cpp: (WebKit::areLayoutTestImagesOpaque): Make linux match windows. +2010-09-10 Jay Civelli <jcivelli@chromium.org> + + Reviewed by Darin Fisher. + + Add the destructor to WebDOMEvent to prevent a leak. + https://bugs.webkit.org/show_bug.cgi?id=45287 + + * public/WebDOMEvent.h: + (WebKit::WebDOMEvent::~WebDOMEvent): + 2010-09-09 Chris Guillory <chris.guillory@google.com> Reviewed by Chris Fleizach. Add methods used to determine accessibility state. https://bugs.webkit.org/show_bug.cgi?id=45434 - * public/WebAccessibilityObject.h: * src/WebAccessibilityObject.cpp: diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS index 2fc218b..17cf7b5 100644 --- a/WebKit/chromium/DEPS +++ b/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '58277', + 'chromium_rev': '59961', } deps = { diff --git a/WebKit/chromium/WebKit.grd b/WebKit/chromium/WebKit.grd index 92ee008..3b7209a 100644 --- a/WebKit/chromium/WebKit.grd +++ b/WebKit/chromium/WebKit.grd @@ -9,7 +9,7 @@ </outputs> <release seq="1"> <includes> - <include name="IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS" file="src\js\DebuggerScript.js" type="BINDATA"/> + <include name="IDR_DEVTOOLS_DEBUGGER_SCRIPT_JS" file="..\..\WebCore\bindings\v8\DebuggerScript.js" type="BINDATA"/> <include name="IDR_DEVTOOLS_INJECT_WEBKIT_JS" file="..\..\WebCore\inspector\front-end\InjectedScript.js" type="BINDATA"/> </includes> </release> diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp index 11246fa..3523f21 100644 --- a/WebKit/chromium/WebKit.gyp +++ b/WebKit/chromium/WebKit.gyp @@ -98,6 +98,7 @@ 'public/mac/WebSandboxSupport.h', 'public/mac/WebScreenInfoFactory.h', 'public/WebAccessibilityCache.h', + 'public/WebAccessibilityNotification.h', 'public/WebAccessibilityObject.h', 'public/WebAccessibilityRole.h', 'public/WebAnimationController.h', @@ -153,6 +154,8 @@ 'public/WebFileSystemCallbacks.h', 'public/WebFileSystemEntry.h', 'public/WebFileUtilities.h', + 'public/WebFileWriter.h', + 'public/WebFileWriterClient.h', 'public/WebFindOptions.h', 'public/WebFloatPoint.h', 'public/WebFloatRect.h', @@ -280,6 +283,8 @@ 'src/AssertMatchingEnums.cpp', 'src/AsyncFileSystemChromium.cpp', 'src/AsyncFileSystemChromium.h', + 'src/AsyncFileWriterChromium.cpp', + 'src/AsyncFileWriterChromium.h', 'src/AutoFillPopupMenuClient.cpp', 'src/AutoFillPopupMenuClient.h', 'src/BackForwardListClientImpl.cpp', @@ -322,6 +327,7 @@ 'src/GLES2ContextInternal.cpp', 'src/GLES2ContextInternal.h', 'src/GraphicsContext3D.cpp', + 'src/GraphicsContext3DInternal.h', 'src/gtk/WebFontInfo.cpp', 'src/gtk/WebFontInfo.h', 'src/gtk/WebInputEventFactory.cpp', @@ -781,7 +787,8 @@ 'dependencies': [ 'webkit', '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', - '<(chromium_src_dir)/gfx/gfx.gyp:gfx', + '<(chromium_src_dir)/webkit/support/webkit_support.gyp:blob', + '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', ], 'include_dirs': [ '../../JavaScriptCore', @@ -801,6 +808,7 @@ 'webkit', '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf_config', '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc', + '<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa', '<(chromium_src_dir)/webkit/support/webkit_support.gyp:blob', '<(chromium_src_dir)/webkit/support/webkit_support.gyp:copy_npapi_layout_test_plugin', '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support', diff --git a/WebKit/chromium/WebKit.gypi b/WebKit/chromium/WebKit.gypi index 4c6ac37..035015b 100644 --- a/WebKit/chromium/WebKit.gypi +++ b/WebKit/chromium/WebKit.gypi @@ -34,7 +34,6 @@ # for copying them to resource dir, and for generating 'devtools.html' file. 'devtools_js_files': [ 'src/js/DevTools.js', - 'src/js/DevToolsHostStub.js', 'src/js/Tests.js', ], 'devtools_css_files': [ diff --git a/WebKit/chromium/public/WebAccessibilityNotification.h b/WebKit/chromium/public/WebAccessibilityNotification.h new file mode 100644 index 0000000..c4a9551 --- /dev/null +++ b/WebKit/chromium/public/WebAccessibilityNotification.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * 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 WebAccessibilityNotification_h +#define WebAccessibilityNotification_h + +namespace WebKit { + +enum WebAccessibilityNotification { + WebAccessibilityNotificationActiveDescendantChanged, + WebAccessibilityNotificationCheckedStateChanged, + WebAccessibilityNotificationChildrenChanged, + WebAccessibilityNotificationFocusedUIElementChanged, + WebAccessibilityNotificationLayoutComplete, + WebAccessibilityNotificationLoadComplete, + WebAccessibilityNotificationSelectedChildrenChanged, + WebAccessibilityNotificationSelectedTextChanged, + WebAccessibilityNotificationValueChanged, + WebAccessibilityNotificationScrolledToAnchor, + WebAccessibilityNotificationLiveRegionChanged, + WebAccessibilityNotificationMenuListValueChanged, + WebAccessibilityNotificationRowCountChanged, + WebAccessibilityNotificationRowCollapsed, + WebAccessibilityNotificationRowExpanded, + WebAccessibilityNotificationInvalid +}; + +} // namespace WebKit + +#endif // WebAccessibilityNotification_h diff --git a/WebKit/chromium/public/WebAccessibilityObject.h b/WebKit/chromium/public/WebAccessibilityObject.h index 6b55376..f7c93f2 100644 --- a/WebKit/chromium/public/WebAccessibilityObject.h +++ b/WebKit/chromium/public/WebAccessibilityObject.h @@ -70,6 +70,7 @@ public: WEBKIT_API WebString actionVerb() const; WEBKIT_API bool canSetFocusAttribute() const; WEBKIT_API bool canSetValueAttribute() const; + WEBKIT_API bool isValid() const; WEBKIT_API unsigned childCount() const; diff --git a/WebKit/chromium/public/WebDOMEvent.h b/WebKit/chromium/public/WebDOMEvent.h index d34c8d4..fa02b0c 100644 --- a/WebKit/chromium/public/WebDOMEvent.h +++ b/WebKit/chromium/public/WebDOMEvent.h @@ -50,6 +50,8 @@ public: BubblingPhase = 3 }; + ~WebDOMEvent() { reset(); } + WebDOMEvent() : m_private(0) { } WebDOMEvent(const WebDOMEvent& e) : m_private(0) { assign(e); } WebDOMEvent& operator=(const WebDOMEvent& e) diff --git a/WebKit/chromium/public/WebDataSource.h b/WebKit/chromium/public/WebDataSource.h index 1aa7a98..1a8c270 100644 --- a/WebKit/chromium/public/WebDataSource.h +++ b/WebKit/chromium/public/WebDataSource.h @@ -95,6 +95,10 @@ public: // The application cache host associated with this datasource. virtual WebApplicationCacheHost* applicationCacheHost() = 0; + // Set deferMainResourceDataLoad flag on the loader. This is used for + // testing. + virtual void setDeferMainResourceDataLoad(bool) = 0; + protected: ~WebDataSource() { } }; diff --git a/WebKit/chromium/public/WebDeviceOrientationClientMock.h b/WebKit/chromium/public/WebDeviceOrientationClientMock.h index 9cbccf7..7fae792 100644 --- a/WebKit/chromium/public/WebDeviceOrientationClientMock.h +++ b/WebKit/chromium/public/WebDeviceOrientationClientMock.h @@ -36,7 +36,7 @@ namespace WebKit { class WebDeviceOrientationClientMock : public WebDeviceOrientationClient { public: - WebDeviceOrientationClientMock() { initialize(); } + WEBKIT_API static WebDeviceOrientationClientMock* create(); ~WebDeviceOrientationClientMock() { reset(); } virtual void setController(WebDeviceOrientationController*); @@ -47,6 +47,7 @@ public: WEBKIT_API void setOrientation(WebDeviceOrientation&); private: + WebDeviceOrientationClientMock() { initialize(); } WEBKIT_API void initialize(); WEBKIT_API void reset(); diff --git a/WebKit/chromium/public/WebFileSystem.h b/WebKit/chromium/public/WebFileSystem.h index 641c169..b21235d 100644 --- a/WebKit/chromium/public/WebFileSystem.h +++ b/WebKit/chromium/public/WebFileSystem.h @@ -37,6 +37,8 @@ namespace WebKit { class WebFileSystemCallbacks; +class WebFileWriter; +class WebFileWriterClient; class WebFileSystem { public: @@ -100,6 +102,10 @@ public: // WebFileSystemCallbacks::didFail() must be called otherwise. virtual void readDirectory(const WebString& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + // Creates a WebFileWriter that can be used to write to the given file. + // This is a fast, synchronous call, and should not stat the filesystem. + virtual WebFileWriter* createFileWriter(const WebString& path, WebFileWriterClient*) { WEBKIT_ASSERT_NOT_REACHED(); return 0; } + protected: virtual ~WebFileSystem() { } }; diff --git a/WebKit/chromium/public/WebFileWriter.h b/WebKit/chromium/public/WebFileWriter.h new file mode 100644 index 0000000..9cde098 --- /dev/null +++ b/WebKit/chromium/public/WebFileWriter.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * 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 WebFileWriter_h +#define WebFileWriter_h + +#include "WebCommon.h" +#include "WebString.h" + +namespace WebKit { + +class WebURL; + +class WebFileWriter { +public: + virtual ~WebFileWriter() { } + + // Only one write or one truncate operation can be in progress at a time. + // These functions are asynchronous and will report results through the WebFileWriter's associated WebFileWriterClient. + virtual void write(long long position, const WebURL& blobURL) = 0; + virtual void truncate(long long length) = 0; + + // Cancel will attempt to abort a running write or truncate. However, it may not be possible to cancel an in-progress action, or the call may have come in too late. Partial writes are possible. + // Do not call cancel when there is no write or truncate in progress. + virtual void cancel() = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/public/WebFileWriterClient.h index d3333e2..d371582 100644 --- a/WebKit/chromium/src/js/DevToolsHostStub.js +++ b/WebKit/chromium/public/WebFileWriterClient.h @@ -28,11 +28,30 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/** - * @fileoverview These stubs emulate backend functionality and allows - * DevTools frontend to function as a standalone web app. - */ +#ifndef WebFileWriterClient_h +#define WebFileWriterClient_h + +#include "WebCommon.h" +#include "WebFileError.h" + +namespace WebKit { + +class WebFileWriterClient { +public: + // Called for each chunk of a write, to indicate progress. + // On the final chunk, when the write is finished, complete will be true. + virtual void didWrite(long long bytes, bool complete) = 0; + + // Called once when the truncate completes successfully. + virtual void didTruncate(long long length) = 0; + + // Called if the write or truncate fails, or if it is cancelled before the write or truncate completes. Completion of an operation will be signalled exactly once, either by didFail, didTruncate, or didWrite(..., true). + virtual void didFail(WebFileError) = 0; + +protected: + virtual ~WebFileWriterClient() { } +}; + +} // namespace WebKit -if (!window["RemoteDebuggerCommandExecutor"]) { - window["RemoteDebuggerCommandExecutor"] = {}; -} +#endif diff --git a/WebKit/chromium/public/WebFrame.h b/WebKit/chromium/public/WebFrame.h index d8eca6a..6725f58 100644 --- a/WebKit/chromium/public/WebFrame.h +++ b/WebKit/chromium/public/WebFrame.h @@ -533,6 +533,9 @@ public: // empty ((0,0), (0,0)). virtual WebRect selectionBoundsRect() const = 0; + // Only for testing purpose: + // Returns true if selection.anchorNode has a marker on range from |from| with |length|. + virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const = 0; protected: ~WebFrame() { } }; diff --git a/WebKit/chromium/public/WebGeolocationService.h b/WebKit/chromium/public/WebGeolocationService.h index ed8c4e8..ea91b58 100644 --- a/WebKit/chromium/public/WebGeolocationService.h +++ b/WebKit/chromium/public/WebGeolocationService.h @@ -31,10 +31,9 @@ #ifndef WebGeolocationService_h #define WebGeolocationService_h -#include "WebGeolocationServiceBridge.h" - namespace WebKit { +class WebGeolocationServiceBridge; class WebString; class WebURL; @@ -50,10 +49,14 @@ public: // Attaches the WebGeolocationServiceBridge to the embedder and returns its // id, which should be used on subsequent calls for the methods above. + // An ID of zero indicates the attach failed. virtual int attachBridge(WebGeolocationServiceBridge*) { return 0; } // Detaches the WebGeolocationServiceBridge from the embedder. virtual void detachBridge(int bridgeId) { } + +protected: + virtual ~WebGeolocationService() {} }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebGeolocationServiceBridge.h b/WebKit/chromium/public/WebGeolocationServiceBridge.h index 422b32b..d209c23 100644 --- a/WebKit/chromium/public/WebGeolocationServiceBridge.h +++ b/WebKit/chromium/public/WebGeolocationServiceBridge.h @@ -47,7 +47,11 @@ public: virtual void setIsAllowed(bool allowed) = 0; virtual void setLastPosition(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, long long timestamp) = 0; virtual void setLastError(int errorCode, const WebString& message) = 0; - virtual void onWebGeolocationServiceDestroyed() = 0; + // Called when the WebGeolocationService to which this bridge is attached is going out of scope. On receiving + // this call the bridge implementation must not make any further access to the service. + virtual void didDestroyGeolocationService() = 0; + // FIXME: Remove this badly named method when all callers are using didDestroyGeolocationService directly. + void onWebGeolocationServiceDestroyed() { didDestroyGeolocationService(); } protected: virtual ~WebGeolocationServiceBridge() {} diff --git a/WebKit/chromium/public/WebGeolocationServiceMock.h b/WebKit/chromium/public/WebGeolocationServiceMock.h index 407fe9d..820975e 100644 --- a/WebKit/chromium/public/WebGeolocationServiceMock.h +++ b/WebKit/chromium/public/WebGeolocationServiceMock.h @@ -44,9 +44,6 @@ public: WEBKIT_API static void setMockGeolocationPermission(bool allowed); WEBKIT_API static void setMockGeolocationPosition(double latitude, double longitude, double accuracy); WEBKIT_API static void setMockGeolocationError(int errorCode, const WebString& message); - -protected: - static bool s_mockGeolocationPermission; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebGraphicsContext3D.h b/WebKit/chromium/public/WebGraphicsContext3D.h index 44a0498..9857174 100644 --- a/WebKit/chromium/public/WebGraphicsContext3D.h +++ b/WebKit/chromium/public/WebGraphicsContext3D.h @@ -83,6 +83,11 @@ public: // Initializes the graphics context; should be the first operation performed // on newly-constructed instances. Returns true on success. + virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) = 0; + + // Initializes the graphics context; should be the first operation performed + // on newly-constructed instances. Returns true on success. + // FIXME: remove this entry point once the compositor is switched to use GraphicsContext3D. virtual bool initialize(Attributes, WebView*) = 0; // Makes the OpenGL context current on the current thread. Returns true on @@ -134,8 +139,20 @@ public: // getError in the order they were added. virtual void synthesizeGLError(unsigned long error) = 0; + // EXT_texture_format_BGRA8888 virtual bool supportsBGRA() = 0; + // GL_CHROMIUM_map_sub + virtual bool supportsMapSubCHROMIUM() = 0; + virtual void* mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access) = 0; + virtual void unmapBufferSubDataCHROMIUM(const void*) = 0; + virtual void* mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access) = 0; + virtual void unmapTexSubImage2DCHROMIUM(const void*) = 0; + + // GL_CHROMIUM_copy_texture_to_parent_texture + virtual bool supportsCopyTextureToParentTextureCHROMIUM() = 0; + virtual void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture) = 0; + // The entry points below map directly to the OpenGL ES 2.0 API. // See: http://www.khronos.org/registry/gles/ // and: http://www.khronos.org/opengles/sdk/docs/man/ diff --git a/WebKit/chromium/public/WebHTTPBody.h b/WebKit/chromium/public/WebHTTPBody.h index a2bb5cd..6e45bf6 100644 --- a/WebKit/chromium/public/WebHTTPBody.h +++ b/WebKit/chromium/public/WebHTTPBody.h @@ -54,7 +54,9 @@ public: WebString filePath; long long fileStart; long long fileLength; // -1 means to the end of the file. + // FIXME: remove this field once all users of Element have been switched to use 'modificationTime'. WebFileInfo fileInfo; + double modificationTime; WebURL blobURL; }; @@ -85,6 +87,8 @@ public: WEBKIT_API void appendData(const WebData&); WEBKIT_API void appendFile(const WebString&); // Passing -1 to fileLength means to the end of the file. + WEBKIT_API void appendFileRange(const WebString&, long long fileStart, long long fileLength, double modificationTime); + // FIXME: Remove this method once all callers have been switched to use the method above. WEBKIT_API void appendFileRange(const WebString&, long long fileStart, long long fileLength, const WebFileInfo&); WEBKIT_API void appendBlob(const WebURL&); diff --git a/WebKit/chromium/public/WebIDBCursor.h b/WebKit/chromium/public/WebIDBCursor.h index 27eb924..f47a44c 100644 --- a/WebKit/chromium/public/WebIDBCursor.h +++ b/WebKit/chromium/public/WebIDBCursor.h @@ -44,33 +44,30 @@ public: WEBKIT_ASSERT_NOT_REACHED(); return 0; } - virtual WebIDBKey key() const { WEBKIT_ASSERT_NOT_REACHED(); - return WebIDBKey(""); + return WebIDBKey::createInvalid(); } - + // FIXME: Remove the legacy version of value() (the first version) as soon as a WebKit roll happens. virtual WebSerializedScriptValue value() const { - WEBKIT_ASSERT_NOT_REACHED(); - return WebSerializedScriptValue(); - } - - virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*) - { - WEBKIT_ASSERT_NOT_REACHED(); + WebSerializedScriptValue serializedScriptValue; + WebIDBKey idbKey; + value(serializedScriptValue, idbKey); + WEBKIT_ASSERT(!serializedScriptValue.isNull()); + WEBKIT_ASSERT(idbKey.type() == WebIDBKey::InvalidType); + return serializedScriptValue; } - - virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*) + // One or the other will set, depending on what type of cursor this is. + virtual void value(WebSerializedScriptValue& serializedScriptValue, WebIDBKey& idbKey) const { - WEBKIT_ASSERT_NOT_REACHED(); + serializedScriptValue = value(); } - virtual void remove(WebIDBCallbacks*) - { - WEBKIT_ASSERT_NOT_REACHED(); - } + virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void remove(WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebIDBFactory.h b/WebKit/chromium/public/WebIDBFactory.h index 7c070a2..ab05b06 100755 --- a/WebKit/chromium/public/WebIDBFactory.h +++ b/WebKit/chromium/public/WebIDBFactory.h @@ -52,16 +52,14 @@ public: virtual ~WebIDBFactory() { } // The WebKit implementation of open ignores the WebFrame* parameter. - virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame) + virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame, const WebString& dataDir) { - int exceptionCode; - open(name, description, callbacks, origin, webFrame, exceptionCode); + open(name, description, callbacks, origin, webFrame); } // FIXME: Delete soon. Compatability hack. - virtual void open(const WebString& name, const WebString& description, - WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame, int& exceptionCode) + virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* webFrame) { - open(name, description, callbacks, origin, webFrame); + open(name, description, callbacks, origin, webFrame, "/tmp/temporary-indexed-db-files"); } virtual void abortPendingTransactions(const WebVector<int>& pendingIDs) { WEBKIT_ASSERT_NOT_REACHED(); } diff --git a/WebKit/chromium/public/WebIDBIndex.h b/WebKit/chromium/public/WebIDBIndex.h index dafea0e..e03fc58 100644 --- a/WebKit/chromium/public/WebIDBIndex.h +++ b/WebKit/chromium/public/WebIDBIndex.h @@ -30,6 +30,10 @@ namespace WebKit { +class WebIDBCallbacks; +class WebIDBKey; +class WebIDBKeyRange; + // See comment in WebIndexedDatabase for a high level overview of these classes. class WebIDBIndex { public: @@ -40,6 +44,11 @@ public: WEBKIT_ASSERT_NOT_REACHED(); return WebString(); } + virtual WebString storeName() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } virtual WebString keyPath() const { WEBKIT_ASSERT_NOT_REACHED(); @@ -50,6 +59,11 @@ public: WEBKIT_ASSERT_NOT_REACHED(); return false; } + + virtual void openObjectCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void getObject(const WebIDBKey&, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void get(const WebIDBKey&, WebIDBCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebIDBKey.h b/WebKit/chromium/public/WebIDBKey.h index 6aef332..60d3325 100644 --- a/WebKit/chromium/public/WebIDBKey.h +++ b/WebKit/chromium/public/WebIDBKey.h @@ -42,7 +42,7 @@ public: // Please use one of the factory methods. This is public only to allow WebVector. WebIDBKey() { } ~WebIDBKey() { reset(); } - + WEBKIT_API static WebIDBKey createNull(); WEBKIT_API static WebIDBKey createInvalid(); WEBKIT_API static WebIDBKey createFromValueAndKeyPath(const WebSerializedScriptValue&, const WebIDBKeyPath&); diff --git a/WebKit/chromium/public/WebInputElement.h b/WebKit/chromium/public/WebInputElement.h index ef3b577..3ef92de 100644 --- a/WebKit/chromium/public/WebInputElement.h +++ b/WebKit/chromium/public/WebInputElement.h @@ -79,9 +79,17 @@ namespace WebKit { Week }; + // This returns true for all of textfield-looking types such as text, + // password, search, email, url, and number. + WEBKIT_API bool isTextField() const; + // This returns true only for type=text. + WEBKIT_API bool isText() const; + WEBKIT_API bool isPasswordField() const; + WEBKIT_API bool isImageButton() const; WEBKIT_API bool autoComplete() const; WEBKIT_API bool isReadOnly() const; WEBKIT_API bool isEnabledFormControl() const; + // Deperated. WEBKIT_API InputType inputType() const; WEBKIT_API int maxLength() const; WEBKIT_API bool isActivatedSubmit() const; diff --git a/WebKit/chromium/public/WebKit.h b/WebKit/chromium/public/WebKit.h index 5550db1..732cac6 100644 --- a/WebKit/chromium/public/WebKit.h +++ b/WebKit/chromium/public/WebKit.h @@ -55,11 +55,6 @@ WEBKIT_API WebKitClient* webKitClient(); WEBKIT_API void setLayoutTestMode(bool); WEBKIT_API bool layoutTestMode(); -// This is a temporary flag while we try to get Linux to match Windows' -// checksum computation. It specifies whether or not the baseline images -// should be opaque or not. -WEBKIT_API bool areLayoutTestImagesOpaque(); - // Enables the named log channel. See WebCore/platform/Logging.h for details. WEBKIT_API void enableLogChannel(const char*); diff --git a/WebKit/chromium/public/WebURLLoaderClient.h b/WebKit/chromium/public/WebURLLoaderClient.h index c716e5d..7614ea3 100644 --- a/WebKit/chromium/public/WebURLLoaderClient.h +++ b/WebKit/chromium/public/WebURLLoaderClient.h @@ -64,7 +64,10 @@ public: virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength) { } // Called when the load completes successfully. - virtual void didFinishLoading(WebURLLoader*) { } + virtual void didFinishLoading(WebURLLoader*, double finishTime) { } + + // FIXME: remove this once clients are updated. + virtual void didFinishLoading(WebURLLoader* loader) { didFinishLoading(loader, 0); } // Called when the load completes with an error. virtual void didFail(WebURLLoader*, const WebURLError&) { } diff --git a/WebKit/chromium/public/WebView.h b/WebKit/chromium/public/WebView.h index 1b94da2..d162f26 100644 --- a/WebKit/chromium/public/WebView.h +++ b/WebKit/chromium/public/WebView.h @@ -45,6 +45,7 @@ class WebDragData; class WebFrame; class WebFrameClient; class WebGLES2Context; +class WebGraphicsContext3D; class WebNode; class WebSettings; class WebString; @@ -109,6 +110,9 @@ public: virtual bool isActive() const = 0; virtual void setIsActive(bool) = 0; + // Allows disabling domain relaxation. + virtual void setDomainRelaxationForbidden(bool, const WebString& scheme) = 0; + // Closing ------------------------------------------------------------- @@ -339,8 +343,17 @@ public: // Returns the GLES2Context associated with this WebView. One will be // created if it doesn't already exist. + // FIXME: remove this method once the compositor is fully switched + // over to GraphicsContext3D. virtual WebGLES2Context* gles2Context() = 0; + // Returns the (on-screen) WebGraphicsContext3D associated with + // this WebView. One will be created if it doesn't already exist. + // This is used to set up sharing between this context (which is + // that used by the compositor) and contexts for WebGL and other + // APIs. + virtual WebGraphicsContext3D* graphicsContext3D() = 0; + protected: ~WebView() {} }; diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h index 5c9a79b..f686419 100644 --- a/WebKit/chromium/public/WebViewClient.h +++ b/WebKit/chromium/public/WebViewClient.h @@ -31,6 +31,7 @@ #ifndef WebViewClient_h #define WebViewClient_h +#include "WebAccessibilityNotification.h" #include "WebDragOperation.h" #include "WebEditingAction.h" #include "WebFileChooserCompletion.h" @@ -280,6 +281,9 @@ public: // Notifies embedder that the children of an accessibility object has changed. virtual void didChangeAccessibilityObjectChildren(const WebAccessibilityObject&) { } + + // Notifies embedder about an accessibility notification. + virtual void postAccessibilityNotification(const WebAccessibilityObject&, WebAccessibilityNotification) { } // Developer tools ----------------------------------------------------- diff --git a/WebKit/chromium/public/WebWidget.h b/WebKit/chromium/public/WebWidget.h index 5c9f54e..d010270 100644 --- a/WebKit/chromium/public/WebWidget.h +++ b/WebKit/chromium/public/WebWidget.h @@ -60,13 +60,26 @@ public: // and it may result in calls to WebWidgetClient::didInvalidateRect. virtual void layout() = 0; - // Called to paint the specified region of the WebWidget onto the given - // canvas. You MUST call Layout before calling this method. It is - // okay to call paint multiple times once layout has been called, - // assuming no other changes are made to the WebWidget (e.g., once - // events are processed, it should be assumed that another call to - // layout is warranted before painting again). - virtual void paint(WebCanvas*, const WebRect&) = 0; + // Called to paint the rectangular region within the WebWidget + // onto the specified canvas at (viewPort.x,viewPort.y). You MUST call + // Layout before calling this method. It is okay to call paint + // multiple times once layout has been called, assuming no other + // changes are made to the WebWidget (e.g., once events are + // processed, it should be assumed that another call to layout is + // warranted before painting again). + virtual void paint(WebCanvas*, const WebRect& viewPort) = 0; + + // Triggers compositing of the current layers onto the screen. + // The finish argument controls whether the compositor will wait for the + // GPU to finish rendering before returning. You MUST call Layout + // before calling this method, for the same reasons described in + // the paint method above. + virtual void composite(bool finish) = 0; + + // Called to inform the WebWidget of a change in theme. + // Implementors that cache rendered copies of widgets need to re-render + // on receiving this message + virtual void themeChanged() = 0; // Called to inform the WebWidget of an input event. Returns true if // the event has been processed, false otherwise. diff --git a/WebKit/chromium/public/WebWidgetClient.h b/WebKit/chromium/public/WebWidgetClient.h index bd7bd6a..9bd553f 100644 --- a/WebKit/chromium/public/WebWidgetClient.h +++ b/WebKit/chromium/public/WebWidgetClient.h @@ -50,6 +50,9 @@ public: // scrolled by the specified dx and dy amounts. virtual void didScrollRect(int dx, int dy, const WebRect& clipRect) { } + // Called when a call to WebWidget::composite is required + virtual void scheduleComposite() { } + // Called when the widget acquires or loses focus, respectively. virtual void didFocus() { } virtual void didBlur() { } diff --git a/WebKit/chromium/src/AsyncFileWriterChromium.cpp b/WebKit/chromium/src/AsyncFileWriterChromium.cpp new file mode 100644 index 0000000..4bfc988 --- /dev/null +++ b/WebKit/chromium/src/AsyncFileWriterChromium.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * 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 "AsyncFileWriterChromium.h" + +#if ENABLE(FILE_SYSTEM) + +#include "Blob.h" +#include "FileWriterClient.h" +#include "WebFileWriter.h" +#include "WebURL.h" + +using namespace WebCore; + +namespace WebKit { + +AsyncFileWriterChromium::AsyncFileWriterChromium(FileWriterClient* client) + : m_client(client) +{ +} + +void AsyncFileWriterChromium::setWebFileWriter(WebFileWriter* writer) +{ + ASSERT(!m_writer); + m_writer = writer; +} + +void AsyncFileWriterChromium::write(long long position, Blob* data) +{ + ASSERT(m_writer); + m_writer->write(position, WebURL(data->url())); +} + +void AsyncFileWriterChromium::truncate(long long length) +{ + ASSERT(m_writer); + m_writer->truncate(length); +} + +void AsyncFileWriterChromium::abort() +{ + ASSERT(m_writer); + m_writer->cancel(); +} + +void AsyncFileWriterChromium::didWrite(long long bytes, bool complete) +{ + ASSERT(m_writer); + m_client->didWrite(bytes, complete); +} + +void AsyncFileWriterChromium::didTruncate(long long length) +{ + m_client->didTruncate(length); +} + +void AsyncFileWriterChromium::didFail(WebFileError error) +{ + m_client->didFail(error); +} + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebKit/chromium/src/AsyncFileWriterChromium.h b/WebKit/chromium/src/AsyncFileWriterChromium.h new file mode 100644 index 0000000..92743ca --- /dev/null +++ b/WebKit/chromium/src/AsyncFileWriterChromium.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * 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 AsyncFileWriterChromium_h +#define AsyncFileWriterChromium_h + +#if ENABLE(FILE_SYSTEM) + +#include "AsyncFileWriter.h" +#include "WebFileError.h" +#include "WebFileWriterClient.h" + +namespace WebCore { +class Blob; +class FileWriterClient; +} + +namespace WebKit { + +class WebFileWriter; + +class AsyncFileWriterChromium : public WebCore::AsyncFileWriter, public WebFileWriterClient { +public: + AsyncFileWriterChromium(WebCore::FileWriterClient* client); + + void setWebFileWriter(WebFileWriter* writer); + + // FileWriter + virtual void write(long long position, WebCore::Blob* data); + virtual void truncate(long long length); + virtual void abort(); + + // WebFileWriterClient + virtual void didWrite(long long bytes, bool complete); + virtual void didTruncate(long long length); + virtual void didFail(WebFileError); + +private: + OwnPtr<WebFileWriter> m_writer; + WebCore::FileWriterClient* m_client; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // AsyncFileWriterChromium_h diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index 8a3eda6..8c13cbb 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -56,11 +56,10 @@ #include "NotificationPresenterImpl.h" #include "Page.h" #include "PopupMenuChromium.h" -#include "SearchPopupMenuChromium.h" #include "ScriptController.h" +#include "SearchPopupMenuChromium.h" #include "SecurityOrigin.h" #include "SharedGraphicsContext3D.h" -#include "WebGeolocationService.h" #if USE(V8) #include "V8Proxy.h" #endif @@ -70,6 +69,7 @@ #include "WebFileChooserCompletionImpl.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" +#include "WebGeolocationService.h" #include "WebInputEvent.h" #include "WebKit.h" #include "WebNode.h" @@ -103,6 +103,46 @@ static WebPopupType convertPopupType(PopupContainer::PopupType type) } } +// Converts a WebCore::AXObjectCache::AXNotification to a WebKit::WebAccessibilityNotification +static WebAccessibilityNotification toWebAccessibilityNotification(AXObjectCache::AXNotification notification) +{ + switch (notification) { + case AXObjectCache::AXActiveDescendantChanged: + return WebAccessibilityNotificationActiveDescendantChanged; + case AXObjectCache::AXCheckedStateChanged: + return WebAccessibilityNotificationCheckedStateChanged; + case AXObjectCache::AXChildrenChanged: + return WebAccessibilityNotificationChildrenChanged; + case AXObjectCache::AXFocusedUIElementChanged: + return WebAccessibilityNotificationFocusedUIElementChanged; + case AXObjectCache::AXLayoutComplete: + return WebAccessibilityNotificationLayoutComplete; + case AXObjectCache::AXLoadComplete: + return WebAccessibilityNotificationLoadComplete; + case AXObjectCache::AXSelectedChildrenChanged: + return WebAccessibilityNotificationSelectedChildrenChanged; + case AXObjectCache::AXSelectedTextChanged: + return WebAccessibilityNotificationSelectedTextChanged; + case AXObjectCache::AXValueChanged: + return WebAccessibilityNotificationValueChanged; + case AXObjectCache::AXScrolledToAnchor: + return WebAccessibilityNotificationScrolledToAnchor; + case AXObjectCache::AXLiveRegionChanged: + return WebAccessibilityNotificationLiveRegionChanged; + case AXObjectCache::AXMenuListValueChanged: + return WebAccessibilityNotificationMenuListValueChanged; + case AXObjectCache::AXRowCountChanged: + return WebAccessibilityNotificationRowCountChanged; + case AXObjectCache::AXRowCollapsed: + return WebAccessibilityNotificationRowCollapsed; + case AXObjectCache::AXRowExpanded: + return WebAccessibilityNotificationRowExpanded; + default: + ASSERT_NOT_REACHED(); + return WebAccessibilityNotificationInvalid; + } +} + ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) : m_webView(webView) , m_toolbarsVisible(true) @@ -343,9 +383,9 @@ bool ChromeClientImpl::statusbarVisible() void ChromeClientImpl::setScrollbarsVisible(bool value) { m_scrollbarsVisible = value; - WebFrameImpl* web_frame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); - if (web_frame) - web_frame->setCanHaveScrollbars(value); + WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); + if (webFrame) + webFrame->setCanHaveScrollbars(value); } bool ChromeClientImpl::scrollbarsVisible() @@ -493,8 +533,15 @@ void ChromeClientImpl::invalidateContentsAndWindow(const IntRect& updateRect, bo { if (updateRect.isEmpty()) return; - if (m_webView->client()) - m_webView->client()->didInvalidateRect(updateRect); +#if USE(ACCELERATED_COMPOSITING) + if (!m_webView->isAcceleratedCompositingActive()) { +#endif + if (m_webView->client()) + m_webView->client()->didInvalidateRect(updateRect); +#if USE(ACCELERATED_COMPOSITING) + } else + m_webView->invalidateRootLayerRect(updateRect); +#endif } void ChromeClientImpl::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate) @@ -508,11 +555,18 @@ void ChromeClientImpl::scroll( const IntRect& clipRect) { m_webView->hidePopups(); - if (m_webView->client()) { - int dx = scrollDelta.width(); - int dy = scrollDelta.height(); - m_webView->client()->didScrollRect(dx, dy, clipRect); - } +#if USE(ACCELERATED_COMPOSITING) + if (!m_webView->isAcceleratedCompositingActive()) { +#endif + if (m_webView->client()) { + int dx = scrollDelta.width(); + int dy = scrollDelta.height(); + m_webView->client()->didScrollRect(dx, dy, clipRect); + } +#if USE(ACCELERATED_COMPOSITING) + } else + m_webView->scrollRootLayerRect(scrollDelta, clipRect); +#endif } IntPoint ChromeClientImpl::screenToWindow(const IntPoint&) const @@ -720,6 +774,13 @@ void ChromeClientImpl::didChangeAccessibilityObjectChildren(WebCore::Accessibili m_webView->client()->didChangeAccessibilityObjectChildren(WebAccessibilityObject(obj)); } +void ChromeClientImpl::postAccessibilityNotification(AccessibilityObject* obj, AXObjectCache::AXNotification notification) +{ + // Alert assistive technology about the accessibility object notification. + if (obj) + m_webView->client()->postAccessibilityNotification(WebAccessibilityObject(obj), toWebAccessibilityNotification(notification)); +} + #if ENABLE(NOTIFICATIONS) NotificationPresenter* ChromeClientImpl::notificationPresenter() const { diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h index d16d8f6..fbaac87 100644 --- a/WebKit/chromium/src/ChromeClientImpl.h +++ b/WebKit/chromium/src/ChromeClientImpl.h @@ -168,6 +168,7 @@ public: virtual void popupClosed(WebCore::PopupContainer* popupContainer); virtual void didChangeAccessibilityObjectState(WebCore::AccessibilityObject*); virtual void didChangeAccessibilityObjectChildren(WebCore::AccessibilityObject*); + virtual void postAccessibilityNotification(WebCore::AccessibilityObject*, WebCore::AXObjectCache::AXNotification); // ChromeClientImpl: void setCursor(const WebCursorInfo& cursor); diff --git a/WebKit/chromium/src/DOMUtilitiesPrivate.cpp b/WebKit/chromium/src/DOMUtilitiesPrivate.cpp index 4081db6..6f952f7 100644 --- a/WebKit/chromium/src/DOMUtilitiesPrivate.cpp +++ b/WebKit/chromium/src/DOMUtilitiesPrivate.cpp @@ -97,7 +97,7 @@ bool elementHasLegalLinkAttribute(const Element* element, if (element->hasTagName(HTMLNames::inputTag)) { const HTMLInputElement* input = static_cast<const HTMLInputElement*>(element); - if (input->inputType() == HTMLInputElement::IMAGE) + if (input->isImageButton()) return true; } } else if (attrName == HTMLNames::hrefAttr) { diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index ea668c7..61d43df 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -1053,8 +1053,7 @@ void FrameLoaderClientImpl::committedLoad(DocumentLoader* loader, const char* da // If we are sending data to MediaDocument, we should stop here // and cancel the request. - if (m_webFrame->frame()->document() - && m_webFrame->frame()->document()->isMediaDocument()) + if (m_webFrame->frame()->document()->isMediaDocument()) loader->cancelMainResourceLoad(pluginWillHandleLoadError(loader->response())); // The plugin widget could have been created in the m_webFrame->DidReceiveData @@ -1207,6 +1206,12 @@ bool FrameLoaderClientImpl::canHandleRequest(const ResourceRequest& request) con m_webFrame, WrappedResourceRequest(request)); } +bool FrameLoaderClientImpl::canShowMIMETypeAsHTML(const String& MIMEType) const +{ + notImplemented(); + return false; +} + bool FrameLoaderClientImpl::canShowMIMEType(const String& mimeType) const { // This method is called to determine if the media type can be shown @@ -1398,12 +1403,12 @@ PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( if (!webPlugin->initialize(container.get())) return 0; - if (m_webFrame->frame()->view()->zoomFactor() != 1) { + bool zoomTextOnly = m_webFrame->viewImpl()->zoomTextOnly(); + float zoomFactor = zoomTextOnly ? m_webFrame->frame()->textZoomFactor() : m_webFrame->frame()->pageZoomFactor(); + if (zoomFactor != 1) { // There's a saved zoom level, so tell the plugin about it since // WebViewImpl::setZoomLevel was called before the plugin was created. - webPlugin->setZoomFactor( - m_webFrame->frame()->view()->zoomFactor(), - m_webFrame->frame()->page()->settings()->zoomMode() == ZoomTextOnly); + webPlugin->setZoomFactor(zoomFactor, zoomTextOnly); } // The element might have been removed during plugin initialization! diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h index 361bae4..57105de 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -149,6 +149,7 @@ public: virtual bool shouldFallBack(const WebCore::ResourceError&); virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; virtual bool canShowMIMEType(const WTF::String& MIMEType) const; + virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const; virtual bool representationExistsForURLScheme(const WTF::String& URLScheme) const; virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String& URLScheme) const; virtual void frameLoadCompleted(); diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index 3051b9b..c78d334 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -39,6 +39,7 @@ #include "CanvasRenderingContext.h" #include "Chrome.h" #include "ChromeClientImpl.h" +#include "GraphicsContext3DInternal.h" #include "HTMLCanvasElement.h" #include "HTMLImageElement.h" #include "ImageBuffer.h" @@ -60,8 +61,6 @@ #include <CoreGraphics/CGImage.h> #endif -// using namespace std; - // There are two levels of delegation in this file: // // 1. GraphicsContext3D delegates to GraphicsContext3DInternal. This is done @@ -82,239 +81,6 @@ namespace WebCore { //---------------------------------------------------------------------- // GraphicsContext3DInternal -class GraphicsContext3DInternal { -public: - GraphicsContext3DInternal(); - ~GraphicsContext3DInternal(); - - bool initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow); - - PlatformGraphicsContext3D platformGraphicsContext3D() const; - Platform3DObject platformTexture() const; - - bool makeContextCurrent(); - - int sizeInBytes(int type); - - void reshape(int width, int height); - - void paintRenderingResultsToCanvas(CanvasRenderingContext* context); - bool paintsIntoCanvasBuffer() const; - - void prepareTexture(); - -#if USE(ACCELERATED_COMPOSITING) - WebGLLayerChromium* platformLayer() const; -#endif - bool isGLES2Compliant() const; - bool isGLES2NPOTStrict() const; - bool isErrorGeneratedOnOutOfBoundsAccesses() const; - - //---------------------------------------------------------------------- - // Entry points for WebGL. - // - void activeTexture(unsigned long texture); - void attachShader(Platform3DObject program, Platform3DObject shader); - void bindAttribLocation(Platform3DObject, unsigned long index, const String& name); - void bindBuffer(unsigned long target, Platform3DObject); - void bindFramebuffer(unsigned long target, Platform3DObject); - void bindRenderbuffer(unsigned long target, Platform3DObject); - void bindTexture(unsigned long target, Platform3DObject texture); - void blendColor(double red, double green, double blue, double alpha); - void blendEquation(unsigned long mode); - void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha); - void blendFunc(unsigned long sfactor, unsigned long dfactor); - void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha); - - void bufferData(unsigned long target, int size, unsigned long usage); - void bufferData(unsigned long target, int size, const void* data, unsigned long usage); - void bufferSubData(unsigned long target, long offset, int size, const void* data); - - unsigned long checkFramebufferStatus(unsigned long target); - void clear(unsigned long mask); - void clearColor(double red, double green, double blue, double alpha); - void clearDepth(double depth); - void clearStencil(long s); - void colorMask(bool red, bool green, bool blue, bool alpha); - void compileShader(Platform3DObject); - - void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border); - void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height); - void cullFace(unsigned long mode); - void depthFunc(unsigned long func); - void depthMask(bool flag); - void depthRange(double zNear, double zFar); - void detachShader(Platform3DObject, Platform3DObject); - void disable(unsigned long cap); - void disableVertexAttribArray(unsigned long index); - void drawArrays(unsigned long mode, long first, long count); - void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset); - - void enable(unsigned long cap); - void enableVertexAttribArray(unsigned long index); - void finish(); - void flush(); - void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject); - void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level); - void frontFace(unsigned long mode); - void generateMipmap(unsigned long target); - - bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&); - bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&); - - void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders); - - int getAttribLocation(Platform3DObject, const String& name); - - void getBooleanv(unsigned long pname, unsigned char* value); - - void getBufferParameteriv(unsigned long target, unsigned long pname, int* value); - - GraphicsContext3D::Attributes getContextAttributes(); - - unsigned long getError(); - - void getFloatv(unsigned long pname, float* value); - - void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value); - - void getIntegerv(unsigned long pname, int* value); - - void getProgramiv(Platform3DObject program, unsigned long pname, int* value); - - String getProgramInfoLog(Platform3DObject); - - void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value); - - void getShaderiv(Platform3DObject, unsigned long pname, int* value); - - String getShaderInfoLog(Platform3DObject); - - String getShaderSource(Platform3DObject); - String getString(unsigned long name); - - void getTexParameterfv(unsigned long target, unsigned long pname, float* value); - void getTexParameteriv(unsigned long target, unsigned long pname, int* value); - - void getUniformfv(Platform3DObject program, long location, float* value); - void getUniformiv(Platform3DObject program, long location, int* value); - - long getUniformLocation(Platform3DObject, const String& name); - - void getVertexAttribfv(unsigned long index, unsigned long pname, float* value); - void getVertexAttribiv(unsigned long index, unsigned long pname, int* value); - - long getVertexAttribOffset(unsigned long index, unsigned long pname); - - void hint(unsigned long target, unsigned long mode); - bool isBuffer(Platform3DObject); - bool isEnabled(unsigned long cap); - bool isFramebuffer(Platform3DObject); - bool isProgram(Platform3DObject); - bool isRenderbuffer(Platform3DObject); - bool isShader(Platform3DObject); - bool isTexture(Platform3DObject); - void lineWidth(double); - void linkProgram(Platform3DObject); - void pixelStorei(unsigned long pname, long param); - void polygonOffset(double factor, double units); - - void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* data); - - void releaseShaderCompiler(); - void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height); - void sampleCoverage(double value, bool invert); - void scissor(long x, long y, unsigned long width, unsigned long height); - void shaderSource(Platform3DObject, const String& string); - void stencilFunc(unsigned long func, long ref, unsigned long mask); - void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask); - void stencilMask(unsigned long mask); - void stencilMaskSeparate(unsigned long face, unsigned long mask); - void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass); - void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass); - - // These next several functions return an error code (0 if no errors) rather than using an ExceptionCode. - // Currently they return -1 on any error. - int texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels); - - void texParameterf(unsigned target, unsigned pname, float param); - void texParameteri(unsigned target, unsigned pname, int param); - - int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels); - - void uniform1f(long location, float x); - void uniform1fv(long location, float* v, int size); - void uniform1i(long location, int x); - void uniform1iv(long location, int* v, int size); - void uniform2f(long location, float x, float y); - void uniform2fv(long location, float* v, int size); - void uniform2i(long location, int x, int y); - void uniform2iv(long location, int* v, int size); - void uniform3f(long location, float x, float y, float z); - void uniform3fv(long location, float* v, int size); - void uniform3i(long location, int x, int y, int z); - void uniform3iv(long location, int* v, int size); - void uniform4f(long location, float x, float y, float z, float w); - void uniform4fv(long location, float* v, int size); - void uniform4i(long location, int x, int y, int z, int w); - void uniform4iv(long location, int* v, int size); - void uniformMatrix2fv(long location, bool transpose, float* value, int size); - void uniformMatrix3fv(long location, bool transpose, float* value, int size); - void uniformMatrix4fv(long location, bool transpose, float* value, int size); - - void useProgram(Platform3DObject); - void validateProgram(Platform3DObject); - - void vertexAttrib1f(unsigned long indx, float x); - void vertexAttrib1fv(unsigned long indx, float* values); - void vertexAttrib2f(unsigned long indx, float x, float y); - void vertexAttrib2fv(unsigned long indx, float* values); - void vertexAttrib3f(unsigned long indx, float x, float y, float z); - void vertexAttrib3fv(unsigned long indx, float* values); - void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w); - void vertexAttrib4fv(unsigned long indx, float* values); - void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized, - unsigned long stride, unsigned long offset); - - void viewport(long x, long y, unsigned long width, unsigned long height); - - unsigned createBuffer(); - unsigned createFramebuffer(); - unsigned createProgram(); - unsigned createRenderbuffer(); - unsigned createShader(unsigned long); - unsigned createTexture(); - - void deleteBuffer(unsigned); - void deleteFramebuffer(unsigned); - void deleteProgram(unsigned); - void deleteRenderbuffer(unsigned); - void deleteShader(unsigned); - void deleteTexture(unsigned); - - void synthesizeGLError(unsigned long error); - bool supportsBGRA(); - -private: - OwnPtr<WebKit::WebGraphicsContext3D> m_impl; - WebKit::WebViewImpl* m_webViewImpl; -#if USE(ACCELERATED_COMPOSITING) - RefPtr<WebGLLayerChromium> m_compositingLayer; -#endif -#if PLATFORM(SKIA) - // If the width and height of the Canvas's backing store don't - // match those that we were given in the most recent call to - // reshape(), then we need an intermediate bitmap to read back the - // frame buffer into. This seems to happen when CSS styles are - // used to resize the Canvas. - SkBitmap m_resizingBitmap; -#endif - -#if PLATFORM(CG) - unsigned char* m_renderOutput; -#endif -}; - GraphicsContext3DInternal::GraphicsContext3DInternal() : m_webViewImpl(0) #if PLATFORM(SKIA) @@ -334,8 +100,7 @@ GraphicsContext3DInternal::~GraphicsContext3DInternal() #endif } -bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, - HostWindow* hostWindow) +bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool renderDirectlyToHostWindow) { WebKit::WebGraphicsContext3D::Attributes webAttributes; webAttributes.alpha = attrs.alpha; @@ -354,7 +119,7 @@ bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, if (!m_webViewImpl) return false; - if (!webContext->initialize(webAttributes, m_webViewImpl)) { + if (!webContext->initialize(webAttributes, m_webViewImpl, renderDirectlyToHostWindow)) { delete webContext; return false; } @@ -366,6 +131,13 @@ bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, return true; } +WebKit::WebGraphicsContext3D* GraphicsContext3DInternal::extractWebGraphicsContext3D(GraphicsContext3D* context) +{ + if (!context) + return 0; + return context->m_internal->m_impl.get(); +} + PlatformGraphicsContext3D GraphicsContext3DInternal::platformGraphicsContext3D() const { return m_impl.get(); @@ -528,6 +300,12 @@ void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \ m_impl->name(a1, a2, a3, a4); \ } +#define DELEGATE_TO_IMPL_4R(name, t1, t2, t3, t4, rt) \ +rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \ +{ \ + return m_impl->name(a1, a2, a3, a4); \ +} + #define DELEGATE_TO_IMPL_5(name, t1, t2, t3, t4, t5) \ void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ { \ @@ -898,6 +676,13 @@ DELEGATE_TO_IMPL_1(deleteTexture, unsigned) DELEGATE_TO_IMPL_1(synthesizeGLError, unsigned long) DELEGATE_TO_IMPL_R(supportsBGRA, bool) +DELEGATE_TO_IMPL_R(supportsMapSubCHROMIUM, bool) +DELEGATE_TO_IMPL_4R(mapBufferSubDataCHROMIUM, unsigned, int, int, unsigned, void*) +DELEGATE_TO_IMPL_1(unmapBufferSubDataCHROMIUM, const void*) +DELEGATE_TO_IMPL_9R(mapTexSubImage2DCHROMIUM, unsigned, int, int, int, int, int, unsigned, unsigned, unsigned, void*) +DELEGATE_TO_IMPL_1(unmapTexSubImage2DCHROMIUM, const void*) +DELEGATE_TO_IMPL_R(supportsCopyTextureToParentTextureCHROMIUM, bool) +DELEGATE_TO_IMPL_2(copyTextureToParentTextureCHROMIUM, unsigned, unsigned) //---------------------------------------------------------------------- // GraphicsContext3D @@ -960,6 +745,12 @@ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \ m_internal->name(a1, a2, a3, a4); \ } +#define DELEGATE_TO_INTERNAL_4R(name, t1, t2, t3, t4, rt) \ +rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \ +{ \ + return m_internal->name(a1, a2, a3, a4); \ +} + #define DELEGATE_TO_INTERNAL_5(name, t1, t2, t3, t4, t5) \ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ { \ @@ -1002,7 +793,7 @@ rt GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a return m_internal->name(a1, a2, a3, a4, a5, a6, a7, a8, a9); \ } -GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes, HostWindow*) +GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes, HostWindow*, bool) { } @@ -1010,15 +801,14 @@ GraphicsContext3D::~GraphicsContext3D() { } -PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) +PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle) { - GraphicsContext3DInternal* internal = new GraphicsContext3DInternal(); - if (!internal->initialize(attrs, hostWindow)) { - delete internal; + OwnPtr<GraphicsContext3DInternal> internal = adoptPtr(new GraphicsContext3DInternal()); + if (!internal->initialize(attrs, hostWindow, renderStyle == RenderDirectlyToHostWindow)) { return 0; } - PassOwnPtr<GraphicsContext3D> result = new GraphicsContext3D(attrs, hostWindow); - result->m_internal.set(internal); + PassOwnPtr<GraphicsContext3D> result = new GraphicsContext3D(attrs, hostWindow, renderStyle == RenderDirectlyToHostWindow); + result->m_internal = internal.release(); return result; } @@ -1234,6 +1024,13 @@ DELEGATE_TO_INTERNAL_1(deleteTexture, unsigned) DELEGATE_TO_INTERNAL_1(synthesizeGLError, unsigned long) DELEGATE_TO_INTERNAL_R(supportsBGRA, bool) +DELEGATE_TO_INTERNAL_R(supportsMapSubCHROMIUM, bool) +DELEGATE_TO_INTERNAL_4R(mapBufferSubDataCHROMIUM, unsigned, int, int, unsigned, void*) +DELEGATE_TO_INTERNAL_1(unmapBufferSubDataCHROMIUM, const void*) +DELEGATE_TO_INTERNAL_9R(mapTexSubImage2DCHROMIUM, unsigned, int, int, int, int, int, unsigned, unsigned, unsigned, void*) +DELEGATE_TO_INTERNAL_1(unmapTexSubImage2DCHROMIUM, const void*) +DELEGATE_TO_INTERNAL_R(supportsCopyTextureToParentTextureCHROMIUM, bool) +DELEGATE_TO_INTERNAL_2(copyTextureToParentTextureCHROMIUM, unsigned, unsigned) bool GraphicsContext3D::isGLES2Compliant() const { diff --git a/WebKit/chromium/src/GraphicsContext3DInternal.h b/WebKit/chromium/src/GraphicsContext3DInternal.h new file mode 100644 index 0000000..f12fff0 --- /dev/null +++ b/WebKit/chromium/src/GraphicsContext3DInternal.h @@ -0,0 +1,301 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 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 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 GraphicsContext3DInternal_h +#define GraphicsContext3DInternal_h + +#include "GraphicsContext3D.h" +#include <wtf/OwnPtr.h> +#if PLATFORM(SKIA) +#include "SkBitmap.h" +#endif + +namespace WebKit { +class WebGraphicsContext3D; +class WebViewImpl; +} // namespace WebKit + +namespace WebCore { + +#if USE(ACCELERATED_COMPOSITING) +class WebGLLayerChromium; +#endif + +class GraphicsContext3DInternal { +public: + GraphicsContext3DInternal(); + ~GraphicsContext3DInternal(); + + bool initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool renderDirectlyToHostWindow); + + // Helper function to provide access to the lower-level WebGraphicsContext3D, + // which is needed for subordinate contexts like WebGL's to share resources + // with the compositor's context. + static WebKit::WebGraphicsContext3D* extractWebGraphicsContext3D(GraphicsContext3D* context); + + PlatformGraphicsContext3D platformGraphicsContext3D() const; + Platform3DObject platformTexture() const; + + bool makeContextCurrent(); + + int sizeInBytes(int type); + + void reshape(int width, int height); + + void paintRenderingResultsToCanvas(CanvasRenderingContext*); + bool paintsIntoCanvasBuffer() const; + + void prepareTexture(); + +#if USE(ACCELERATED_COMPOSITING) + WebGLLayerChromium* platformLayer() const; +#endif + bool isGLES2Compliant() const; + bool isGLES2NPOTStrict() const; + bool isErrorGeneratedOnOutOfBoundsAccesses() const; + + //---------------------------------------------------------------------- + // Entry points for WebGL. + // + void activeTexture(unsigned long texture); + void attachShader(Platform3DObject program, Platform3DObject shader); + void bindAttribLocation(Platform3DObject, unsigned long index, const String& name); + void bindBuffer(unsigned long target, Platform3DObject); + void bindFramebuffer(unsigned long target, Platform3DObject); + void bindRenderbuffer(unsigned long target, Platform3DObject); + void bindTexture(unsigned long target, Platform3DObject texture); + void blendColor(double red, double green, double blue, double alpha); + void blendEquation(unsigned long mode); + void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha); + void blendFunc(unsigned long sfactor, unsigned long dfactor); + void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha); + + void bufferData(unsigned long target, int size, unsigned long usage); + void bufferData(unsigned long target, int size, const void* data, unsigned long usage); + void bufferSubData(unsigned long target, long offset, int size, const void* data); + + unsigned long checkFramebufferStatus(unsigned long target); + void clear(unsigned long mask); + void clearColor(double red, double green, double blue, double alpha); + void clearDepth(double depth); + void clearStencil(long s); + void colorMask(bool red, bool green, bool blue, bool alpha); + void compileShader(Platform3DObject); + + void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border); + void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height); + void cullFace(unsigned long mode); + void depthFunc(unsigned long func); + void depthMask(bool flag); + void depthRange(double zNear, double zFar); + void detachShader(Platform3DObject, Platform3DObject); + void disable(unsigned long cap); + void disableVertexAttribArray(unsigned long index); + void drawArrays(unsigned long mode, long first, long count); + void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset); + + void enable(unsigned long cap); + void enableVertexAttribArray(unsigned long index); + void finish(); + void flush(); + void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject); + void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level); + void frontFace(unsigned long mode); + void generateMipmap(unsigned long target); + + bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&); + bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&); + + void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders); + + int getAttribLocation(Platform3DObject, const String& name); + + void getBooleanv(unsigned long pname, unsigned char* value); + + void getBufferParameteriv(unsigned long target, unsigned long pname, int* value); + + GraphicsContext3D::Attributes getContextAttributes(); + + unsigned long getError(); + + void getFloatv(unsigned long pname, float* value); + + void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value); + + void getIntegerv(unsigned long pname, int* value); + + void getProgramiv(Platform3DObject program, unsigned long pname, int* value); + + String getProgramInfoLog(Platform3DObject); + + void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value); + + void getShaderiv(Platform3DObject, unsigned long pname, int* value); + + String getShaderInfoLog(Platform3DObject); + + String getShaderSource(Platform3DObject); + String getString(unsigned long name); + + void getTexParameterfv(unsigned long target, unsigned long pname, float* value); + void getTexParameteriv(unsigned long target, unsigned long pname, int* value); + + void getUniformfv(Platform3DObject program, long location, float* value); + void getUniformiv(Platform3DObject program, long location, int* value); + + long getUniformLocation(Platform3DObject, const String& name); + + void getVertexAttribfv(unsigned long index, unsigned long pname, float* value); + void getVertexAttribiv(unsigned long index, unsigned long pname, int* value); + + long getVertexAttribOffset(unsigned long index, unsigned long pname); + + void hint(unsigned long target, unsigned long mode); + bool isBuffer(Platform3DObject); + bool isEnabled(unsigned long cap); + bool isFramebuffer(Platform3DObject); + bool isProgram(Platform3DObject); + bool isRenderbuffer(Platform3DObject); + bool isShader(Platform3DObject); + bool isTexture(Platform3DObject); + void lineWidth(double); + void linkProgram(Platform3DObject); + void pixelStorei(unsigned long pname, long param); + void polygonOffset(double factor, double units); + + void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* data); + + void releaseShaderCompiler(); + void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height); + void sampleCoverage(double value, bool invert); + void scissor(long x, long y, unsigned long width, unsigned long height); + void shaderSource(Platform3DObject, const String& string); + void stencilFunc(unsigned long func, long ref, unsigned long mask); + void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask); + void stencilMask(unsigned long mask); + void stencilMaskSeparate(unsigned long face, unsigned long mask); + void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass); + void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass); + + // These next several functions return an error code (0 if no errors) rather than using an ExceptionCode. + // Currently they return -1 on any error. + int texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels); + + void texParameterf(unsigned target, unsigned pname, float param); + void texParameteri(unsigned target, unsigned pname, int param); + + int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels); + + void uniform1f(long location, float x); + void uniform1fv(long location, float* v, int size); + void uniform1i(long location, int x); + void uniform1iv(long location, int* v, int size); + void uniform2f(long location, float x, float y); + void uniform2fv(long location, float* v, int size); + void uniform2i(long location, int x, int y); + void uniform2iv(long location, int* v, int size); + void uniform3f(long location, float x, float y, float z); + void uniform3fv(long location, float* v, int size); + void uniform3i(long location, int x, int y, int z); + void uniform3iv(long location, int* v, int size); + void uniform4f(long location, float x, float y, float z, float w); + void uniform4fv(long location, float* v, int size); + void uniform4i(long location, int x, int y, int z, int w); + void uniform4iv(long location, int* v, int size); + void uniformMatrix2fv(long location, bool transpose, float* value, int size); + void uniformMatrix3fv(long location, bool transpose, float* value, int size); + void uniformMatrix4fv(long location, bool transpose, float* value, int size); + + void useProgram(Platform3DObject); + void validateProgram(Platform3DObject); + + void vertexAttrib1f(unsigned long indx, float x); + void vertexAttrib1fv(unsigned long indx, float* values); + void vertexAttrib2f(unsigned long indx, float x, float y); + void vertexAttrib2fv(unsigned long indx, float* values); + void vertexAttrib3f(unsigned long indx, float x, float y, float z); + void vertexAttrib3fv(unsigned long indx, float* values); + void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w); + void vertexAttrib4fv(unsigned long indx, float* values); + void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized, + unsigned long stride, unsigned long offset); + + void viewport(long x, long y, unsigned long width, unsigned long height); + + unsigned createBuffer(); + unsigned createFramebuffer(); + unsigned createProgram(); + unsigned createRenderbuffer(); + unsigned createShader(unsigned long); + unsigned createTexture(); + + void deleteBuffer(unsigned); + void deleteFramebuffer(unsigned); + void deleteProgram(unsigned); + void deleteRenderbuffer(unsigned); + void deleteShader(unsigned); + void deleteTexture(unsigned); + + void synthesizeGLError(unsigned long error); + + void swapBuffers(); + + // EXT_texture_format_BGRA8888 + bool supportsBGRA(); + + // GL_CHROMIUM_map_sub + bool supportsMapSubCHROMIUM(); + void* mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access); + void unmapBufferSubDataCHROMIUM(const void*); + void* mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access); + void unmapTexSubImage2DCHROMIUM(const void*); + + // GL_CHROMIUM_copy_texture_to_parent_texture + bool supportsCopyTextureToParentTextureCHROMIUM(); + void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture); + +private: + OwnPtr<WebKit::WebGraphicsContext3D> m_impl; + WebKit::WebViewImpl* m_webViewImpl; +#if USE(ACCELERATED_COMPOSITING) + RefPtr<WebGLLayerChromium> m_compositingLayer; +#endif +#if PLATFORM(SKIA) + // If the width and height of the Canvas's backing store don't + // match those that we were given in the most recent call to + // reshape(), then we need an intermediate bitmap to read back the + // frame buffer into. This seems to happen when CSS styles are + // used to resize the Canvas. + SkBitmap m_resizingBitmap; +#endif + +#if PLATFORM(CG) + unsigned char* m_renderOutput; +#endif +}; + +} // namespace WebCore + +#endif // GraphicsContext3D_h diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.cpp b/WebKit/chromium/src/IDBCursorBackendProxy.cpp index b4711eb..cf18917 100644 --- a/WebKit/chromium/src/IDBCursorBackendProxy.cpp +++ b/WebKit/chromium/src/IDBCursorBackendProxy.cpp @@ -30,9 +30,11 @@ #include "IDBAny.h" #include "IDBCallbacks.h" +#include "IDBKey.h" #include "SerializedScriptValue.h" #include "WebIDBCallbacksImpl.h" #include "WebIDBKey.h" +#include "WebSerializedScriptValue.h" namespace WebCore { @@ -60,9 +62,17 @@ PassRefPtr<IDBKey> IDBCursorBackendProxy::key() const return m_idbCursor->key(); } -PassRefPtr<SerializedScriptValue> IDBCursorBackendProxy::value() const +PassRefPtr<IDBAny> IDBCursorBackendProxy::value() const { - return m_idbCursor->value(); + WebKit::WebSerializedScriptValue webScriptValue; + WebKit::WebIDBKey webKey; + m_idbCursor->value(webScriptValue, webKey); + if (!webScriptValue.isNull()) { + ASSERT(webKey.type() == WebKit::WebIDBKey::InvalidType); + return IDBAny::create<SerializedScriptValue>(webScriptValue); + } + ASSERT(webKey.type() != WebKit::WebIDBKey::InvalidType); + return IDBAny::create<IDBKey>(webKey); } void IDBCursorBackendProxy::update(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBCallbacks> callbacks) diff --git a/WebKit/chromium/src/IDBCursorBackendProxy.h b/WebKit/chromium/src/IDBCursorBackendProxy.h index 8af27cf..d8b621a 100644 --- a/WebKit/chromium/src/IDBCursorBackendProxy.h +++ b/WebKit/chromium/src/IDBCursorBackendProxy.h @@ -44,7 +44,7 @@ public: virtual unsigned short direction() const; virtual PassRefPtr<IDBKey> key() const; - virtual PassRefPtr<SerializedScriptValue> value() const; + virtual PassRefPtr<IDBAny> value() const; virtual void update(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBCallbacks>); virtual void continueFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); virtual void remove(PassRefPtr<IDBCallbacks>); diff --git a/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index 114e7e1..18101e4 100755 --- a/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -59,10 +59,10 @@ IDBFactoryBackendProxy::~IDBFactoryBackendProxy() { } -void IDBFactoryBackendProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame) +void IDBFactoryBackendProxy::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> origin, Frame* frame, const String& dataDir) { WebKit::WebFrame* webFrame = WebKit::WebFrameImpl::fromFrame(frame); - m_webIDBFactory->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame); + m_webIDBFactory->open(name, description, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } void IDBFactoryBackendProxy::abortPendingTransactions(const Vector<int>& pendingIDs) diff --git a/WebKit/chromium/src/IDBFactoryBackendProxy.h b/WebKit/chromium/src/IDBFactoryBackendProxy.h index 9efc7af..ac30cf2 100755 --- a/WebKit/chromium/src/IDBFactoryBackendProxy.h +++ b/WebKit/chromium/src/IDBFactoryBackendProxy.h @@ -45,7 +45,7 @@ public: virtual ~IDBFactoryBackendProxy(); PassRefPtr<DOMStringList> databases(void) const; - virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*); + virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir); virtual void abortPendingTransactions(const Vector<int>& pendingIDs); private: diff --git a/WebKit/chromium/src/IDBIndexBackendProxy.cpp b/WebKit/chromium/src/IDBIndexBackendProxy.cpp index 5f1b9d9..f92f4f2 100644 --- a/WebKit/chromium/src/IDBIndexBackendProxy.cpp +++ b/WebKit/chromium/src/IDBIndexBackendProxy.cpp @@ -26,10 +26,15 @@ #include "config.h" #include "IDBIndexBackendProxy.h" +#if ENABLE(INDEXED_DATABASE) + +#include "IDBCallbacks.h" +#include "IDBKeyRange.h" +#include "WebIDBCallbacksImpl.h" #include "WebIDBDatabaseError.h" #include "WebIDBIndex.h" - -#if ENABLE(INDEXED_DATABASE) +#include "WebIDBKey.h" +#include "WebIDBKeyRange.h" namespace WebCore { @@ -52,6 +57,11 @@ String IDBIndexBackendProxy::name() return m_webIDBIndex->name(); } +String IDBIndexBackendProxy::storeName() +{ + return m_webIDBIndex->storeName(); +} + String IDBIndexBackendProxy::keyPath() { return m_webIDBIndex->keyPath(); @@ -62,6 +72,26 @@ bool IDBIndexBackendProxy::unique() return m_webIDBIndex->unique(); } +void IDBIndexBackendProxy::openObjectCursor(PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBIndex->openObjectCursor(keyRange, direction, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBIndexBackendProxy::openCursor(PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBIndex->openCursor(keyRange, direction, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBIndexBackendProxy::getObject(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBIndex->getObject(key, new WebIDBCallbacksImpl(callbacks)); +} + +void IDBIndexBackendProxy::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks) +{ + m_webIDBIndex->get(key, new WebIDBCallbacksImpl(callbacks)); +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/IDBIndexBackendProxy.h b/WebKit/chromium/src/IDBIndexBackendProxy.h index 1b378dd..6aafdfa 100644 --- a/WebKit/chromium/src/IDBIndexBackendProxy.h +++ b/WebKit/chromium/src/IDBIndexBackendProxy.h @@ -42,10 +42,14 @@ public: virtual ~IDBIndexBackendProxy(); virtual String name(); + virtual String storeName(); virtual String keyPath(); virtual bool unique(); - // FIXME: Add other methods. + virtual void openObjectCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>); + virtual void openCursor(PassRefPtr<IDBKeyRange>, unsigned short direction, PassRefPtr<IDBCallbacks>); + virtual void getObject(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); + virtual void get(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>); private: IDBIndexBackendProxy(PassOwnPtr<WebKit::WebIDBIndex>); diff --git a/WebKit/chromium/src/InspectorClientImpl.cpp b/WebKit/chromium/src/InspectorClientImpl.cpp index 76acbb2..77150bb 100644 --- a/WebKit/chromium/src/InspectorClientImpl.cpp +++ b/WebKit/chromium/src/InspectorClientImpl.cpp @@ -100,28 +100,10 @@ bool InspectorClientImpl::sendMessageToFrontend(const WTF::String& message) return false; } -void InspectorClientImpl::resourceTrackingWasEnabled() +void InspectorClientImpl::updateInspectorStateCookie(const WTF::String& inspectorState) { if (WebDevToolsAgentImpl* agent = devToolsAgent()) - agent->resourceTrackingWasEnabled(); -} - -void InspectorClientImpl::resourceTrackingWasDisabled() -{ - if (WebDevToolsAgentImpl* agent = devToolsAgent()) - agent->resourceTrackingWasDisabled(); -} - -void InspectorClientImpl::timelineProfilerWasStarted() -{ - if (WebDevToolsAgentImpl* agent = devToolsAgent()) - agent->timelineProfilerWasStarted(); -} - -void InspectorClientImpl::timelineProfilerWasStopped() -{ - if (WebDevToolsAgentImpl* agent = devToolsAgent()) - agent->timelineProfilerWasStopped(); + agent->updateInspectorStateCookie(inspectorState); } WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent() diff --git a/WebKit/chromium/src/InspectorClientImpl.h b/WebKit/chromium/src/InspectorClientImpl.h index 34fcdc3..78d34e3 100644 --- a/WebKit/chromium/src/InspectorClientImpl.h +++ b/WebKit/chromium/src/InspectorClientImpl.h @@ -58,10 +58,7 @@ public: virtual bool sendMessageToFrontend(const WTF::String&); - virtual void resourceTrackingWasEnabled(); - virtual void resourceTrackingWasDisabled(); - virtual void timelineProfilerWasStarted(); - virtual void timelineProfilerWasStopped(); + virtual void updateInspectorStateCookie(const WTF::String&); private: WebDevToolsAgentImpl* devToolsAgent(); diff --git a/WebKit/chromium/src/ResourceHandle.cpp b/WebKit/chromium/src/ResourceHandle.cpp index 88f7f39..83e0017 100644 --- a/WebKit/chromium/src/ResourceHandle.cpp +++ b/WebKit/chromium/src/ResourceHandle.cpp @@ -74,7 +74,7 @@ public: virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&); virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength); virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength); - virtual void didFinishLoading(WebURLLoader*); + virtual void didFinishLoading(WebURLLoader*, double finishTime); virtual void didFail(WebURLLoader*, const WebURLError&); enum ConnectionState { @@ -182,13 +182,13 @@ void ResourceHandleInternal::didReceiveCachedMetadata(WebURLLoader*, const char* m_client->didReceiveCachedMetadata(m_owner, data, dataLength); } -void ResourceHandleInternal::didFinishLoading(WebURLLoader*) +void ResourceHandleInternal::didFinishLoading(WebURLLoader*, double finishTime) { ASSERT(m_client); if (m_state != ConnectionStateReceivedResponse && m_state != ConnectionStateReceivingData) CRASH(); m_state = ConnectionStateFinishedLoading; - m_client->didFinishLoading(m_owner); + m_client->didFinishLoading(m_owner, finishTime); } void ResourceHandleInternal::didFail(WebURLLoader*, const WebURLError& error) @@ -211,16 +211,16 @@ ResourceHandle::ResourceHandle(const ResourceRequest& request, // FIXME: Figure out what to do with the bool params. } -PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request, +PassRefPtr<ResourceHandle> ResourceHandle::create(NetworkingContext* context, + const ResourceRequest& request, ResourceHandleClient* client, - Frame* deprecated, bool defersLoading, bool shouldContentSniff) { RefPtr<ResourceHandle> newHandle = adoptRef(new ResourceHandle( request, client, defersLoading, shouldContentSniff)); - if (newHandle->start(deprecated)) + if (newHandle->start(context)) return newHandle.release(); return 0; @@ -246,7 +246,7 @@ void ResourceHandle::setDefersLoading(bool value) d->setDefersLoading(value); } -bool ResourceHandle::start(Frame* deprecated) +bool ResourceHandle::start(NetworkingContext* context) { d->start(); return true; @@ -288,12 +288,12 @@ bool ResourceHandle::supportsBufferedData() } // static -void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, +void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, + const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, - Vector<char>& data, - Frame* deprecated) + Vector<char>& data) { OwnPtr<WebURLLoader> loader(webKitClient()->createURLLoader()); ASSERT(loader.get()); diff --git a/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp b/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp index abb63cc..8304878 100644 --- a/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp +++ b/WebKit/chromium/src/WebAccessibilityCacheImpl.cpp @@ -63,7 +63,6 @@ WebAccessibilityCache* WebAccessibilityCache::create() PassRefPtr<WebAccessibilityCacheImpl::WeakHandle> WebAccessibilityCacheImpl::WeakHandle::create(AccessibilityObject* object) { - // FIXME: Remove resetting ref-count from AccessibilityObjectWrapper RefPtr<WebAccessibilityCacheImpl::WeakHandle> weakHandle = adoptRef(new WebAccessibilityCacheImpl::WeakHandle(object)); weakHandle->m_object->setWrapper(weakHandle.get()); @@ -149,7 +148,7 @@ void WebAccessibilityCacheImpl::clear() int WebAccessibilityCacheImpl::addOrGetId(const WebAccessibilityObject& object) { - if (object.isNull()) + if (!object.isValid()) return invalidObjectId; RefPtr<AccessibilityObject> o = toAccessibilityObject(object); diff --git a/WebKit/chromium/src/WebAccessibilityObject.cpp b/WebKit/chromium/src/WebAccessibilityObject.cpp index 3a3e94b..96a3173 100644 --- a/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -101,6 +101,15 @@ bool WebAccessibilityObject::canSetValueAttribute() const return m_private->canSetValueAttribute(); } +bool WebAccessibilityObject::isValid() const +{ + if (!m_private) + return false; + + m_private->updateBackingStore(); + return m_private->axObjectID(); +} + unsigned WebAccessibilityObject::childCount() const { if (!m_private) diff --git a/WebKit/chromium/src/WebDataSourceImpl.cpp b/WebKit/chromium/src/WebDataSourceImpl.cpp index ac2a02d..d5b1d79 100644 --- a/WebKit/chromium/src/WebDataSourceImpl.cpp +++ b/WebKit/chromium/src/WebDataSourceImpl.cpp @@ -109,7 +109,8 @@ void WebDataSourceImpl::setExtraData(ExtraData* extraData) m_extraData.set(extraData); } -WebApplicationCacheHost* WebDataSourceImpl::applicationCacheHost() { +WebApplicationCacheHost* WebDataSourceImpl::applicationCacheHost() +{ #if ENABLE(OFFLINE_WEB_APPLICATIONS) return ApplicationCacheHostInternal::toWebApplicationCacheHost(DocumentLoader::applicationCacheHost()); #else @@ -117,6 +118,11 @@ WebApplicationCacheHost* WebDataSourceImpl::applicationCacheHost() { #endif } +void WebDataSourceImpl::setDeferMainResourceDataLoad(bool defer) +{ + DocumentLoader::setDeferMainResourceDataLoad(defer); +} + WebNavigationType WebDataSourceImpl::toWebNavigationType(NavigationType type) { switch (type) { diff --git a/WebKit/chromium/src/WebDataSourceImpl.h b/WebKit/chromium/src/WebDataSourceImpl.h index be32217..05329ff 100644 --- a/WebKit/chromium/src/WebDataSourceImpl.h +++ b/WebKit/chromium/src/WebDataSourceImpl.h @@ -68,6 +68,7 @@ public: virtual ExtraData* extraData() const; virtual void setExtraData(ExtraData*); virtual WebApplicationCacheHost* applicationCacheHost(); + virtual void setDeferMainResourceDataLoad(bool); static WebNavigationType toWebNavigationType(WebCore::NavigationType type); diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index 971c290..c7bb050 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -36,7 +36,6 @@ #include "InjectedScriptHost.h" #include "InspectorBackendDispatcher.h" #include "InspectorController.h" -#include "InspectorValues.h" #include "Page.h" #include "PageGroup.h" #include "PlatformString.h" @@ -58,6 +57,7 @@ #include "WebURLResponse.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include <wtf/CurrentTime.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> @@ -67,8 +67,6 @@ using WebCore::InjectedScriptHost; using WebCore::InspectorArray; using WebCore::InspectorBackendDispatcher; using WebCore::InspectorController; -using WebCore::InspectorObject; -using WebCore::InspectorValue; using WebCore::Node; using WebCore::Page; using WebCore::ResourceError; @@ -82,10 +80,9 @@ namespace WebKit { namespace { -static const char kFrontendConnectedFeatureName[] = "frontend-connected"; -static const char kResourceTrackingFeatureName[] = "resource-tracking"; -static const char kTimelineFeatureName[] = "timeline-profiler"; static const char kApuAgentFeatureName[] = "apu-agent"; +static const char kFrontendConnectedFeatureName[] = "frontend-connected"; +static const char kInspectorStateFeatureName[] = "inspector-state"; class ClientMessageLoopAdapter : public WebCore::ScriptDebugServer::ClientMessageLoop { public: @@ -223,9 +220,7 @@ void WebDevToolsAgentImpl::detach() void WebDevToolsAgentImpl::frontendLoaded() { - inspectorController()->connectFrontend(); - // We know that by this time injected script has already been pushed to the backend. - m_client->runtimePropertyChanged(kFrontendConnectedFeatureName, inspectorController()->injectedScriptHost()->injectedScriptSource()); + connectFrontend(false); } void WebDevToolsAgentImpl::didNavigate() @@ -253,17 +248,12 @@ void WebDevToolsAgentImpl::setRuntimeProperty(const WebString& name, const WebSt { if (name == kApuAgentFeatureName) setApuAgentEnabled(value == "true"); - else if (name == kTimelineFeatureName) - setTimelineProfilingEnabled(value == "true"); - else if (name == kResourceTrackingFeatureName) { + else if (name == kInspectorStateFeatureName) { InspectorController* ic = inspectorController(); - if (value == "true") - ic->enableResourceTracking(false /* not sticky */, false /* no reload */); - else - ic->disableResourceTracking(false /* not sticky */); + ic->restoreInspectorStateFromCookie(value); } else if (name == kFrontendConnectedFeatureName && !inspectorController()->hasFrontend()) { inspectorController()->injectedScriptHost()->setInjectedScriptSource(value); - frontendLoaded(); + connectFrontend(true); } } @@ -273,19 +263,19 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) InspectorController* ic = inspectorController(); if (enabled) { if (!ic->hasFrontend()) - frontendLoaded(); + connectFrontend(true); m_resourceTrackingWasEnabled = ic->resourceTrackingEnabled(); ic->startTimelineProfiler(); if (!m_resourceTrackingWasEnabled) { // TODO(knorton): Introduce some kind of agents dependency here so that // user could turn off resource tracking while apu agent is on. - ic->enableResourceTracking(false, false); + ic->setResourceTrackingEnabled(true); } m_debuggerAgentImpl->setAutoContinueOnException(true); } else { ic->stopTimelineProfiler(); if (!m_resourceTrackingWasEnabled) - ic->disableResourceTracking(false); + ic->setResourceTrackingEnabled(false); m_resourceTrackingWasEnabled = false; } m_client->runtimePropertyChanged( @@ -293,6 +283,16 @@ void WebDevToolsAgentImpl::setApuAgentEnabled(bool enabled) enabled ? String("true") : String("false")); } +void WebDevToolsAgentImpl::connectFrontend(bool afterNavigation) +{ + if (afterNavigation) + inspectorController()->reuseFrontend(); + else + inspectorController()->connectFrontend(); + // We know that by this time injected script has already been pushed to the backend. + m_client->runtimePropertyChanged(kFrontendConnectedFeatureName, inspectorController()->injectedScriptHost()->injectedScriptSource()); +} + WebCore::InspectorController* WebDevToolsAgentImpl::inspectorController() { if (Page* page = m_webViewImpl->page()) @@ -336,7 +336,7 @@ void WebDevToolsAgentImpl::didReceiveResponse(unsigned long resourceId, const We void WebDevToolsAgentImpl::didFinishLoading(unsigned long resourceId) { if (InspectorController* ic = inspectorController()) - ic->didFinishLoading(resourceId); + ic->didFinishLoading(resourceId, 0); } void WebDevToolsAgentImpl::didFailLoading(unsigned long resourceId, const WebURLError& error) @@ -402,24 +402,9 @@ bool WebDevToolsAgentImpl::sendMessageToFrontend(const WTF::String& message) return true; } -void WebDevToolsAgentImpl::resourceTrackingWasEnabled() -{ - m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "true"); -} - -void WebDevToolsAgentImpl::resourceTrackingWasDisabled() -{ - m_client->runtimePropertyChanged(kResourceTrackingFeatureName, "false"); -} - -void WebDevToolsAgentImpl::timelineProfilerWasStarted() -{ - m_client->runtimePropertyChanged(kTimelineFeatureName, "true"); -} - -void WebDevToolsAgentImpl::timelineProfilerWasStopped() +void WebDevToolsAgentImpl::updateInspectorStateCookie(const WTF::String& state) { - m_client->runtimePropertyChanged(kTimelineFeatureName, "false"); + m_client->runtimePropertyChanged(kInspectorStateFeatureName, state); } void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString& script) diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h index 36cafcf..47c4ccf 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -93,16 +93,14 @@ public: virtual void hideHighlight(); virtual void populateSetting(const WTF::String& key, WTF::String* value); virtual void storeSetting(const WTF::String& key, const WTF::String& value); - virtual void resourceTrackingWasEnabled(); - virtual void resourceTrackingWasDisabled(); - virtual void timelineProfilerWasStarted(); - virtual void timelineProfilerWasStopped(); + virtual void updateInspectorStateCookie(const WTF::String&); virtual bool sendMessageToFrontend(const WTF::String&); int hostId() { return m_hostId; } private: void setApuAgentEnabled(bool enabled); + void connectFrontend(bool afterNavigation); WebCore::InspectorController* inspectorController(); diff --git a/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp b/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp index 820c970..8a75ca1 100644 --- a/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp +++ b/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp @@ -32,6 +32,11 @@ namespace WebKit { +WebDeviceOrientationClientMock* WebDeviceOrientationClientMock::create() +{ + return new WebDeviceOrientationClientMock(); +} + void WebDeviceOrientationClientMock::setController(WebDeviceOrientationController* controller) { m_clientMock->setController(controller->controller()); diff --git a/WebKit/chromium/src/WebFormElement.cpp b/WebKit/chromium/src/WebFormElement.cpp index 9c77732..7a01053 100644 --- a/WebKit/chromium/src/WebFormElement.cpp +++ b/WebKit/chromium/src/WebFormElement.cpp @@ -68,7 +68,7 @@ WebString WebFormElement::method() const bool WebFormElement::wasUserSubmitted() const { - return constUnwrap<HTMLFormElement>()->submissionTrigger() == NotSubmittedByJavaScript; + return constUnwrap<HTMLFormElement>()->wasUserSubmitted(); } void WebFormElement::submit() diff --git a/WebKit/chromium/src/WebFrameImpl.cpp b/WebKit/chromium/src/WebFrameImpl.cpp index a2d6a46..2d42f4b 100644 --- a/WebKit/chromium/src/WebFrameImpl.cpp +++ b/WebKit/chromium/src/WebFrameImpl.cpp @@ -1012,22 +1012,9 @@ void WebFrameImpl::dispatchWillSendRequest(WebURLRequest& request) 0, 0, request.toMutableResourceRequest(), response); } -void WebFrameImpl::commitDocumentData(const char* data, size_t dataLen) +void WebFrameImpl::commitDocumentData(const char* data, size_t length) { - DocumentLoader* documentLoader = m_frame->loader()->documentLoader(); - - // Set the text encoding. This calls begin() for us. It is safe to call - // this multiple times (Mac does: page/mac/WebCoreFrameBridge.mm). - bool userChosen = true; - String encoding = documentLoader->overrideEncoding(); - if (encoding.isNull()) { - userChosen = false; - encoding = documentLoader->response().textEncodingName(); - } - m_frame->loader()->writer()->setEncoding(encoding, userChosen); - - // NOTE: mac only does this if there is a document - m_frame->loader()->addData(data, dataLen); + m_frame->loader()->documentLoader()->commitData(data, length); } unsigned WebFrameImpl::unloadListenerCount() const @@ -1229,7 +1216,7 @@ void WebFrameImpl::selectWordAroundPosition(Frame* frame, VisiblePosition pos) VisibleSelection selection(pos); selection.expandUsingGranularity(WordGranularity); - if (frame->shouldChangeSelection(selection)) { + if (frame->selection()->shouldChangeSelection(selection)) { TextGranularity granularity = selection.isRange() ? WordGranularity : CharacterGranularity; frame->selection()->setSelection(selection, granularity); } @@ -1713,11 +1700,18 @@ int WebFrameImpl::pageNumberForElementById(const WebString& id, WebRect WebFrameImpl::selectionBoundsRect() const { if (hasSelection()) - return IntRect(frame()->selectionBounds(false)); + return IntRect(frame()->selection()->bounds(false)); return WebRect(); } +bool WebFrameImpl::selectionStartHasSpellingMarkerFor(int from, int length) const +{ + if (!m_frame) + return false; + return m_frame->editor()->selectionStartHasSpellingMarkerFor(from, length); +} + // WebFrameImpl public --------------------------------------------------------- PassRefPtr<WebFrameImpl> WebFrameImpl::create(WebFrameClient* client) diff --git a/WebKit/chromium/src/WebFrameImpl.h b/WebKit/chromium/src/WebFrameImpl.h index 14217fa..25e7004 100644 --- a/WebKit/chromium/src/WebFrameImpl.h +++ b/WebKit/chromium/src/WebFrameImpl.h @@ -182,6 +182,8 @@ public: float pageHeightInPixels) const; virtual WebRect selectionBoundsRect() const; + virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const; + static PassRefPtr<WebFrameImpl> create(WebFrameClient* client); ~WebFrameImpl(); diff --git a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp index bbb7162..bbc852f 100644 --- a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp +++ b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp @@ -79,13 +79,15 @@ public: virtual void setIsAllowed(bool allowed); virtual void setLastPosition(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, long long timestamp); virtual void setLastError(int errorCode, const WebString& message); - virtual void onWebGeolocationServiceDestroyed(); + virtual void didDestroyGeolocationService(); private: - WebViewClient* getWebViewClient(); - + bool isAttached() const; + // Pointer back to the WebKit geolocation client. We obtain this via the frame's page, but need to cache it + // as it may still be alive after the page has detached from the frame. + WebGeolocationService* m_webGeolocationService; // GeolocationServiceChromium owns us, we only have a pointer back to it. - GeolocationServiceChromium* m_GeolocationServiceChromium; + GeolocationServiceChromium* m_geolocationServiceChromium; int m_bridgeId; }; @@ -95,49 +97,47 @@ GeolocationServiceBridge* createGeolocationServiceBridgeImpl(GeolocationServiceC } WebGeolocationServiceBridgeImpl::WebGeolocationServiceBridgeImpl(GeolocationServiceChromium* geolocationServiceChromium) - : m_GeolocationServiceChromium(geolocationServiceChromium) + : m_webGeolocationService(0) + , m_geolocationServiceChromium(geolocationServiceChromium) , m_bridgeId(0) { } WebGeolocationServiceBridgeImpl::~WebGeolocationServiceBridgeImpl() { - WebKit::WebViewClient* webViewClient = getWebViewClient(); - // Geolocation has an OwnPtr to us, and it's destroyed after the frame has - // been potentially disconnected. In this case, it calls stopUpdating() - // has been called and we have already detached ourselves. - if (!webViewClient) - ASSERT(!m_bridgeId); - else if (m_bridgeId) - webViewClient->geolocationService()->detachBridge(m_bridgeId); + if (isAttached()) + m_webGeolocationService->detachBridge(m_bridgeId); } bool WebGeolocationServiceBridgeImpl::startUpdating(PositionOptions* positionOptions) { attachBridgeIfNeeded(); - getWebViewClient()->geolocationService()->startUpdating(m_bridgeId, m_GeolocationServiceChromium->frame()->document()->url(), positionOptions->enableHighAccuracy()); + if (!isAttached()) + return false; + m_webGeolocationService->startUpdating(m_bridgeId, m_geolocationServiceChromium->frame()->document()->url(), positionOptions->enableHighAccuracy()); return true; } void WebGeolocationServiceBridgeImpl::stopUpdating() { - WebViewClient* webViewClient = getWebViewClient(); - if (m_bridgeId && webViewClient) { - WebGeolocationService* geolocationService = webViewClient->geolocationService(); - geolocationService->stopUpdating(m_bridgeId); - geolocationService->detachBridge(m_bridgeId); + if (isAttached()) { + m_webGeolocationService->stopUpdating(m_bridgeId); + m_webGeolocationService->detachBridge(m_bridgeId); + m_bridgeId = 0; + m_webGeolocationService = 0; } - m_bridgeId = 0; } void WebGeolocationServiceBridgeImpl::suspend() { - getWebViewClient()->geolocationService()->suspend(m_bridgeId); + if (isAttached()) + m_webGeolocationService->suspend(m_bridgeId); } void WebGeolocationServiceBridgeImpl::resume() { - getWebViewClient()->geolocationService()->resume(m_bridgeId); + if (isAttached()) + m_webGeolocationService->resume(m_bridgeId); } int WebGeolocationServiceBridgeImpl::getBridgeId() const @@ -147,38 +147,54 @@ int WebGeolocationServiceBridgeImpl::getBridgeId() const void WebGeolocationServiceBridgeImpl::attachBridgeIfNeeded() { - if (!m_bridgeId) - m_bridgeId = getWebViewClient()->geolocationService()->attachBridge(this); + if (isAttached()) + return; + // Lazy attach to the geolocation service of the associated page if there is one. + Frame* frame = m_geolocationServiceChromium->frame(); + if (!frame || !frame->page()) + return; + WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(frame->page()->chrome()->client()); + WebKit::WebViewClient* webViewClient = chromeClientImpl->webView()->client(); + m_webGeolocationService = webViewClient->geolocationService(); + ASSERT(m_webGeolocationService); + m_bridgeId = m_webGeolocationService->attachBridge(this); + if (!m_bridgeId) { + // Attach failed. Release association with this service. + m_webGeolocationService = 0; + } } void WebGeolocationServiceBridgeImpl::setIsAllowed(bool allowed) { - m_GeolocationServiceChromium->setIsAllowed(allowed); + m_geolocationServiceChromium->setIsAllowed(allowed); } void WebGeolocationServiceBridgeImpl::setLastPosition(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, long long timestamp) { RefPtr<Geoposition> geoposition = Geoposition::create(Coordinates::create(latitude, longitude, providesAltitude, altitude, accuracy, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed), timestamp); - m_GeolocationServiceChromium->setLastPosition(geoposition); + m_geolocationServiceChromium->setLastPosition(geoposition); } void WebGeolocationServiceBridgeImpl::setLastError(int errorCode, const WebString& message) { - m_GeolocationServiceChromium->setLastError(errorCode, message); + m_geolocationServiceChromium->setLastError(errorCode, message); } -WebViewClient* WebGeolocationServiceBridgeImpl::getWebViewClient() +void WebGeolocationServiceBridgeImpl::didDestroyGeolocationService() { - Frame* frame = m_GeolocationServiceChromium->frame(); - if (!frame || !frame->page()) - return 0; - WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(frame->page()->chrome()->client()); - WebKit::WebViewClient* webViewClient = chromeClientImpl->webView()->client(); - return webViewClient; + m_bridgeId = 0; + m_webGeolocationService = 0; } -void WebGeolocationServiceBridgeImpl::onWebGeolocationServiceDestroyed() +bool WebGeolocationServiceBridgeImpl::isAttached() const { + // Test the class invariant. + if (m_webGeolocationService) + ASSERT(m_bridgeId); + else + ASSERT(!m_bridgeId); + + return m_webGeolocationService; } } // namespace WebKit diff --git a/WebKit/chromium/src/WebGeolocationServiceMock.cpp b/WebKit/chromium/src/WebGeolocationServiceMock.cpp index 2a10c96..e149cf1 100644 --- a/WebKit/chromium/src/WebGeolocationServiceMock.cpp +++ b/WebKit/chromium/src/WebGeolocationServiceMock.cpp @@ -34,9 +34,11 @@ #include "GeolocationService.h" #include "GeolocationServiceChromium.h" #include "GeolocationServiceMock.h" +#include "WebGeolocationServiceBridge.h" #include "WebString.h" #include <wtf/CurrentTime.h> #include <wtf/HashMap.h> +#include <wtf/Vector.h> #if ENABLE(GEOLOCATION) @@ -51,6 +53,7 @@ using WebCore::Geoposition; using WebCore::PositionError; using WebCore::PositionOptions; using WTF::String; +using WTF::Vector; namespace WebCore { class GeolocationServiceChromiumMock : public GeolocationServiceChromium, public GeolocationServiceClient { @@ -124,17 +127,34 @@ namespace WebKit { class WebGeolocationServiceMockImpl : public WebGeolocationServiceMock { public: - virtual ~WebGeolocationServiceMockImpl() { } + WebGeolocationServiceMockImpl(); + virtual ~WebGeolocationServiceMockImpl(); + static void setMockGeolocationPermission(bool allowed); + + // WebGeolocationService virtual void requestPermissionForFrame(int bridgeId, const WebURL& url); virtual int attachBridge(WebGeolocationServiceBridge*); virtual void detachBridge(int bridgeId); private: + void notifyPendingPermissions(); + typedef HashMap<int, WebGeolocationServiceBridge*> IdToBridgeMap; IdToBridgeMap m_idToBridgeMap; + Vector<int> m_pendingPermissionRequests; + + // In addition to the singleton instance pointer, we need to keep the setMockGeolocationPermission() state + // as a static (not object members) as this call may come in before the service has been created. + static enum PermissionState { + PermissionStateUnset, + PermissionStateAllowed, + PermissionStateDenied, + } s_permissionState; + static WebGeolocationServiceMockImpl* s_instance; }; -bool WebGeolocationServiceMock::s_mockGeolocationPermission = false; +WebGeolocationServiceMockImpl::PermissionState WebGeolocationServiceMockImpl::s_permissionState = WebGeolocationServiceMockImpl::PermissionStateUnset; +WebGeolocationServiceMockImpl* WebGeolocationServiceMockImpl::s_instance = 0; WebGeolocationServiceMock* WebGeolocationServiceMock::createWebGeolocationServiceMock() { @@ -143,7 +163,7 @@ WebGeolocationServiceMock* WebGeolocationServiceMock::createWebGeolocationServic void WebGeolocationServiceMock::setMockGeolocationPermission(bool allowed) { - s_mockGeolocationPermission = allowed; + WebGeolocationServiceMockImpl::setMockGeolocationPermission(allowed); } void WebGeolocationServiceMock::setMockGeolocationPosition(double latitude, double longitude, double accuracy) @@ -160,12 +180,35 @@ void WebGeolocationServiceMock::setMockGeolocationError(int errorCode, const Web GeolocationServiceMock::setError(positionError); } +WebGeolocationServiceMockImpl::WebGeolocationServiceMockImpl() +{ + ASSERT(!s_instance); + s_instance = this; +} + +WebGeolocationServiceMockImpl::~WebGeolocationServiceMockImpl() +{ + ASSERT(this == s_instance); + s_instance = 0; + // Reset the permission state, so any future service instance (e.g. running + // multiple tests in a single DRT run) will see a clean call sequence. + s_permissionState = PermissionStateUnset; + for (IdToBridgeMap::iterator it = m_idToBridgeMap.begin(); it != m_idToBridgeMap.end(); ++it) + it->second->didDestroyGeolocationService(); +} + +void WebGeolocationServiceMockImpl::setMockGeolocationPermission(bool allowed) +{ + s_permissionState = allowed ? PermissionStateAllowed : PermissionStateDenied; + if (s_instance) + s_instance->notifyPendingPermissions(); +} + void WebGeolocationServiceMockImpl::requestPermissionForFrame(int bridgeId, const WebURL& url) { - IdToBridgeMap::iterator iter = m_idToBridgeMap.find(bridgeId); - if (iter == m_idToBridgeMap.end()) - return; - iter->second->setIsAllowed(s_mockGeolocationPermission); + m_pendingPermissionRequests.append(bridgeId); + if (s_permissionState != PermissionStateUnset) + notifyPendingPermissions(); } int WebGeolocationServiceMockImpl::attachBridge(WebGeolocationServiceBridge* bridge) @@ -183,6 +226,19 @@ void WebGeolocationServiceMockImpl::detachBridge(int bridgeId) m_idToBridgeMap.remove(bridgeId); } +void WebGeolocationServiceMockImpl::notifyPendingPermissions() +{ + ASSERT(s_permissionState == PermissionStateAllowed || s_permissionState == PermissionStateDenied); + Vector<int> pendingPermissionRequests; + pendingPermissionRequests.swap(m_pendingPermissionRequests); + for (Vector<int>::const_iterator it = pendingPermissionRequests.begin(); it != pendingPermissionRequests.end(); ++it) { + ASSERT(*it > 0); + IdToBridgeMap::iterator iter = m_idToBridgeMap.find(*it); + if (iter != m_idToBridgeMap.end()) + iter->second->setIsAllowed(s_permissionState == PermissionStateAllowed); + } +} + } // namespace WebKit #endif // ENABLE(GEOLOCATION) diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp index 6e1adca..24dcf9a 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -97,11 +97,16 @@ WebGraphicsContext3DDefaultImpl::~WebGraphicsContext3DDefaultImpl() } } -bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView) +bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView, bool renderDirectlyToWebView) { + if (renderDirectlyToWebView) { + // This mode isn't supported with the in-process implementation yet. (FIXME) + return false; + } + if (!gfx::GLContext::InitializeOneOff()) return false; - + m_glContext = WTF::adoptPtr(gfx::GLContext::CreateOffscreenGLContext(0)); if (!m_glContext) return false; @@ -114,6 +119,11 @@ bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attribute return true; } +bool WebGraphicsContext3DDefaultImpl::initialize(WebGraphicsContext3D::Attributes attributes, WebView* webView) +{ + return initialize(attributes, webView, false); +} + void WebGraphicsContext3DDefaultImpl::validateAttributes() { const char* extensions = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); @@ -463,6 +473,40 @@ bool WebGraphicsContext3DDefaultImpl::supportsBGRA() return false; } +bool WebGraphicsContext3DDefaultImpl::supportsMapSubCHROMIUM() +{ + // We don't claim support for this extension at this time + return false; +} + +void* WebGraphicsContext3DDefaultImpl::mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access) +{ + return 0; +} + +void WebGraphicsContext3DDefaultImpl::unmapBufferSubDataCHROMIUM(const void* mem) +{ +} + +void* WebGraphicsContext3DDefaultImpl::mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access) +{ + return 0; +} + +void WebGraphicsContext3DDefaultImpl::unmapTexSubImage2DCHROMIUM(const void* mem) +{ +} + +bool WebGraphicsContext3DDefaultImpl::supportsCopyTextureToParentTextureCHROMIUM() +{ + // We don't claim support for this extension at this time + return false; +} + +void WebGraphicsContext3DDefaultImpl::copyTextureToParentTextureCHROMIUM(unsigned id, unsigned id2) +{ +} + // Helper macros to reduce the amount of code. #define DELEGATE_TO_GL(name, glname) \ diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h index a4c5b4b..5bf439a 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h @@ -59,6 +59,8 @@ public: //---------------------------------------------------------------------- // WebGraphicsContext3D methods + virtual bool initialize(WebGraphicsContext3D::Attributes attributes, WebView*, bool); + // FIXME: remove once compositor is switched over to GraphicsContext3D. virtual bool initialize(WebGraphicsContext3D::Attributes attributes, WebView*); virtual bool makeContextCurrent(); @@ -80,6 +82,13 @@ public: virtual void synthesizeGLError(unsigned long error); virtual bool supportsBGRA(); + virtual bool supportsMapSubCHROMIUM(); + virtual void* mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access); + virtual void unmapBufferSubDataCHROMIUM(const void*); + virtual void* mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access); + virtual void unmapTexSubImage2DCHROMIUM(const void*); + virtual bool supportsCopyTextureToParentTextureCHROMIUM(); + virtual void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture); virtual void activeTexture(unsigned long texture); virtual void attachShader(WebGLId program, WebGLId shader); diff --git a/WebKit/chromium/src/WebHTTPBody.cpp b/WebKit/chromium/src/WebHTTPBody.cpp index e54b4e5..93b94c2 100644 --- a/WebKit/chromium/src/WebHTTPBody.cpp +++ b/WebKit/chromium/src/WebHTTPBody.cpp @@ -78,7 +78,9 @@ bool WebHTTPBody::elementAt(size_t index, Element& result) const result.filePath.reset(); result.fileStart = 0; result.fileLength = 0; + // FIXME: remove this line once all users of Element have been switched to use 'modificationTime'. result.fileInfo.modificationTime = 0.0; + result.modificationTime = 0.0; result.blobURL = KURL(); switch (element.m_type) { @@ -92,7 +94,9 @@ bool WebHTTPBody::elementAt(size_t index, Element& result) const #if ENABLE(BLOB) result.fileStart = element.m_fileStart; result.fileLength = element.m_fileLength; + // FIXME: remove this line once all users of Element have been switched to use 'modificationTime'. result.fileInfo.modificationTime = element.m_expectedFileModificationTime; + result.modificationTime = element.m_expectedFileModificationTime; #endif break; #if ENABLE(BLOB) @@ -123,14 +127,20 @@ void WebHTTPBody::appendFile(const WebString& filePath) m_private->appendFile(filePath); } -void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart, long long fileLength, const WebFileInfo& fileInfo) +void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart, long long fileLength, double modificationTime) { #if ENABLE(BLOB) ensureMutable(); - m_private->appendFileRange(filePath, fileStart, fileLength, fileInfo.modificationTime); + m_private->appendFileRange(filePath, fileStart, fileLength, modificationTime); #endif } +// FIXME: Remove this method once all callers have been switched to use the method above. +void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart, long long fileLength, const WebFileInfo& fileInfo) +{ + return appendFileRange(filePath, fileStart, fileLength, fileInfo.modificationTime); +} + void WebHTTPBody::appendBlob(const WebURL& blobURL) { #if ENABLE(BLOB) diff --git a/WebKit/chromium/src/WebIDBCursorImpl.cpp b/WebKit/chromium/src/WebIDBCursorImpl.cpp index b74d680..6a1053e 100644 --- a/WebKit/chromium/src/WebIDBCursorImpl.cpp +++ b/WebKit/chromium/src/WebIDBCursorImpl.cpp @@ -55,9 +55,19 @@ WebIDBKey WebIDBCursorImpl::key() const return WebIDBKey(m_idbCursorBackend->key()); } -WebSerializedScriptValue WebIDBCursorImpl::value() const +void WebIDBCursorImpl::value(WebSerializedScriptValue& serializedScriptValue, WebIDBKey& idbKey) const { - return m_idbCursorBackend->value(); + // Verify we're starting off with blank slates. + ASSERT(serializedScriptValue.isNull()); + ASSERT(idbKey.type() == WebIDBKey::InvalidType); + + RefPtr<IDBAny> any = m_idbCursorBackend->value(); + if (any->type() == IDBAny::SerializedScriptValueType) + serializedScriptValue.assign(any->serializedScriptValue()); + else if (any->type() == IDBAny::IDBKeyType) + idbKey.assign(any->idbKey()); + else + ASSERT_NOT_REACHED(); } void WebIDBCursorImpl::update(const WebSerializedScriptValue& value, WebIDBCallbacks* callbacks) diff --git a/WebKit/chromium/src/WebIDBCursorImpl.h b/WebKit/chromium/src/WebIDBCursorImpl.h index 565e86a..5fb9e1c 100644 --- a/WebKit/chromium/src/WebIDBCursorImpl.h +++ b/WebKit/chromium/src/WebIDBCursorImpl.h @@ -43,7 +43,7 @@ public: virtual unsigned short direction() const; virtual WebIDBKey key() const; - virtual WebSerializedScriptValue value() const; + virtual void value(WebSerializedScriptValue&, WebIDBKey&) const; virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*); virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*); virtual void remove(WebIDBCallbacks*); diff --git a/WebKit/chromium/src/WebIDBFactoryImpl.cpp b/WebKit/chromium/src/WebIDBFactoryImpl.cpp index 564be36..3c8d459 100755 --- a/WebKit/chromium/src/WebIDBFactoryImpl.cpp +++ b/WebKit/chromium/src/WebIDBFactoryImpl.cpp @@ -58,9 +58,9 @@ WebIDBFactoryImpl::~WebIDBFactoryImpl() { } -void WebIDBFactoryImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*) +void WebIDBFactoryImpl::open(const WebString& name, const WebString& description, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, const WebString& dataDir) { - m_idbFactoryBackend->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0); + m_idbFactoryBackend->open(name, description, IDBCallbacksProxy::create(callbacks), origin, 0, dataDir); } void WebIDBFactoryImpl::abortPendingTransactions(const WebVector<int>& pendingIDs) diff --git a/WebKit/chromium/src/WebIDBFactoryImpl.h b/WebKit/chromium/src/WebIDBFactoryImpl.h index aeab478..4dc0a10 100755 --- a/WebKit/chromium/src/WebIDBFactoryImpl.h +++ b/WebKit/chromium/src/WebIDBFactoryImpl.h @@ -42,7 +42,7 @@ public: WebIDBFactoryImpl(); virtual ~WebIDBFactoryImpl(); - virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*); + virtual void open(const WebString& name, const WebString& description, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir); virtual void abortPendingTransactions(const WebVector<int>& pendingIDs); private: diff --git a/WebKit/chromium/src/WebIDBIndexImpl.cpp b/WebKit/chromium/src/WebIDBIndexImpl.cpp index 777ec32..c049aac 100644 --- a/WebKit/chromium/src/WebIDBIndexImpl.cpp +++ b/WebKit/chromium/src/WebIDBIndexImpl.cpp @@ -26,7 +26,12 @@ #include "config.h" #include "WebIDBIndexImpl.h" +#include "IDBCallbacksProxy.h" #include "IDBIndex.h" +#include "IDBKeyRange.h" +#include "WebIDBCallbacks.h" +#include "WebIDBKey.h" +#include "WebIDBKeyRange.h" #if ENABLE(INDEXED_DATABASE) @@ -48,6 +53,11 @@ WebString WebIDBIndexImpl::name() const return m_backend->name(); } +WebString WebIDBIndexImpl::storeName() const +{ + return m_backend->storeName(); +} + WebString WebIDBIndexImpl::keyPath() const { return m_backend->keyPath(); @@ -58,6 +68,26 @@ bool WebIDBIndexImpl::unique() const return m_backend->unique(); } +void WebIDBIndexImpl::openCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks) +{ + m_backend->openCursor(keyRange, direction, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBIndexImpl::openObjectCursor(const WebIDBKeyRange& keyRange, unsigned short direction, WebIDBCallbacks* callbacks) +{ + m_backend->openObjectCursor(keyRange, direction, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBIndexImpl::getObject(const WebIDBKey& keyRange, WebIDBCallbacks* callbacks) +{ + m_backend->getObject(keyRange, IDBCallbacksProxy::create(callbacks)); +} + +void WebIDBIndexImpl::get(const WebIDBKey& keyRange, WebIDBCallbacks* callbacks) +{ + m_backend->get(keyRange, IDBCallbacksProxy::create(callbacks)); +} + } // namespace WebCore #endif // ENABLE(INDEXED_DATABASE) diff --git a/WebKit/chromium/src/WebIDBIndexImpl.h b/WebKit/chromium/src/WebIDBIndexImpl.h index 73f3819..2108001 100644 --- a/WebKit/chromium/src/WebIDBIndexImpl.h +++ b/WebKit/chromium/src/WebIDBIndexImpl.h @@ -42,9 +42,15 @@ public: virtual ~WebIDBIndexImpl(); virtual WebString name() const; + virtual WebString storeName() const; virtual WebString keyPath() const; virtual bool unique() const; + virtual void openObjectCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*); + virtual void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*); + virtual void getObject(const WebIDBKey&, WebIDBCallbacks*); + virtual void get(const WebIDBKey&, WebIDBCallbacks*); + private: WTF::RefPtr<WebCore::IDBIndexBackendInterface> m_backend; }; diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp index 7bf6407..25d484c 100644 --- a/WebKit/chromium/src/WebInputElement.cpp +++ b/WebKit/chromium/src/WebInputElement.cpp @@ -40,6 +40,26 @@ using namespace WebCore; namespace WebKit { +bool WebInputElement::isTextField() const +{ + return constUnwrap<HTMLInputElement>()->isTextField(); +} + +bool WebInputElement::isText() const +{ + return constUnwrap<HTMLInputElement>()->isText(); +} + +bool WebInputElement::isPasswordField() const +{ + return constUnwrap<HTMLInputElement>()->isPasswordField(); +} + +bool WebInputElement::isImageButton() const +{ + return constUnwrap<HTMLInputElement>()->isImageButton(); +} + bool WebInputElement::autoComplete() const { return constUnwrap<HTMLInputElement>()->autoComplete(); @@ -57,7 +77,7 @@ bool WebInputElement::isEnabledFormControl() const WebInputElement::InputType WebInputElement::inputType() const { - return static_cast<InputType>(constUnwrap<HTMLInputElement>()->inputType()); + return static_cast<InputType>(constUnwrap<HTMLInputElement>()->deprecatedInputType()); } int WebInputElement::maxLength() const diff --git a/WebKit/chromium/src/WebKit.cpp b/WebKit/chromium/src/WebKit.cpp index f3336ea..cadcb6c 100644 --- a/WebKit/chromium/src/WebKit.cpp +++ b/WebKit/chromium/src/WebKit.cpp @@ -103,11 +103,6 @@ bool layoutTestMode() return s_layoutTestMode; } -bool areLayoutTestImagesOpaque() -{ - return true; -} - void enableLogChannel(const char* name) { WTFLogChannel* channel = WebCore::getChannelFromName(name); diff --git a/WebKit/chromium/src/WebPasswordFormUtils.cpp b/WebKit/chromium/src/WebPasswordFormUtils.cpp index e5d5411..6968e1a 100644 --- a/WebKit/chromium/src/WebPasswordFormUtils.cpp +++ b/WebKit/chromium/src/WebPasswordFormUtils.cpp @@ -79,8 +79,8 @@ void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields) continue; if ((fields->passwords.size() < maxPasswords) - && (inputElement->inputType() == HTMLInputElement::PASSWORD) - && (inputElement->autoComplete())) { + && inputElement->isPasswordField() + && inputElement->autoComplete()) { if (fields->passwords.isEmpty()) firstPasswordIndex = i; fields->passwords.append(inputElement); @@ -98,7 +98,9 @@ void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields) if (!inputElement->isEnabledFormControl()) continue; - if ((inputElement->inputType() == HTMLInputElement::TEXT) + // FIXME: This needs to use a function other than deprecatedInputType. + // Does this really want to special-case TEXT, and not other text-field-like input elements? + if ((inputElement->deprecatedInputType() == HTMLInputElement::TEXT) && (inputElement->autoComplete())) { fields->userName = inputElement; break; diff --git a/WebKit/chromium/src/WebPopupMenuImpl.cpp b/WebKit/chromium/src/WebPopupMenuImpl.cpp index 75d6cc1..085a157 100644 --- a/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -174,6 +174,16 @@ void WebPopupMenuImpl::paint(WebCanvas* canvas, const WebRect& rect) } } +void WebPopupMenuImpl::themeChanged() +{ + notImplemented(); +} + +void WebPopupMenuImpl::composite(bool finish) +{ + notImplemented(); +} + bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) { if (!m_widget) diff --git a/WebKit/chromium/src/WebPopupMenuImpl.h b/WebKit/chromium/src/WebPopupMenuImpl.h index edbb4ab..221ba03 100644 --- a/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/WebKit/chromium/src/WebPopupMenuImpl.h @@ -63,6 +63,8 @@ public: virtual void resize(const WebSize&); virtual void layout(); virtual void paint(WebCanvas* canvas, const WebRect& rect); + virtual void themeChanged(); + virtual void composite(bool finish); virtual bool handleInputEvent(const WebInputEvent&); virtual void mouseCaptureLost(); virtual void setFocus(bool enable); diff --git a/WebKit/chromium/src/WebSearchableFormData.cpp b/WebKit/chromium/src/WebSearchableFormData.cpp index 1864514..5fc51ca 100644 --- a/WebKit/chromium/src/WebSearchableFormData.cpp +++ b/WebKit/chromium/src/WebSearchableFormData.cpp @@ -131,7 +131,7 @@ bool IsInDefaultState(const HTMLFormControlElement* formElement) { if (formElement->hasTagName(HTMLNames::inputTag)) { const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(formElement); - if (inputElement->inputType() == HTMLInputElement::CHECKBOX || inputElement->inputType() == HTMLInputElement::RADIO) + if (inputElement->isCheckbox() || inputElement->isRadioButton()) return inputElement->checked() == inputElement->defaultChecked(); } else if (formElement->hasTagName(HTMLNames::selectTag)) return IsSelectInDefaultState(static_cast<const HTMLSelectElement*>(formElement)); @@ -166,19 +166,24 @@ bool HasSuitableTextElement(const HTMLFormElement* form, Vector<char>* encodedSt bool isTextElement = false; if (formElement->hasTagName(HTMLNames::inputTag)) { - switch (static_cast<const HTMLInputElement*>(formElement)->inputType()) { + if (static_cast<const HTMLInputElement*>(formElement)->isFileUpload()) { + // Too big, don't try to index this. + return 0; + } + + if (static_cast<const HTMLInputElement*>(formElement)->isPasswordField()) { + // Don't store passwords! This is most likely an https anyway. + return 0; + } + + // FIXME: This needs to use a function on HTMLInputElement other than deprecatedInputType. + // Also, it's not clear why TEXT should be handled differently than, say, SEARCH. + switch (static_cast<const HTMLInputElement*>(formElement)->deprecatedInputType()) { case HTMLInputElement::TEXT: case HTMLInputElement::ISINDEX: isTextElement = true; break; - case HTMLInputElement::PASSWORD: - // Don't store passwords! This is most likely an https anyway. - // Fall through. - case HTMLInputElement::FILE: - // Too big, don't try to index this. - return 0; default: - // All other input types are indexable. break; } } diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 137bf06..a1c6578 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -34,6 +34,7 @@ #include "AutoFillPopupMenuClient.h" #include "AXObjectCache.h" #include "Chrome.h" +#include "ColorSpace.h" #include "CompositionUnderlineVectorBuilder.h" #include "ContextMenu.h" #include "ContextMenuController.h" @@ -55,17 +56,17 @@ #include "FrameLoader.h" #include "FrameTree.h" #include "FrameView.h" -#include "GLES2Context.h" -#include "GLES2ContextInternal.h" #include "GraphicsContext.h" #include "GraphicsContext3D.h" +#include "GraphicsContext3DInternal.h" #include "HTMLInputElement.h" #include "HTMLMediaElement.h" #include "HitTestResult.h" #include "HTMLNames.h" #include "Image.h" +#include "ImageBuffer.h" +#include "ImageData.h" #include "InspectorController.h" -#include "IntRect.h" #include "KeyboardCodes.h" #include "KeyboardEvent.h" #include "MIMETypeRegistry.h" @@ -115,7 +116,11 @@ #include "WebString.h" #include "WebVector.h" #include "WebViewClient.h" -#include "wtf/OwnPtr.h" +#include <wtf/RefPtr.h> + +#if PLATFORM(CG) +#include <CoreGraphics/CGContext.h> +#endif #if OS(WINDOWS) #include "RenderThemeChromiumWin.h" @@ -245,6 +250,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools , m_newNavigationLoader(0) #endif , m_zoomLevel(0) + , m_zoomTextOnly(false) , m_contextMenuAllowed(false) , m_doingDragAndDrop(false) , m_ignoreInputEvents(false) @@ -270,7 +276,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools #if ENABLE(INPUT_SPEECH) , m_speechInputClient(client) #endif - , m_gles2Context(0) , m_deviceOrientationClientProxy(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0)) { // WebKit/win/WebView.cpp does the same thing, except they call the @@ -912,13 +917,18 @@ void WebViewImpl::resize(const WebSize& newSize) if (m_client) { WebRect damagedRect(0, 0, m_size.width, m_size.height); - m_client->didInvalidateRect(damagedRect); + if (isAcceleratedCompositingActive()) { +#if USE(ACCELERATED_COMPOSITING) + invalidateRootLayerRect(damagedRect); +#endif + } else + m_client->didInvalidateRect(damagedRect); } #if OS(DARWIN) - if (m_gles2Context) { - m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width), - std::max(1, m_size.height))); + if (m_layerRenderer) { + m_layerRenderer->resizeOnscreenContent(WebCore::IntSize(std::max(1, m_size.width), + std::max(1, m_size.height))); } #endif } @@ -944,35 +954,90 @@ void WebViewImpl::layout() } } -void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) +#if USE(ACCELERATED_COMPOSITING) +void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect) { + ASSERT(rect.right() <= m_layerRenderer->rootLayerTextureSize().width() + && rect.bottom() <= m_layerRenderer->rootLayerTextureSize().height()); + +#if PLATFORM(SKIA) + PlatformContextSkia context(canvas); + + // PlatformGraphicsContext is actually a pointer to PlatformContextSkia + GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context)); + int bitmapHeight = canvas->getDevice()->accessBitmap(false).height(); +#elif PLATFORM(CG) + GraphicsContext gc(canvas); + int bitmapHeight = CGBitmapContextGetHeight(reinterpret_cast<CGContextRef>(canvas)); +#else + notImplemented(); +#endif + // Compute rect to sample from inverted GPU buffer. + IntRect invertRect(rect.x(), bitmapHeight - rect.bottom(), rect.width(), rect.height()); + + OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(rect.size())); + RefPtr<ImageData> imageData(ImageData::create(rect.width(), rect.height())); + if (imageBuffer.get() && imageData.get()) { + m_layerRenderer->getFramebufferPixels(imageData->data()->data()->data(), invertRect); + imageBuffer->putPremultipliedImageData(imageData.get(), IntRect(IntPoint(), rect.size()), IntPoint()); + gc.save(); + gc.translate(FloatSize(0.0f, bitmapHeight)); + gc.scale(FloatSize(1.0f, -1.0f)); + // Use invertRect in next line, so that transform above inverts it back to + // desired destination rect. + gc.drawImageBuffer(imageBuffer.get(), DeviceColorSpace, invertRect.location()); + gc.restore(); + } +} +#endif +void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) +{ + if (isAcceleratedCompositingActive()) { #if USE(ACCELERATED_COMPOSITING) - if (!isAcceleratedCompositingActive()) { + doComposite(); + + // If a canvas was passed in, we use it to grab a copy of the + // freshly-rendered pixels. + if (canvas) { + // Clip rect to the confines of the rootLayerTexture. + IntRect resizeRect(rect); + resizeRect.intersect(IntRect(IntPoint(), m_layerRenderer->rootLayerTextureSize())); + doPixelReadbackToCanvas(canvas, resizeRect); + } + + // Temporarily present so the downstream Chromium renderwidget still renders. + // FIXME: remove this call once the changes to Chromium's renderwidget have landed. + m_layerRenderer->present(); #endif + } else { WebFrameImpl* webframe = mainFrameImpl(); if (webframe) webframe->paint(canvas, rect); -#if USE(ACCELERATED_COMPOSITING) - } else { - // Draw the contents of the root layer. - updateRootLayerContents(rect); + } +} - WebFrameImpl* webframe = mainFrameImpl(); - if (!webframe) - return; - FrameView* view = webframe->frameView(); - if (!view) - return; +void WebViewImpl::themeChanged() +{ + if (!page()) + return; + FrameView* view = page()->mainFrame()->view(); - // The visibleRect includes scrollbars whereas the contentRect doesn't. - IntRect visibleRect = view->visibleContentRect(true); - IntRect contentRect = view->visibleContentRect(false); + WebRect damagedRect(0, 0, m_size.width, m_size.height); + view->invalidateRect(damagedRect); +} - // Ask the layer compositor to redraw all the layers. - ASSERT(m_layerRenderer->hardwareCompositing()); - m_layerRenderer->drawLayers(rect, visibleRect, contentRect, IntPoint(view->scrollX(), view->scrollY())); - } +void WebViewImpl::composite(bool finish) +{ +#if USE(ACCELERATED_COMPOSITING) + doComposite(); + + // Finish if requested. + if (finish) + m_layerRenderer->finish(); + + // Put result onscreen. + m_layerRenderer->present(); #endif } @@ -1474,16 +1539,23 @@ int WebViewImpl::setZoomLevel(bool textOnly, int zoomLevel) maxTextSizeMultiplier), minTextSizeMultiplier)); Frame* frame = mainFrameImpl()->frame(); - FrameView* view = frame->view(); - if (!view) - return m_zoomLevel; - if (zoomFactor != view->zoomFactor()) { - view->setZoomFactor(zoomFactor, textOnly ? ZoomTextOnly : ZoomPage); + + float oldZoomFactor = m_zoomTextOnly ? frame->textZoomFactor() : frame->pageZoomFactor(); + + if (textOnly) + frame->setPageAndTextZoomFactors(1, zoomFactor); + else + frame->setPageAndTextZoomFactors(zoomFactor, 1); + + if (oldZoomFactor != zoomFactor || textOnly != m_zoomTextOnly) { WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromFrame(frame); if (pluginContainer) pluginContainer->plugin()->setZoomFactor(zoomFactor, textOnly); - m_zoomLevel = zoomLevel; } + + m_zoomLevel = zoomLevel; + m_zoomTextOnly = textOnly; + return m_zoomLevel; } @@ -1904,6 +1976,11 @@ bool WebViewImpl::isActive() const return (page() && page()->focusController()) ? page()->focusController()->isActive() : false; } +void WebViewImpl::setDomainRelaxationForbidden(bool forbidden, const WebString& scheme) +{ + SecurityOrigin::setDomainRelaxationForbiddenForURLScheme(forbidden, String(scheme)); +} + void WebViewImpl::setScrollbarColors(unsigned inactiveColor, unsigned activeColor, unsigned trackColor) { @@ -2114,24 +2191,126 @@ bool WebViewImpl::allowsAcceleratedCompositing() void WebViewImpl::setRootGraphicsLayer(WebCore::PlatformLayer* layer) { + bool wasActive = m_isAcceleratedCompositingActive; setIsAcceleratedCompositingActive(layer ? true : false); if (m_layerRenderer) m_layerRenderer->setRootLayer(layer); + if (wasActive != m_isAcceleratedCompositingActive) { + IntRect damagedRect(0, 0, m_size.width, m_size.height); + if (m_isAcceleratedCompositingActive) + invalidateRootLayerRect(damagedRect); + else + m_client->didInvalidateRect(damagedRect); + } +} + +void WebViewImpl::setRootLayerNeedsDisplay() +{ + if (m_layerRenderer) + m_layerRenderer->setNeedsDisplay(); + m_client->scheduleComposite(); + // FIXME: To avoid breaking the downstream Chrome render_widget while downstream + // changes land, we also have to pass a 1x1 invalidate up to the client + { + WebRect damageRect(0, 0, 1, 1); + m_client->didInvalidateRect(damageRect); + } } + +void WebViewImpl::scrollRootLayerRect(const IntSize& scrollDelta, const IntRect& clipRect) +{ + // FIXME: To avoid breaking the Chrome render_widget when the new compositor render + // path is not checked in, we must still pass scroll damage up to the client. This + // code will be backed out in a followup CL once the Chromium changes have landed. + m_client->didScrollRect(scrollDelta.width(), scrollDelta.height(), clipRect); + + ASSERT(m_layerRenderer); + // Compute the damage rect in viewport space. + WebFrameImpl* webframe = mainFrameImpl(); + if (!webframe) + return; + FrameView* view = webframe->frameView(); + if (!view) + return; + + IntRect contentRect = view->visibleContentRect(false); + + // We support fast scrolling in one direction at a time. + if (scrollDelta.width() && scrollDelta.height()) { + invalidateRootLayerRect(WebRect(contentRect)); + return; + } + + // Compute the region we will expose by scrolling. We use the + // content rect for invalidation. Using this space for damage + // rects allows us to intermix invalidates with scrolls. + IntRect damagedContentsRect; + if (scrollDelta.width()) { + float dx = static_cast<float>(scrollDelta.width()); + damagedContentsRect.setY(contentRect.y()); + damagedContentsRect.setHeight(contentRect.height()); + if (dx > 0) { + damagedContentsRect.setX(contentRect.x()); + damagedContentsRect.setWidth(dx); + } else { + damagedContentsRect.setX(contentRect.right() + dx); + damagedContentsRect.setWidth(-dx); + } + } else { + float dy = static_cast<float>(scrollDelta.height()); + damagedContentsRect.setX(contentRect.x()); + damagedContentsRect.setWidth(contentRect.width()); + if (dy > 0) { + damagedContentsRect.setY(contentRect.y()); + damagedContentsRect.setHeight(dy); + } else { + damagedContentsRect.setY(contentRect.bottom() + dy); + damagedContentsRect.setHeight(-dy); + } + } + + m_scrollDamage.unite(damagedContentsRect); + setRootLayerNeedsDisplay(); +} + +void WebViewImpl::invalidateRootLayerRect(const IntRect& rect) +{ + // FIXME: To avoid breaking the Chrome render_widget when the new compositor render + // path is not checked in, we must still pass damage up to the client. This + // code will be backed out in a followup CL once the Chromium changes have landed. + m_client->didInvalidateRect(rect); + + ASSERT(m_layerRenderer); + + if (!page()) + return; + FrameView* view = page()->mainFrame()->view(); + + // rect is in viewport space. Convert to content space + // so that invalidations and scroll invalidations play well with one-another. + FloatRect contentRect = view->windowToContents(rect); + + // FIXME: add a smarter damage aggregation logic? Right now, LayerChromium does simple union-ing. + m_layerRenderer->rootLayer()->setNeedsDisplay(contentRect); +} + + void WebViewImpl::setIsAcceleratedCompositingActive(bool active) { if (m_isAcceleratedCompositingActive == active) return; if (active) { - m_layerRenderer = LayerRendererChromium::create(getOnscreenGLES2Context()); + OwnPtr<GraphicsContext3D> context = m_temporaryOnscreenGraphicsContext3D.release(); + if (!context) { + context = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow); + if (context) + context->reshape(std::max(1, m_size.width), std::max(1, m_size.height)); + } + m_layerRenderer = LayerRendererChromium::create(context.release()); if (m_layerRenderer) { m_isAcceleratedCompositingActive = true; - - // Force a redraw the entire view so that the compositor gets the entire view, - // rather than just the currently-dirty subset. - m_client->didInvalidateRect(IntRect(0, 0, m_size.width, m_size.height)); } else { m_isAcceleratedCompositingActive = false; m_compositorCreationFailed = true; @@ -2142,17 +2321,11 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) } } -void WebViewImpl::updateRootLayerContents(const WebRect& rect) +void WebViewImpl::updateRootLayerContents(const IntRect& rect) { if (!isAcceleratedCompositingActive()) return; - // FIXME: The accelerated compositing path invalidates a 1x1 rect at (0, 0) - // in order to get the renderer to ask the compositor to redraw. This is only - // temporary until we get the compositor to render directly from its own thread. - if (!rect.x && !rect.y && rect.width == 1 && rect.height == 1) - return; - WebFrameImpl* webframe = mainFrameImpl(); if (!webframe) return; @@ -2164,7 +2337,7 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect) if (rootLayer) { IntRect visibleRect = view->visibleContentRect(true); - m_layerRenderer->setRootLayerCanvasSize(IntSize(rect.width, rect.height)); + m_layerRenderer->setRootLayerCanvasSize(IntSize(rect.width(), rect.height())); GraphicsContext* rootLayerContext = m_layerRenderer->rootLayerGraphicsContext(); #if PLATFORM(SKIA) @@ -2174,7 +2347,7 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect) platformCanvas->save(); // Bring the canvas into the coordinate system of the paint rect. - platformCanvas->translate(static_cast<SkScalar>(-rect.x), static_cast<SkScalar>(-rect.y)); + platformCanvas->translate(static_cast<SkScalar>(-rect.x()), static_cast<SkScalar>(-rect.y())); rootLayerContext->save(); @@ -2188,7 +2361,7 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect) CGContextSaveGState(cgContext); // Bring the CoreGraphics context into the coordinate system of the paint rect. - CGContextTranslateCTM(cgContext, -rect.x, -rect.y); + CGContextTranslateCTM(cgContext, -rect.x(), -rect.y()); rootLayerContext->save(); @@ -2202,62 +2375,88 @@ void WebViewImpl::updateRootLayerContents(const WebRect& rect) } } -void WebViewImpl::setRootLayerNeedsDisplay() +void WebViewImpl::doComposite() { - // FIXME: For now we're posting a repaint event for the entire page which is an overkill. - if (WebFrameImpl* webframe = mainFrameImpl()) { - if (FrameView* view = webframe->frameView()) { - // FIXME: Temporary hack to invalidate part of the page so that we get called to render - // again. - IntRect visibleRect = view->visibleContentRect(true); - m_client->didInvalidateRect(IntRect(0, 0, 1, 1)); + ASSERT(isAcceleratedCompositingActive()); + if (!page()) + return; + FrameView* view = page()->mainFrame()->view(); + + // The visibleRect includes scrollbars whereas the contentRect doesn't. + IntRect visibleRect = view->visibleContentRect(true); + IntRect contentRect = view->visibleContentRect(false); + IntRect viewPort = IntRect(0, 0, m_size.width, m_size.height); + + // Give the compositor a chance to setup/resize the root texture handle and perform scrolling. + m_layerRenderer->prepareToDrawLayers(visibleRect, contentRect, IntPoint(view->scrollX(), view->scrollY())); + + // Draw the contents of the root layer. + Vector<FloatRect> damageRects; + damageRects.append(m_scrollDamage); + damageRects.append(m_layerRenderer->rootLayer()->dirtyRect()); + for (size_t i = 0; i < damageRects.size(); ++i) { + // The damage rect for the root layer is in content space [e.g. unscrolled]. + // Convert from content space to viewPort space. + const FloatRect damagedContentRect = damageRects[i]; + IntRect damagedRect = view->contentsToWindow(IntRect(damagedContentRect)); + + // Intersect this rectangle with the viewPort. + damagedRect.intersect(viewPort); + + // Now render it. + if (damagedRect.width() && damagedRect.height()) { + updateRootLayerContents(damagedRect); + m_layerRenderer->updateRootLayerTextureRect(damagedRect); } } + m_layerRenderer->rootLayer()->resetNeedsDisplay(); + m_scrollDamage = WebRect(); - if (m_layerRenderer) - m_layerRenderer->setNeedsDisplay(); + // Draw the actual layers... + m_layerRenderer->drawLayers(visibleRect, contentRect); } -#endif // USE(ACCELERATED_COMPOSITING) +#endif -PassOwnPtr<GLES2Context> WebViewImpl::getOnscreenGLES2Context() -{ - WebGLES2Context* context = gles2Context(); - if (!context) - return 0; - return GLES2Context::create(GLES2ContextInternal::create(context, false)); -} SharedGraphicsContext3D* WebViewImpl::getSharedGraphicsContext3D() { if (!m_sharedContext3D) { GraphicsContext3D::Attributes attr; OwnPtr<GraphicsContext3D> context = GraphicsContext3D::create(attr, m_page->chrome()); + if (!context) + return 0; m_sharedContext3D = SharedGraphicsContext3D::create(context.release()); } return m_sharedContext3D.get(); } -// Returns the GLES2 context associated with this View. If one doesn't exist -// it will get created first. WebGLES2Context* WebViewImpl::gles2Context() { - if (!m_gles2Context) { - m_gles2Context = webKitClient()->createGLES2Context(); - if (!m_gles2Context) - return 0; - - if (!m_gles2Context->initialize(this, 0)) { - m_gles2Context.clear(); - return 0; - } + return 0; +} +WebGraphicsContext3D* WebViewImpl::graphicsContext3D() +{ +#if USE(ACCELERATED_COMPOSITING) + GraphicsContext3D* context = 0; + if (m_layerRenderer) + context = m_layerRenderer->context(); + else if (m_temporaryOnscreenGraphicsContext3D) + context = m_temporaryOnscreenGraphicsContext3D.get(); + else { + GraphicsContext3D::Attributes attributes; + m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow); #if OS(DARWIN) - m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width), - std::max(1, m_size.height))); + if (m_temporaryOnscreenGraphicsContext3D) + m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size.width), std::max(1, m_size.height)); #endif + context = m_temporaryOnscreenGraphicsContext3D.get(); } - return m_gles2Context.get(); + return GraphicsContext3DInternal::extractWebGraphicsContext3D(context); +#else + return 0; +#endif } } // namespace WebKit diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index a42099c..bbd25a2 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -31,9 +31,9 @@ #ifndef WebViewImpl_h #define WebViewImpl_h -#include "WebGLES2Context.h" #include "WebNavigationPolicy.h" #include "WebPoint.h" +#include "WebRect.h" #include "WebSize.h" #include "WebString.h" #include "WebView.h" @@ -43,8 +43,10 @@ #include "ContextMenuClientImpl.h" #include "DragClientImpl.h" #include "EditorClientImpl.h" +#include "GraphicsContext3D.h" #include "GraphicsLayer.h" #include "InspectorClientImpl.h" +#include "IntRect.h" #include "LayerRendererChromium.h" #include "NotificationPresenterImpl.h" #include "SpeechInputClientImpl.h" @@ -54,7 +56,6 @@ namespace WebCore { class ChromiumDataObject; class Frame; -class GLES2Context; class HistoryItem; class HitTestResult; class KeyboardEvent; @@ -92,6 +93,8 @@ public: virtual void resize(const WebSize&); virtual void layout(); virtual void paint(WebCanvas*, const WebRect&); + virtual void themeChanged(); + virtual void composite(bool finish); virtual bool handleInputEvent(const WebInputEvent&); virtual void mouseCaptureLost(); virtual void setFocus(bool enable); @@ -119,6 +122,7 @@ public: virtual void setTabKeyCyclesThroughElements(bool value); virtual bool isActive() const; virtual void setIsActive(bool value); + virtual void setDomainRelaxationForbidden(bool, const WebString& scheme); virtual bool dispatchBeforeUnloadEvent(); virtual void dispatchUnloadEvent(); virtual WebFrame* mainFrame(); @@ -322,21 +326,28 @@ public: } #if USE(ACCELERATED_COMPOSITING) - void setRootLayerNeedsDisplay(); - void setRootGraphicsLayer(WebCore::PlatformLayer*); bool allowsAcceleratedCompositing(); + void setRootGraphicsLayer(WebCore::PlatformLayer*); + void setRootLayerNeedsDisplay(); + void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect); + void invalidateRootLayerRect(const WebCore::IntRect&); #endif - // Onscreen contexts display to the screen associated with this view. - // Offscreen contexts render offscreen but can share resources with the - // onscreen context and thus can be composited. - PassOwnPtr<WebCore::GLES2Context> getOnscreenGLES2Context(); - - // Returns an onscreen context + // FIXME: remove this method once the compositor is fully switched + // over to GraphicsContext3D. virtual WebGLES2Context* gles2Context(); + + // Returns the onscreen 3D context used by the compositor. This is + // used by the renderer's code to set up resource sharing between + // the compositor's context and subordinate contexts for APIs like + // WebGL. Returns 0 if compositing support is not compiled in. + virtual WebGraphicsContext3D* graphicsContext3D(); + virtual WebCore::SharedGraphicsContext3D* getSharedGraphicsContext3D(); WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); } + bool zoomTextOnly() const { return m_zoomTextOnly; } + // Returns true if the event leads to scrolling. static bool mapKeyCodeForScroll(int keyCode, WebCore::ScrollDirection* scrollDirection, @@ -386,7 +397,9 @@ private: #if USE(ACCELERATED_COMPOSITING) void setIsAcceleratedCompositingActive(bool); - void updateRootLayerContents(const WebRect&); + void updateRootLayerContents(const WebCore::IntRect&); + void doComposite(); + void doPixelReadbackToCanvas(WebCanvas*, const WebCore::IntRect&); #endif WebViewClient* m_client; @@ -433,6 +446,8 @@ private: // mean zoom in, negative numbers mean zoom out. int m_zoomLevel; + bool m_zoomTextOnly; + bool m_contextMenuAllowed; bool m_doingDragAndDrop; @@ -511,6 +526,7 @@ private: RefPtr<WebCore::Node> m_mouseCaptureNode; #if USE(ACCELERATED_COMPOSITING) + WebCore::IntRect m_scrollDamage; OwnPtr<WebCore::LayerRendererChromium> m_layerRenderer; bool m_isAcceleratedCompositingActive; bool m_compositorCreationFailed; @@ -520,8 +536,10 @@ private: #if ENABLE(INPUT_SPEECH) SpeechInputClientImpl m_speechInputClient; #endif - - OwnPtr<WebGLES2Context> m_gles2Context; + // If we attempt to fetch the on-screen GraphicsContext3D before + // the compositor has been turned on, we need to instantiate it + // early. This member holds on to the GC3D in this case. + OwnPtr<WebCore::GraphicsContext3D> m_temporaryOnscreenGraphicsContext3D; RefPtr<WebCore::SharedGraphicsContext3D> m_sharedContext3D; diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js deleted file mode 100644 index 5a8a7bf..0000000 --- a/WebKit/chromium/src/js/DebuggerScript.js +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * 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. - */ - -(function () { - -var DebuggerScript = {}; -DebuggerScript._breakpoints = {}; - -DebuggerScript.PauseOnExceptionsState = { - DontPauseOnExceptions : 0, - PauseOnAllExceptions : 1, - PauseOnUncaughtExceptions: 2 -}; - -DebuggerScript.ScriptWorldType = { - MainWorld : 0, - ExtensionsWorld : 1 -}; - -DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.DontPauseOnExceptions; -Debug.clearBreakOnException(); -Debug.clearBreakOnUncaughtException(); - -DebuggerScript.getAfterCompileScript = function(eventData) -{ - return DebuggerScript._formatScript(eventData.script_.script_); -} - -DebuggerScript.getScripts = function(contextData) -{ - var result = []; - - if (!contextData) - return result; - var comma = contextData.indexOf(","); - if (comma === -1) - return result; - // Context data is a string in the following format: - // ("page"|"injected")","<page id> - var idSuffix = contextData.substring(comma); // including the comma - - var scripts = Debug.scripts(); - for (var i = 0; i < scripts.length; ++i) { - var script = scripts[i]; - if (script.context_data && script.context_data.lastIndexOf(idSuffix) != -1) - result.push(DebuggerScript._formatScript(script)); - } - return result; -} - -DebuggerScript._formatScript = function(script) -{ - var scriptWorldType = DebuggerScript.ScriptWorldType.MainWorld; - if (script.context_data && script.context_data.indexOf("injected") == 0) - scriptWorldType = DebuggerScript.ScriptWorldType.ExtensionsWorld; - return { - id: script.id, - name: script.nameOrSourceURL(), - source: script.source, - lineOffset: DebuggerScript._v8ToWebkitLineNumber(script.line_offset), - lineCount: script.lineCount(), - scriptWorldType: scriptWorldType - }; -} - -DebuggerScript.setBreakpoint = function(execState, args) -{ - args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber); - var breakId = Debug.setScriptBreakPointById(args.scriptId, args.lineNumber, 0 /* column */, args.condition); - if (!args.enabled) - Debug.disableScriptBreakPoint(breakId); - - var locations = Debug.findBreakPointActualLocations(breakId); - var actualLineNumber = locations.length ? locations[0].line : args.lineNumber; - - var key = args.scriptId + ":" + actualLineNumber; - if (key in DebuggerScript._breakpoints) { - // Remove old breakpoint. - Debug.findBreakPoint(DebuggerScript._breakpoints[key], true); - } - DebuggerScript._breakpoints[key] = breakId; - return DebuggerScript._v8ToWebkitLineNumber(actualLineNumber); -} - -DebuggerScript.removeBreakpoint = function(execState, args) -{ - args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber); - var key = args.scriptId + ":" + args.lineNumber; - var breakId = DebuggerScript._breakpoints[key]; - if (breakId) - Debug.findBreakPoint(breakId, true); - delete DebuggerScript._breakpoints[key]; -} - -DebuggerScript.pauseOnExceptionsState = function() -{ - return DebuggerScript._pauseOnExceptionsState; -} - -DebuggerScript.setPauseOnExceptionsState = function(newState) -{ - DebuggerScript._pauseOnExceptionsState = newState; - - if (DebuggerScript.PauseOnExceptionsState.PauseOnAllExceptions === newState) - Debug.setBreakOnException(); - else - Debug.clearBreakOnException(); - - if (DebuggerScript.PauseOnExceptionsState.PauseOnUncaughtExceptions === newState) - Debug.setBreakOnUncaughtException(); - else - Debug.clearBreakOnUncaughtException(); -} - -DebuggerScript.currentCallFrame = function(execState, args) -{ - var frameCount = execState.frameCount(); - if (frameCount === 0) - return undefined; - - var topFrame; - for (var i = frameCount - 1; i >= 0; i--) { - var frameMirror = execState.frame(i); - topFrame = DebuggerScript._frameMirrorToJSCallFrame(frameMirror, topFrame); - } - return topFrame; -} - -DebuggerScript.stepIntoStatement = function(execState) -{ - execState.prepareStep(Debug.StepAction.StepIn, 1); -} - -DebuggerScript.stepOverStatement = function(execState) -{ - execState.prepareStep(Debug.StepAction.StepNext, 1); -} - -DebuggerScript.stepOutOfFunction = function(execState) -{ - execState.prepareStep(Debug.StepAction.StepOut, 1); -} - -DebuggerScript.editScriptSource = function(scriptId, newSource) -{ - var scripts = Debug.scripts(); - var scriptToEdit = null; - for (var i = 0; i < scripts.length; i++) { - if (scripts[i].id == scriptId) { - scriptToEdit = scripts[i]; - break; - } - } - if (!scriptToEdit) - throw("Script not found"); - - var changeLog = []; - Debug.LiveEdit.SetScriptSource(scriptToEdit, newSource, false, changeLog); - return scriptToEdit.source; -} - -DebuggerScript.clearBreakpoints = function(execState, args) -{ - for (var key in DebuggerScript._breakpoints) { - var breakId = DebuggerScript._breakpoints[key]; - Debug.findBreakPoint(breakId, true); - } - DebuggerScript._breakpoints = {}; -} - -DebuggerScript.setBreakpointsActivated = function(execState, args) -{ - Debug.debuggerFlags().breakPointsActive.setValue(args.enabled); -} - -DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) -{ - // Get function name. - var func; - try { - func = frameMirror.func(); - } catch(e) { - } - var functionName; - if (func) - functionName = func.name() || func.inferredName(); - - // Get script ID. - var script = func.script(); - var sourceID = script && script.id(); - - // Get line number. - var line = DebuggerScript._v8ToWebkitLineNumber(frameMirror.sourceLine()); - - // Get this object. - var thisObject = frameMirror.details_.receiver(); - - // Get scope chain array in format: [<scope type>, <scope object>, <scope type>, <scope object>,...] - var scopeChain = []; - var scopeType = []; - for (var i = 0; i < frameMirror.scopeCount(); i++) { - var scopeMirror = frameMirror.scope(i); - var scopeObjectMirror = scopeMirror.scopeObject(); - var properties = scopeObjectMirror.properties(); - var scopeObject = {}; - for (var j = 0; j < properties.length; j++) - scopeObject[properties[j].name()] = properties[j].value_; - // Reset scope object prototype to null so that the proto properties - // don't appear in th local scope section. - scopeObject.__proto__ = null; - scopeType.push(scopeMirror.scopeType()); - scopeChain.push(scopeObject); - } - - function evaluate(expression) { - return frameMirror.evaluate(expression, false).value(); - } - - return { - "sourceID": sourceID, - "line": line, - "functionName": functionName, - "type": "function", - "thisObject": thisObject, - "scopeChain": scopeChain, - "scopeType": scopeType, - "evaluate": evaluate, - "caller": callerFrame - }; -} - -DebuggerScript._webkitToV8LineNumber = function(line) -{ - return line - 1; -}; - -DebuggerScript._v8ToWebkitLineNumber = function(line) -{ - return line + 1; -}; - -return DebuggerScript; - -})(); diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index f55be4e..0c7241d 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -162,7 +162,3 @@ WebInspector.resetToolbarColors = function() } -// TODO(yurys): should be removed when eclipse debugger stops using it. -if (window.RemoteDebuggerAgent) { - RemoteDebuggerAgent.setContextId = function() {}; -} diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index 2233463..5cebb52 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -953,230 +953,6 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb /** - * Gets a XPathResult matching given xpath. - * @param {string} xpath - * @param {number} resultType - * @param {Node} opt_ancestor Context node. If not specified documentElement - * will be used - * @return {XPathResult} Type of returned value is determined by "resultType" parameter - */ - -TestSuite.prototype._evaluateXpath = function(xpath, resultType, opt_ancestor) -{ - if (!opt_ancestor) - opt_ancestor = document.documentElement; - try { - return document.evaluate(xpath, opt_ancestor, null, resultType, null); - } catch(e) { - this.fail('Error in expression: "' + xpath + '".' + e); - } -}; - - -/** - * Gets first Node matching given xpath. - * @param {string} xpath - * @param {Node} opt_ancestor Context node. If not specified documentElement - * will be used - * @return {?Node} - */ -TestSuite.prototype._findNode = function(xpath, opt_ancestor) -{ - var result = this._evaluateXpath(xpath, XPathResult.FIRST_ORDERED_NODE_TYPE, opt_ancestor).singleNodeValue; - this.assertTrue(!!result, "Cannot find node on path: " + xpath); - return result; -}; - - -/** - * Gets a text matching given xpath. - * @param {string} xpath - * @param {Node} opt_ancestor Context node. If not specified documentElement - * will be used - * @return {?string} - */ -TestSuite.prototype._findText = function(xpath, opt_ancestor) -{ - var result = this._evaluateXpath(xpath, XPathResult.STRING_TYPE, opt_ancestor).stringValue; - this.assertTrue(!!result, "Cannot find text on path: " + xpath); - return result; -}; - - -/** - * Gets an iterator over nodes matching given xpath. - * @param {string} xpath - * @param {Node} opt_ancestor Context node. If not specified, documentElement - * will be used - * @return {XPathResult} Iterator over the nodes - */ -TestSuite.prototype._nodeIterator = function(xpath, opt_ancestor) -{ - return this._evaluateXpath(xpath, XPathResult.ORDERED_NODE_ITERATOR_TYPE, opt_ancestor); -}; - - -/** - * Checks the scopeSectionDiv against the expectations. - * @param {Node} scopeSectionDiv The section div - * @param {Object} expectations Expectations dictionary - */ -TestSuite.prototype._checkScopeSectionDiv = function(scopeSectionDiv, expectations) -{ - var scopeTitle = this._findText('./div[@class="header"]/div[@class="title"]/text()', scopeSectionDiv); - this.assertEquals(expectations.title, scopeTitle, "Unexpected scope section title."); - if (!expectations.properties) - return; - this.assertTrue(scopeSectionDiv.hasStyleClass("expanded"), 'Section "' + scopeTitle + '" is collapsed.'); - - var propertyIt = this._nodeIterator("./ol/li", scopeSectionDiv); - var propertyLi; - var foundProps = []; - while (propertyLi = propertyIt.iterateNext()) { - var name = this._findText('./span[@class="name"]/text()', propertyLi); - var value = this._findText('./span[@class="value"]/text()', propertyLi); - this.assertTrue(!!name, 'Invalid variable name: "' + name + '"'); - this.assertTrue(name in expectations.properties, "Unexpected property: " + name); - this.assertEquals(expectations.properties[name], value, 'Unexpected "' + name + '" property value.'); - delete expectations.properties[name]; - foundProps.push(name + " = " + value); - } - - // Check that all expected properties were found. - for (var p in expectations.properties) - this.fail('Property "' + p + '" was not found in scope "' + scopeTitle + '". Found properties: "' + foundProps.join(",") + '"'); -}; - - -/** - * Expands scope sections matching the filter and invokes the callback on - * success. - * @param {function(WebInspector.ObjectPropertiesSection, number):boolean} - * filter - * @param {Function} callback - */ -TestSuite.prototype._expandScopeSections = function(filter, callback) -{ - var sections = WebInspector.currentPanel.sidebarPanes.scopechain.sections; - - var toBeUpdatedCount = 0; - function updateListener() { - --toBeUpdatedCount; - if (toBeUpdatedCount === 0) { - // Report when all scopes are expanded and populated. - callback(); - } - } - - // Global scope is always the last one. - for (var i = 0; i < sections.length - 1; i++) { - var section = sections[i]; - if (!filter(sections, i)) - continue; - ++toBeUpdatedCount; - var populated = section.populated; - - this._hookGetPropertiesCallback(updateListener, - function() { - section.expand(); - if (populated) { - // Make sure "updateProperties" callback will be called at least once - // after it was overridden. - section.update(); - } - }); - } -}; - - -/** - * Tests that scopes can be expanded and contain expected data. - */ -TestSuite.prototype.testExpandScope = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html"]); - - this._waitForScriptPause( - { - functionsOnStack: ["innerFunction", "handleClick", ""], - lineNumber: 8, - lineText: " debugger;" - }, - expandAllSectionsExceptGlobal); - - // Expanding Global scope takes for too long so we skeep it. - function expandAllSectionsExceptGlobal() { - test._expandScopeSections(function(sections, i) { - return i < sections.length - 1; - }, - examineScopes /* When all scopes are expanded and populated check them. */); - } - - // Check scope sections contents. - function examineScopes() { - var scopeVariablesSection = test._findNode('//div[@id="scripts-sidebar"]/div[div[@class="title"]/text()="Scope Variables"]'); - var expectedScopes = [ - { - title: "Local", - properties: { - x:"2009", - innerFunctionLocalVar:"2011", - "this": "DOMWindow", - } - }, - { - title: "Closure", - properties: { - n: '"TextParam"', - makeClosureLocalVar: '"local.TextParam"', - } - }, - { - title: "Global", - }, - ]; - var it = test._nodeIterator('./div[@class="body"]/div', scopeVariablesSection); - var scopeIndex = 0; - var scopeDiv; - while (scopeDiv = it.iterateNext()) { - test.assertTrue(scopeIndex < expectedScopes.length, "Too many scopes."); - test._checkScopeSectionDiv(scopeDiv, expectedScopes[scopeIndex]); - ++scopeIndex; - } - test.assertEquals(expectedScopes.length, scopeIndex, "Unexpected number of scopes."); - - test.releaseControl(); - } - - test.takeControl(); -}; - - -/** - * Returns child tree element for a property with given name. - * @param {TreeElement} parent Parent tree element. - * @param {string} childName - * @param {string} objectPath Path to the object. Will be printed in the case - * of failure. - * @return {TreeElement} - */ -TestSuite.prototype._findChildProperty = function(parent, childName, objectPath) -{ - var children = parent.children; - for (var i = 0; i < children.length; i++) { - var treeElement = children[i]; - var property = treeElement.property; - if (property.name === childName) - return treeElement; - } - this.fail('Cannot find property "' + childName + '" in ' + objectPath); -}; - - -/** * Executes the 'code' with InjectedScriptAccess.getProperties overriden * so that all callbacks passed to InjectedScriptAccess.getProperties are * extended with the "hook". diff --git a/WebKit/chromium/tests/PopupMenuTest.cpp b/WebKit/chromium/tests/PopupMenuTest.cpp index 50319af..aef29cf 100644 --- a/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/WebKit/chromium/tests/PopupMenuTest.cpp @@ -128,6 +128,8 @@ public: virtual void resize(const WebSize&) { } virtual void layout() { } virtual void paint(WebCanvas*, const WebRect&) { } + virtual void themeChanged() { } + virtual void composite(bool finish) { } virtual bool handleInputEvent(const WebInputEvent&) { return true; } virtual void mouseCaptureLost() { } virtual void setFocus(bool) { } diff --git a/WebKit/efl/CMakeListsEfl.txt b/WebKit/efl/CMakeListsEfl.txt index 2ea5ee5..8b77260 100644 --- a/WebKit/efl/CMakeListsEfl.txt +++ b/WebKit/efl/CMakeListsEfl.txt @@ -16,7 +16,7 @@ LIST(APPEND WebKit_INCLUDE_DIRECTORIES ${EDJE_INCLUDE_DIRS} ${EFLDEPS_INCLUDE_DIRS} ${EVAS_INCLUDE_DIRS} - ${LIBXML2_INCLUDE_DIRS} + ${LIBXML2_INCLUDE_DIR} ${LIBXSLT_INCLUDE_DIRS} ${SQLITE_INCLUDE_DIRS} ) diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog index e805d2c..879a1af 100644 --- a/WebKit/efl/ChangeLog +++ b/WebKit/efl/ChangeLog @@ -1,3 +1,140 @@ +2010-09-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (r60104): Zoom level is unexpectedly reset on page reload + https://bugs.webkit.org/show_bug.cgi?id=42863 + + * ewk/ewk_frame.cpp: + (ewk_frame_zoom_get): + (ewk_frame_zoom_set): + (ewk_frame_zoom_text_only_set): + Call functions on Frame instead of FrameView. + +2010-09-16 Darin Adler <darin@apple.com> + + Fix build. + + * ewk/ewk_view.cpp: + (ewk_view_input_method_state_set): Updated for change + in name of isUrlField to isURLField. + +2010-09-14 Ryuan Choi <ryuan.choi@samsung.com> + + Reviewed by Kenneth Rohde Christiansen. + + [EFL] ewk_frame_view_create_for_view set null as theme. + https://bugs.webkit.org/show_bug.cgi?id=45741 + + Add theme in ewk_view to use instead of frame's theme which is null in + ewk_frame_view_create_for_view. + + * ewk/ewk_frame.cpp: + (ewk_frame_view_create_for_view): + * ewk/ewk_view.cpp: + (ewk_view_theme_set): + (ewk_view_theme_get): + +2010-09-14 Leandro Pereira <leandro@profusion.mobi> + + [EFL] Unreviewed build fix: remove "virtual" keyword from + implementation file. + + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::canShowMIMETypeAsHTML): + +2010-09-13 Rafael Antognolli <antognolli@profusion.mobi> + + Unreviewed build fix. + + [EFL] Fix build break when enabling HTML5 video support + https://bugs.webkit.org/show_bug.cgi?id=45674 + + The correct include variable for LibXml2 in cmake is + LIBXML2_INCLUDE_DIR instead of LIBXML2_INCLUDE_DIRS. + + * CMakeListsEfl.txt: + +2010-09-13 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Reviewed by Kenneth Rohde Christiansen. + + [EFL] Add setting API for enabling page cache + https://bugs.webkit.org/show_bug.cgi?id=44931 + + * ewk/ewk_view.cpp: + (_ewk_view_priv_new): + (ewk_view_setting_page_cache_get): Added. + (ewk_view_setting_page_cache_set): Added. + * ewk/ewk_view.h: + +2010-09-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Paste should be implemented in WebCore like Copy and Cut for Mac also. + https://bugs.webkit.org/show_bug.cgi?id=45494 + <rdar://problem/7660537> + + On the Mac platform, the implementation of the paste operation is all done + at the WebKit level. In order to support it on WebKit2 it is necessary to + refactor the code and move this functionality at the level of WebCore like + we already have on Windows. + The original code relies on some in AppKit functions that call back into + WebKit causing problems in WebKit2. All this functionality has been moved + at the level of the editor client where it can be dealt with appropriately. + + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::canShowMIMETypeAsHTML): Added stub. + * WebCoreSupport/FrameLoaderClientEfl.h: + +2010-09-11 Ryuan Choi <ryuan.choi@samsung.com> + + Reviewed by Antonio Gomes. + + [EFL] Fix EFL build after r67274 + https://bugs.webkit.org/show_bug.cgi?id=45584 + + Remove include of ZoomMode.h and change setZoomFactor and zoomFactor + to proper apis chaged by r67264. + + * ewk/ewk_frame.cpp: + (ewk_frame_zoom_get): + (ewk_frame_zoom_set): + (ewk_frame_zoom_text_only_get): + (ewk_frame_zoom_text_only_set): + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Move code from WebKit-layer to DocumentLoader + https://bugs.webkit.org/show_bug.cgi?id=45569 + + This code didn't know that setEncoding could be called multiple times + safely. + + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::FrameLoaderClientEfl): + (WebCore::FrameLoaderClientEfl::committedLoad): + (WebCore::FrameLoaderClientEfl::dispatchDidReceiveResponse): + (WebCore::FrameLoaderClientEfl::finishedLoading): + (WebCore::FrameLoaderClientEfl::dispatchDidFailLoading): + (WebCore::FrameLoaderClientEfl::setMainDocumentError): + * WebCoreSupport/FrameLoaderClientEfl.h: + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Main resource bytes shouldn't bounce through FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=45496 + + Now return the bytes to the DocumentLoader. + + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::committedLoad): + 2010-09-08 Darin Adler <darin@apple.com> Reviewed by Adam Barth. diff --git a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp index 8ec783a..056687c 100644 --- a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp +++ b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp @@ -67,7 +67,6 @@ namespace WebCore { FrameLoaderClientEfl::FrameLoaderClientEfl(Evas_Object *view) : m_view(view) , m_frame(0) - , m_firstData(false) , m_userAgent("") , m_customUserAgent("") , m_pluginView(0) @@ -182,20 +181,10 @@ void FrameLoaderClientEfl::dispatchWillSubmitForm(FramePolicyFunction function, callPolicyFunction(function, PolicyUse); } - void FrameLoaderClientEfl::committedLoad(DocumentLoader* loader, const char* data, int length) { - if (!m_pluginView) { - if (!m_frame) - return; - - FrameLoader* fl = loader->frameLoader(); - if (m_firstData) { - fl->writer()->setEncoding(m_response.textEncodingName(), false); - m_firstData = false; - } - fl->addData(data, length); - } + if (!m_pluginView) + loader->commitData(data, length); // We re-check here as the plugin can have been created if (m_pluginView) { @@ -325,7 +314,6 @@ void FrameLoaderClientEfl::frameLoaderDestroyed() void FrameLoaderClientEfl::dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse& response) { m_response = response; - m_firstData = true; } void FrameLoaderClientEfl::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& MIMEType, const ResourceRequest&) @@ -690,6 +678,12 @@ bool FrameLoaderClientEfl::canHandleRequest(const ResourceRequest&) const return true; } +bool FrameLoaderClientEfl::canShowMIMETypeAsHTML(const String& MIMEType) const +{ + notImplemented(); + return false; +} + bool FrameLoaderClientEfl::canShowMIMEType(const String& MIMEType) const { if (MIMETypeRegistry::isSupportedImageMIMEType(MIMEType)) @@ -719,17 +713,11 @@ String FrameLoaderClientEfl::generatedMIMETypeForURLScheme(const String&) const void FrameLoaderClientEfl::finishedLoading(DocumentLoader* loader) { - if (!m_pluginView) { - if (m_firstData) { - FrameLoader* fl = loader->frameLoader(); - fl->writer()->setEncoding(m_response.textEncodingName(), false); - m_firstData = false; - } - } else { - m_pluginView->didFinishLoading(); - m_pluginView = 0; - m_hasSentResponseToPlugin = false; - } + if (!m_pluginView) + return; + m_pluginView->didFinishLoading(); + m_pluginView = 0; + m_hasSentResponseToPlugin = false; } @@ -765,15 +753,7 @@ void FrameLoaderClientEfl::dispatchDidFinishLoading(DocumentLoader*, unsigned lo void FrameLoaderClientEfl::dispatchDidFailLoading(DocumentLoader* loader, unsigned long identifier, const ResourceError& err) { - if (!shouldFallBack(err)) - return; - - if (m_firstData) { - FrameLoader* fl = loader->frameLoader(); - fl->writer()->setEncoding(m_response.textEncodingName(), false); - m_firstData = false; - } - + notImplemented(); } bool FrameLoaderClientEfl::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) @@ -904,16 +884,11 @@ void FrameLoaderClientEfl::dispatchUnableToImplementPolicy(const ResourceError&) void FrameLoaderClientEfl::setMainDocumentError(DocumentLoader* loader, const ResourceError& error) { - if (!m_pluginView) { - if (m_firstData) { - loader->frameLoader()->writer()->setEncoding(m_response.textEncodingName(), false); - m_firstData = false; - } - } else { - m_pluginView->didFail(error); - m_pluginView = 0; - m_hasSentResponseToPlugin = false; - } + if (!m_pluginView) + return; + m_pluginView->didFail(error); + m_pluginView = 0; + m_hasSentResponseToPlugin = false; } void FrameLoaderClientEfl::startDownload(const ResourceRequest&) diff --git a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h index bd105cd..68f145d 100644 --- a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h +++ b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h @@ -181,6 +181,7 @@ class FrameLoaderClientEfl : public FrameLoaderClient { virtual bool canHandleRequest(const ResourceRequest&) const; virtual bool canShowMIMEType(const String&) const; + virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const; virtual bool representationExistsForURLScheme(const String&) const; virtual String generatedMIMETypeForURLScheme(const String&) const; @@ -209,7 +210,6 @@ class FrameLoaderClientEfl : public FrameLoaderClient { Evas_Object *m_frame; ResourceResponse m_response; - bool m_firstData; String m_userAgent; String m_customUserAgent; diff --git a/WebKit/efl/ewk/ewk_frame.cpp b/WebKit/efl/ewk/ewk_frame.cpp index 8945ee7..038e105 100644 --- a/WebKit/efl/ewk/ewk_frame.cpp +++ b/WebKit/efl/ewk/ewk_frame.cpp @@ -45,7 +45,6 @@ #include "SharedBuffer.h" #include "SubstituteData.h" #include "WindowsKeyboardCodes.h" -#include "ZoomMode.h" #include "ewk_private.h" #include <Eina.h> @@ -71,7 +70,7 @@ struct Ewk_Frame_Smart_Data { struct { Evas_Coord w, h; } contents_size; - WebCore::ZoomMode zoom_mode; + Eina_Bool textZoom:1; Eina_Bool editable:1; }; @@ -1021,10 +1020,10 @@ float ewk_frame_zoom_get(const Evas_Object* o) { EWK_FRAME_SD_GET_OR_RETURN(o, sd, -1.0); EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, -1.0); - WebCore::FrameView* view = sd->frame->view(); - if (!view) - return -1; - return view->zoomFactor(); + + if (sd->textZoom) + return sd->frame->textZoomFactor(); + return sd->frame->pageZoomFactor(); } /** @@ -1041,10 +1040,10 @@ Eina_Bool ewk_frame_zoom_set(Evas_Object* o, float zoom) { EWK_FRAME_SD_GET_OR_RETURN(o, sd, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, EINA_FALSE); - WebCore::FrameView* view = sd->frame->view(); - if (!view) - return EINA_FALSE; - view->setZoomFactor(zoom, sd->zoom_mode); + if (sd->textZoom) + sd->frame->setTextZoomFactor(zoom); + else + sd->frame->setPageZoomFactor(zoom); return EINA_TRUE; } @@ -1058,7 +1057,7 @@ Eina_Bool ewk_frame_zoom_set(Evas_Object* o, float zoom) Eina_Bool ewk_frame_zoom_text_only_get(const Evas_Object* o) { EWK_FRAME_SD_GET_OR_RETURN(o, sd, EINA_FALSE); - return sd->zoom_mode == WebCore::ZoomTextOnly; + return sd->textZoom; } /** @@ -1073,15 +1072,15 @@ Eina_Bool ewk_frame_zoom_text_only_set(Evas_Object* o, Eina_Bool setting) { EWK_FRAME_SD_GET_OR_RETURN(o, sd, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, EINA_FALSE); - WebCore::ZoomMode zm = setting ? WebCore::ZoomTextOnly : WebCore::ZoomPage; - if (sd->zoom_mode == zm) + if (sd->textZoom == setting) return EINA_TRUE; - sd->zoom_mode = zm; - WebCore::FrameView* view = sd->frame->view(); - if (!view) - return EINA_FALSE; - view->setZoomFactor(view->zoomFactor(), sd->zoom_mode); + float zoom_level = sd->textZoom ? sd->frame->textZoomFactor() : sd->frame->pageZoomFactor(); + sd->textZoom = setting; + if (sd->textZoom) + sd->frame->setPageAndTextZoomFactors(1, zoom_level); + else + sd->frame->setPageAndTextZoomFactors(zoom_level, 1); return EINA_TRUE; } @@ -1953,7 +1952,9 @@ void ewk_frame_view_create_for_view(Evas_Object* o, Evas_Object* view) sd->frame->createView(size, bg, !a, WebCore::IntSize(), false); if (!sd->frame->view()) return; - sd->frame->view()->setEdjeTheme(sd->theme); + + const char* theme = ewk_view_theme_get(view); + sd->frame->view()->setEdjeTheme(theme); sd->frame->view()->setEvasObject(o); } diff --git a/WebKit/efl/ewk/ewk_view.cpp b/WebKit/efl/ewk/ewk_view.cpp index 254fdfd..76e4bf5 100644 --- a/WebKit/efl/ewk/ewk_view.cpp +++ b/WebKit/efl/ewk/ewk_view.cpp @@ -90,6 +90,7 @@ struct _Ewk_View_Private_Data { const char* encoding_default; const char* encoding_custom; const char* cache_directory; + const char* theme; int font_minimum_size; int font_minimum_logical_size; int font_default_size; @@ -112,6 +113,7 @@ struct _Ewk_View_Private_Data { Eina_Bool spatial_navigation:1; Eina_Bool local_storage:1; Eina_Bool offline_app_cache: 1; + Eina_Bool page_cache: 1; struct { float w; float h; @@ -565,6 +567,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* sd) priv->page_settings->setPluginsEnabled(true); priv->page_settings->setLocalStorageEnabled(true); priv->page_settings->setOfflineWebApplicationCacheEnabled(true); + priv->page_settings->setUsesPageCache(true); url = priv->page_settings->userStyleSheetLocation(); priv->settings.user_stylesheet = eina_stringshare_add(url.prettyURL().utf8().data()); @@ -605,6 +608,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* sd) priv->settings.caret_browsing = priv->page_settings->caretBrowsingEnabled(); priv->settings.local_storage = priv->page_settings->localStorageEnabled(); priv->settings.offline_app_cache = true; // XXX no function to read setting; this keeps the original setting + priv->settings.page_cache = priv->page_settings->usesPageCache(); // Since there's no scale separated from zooming in webkit-efl, this functionality of // viewport meta tag is implemented using zoom. When scale zoom is supported by webkit-efl, @@ -1110,6 +1114,9 @@ void ewk_view_fixed_layout_size_get(Evas_Object* o, Evas_Coord* w, Evas_Coord* h void ewk_view_theme_set(Evas_Object* o, const char* path) { EWK_VIEW_SD_GET_OR_RETURN(o, sd); + EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv); + if (!eina_stringshare_replace(&priv->settings.theme, path)) + return; ewk_frame_theme_set(sd->main_frame, path); } @@ -1125,7 +1132,8 @@ void ewk_view_theme_set(Evas_Object* o, const char* path) const char* ewk_view_theme_get(Evas_Object* o) { EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0); - return ewk_frame_theme_get(sd->main_frame); + EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0); + return priv->settings.theme; } /** @@ -2746,6 +2754,37 @@ Eina_Bool ewk_view_setting_local_storage_set(Evas_Object* o, Eina_Bool enable) } /** + * Gets if the page cache is enabled. + * + * @param o view object to set if page cache is enabled. + * @return @c EINA_TRUE if page cache is enabled, @c EINA_FALSE if not. + */ +Eina_Bool ewk_view_setting_page_cache_get(Evas_Object* o) +{ + EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE); + EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE); + return priv->settings.page_cache; +} + +/** + * Sets the page cache. + * + * @param o view object to set if page cache is enabled. + * @return @c EINA_TRUE on success and @c EINA_FALSE on failure + */ +Eina_Bool ewk_view_setting_page_cache_set(Evas_Object* o, Eina_Bool enable) +{ + EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE); + EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE); + enable = !!enable; + if (priv->settings.page_cache != enable) { + priv->page_settings->setUsesPageCache(enable); + priv->settings.page_cache = enable; + } + return EINA_TRUE; +} + +/** * Similar to evas_object_smart_data_get(), but does type checking. * * @param o view object to query internal data. @@ -3211,7 +3250,7 @@ void ewk_view_input_method_state_set(Evas_Object* o, Eina_Bool active) priv->imh |= inputElement->isTelephoneField() * EWK_IMH_TELEPHONE; priv->imh |= inputElement->isNumberField() * EWK_IMH_NUMBER; priv->imh |= inputElement->isEmailField() * EWK_IMH_EMAIL; - priv->imh |= inputElement->isUrlField() * EWK_IMH_URL; + priv->imh |= inputElement->isURLField() * EWK_IMH_URL; } } } diff --git a/WebKit/efl/ewk/ewk_view.h b/WebKit/efl/ewk/ewk_view.h index c5d2d45..be27f68 100644 --- a/WebKit/efl/ewk/ewk_view.h +++ b/WebKit/efl/ewk/ewk_view.h @@ -450,6 +450,9 @@ EAPI Eina_Bool ewk_view_setting_spatial_navigation_set(Evas_Object* o, Eina_B EAPI Eina_Bool ewk_view_setting_local_storage_get(Evas_Object* o); EAPI Eina_Bool ewk_view_setting_local_storage_set(Evas_Object* o, Eina_Bool enable); +EAPI Eina_Bool ewk_view_setting_page_cache_get(Evas_Object* o); +EAPI Eina_Bool ewk_view_setting_page_cache_set(Evas_Object* o, Eina_Bool enable); + /* to be used by subclass implementations */ EAPI Ewk_View_Smart_Data *ewk_view_smart_data_get(const Evas_Object *o); diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index 25fe4fd..16f4063 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,384 @@ +2010-09-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (r60104): Zoom level is unexpectedly reset on page reload + https://bugs.webkit.org/show_bug.cgi?id=42863 + + * webkit/webkitwebview.cpp: + (webkit_web_view_get_zoom_level): + (webkit_web_view_apply_zoom_level): + (webkit_web_view_set_full_content_zoom): + Call functions on Frame instead of FrameView. + +2010-09-16 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Implement dissolveDragImageToFraction + https://bugs.webkit.org/show_bug.cgi?id=45826 + + To support full alpha in the drag icon, changed the drag icon to be a + GtkWindow with an RGBA colormap. Added logic to support painting the drag + image to this window during the expose event. + + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::dragIconWindowExposeEventCallback): Added. + (WebKit::DragClient::DragClient): Initialize the new drag icon window. + (WebKit::DragClient::~DragClient): Disconnect the expose event signal. + (WebKit::DragClient::startDrag): Resize the drag icon window the appropriate size and + if necessary, set its colormap. + (WebKit::DragClient::dragIconWindowExposeEvent): Added. + * WebCoreSupport/DragClientGtk.h: Added new member and method declarations. + +2010-09-14 Philippe Normand <pnormand@igalia.com> + + Reviewed by Eric Carlson and Martin Robinson. + + [GTK] eventSender.contextClick() should return the contents of the context menu + https://bugs.webkit.org/show_bug.cgi?id=39102 + + New private WebView API to retrieve the context-menu widget. This + is used by DRT only. + + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_get_context_menu): + +2010-09-16 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Xan Lopez. + + GTK+ 3.x. updates, gtk_widget_size_request is deprecated and + "activate-slider" style property for scrollbars is gone. + + * webkit/webkitwebview.cpp: + (PopupMenuPositionFunc): + +2010-09-15 Martin Robinson <mrobinson@igalia.com> + + Reviewed by David Levin. + + [GTK] [REGRESSION] r67591 broke the testwebbackforwardlist API test and introduced a memory leak + https://bugs.webkit.org/show_bug.cgi?id=45865 + + When initializing the backForwardList private member of the WebView, do + so with adoptPlatformRef to prevent a memory leak. + + * webkit/webkitwebview.cpp: + (webkit_web_view_init): Initialize member with adoptPlatformRef. + +2010-09-15 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Eric Seidel. + + [Gtk] Use GOwnPtr for code that needs it + https://bugs.webkit.org/show_bug.cgi?id=21594 + + Convert as reference counted private members of WebKitWebView to + smart pointers as possible. This removes a lot of unecessary manual + memory management. Also convert some pointer members away from pointer + types, now that we are sure their destructors are called. + + * WebCoreSupport/ContextMenuClientGtk.cpp: + (WebKit::inputMethodsMenuItem): Updated to reflect PlatformRefPtr changes. + * WebCoreSupport/DragClientGtk.cpp: + (WebKit::DragClient::startDrag): Ditto. + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::EditorClient::setInputMethodState): Ditto. + (WebKit::EditorClient::respondToChangedSelection): Ditto. + (WebKit::EditorClient::handleInputMethodKeydown): Ditto. + (WebKit::EditorClient::handleInputMethodMousePress): Ditto. + (WebKit::EditorClient::EditorClient): Ditto. + (WebKit::EditorClient::~EditorClient): Ditto. + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::postCommitFrameViewSetup): Ditto. + * webkit/webkitprivate.h: Ditto. + * webkit/webkitwebview.cpp: Ditto. + (destroy_menu_cb): Ditto. + (webkit_web_view_forward_context_menu_event): Ditto. + (webkit_web_view_key_release_event): Ditto. + (webkit_web_view_button_press_event): Ditto. + (webkit_web_view_button_release_event): Ditto. + (webkit_web_view_focus_in_event): Ditto. + (webkit_web_view_focus_out_event): Ditto. + (webkit_web_view_realize): Ditto. + (webkit_web_view_set_scroll_adjustments): Ditto. + (webkit_web_view_dispose): Changed all g_object_unref calls to + PlatformRefPtr.clear(). Although this will also be done by the manual + call to the WebKitWebViewPrivate destructor, the order that these + fields are zero'd in is still very sensitive. + (webkit_web_view_finalize): Updated to reflect PlatformRefPtr changes. + (webViewGetDPI): Ditto. + (webkit_web_view_screen_changed): Ditto. + (webkit_web_view_drag_end): Ditto. + (webkit_web_view_drag_data_get): Ditto. + (doDragLeaveLater): Ditto. + (webkit_web_view_drag_leave): Ditto. + (webkit_web_view_drag_motion): Ditto. + (webkit_web_view_drag_data_received): Ditto. + (webkit_web_view_drag_drop): Ditto. + (webkit_web_view_get_im_context): Ditto. + (webkit_web_view_update_settings): Ditto. + (webkit_web_view_init): Ditto. + (webkit_web_view_set_settings): Ditto. + (webkit_web_view_get_settings): Ditto. + (webkit_web_view_get_inspector): Ditto. + (webkit_web_view_set_window_features): Ditto. + (webkit_web_view_get_window_features): Ditto. + (webkit_web_view_get_back_forward_list): Ditto. + (webkit_web_view_zoom_in): Ditto. + (webkit_web_view_zoom_out): Ditto. + (webkit_web_view_add_resource): Ditto. + (webkit_web_view_get_resource): Ditto. + (webkit_web_view_get_main_resource): Ditto. + (webkit_web_view_clear_resources): Ditto. + (webkit_web_view_get_subresources): Ditto. + +2010-09-14 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] fast/events/keydown-numpad-keys.html produces many GLib warnings + https://bugs.webkit.org/show_bug.cgi?id=45775 + + Handle the toggle-overwrite signal on the GtkTextView used for generating editing + commands. Ignore this signals, as the default handler assumes that the GtkTextView + has a layout and this one does not. + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::toggleOverwriteCallback): Added. Cancels the default handler. + (WebKit::EditorClient::EditorClient): Attach a handler for toggle-overwrite. + +2010-09-14 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Provide network-based load timing. + Before this change, inspector used timers taken from + within WebCore notifications (that are by definition + synchronous and serialized). As a result, timing was + affected by the routines running on the main thread + (JavaScript and such). + https://bugs.webkit.org/show_bug.cgi?id=45664 + + * webkit/webkitdownload.cpp: + (DownloadClient::didFinishLoading): + +2010-09-15 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r67551. + http://trac.webkit.org/changeset/67551 + https://bugs.webkit.org/show_bug.cgi?id=45816 + + "Plugin tests fail" (Requested by yurys on #webkit). + + * webkit/webkitdownload.cpp: + (DownloadClient::didFinishLoading): + +2010-09-14 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Provide network-based load timing. + Before this change, inspector used timers taken from + within WebCore notifications (that are by definition + synchronous and serialized). As a result, timing was + affected by the routines running on the main thread + (JavaScript and such). + https://bugs.webkit.org/show_bug.cgi?id=45664 + + * webkit/webkitdownload.cpp: + (DownloadClient::didFinishLoading): + +2010-09-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Paste should be implemented in WebCore like Copy and Cut for Mac also. + https://bugs.webkit.org/show_bug.cgi?id=45494 + <rdar://problem/7660537> + + On the Mac platform, the implementation of the paste operation is all done + at the WebKit level. In order to support it on WebKit2 it is necessary to + refactor the code and move this functionality at the level of WebCore like + we already have on Windows. + The original code relies on some in AppKit functions that call back into + WebKit causing problems in WebKit2. All this functionality has been moved + at the level of the editor client where it can be dealt with appropriately. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::canShowMIMETypeAsHTML): Added stub. + * WebCoreSupport/FrameLoaderClientGtk.h: + +2010-09-13 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Provide unit tests for AtkText's text selection functions + https://bugs.webkit.org/show_bug.cgi?id=43919 + + New tests to check getting, setting and removing text selections + + * tests/testatk.c: + (testWekitAtkTextSelections): New unit tests to check all the text + selection related functions altogether through a single test + function. + (main): + + Make sure that code dependant on getting information from the + clipboard gets executed only when there's a GDK window associated + to the webview widget, as that's not the case when executing the + unit tests (the wedbview is not inside of any toplevel window) and + will make the tests crash if not taken into account. + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::EditorClient::respondToChangedSelection): + +2010-09-11 Xan Lopez <xlopez@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Make introspection work with g-o-i 0.9.5 + https://bugs.webkit.org/show_bug.cgi?id=45590 + + Use new type syntax and bump version number of the gir file. + + * JSCore.gir.in: + +2010-09-10 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Darin Adler. + + Add NetworkingContext to avoid layer violations + https://bugs.webkit.org/show_bug.cgi?id=42292 + + * webkit/webkitdownload.cpp: + (webkit_download_start): + * webkit/webkitprivate.cpp: + (currentToplevelCallback): + +2010-09-10 Sam Weinig <sam@webkit.org> + + Fix GTK build. + + * webkit/webkitwebview.cpp: + (webkit_web_view_set_full_content_zoom): + +2010-09-10 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Remove unnecessary constraint in WebCore of choosing either text zoom or full page zoom. + Precursor to <rdar://problem/7660657> + https://bugs.webkit.org/show_bug.cgi?id=45522 + + * webkit/webkitwebview.cpp: + (webkit_web_view_get_zoom_level): + (webkit_web_view_apply_zoom_level): + (webkit_web_view_set_full_content_zoom): + +2010-09-10 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] Fix warnings because of bad assignments in testatk.c + https://bugs.webkit.org/show_bug.cgi?id=45538 + + Use AtkObject and AtkText instances properly in the code. + + * tests/testatk.c: + (testWebkitAtkListsOfItems): + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Move code from WebKit-layer to DocumentLoader + https://bugs.webkit.org/show_bug.cgi?id=45569 + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::committedLoad): + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Main resource bytes shouldn't bounce through FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=45496 + + Now return the bytes to the DocumentLoader. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::committedLoad): + +2010-09-10 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Placement new / manual destructor invocation should be used on private GObject memory + https://bugs.webkit.org/show_bug.cgi?id=45550 + + GLib allocates and deallocates GObject private data structs itself. When + those structs contain C++ members, their constructors and destructors are not + called. This is not only dangerous, it makes RefPtr-type smart pointers much + less useful. We can fix this problem by calling placement new on the private + data struct during instance initialization and calling the destructor during + finalization. + + This patch takes that approach and switches plain char* members of + WebKitWebView (with manual memory allocation) to use CString. + + * webkit/webkitprivate.h: Switch char* members to CString. + * webkit/webkitwebview.cpp: + (webkit_web_view_finalize): Manually call the destructor on the private + data. Remove manual deallocation of members which are now CString. + (webkit_web_view_query_tooltip): Update to reflect CString change. + (webkit_web_view_init): Use placement new to initialize C++ members of + the private data section. + (webkit_web_view_get_encoding): Update to reflect CString change. + (webkit_web_view_get_custom_encoding): Ditto. + (webkit_web_view_add_resource): Ditto. + (webkit_web_view_get_resource): Ditto. + (webkit_web_view_clear_resources): Ditto. + (webkit_web_view_set_tooltip_text): Ditto. + (webkit_web_view_get_icon_uri): Ditto. + +2010-09-10 Gustavo Noronha Silva <gns@gnome.org> + + Reviewed by Martin Robinson. + + [GTK] Google sites do not like WebKitGTK+ + https://bugs.webkit.org/show_bug.cgi?id=39617 + + Special-case Google domains, and spoof User-Agent when talking to + them, to stop being treated as a second-class citizen. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::initializeDomainsList): + (WebKit::isGoogleDomain): + (WebKit::FrameLoaderClient::userAgent): If enable-site-specific-quirks + is enabled, send the standard WebKit User-Agent string, disregarding the + custom one set by the browser for Google domains. + * webkit/webkitprivate.h: + * webkit/webkitwebsettings.cpp: + (webkitPlatform): Fix style, and simplify. + (webkitOSVersion): Ditto. + (webkitUserAgent): Add the Version/x.y string Safari has been + using since Safari 2.2. + +2010-09-10 Xan Lopez <xlopez@igalia.com> + + Reviewed by Martin Robinson. + + Fix compilation with GTK+ 3.x. + + GDK key macros were renamed from GDK_FOO to GDK_KEY_FOO, we need + to include the compat header provided if we want to keep using the + old names. + + * WebCoreSupport/FullscreenVideoController.cpp: include GtkVersioning.h + 2010-09-08 Darin Adler <darin@apple.com> Reviewed by Adam Barth. diff --git a/WebKit/gtk/JSCore.gir.in b/WebKit/gtk/JSCore.gir.in index e979c33..e143982 100644 --- a/WebKit/gtk/JSCore.gir.in +++ b/WebKit/gtk/JSCore.gir.in @@ -1,12 +1,14 @@ <?xml version="1.0"?> -<repository version="1.1" +<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0" xmlns:c="http://www.gtk.org/introspection/c/1.0"> <namespace name="JSCore" version="@WEBKITGTK_API_VERSION@" shared-library="webkitgtk-@WEBKITGTK_API_VERSION@"> - <alias name="GlobalContextRef" - target="none" - c:type="JSGlobalContextRef"/> - <alias name="ObjectRef" target="none" c:type="JSObjectRef"/> + <alias name="GlobalContextRef" target="none"> + <type name="JSGlobalContextRef" c:type="JSGlobalContextRef"/> + </alias> + <alias name="ObjectRef" target="none"> + <type name="JSObjectRef" c:type="JSObjectRef"/> + </alias> <function name="EvaluateScript" c:identifier="JSEvaluateScript"> <return-value transfer-ownership="none"> <type name="none" c:type="void"/> diff --git a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp index 5c1bc0b..069fb19 100644 --- a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp @@ -62,7 +62,7 @@ static GtkWidget* inputMethodsMenuItem (WebKitWebView* webView) WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); GtkWidget* imContextMenu = gtk_menu_new(); - gtk_im_multicontext_append_menuitems(GTK_IM_MULTICONTEXT(priv->imContext), GTK_MENU_SHELL(imContextMenu)); + gtk_im_multicontext_append_menuitems(GTK_IM_MULTICONTEXT(priv->imContext.get()), GTK_MENU_SHELL(imContextMenu)); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), imContextMenu); diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp index b6075b6..cc75d36 100644 --- a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp @@ -34,16 +34,30 @@ #include "RenderObject.h" #include "webkitprivate.h" #include "webkitwebview.h" +#include <gdk/gdk.h> #include <gtk/gtk.h> using namespace WebCore; namespace WebKit { +static gboolean dragIconWindowExposeEventCallback(GtkWidget* widget, GdkEventExpose* event, DragClient* client) +{ + client->dragIconWindowExposeEvent(widget, event); + return TRUE; +} + DragClient::DragClient(WebKitWebView* webView) : m_webView(webView) , m_startPos(0, 0) + , m_dragIconWindow(gtk_window_new(GTK_WINDOW_POPUP)) { + g_signal_connect(m_dragIconWindow.get(), "expose-event", G_CALLBACK(dragIconWindowExposeEventCallback), this); +} + +DragClient::~DragClient() +{ + g_signal_handlers_disconnect_by_func(m_dragIconWindow.get(), (gpointer) dragIconWindowExposeEventCallback, this); } void DragClient::willPerformDragDestinationAction(DragDestinationAction, DragData*) @@ -77,18 +91,44 @@ void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event()); GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, currentEvent.get()); - webView->priv->draggingDataObjects->set(context, dataObject); + webView->priv->draggingDataObjects.set(context, dataObject); // A drag starting should prevent a double-click from happening. This might // happen if a drag is followed very quickly by another click (like in the DRT). webView->priv->previousClickTime = 0; - if (image) - gtk_drag_set_icon_pixbuf(context, image, eventPos.x() - dragImageOrigin.x(), eventPos.y() - dragImageOrigin.y()); - else + // This strategy originally comes from Chromium: + // src/chrome/browser/gtk/tab_contents_drag_source.cc + if (image) { + m_dragImage = image; + IntSize imageSize(cairo_image_surface_get_width(image), cairo_image_surface_get_height(image)); + gtk_window_resize(GTK_WINDOW(m_dragIconWindow.get()), imageSize.width(), imageSize.height()); + + if (!gtk_widget_get_realized(m_dragIconWindow.get())) { + GdkScreen* screen = gtk_widget_get_screen(m_dragIconWindow.get()); + GdkColormap* rgba = gdk_screen_get_rgba_colormap(screen); + if (rgba) + gtk_widget_set_colormap(m_dragIconWindow.get(), rgba); + } + + IntSize origin = eventPos - dragImageOrigin; + gtk_drag_set_icon_widget(context, m_dragIconWindow.get(), + origin.width(), origin.height()); + } else gtk_drag_set_icon_default(context); } +void DragClient::dragIconWindowExposeEvent(GtkWidget* widget, GdkEventExpose* event) +{ + PlatformRefPtr<cairo_t> context = adoptPlatformRef(gdk_cairo_create(event->window)); + cairo_rectangle(context.get(), 0, 0, + cairo_image_surface_get_width(m_dragImage.get()), + cairo_image_surface_get_height(m_dragImage.get())); + cairo_set_operator(context.get(), CAIRO_OPERATOR_SOURCE); + cairo_set_source_surface(context.get(), m_dragImage.get(), 0, 0); + cairo_fill(context.get()); +} + DragImageRef DragClient::createDragImageForLink(KURL&, const String&, Frame*) { notImplemented(); diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.h b/WebKit/gtk/WebCoreSupport/DragClientGtk.h index 514852e..2ab7e2d 100644 --- a/WebKit/gtk/WebCoreSupport/DragClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.h @@ -31,6 +31,8 @@ #define DragClientGtk_h #include "DragClient.h" +#include "GRefPtr.h" +#include "PlatformRefPtrCairo.h" typedef struct _WebKitWebView WebKitWebView; @@ -39,6 +41,7 @@ namespace WebKit { class DragClient : public WebCore::DragClient { public: DragClient(WebKitWebView*); + ~DragClient(); virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*); virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*); @@ -51,9 +54,13 @@ namespace WebKit { virtual void dragControllerDestroyed(); + void dragIconWindowExposeEvent(GtkWidget*, GdkEventExpose*); + private: WebKitWebView* m_webView; WebCore::IntPoint m_startPos; + PlatformRefPtr<GtkWidget> m_dragIconWindow; + PlatformRefPtr<cairo_surface_t> m_dragImage; }; } diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp index 8a019b4..d4e70b6 100644 --- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp @@ -122,6 +122,13 @@ static void pasteClipboardCallback(GtkWidget* widget, EditorClient* client) client->addPendingEditorCommand("Paste"); } +static void toggleOverwriteCallback(GtkWidget* widget, EditorClient* client) +{ + // We don't support toggling the overwrite mode, but the default callback expects + // the GtkTextView to have a layout, so we handle this signal just to stop it. + g_signal_stop_emission_by_name(widget, "toggle-overwrite"); +} + static const char* const gtkDeleteCommands[][2] = { { "DeleteBackward", "DeleteForward" }, // Characters { "DeleteWordBackward", "DeleteWordForward" }, // Word ends @@ -229,15 +236,15 @@ void EditorClient::setInputMethodState(bool active) WebKitWebViewPrivate* priv = m_webView->priv; if (active) - gtk_im_context_focus_in(priv->imContext); + gtk_im_context_focus_in(priv->imContext.get()); else - gtk_im_context_focus_out(priv->imContext); + gtk_im_context_focus_out(priv->imContext.get()); #ifdef MAEMO_CHANGES if (active) - hildon_gtk_im_context_show(priv->imContext); + hildon_gtk_im_context_show(priv->imContext.get()); else - hildon_gtk_im_context_hide(priv->imContext); + hildon_gtk_im_context_hide(priv->imContext.get()); #endif } @@ -341,6 +348,31 @@ static void collapseSelection(GtkClipboard* clipboard, WebKitWebView* webView) frame->selection()->setBase(frame->selection()->extent(), frame->selection()->affinity()); } +#if PLATFORM(X11) +static void setSelectionPrimaryClipboardIfNeeded(WebKitWebView* webView) +{ + if (!gtk_widget_has_screen(GTK_WIDGET(webView))) + return; + + GtkClipboard* clipboard = gtk_widget_get_clipboard(GTK_WIDGET(webView), GDK_SELECTION_PRIMARY); + DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard); + WebCore::Page* corePage = core(webView); + Frame* targetFrame = corePage->focusController()->focusedOrMainFrame(); + + if (!targetFrame->selection()->isRange()) + return; + + dataObject->clear(); + dataObject->setRange(targetFrame->selection()->toNormalizedRange()); + + viewSettingClipboard = webView; + GClosure* callback = g_cclosure_new_object(G_CALLBACK(collapseSelection), G_OBJECT(webView)); + g_closure_set_marshal(callback, g_cclosure_marshal_VOID__VOID); + pasteboardHelperInstance()->writeClipboardContents(clipboard, callback); + viewSettingClipboard = 0; +} +#endif + void EditorClient::respondToChangedSelection() { WebKitWebViewPrivate* priv = m_webView->priv; @@ -354,19 +386,7 @@ void EditorClient::respondToChangedSelection() return; #if PLATFORM(X11) - GtkClipboard* clipboard = gtk_widget_get_clipboard(GTK_WIDGET(m_webView), GDK_SELECTION_PRIMARY); - DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard); - - if (targetFrame->selection()->isRange()) { - dataObject->clear(); - dataObject->setRange(targetFrame->selection()->toNormalizedRange()); - - viewSettingClipboard = m_webView; - GClosure* callback = g_cclosure_new_object(G_CALLBACK(collapseSelection), G_OBJECT(m_webView)); - g_closure_set_marshal(callback, g_cclosure_marshal_VOID__VOID); - pasteboardHelperInstance()->writeClipboardContents(clipboard, callback); - viewSettingClipboard = 0; - } + setSelectionPrimaryClipboardIfNeeded(m_webView); #endif if (!targetFrame->editor()->hasComposition()) @@ -376,7 +396,7 @@ void EditorClient::respondToChangedSelection() unsigned end; if (!targetFrame->editor()->getCompositionSelection(start, end)) { // gtk_im_context_reset() clears the composition for us. - gtk_im_context_reset(priv->imContext); + gtk_im_context_reset(priv->imContext.get()); targetFrame->editor()->confirmCompositionWithoutDisturbingSelection(); } } @@ -710,7 +730,7 @@ void EditorClient::handleInputMethodKeydown(KeyboardEvent* event) m_treatContextCommitAsKeyEvent = (!targetFrame->editor()->hasComposition()) && event->keyEvent()->gdkEventKey()->keyval; clearPendingComposition(); - if ((gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey()) && !m_pendingComposition) + if ((gtk_im_context_filter_keypress(priv->imContext.get(), event->keyEvent()->gdkEventKey()) && !m_pendingComposition) || (!m_treatContextCommitAsKeyEvent && !targetFrame->editor()->hasComposition())) event->preventDefault(); @@ -730,12 +750,12 @@ void EditorClient::handleInputMethodMousePress() // In this case, if the focused node is changed, the commit signal happens in a diffrent node. // Therefore, we need to confirm the current compositon and ignore the next commit signal. GOwnPtr<gchar> newPreedit(0); - gtk_im_context_get_preedit_string(priv->imContext, &newPreedit.outPtr(), 0, 0); + gtk_im_context_get_preedit_string(priv->imContext.get(), &newPreedit.outPtr(), 0, 0); if (g_utf8_strlen(newPreedit.get(), -1)) { targetFrame->editor()->confirmComposition(); m_preventNextCompositionCommit = true; - gtk_im_context_reset(priv->imContext); + gtk_im_context_reset(priv->imContext.get()); } } @@ -747,8 +767,8 @@ EditorClient::EditorClient(WebKitWebView* webView) , m_nativeWidget(gtk_text_view_new()) { WebKitWebViewPrivate* priv = m_webView->priv; - g_signal_connect(priv->imContext, "commit", G_CALLBACK(imContextCommitted), this); - g_signal_connect(priv->imContext, "preedit-changed", G_CALLBACK(imContextPreeditChanged), this); + g_signal_connect(priv->imContext.get(), "commit", G_CALLBACK(imContextCommitted), this); + g_signal_connect(priv->imContext.get(), "preedit-changed", G_CALLBACK(imContextPreeditChanged), this); g_signal_connect(m_nativeWidget.get(), "backspace", G_CALLBACK(backspaceCallback), this); g_signal_connect(m_nativeWidget.get(), "cut-clipboard", G_CALLBACK(cutClipboardCallback), this); @@ -757,13 +777,14 @@ EditorClient::EditorClient(WebKitWebView* webView) g_signal_connect(m_nativeWidget.get(), "select-all", G_CALLBACK(selectAllCallback), this); g_signal_connect(m_nativeWidget.get(), "move-cursor", G_CALLBACK(moveCursorCallback), this); g_signal_connect(m_nativeWidget.get(), "delete-from-cursor", G_CALLBACK(deleteFromCursorCallback), this); + g_signal_connect(m_nativeWidget.get(), "toggle-overwrite", G_CALLBACK(toggleOverwriteCallback), this); } EditorClient::~EditorClient() { WebKitWebViewPrivate* priv = m_webView->priv; - g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextCommitted, this); - g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextPreeditChanged, this); + g_signal_handlers_disconnect_by_func(priv->imContext.get(), (gpointer)imContextCommitted, this); + g_signal_handlers_disconnect_by_func(priv->imContext.get(), (gpointer)imContextPreeditChanged, this); } void EditorClient::textFieldDidBeginEditing(Element*) diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 4b0da3d..93b4cc2 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -49,6 +49,7 @@ #include "MIMETypeRegistry.h" #include "MouseEvent.h" #include "NotImplemented.h" +#include "Page.h" #include "PlatformString.h" #include "PluginDatabase.h" #include "RenderPart.h" @@ -93,9 +94,115 @@ FrameLoaderClient::~FrameLoaderClient() g_object_unref(m_policyDecision); } -String FrameLoaderClient::userAgent(const KURL&) +static void initializeDomainsList(HashSet<String>& googleDomains) +{ + // Google search domains. + googleDomains.add("biz"); + googleDomains.add("com"); + googleDomains.add("net"); + googleDomains.add("org"); + googleDomains.add("ae"); + googleDomains.add("ag"); + googleDomains.add("am"); + googleDomains.add("at"); + googleDomains.add("az"); + googleDomains.add("be"); + googleDomains.add("bi"); + googleDomains.add("ca"); + googleDomains.add("cc"); + googleDomains.add("cd"); + googleDomains.add("cg"); + googleDomains.add("ch"); + googleDomains.add("cl"); + googleDomains.add("com.br"); + googleDomains.add("co.uk"); + googleDomains.add("co.jp"); + googleDomains.add("de"); + googleDomains.add("dj"); + googleDomains.add("dk"); + googleDomains.add("es"); + googleDomains.add("fi"); + googleDomains.add("fm"); + googleDomains.add("fr"); + googleDomains.add("gg"); + googleDomains.add("gl"); + googleDomains.add("gm"); + googleDomains.add("gs"); + googleDomains.add("hn"); + googleDomains.add("hu"); + googleDomains.add("ie"); + googleDomains.add("it"); + googleDomains.add("je"); + googleDomains.add("kz"); + googleDomains.add("li"); + googleDomains.add("lt"); + googleDomains.add("lu"); + googleDomains.add("lv"); + googleDomains.add("ma"); + googleDomains.add("ms"); + googleDomains.add("mu"); + googleDomains.add("mw"); + googleDomains.add("nl"); + googleDomains.add("no"); + googleDomains.add("nu"); + googleDomains.add("pl"); + googleDomains.add("pn"); + googleDomains.add("pt"); + googleDomains.add("ru"); + googleDomains.add("rw"); + googleDomains.add("sh"); + googleDomains.add("sk"); + googleDomains.add("sm"); + googleDomains.add("st"); + googleDomains.add("td"); + googleDomains.add("tk"); + googleDomains.add("tp"); + googleDomains.add("tv"); + googleDomains.add("us"); + googleDomains.add("uz"); + googleDomains.add("ws"); +} + +static bool isGoogleDomain(String host) +{ + DEFINE_STATIC_LOCAL(HashSet<String>, googleDomains, ()); + DEFINE_STATIC_LOCAL(Vector<String>, otherGoogleDomains, ()); + + if (googleDomains.isEmpty()) { + otherGoogleDomains.append("gmail.com"); + otherGoogleDomains.append("youtube.com"); + otherGoogleDomains.append("gstatic.com"); + otherGoogleDomains.append("ytimg.com"); + + initializeDomainsList(googleDomains); + } + + // First check if this is one of the various google.com international domains. + int position = host.find(".google."); + if (position > 0 && googleDomains.contains(host.substring(position + sizeof(".google.")))) + return true; + + // Then we check the possibility of it being one of the other, .com-only google domains. + for (unsigned int i = 0; i < otherGoogleDomains.size(); i++) { + if (host.endsWith(otherGoogleDomains.at(i))) + return true; + } + + return false; +} + +String FrameLoaderClient::userAgent(const KURL& url) { WebKitWebSettings* settings = webkit_web_view_get_settings(getViewFromFrame(m_frame)); + + gboolean useQuirks; + g_object_get(settings, "enable-site-specific-quirks", &useQuirks, NULL); + + // For Google domains, drop the browser's custom User Agent string, and use the standard + // WebKit/Safari one, so they don't give us a broken experience. + if (useQuirks && isGoogleDomain(url.host())) + return webkitUserAgent(); + return String::fromUTF8(webkit_web_settings_get_user_agent(settings)); } @@ -138,26 +245,15 @@ void FrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction policyFunctio (core(m_frame)->loader()->policyChecker()->*policyFunction)(PolicyUse); } - void FrameLoaderClient::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) { if (!m_pluginView) { ASSERT(loader->frame()); - // Setting the encoding on the frame loader is our way to get work done that is normally done - // when the first bit of data is received, even for the case of a document with no data (like about:blank). - String encoding = loader->overrideEncoding(); - bool userChosen = !encoding.isNull(); - if (!userChosen) - encoding = loader->response().textEncodingName(); - - FrameLoader* frameLoader = loader->frameLoader(); - frameLoader->writer()->setEncoding(encoding, userChosen); - if (data) - frameLoader->addData(data, length); + loader->commitData(data, length); Frame* coreFrame = loader->frame(); - if (coreFrame && coreFrame->document() && coreFrame->document()->isMediaDocument()) - loader->cancelMainResourceLoad(frameLoader->client()->pluginWillHandleLoadError(loader->response())); + if (coreFrame && coreFrame->document()->isMediaDocument()) + loader->cancelMainResourceLoad(coreFrame->loader()->client()->pluginWillHandleLoadError(loader->response())); } if (m_pluginView) { @@ -859,6 +955,12 @@ bool FrameLoaderClient::canHandleRequest(const ResourceRequest&) const return true; } +bool FrameLoaderClient::canShowMIMETypeAsHTML(const String& MIMEType) const +{ + notImplemented(); + return false; +} + bool FrameLoaderClient::canShowMIMEType(const String& type) const { return (MIMETypeRegistry::isSupportedImageMIMEType(type) @@ -1145,14 +1247,12 @@ static void postCommitFrameViewSetup(WebKitWebFrame *frame, FrameView *view, boo { WebKitWebView* containingWindow = getViewFromFrame(frame); WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(containingWindow); - view->setGtkAdjustments(priv->horizontalAdjustment, priv->verticalAdjustment, resetValues); + view->setGtkAdjustments(priv->horizontalAdjustment.get(), priv->verticalAdjustment.get(), resetValues); if (priv->currentMenu) { - GtkMenu* menu = priv->currentMenu; - priv->currentMenu = 0; - - gtk_menu_popdown(menu); - g_object_unref(menu); + PlatformRefPtr<GtkMenu> menu(priv->currentMenu); + priv->currentMenu.clear(); + gtk_menu_popdown(menu.get()); } // Do not allow click counting between main frame loads. diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h index 753576b..c5ffc6a 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h @@ -160,6 +160,7 @@ namespace WebKit { virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; virtual bool canShowMIMEType(const WTF::String&) const; + virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const; virtual bool representationExistsForURLScheme(const WTF::String&) const; virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String&) const; diff --git a/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp b/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp index c95dcff..cf9a548 100644 --- a/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp +++ b/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp @@ -23,6 +23,7 @@ #include "FullscreenVideoController.h" +#include "GtkVersioning.h" #include "MediaPlayer.h" #include <gdk/gdk.h> diff --git a/WebKit/gtk/tests/testatk.c b/WebKit/gtk/tests/testatk.c index 9930bc2..9ca7c05 100644 --- a/WebKit/gtk/tests/testatk.c +++ b/WebKit/gtk/tests/testatk.c @@ -44,10 +44,12 @@ static const char* contentsInTable = "<html><body><table><tr><td>foo</td><td>bar static const char* contentsInTableWithHeaders = "<html><body><table><tr><th>foo</th><th>bar</th><th colspan='2'>baz</th></tr><tr><th>qux</th><td>1</td><td>2</td><td>3</td></tr><tr><th rowspan='2'>quux</th><td>4</td><td>5</td><td>6</td></tr><tr><td>6</td><td>7</td><td>8</td></tr><tr><th>corge</th><td>9</td><td>10</td><td>11</td></tr></table><table><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></table></body></html>"; -static const char* textWithAttributes = "<html><head><style>.st1 {font-family: monospace; color:rgb(120,121,122);} .st2 {text-decoration:underline; background-color:rgb(80,81,82);}</style></head><body><p style=\"font-size:14; text-align:right;\">This is the <i>first</i><b> sentence of this text.</b></p><p class=\"st1\">This sentence should have an style applied <span class=\"st2\">and this part should have another one</span>.</p><p>x<sub>1</sub><sup>2</sup>=x<sub>2</sub><sup>3</sup></p><p style=\"text-align:center;\">This sentence is the <strike>last</strike> one.</p></body></html>"; - static const char* listsOfItems = "<html><body><ul><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ul><ol><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ol></body></html>"; +static const char* textForSelections = "<html><body><p>A paragraph with plain text</p><p>A paragraph with <a href='http://webkit.org'>a link</a> in the middle</p></body></html>"; + +static const char* textWithAttributes = "<html><head><style>.st1 {font-family: monospace; color:rgb(120,121,122);} .st2 {text-decoration:underline; background-color:rgb(80,81,82);}</style></head><body><p style=\"font-size:14; text-align:right;\">This is the <i>first</i><b> sentence of this text.</b></p><p class=\"st1\">This sentence should have an style applied <span class=\"st2\">and this part should have another one</span>.</p><p>x<sub>1</sub><sup>2</sup>=x<sub>2</sub><sup>3</sup></p><p style=\"text-align:center;\">This sentence is the <strike>last</strike> one.</p></body></html>"; + static gboolean bail_out(GMainLoop* loop) { if (g_main_loop_is_running(loop)) @@ -742,6 +744,121 @@ static void testWebkitAtkTextAttributes(void) atk_attribute_set_free(set3); } +static void testWekitAtkTextSelections(void) +{ + WebKitWebView* webView; + AtkObject* obj; + GMainLoop* loop; + gchar* selectedText; + gint startOffset; + gint endOffset; + gboolean result; + + 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, textForSelections, NULL, NULL, NULL); + loop = g_main_loop_new(NULL, TRUE); + + g_timeout_add(100, (GSourceFunc)bail_out, loop); + g_main_loop_run(loop); + + obj = gtk_widget_get_accessible(GTK_WIDGET(webView)); + g_assert(obj); + + AtkText* paragraph1 = ATK_TEXT(atk_object_ref_accessible_child(obj, 0)); + g_assert(ATK_IS_TEXT(paragraph1)); + AtkText* paragraph2 = ATK_TEXT(atk_object_ref_accessible_child(obj, 1)); + g_assert(ATK_IS_TEXT(paragraph2)); + AtkText* link = ATK_TEXT(atk_object_ref_accessible_child(ATK_OBJECT(paragraph2), 0)); + g_assert(ATK_IS_TEXT(link)); + + // First paragraph (simple text) + + // Basic initial checks + g_assert_cmpint(atk_text_get_n_selections(paragraph1), ==, 0); + selectedText = atk_text_get_selection(paragraph1, 0, &startOffset, &endOffset); + g_assert_cmpint(startOffset, ==, 0); + g_assert_cmpint(endOffset, ==, 0); + g_assert_cmpstr(selectedText, ==, NULL); + g_free (selectedText); + // Try removing a non existing (yet) selection + result = atk_text_remove_selection(paragraph1, 0); + g_assert(!result); + // Try setting a 0-char selection + result = atk_text_set_selection(paragraph1, 0, 5, 5); + g_assert(result); + + // Make a selection and test it + result = atk_text_set_selection(paragraph1, 0, 5, 25); + g_assert(result); + g_assert_cmpint(atk_text_get_n_selections(paragraph1), ==, 1); + selectedText = atk_text_get_selection(paragraph1, 0, &startOffset, &endOffset); + g_assert_cmpint(startOffset, ==, 5); + g_assert_cmpint(endOffset, ==, 25); + g_assert_cmpstr(selectedText, ==, "agraph with plain te"); + g_free (selectedText); + // Try removing the selection from other AtkText object (should fail) + result = atk_text_remove_selection(paragraph2, 0); + g_assert(!result); + + // Remove the selection and test everything again + result = atk_text_remove_selection(paragraph1, 0); + g_assert(result); + g_assert_cmpint(atk_text_get_n_selections(paragraph1), ==, 0); + selectedText = atk_text_get_selection(paragraph1, 0, &startOffset, &endOffset); + // Now offsets should be the same, set to the last position of the caret + g_assert_cmpint(startOffset, ==, endOffset); + g_assert_cmpint(startOffset, ==, 25); + g_assert_cmpint(endOffset, ==, 25); + g_assert_cmpstr(selectedText, ==, NULL); + g_free (selectedText); + + // Second paragraph (text + link + text) + + // Set a selection partially covering the link and test it + result = atk_text_set_selection(paragraph2, 0, 7, 21); + g_assert(result); + + // Test the paragraph first + g_assert_cmpint(atk_text_get_n_selections(paragraph2), ==, 1); + selectedText = atk_text_get_selection(paragraph2, 0, &startOffset, &endOffset); + g_assert_cmpint(startOffset, ==, 7); + g_assert_cmpint(endOffset, ==, 21); + g_assert_cmpstr(selectedText, ==, "raph with a li"); + g_free (selectedText); + + // Now test just the link + g_assert_cmpint(atk_text_get_n_selections(link), ==, 1); + selectedText = atk_text_get_selection(link, 0, &startOffset, &endOffset); + g_assert_cmpint(startOffset, ==, 0); + g_assert_cmpint(endOffset, ==, 4); + g_assert_cmpstr(selectedText, ==, "a li"); + g_free (selectedText); + + // Remove selections and text everything again + result = atk_text_remove_selection(paragraph2, 0); + g_assert(result); + g_assert_cmpint(atk_text_get_n_selections(paragraph2), ==, 0); + selectedText = atk_text_get_selection(paragraph2, 0, &startOffset, &endOffset); + // Now offsets should be the same (no selection) + g_assert_cmpint(startOffset, ==, endOffset); + g_assert_cmpstr(selectedText, ==, NULL); + g_free (selectedText); + + g_assert_cmpint(atk_text_get_n_selections(link), ==, 0); + selectedText = atk_text_get_selection(link, 0, &startOffset, &endOffset); + // Now offsets should be the same (no selection) + g_assert_cmpint(startOffset, ==, endOffset); + g_assert_cmpstr(selectedText, ==, NULL); + g_free (selectedText); + + g_object_unref(paragraph1); + g_object_unref(paragraph2); + g_object_unref(webView); +} + static void test_webkit_atk_get_extents(void) { WebKitWebView* webView; @@ -876,17 +993,17 @@ static void testWebkitAtkListsOfItems(void) g_assert(atk_object_get_role(uList) == ATK_ROLE_LIST); g_assert_cmpint(atk_object_get_n_accessible_children(uList), ==, 3); - item1 = ATK_TEXT(atk_object_ref_accessible_child(uList, 0)); - item2 = ATK_TEXT(atk_object_ref_accessible_child(uList, 1)); - item3 = ATK_TEXT(atk_object_ref_accessible_child(uList, 2)); + item1 = atk_object_ref_accessible_child(uList, 0); + item2 = atk_object_ref_accessible_child(uList, 1); + item3 = atk_object_ref_accessible_child(uList, 2); g_assert_cmpint(atk_object_get_n_accessible_children(item1), ==, 0); g_assert_cmpint(atk_object_get_n_accessible_children(item2), ==, 1); g_assert_cmpint(atk_object_get_n_accessible_children(item3), ==, 1); - g_assert_cmpstr(atk_text_get_text(item1, 0, -1), ==, "\342\200\242 text only"); - g_assert_cmpstr(atk_text_get_text(item2, 0, -1), ==, "\342\200\242 link only"); - g_assert_cmpstr(atk_text_get_text(item3, 0, -1), ==, "\342\200\242 text and a link"); + g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item1), 0, -1), ==, "\342\200\242 text only"); + g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item2), 0, -1), ==, "\342\200\242 link only"); + g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item3), 0, -1), ==, "\342\200\242 text and a link"); g_object_unref(item1); g_object_unref(item2); @@ -899,13 +1016,13 @@ static void testWebkitAtkListsOfItems(void) g_assert(atk_object_get_role(oList) == ATK_ROLE_LIST); g_assert_cmpint(atk_object_get_n_accessible_children(oList), ==, 3); - item1 = ATK_TEXT(atk_object_ref_accessible_child(oList, 0)); - item2 = ATK_TEXT(atk_object_ref_accessible_child(oList, 1)); - item3 = ATK_TEXT(atk_object_ref_accessible_child(oList, 2)); + item1 = atk_object_ref_accessible_child(oList, 0); + item2 = atk_object_ref_accessible_child(oList, 1); + item3 = atk_object_ref_accessible_child(oList, 2); - g_assert_cmpstr(atk_text_get_text(item1, 0, -1), ==, "1 text only"); - g_assert_cmpstr(atk_text_get_text(item2, 0, -1), ==, "2 link only"); - g_assert_cmpstr(atk_text_get_text(item3, 0, -1), ==, "3 text and a link"); + g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item1), 0, -1), ==, "1 text only"); + g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item2), 0, -1), ==, "2 link only"); + g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item3), 0, -1), ==, "3 text and a link"); g_assert_cmpint(atk_object_get_n_accessible_children(item1), ==, 0); g_assert_cmpint(atk_object_get_n_accessible_children(item2), ==, 1); @@ -936,6 +1053,7 @@ int main(int argc, char** argv) g_test_add_func("/webkit/atk/getTextInTable", testWebkitAtkGetTextInTable); g_test_add_func("/webkit/atk/getHeadersInTable", testWebkitAtkGetHeadersInTable); g_test_add_func("/webkit/atk/textAttributes", testWebkitAtkTextAttributes); + g_test_add_func("/webkit/atk/textSelections", testWekitAtkTextSelections); g_test_add_func("/webkit/atk/get_extents", test_webkit_atk_get_extents); g_test_add_func("/webkit/atk/listsOfItems", testWebkitAtkListsOfItems); return g_test_run (); diff --git a/WebKit/gtk/webkit/webkitdownload.cpp b/WebKit/gtk/webkit/webkitdownload.cpp index 9bcb739..1e45250 100644 --- a/WebKit/gtk/webkit/webkitdownload.cpp +++ b/WebKit/gtk/webkit/webkitdownload.cpp @@ -60,7 +60,7 @@ class DownloadClient : public Noncopyable, public ResourceHandleClient { virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&); virtual void didReceiveData(ResourceHandle*, const char*, int, int); - virtual void didFinishLoading(ResourceHandle*); + virtual void didFinishLoading(ResourceHandle*, double); virtual void didFail(ResourceHandle*, const ResourceError&); virtual void wasBlocked(ResourceHandle*); virtual void cannotShowURL(ResourceHandle*); @@ -485,8 +485,9 @@ void webkit_download_start(WebKitDownload* download) g_return_if_fail(priv->status == WEBKIT_DOWNLOAD_STATUS_CREATED); g_return_if_fail(priv->timer == NULL); + // For GTK, when downloading a file NetworkingContext is null if (!priv->resourceHandle) - priv->resourceHandle = ResourceHandle::create(core(priv->networkRequest), priv->downloadClient, 0, false, false); + priv->resourceHandle = ResourceHandle::create(/* Null NetworkingContext */ NULL, core(priv->networkRequest), priv->downloadClient, false, false); else { priv->resourceHandle->setClient(priv->downloadClient); @@ -929,7 +930,7 @@ void DownloadClient::didReceiveData(ResourceHandle*, const char* data, int lengt webkit_download_received_data(m_download, data, length); } -void DownloadClient::didFinishLoading(ResourceHandle*) +void DownloadClient::didFinishLoading(ResourceHandle*, double) { webkit_download_finished_loading(m_download); } diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp index 1b7f7a3..aa3d3da 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 "FrameNetworkingContextGtk.h" #include "GtkVersioning.h" #include "HTMLMediaElement.h" #include "HTMLNames.h" @@ -205,11 +206,14 @@ static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMes if (!d) return NULL; - WebCore::Frame* frame = d->m_frame; - if (!frame) + WebKit::FrameNetworkingContextGtk* context = static_cast<WebKit::FrameNetworkingContextGtk*>(d->m_context.get()); + if (!context) + return NULL; + + if (!context->coreFrame()) return NULL; - GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(frame->page()->chrome()->platformPageClient())); + GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(context->coreFrame()->page()->chrome()->platformPageClient())); if (gtk_widget_is_toplevel(toplevel)) return toplevel; else diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index bde5b55..616ee6b 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -59,6 +59,7 @@ #include "FullscreenVideoController.h" #include "Node.h" #include "Page.h" +#include "PlatformString.h" #include "ResourceHandle.h" #include "ResourceRequest.h" #include "ResourceResponse.h" @@ -133,32 +134,32 @@ extern "C" { typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate; struct _WebKitWebViewPrivate { WebCore::Page* corePage; - WebKitWebSettings* webSettings; - WebKitWebInspector* webInspector; - WebKitWebWindowFeatures* webWindowFeatures; + PlatformRefPtr<WebKitWebSettings> webSettings; + PlatformRefPtr<WebKitWebInspector> webInspector; + PlatformRefPtr<WebKitWebWindowFeatures> webWindowFeatures; WebKitWebFrame* mainFrame; - WebKitWebBackForwardList* backForwardList; + PlatformRefPtr<WebKitWebBackForwardList> backForwardList; - GtkMenu* currentMenu; + PlatformRefPtr<GtkMenu> currentMenu; gint lastPopupXPosition; gint lastPopupYPosition; HashSet<GtkWidget*> children; bool editable; - GtkIMContext* imContext; + PlatformRefPtr<GtkIMContext> imContext; gboolean transparent; - GtkAdjustment* horizontalAdjustment; - GtkAdjustment* verticalAdjustment; + PlatformRefPtr<GtkAdjustment> horizontalAdjustment; + PlatformRefPtr<GtkAdjustment> verticalAdjustment; gboolean zoomFullContent; WebKitLoadStatus loadStatus; - char* encoding; - char* customEncoding; + CString encoding; + CString customEncoding; - char* iconURI; + CString iconURI; gboolean disposing; gboolean usePrimaryForPaste; @@ -169,18 +170,17 @@ extern "C" { // These are hosted here because the DataSource object is // created too late in the frame loading process. - WebKitWebResource* mainResource; - char* mainResourceIdentifier; - GHashTable* subResources; - char* tooltipText; + PlatformRefPtr<WebKitWebResource> mainResource; + CString mainResourceIdentifier; + PlatformRefPtr<GHashTable> subResources; + CString tooltipText; int currentClickCount; - WebCore::IntPoint* previousClickPoint; + WebCore::IntPoint previousClickPoint; guint previousClickButton; guint32 previousClickTime; - - HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk> >* draggingDataObjects; - HashMap<GdkDragContext*, WebKit::DroppingContext*>* droppingContexts; + HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk> > draggingDataObjects; + HashMap<GdkDragContext*, WebKit::DroppingContext*> droppingContexts; }; #define WEBKIT_WEB_FRAME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate)) @@ -206,6 +206,9 @@ extern "C" { gboolean disposed; }; + WTF::String + webkitUserAgent(); + void webkit_web_frame_core_frame_gone(WebKitWebFrame*); @@ -283,6 +286,9 @@ extern "C" { void webkit_web_view_set_tooltip_text(WebKitWebView*, const char*); + GtkMenu* + webkit_web_view_get_context_menu(WebKitWebView*); + WEBKIT_API void webkit_web_view_execute_core_command_by_name(WebKitWebView* webView, const gchar* name, const gchar* value); diff --git a/WebKit/gtk/webkit/webkitwebsettings.cpp b/WebKit/gtk/webkit/webkitwebsettings.cpp index 71a338c..767fce1 100644 --- a/WebKit/gtk/webkit/webkitwebsettings.cpp +++ b/WebKit/gtk/webkit/webkitwebsettings.cpp @@ -163,56 +163,62 @@ enum { // Create a default user agent string // This is a liberal interpretation of http://www.mozilla.org/build/revised-user-agent-strings.html // See also http://developer.apple.com/internet/safari/faq.html#anchor2 -static String webkit_get_user_agent() +static String webkitPlatform() { - gchar* platform; - gchar* osVersion; - #if PLATFORM(X11) - platform = g_strdup("X11"); + DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("X11"))); #elif OS(WINDOWS) - platform = g_strdup("Windows"); + DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Windows"))); #elif PLATFORM(MAC) - platform = g_strdup("Macintosh"); + DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Macintosh"))); #elif defined(GDK_WINDOWING_DIRECTFB) - platform = g_strdup("DirectFB"); + DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("DirectFB"))); #else - platform = g_strdup("Unknown"); + DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Unknown"))); #endif + return uaPlatform; +} + +static String webkitOSVersion() +{ // FIXME: platform/version detection can be shared. #if OS(DARWIN) #if CPU(X86) - osVersion = g_strdup("Intel Mac OS X"); + DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Intel Mac OS X"))); #else - osVersion = g_strdup("PPC Mac OS X"); + DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("PPC Mac OS X"))); #endif #elif OS(UNIX) + DEFINE_STATIC_LOCAL(String, uaOSVersion, (String())); + + if (!uaOSVersion.isEmpty()) + return uaOSVersion; + struct utsname name; if (uname(&name) != -1) - osVersion = g_strdup_printf("%s %s", name.sysname, name.machine); + uaOSVersion = String::format("%s %s", name.sysname, name.machine); else - osVersion = g_strdup("Unknown"); - + uaOSVersion = String("Unknown"); #elif OS(WINDOWS) - // FIXME: Compute the Windows version - osVersion = g_strdup("Windows"); - + DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Windows"))); #else - osVersion = g_strdup("Unknown"); + DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Unknown"))); #endif + return uaOSVersion; +} + +String webkitUserAgent() +{ // We mention Safari since many broken sites check for it (OmniWeb does this too) // We re-use the WebKit version, though it doesn't seem to matter much in practice DEFINE_STATIC_LOCAL(const String, uaVersion, (String::format("%d.%d+", WEBKIT_USER_AGENT_MAJOR_VERSION, WEBKIT_USER_AGENT_MINOR_VERSION))); - DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko) Safari/%s", - platform, osVersion, defaultLanguage().utf8().data(), uaVersion.utf8().data(), uaVersion.utf8().data()))); - - g_free(osVersion); - g_free(platform); + DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko) Version/5.0 Safari/%s", + webkitPlatform().utf8().data(), webkitOSVersion().utf8().data(), defaultLanguage().utf8().data(), uaVersion.utf8().data(), uaVersion.utf8().data()))); return staticUA; } @@ -607,7 +613,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) g_param_spec_string("user-agent", _("User Agent"), _("The User-Agent string used by WebKitGtk"), - webkit_get_user_agent().utf8().data(), + webkitUserAgent().utf8().data(), flags)); /** @@ -1034,7 +1040,7 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con case PROP_USER_AGENT: g_free(priv->user_agent); if (!g_value_get_string(value) || !strlen(g_value_get_string(value))) - priv->user_agent = g_strdup(webkit_get_user_agent().utf8().data()); + priv->user_agent = g_strdup(webkitUserAgent().utf8().data()); else priv->user_agent = g_strdup(g_value_get_string(value)); break; diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index 480983f..3212450 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -210,11 +210,7 @@ static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView*); 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; + WEBKIT_WEB_VIEW(data)->priv->currentMenu = 0; } static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData) @@ -224,7 +220,11 @@ static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pus GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(view)); GtkRequisition menuSize; +#ifdef GTK_API_VERSION_2 gtk_widget_size_request(GTK_WIDGET(menu), &menuSize); +#else + gtk_size_request_get_size(GTK_SIZE_REQUEST(menu), &menuSize, NULL); +#endif *x = priv->lastPopupXPosition; if ((*x + menuSize.width) >= gdk_screen_get_width(screen)) @@ -304,7 +304,7 @@ 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->currentMenu = menu; priv->lastPopupXPosition = event.globalX(); priv->lastPopupYPosition = event.globalY(); @@ -592,7 +592,7 @@ static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey // the event if we don't have a pending composition, because that means we // are using a context like 'simple' which marks every keystroke as filtered. WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient()); - if (gtk_im_context_filter_keypress(webView->priv->imContext, event) && !client->hasPendingComposition()) + if (gtk_im_context_filter_keypress(webView->priv->imContext.get(), event) && !client->hasPendingComposition()) return TRUE; Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); @@ -651,8 +651,8 @@ static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventBu // GDK logic for counting clicks. guint32 eventTime = getEventTime(reinterpret_cast<GdkEvent*>(event)); if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) - || ((abs(event->x - priv->previousClickPoint->x()) < doubleClickDistance) - && (abs(event->y - priv->previousClickPoint->y()) < doubleClickDistance) + || ((abs(event->x - priv->previousClickPoint.x()) < doubleClickDistance) + && (abs(event->y - priv->previousClickPoint.y()) < doubleClickDistance) && (eventTime - priv->previousClickTime < static_cast<guint>(doubleClickTime)) && (event->button == priv->previousClickButton))) priv->currentClickCount++; @@ -661,7 +661,7 @@ static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventBu PlatformMouseEvent platformEvent(event); platformEvent.setClickCount(priv->currentClickCount); - *priv->previousClickPoint = platformEvent.pos(); + priv->previousClickPoint = platformEvent.pos(); priv->previousClickButton = event->button; priv->previousClickTime = eventTime; @@ -702,7 +702,7 @@ static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEvent if (focusedFrame && focusedFrame->editor()->canEdit()) { #ifdef MAEMO_CHANGES WebKitWebViewPrivate* priv = webView->priv; - hildon_gtk_im_context_filter_event(priv->imContext, (GdkEvent*)event); + hildon_gtk_im_context_filter_event(priv->imContext.get(), (GdkEvent*)event); #endif } @@ -806,7 +806,7 @@ static gboolean webkit_web_view_focus_in_event(GtkWidget* widget, GdkEventFocus* focusController->setFocusedFrame(core(webView)->mainFrame()); if (focusController->focusedFrame()->editor()->canEdit()) - gtk_im_context_focus_in(webView->priv->imContext); + gtk_im_context_focus_in(webView->priv->imContext.get()); } return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_in_event(widget, event); } @@ -824,7 +824,7 @@ static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus } if (webView->priv->imContext) - gtk_im_context_focus_out(webView->priv->imContext); + gtk_im_context_focus_out(webView->priv->imContext.get()); return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_out_event(widget, event); } @@ -875,7 +875,7 @@ static void webkit_web_view_realize(GtkWidget* widget) WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; - gtk_im_context_set_client_window(priv->imContext, window); + gtk_im_context_set_client_window(priv->imContext.get(), window); } static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* hadj, GtkAdjustment* vadj) @@ -883,26 +883,12 @@ static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAd if (!core(webView)) return; - FrameView* view = core(webkit_web_view_get_main_frame(webView))->view(); - - if (hadj) - g_object_ref(hadj); - if (vadj) - g_object_ref(vadj); - - WebKitWebViewPrivate* priv = webView->priv; - - if (priv->horizontalAdjustment) - g_object_unref(priv->horizontalAdjustment); - if (priv->verticalAdjustment) - g_object_unref(priv->verticalAdjustment); - - priv->horizontalAdjustment = hadj; - priv->verticalAdjustment = vadj; + webView->priv->horizontalAdjustment = hadj; + webView->priv->verticalAdjustment = vadj; + FrameView* view = core(webkit_web_view_get_main_frame(webView))->view(); if (!view) return; - view->setGtkAdjustments(hadj, vadj); } @@ -1158,78 +1144,42 @@ static void webkit_web_view_dispose(GObject* object) priv->disposing = TRUE; - if (priv->horizontalAdjustment) { - g_object_unref(priv->horizontalAdjustment); - priv->horizontalAdjustment = NULL; - } - - if (priv->verticalAdjustment) { - g_object_unref(priv->verticalAdjustment); - priv->verticalAdjustment = NULL; - } - - if (priv->backForwardList) { - g_object_unref(priv->backForwardList); - priv->backForwardList = NULL; - } + // These smart pointers are cleared manually, because some cleanup operations are + // very sensitive to their value. We may crash if these are done in the wrong order. + priv->horizontalAdjustment.clear(); + priv->verticalAdjustment.clear(); + priv->backForwardList.clear(); if (priv->corePage) { webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(object)); - core(priv->mainFrame)->loader()->detachFromParent(); delete priv->corePage; - priv->corePage = NULL; + priv->corePage = 0; } if (priv->webSettings) { - g_signal_handlers_disconnect_by_func(priv->webSettings, (gpointer)webkit_web_view_settings_notify, webView); - g_object_unref(priv->webSettings); - priv->webSettings = NULL; - - g_object_unref(priv->webInspector); - priv->webInspector = NULL; - - g_object_unref(priv->webWindowFeatures); - priv->webWindowFeatures = NULL; - - g_object_unref(priv->imContext); - priv->imContext = NULL; - } - - if (priv->mainResource) { - g_object_unref(priv->mainResource); - priv->mainResource = NULL; + g_signal_handlers_disconnect_by_func(priv->webSettings.get(), (gpointer)webkit_web_view_settings_notify, webView); + priv->webSettings.clear(); } - if (priv->subResources) { - g_hash_table_unref(priv->subResources); - priv->subResources = NULL; - } + priv->webInspector.clear(); + priv->webWindowFeatures.clear(); + priv->mainResource.clear(); + priv->subResources.clear(); - priv->draggingDataObjects->clear(); - HashMap<GdkDragContext*, DroppingContext*>::iterator endDroppingContexts = priv->droppingContexts->end(); - for (HashMap<GdkDragContext*, DroppingContext*>::iterator iter = priv->droppingContexts->begin(); iter != endDroppingContexts; ++iter) + HashMap<GdkDragContext*, DroppingContext*>::iterator endDroppingContexts = priv->droppingContexts.end(); + for (HashMap<GdkDragContext*, DroppingContext*>::iterator iter = priv->droppingContexts.begin(); iter != endDroppingContexts; ++iter) delete (iter->second); - priv->droppingContexts->clear(); + priv->droppingContexts.clear(); G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object); } static void webkit_web_view_finalize(GObject* object) { - WebKitWebView* webView = WEBKIT_WEB_VIEW(object); - WebKitWebViewPrivate* priv = webView->priv; - - g_free(priv->tooltipText); - g_free(priv->mainResourceIdentifier); - g_free(priv->encoding); - g_free(priv->customEncoding); - g_free(priv->iconURI); - - delete priv->previousClickPoint; - delete priv->draggingDataObjects; - delete priv->droppingContexts; - + // We need to manually call the destructor here, since this object's memory is managed + // by GLib. This calls all C++ members' destructors and prevents memory leaks. + WEBKIT_WEB_VIEW(object)->priv->~WebKitWebViewPrivate(); G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object); } @@ -1279,7 +1229,7 @@ static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget) static gdouble webViewGetDPI(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; - WebKitWebSettings* webSettings = priv->webSettings; + WebKitWebSettings* webSettings = priv->webSettings.get(); gboolean enforce96DPI; g_object_get(webSettings, "enforce-96-dpi", &enforce96DPI, NULL); if (enforce96DPI) @@ -1305,7 +1255,7 @@ static void webkit_web_view_screen_changed(GtkWidget* widget, GdkScreen* previou if (priv->disposing) return; - WebKitWebSettings* webSettings = priv->webSettings; + WebKitWebSettings* webSettings = priv->webSettings.get(); Settings* settings = core(webView)->settings(); gdouble DPI = webViewGetDPI(webView); @@ -1339,10 +1289,10 @@ static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context) // This might happen if a drag is still in progress after a WebKitWebView // is disposed and before it is finalized. - if (!priv->draggingDataObjects->contains(context)) + if (!priv->draggingDataObjects.contains(context)) return; - priv->draggingDataObjects->remove(context); + priv->draggingDataObjects.remove(context); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); if (!frame) @@ -1377,10 +1327,10 @@ static void webkit_web_view_drag_data_get(GtkWidget* widget, GdkDragContext* con // This might happen if a drag is still in progress after a WebKitWebView // is diposed and before it is finalized. - if (!priv->draggingDataObjects->contains(context)) + if (!priv->draggingDataObjects.contains(context)) return; - pasteboardHelperInstance()->fillSelectionData(selectionData, info, priv->draggingDataObjects->get(context).get()); + pasteboardHelperInstance()->fillSelectionData(selectionData, info, priv->draggingDataObjects.get(context).get()); } static gboolean doDragLeaveLater(DroppingContext* context) @@ -1388,7 +1338,7 @@ static gboolean doDragLeaveLater(DroppingContext* context) WebKitWebView* webView = context->webView; WebKitWebViewPrivate* priv = webView->priv; - if (!priv->droppingContexts->contains(context->gdkContext)) + if (!priv->droppingContexts.contains(context->gdkContext)) return FALSE; // If the view doesn't know about the drag yet (there are still pending data) @@ -1405,7 +1355,7 @@ static gboolean doDragLeaveLater(DroppingContext* context) } core(webView)->dragController()->dragEnded(); - priv->droppingContexts->remove(context->gdkContext); + priv->droppingContexts.remove(context->gdkContext); delete context; return FALSE; } @@ -1415,13 +1365,13 @@ static void webkit_web_view_drag_leave(GtkWidget* widget, GdkDragContext* contex WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; - if (!priv->droppingContexts->contains(context)) + if (!priv->droppingContexts.contains(context)) return; // During a drop GTK+ will fire a drag-leave signal right before firing // the drag-drop signal. We want the actions for drag-leave to happen after // those for drag-drop, so schedule them to happen asynchronously here. - g_timeout_add(0, reinterpret_cast<GSourceFunc>(doDragLeaveLater), priv->droppingContexts->get(context)); + g_timeout_add(0, reinterpret_cast<GSourceFunc>(doDragLeaveLater), priv->droppingContexts.get(context)); } static gboolean webkit_web_view_drag_motion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time) @@ -1431,21 +1381,21 @@ static gboolean webkit_web_view_drag_motion(GtkWidget* widget, GdkDragContext* c DroppingContext* droppingContext = 0; IntPoint position = IntPoint(x, y); - if (!priv->droppingContexts->contains(context)) { + if (!priv->droppingContexts.contains(context)) { droppingContext = new DroppingContext; droppingContext->webView = webView; droppingContext->gdkContext = context; droppingContext->dataObject = WebCore::DataObjectGtk::create(); droppingContext->dropHappened = false; droppingContext->lastMotionPosition = position; - priv->droppingContexts->set(context, droppingContext); + priv->droppingContexts.set(context, droppingContext); Vector<GdkAtom> acceptableTargets(pasteboardHelperInstance()->dropAtomsForContext(widget, context)); droppingContext->pendingDataRequests = acceptableTargets.size(); for (size_t i = 0; i < acceptableTargets.size(); i++) gtk_drag_get_data(widget, context, acceptableTargets.at(i), time); } else { - droppingContext = priv->droppingContexts->get(context); + droppingContext = priv->droppingContexts.get(context); droppingContext->lastMotionPosition = position; } @@ -1468,10 +1418,10 @@ static void webkit_web_view_drag_data_received(GtkWidget* widget, GdkDragContext WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; - if (!priv->droppingContexts->contains(context)) + if (!priv->droppingContexts.contains(context)) return; - DroppingContext* droppingContext = priv->droppingContexts->get(context); + DroppingContext* droppingContext = priv->droppingContexts.get(context); droppingContext->pendingDataRequests--; pasteboardHelperInstance()->fillDataObjectFromDropData(selectionData, info, droppingContext->dataObject.get()); @@ -1493,10 +1443,10 @@ static gboolean webkit_web_view_drag_drop(GtkWidget* widget, GdkDragContext* con WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; - if (!priv->droppingContexts->contains(context)) + if (!priv->droppingContexts.contains(context)) return FALSE; - DroppingContext* droppingContext = priv->droppingContexts->get(context); + DroppingContext* droppingContext = priv->droppingContexts.get(context); droppingContext->dropHappened = true; IntPoint position(x, y); @@ -1512,8 +1462,8 @@ static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y, { WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(widget); - if (priv->tooltipText) { - gtk_tooltip_set_text(tooltip, priv->tooltipText); + if (priv->tooltipText.length() > 0) { + gtk_tooltip_set_text(tooltip, priv->tooltipText.data()); return TRUE; } @@ -1524,7 +1474,7 @@ static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y, static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); - return GTK_IM_CONTEXT(webView->priv->imContext); + return GTK_IM_CONTEXT(webView->priv->imContext.get()); } static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) @@ -2892,7 +2842,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) static void webkit_web_view_update_settings(WebKitWebView* webView) { WebKitWebViewPrivate* priv = webView->priv; - WebKitWebSettings* webSettings = priv->webSettings; + WebKitWebSettings* webSettings = priv->webSettings.get(); Settings* settings = core(webView)->settings(); gchar* defaultEncoding, *cursiveFontFamily, *defaultFontFamily, *fantasyFontFamily, *monospaceFontFamily, *sansSerifFontFamily, *serifFontFamily, *userStylesheetUri; @@ -3095,8 +3045,14 @@ static void webkit_web_view_init(WebKitWebView* webView) { WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView); webView->priv = priv; + // This is the placement new syntax: http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.10 + // It allows us to call a constructor on manually allocated locations in memory. We must use it + // in this case, because GLib manages the memory for the private data section, but we wish it + // to contain C++ object members. The use of placement new calls the constructor on all C++ data + // members, which ensures they are initialized properly. + new (priv) WebKitWebViewPrivate(); - priv->imContext = gtk_im_multicontext_new(); + priv->imContext = adoptPlatformRef(gtk_im_multicontext_new()); Page::PageClients pageClients; pageClients.chromeClient = new WebKit::ChromeClient(webView); @@ -3108,40 +3064,33 @@ static void webkit_web_view_init(WebKitWebView* webView) // We also add a simple wrapper class to provide the public // interface for the Web Inspector. - priv->webInspector = WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL)); - webkit_web_inspector_set_inspector_client(priv->webInspector, priv->corePage); + priv->webInspector = adoptPlatformRef(WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL))); + webkit_web_inspector_set_inspector_client(priv->webInspector.get(), priv->corePage); + // The smart pointer will call g_object_ref_sink on these adjustments. priv->horizontalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); priv->verticalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); - g_object_ref_sink(priv->horizontalAdjustment); - g_object_ref_sink(priv->verticalAdjustment); - gtk_widget_set_can_focus(GTK_WIDGET(webView), TRUE); priv->mainFrame = WEBKIT_WEB_FRAME(webkit_web_frame_new(webView)); priv->lastPopupXPosition = priv->lastPopupYPosition = -1; priv->editable = false; - priv->backForwardList = webkit_web_back_forward_list_new_with_web_view(webView); + priv->backForwardList = adoptPlatformRef(webkit_web_back_forward_list_new_with_web_view(webView)); priv->zoomFullContent = FALSE; - priv->webSettings = webkit_web_settings_new(); + priv->webSettings = adoptPlatformRef(webkit_web_settings_new()); webkit_web_view_update_settings(webView); - g_signal_connect(priv->webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); + g_signal_connect(priv->webSettings.get(), "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); - priv->webWindowFeatures = webkit_web_window_features_new(); + priv->webWindowFeatures = adoptPlatformRef(webkit_web_window_features_new()); - priv->subResources = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref); + priv->subResources = adoptPlatformRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref)); - priv->tooltipText = 0; priv->currentClickCount = 0; - priv->previousClickPoint = new IntPoint(0, 0); priv->previousClickButton = 0; priv->previousClickTime = 0; - - priv->draggingDataObjects = new HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk> >(); - priv->droppingContexts = new HashMap<GdkDragContext*, DroppingContext*>(); gtk_drag_dest_set(GTK_WIDGET(webView), static_cast<GtkDestDefaults>(0), 0, 0, static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE)); gtk_drag_dest_set_target_list(GTK_WIDGET(webView), pasteboardHelperInstance()->targetList()); } @@ -3211,9 +3160,7 @@ void webkit_web_view_set_settings(WebKitWebView* webView, WebKitWebSettings* web g_return_if_fail(WEBKIT_IS_WEB_SETTINGS(webSettings)); WebKitWebViewPrivate* priv = webView->priv; - g_signal_handlers_disconnect_by_func(priv->webSettings, (gpointer)webkit_web_view_settings_notify, webView); - g_object_unref(priv->webSettings); - g_object_ref(webSettings); + g_signal_handlers_disconnect_by_func(priv->webSettings.get(), (gpointer)webkit_web_view_settings_notify, webView); priv->webSettings = webSettings; webkit_web_view_update_settings(webView); g_signal_connect(webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); @@ -3235,10 +3182,8 @@ void webkit_web_view_set_settings(WebKitWebView* webView, WebKitWebSettings* web */ WebKitWebSettings* webkit_web_view_get_settings(WebKitWebView* webView) { - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - - WebKitWebViewPrivate* priv = webView->priv; - return priv->webSettings; + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); + return webView->priv->webSettings.get(); } /** @@ -3257,26 +3202,18 @@ WebKitWebSettings* webkit_web_view_get_settings(WebKitWebView* webView) */ WebKitWebInspector* webkit_web_view_get_inspector(WebKitWebView* webView) { - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - - WebKitWebViewPrivate* priv = webView->priv; - return priv->webInspector; + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); + return webView->priv->webInspector.get(); } // internal static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures) { - WebKitWebViewPrivate* priv = webView->priv; - if (!webWindowFeatures) return; - - if (webkit_web_window_features_equal(priv->webWindowFeatures, webWindowFeatures)) + if (webkit_web_window_features_equal(webView->priv->webWindowFeatures.get(), webWindowFeatures)) return; - - g_object_unref(priv->webWindowFeatures); - g_object_ref(webWindowFeatures); - priv->webWindowFeatures = webWindowFeatures; + webView->priv->webWindowFeatures = webWindowFeatures; } /** @@ -3292,10 +3229,8 @@ static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWe */ WebKitWebWindowFeatures* webkit_web_view_get_window_features(WebKitWebView* webView) { - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - - WebKitWebViewPrivate* priv = webView->priv; - return priv->webWindowFeatures; + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); + return webView->priv->webWindowFeatures.get(); } /** @@ -3359,14 +3294,10 @@ void webkit_web_view_set_maintains_back_forward_list(WebKitWebView* webView, gbo */ WebKitWebBackForwardList* webkit_web_view_get_back_forward_list(WebKitWebView* webView) { - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - - WebKitWebViewPrivate* priv = webView->priv; - + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); if (!core(webView) || !core(webView)->backForwardList()->enabled()) - return NULL; - - return priv->backForwardList; + return 0; + return webView->priv->backForwardList.get(); } /** @@ -4075,11 +4006,8 @@ gfloat webkit_web_view_get_zoom_level(WebKitWebView* webView) if (!frame) return 1.0f; - FrameView* view = frame->view(); - if (!view) - return 1; - - return view->zoomFactor(); + WebKitWebViewPrivate* priv = webView->priv; + return priv->zoomFullContent ? frame->pageZoomFactor() : frame->textZoomFactor(); } static void webkit_web_view_apply_zoom_level(WebKitWebView* webView, gfloat zoomLevel) @@ -4088,12 +4016,11 @@ static void webkit_web_view_apply_zoom_level(WebKitWebView* webView, gfloat zoom if (!frame) return; - FrameView* view = frame->view(); - if (!view) - return; - WebKitWebViewPrivate* priv = webView->priv; - view->setZoomFactor(zoomLevel, priv->zoomFullContent ? ZoomPage : ZoomTextOnly); + if (priv->zoomFullContent) + frame->setPageZoomFactor(zoomLevel); + else + frame->setTextZoomFactor(zoomLevel); } /** @@ -4133,7 +4060,7 @@ void webkit_web_view_zoom_in(WebKitWebView* webView) WebKitWebViewPrivate* priv = webView->priv; gfloat zoomMultiplierRatio; - g_object_get(priv->webSettings, "zoom-step", &zoomMultiplierRatio, NULL); + g_object_get(priv->webSettings.get(), "zoom-step", &zoomMultiplierRatio, NULL); webkit_web_view_set_zoom_level(webView, webkit_web_view_get_zoom_level(webView) + zoomMultiplierRatio); } @@ -4154,7 +4081,7 @@ void webkit_web_view_zoom_out(WebKitWebView* webView) WebKitWebViewPrivate* priv = webView->priv; gfloat zoomMultiplierRatio; - g_object_get(priv->webSettings, "zoom-step", &zoomMultiplierRatio, NULL); + g_object_get(priv->webSettings.get(), "zoom-step", &zoomMultiplierRatio, NULL); webkit_web_view_set_zoom_level(webView, webkit_web_view_get_zoom_level(webView) - zoomMultiplierRatio); } @@ -4196,8 +4123,17 @@ void webkit_web_view_set_full_content_zoom(WebKitWebView* webView, gboolean zoom if (priv->zoomFullContent == zoomFullContent) return; + Frame* frame = core(webView)->mainFrame(); + if (!frame) + return; + + gfloat zoomLevel = priv->zoomFullContent ? frame->pageZoomFactor() : frame->textZoomFactor(); + priv->zoomFullContent = zoomFullContent; - webkit_web_view_apply_zoom_level(webView, webkit_web_view_get_zoom_level(webView)); + if (priv->zoomFullContent) + frame->setPageAndTextZoomFactors(zoomLevel, 1); + else + frame->setPageAndTextZoomFactors(1, zoomLevel); g_object_notify(G_OBJECT(webView), "full-content-zoom"); } @@ -4246,16 +4182,11 @@ gdouble webkit_web_view_get_progress(WebKitWebView* webView) const gchar* webkit_web_view_get_encoding(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - String encoding = core(webView)->mainFrame()->loader()->writer()->encoding(); - - if (!encoding.isEmpty()) { - WebKitWebViewPrivate* priv = webView->priv; - g_free(priv->encoding); - priv->encoding = g_strdup(encoding.utf8().data()); - return priv->encoding; - } else - return NULL; + if (encoding.isEmpty()) + return 0; + webView->priv->encoding = encoding.utf8(); + return webView->priv->encoding.data(); } /** @@ -4289,16 +4220,11 @@ void webkit_web_view_set_custom_encoding(WebKitWebView* webView, const char* enc const char* webkit_web_view_get_custom_encoding(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - String overrideEncoding = core(webView)->mainFrame()->loader()->documentLoader()->overrideEncoding(); - - if (!overrideEncoding.isEmpty()) { - WebKitWebViewPrivate* priv = webView->priv; - g_free (priv->customEncoding); - priv->customEncoding = g_strdup(overrideEncoding.utf8().data()); - return priv->customEncoding; - } else - return NULL; + if (overrideEncoding.isEmpty()) + return 0; + webView->priv->customEncoding = overrideEncoding.utf8(); + return webView->priv->customEncoding.data(); } /** @@ -4520,27 +4446,26 @@ void webkit_web_view_add_resource(WebKitWebView* webView, const char* identifier WebKitWebViewPrivate* priv = webView->priv; if (!priv->mainResource) { - priv->mainResource = webResource; - priv->mainResourceIdentifier = g_strdup(identifier); + priv->mainResource = adoptPlatformRef(webResource); + priv->mainResourceIdentifier = identifier; return; } - g_hash_table_insert(priv->subResources, g_strdup(identifier), webResource); + g_hash_table_insert(priv->subResources.get(), g_strdup(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); + gpointer webResource = 0; + gboolean resourceFound = g_hash_table_lookup_extended(priv->subResources.get(), identifier, NULL, &webResource); // The only resource we do not store in this hash table is the // main! If we did not find a request, it probably means the load // has been interrupted while while a resource was still being // loaded. - if (!resourceFound && !g_str_equal(identifier, priv->mainResourceIdentifier)) - return NULL; + if (!resourceFound && !g_str_equal(identifier, priv->mainResourceIdentifier.data())) + return 0; if (!webResource) return webkit_web_view_get_main_resource(webView); @@ -4550,30 +4475,24 @@ WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* id WebKitWebResource* webkit_web_view_get_main_resource(WebKitWebView* webView) { - return webView->priv->mainResource; + return webView->priv->mainResource.get(); } 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; - } + priv->mainResourceIdentifier = ""; + priv->mainResource = 0; if (priv->subResources) - g_hash_table_remove_all(priv->subResources); + g_hash_table_remove_all(priv->subResources.get()); } 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); + GList* subResources = g_hash_table_get_values(priv->subResources.get()); + return g_list_remove(subResources, priv->mainResource.get()); } /* From EventHandler.cpp */ @@ -4589,12 +4508,11 @@ void webkit_web_view_set_tooltip_text(WebKitWebView* webView, const char* toolti { #if GTK_CHECK_VERSION(2, 12, 0) WebKitWebViewPrivate* priv = webView->priv; - g_free(priv->tooltipText); if (tooltip && *tooltip != '\0') { - priv->tooltipText = g_strdup(tooltip); + priv->tooltipText = tooltip; gtk_widget_set_has_tooltip(GTK_WIDGET(webView), TRUE); } else { - priv->tooltipText = 0; + priv->tooltipText = ""; gtk_widget_set_has_tooltip(GTK_WIDGET(webView), FALSE); } @@ -4646,15 +4564,10 @@ WebKitHitTestResult* webkit_web_view_get_hit_test_result(WebKitWebView* webView, */ G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView) { - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - - Page* corePage = core(webView); - String iconURL = iconDatabase()->iconURLForPageURL(corePage->mainFrame()->loader()->url().prettyURL()); - - WebKitWebViewPrivate* priv = webView->priv; - g_free(priv->iconURI); - priv->iconURI = g_strdup(iconURL.utf8().data()); - return priv->iconURI; + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); + String iconURL = iconDatabase()->iconURLForPageURL(core(webView)->mainFrame()->loader()->url().prettyURL()); + webView->priv->iconURI = iconURL.utf8(); + return webView->priv->iconURI.data(); } /** @@ -4805,3 +4718,17 @@ gboolean webkit_web_view_is_command_enabled(WebKitWebView* webView, const gchar* return core(webView)->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled(); } + +GtkMenu* webkit_web_view_get_context_menu(WebKitWebView* webView) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); + +#if ENABLE(CONTEXT_MENUS) + ContextMenu* menu = core(webView)->contextMenuController()->contextMenu(); + if (!menu) + return 0; + return menu->platformDescription(); +#else + return 0; +#endif +} diff --git a/WebKit/haiku/ChangeLog b/WebKit/haiku/ChangeLog index 986b00f..718c4c3 100644 --- a/WebKit/haiku/ChangeLog +++ b/WebKit/haiku/ChangeLog @@ -1,3 +1,45 @@ +2010-09-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Paste should be implemented in WebCore like Copy and Cut for Mac also. + https://bugs.webkit.org/show_bug.cgi?id=45494 + <rdar://problem/7660537> + + On the Mac platform, the implementation of the paste operation is all done + at the WebKit level. In order to support it on WebKit2 it is necessary to + refactor the code and move this functionality at the level of WebCore like + we already have on Windows. + The original code relies on some in AppKit functions that call back into + WebKit causing problems in WebKit2. All this functionality has been moved + at the level of the editor client where it can be dealt with appropriately. + + * WebCoreSupport/FrameLoaderClientHaiku.cpp: + (WebCore::FrameLoaderClientHaiku::canShowMIMETypeAsHTML): Added stub. + * WebCoreSupport/FrameLoaderClientHaiku.h: + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Move code from WebKit-layer to DocumentLoader + https://bugs.webkit.org/show_bug.cgi?id=45569 + + * WebCoreSupport/FrameLoaderClientHaiku.cpp: + (WebCore::FrameLoaderClientHaiku::committedLoad): + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Main resource bytes shouldn't bounce through FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=45496 + + Now return the bytes to the DocumentLoader. + + * WebCoreSupport/FrameLoaderClientHaiku.cpp: + (WebCore::FrameLoaderClientHaiku::committedLoad): + 2010-08-06 Gavin Barraclough <barraclough@apple.com> Rubber stamped by Sam Weinig diff --git a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp index 430194a..705a333 100644 --- a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp +++ b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp @@ -361,6 +361,12 @@ void FrameLoaderClientHaiku::finishedLoading(DocumentLoader*) notImplemented(); } +bool FrameLoaderClientHaiku::canShowMIMETypeAsHTML(const String& MIMEType) const +{ + notImplemented(); + return false; +} + bool FrameLoaderClientHaiku::canShowMIMEType(const String& MIMEType) const { notImplemented(); @@ -506,12 +512,7 @@ void FrameLoaderClientHaiku::setMainDocumentError(WebCore::DocumentLoader*, cons void FrameLoaderClientHaiku::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) { - if (!m_frame) - return; - - FrameLoader* frameLoader = loader->frameLoader(); - frameLoader->writer()->setEncoding(m_response.textEncodingName(), false); - frameLoader->addData(data, length); + loader->commitData(data, length); } WebCore::ResourceError FrameLoaderClientHaiku::cancelledError(const WebCore::ResourceRequest& request) diff --git a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h index dfe5747..eafbfc3 100644 --- a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h +++ b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h @@ -130,6 +130,7 @@ namespace WebCore { virtual void finishedLoading(DocumentLoader*); virtual bool canShowMIMEType(const String& MIMEType) const; + virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const; virtual bool representationExistsForURLScheme(const String& URLScheme) const; virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const; diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index df5ca46..a43b4c5 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,444 @@ +2010-09-20 Andy Estes <aestes@apple.com> + + Reviewed by Adam Barth. + + REGRESSION (HTML5 Parser): Pages broken due to <tag<tag> parsing changes + https://bugs.webkit.org/show_bug.cgi?id=40961 + + Implement WebKitUsePreHTML5ParserQuirks preference. + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): Default WebKitUsePreHTML5ParserQuirks to + false. + (-[WebPreferences usePreHTML5ParserQuirks]): + (-[WebPreferences setUsePreHTML5ParserQuirks:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): Update WebCore::Settings + with the value of WebKitUsePreHTML5ParserQuirks when a preference + changes. + +2010-09-20 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Pasteboard doesn't work in WebKit2. + https://bugs.webkit.org/show_bug.cgi?id=42317 + <rdar://problem/7660537> + + Some changes to fix style inconsistencies. + Added OBJC 2.0 style enumeration. + + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::userVisibleString): + (createExcludedElementsForAttributedStringConversion): + (WebEditorClient::documentFragmentFromAttributedString): Changed parameter to be + a Vector of RefPtr. + (WebEditorClient::setInsertionPasteboard): + (WebEditorClient::pasteboardTypesForSelection): + +2010-09-17 David Hyatt <hyatt@apple.com> + + Reviewed by Simon Fraser. + + https://bugs.webkit.org/show_bug.cgi?id=45993, convert printing to the new pagination model. + + Make printing store the page height in the RenderView and push that into the layout state to + use the new pagination model. The old pagination model is retained because it is still used + for embedded WebViews. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _adjustedBottomOfPageWithTop:bottom:limit:]): + +2010-09-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (r60104): Zoom level is unexpectedly reset on page reload + https://bugs.webkit.org/show_bug.cgi?id=42863 + + * WebView/WebView.mm: + (-[WebView _setZoomMultiplier:isTextOnly:]): + Call functions on Frame instead of FrameView. + +2010-09-17 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Simon Fraser. + + Reduce minimum DOMTimer interval + https://bugs.webkit.org/show_bug.cgi?id=45362 + + * WebView/WebView.mm: Added in a call to set the mimimum allowed DOMTimer to 4ms. + +2010-09-17 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + Add WebKitAccelerated2dCanvasEnabled flag to WebKit for Mac + https://bugs.webkit.org/show_bug.cgi?id=45911 + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences accelerated2dCanvasEnabled]): + (-[WebPreferences setAccelerated2dCanvasEnabled:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-09-17 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + WebKit should use system wide spell checking preference when application specific one isn't set. + https://bugs.webkit.org/show_bug.cgi?id=45789 + <rdar://problem/8416041> + + * WebView/WebView.mm: + (+[WebView initialize]): Use system wide autocorrection and text substitution preferences + when the application level preferences are not set. + +2010-09-16 John Sullivan <sullivan@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8395558> + https://bugs.webkit.org/show_bug.cgi?id=45938 + _web_makePluginViewsPerformSelector:: mutates subviews array while iterating it + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _web_makePluginSubviewsPerformSelector:withObject:]): + Converted from -[NSArray _web_makePluginViewsPerformSelector:withObject:]. The old method + was only ever called on the result of -[WebHTMLView subviews]. By moving that knowledge into + this helper method, it can't be used incorrectly. Now it makes a copy of [WebHTMLView subviews] + before enumerating it, to ensure that the selector can't mutate the array being enumerated. + (-[WebHTMLView viewWillMoveToHostWindow:]): + Updated for _web_makePluginSubviewsPerformSelector:: signature change. + (-[WebHTMLView viewDidMoveToHostWindow]): + Ditto. + +2010-09-16 Darin Adler <darin@apple.com> + + Reviewed by Andreas Kling. + + Reduce use of HTMLInputElement::inputType so we can remove it later + https://bugs.webkit.org/show_bug.cgi?id=45903 + + * WebView/WebHTMLRepresentation.mm: + (-[WebHTMLRepresentation elementDoesAutoComplete:]): Use isPasswordField. + (-[WebHTMLRepresentation elementIsPassword:]): Use isPasswordField. + +2010-09-16 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Darin Adler. + + Always use a valid string when setting WebKitUserStyleSheetLocationPreferenceKey. + https://bugs.webkit.org/show_bug.cgi?id=41510 + + This prevents usage of nil value, which would cause an uncaught exception. + + * WebView/WebPreferences.mm: + (-[WebPreferences setUserStyleSheetLocation:]): + +2010-09-16 Dan Bernstein <mitz@apple.com> + + Reverted the previous change because r67628 has been reverted. + + * WebCoreSupport/WebPlatformStrategies.h: + * WebCoreSupport/WebPlatformStrategies.mm: + +2010-09-16 Dan Bernstein <mitz@apple.com> + + Build fix after r67628. Added context menu item localizable strings for the items + added in r67628, following equivalent menu items in Mac OS X when possible. However, + this set of menu items does not make much sense for Mac OS X, and this should be + addressed separately. + + * WebCoreSupport/WebPlatformStrategies.h: + * WebCoreSupport/WebPlatformStrategies.mm: + (WebPlatformStrategies::contextMenuItemTagOpenMediaInNewWindow): + (WebPlatformStrategies::contextMenuItemTagCopyMediaLinkToClipboard): + (WebPlatformStrategies::contextMenuItemTagToggleMediaControls): + (WebPlatformStrategies::contextMenuItemTagToggleMediaLoop): + (WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen): + (WebPlatformStrategies::contextMenuItemTagMediaPlay): + (WebPlatformStrategies::contextMenuItemTagMediaPause): + (WebPlatformStrategies::contextMenuItemTagMediaMute): + (WebPlatformStrategies::contextMenuItemTagMediaUnMute): + +2010-09-16 Eric Uhrhane <ericu@chromium.org> + + Reviewed by Jian Li. + + Unify FILE_SYSTEM and FILE_WRITER enables under the name FILE_SYSTEM. + https://bugs.webkit.org/show_bug.cgi?id=45798 + + * Configurations/FeatureDefines.xcconfig: + +2010-09-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Adam Roben. + + https://bugs.webkit.org/show_bug.cgi?id=44715 + maps.google.com flips upside down when zooming map using trackpad in WebKit2 on Mac + + Move geometry flipping to platform-specific code. + + * WebView/WebHTMLView.mm: + (-[WebHTMLView attachRootLayer:]): + +2010-09-14 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + Only intercept ESC key press when autocorrection UI is visible. + https://bugs.webkit.org/show_bug.cgi?id=45071 + + * WebCoreSupport/WebEditorClient.h: Added declaration of isShowingCorrectionPanel(), + which provides an inteface to query whether autocorrection panel is shown. + + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::WebEditorClient): Defined a constant, InvalidCorrectionPanelTag, + for invalid correction panel tag. Replaced -1 with this constant. + (WebEditorClient::dismissCorrectionPanel): Ditto + (WebEditorClient::isShowingCorrectionPanel): Query whether autocorrection panel is shown. + +2010-09-14 Mark Rowe <mrowe@apple.com> + + Reviewed by John Sullivan. + + Part of <rdar://problem/8420003>. Make it possible to override the version number used in linked-in-or-after checks. + + * Misc/WebKitVersionChecks.h: Remove two unused functions from the header and add a method to set the overriden version. + * Misc/WebKitVersionChecks.m: + (WebKitLinkedOnOrAfter): + (setWebKitLinkTimeVersion): Set the overridden version. + (WebKitLinkTimeVersion): Return the overridden version if set, otherwise do the old thing. + * WebView/WebPreferences.mm: + (+[WebPreferences setWebKitLinkTimeVersion:]): Call through to set the overridden version. + * WebView/WebPreferencesPrivate.h: + +2010-09-14 Eric Seidel <eric@webkit.org> + + Unreviewed, reverting changes r67451 and r67451. + Broke lots of builders. + + Only intercept ESC key press when autocorrection UI is visible. + https://bugs.webkit.org/show_bug.cgi?id=45071 + + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::WebEditorClient): + (WebEditorClient::dismissCorrectionPanel): + +2010-09-14 Jia Pu <jpu@apple.com> + + Reviewed by Dan Bernstein. + + Only intercept ESC key press when autocorrection UI is visible. + https://bugs.webkit.org/show_bug.cgi?id=45071 + + * WebCoreSupport/WebEditorClient.h: Added declaration of isShowingCorrectionPanel(), + which provides an inteface to query whether autocorrection panel is shown. + + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::WebEditorClient): Defined a constant, InvalidCorrectionPanelTag, + for invalid correction panel tag. Replaced -1 with this constant. + (WebEditorClient::dismissCorrectionPanel): Ditto + (WebEditorClient::isShowingCorrectionPanel): Query whether autocorrection panel is shown. + +2010-09-13 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Preparation for eliminating deprecatedParseURL + https://bugs.webkit.org/show_bug.cgi?id=45695 + + * DOM/WebDOMOperations.mm: + (-[DOMDocument webFrame]): Get rid of unneeded local variable. + (-[DOMDocument URLWithAttributeString:]): Remove unhelpful comment. + +2010-09-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Paste should be implemented in WebCore like Copy and Cut for Mac also. + https://bugs.webkit.org/show_bug.cgi?id=45494 + <rdar://problem/7660537> + + On the Mac platform, the implementation of the paste operation is all done + at the WebKit level. In order to support it on WebKit2 it is necessary to + refactor the code and move this functionality at the level of WebCore like + we already have on Windows. + The original code relies on some in AppKit functions that call back into + WebKit causing problems in WebKit2. All this functionality has been moved + at the level of the editor client where it can be dealt with appropriately. + + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + (excludedElementsForAttributedStringConversion): + (WebEditorClient::documentFragmentFromAttributedString): Added. + (WebEditorClient::setInsertionPasteboard): + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::canShowMIMETypeAsHTML): Re-implemented at the level + of the editor client. + * WebView/WebHTMLView.mm: Removed paste method. + +2010-09-13 John Sullivan <sullivan@apple.com> + + Reviewed by Adam Roben. + + https://bugs.webkit.org/show_bug.cgi?id=45677 + [WebView canMarkAllTextMatches] can crash if called after [WebView close] + + <rdar://problem/8404890> + + * WebView/WebView.mm: + (-[WebView canMarkAllTextMatches]): + Return NO immediately if the webview has already been closed. This was an overlooked + case from the fix for 45175. + +2010-09-10 MORITA Hajime <morrita@google.com> + + Reviewed by Tony Chang. + + [Chromium] Implement textInputController.hasSpellingMarker() for Chromium + https://bugs.webkit.org/show_bug.cgi?id=45441 + + Moved the actual logic of hasSpellingMarker into WebCore to share + it with other ports. + + * WebView/WebFrame.mm: + (-[WebFrame hasSpellingMarker:length:]): + +2010-09-11 Adam Barth <abarth@webkit.org> + + Reviewed by Sam Weinig. + + Make SecurityOrigin::canDisplay an instance function + https://bugs.webkit.org/show_bug.cgi?id=45219 + + * Plugins/Hosted/NetscapePluginInstanceProxy.mm: + (WebKit::NetscapePluginInstanceProxy::loadRequest): + * Plugins/WebNetscapePluginStream.mm: + (WebNetscapePluginStream::WebNetscapePluginStream): + * Plugins/WebNetscapePluginView.mm: + (-[WebNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]): + * Plugins/WebPluginContainerCheck.mm: + (-[WebPluginContainerCheck _isForbiddenFileLoad]): + * WebView/WebFrame.mm: + (-[WebFrame _allowsFollowingLink:]): + +2010-09-10 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Remove unnecessary constraint in WebCore of choosing either text zoom or full page zoom. + Precursor to <rdar://problem/7660657> + https://bugs.webkit.org/show_bug.cgi?id=45522 + + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + (-[WebView _setZoomMultiplier:isTextOnly:]): + (-[WebView _realZoomMultiplierIsTextOnly]): + * WebView/WebViewData.h: + * WebView/WebViewData.mm: + (-[WebViewPrivate init]): + Move tracking of text only zoom here from WebCore. + +2010-09-10 Stephanie Lewis <slewis@apple.com> + + Reviewed by Alexey Proskuryakov. + + Refactor JavaScriptCore memory statistics so that WebKit doesn't need to know about the JIT and + other implementation details of JavaScriptCore. Necessary to fix PPC build. + + https://bugs.webkit.org/show_bug.cgi?id=45528 + + * Misc/WebCoreStatistics.mm: + (+[WebCoreStatistics memoryStatistics]): + +2010-09-10 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Move some Dashboard stuff from WebCore to WebKit along with a bit more FrameMac cleanup + https://bugs.webkit.org/show_bug.cgi?id=45582 + + * MigrateHeaders.make: Removed WebDashboardRegion.h from the set of header to copy. + + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::dashboardRegionsChanged): Changed this to call + -[WebView _dashboardRegions] so we don't have two copies of that code. + + * WebView/WebDashboardRegion.h: Copied from WebCore/page/mac/WebDashboardRegion.h. + * WebView/WebDashboardRegion.mm: Copied from WebCore/page/mac/WebDashboardRegion.m. + + * WebView/WebView.mm: + (-[WebView _dashboardRegions]): Moved the code from Frame::dashboardRegions here. + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Move code from WebKit-layer to DocumentLoader + https://bugs.webkit.org/show_bug.cgi?id=45569 + + This code is the most confused, but now should be a bit cleaner. + There's still a magical fake-setting for creating renderers that needs + to be cleaned up, but we can do that in a separate patch. + + * WebView/WebFrame.mm: + (-[WebFrame _commitData:]): + * WebView/WebFrameInternal.h: + * WebView/WebHTMLRepresentation.mm: + (-[WebHTMLRepresentation receivedData:withDataSource:]): + (-[WebHTMLRepresentation finishedLoadingWithDataSource:]): + +2010-09-09 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to SelectionController as planned + https://bugs.webkit.org/show_bug.cgi?id=45508 + + * WebView/WebFrame.mm: + (-[WebFrame _selectionGranularity]): + (-[WebFrame _insertParagraphSeparatorInQuotedContent]): + (-[WebFrame _typingStyle]): + (-[WebFrame _replaceSelectionWithFragment:selectReplacement:smartReplace:matchStyle:]): + * WebView/WebHTMLRepresentation.mm: + (-[WebHTMLRepresentation currentForm]): + * WebView/WebHTMLView.mm: + (-[WebHTMLView jumpToSelection:]): + (-[WebHTMLView centerSelectionInVisibleArea:]): + (-[WebHTMLView _canSmartCopyOrDelete]): + (-[WebHTMLView _lookUpInDictionaryFromMenu:]): + (-[WebHTMLView selectionRect]): + (-[WebHTMLView selectionTextRects]): + (-[WebHTMLView selectionImageRect]): + * WebView/WebView.mm: + (-[WebView setEditable:]): + Call functions on selection(). + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Main resource bytes shouldn't bounce through FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=45496 + + Now return the bytes to the DocumentLoader. + + Previously, we were checking the document for null. However, Frame can + never have a null document, so this check is no longer needed. + + * WebView/WebFrame.mm: + (-[WebFrame _addData:]): + 2010-09-09 John Therrell <jtherrell@apple.com> Reviewed by Alexey Proskuryakov. diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index 8f8c213..81d912f 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -69,7 +69,6 @@ ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; ENABLE_FILTERS = $(ENABLE_FILTERS_$(REAL_PLATFORM_NAME)); ENABLE_FILTERS_macosx = ENABLE_FILTERS; -ENABLE_FILE_WRITER = ; ENABLE_FILE_SYSTEM = ; ENABLE_FULLSCREEN_API = ENABLE_FULLSCREEN_API; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; @@ -121,4 +120,4 @@ ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_WRITER) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_LINK_PREFETCH) $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_SYSTEM) $(ENABLE_FULLSCREEN_API) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_IMAGE_RESIZER) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_SPEECH) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_METER_TAG) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index 9f9441c..67bf769 100644 --- a/WebKit/mac/Configurations/Version.xcconfig +++ b/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 8; +MINOR_VERSION = 9; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebKit/mac/DOM/WebDOMOperations.mm b/WebKit/mac/DOM/WebDOMOperations.mm index d21f2b0..3d69836 100644 --- a/WebKit/mac/DOM/WebDOMOperations.mm +++ b/WebKit/mac/DOM/WebDOMOperations.mm @@ -121,8 +121,7 @@ using namespace JSC; - (WebFrame *)webFrame { - Document* document = core(self); - Frame* frame = document->frame(); + Frame* frame = core(self)->frame(); if (!frame) return nil; return kit(frame); @@ -130,7 +129,6 @@ using namespace JSC; - (NSURL *)URLWithAttributeString:(NSString *)string { - // FIXME: Is deprecatedParseURL appropriate here? return core(self)->completeURL(deprecatedParseURL(string)); } diff --git a/WebKit/mac/MigrateHeaders.make b/WebKit/mac/MigrateHeaders.make index 83e2e08..2e6f24a 100644 --- a/WebKit/mac/MigrateHeaders.make +++ b/WebKit/mac/MigrateHeaders.make @@ -180,7 +180,6 @@ all : \ $(PUBLIC_HEADERS_DIR)/DOMXPathExpression.h \ $(PUBLIC_HEADERS_DIR)/DOMXPathNSResolver.h \ $(PUBLIC_HEADERS_DIR)/DOMXPathResult.h \ - $(PRIVATE_HEADERS_DIR)/WebDashboardRegion.h \ $(PUBLIC_HEADERS_DIR)/WebScriptObject.h \ $(PUBLIC_HEADERS_DIR)/npapi.h \ $(PUBLIC_HEADERS_DIR)/npfunctions.h \ diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm index cc68cef..5b5a1bc 100644 --- a/WebKit/mac/Misc/WebCoreStatistics.mm +++ b/WebKit/mac/Misc/WebCoreStatistics.mm @@ -29,11 +29,10 @@ #import "WebCoreStatistics.h" #import "DOMElementInternal.h" -#import <JavaScriptCore/RegisterFile.h> -#import <JavaScriptCore/ExecutableAllocator.h> #import "WebCache.h" #import "WebFrameInternal.h" -#import <runtime/JSLock.h> +#import <JavaScriptCore/JSLock.h> +#import <JavaScriptCore/MemoryStatistics.h> #import <WebCore/Console.h> #import <WebCore/FontCache.h> #import <WebCore/Frame.h> @@ -196,18 +195,19 @@ using namespace WebCore; + (NSDictionary *)memoryStatistics { WTF::FastMallocStatistics fastMallocStatistics = WTF::fastMallocStatistics(); + JSLock lock(SilenceAssertionsOnly); - Heap::Statistics jsHeapStatistics = JSDOMWindow::commonJSGlobalData()->heap.statistics(); - size_t jscStackBytes = RegisterFile::committedByteCount(); - size_t jscJITBytes = ExecutableAllocator::committedByteCount(); + Heap::Statistics heapMemoryStats = heapStatistics(JSDOMWindow::commonJSGlobalData()); + GlobalMemoryStatistics globalMemoryStats = globalMemoryStatistics(); + return [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:fastMallocStatistics.reservedVMBytes], @"FastMallocReservedVMBytes", [NSNumber numberWithInt:fastMallocStatistics.committedVMBytes], @"FastMallocCommittedVMBytes", [NSNumber numberWithInt:fastMallocStatistics.freeListBytes], @"FastMallocFreeListBytes", - [NSNumber numberWithInt:jsHeapStatistics.size], @"JavaScriptHeapSize", - [NSNumber numberWithInt:jsHeapStatistics.free], @"JavaScriptFreeSize", - [NSNumber numberWithUnsignedInt:(unsigned int)jscStackBytes], @"JavaScriptStackSize", - [NSNumber numberWithUnsignedInt:(unsigned int)jscJITBytes], @"JavaScriptJITSize", + [NSNumber numberWithInt:heapMemoryStats.size], @"JavaScriptHeapSize", + [NSNumber numberWithInt:heapMemoryStats.free], @"JavaScriptFreeSize", + [NSNumber numberWithUnsignedInt:(unsigned int)globalMemoryStats.stackBytes], @"JavaScriptStackSize", + [NSNumber numberWithUnsignedInt:(unsigned int)globalMemoryStats.JITBytes], @"JavaScriptJITSize", nil]; } diff --git a/WebKit/mac/Misc/WebKitVersionChecks.h b/WebKit/mac/Misc/WebKitVersionChecks.h index 8b34c94..94286d6 100644 --- a/WebKit/mac/Misc/WebKitVersionChecks.h +++ b/WebKit/mac/Misc/WebKitVersionChecks.h @@ -30,9 +30,9 @@ Version numbers are based on the 'current library version' specified in the WebKit build rules. All of these methods return or take version numbers with each part shifted to the left 2 bytes. For example the version 1.2.3 is returned as 0x00010203 and version 200.3.5 is returned as 0x00C80305 - A version of -1 is returned if the main executable did not link against WebKit (should never happen). + A version of -1 is returned if the main executable did not link against WebKit. - Please use the current WebKit version number, available in WebKit/Configurations/Version.xcconfig, + Please use the current WebKit version number, available in WebKit/mac/Configurations/Version.xcconfig, when adding a new version constant. */ @@ -60,8 +60,7 @@ extern "C" { #endif BOOL WebKitLinkedOnOrAfter(int version); -int WebKitLinkTimeVersion(void); -int WebKitRunTimeVersion(void); +void setWebKitLinkTimeVersion(int); #ifdef __cplusplus } diff --git a/WebKit/mac/Misc/WebKitVersionChecks.m b/WebKit/mac/Misc/WebKitVersionChecks.m index 5659273..a63e10b 100644 --- a/WebKit/mac/Misc/WebKitVersionChecks.m +++ b/WebKit/mac/Misc/WebKitVersionChecks.m @@ -29,17 +29,23 @@ #import "WebKitVersionChecks.h" #import <mach-o/dyld.h> +static int WebKitLinkTimeVersion(void); +static int overridenWebKitLinkTimeVersion; + BOOL WebKitLinkedOnOrAfter(int version) { - return (WebKitLinkTimeVersion() >= version); + return (WebKitLinkTimeVersion() >= version); } -int WebKitLinkTimeVersion(void) +void setWebKitLinkTimeVersion(int version) { - return NSVersionOfLinkTimeLibrary("WebKit"); + overridenWebKitLinkTimeVersion = version; } -int WebKitRunTimeVersion(void) +static int WebKitLinkTimeVersion(void) { - return NSVersionOfRunTimeLibrary("WebKit"); + if (overridenWebKitLinkTimeVersion) + return overridenWebKitLinkTimeVersion; + + return NSVersionOfLinkTimeLibrary("WebKit"); } diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm index 88df4cf..c0c480b 100644 --- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm +++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm @@ -762,7 +762,7 @@ NPError NetscapePluginInstanceProxy::loadRequest(NSURLRequest *request, const ch return NPERR_GENERIC_ERROR; } } else { - if (!SecurityOrigin::canDisplay(URL, String(), core([m_pluginView webFrame])->document())) + if (!core([m_pluginView webFrame])->document()->securityOrigin()->canDisplay(URL)) return NPERR_GENERIC_ERROR; } diff --git a/WebKit/mac/Plugins/WebNetscapePluginStream.mm b/WebKit/mac/Plugins/WebNetscapePluginStream.mm index 35af439..f39b104 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginStream.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginStream.mm @@ -161,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(SecurityOrigin::canDisplay([request URL], String(), core([view webFrame])->document())); + ASSERT(core([view webFrame])->document()->securityOrigin()->canDisplay([request URL])); ASSERT([request URL]); ASSERT(plugin); diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm index e98c6b7..3d5d7a1 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -1728,7 +1728,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) return NPERR_INVALID_PARAM; } } else { - if (!SecurityOrigin::canDisplay(URL, String(), core([self webFrame])->document())) + if (!core([self webFrame])->document()->securityOrigin()->canDisplay(URL)) return NPERR_GENERIC_ERROR; } diff --git a/WebKit/mac/Plugins/WebPluginContainerCheck.mm b/WebKit/mac/Plugins/WebPluginContainerCheck.mm index e273bfc..30368a8 100644 --- a/WebKit/mac/Plugins/WebPluginContainerCheck.mm +++ b/WebKit/mac/Plugins/WebPluginContainerCheck.mm @@ -99,7 +99,7 @@ using namespace WebCore; { Frame* coreFrame = core([_controller webFrame]); ASSERT(coreFrame); - if (!SecurityOrigin::canDisplay([_request URL], String(), coreFrame->document())) { + if (!coreFrame->document()->securityOrigin()->canDisplay([_request URL])) { [self _continueWithPolicy:PolicyIgnore]; return YES; } diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm index d973e2b..68e17be 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -71,8 +71,6 @@ #import <wtf/PassRefPtr.h> #import <wtf/Vector.h> - - #if USE(ACCELERATED_COMPOSITING) #import <WebCore/GraphicsLayer.h> #endif @@ -111,6 +109,7 @@ using namespace WebCore; @end #if ENABLE(FULLSCREEN_API) + @interface WebKitFullScreenListener : NSObject <WebKitFullScreenListener> { RefPtr<Element> _element; @@ -118,6 +117,7 @@ using namespace WebCore; - (id)initWithElement:(Element*)element; @end + #endif WebChromeClient::WebChromeClient(WebView *webView) @@ -564,6 +564,7 @@ void WebChromeClient::print(Frame* frame) } #if ENABLE(DATABASE) + void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName) { BEGIN_BLOCK_OBJC_EXCEPTIONS; @@ -579,9 +580,11 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database END_BLOCK_OBJC_EXCEPTIONS; } + #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) + void WebChromeClient::reachedMaxAppCacheSize(int64_t spaceNeeded) { // FIXME: Free some space. @@ -597,6 +600,7 @@ void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin* origin) END_BLOCK_OBJC_EXCEPTIONS; } + #endif void WebChromeClient::populateVisitedLinks() @@ -616,17 +620,14 @@ void WebChromeClient::populateVisitedLinks() } #if ENABLE(DASHBOARD_SUPPORT) + void WebChromeClient::dashboardRegionsChanged() { BEGIN_BLOCK_OBJC_EXCEPTIONS; - - NSMutableDictionary *regions = core([m_webView mainFrame])->dashboardRegionsDictionary(); - [m_webView _addScrollerDashboardRegions:regions]; - - CallUIDelegate(m_webView, @selector(webView:dashboardRegionsChanged:), regions); - + CallUIDelegate(m_webView, @selector(webView:dashboardRegionsChanged:), [m_webView _dashboardRegions]); END_BLOCK_OBJC_EXCEPTIONS; } + #endif FloatRect WebChromeClient::customHighlightRect(Node* node, const AtomicString& type, const FloatRect& lineRect) @@ -954,7 +955,9 @@ void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geoloca @end #if ENABLE(FULLSCREEN_API) + @implementation WebKitFullScreenListener + - (id)initWithElement:(Element*)element { if (!(self = [super init])) @@ -989,4 +992,5 @@ void WebChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geoloca } @end + #endif diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.h b/WebKit/mac/WebCoreSupport/WebEditorClient.h index fe33e05..ad324b9 100644 --- a/WebKit/mac/WebCoreSupport/WebEditorClient.h +++ b/WebKit/mac/WebCoreSupport/WebEditorClient.h @@ -70,9 +70,11 @@ public: virtual void didWriteSelectionToPasteboard(); virtual void didSetSelectionTypesForPasteboard(); - virtual NSString* userVisibleString(NSURL*); + virtual NSString* userVisibleString(NSURL *); + virtual WebCore::DocumentFragment* documentFragmentFromAttributedString(NSAttributedString *, Vector< RefPtr<WebCore::ArchiveResource> >&); + virtual void setInsertionPasteboard(NSPasteboard *); #ifdef BUILDING_ON_TIGER - virtual NSArray* pasteboardTypesForSelection(WebCore::Frame*); + virtual NSArray *pasteboardTypesForSelection(WebCore::Frame*); #endif #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) @@ -133,6 +135,7 @@ public: #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) virtual void showCorrectionPanel(const WebCore::FloatRect& boundingBoxOfReplacedString, const WTF::String& replacedString, const WTF::String& replacementString, WebCore::Editor*); virtual void dismissCorrectionPanel(bool correctionAccepted); + virtual bool isShowingCorrectionPanel(); #endif private: void registerCommandForUndoOrRedo(PassRefPtr<WebCore::EditCommand>, bool isRedo); diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/WebKit/mac/WebCoreSupport/WebEditorClient.mm index 41cff68..2bf3259 100644 --- a/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -30,6 +30,7 @@ #import "WebEditorClient.h" #import "DOMCSSStyleDeclarationInternal.h" +#import "DOMDocumentFragmentInternal.h" #import "DOMHTMLElementInternal.h" #import "DOMHTMLInputElementInternal.h" #import "DOMHTMLTextAreaElementInternal.h" @@ -48,8 +49,11 @@ #import "WebKitVersionChecks.h" #import "WebLocalizableStrings.h" #import "WebNSURLExtras.h" +#import "WebResourceInternal.h" #import "WebViewInternal.h" +#import <WebCore/ArchiveResource.h> #import <WebCore/Document.h> +#import <WebCore/DocumentFragment.h> #import <WebCore/EditAction.h> #import <WebCore/EditCommand.h> #import <WebCore/HTMLInputElement.h> @@ -73,11 +77,18 @@ using namespace WTF; using namespace HTMLNames; +@interface NSAttributedString (WebNSAttributedStringDetails) +- (id)_initWithDOMRange:(DOMRange*)range; +- (DOMDocumentFragment*)_documentFromRange:(NSRange)range document:(DOMDocument*)document documentAttributes:(NSDictionary *)dict subresources:(NSArray **)subresources; +@end + static WebViewInsertAction kit(EditorInsertAction coreAction) { return static_cast<WebViewInsertAction>(coreAction); } +static const int InvalidCorrectionPanelTag = 0; + #ifdef BUILDING_ON_TIGER @interface NSSpellChecker (NotYetPublicMethods) - (void)learnWord:(NSString *)word; @@ -175,7 +186,7 @@ WebEditorClient::WebEditorClient(WebView *webView) , m_undoTarget([[[WebEditorUndoTarget alloc] init] autorelease]) , m_haveUndoRedoOperations(false) #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) - , m_correctionPanelTag(-1) + , m_correctionPanelTag(InvalidCorrectionPanelTag) #endif { } @@ -325,13 +336,54 @@ void WebEditorClient::didSetSelectionTypesForPasteboard() [[m_webView _editingDelegateForwarder] webView:m_webView didSetSelectionTypesForPasteboard:[NSPasteboard generalPasteboard]]; } -NSString* WebEditorClient::userVisibleString(NSURL *URL) +NSString *WebEditorClient::userVisibleString(NSURL *URL) { return [URL _web_userVisibleString]; } +static NSArray *createExcludedElementsForAttributedStringConversion() +{ + NSArray *elements = [[NSArray alloc] initWithObjects: + // Omit style since we want style to be inline so the fragment can be easily inserted. + @"style", + // Omit xml so the result is not XHTML. + @"xml", + // Omit tags that will get stripped when converted to a fragment anyway. + @"doctype", @"html", @"head", @"body", + // Omit deprecated tags. + @"applet", @"basefont", @"center", @"dir", @"font", @"isindex", @"menu", @"s", @"strike", @"u", + // Omit object so no file attachments are part of the fragment. + @"object", nil]; + CFRetain(elements); + return elements; +} + +DocumentFragment* WebEditorClient::documentFragmentFromAttributedString(NSAttributedString *string, Vector<RefPtr<ArchiveResource> >& resources) +{ + static NSArray *excludedElements = createExcludedElementsForAttributedStringConversion(); + + NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys: excludedElements, NSExcludedElementsDocumentAttribute, + nil, @"WebResourceHandler", nil]; + + NSArray *subResources; + DOMDocumentFragment* fragment = [string _documentFromRange:NSMakeRange(0, [string length]) + document:[[m_webView mainFrame] DOMDocument] + documentAttributes:dictionary + subresources:&subResources]; + for (WebResource* resource in subResources) + resources.append([resource _coreResource]); + + [dictionary release]; + return core(fragment); +} + +void WebEditorClient::setInsertionPasteboard(NSPasteboard *pasteboard) +{ + [m_webView _setInsertionPasteboard:pasteboard]; +} + #ifdef BUILDING_ON_TIGER -NSArray* WebEditorClient::pasteboardTypesForSelection(Frame* selectedFrame) +NSArray *WebEditorClient::pasteboardTypesForSelection(Frame* selectedFrame) { WebFrame* frame = kit(selectedFrame); return [[[frame frameView] documentView] pasteboardTypesForSelection]; @@ -829,11 +881,16 @@ void WebEditorClient::showCorrectionPanel(const FloatRect& boundingBoxOfReplaced void WebEditorClient::dismissCorrectionPanel(bool correctionAccepted) { - if (m_correctionPanelTag >= 0) { + if (m_correctionPanelTag != InvalidCorrectionPanelTag) { [[NSSpellChecker sharedSpellChecker] dismissCorrection:m_correctionPanelTag acceptCorrection:correctionAccepted]; - m_correctionPanelTag = -1; + m_correctionPanelTag = InvalidCorrectionPanelTag; } } + +bool WebEditorClient::isShowingCorrectionPanel() +{ + return m_correctionPanelTag != InvalidCorrectionPanelTag; +} #endif void WebEditorClient::updateSpellingUIWithMisspelledWord(const String& misspelledWord) diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index cbb89ec..447c515 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -177,6 +177,7 @@ private: virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; virtual bool canShowMIMEType(const WTF::String& MIMEType) const; + virtual bool canShowMIMETypeAsHTML(const WTF::String& MIMEType) const; virtual bool representationExistsForURLScheme(const WTF::String& URLScheme) const; virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String& URLScheme) const; diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index dcbca28..a398ef7 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -1018,6 +1018,11 @@ bool WebFrameLoaderClient::canShowMIMEType(const String& MIMEType) const return [getWebView(m_webFrame.get()) _canShowMIMEType:MIMEType]; } +bool WebFrameLoaderClient::canShowMIMETypeAsHTML(const String& MIMEType) const +{ + return [WebView canShowMIMETypeAsHTML:MIMEType]; +} + bool WebFrameLoaderClient::representationExistsForURLScheme(const String& URLScheme) const { return [WebView _representationExistsForURLScheme:URLScheme]; diff --git a/WebKit/mac/WebView/WebDashboardRegion.h b/WebKit/mac/WebView/WebDashboardRegion.h new file mode 100644 index 0000000..4963d04 --- /dev/null +++ b/WebKit/mac/WebView/WebDashboardRegion.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if !defined(ENABLE_DASHBOARD_SUPPORT) +#define ENABLE_DASHBOARD_SUPPORT 1 +#endif + +#if ENABLE_DASHBOARD_SUPPORT + +typedef enum { + WebDashboardRegionTypeNone, + WebDashboardRegionTypeCircle, + WebDashboardRegionTypeRectangle, + WebDashboardRegionTypeScrollerRectangle +} WebDashboardRegionType; + +@interface WebDashboardRegion : NSObject <NSCopying> +{ + NSRect rect; + NSRect clip; + WebDashboardRegionType type; +} +- initWithRect:(NSRect)rect clip:(NSRect)clip type:(WebDashboardRegionType)type; +- (NSRect)dashboardRegionClip; +- (NSRect)dashboardRegionRect; +- (WebDashboardRegionType)dashboardRegionType; +@end + +#endif diff --git a/WebKit/mac/WebView/WebDashboardRegion.mm b/WebKit/mac/WebView/WebDashboardRegion.mm new file mode 100644 index 0000000..c44977a --- /dev/null +++ b/WebKit/mac/WebView/WebDashboardRegion.mm @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2004 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 "WebDashboardRegion.h" + +#import <wtf/UnusedParam.h> + +#if ENABLE(DASHBOARD_SUPPORT) + +@implementation WebDashboardRegion + +- initWithRect:(NSRect)r clip:(NSRect)c type:(WebDashboardRegionType)t +{ + self = [super init]; + rect = r; + clip = c; + type = t; + return self; +} + +- (id)copyWithZone:(NSZone *)unusedZone +{ + UNUSED_PARAM(unusedZone); + + return [self retain]; +} + +- (NSRect)dashboardRegionClip +{ + return clip; +} + +- (NSRect)dashboardRegionRect +{ + return rect; +} + +- (WebDashboardRegionType)dashboardRegionType +{ + return type; +} + +static const char* typeName(WebDashboardRegionType type) +{ + switch (type) { + case WebDashboardRegionTypeNone: + return "None"; + case WebDashboardRegionTypeCircle: + return "Circle"; + case WebDashboardRegionTypeRectangle: + return "Rectangle"; + case WebDashboardRegionTypeScrollerRectangle: + return "ScrollerRectangle"; + } + return "Unknown"; +} + +- (NSString *)description +{ + return [NSString stringWithFormat:@"rect:%@ clip:%@ type:%s", NSStringFromRect(rect), NSStringFromRect(clip), typeName(type)]; +} + +// FIXME: Overriding isEqual: without overriding hash will cause trouble if this ever goes into a NSSet or is the key in an NSDictionary. +- (BOOL)isEqual:(id)other +{ + return NSEqualRects(rect, [other dashboardRegionRect]) && NSEqualRects(clip, [other dashboardRegionClip]) && type == [other dashboardRegionType]; +} + +@end + +#endif diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index 8d564a3..02696f4 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -487,21 +487,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return dataSource(_private->coreFrame->loader()->documentLoader()); } -- (void)_addData:(NSData *)data -{ - Document* document = _private->coreFrame->document(); - - // Document may be nil if the part is about to redirect - // as a result of JS executing during load, i.e. one frame - // changing another's location before the frame's document - // has been created. - if (!document) - return; - - document->setShouldCreateRenderers(_private->shouldCreateRenderers); - _private->coreFrame->loader()->addData((const char *)[data bytes], [data length]); -} - - (NSString *)_stringWithDocumentTypeStringAndMarkupString:(NSString *)markupString { return _private->coreFrame->documentTypeString() + markupString; @@ -715,7 +700,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (TextGranularity)_selectionGranularity { - return _private->coreFrame->selectionGranularity(); + return _private->coreFrame->selection()->granularity(); } - (NSRange)_convertToNSRange:(Range *)range @@ -859,7 +844,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return; TypingCommand::insertParagraphSeparatorInQuotedContent(_private->coreFrame->document()); - _private->coreFrame->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); + _private->coreFrame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); } - (VisiblePosition)_visiblePositionForPoint:(NSPoint)point @@ -895,9 +880,9 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (DOMCSSStyleDeclaration *)_typingStyle { - if (!_private->coreFrame || !_private->coreFrame->typingStyle()) + if (!_private->coreFrame || !_private->coreFrame->selection()->typingStyle()) return nil; - return kit(_private->coreFrame->typingStyle()->copy().get()); + return kit(_private->coreFrame->selection()->typingStyle()->copy().get()); } - (void)_setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction @@ -942,15 +927,13 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return [self _canProvideDocumentSource]; } -- (void)_receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName +- (void)_commitData:(NSData *)data { - // Set the encoding. This only needs to be done once, but it's harmless to do it again later. - String encoding = _private->coreFrame->loader()->documentLoader()->overrideEncoding(); - bool userChosen = !encoding.isNull(); - if (encoding.isNull()) - encoding = textEncodingName; - _private->coreFrame->loader()->writer()->setEncoding(encoding, userChosen); - [self _addData:data]; + // FIXME: This really should be a setting. + Document* document = _private->coreFrame->document(); + document->setShouldCreateRenderers(_private->shouldCreateRenderers); + + _private->coreFrame->loader()->documentLoader()->commitData((const char *)[data bytes], [data length]); } @end @@ -1167,7 +1150,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return; applyCommand(ReplaceSelectionCommand::create(_private->coreFrame->document(), core(fragment), selectReplacement, smartReplace, matchStyle)); - _private->coreFrame->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); + _private->coreFrame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); } - (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace @@ -1282,7 +1265,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return YES; - return SecurityOrigin::canDisplay(URL, String(), _private->coreFrame->document()); + return _private->coreFrame->document()->securityOrigin()->canDisplay(URL); } - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObjectRef inScriptWorld:(WebScriptWorld *)world @@ -1366,38 +1349,12 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return coreFrame->layerTreeAsText(); } -static Node* spellingNode(Frame* coreFrame) -{ - Node* focusedNode = coreFrame->selection()->start().node(); - if (!focusedNode || !focusedNode->renderer()) - return 0; - - for (const RenderObject* renderer = focusedNode->renderer(); renderer; renderer = renderer->childAt(0)) { - if (renderer->isText()) - return renderer->node(); - } - return 0; -} - - (BOOL)hasSpellingMarker:(int)from length:(int)length { Frame* coreFrame = _private->coreFrame; if (!coreFrame) return NO; - - Node* node = spellingNode(coreFrame); - if (!node) - return NO; - - unsigned int startOffset = static_cast<unsigned int>(from); - unsigned int endOffset = static_cast<unsigned int>(from + length); - Vector<DocumentMarker> markers = coreFrame->document()->markers()->markersForNode(node); - for (size_t i = 0; i < markers.size(); ++i) { - DocumentMarker marker = markers[i]; - if (marker.startOffset <= startOffset && endOffset <= marker.endOffset && marker.type == DocumentMarker::Spelling) - return YES; - } - return NO; + return coreFrame->editor()->selectionStartHasSpellingMarkerFor(from, length); } @end diff --git a/WebKit/mac/WebView/WebFrameInternal.h b/WebKit/mac/WebView/WebFrameInternal.h index dc3de21..8cdc272 100644 --- a/WebKit/mac/WebView/WebFrameInternal.h +++ b/WebKit/mac/WebView/WebFrameInternal.h @@ -162,7 +162,7 @@ WebView *getWebView(WebFrame *webFrame); - (BOOL)_canProvideDocumentSource; - (BOOL)_canSaveAsWebArchive; -- (void)_receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName; +- (void)_commitData:(NSData *)data; @end diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.mm b/WebKit/mac/WebView/WebHTMLRepresentation.mm index 188747d..2699472 100644 --- a/WebKit/mac/WebView/WebHTMLRepresentation.mm +++ b/WebKit/mac/WebView/WebHTMLRepresentation.mm @@ -166,23 +166,24 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second) - (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)dataSource { WebFrame *webFrame = [dataSource webFrame]; - if (webFrame) { - if (!_private->pluginView) - [webFrame _receivedData:data textEncodingName:[[_private->dataSource response] textEncodingName]]; - - // If the document is a stand-alone media document, now is the right time to cancel the WebKit load - Frame* coreFrame = core(webFrame); - if (coreFrame->document() && coreFrame->document()->isMediaDocument()) - coreFrame->loader()->documentLoader()->cancelMainResourceLoad(coreFrame->loader()->client()->pluginWillHandleLoadError(coreFrame->loader()->documentLoader()->response())); - - if (_private->pluginView) { - if (!_private->hasSentResponseToPlugin) { - [_private->manualLoader pluginView:_private->pluginView receivedResponse:[dataSource response]]; - _private->hasSentResponseToPlugin = YES; - } - - [_private->manualLoader pluginView:_private->pluginView receivedData:data]; + if (!webFrame) + return; + + if (!_private->pluginView) + [webFrame _commitData:data]; + + // If the document is a stand-alone media document, now is the right time to cancel the WebKit load + Frame* coreFrame = core(webFrame); + if (coreFrame->document()->isMediaDocument()) + coreFrame->loader()->documentLoader()->cancelMainResourceLoad(coreFrame->loader()->client()->pluginWillHandleLoadError(coreFrame->loader()->documentLoader()->response())); + + if (_private->pluginView) { + if (!_private->hasSentResponseToPlugin) { + [_private->manualLoader pluginView:_private->pluginView receivedResponse:[dataSource response]]; + _private->hasSentResponseToPlugin = YES; } + + [_private->manualLoader pluginView:_private->pluginView receivedData:data]; } } @@ -195,25 +196,26 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second) - (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource { - WebFrame *frame = [dataSource webFrame]; + WebFrame* webFrame = [dataSource webFrame]; if (_private->pluginView) { [_private->manualLoader pluginViewFinishedLoading:_private->pluginView]; return; } - if (frame) { - if (![self _isDisplayingWebArchive]) { - // Telling the frame we received some data and passing nil as the data is our - // way to get work done that is normally done when the first bit of data is - // received, even for the case of a document with no data (like about:blank). - [frame _receivedData:nil textEncodingName:[[_private->dataSource response] textEncodingName]]; - } - - WebView *webView = [frame webView]; - if ([webView isEditable]) - core(frame)->editor()->applyEditingStyleToBodyElement(); + if (!webFrame) + return; + + if (![self _isDisplayingWebArchive]) { + // Telling the frame we received some data and passing nil as the data is our + // way to get work done that is normally done when the first bit of data is + // received, even for the case of a document with no data (like about:blank). + [webFrame _commitData:nil]; } + + WebView *webView = [webFrame webView]; + if ([webView isEditable]) + core(webFrame)->editor()->applyEditingStyleToBodyElement(); } - (BOOL)canProvideDocumentSource @@ -304,15 +306,14 @@ static HTMLInputElement* inputElementFromDOMElement(DOMElement* element) HTMLInputElement* inputElement = inputElementFromDOMElement(element); return inputElement && inputElement->isTextField() - && inputElement->inputType() != HTMLInputElement::PASSWORD + && !inputElement->isPasswordField() && inputElement->autoComplete(); } - (BOOL)elementIsPassword:(DOMElement *)element { HTMLInputElement* inputElement = inputElementFromDOMElement(element); - return inputElement - && inputElement->inputType() == HTMLInputElement::PASSWORD; + return inputElement && inputElement->isPasswordField(); } - (DOMElement *)formForElement:(DOMElement *)element @@ -323,7 +324,7 @@ static HTMLInputElement* inputElementFromDOMElement(DOMElement* element) - (DOMElement *)currentForm { - return kit(core([_private->dataSource webFrame])->currentForm()); + return kit(core([_private->dataSource webFrame])->selection()->currentForm()); } - (NSArray *)controlsInForm:(DOMElement *)form diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index bd71eff..02d32d9 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -1914,12 +1914,11 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) - (NSImage *)_selectionDraggingImage { - if ([self _hasSelection]) { - NSImage *dragImage = core([self _frame])->selectionImage(); - [dragImage _web_dissolveToFraction:WebDragImageAlpha]; - return dragImage; - } - return nil; + if (![self _hasSelection]) + return nil; + NSImage *dragImage = core([self _frame])->selectionImage(); + [dragImage _web_dissolveToFraction:WebDragImageAlpha]; + return dragImage; } - (NSRect)_selectionDraggingRect @@ -2303,7 +2302,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) return bottom; float newBottom; - view->adjustPageHeight(&newBottom, top, bottom, bottomLimit); + view->adjustPageHeightDeprecated(&newBottom, top, bottom, bottomLimit); #ifdef __LP64__ // If the new bottom is equal to the old bottom (when both are treated as floats), we just return the original @@ -2378,10 +2377,6 @@ static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension #endif -@interface NSArray (WebHTMLView) -- (void)_web_makePluginViewsPerformSelector:(SEL)selector withObject:(id)object; -@end - @implementation WebHTMLView + (void)initialize @@ -2529,6 +2524,7 @@ WEBCORE_COMMAND(alignLeft) WEBCORE_COMMAND(alignRight) WEBCORE_COMMAND(copy) WEBCORE_COMMAND(cut) +WEBCORE_COMMAND(paste) WEBCORE_COMMAND(delete) WEBCORE_COMMAND(deleteBackward) WEBCORE_COMMAND(deleteBackwardByDecomposingPreviousCharacter) @@ -2664,7 +2660,7 @@ WEBCORE_COMMAND(yankAndSelect) COMMAND_PROLOGUE if (Frame* coreFrame = core([self _frame])) - coreFrame->revealSelection(ScrollAlignment::alignCenterAlways); + coreFrame->selection()->revealSelection(ScrollAlignment::alignCenterAlways); } - (NSCellStateValue)selectionHasStyle:(CSSStyleDeclaration*)style @@ -3080,14 +3076,31 @@ WEBCORE_COMMAND(yankAndSelect) } } +- (void)_web_makePluginSubviewsPerformSelector:(SEL)selector withObject:(id)object +{ +#if ENABLE(NETSCAPE_PLUGIN_API) + // Copy subviews because [self subviews] returns the view's mutable internal array, + // and we must avoid mutating the array while enumerating it. + NSArray *subviews = [[self subviews] copy]; + + NSEnumerator *enumerator = [subviews objectEnumerator]; + WebNetscapePluginView *view; + while ((view = [enumerator nextObject]) != nil) + if ([view isKindOfClass:[WebBaseNetscapePluginView class]]) + [view performSelector:selector withObject:object]; + + [subviews release]; +#endif +} + - (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow { - [[self subviews] _web_makePluginViewsPerformSelector:@selector(viewWillMoveToHostWindow:) withObject:hostWindow]; + [self _web_makePluginSubviewsPerformSelector:@selector(viewWillMoveToHostWindow:) withObject:hostWindow]; } - (void)viewDidMoveToHostWindow { - [[self subviews] _web_makePluginViewsPerformSelector:@selector(viewDidMoveToHostWindow) withObject:nil]; + [self _web_makePluginSubviewsPerformSelector:@selector(viewDidMoveToHostWindow) withObject:nil]; } @@ -4197,7 +4210,7 @@ static BOOL isInPasswordField(Frame* coreFrame) COMMAND_PROLOGUE if (Frame* coreFrame = core([self _frame])) - coreFrame->revealSelection(ScrollAlignment::alignCenterAlways); + coreFrame->selection()->revealSelection(ScrollAlignment::alignCenterAlways); } - (NSData *)_selectionStartFontAttributesAsRTF @@ -5082,21 +5095,6 @@ static BOOL writingDirectionKeyBindingsEnabled() @end -@implementation NSArray (WebHTMLView) - -- (void)_web_makePluginViewsPerformSelector:(SEL)selector withObject:(id)object -{ -#if ENABLE(NETSCAPE_PLUGIN_API) - NSEnumerator *enumerator = [self objectEnumerator]; - WebNetscapePluginView *view; - while ((view = [enumerator nextObject]) != nil) - if ([view isKindOfClass:[WebBaseNetscapePluginView class]]) - [view performSelector:selector withObject:object]; -#endif -} - -@end - @implementation WebHTMLView (WebInternal) - (void)_selectionChanged @@ -5145,7 +5143,7 @@ static BOOL writingDirectionKeyBindingsEnabled() if (![[self _webView] smartInsertDeleteEnabled]) return NO; Frame* coreFrame = core([self _frame]); - return coreFrame && coreFrame->selectionGranularity() == WordGranularity; + return coreFrame && coreFrame->selection()->granularity() == WordGranularity; } - (NSEvent *)_mouseDownEvent @@ -5163,24 +5161,6 @@ static BOOL writingDirectionKeyBindingsEnabled() return [_private->dataSource webFrame]; } -- (void)paste:(id)sender -{ - COMMAND_PROLOGUE - - RetainPtr<WebHTMLView> selfProtector = self; - RefPtr<Frame> coreFrame = core([self _frame]); - if (!coreFrame) - return; - if (coreFrame->editor()->tryDHTMLPaste()) - return; // DHTML did the whole operation - if (!coreFrame->editor()->canPaste()) - return; - if (coreFrame->selection()->isContentRichlyEditable()) - [self _pasteWithPasteboard:[NSPasteboard generalPasteboard] allowPlainText:YES]; - else - coreFrame->editor()->pasteAsPlainTextBypassingDHTML(); -} - - (void)closeIfNotCurrentView { if ([[[self _frame] frameView] documentView] != self) @@ -5360,7 +5340,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) if (!coreFrame) return; - NSRect rect = coreFrame->selectionBounds(); + NSRect rect = coreFrame->selection()->bounds(); #ifndef BUILDING_ON_TIGER NSDictionary *attributes = [attrString fontAttributesInRange:NSMakeRange(0,1)]; @@ -5582,7 +5562,11 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) [[NSNotificationCenter defaultCenter] postNotificationName:_WebViewDidStartAcceleratedCompositingNotification object:[self _webView] userInfo:nil]; #if defined(BUILDING_ON_LEOPARD) + [viewLayer setSublayerTransform:CATransform3DMakeScale(1, -1, 1)]; // setGeometryFlipped: doesn't exist on Leopard. [self _updateLayerHostingViewPosition]; +#else + // Do geometry flipping here, which flips all the compositing layers so they are top-down. + [viewLayer setGeometryFlipped:YES]; #endif } @@ -6037,25 +6021,27 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSRect)selectionRect { - if ([self _hasSelection]) - return core([self _frame])->selectionBounds(); - return NSZeroRect; + if (![self _hasSelection]) + return NSZeroRect; + return core([self _frame])->selection()->bounds(); } - (NSArray *)selectionTextRects { if (![self _hasSelection]) return nil; - + Vector<FloatRect> list; if (Frame* coreFrame = core([self _frame])) - coreFrame->selectionTextRects(list, Frame::RespectTransforms); + coreFrame->selection()->getClippedVisibleTextRectangles(list); + + size_t size = list.size(); + + NSMutableArray *result = [NSMutableArray arrayWithCapacity:size]; - unsigned size = list.size(); - NSMutableArray *result = [[[NSMutableArray alloc] initWithCapacity:size] autorelease]; - for (unsigned i = 0; i < size; ++i) + for (size_t i = 0; i < size; ++i) [result addObject:[NSValue valueWithRect:list[i]]]; - + return result; } @@ -6066,16 +6052,16 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSImage *)selectionImageForcingBlackText:(BOOL)forceBlackText { - if ([self _hasSelection]) - return core([self _frame])->selectionImage(forceBlackText); - return nil; + if (![self _hasSelection]) + return nil; + return core([self _frame])->selectionImage(forceBlackText); } - (NSRect)selectionImageRect { - if ([self _hasSelection]) - return core([self _frame])->selectionBounds(); - return NSZeroRect; + if (![self _hasSelection]) + return NSZeroRect; + return core([self _frame])->selection()->bounds(); } - (NSArray *)pasteboardTypesForSelection diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 3b750ff..17c8e4d 100644 --- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -92,6 +92,7 @@ #define WebKitShowDebugBordersPreferenceKey @"WebKitShowDebugBorders" #define WebKitShowRepaintCounterPreferenceKey @"WebKitShowRepaintCounter" #define WebKitWebGLEnabledPreferenceKey @"WebKitWebGLEnabled" +#define WebKitAccelerated2dCanvasEnabledPreferenceKey @"WebKitAccelerated2dCanvasEnabled" #define WebKitUsesProxiedOpenPanelPreferenceKey @"WebKitUsesProxiedOpenPanel" #define WebKitPluginAllowedRunTimePreferenceKey @"WebKitPluginAllowedRunTime" #define WebKitFrameFlatteningEnabledPreferenceKey @"WebKitFrameFlatteningEnabled" @@ -111,6 +112,7 @@ #define WebKitCacheModelPreferenceKey @"WebKitCacheModelPreferenceKey" #define WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey @"WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey" #define WebKitEditingBehaviorPreferenceKey @"WebKitEditingBehavior" +#define WebKitUsePreHTML5ParserQuirksKey @"WebKitUsePreHTML5ParserQuirks" // CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set // to NO, or has no value. For compatibility with Mac OS X 10.4.6, deferred updates are OFF by diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm index a4a5383..87284bb 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -361,12 +361,14 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey, [NSNumber numberWithBool:NO], WebKitShowRepaintCounterPreferenceKey, [NSNumber numberWithBool:NO], WebKitWebGLEnabledPreferenceKey, + [NSNumber numberWithBool:NO], WebKitAccelerated2dCanvasEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitUsesProxiedOpenPanelPreferenceKey, [NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey, [NSNumber numberWithBool:NO], WebKitFrameFlatteningEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitDNSPrefetchingEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitFullScreenEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitMemoryInfoEnabledPreferenceKey, + [NSNumber numberWithBool:NO], WebKitUsePreHTML5ParserQuirksKey, [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota, [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota, nil]; @@ -641,7 +643,10 @@ static WebCacheModel cacheModelForMainBundle(void) } else { locationString = [URL _web_originalDataAsString]; } - + + if (!locationString) + locationString = @""; + [self _setStringValue:locationString forKey: WebKitUserStyleSheetLocationPreferenceKey]; } @@ -1267,6 +1272,16 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:enabled forKey:WebKitWebGLEnabledPreferenceKey]; } +- (BOOL)accelerated2dCanvasEnabled +{ + return [self _boolValueForKey:WebKitAccelerated2dCanvasEnabledPreferenceKey]; +} + +- (void)setAccelerated2dCanvasEnabled:(BOOL)enabled +{ + [self _setBoolValue:enabled forKey:WebKitAccelerated2dCanvasEnabledPreferenceKey]; +} + - (BOOL)usesProxiedOpenPanel { return [self _boolValueForKey:WebKitUsesProxiedOpenPanelPreferenceKey]; @@ -1327,6 +1342,16 @@ static NSString *classIBCreatorID = nil; [self _setIntegerValue:behavior forKey:WebKitEditingBehaviorPreferenceKey]; } +- (BOOL)usePreHTML5ParserQuirks +{ + return [self _boolValueForKey:WebKitUsePreHTML5ParserQuirksKey]; +} + +- (void)setUsePreHTML5ParserQuirks:(BOOL)flag +{ + [self _setBoolValue:flag forKey:WebKitUsePreHTML5ParserQuirksKey]; +} + - (void)didRemoveFromWebView { ASSERT(_private->numWebViews); @@ -1357,6 +1382,11 @@ static NSString *classIBCreatorID = nil; return [self _boolValueForKey:WebKitFullScreenEnabledPreferenceKey]; } ++ (void)setWebKitLinkTimeVersion:(int)version +{ + setWebKitLinkTimeVersion(version); +} + @end @implementation WebPreferences (WebInternal) diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h index 783038d..3bd5e24 100644 --- a/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -184,6 +184,9 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)webGLEnabled; - (void)setWebGLEnabled:(BOOL)enabled; +- (BOOL)accelerated2dCanvasEnabled; +- (void)setAccelerated2dCanvasEnabled:(BOOL)enabled; + - (BOOL)paginateDuringLayoutEnabled; - (void)setPaginateDuringLayoutEnabled:(BOOL)flag; @@ -203,6 +206,8 @@ extern NSString *WebPreferencesRemovedNotification; + (void)_setInitialDefaultTextEncodingToSystemEncoding; + (void)_setIBCreatorID:(NSString *)string; ++ (void)setWebKitLinkTimeVersion:(int)version; + // For WebView's use only. - (void)willAddToWebView; - (void)didRemoveFromWebView; @@ -212,4 +217,7 @@ extern NSString *WebPreferencesRemovedNotification; - (void)setFullScreenEnabled:(BOOL)flag; - (BOOL)fullScreenEnabled; +- (void)setUsePreHTML5ParserQuirks:(BOOL)flag; +- (BOOL)usePreHTML5ParserQuirks; + @end diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 0125e1c..20f6e24 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -174,6 +174,10 @@ #import <wtf/StdLibExtras.h> #import <wtf/Threading.h> +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#import <AppKit/NSTextChecker.h> +#endif + #if ENABLE(DASHBOARD_SUPPORT) #import <WebKit/WebDashboardRegion.h> #endif @@ -692,6 +696,7 @@ static bool shouldEnableLoadDeferring() _private->page->setCanStartMedia([self window]); _private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]); + _private->page->settings()->setMinDOMTimerInterval(0.004); [WebFrame _createMainFrameWithPage:_private->page frameName:frameName frameView:frameView]; @@ -1427,7 +1432,6 @@ static bool fastDocumentTeardownEnabled() settings->setWebArchiveDebugModeEnabled([preferences webArchiveDebugModeEnabled]); settings->setLocalFileContentSniffingEnabled([preferences localFileContentSniffingEnabled]); settings->setOfflineWebApplicationCacheEnabled([preferences offlineWebApplicationCacheEnabled]); - settings->setZoomMode([preferences zoomsTextOnly] ? ZoomTextOnly : ZoomPage); settings->setJavaScriptCanAccessClipboard([preferences javaScriptCanAccessClipboard]); settings->setXSSAuditorEnabled([preferences isXSSAuditorEnabled]); settings->setEnforceCSSMIMETypeInNoQuirksMode(!WKAppVersionCheckLessThan(@"com.apple.iWeb", -1, 2.1)); @@ -1435,11 +1439,13 @@ static bool fastDocumentTeardownEnabled() // FIXME: Enabling accelerated compositing when WebGL is enabled causes tests to fail on Leopard which expect HW compositing to be disabled. // Until we fix that, I will comment out the test (CFM) - settings->setAcceleratedCompositingEnabled((coreVideoHas7228836Fix() || [preferences webGLEnabled]) && [preferences acceleratedCompositingEnabled]); + settings->setAcceleratedCompositingEnabled((coreVideoHas7228836Fix() || [preferences webGLEnabled] || + [preferences accelerated2dCanvasEnabled]) && [preferences acceleratedCompositingEnabled]); settings->setShowDebugBorders([preferences showDebugBorders]); settings->setShowRepaintCounter([preferences showRepaintCounter]); settings->setPluginAllowedRunTime([preferences pluginAllowedRunTime]); settings->setWebGLEnabled([preferences webGLEnabled]); + settings->setAccelerated2dCanvasEnabled([preferences accelerated2dCanvasEnabled]); settings->setLoadDeferringEnabled(shouldEnableLoadDeferring()); settings->setFrameFlatteningEnabled([preferences isFrameFlatteningEnabled]); settings->setPaginateDuringLayoutEnabled([preferences paginateDuringLayoutEnabled]); @@ -1447,9 +1453,14 @@ static bool fastDocumentTeardownEnabled() settings->setFullScreenEnabled([preferences fullScreenEnabled]); #endif settings->setMemoryInfoEnabled([preferences memoryInfoEnabled]); + settings->setUsePreHTML5ParserQuirks([preferences usePreHTML5ParserQuirks]); // Application Cache Preferences are stored on the global cache storage manager, not in Settings. [WebApplicationCache setDefaultOriginQuota:[preferences applicationCacheDefaultOriginQuota]]; + + BOOL zoomsTextOnly = [preferences zoomsTextOnly]; + if (_private->zoomsTextOnly != zoomsTextOnly) + [self _setZoomMultiplier:_private->zoomMultiplier isTextOnly:zoomsTextOnly]; } static inline IMP getMethod(id o, SEL s) @@ -1908,9 +1919,38 @@ static inline IMP getMethod(id o, SEL s) Frame* mainFrame = [self _mainCoreFrame]; if (!mainFrame) return nil; - NSMutableDictionary *regions = mainFrame->dashboardRegionsDictionary(); - [self _addScrollerDashboardRegions:regions]; - return regions; + + const Vector<DashboardRegionValue>& regions = mainFrame->document()->dashboardRegions(); + size_t size = regions.size(); + + NSMutableDictionary *webRegions = [NSMutableDictionary dictionaryWithCapacity:size]; + for (size_t i = 0; i < size; i++) { + const DashboardRegionValue& region = regions[i]; + + if (region.type == StyleDashboardRegion::None) + continue; + + NSString *label = region.label; + WebDashboardRegionType type = WebDashboardRegionTypeNone; + if (region.type == StyleDashboardRegion::Circle) + type = WebDashboardRegionTypeCircle; + else if (region.type == StyleDashboardRegion::Rectangle) + type = WebDashboardRegionTypeRectangle; + NSMutableArray *regionValues = [webRegions objectForKey:label]; + if (!regionValues) { + regionValues = [[NSMutableArray alloc] initWithCapacity:1]; + [webRegions setObject:regionValues forKey:label]; + [regionValues release]; + } + + WebDashboardRegion *webRegion = [[WebDashboardRegion alloc] initWithRect:region.bounds clip:region.clip type:type]; + [regionValues addObject:webRegion]; + [webRegion release]; + } + + [self _addScrollerDashboardRegions:webRegions]; + + return webRegions; } - (void)_setDashboardBehavior:(WebDashboardBehavior)behavior to:(BOOL)flag @@ -2604,6 +2644,13 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) automaticTextReplacementEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticTextReplacementEnabled]; automaticSpellingCorrectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticSpellingCorrectionEnabled]; #endif + +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticTextReplacementEnabled]) + automaticTextReplacementEnabled = [NSSpellChecker isAutomaticTextReplacementEnabled]; + if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticSpellingCorrectionEnabled]) + automaticTextReplacementEnabled = [NSSpellChecker isAutomaticSpellingCorrectionEnabled]; +#endif } + (void)_applicationWillTerminate @@ -3272,17 +3319,16 @@ static bool needsWebViewInitThreadWorkaround() { // NOTE: This has no visible effect when viewing a PDF (see <rdar://problem/4737380>) _private->zoomMultiplier = multiplier; + _private->zoomsTextOnly = isTextOnly; - ASSERT(_private->page); - if (_private->page) - _private->page->settings()->setZoomMode(isTextOnly ? ZoomTextOnly : ZoomPage); - - // FIXME: It would be nice to rework this code so that _private->zoomMultiplier doesn't exist - // and instead FrameView::zoomFactor is used. + // FIXME: It might be nice to rework this code so that _private->zoomMultiplier doesn't exist + // and instead the zoom factors stored in Frame are used. Frame* coreFrame = [self _mainCoreFrame]; if (coreFrame) { - if (FrameView* view = coreFrame->view()) - view->setZoomFactor(multiplier, isTextOnly ? ZoomTextOnly : ZoomPage); + if (_private->zoomsTextOnly) + coreFrame->setPageAndTextZoomFactors(1, multiplier); + else + coreFrame->setPageAndTextZoomFactors(multiplier, 1); } } @@ -3303,7 +3349,7 @@ static bool needsWebViewInitThreadWorkaround() if (!_private->page) return NO; - return _private->page->settings()->zoomMode() == ZoomTextOnly; + return _private->zoomsTextOnly; } #define MinimumZoomMultiplier 0.5f @@ -4366,6 +4412,9 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)canMarkAllTextMatches { + if (_private->closed) + return NO; + WebFrame *frame = [self mainFrame]; do { id <WebDocumentView> view = [[frame frameView] documentView]; @@ -4769,7 +4818,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu mainFrame->editor()->applyEditingStyleToBodyElement(); // If the WebView is made editable and the selection is empty, set it to something. if (![self selectedDOMRange]) - mainFrame->setSelectionFromNone(); + mainFrame->selection()->setSelectionFromNone(); } } } diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h index 558770e..9aa91dc 100644 --- a/WebKit/mac/WebView/WebViewData.h +++ b/WebKit/mac/WebView/WebViewData.h @@ -78,6 +78,7 @@ extern int pluginDatabaseClientCount; BOOL allowsUndo; float zoomMultiplier; + BOOL zoomsTextOnly; NSString *applicationNameForUserAgent; WTF::String userAgent; diff --git a/WebKit/mac/WebView/WebViewData.mm b/WebKit/mac/WebView/WebViewData.mm index 06da58f..9794d03 100644 --- a/WebKit/mac/WebView/WebViewData.mm +++ b/WebKit/mac/WebView/WebViewData.mm @@ -62,6 +62,7 @@ int pluginDatabaseClientCount = 0; cssAnimationsSuspended = NO; zoomMultiplier = 1; + zoomsTextOnly = NO; #if ENABLE(DASHBOARD_SUPPORT) dashboardBehaviorAllowWheelScrolling = YES; diff --git a/WebKit/qt/Api/DerivedSources.pro b/WebKit/qt/Api/DerivedSources.pro index 86d5dac..6fb52f2 100644 --- a/WebKit/qt/Api/DerivedSources.pro +++ b/WebKit/qt/Api/DerivedSources.pro @@ -10,7 +10,7 @@ DESTDIR = ../../../include/QtWebKit QUOTE = "" DOUBLE_ESCAPED_QUOTE = "" ESCAPE = "" -contains(QMAKE_HOST.os, "Windows"):isEmpty(QMAKE_SH) { +win32-msvc* | (contains(QMAKE_HOST.os, "Windows"):isEmpty(QMAKE_SH)) { # MinGW's make will run makefile commands using sh, even if make # was run from the Windows shell, if it finds sh in the path. ESCAPE = "^" diff --git a/WebKit/qt/Api/qwebelement.cpp b/WebKit/qt/Api/qwebelement.cpp index f7b1188..261631c 100644 --- a/WebKit/qt/Api/qwebelement.cpp +++ b/WebKit/qt/Api/qwebelement.cpp @@ -31,23 +31,33 @@ #include "FrameView.h" #include "GraphicsContext.h" #include "HTMLElement.h" +#if USE(JSC) #include "JSGlobalObject.h" #include "JSHTMLElement.h" #include "JSObject.h" -#include "NodeList.h" #include "PropertyNameArray.h" +#include <parser/SourceCode.h> +#include "qt_runtime.h" +#elif USE(V8) +#include "V8DOMWindow.h" +#include "V8Binding.h" +#include "NotImplemented.h" +#endif +#include "NodeList.h" #include "RenderImage.h" #include "StaticNodeList.h" -#include "qt_runtime.h" #include "qwebframe.h" #include "qwebframe_p.h" #include "runtime_root.h" -#include <parser/SourceCode.h> #include <wtf/Vector.h> #include <wtf/text/CString.h> #include <QPainter> +#if USE(V8) +using namespace V8::Bindings; +#endif + using namespace WebCore; class QWebElementPrivate { @@ -694,6 +704,7 @@ QWebFrame *QWebElement::webFrame() const return QWebFramePrivate::kit(frame); } +#if USE(JSC) static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValue, ScriptState*& state, ScriptController*& scriptController) { if (!element) @@ -721,6 +732,26 @@ static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValu return true; } +#elif USE(V8) +static bool setupScriptContext(WebCore::Element* element, v8::Handle<v8::Value>& thisValue, ScriptState*& state, ScriptController*& scriptController) +{ + if (!element) + return false; + + Document* document = element->document(); + if (!document) + return false; + + Frame* frame = document->frame(); + if (!frame) + return false; + + state = mainWorldScriptState(frame); + // Get V8 wrapper for DOM element + thisValue = toV8(frame->domWindow()); + return true; +} +#endif /*! @@ -732,12 +763,16 @@ QVariant QWebElement::evaluateJavaScript(const QString& scriptSource) return QVariant(); ScriptState* state = 0; +#if USE(JSC) JSC::JSValue thisValue; +#elif USE(V8) + v8::Handle<v8::Value> thisValue; +#endif ScriptController* scriptController = 0; if (!setupScriptContext(m_element, thisValue, state, scriptController)) return QVariant(); - +#if USE(JSC) JSC::ScopeChain& scopeChain = state->dynamicGlobalObject()->globalScopeChain(); JSC::UString script(reinterpret_cast_ptr<const UChar*>(scriptSource.data()), scriptSource.length()); JSC::Completion completion = JSC::evaluate(state, scopeChain, JSC::makeSource(script), thisValue); @@ -750,6 +785,10 @@ QVariant QWebElement::evaluateJavaScript(const QString& scriptSource) int distance = 0; return JSC::Bindings::convertValueToQVariant(state, result, QMetaType::Void, &distance); +#elif USE(V8) + notImplemented(); + return QVariant(); +#endif } /*! diff --git a/WebKit/qt/Api/qwebelement.h b/WebKit/qt/Api/qwebelement.h index c488d12..b94c372 100644 --- a/WebKit/qt/Api/qwebelement.h +++ b/WebKit/qt/Api/qwebelement.h @@ -32,11 +32,20 @@ namespace WebCore { class Node; } -namespace JSC { -namespace Bindings { + +#if defined(WTF_USE_V8) && WTF_USE_V8 +namespace V8 { + namespace Bindings { class QtWebElementRuntime; + } } +#else +namespace JSC { + namespace Bindings { + class QtWebElementRuntime; + } } +#endif QT_BEGIN_NAMESPACE class QPainter; @@ -160,7 +169,12 @@ private: friend class QWebHitTestResult; friend class QWebHitTestResultPrivate; friend class QWebPage; + +#if defined(WTF_USE_V8) && WTF_USE_V8 + friend class V8::Bindings::QtWebElementRuntime; +#else friend class JSC::Bindings::QtWebElementRuntime; +#endif QWebElementPrivate* d; WebCore::Element* m_element; diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index 464b4a0..46580bb 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -21,8 +21,12 @@ #include "config.h" #include "qwebframe.h" +#if USE(JSC) #include "Bridge.h" #include "CallFrame.h" +#elif USE(V8) +#include "V8Binding.h" +#endif #include "Document.h" #include "DocumentLoader.h" #include "DragData.h" @@ -32,23 +36,35 @@ #include "FrameLoaderClientQt.h" #include "FrameTree.h" #include "FrameView.h" +#if USE(JSC) #include "GCController.h" +#elif USE(V8) +#include "V8GCController.h" +#endif #include "GraphicsContext.h" #include "HTMLMetaElement.h" #include "HitTestResult.h" #include "HTTPParsers.h" #include "IconDatabase.h" #include "InspectorController.h" +#if USE(JSC) #include "JSDOMBinding.h" #include "JSDOMWindowBase.h" #include "JSLock.h" #include "JSObject.h" +#elif USE(V8) +#include "V8DOMWrapper.h" +#include "V8DOMWindowShell.h" +#endif +#include "NetworkingContext.h" #include "NodeList.h" #include "Page.h" #include "PlatformMouseEvent.h" #include "PlatformWheelEvent.h" #include "PrintContext.h" +#if USE(JSC) #include "PutPropertySlot.h" +#endif #include "RenderLayer.h" #include "RenderTreeAsText.h" #include "RenderView.h" @@ -64,8 +80,10 @@ #include "TiledBackingStore.h" #include "htmlediting.h" #include "markup.h" +#if USE(JSC) #include "qt_instance.h" #include "qt_runtime.h" +#endif #include "qwebelement.h" #include "qwebframe_p.h" #include "qwebpage.h" @@ -74,8 +92,10 @@ #include "qwebsecurityorigin_p.h" #include "qwebscriptworld.h" #include "qwebscriptworld_p.h" +#if USE(JSC) #include "runtime_object.h" #include "runtime_root.h" +#endif #include "wtf/HashMap.h" #include <QMultiMap> #include <qdebug.h> @@ -476,7 +496,7 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object { if (!page()->settings()->testAttribute(QWebSettings::JavascriptEnabled)) return; - +#if USE(JSC) JSC::JSLock lock(JSC::SilenceAssertionsOnly); JSDOMWindow* window = toJSDOMWindow(d->frame, mainThreadNormalWorld()); JSC::Bindings::RootObject* root; @@ -497,6 +517,13 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object JSC::PutPropertySlot slot; window->put(exec, JSC::Identifier(exec, reinterpret_cast_ptr<const UChar*>(name.constData()), name.length()), runtimeObject, slot); +#elif USE(V8) + QScriptEngine* engine = d->frame->script()->qtScriptEngine(); + if (!engine) + return; + QScriptValue v = engine->newQObject(object, ownership); + engine->globalObject().property("window").setProperty(name, v); +#endif } /*! @@ -868,9 +895,9 @@ QList<QWebFrame*> QWebFrame::childFrames() const FrameTree *tree = d->frame->tree(); for (Frame *child = tree->firstChild(); child; child = child->tree()->nextSibling()) { FrameLoader *loader = child->loader(); - FrameLoaderClientQt *client = static_cast<FrameLoaderClientQt*>(loader->client()); - if (client) - rc.append(client->webFrame()); + QWebFrame* webFrame = qobject_cast<QWebFrame*>(loader->networkingContext()->originatingObject()); + if (webFrame) + rc.append(webFrame); } } @@ -1105,11 +1132,9 @@ void QWebFrame::render(QPainter* painter) */ void QWebFrame::setTextSizeMultiplier(qreal factor) { - FrameView* view = d->frame->view(); - if (!view) - return; + page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, true); - view->setZoomFactor(factor, ZoomTextOnly); + d->frame->setPageAndTextZoomFactors(1, factor); } /*! @@ -1117,11 +1142,7 @@ void QWebFrame::setTextSizeMultiplier(qreal factor) */ qreal QWebFrame::textSizeMultiplier() const { - FrameView* view = d->frame->view(); - if (!view) - return 1; - - return view->zoomFactor(); + return d->zoomTextOnly ? d->frame->textZoomFactor() : d->frame->pageZoomFactor(); } /*! @@ -1132,24 +1153,15 @@ qreal QWebFrame::textSizeMultiplier() const void QWebFrame::setZoomFactor(qreal factor) { - Page* page = d->frame->page(); - if (!page) - return; - - FrameView* view = d->frame->view(); - if (!view) - return; - - view->setZoomFactor(factor, page->settings()->zoomMode()); + if (d->zoomTextOnly) + d->frame->setTextZoomFactor(factor); + else + d->frame->setPageZoomFactor(factor); } qreal QWebFrame::zoomFactor() const { - FrameView* view = d->frame->view(); - if (!view) - return 1; - - return view->zoomFactor(); + return d->zoomTextOnly ? d->frame->textZoomFactor() : d->frame->pageZoomFactor(); } /*! @@ -1388,9 +1400,17 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) ScriptController *proxy = d->frame->script(); QVariant rc; if (proxy) { - JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); +#if USE(JSC) int distance = 0; + JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); + rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject(mainThreadNormalWorld())->globalExec(), v, QMetaType::Void, &distance); +#elif USE(V8) + QScriptEngine* engine = d->frame->script()->qtScriptEngine(); + if (!engine) + return rc; + rc = engine->evaluate(scriptSource).toVariant(); +#endif } return rc; } @@ -1414,7 +1434,7 @@ WebCore::Frame* QWebFramePrivate::core(const QWebFrame* webFrame) QWebFrame* QWebFramePrivate::kit(const WebCore::Frame* coreFrame) { - return static_cast<FrameLoaderClientQt*>(coreFrame->loader()->client())->webFrame(); + return qobject_cast<QWebFrame*>(coreFrame->loader()->networkingContext()->originatingObject()); } diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h index b5dda62..6d6eca1 100644 --- a/WebKit/qt/Api/qwebframe_p.h +++ b/WebKit/qt/Api/qwebframe_p.h @@ -31,6 +31,7 @@ #include "qwebelement.h" #include "wtf/RefPtr.h" #include "Frame.h" +#include "ViewportArguments.h" namespace WebCore { class FrameLoaderClientQt; @@ -71,7 +72,7 @@ public: , allowsScrolling(true) , marginWidth(-1) , marginHeight(-1) - , initialLayoutComplete(false) + , zoomTextOnly(false) {} void init(QWebFrame* qframe, QWebFrameData* frameData); void setPage(QWebPage*); @@ -99,7 +100,8 @@ public: bool allowsScrolling; int marginWidth; int marginHeight; - bool initialLayoutComplete; + bool zoomTextOnly; + WebCore::ViewportArguments viewportArguments; }; class QWebHitTestResultPrivate { diff --git a/WebKit/qt/Api/qwebkitplatformplugin.h b/WebKit/qt/Api/qwebkitplatformplugin.h index 3c56c98..76496c5 100644 --- a/WebKit/qt/Api/qwebkitplatformplugin.h +++ b/WebKit/qt/Api/qwebkitplatformplugin.h @@ -27,6 +27,7 @@ */ #include <QObject> +#include <QUrl> class QWebSelectData { @@ -66,6 +67,7 @@ public: virtual const QString title() const = 0; virtual const QString message() const = 0; virtual const QByteArray iconData() const = 0; + virtual const QUrl openerPageUrl() const = 0; }; class QWebNotificationPresenter : public QObject @@ -79,6 +81,7 @@ public: Q_SIGNALS: void notificationClosed(); + void notificationClicked(); }; class QWebHapticFeedbackPlayer @@ -113,6 +116,6 @@ public: }; -Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.3"); +Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.4"); #endif // QWEBKITPLATFORMPLUGIN_H diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 8bf9208..181b3a6 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -64,6 +64,7 @@ #include "FocusController.h" #include "Editor.h" #include "Scrollbar.h" +#include "NetworkingContext.h" #include "PlatformKeyboardEvent.h" #include "PlatformWheelEvent.h" #include "PluginDatabase.h" @@ -77,6 +78,7 @@ #include "HTMLNames.h" #include "HitTestResult.h" #include "WindowFeatures.h" +#include "WebPlatformStrategies.h" #include "LocalizedStrings.h" #include "Cache.h" #include "runtime/InitializeThreading.h" @@ -263,13 +265,15 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) , inspectorIsInternalOnly(false) { WebCore::InitializeLoggingChannelsIfNecessary(); - JSC::initializeThreading(); + ScriptController::initializeThreading(); WTF::initializeMainThread(); WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData); #if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) WebCore::Font::setCodePath(WebCore::Font::Complex); #endif + WebPlatformStrategies::initialize(qq); + Page::PageClients pageClients; pageClients.chromeClient = new ChromeClientQt(q); pageClients.contextMenuClient = new ContextMenuClientQt(); @@ -1201,7 +1205,8 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) (selection.length < 0) ? selection.start : selection.start + selection.length); } else #endif - editor->setComposition(preedit, underlines, preedit.length(), 0); + if (!preedit.isEmpty()) + editor->setComposition(preedit, underlines, preedit.length(), 0); } ev->accept(); @@ -1697,15 +1702,15 @@ InspectorController* QWebPagePrivate::inspectorController() /*! - \class QWebPage::ViewportHints + \class QWebPage::ViewportConfiguration \since 4.7 - \brief The QWebPage::ViewportHints class describes hints that can be applied to a viewport. + \brief The QWebPage::ViewportConfiguration class describes hints that can be applied to a viewport. - QWebPage::ViewportHints provides a description of a viewport, such as viewport geometry, + QWebPage::ViewportConfiguration provides a description of a viewport, such as viewport geometry, initial scale factor with limits, plus information about whether a user should be able to scale the contents in the viewport or not, ie. by zooming. - ViewportHints can be set by a web author using the viewport meta tag extension, documented + ViewportConfiguration can be set by a web author using the viewport meta tag extension, documented at \l{http://developer.apple.com/safari/library/documentation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html}{Safari Reference Library: Using the Viewport Meta Tag}. All values might not be set, as such when dealing with the hints, the developer needs to @@ -1715,13 +1720,14 @@ InspectorController* QWebPagePrivate::inspectorController() */ /*! - Constructs an empty QWebPage::ViewportHints. + Constructs an empty QWebPage::ViewportConfiguration. */ -QWebPage::ViewportHints::ViewportHints() +QWebPage::ViewportConfiguration::ViewportConfiguration() : d(0) , m_initialScaleFactor(-1.0) , m_minimumScaleFactor(-1.0) , m_maximumScaleFactor(-1.0) + , m_devicePixelRatio(-1.0) , m_isUserScalable(true) , m_isValid(false) { @@ -1729,13 +1735,14 @@ QWebPage::ViewportHints::ViewportHints() } /*! - Constructs a QWebPage::ViewportHints which is a copy from \a other . + Constructs a QWebPage::ViewportConfiguration which is a copy from \a other . */ -QWebPage::ViewportHints::ViewportHints(const QWebPage::ViewportHints& other) +QWebPage::ViewportConfiguration::ViewportConfiguration(const QWebPage::ViewportConfiguration& other) : d(other.d) , m_initialScaleFactor(other.m_initialScaleFactor) , m_minimumScaleFactor(other.m_minimumScaleFactor) , m_maximumScaleFactor(other.m_maximumScaleFactor) + , m_devicePixelRatio(other.m_devicePixelRatio) , m_isUserScalable(other.m_isUserScalable) , m_isValid(other.m_isValid) , m_size(other.m_size) @@ -1744,18 +1751,18 @@ QWebPage::ViewportHints::ViewportHints(const QWebPage::ViewportHints& other) } /*! - Destroys the QWebPage::ViewportHints. + Destroys the QWebPage::ViewportConfiguration. */ -QWebPage::ViewportHints::~ViewportHints() +QWebPage::ViewportConfiguration::~ViewportConfiguration() { } /*! - Assigns the given QWebPage::ViewportHints to this viewport hints and returns a + Assigns the given QWebPage::ViewportConfiguration to this viewport hints and returns a reference to this. */ -QWebPage::ViewportHints& QWebPage::ViewportHints::operator=(const QWebPage::ViewportHints& other) +QWebPage::ViewportConfiguration& QWebPage::ViewportConfiguration::operator=(const QWebPage::ViewportConfiguration& other) { if (this != &other) { d = other.d; @@ -1770,30 +1777,30 @@ QWebPage::ViewportHints& QWebPage::ViewportHints::operator=(const QWebPage::View return *this; } -/*! \fn inline bool QWebPage::ViewportHints::isValid() const - Returns whether this is a valid ViewportHints or not. +/*! \fn inline bool QWebPage::ViewportConfiguration::isValid() const + Returns whether this is a valid ViewportConfiguration or not. - An invalid ViewportHints will have an empty QSize, negative values for scale factors and + An invalid ViewportConfiguration will have an empty QSize, negative values for scale factors and true for the boolean isUserScalable. */ -/*! \fn inline QSize QWebPage::ViewportHints::size() const +/*! \fn inline QSize QWebPage::ViewportConfiguration::size() const Returns the size of the viewport. */ -/*! \fn inline qreal QWebPage::ViewportHints::initialScaleFactor() const +/*! \fn inline qreal QWebPage::ViewportConfiguration::initialScaleFactor() const Returns the initial scale of the viewport as a multiplier. */ -/*! \fn inline qreal QWebPage::ViewportHints::minimumScaleFactor() const +/*! \fn inline qreal QWebPage::ViewportConfiguration::minimumScaleFactor() const Returns the minimum scale value of the viewport as a multiplier. */ -/*! \fn inline qreal QWebPage::ViewportHints::maximumScaleFactor() const +/*! \fn inline qreal QWebPage::ViewportConfiguration::maximumScaleFactor() const Returns the maximum scale value of the viewport as a multiplier. */ -/*! \fn inline bool QWebPage::ViewportHints::isUserScalable() const +/*! \fn inline bool QWebPage::ViewportConfiguration::isUserScalable() const Determines whether or not the scale can be modified by the user. */ @@ -1913,7 +1920,8 @@ QWebFrame *QWebPage::mainFrame() const QWebFrame *QWebPage::currentFrame() const { d->createMainFrame(); - return static_cast<WebCore::FrameLoaderClientQt *>(d->page->focusController()->focusedOrMainFrame()->loader()->client())->webFrame(); + WebCore::Frame *frame = d->page->focusController()->focusedOrMainFrame(); + return qobject_cast<QWebFrame*>(frame->loader()->networkingContext()->originatingObject()); } @@ -2317,6 +2325,30 @@ void QWebPage::setViewportSize(const QSize &size) const } } +QWebPage::ViewportConfiguration QWebPage::viewportConfigurationForSize(QSize availableSize) const +{ + static int desktopWidth = 980; + static int deviceDPI = 160; + + FloatRect rect = d->page->chrome()->windowRect(); + + int deviceWidth = rect.width(); + int deviceHeight = rect.height(); + + WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(mainFrame()->d->viewportArguments, desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize); + + ViewportConfiguration result; + + result.m_isValid = true; + result.m_size = conf.layoutViewport; + result.m_initialScaleFactor = conf.initialScale; + result.m_minimumScaleFactor = conf.minimumScale; + result.m_maximumScaleFactor = conf.maximumScale; + result.m_devicePixelRatio = conf.devicePixelRatio; + + return result; +} + QSize QWebPage::preferredContentsSize() const { QWebFrame* frame = d->mainFrame; @@ -2366,8 +2398,7 @@ void QWebPage::setPreferredContentsSize(const QSize& size) const } else if (view->useFixedLayout()) view->setUseFixedLayout(false); - if (frame->d->initialLayoutComplete) - view->layout(); + view->layout(); } /*! @@ -3699,25 +3730,12 @@ quint64 QWebPage::bytesReceived() const /*! \since 4.7 - \fn void QWebPage::viewportChangeRequested(const QWebPage::ViewportHints& hints) - - This signal is emitted before any layout of the contents, giving you the viewport \a arguments - the web page would like you to use when laying out its contents, including elements fixed to the - viewport. This viewport might be larger that your actual viewport, meaning that a initialScaleFactor - should be applied. When no scale is given, it is assumed that the contents should be scaled - such that the width of the scaled contents fits within the actual viewport. - - The minimum and maximum allowed scale represents the min and max values that the page - allows for scaling, and thus, affects the ability to zoom in on the page. - - Invalid values are supplied for the values not explicitly set by the web author; thus an - invalid viewport size, and negative values for scale factor and limits. The boolean - ViewportHints::isUserScalable is set to true. + \fn void QWebPage::viewportChangeRequested() Page authors can provide the supplied values by using the viewport meta tag. More information about this can be found at \l{http://developer.apple.com/safari/library/documentation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html}{Safari Reference Library: Using the Viewport Meta Tag}. - \sa QWebPage::ViewportHints, setPreferredContentsSize(), QGraphicsWebView::setScale() + \sa QWebPage::ViewportConfiguration, setPreferredContentsSize(), QGraphicsWebView::setScale() */ /*! diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h index dda4a6a..b1441ff 100644 --- a/WebKit/qt/Api/qwebpage.h +++ b/WebKit/qt/Api/qwebpage.h @@ -48,7 +48,7 @@ class QWebHitTestResult; class QWebNetworkInterface; class QWebPagePrivate; class QWebPluginFactory; -class QtViewportHintsPrivate; +class QtViewportConfigurationPrivate; namespace WebCore { class ChromeClientQt; @@ -207,34 +207,35 @@ public: GeolocationPermissionDomain }; - class ViewportHints { + class ViewportConfiguration { public: - ViewportHints(); - ViewportHints(const QWebPage::ViewportHints& other); + ViewportConfiguration(); + ViewportConfiguration(const QWebPage::ViewportConfiguration& other); - ~ViewportHints(); + ~ViewportConfiguration(); - QWebPage::ViewportHints& operator=(const QWebPage::ViewportHints& other); + QWebPage::ViewportConfiguration& operator=(const QWebPage::ViewportConfiguration& other); inline qreal initialScaleFactor() const { return m_initialScaleFactor; }; inline qreal minimumScaleFactor() const { return m_minimumScaleFactor; }; inline qreal maximumScaleFactor() const { return m_maximumScaleFactor; }; - inline int targetDensityDpi() const { return m_targetDensityDpi; }; + inline qreal devicePixelRatio() const { return m_devicePixelRatio; }; inline bool isUserScalable() const { return m_isUserScalable; }; inline bool isValid() const { return m_isValid; }; inline QSize size() const { return m_size; }; private: - QSharedDataPointer<QtViewportHintsPrivate> d; + QSharedDataPointer<QtViewportConfigurationPrivate> d; qreal m_initialScaleFactor; qreal m_minimumScaleFactor; qreal m_maximumScaleFactor; - int m_targetDensityDpi; + qreal m_devicePixelRatio; bool m_isUserScalable; bool m_isValid; QSize m_size; friend class WebCore::ChromeClientQt; + friend class QWebPage; }; @@ -274,6 +275,7 @@ public: QSize viewportSize() const; void setViewportSize(const QSize &size) const; + ViewportConfiguration viewportConfigurationForSize(QSize availableSize) const; QSize preferredContentsSize() const; void setPreferredContentsSize(const QSize &size) const; @@ -384,7 +386,7 @@ Q_SIGNALS: void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item); void restoreFrameStateRequested(QWebFrame* frame); - void viewportChangeRequested(const QWebPage::ViewportHints& hints); + void viewportChangeRequested(); void requestPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain); void checkPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy); diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index 6310eaf..82f5365 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -58,13 +58,13 @@ QT_END_NAMESPACE class QWebInspector; class QWebPageClient; -class QtViewportHintsPrivate : public QSharedData { +class QtViewportConfigurationPrivate : public QSharedData { public: - QtViewportHintsPrivate(QWebPage::ViewportHints* qq) + QtViewportConfigurationPrivate(QWebPage::ViewportConfiguration* qq) : q(qq) { } - QWebPage::ViewportHints* q; + QWebPage::ViewportConfiguration* q; }; class QWebPagePrivate { diff --git a/WebKit/qt/Api/qwebscriptworld.cpp b/WebKit/qt/Api/qwebscriptworld.cpp index 84b678d..74ab651 100644 --- a/WebKit/qt/Api/qwebscriptworld.cpp +++ b/WebKit/qt/Api/qwebscriptworld.cpp @@ -32,7 +32,9 @@ using namespace WebCore; */ QWebScriptWorld::QWebScriptWorld() { +#if USE(JSC) d = new QWebScriptWorldPrivate(ScriptController::createWorld()); +#endif } QWebScriptWorld::QWebScriptWorld(const QWebScriptWorld& other) diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index d88b0da..b71de25 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -217,10 +217,6 @@ void QWebSettingsPrivate::apply() QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath; settings->setLocalStorageDatabasePath(storagePath); - value = attributes.value(QWebSettings::ZoomTextOnly, - global->attributes.value(QWebSettings::ZoomTextOnly)); - settings->setZoomMode(value ? WebCore::ZoomTextOnly : WebCore::ZoomPage); - value = attributes.value(QWebSettings::PrintElementBackgrounds, global->attributes.value(QWebSettings::PrintElementBackgrounds)); settings->setShouldPrintBackgrounds(value); diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 95e79a4..34edbd7 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,557 @@ +2010-09-20 Jacob Dinu <dinu.jacob@nokia.com> + + Reviewed by Adam Barth. + + Added a new qwebpage test for loading a cached page + https://bugs.webkit.org/show_bug.cgi?id=41155 + + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::loadCachedPage): + +2010-09-08 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix forward includes generation for MSVC when sh is in PATH. + + MSVC's nmake isn't affected by having sh in PATH. + + * Api/DerivedSources.pro: + +2010-09-18 Ademar de Souza Reis Jr <ademar.reis@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + Enable Platform Strategies on Qt + + [Qt] Turn on PLATFORM_STRATEGIES + https://bugs.webkit.org/show_bug.cgi?id=45831 + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): Initialize the PlatformStrategy + singleton. + * WebCoreSupport/WebPlatformStrategies.cpp: Added, code was moved + from platform/qt/Localizations.cpp and plugins/qt/PluginDataQt.cpp + (WebPlatformStrategies::initialize): create the singleton, + following the same "pattern" used by Mac and Win ports. + (WebPlatformStrategies::WebPlatformStrategies): + (WebPlatformStrategies::createPluginStrategy): + (WebPlatformStrategies::createLocalizationStrategy): + (WebPlatformStrategies::createVisitedLinkStrategy): + (WebPlatformStrategies::refreshPlugins): + (WebPlatformStrategies::getPluginInfo): + (WebPlatformStrategies::inputElementAltText): + (WebPlatformStrategies::resetButtonDefaultLabel): + (WebPlatformStrategies::searchableIndexIntroduction): + (WebPlatformStrategies::submitButtonDefaultLabel): + (WebPlatformStrategies::fileButtonChooseFileLabel): + (WebPlatformStrategies::fileButtonNoFileSelectedLabel): + (WebPlatformStrategies::contextMenuItemTagOpenLinkInNewWindow): + (WebPlatformStrategies::contextMenuItemTagDownloadLinkToDisk): + (WebPlatformStrategies::contextMenuItemTagCopyLinkToClipboard): + (WebPlatformStrategies::contextMenuItemTagOpenImageInNewWindow): + (WebPlatformStrategies::contextMenuItemTagDownloadImageToDisk): + (WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard): + (WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow): + (WebPlatformStrategies::contextMenuItemTagCopy): + (WebPlatformStrategies::contextMenuItemTagGoBack): + (WebPlatformStrategies::contextMenuItemTagGoForward): + (WebPlatformStrategies::contextMenuItemTagStop): + (WebPlatformStrategies::contextMenuItemTagReload): + (WebPlatformStrategies::contextMenuItemTagCut): + (WebPlatformStrategies::contextMenuItemTagPaste): + (WebPlatformStrategies::contextMenuItemTagNoGuessesFound): + (WebPlatformStrategies::contextMenuItemTagIgnoreSpelling): + (WebPlatformStrategies::contextMenuItemTagLearnSpelling): + (WebPlatformStrategies::contextMenuItemTagSearchWeb): + (WebPlatformStrategies::contextMenuItemTagLookUpInDictionary): + (WebPlatformStrategies::contextMenuItemTagOpenLink): + (WebPlatformStrategies::contextMenuItemTagIgnoreGrammar): + (WebPlatformStrategies::contextMenuItemTagSpellingMenu): + (WebPlatformStrategies::contextMenuItemTagShowSpellingPanel): + (WebPlatformStrategies::contextMenuItemTagCheckSpelling): + (WebPlatformStrategies::contextMenuItemTagCheckSpellingWhileTyping): + (WebPlatformStrategies::contextMenuItemTagCheckGrammarWithSpelling): + (WebPlatformStrategies::contextMenuItemTagFontMenu): + (WebPlatformStrategies::contextMenuItemTagBold): + (WebPlatformStrategies::contextMenuItemTagItalic): + (WebPlatformStrategies::contextMenuItemTagUnderline): + (WebPlatformStrategies::contextMenuItemTagOutline): + (WebPlatformStrategies::contextMenuItemTagWritingDirectionMenu): + (WebPlatformStrategies::contextMenuItemTagTextDirectionMenu): + (WebPlatformStrategies::contextMenuItemTagDefaultDirection): + (WebPlatformStrategies::contextMenuItemTagLeftToRight): + (WebPlatformStrategies::contextMenuItemTagRightToLeft): + (WebPlatformStrategies::contextMenuItemTagInspectElement): + (WebPlatformStrategies::searchMenuNoRecentSearchesText): + (WebPlatformStrategies::searchMenuRecentSearchesText): + (WebPlatformStrategies::searchMenuClearRecentSearchesText): + (WebPlatformStrategies::AXWebAreaText): + (WebPlatformStrategies::AXLinkText): + (WebPlatformStrategies::AXListMarkerText): + (WebPlatformStrategies::AXImageMapText): + (WebPlatformStrategies::AXHeadingText): + (WebPlatformStrategies::AXDefinitionListTermText): + (WebPlatformStrategies::AXDefinitionListDefinitionText): + (WebPlatformStrategies::AXButtonActionVerb): + (WebPlatformStrategies::AXRadioButtonActionVerb): + (WebPlatformStrategies::AXTextFieldActionVerb): + (WebPlatformStrategies::AXCheckedCheckBoxActionVerb): + (WebPlatformStrategies::AXUncheckedCheckBoxActionVerb): + (WebPlatformStrategies::AXMenuListActionVerb): + (WebPlatformStrategies::AXMenuListPopupActionVerb): + (WebPlatformStrategies::AXLinkActionVerb): + (WebPlatformStrategies::missingPluginText): + (WebPlatformStrategies::crashedPluginText): + (WebPlatformStrategies::multipleFileUploadText): + (WebPlatformStrategies::unknownFileSizeText): + (WebPlatformStrategies::imageTitle): + (WebPlatformStrategies::mediaElementLoadingStateText): + (WebPlatformStrategies::mediaElementLiveBroadcastStateText): + (WebPlatformStrategies::localizedMediaControlElementString): + (WebPlatformStrategies::localizedMediaControlElementHelpText): + (WebPlatformStrategies::localizedMediaTimeDescription): + (WebPlatformStrategies::validationMessageValueMissingText): + (WebPlatformStrategies::validationMessageTypeMismatchText): + (WebPlatformStrategies::validationMessagePatternMismatchText): + (WebPlatformStrategies::validationMessageTooLongText): + (WebPlatformStrategies::validationMessageRangeUnderflowText): + (WebPlatformStrategies::validationMessageRangeOverflowText): + (WebPlatformStrategies::validationMessageStepMismatchText): + (WebPlatformStrategies::isLinkVisited): + (WebPlatformStrategies::addVisitedLink): + * WebCoreSupport/WebPlatformStrategies.h: Added, based on Mac and Win + versions. + +2010-09-18 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Antonio Gomes. + + [Qt] V8 port: Add FrameLoaderClientQt::allowScriptExtension() + https://bugs.webkit.org/show_bug.cgi?id=46034 + + r67749 added FrameLoaderClient::allowScriptExtension() (V8-specific) + Add a stub implementation that simply returns false for now. + + * WebCoreSupport/FrameLoaderClientQt.h: + (WebCore::FrameLoaderClientQt::allowScriptExtension): + +2010-09-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (r60104): Zoom level is unexpectedly reset on page reload + https://bugs.webkit.org/show_bug.cgi?id=42863 + + * Api/qwebframe.cpp: + (QWebFrame::setTextSizeMultiplier): + (QWebFrame::textSizeMultiplier): + (QWebFrame::setZoomFactor): + (QWebFrame::zoomFactor): + Call functions on Frame instead of FrameView. + +2010-09-16 Darin Adler <darin@apple.com> + + Fix build. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): Updated for change + in name of isUrlField to isURLField. + +2010-09-16 Darin Adler <darin@apple.com> + + Reviewed by Andreas Kling. + + Reduce use of HTMLInputElement::inputType so we can remove it later + https://bugs.webkit.org/show_bug.cgi?id=45903 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId): + Use isPasswordField. + +2010-09-16 Robert Hogan <robert@webkit.org> + + Reviewed by Antonio Gomes. + + [Qt] Support globalhistory tests + https://bugs.webkit.org/show_bug.cgi?id=45774 + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::populateVisitedLinks): + * WebCoreSupport/ChromeClientQt.h: + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::dumpHistoryCallbacks): + (DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::setTitle): + (WebCore::FrameLoaderClientQt::updateGlobalHistory): + (WebCore::FrameLoaderClientQt::updateGlobalHistoryRedirectLinks): + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-09-16 Diego Gonzalez <diegohcg@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Remove FrameLoaderClientQt::webFrame() to use NetworkingContext to get the WebFrame to avoid layering violations + https://bugs.webkit.org/show_bug.cgi?id=42293 + + * Api/qwebframe.cpp: + (QWebFrame::childFrames): + (QWebFramePrivate::kit): + * Api/qwebpage.cpp: + (QWebPage::currentFrame): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::runJavaScriptAlert): + (WebCore::ChromeClientQt::runJavaScriptConfirm): + (WebCore::ChromeClientQt::runJavaScriptPrompt): + (WebCore::ChromeClientQt::contentsSizeChanged): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::chooseFile): + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-09-15 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Update the Symbian def files + + Re-freeze with the viewport meta tag updates. + + * symbian/eabi/QtWebKitu.def: + +2010-09-14 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] V8 port: Get inspector up and running + https://bugs.webkit.org/show_bug.cgi?id=45771 + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::ensureDebuggerScriptLoaded): Added, loads DebuggerScript.js into ScriptDebugServer. + (WebCore::InspectorClientQt::openInspectorFrontend): Ensure that DebuggerScript.js is loaded + before opening an inspector. + +2010-09-14 Enrico Ros <eros@codeaurora.org> + + Reviewed by Andreas Kling. + + [Qt] Respect title attribute on option elements + https://bugs.webkit.org/show_bug.cgi?id=45084 + + Set the tooltip in the combo box model, so it's reflected in the view. + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopup::populate): + +2010-09-13 Daniel Bates <dbates@rim.com> + + https://bugs.webkit.org/show_bug.cgi?id=45732 + + Fix the Qt build. I missed this when reviewing the patch + for Bug #45732. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::suspendActiveDOMObjects): Change enum value ActiveDOMObject::JavaScriptPaused to + ActiveDOMObject::JavaScriptDebuggerPaused + +2010-09-13 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Daniel Bates. + + [Qt] DumpRenderTreeSupportQt::suspendActiveDOMObjects needs a new parameter + https://bugs.webkit.org/show_bug.cgi?id=45732 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::suspendActiveDOMObjects): Pass ActiveDOMObject::JavaScriptPaused + to suspendActiveDOMObjects. + +2010-09-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Paste should be implemented in WebCore like Copy and Cut for Mac also. + https://bugs.webkit.org/show_bug.cgi?id=45494 + <rdar://problem/7660537> + + On the Mac platform, the implementation of the paste operation is all done + at the WebKit level. In order to support it on WebKit2 it is necessary to + refactor the code and move this functionality at the level of WebCore like + we already have on Windows. + The original code relies on some in AppKit functions that call back into + WebKit causing problems in WebKit2. All this functionality has been moved + at the level of the editor client where it can be dealt with appropriately. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::canShowMIMETypeAsHTML): Added stub. + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-08-27 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Antti Koivisto. + + Add a Qt API for the viewport meta tag support based on the + following draft spec: + + http://people.opera.com/rune/TR/ED-css-viewport-20100806/ + + Add common handling of viewport meta tag based on new Opera spec + https://bugs.webkit.org/show_bug.cgi?id=44201 + + * Api/qwebframe_p.h: + (QWebFramePrivate::QWebFramePrivate): + * Api/qwebpage.cpp: + (QWebPage::ViewportConfiguration::ViewportConfiguration): + (QWebPage::ViewportConfiguration::~ViewportConfiguration): + (QWebPage::ViewportConfiguration::operator=): + (QWebPage::viewportConfigurationForSize): + (QWebPage::setPreferredContentsSize): + * Api/qwebpage.h: + * Api/qwebpage_p.h: + (QtViewportConfigurationPrivate::QtViewportConfigurationPrivate): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::didReceiveViewportArguments): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::viewportAsText): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidCommitLoad): + (WebCore::FrameLoaderClientQt::dispatchDidFirstLayout): + +2010-09-12 Martin Smith <martin.smith@nokia.com> + + Reviewed by Simon Hausmann. + + doc: Changed the title so lists of contents sort better. + + * docs/qtwebkit.qdoc: + +2010-09-12 David Boddie <david.boddie@nokia.com> + + Reviewed by Simon Hausmann. + + Doc: More work on the QML documentation. + + * declarative/qdeclarativewebview.cpp: + +2010-09-12 Martin Jones <martin.jones@nokia.com> + + Reviewed by Simon Hausmann. + + [Qml] Ensure WebView gets focus when an editable node is clicked on. + + Task-number: QTBUG-13342 + + * declarative/qdeclarativewebview.cpp: + (GraphicsWebView::mousePressEvent): + +2010-09-12 David Boddie <david.boddie@nokia.com> + + Reviewed by Simon Hausmann. + + Doc: qdoc fixes. + + * declarative/qdeclarativewebview.cpp: + +2010-09-12 Oswald Buddenhagen <oswald.buddenhagen@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] let WebKit inject itself into the qt configuration + + Task-number: QTBUG-12379 + + * qt_webkit_version.pri: Use the faster + instead of * + operator to add webkit to the config. + +2010-09-12 Martin Smith <martin.smith@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix group of declarative web view in QML docs. + + * declarative/qdeclarativewebview.cpp: + +2010-09-12 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Partial implementation of Qt bridge using V8 and QtScript. + + * Api/qwebelement.cpp: + (QWebElement::evaluateJavaScript): Stub it out for now, + to compile, until we have a conversion path between v8::Object + and QScriptValue. + * Api/qwebframe.cpp: + (QWebFrame::addToJavaScriptWindowObject): Implemented using + few lines of QtScript code. + (QWebFrame::evaluateJavaScript): Ditto. + +2010-09-12 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Andreas Kling. + + Fix the build with V8. + + This is a temporary kludge until the scriptworld stuff is properly + ported, as part of the upcoming DRT work. + + * Api/qwebscriptworld.cpp: + (QWebScriptWorld::QWebScriptWorld): + +2010-09-11 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] V8 port for Qt platform: Qt WebCoreSupport changes + https://bugs.webkit.org/show_bug.cgi?id=45149 + + Original patch by Vlad Burlik <volodimir.burlik@nokia.com> + + Implemented the V8 specifics needed in DumpRenderTreeSupportQt and + FrameLoaderClientQt. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::javaScriptObjectsCount): + (DumpRenderTreeSupportQt::garbageCollectorCollect): + (DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread): + (DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::didCreateScriptContextForFrame): + (WebCore::FrameLoaderClientQt::didDestroyScriptContextForFrame): + (WebCore::FrameLoaderClientQt::didCreateIsolatedScriptContext): + (WebCore::FrameLoaderClientQt::createDocumentLoader): + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-09-11 Vlad Burlik <volodimir.burlik@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] V8 port for QT platform: QT API implementation changes + https://bugs.webkit.org/show_bug.cgi?id=45148 + + V8 Implementation of QWebFrame::addToJavaScriptWindowObject() + and QWebFrame::evaluateJavaScript() + + * Api/qwebelement.cpp: + (setupScriptContext): JSC and V8 variations + (QWebElement::evaluateJavaScript): + * Api/qwebelement.h: + * Api/qwebframe.cpp: QObject injection to V8 world + (QWebFrame::addToJavaScriptWindowObject): + (QWebFrame::evaluateJavaScript): + * Api/qwebpage.cpp: Use ScriptController type definitions instead of direct references to JSC or V8 + (QWebPagePrivate::QWebPagePrivate): + +2010-09-10 yi shen <yi.4.shen@nokia.com> + + Reviewed by Antonio Gomes. + + [Qt] selected text gets deleted when qgraphicswebview losts focus + https://bugs.webkit.org/show_bug.cgi?id=45539 + + * Api/qwebpage.cpp: + (QWebPagePrivate::inputMethodEvent): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2010-09-10 Sam Weinig <sam@webkit.org> + + Fix Qt build. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + +2010-09-10 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Remove unnecessary constraint in WebCore of choosing either text zoom or full page zoom. + Precursor to <rdar://problem/7660657> + https://bugs.webkit.org/show_bug.cgi?id=45522 + + * Api/qwebframe.cpp: + (QWebFrame::setTextSizeMultiplier): + (QWebFrame::textSizeMultiplier): + (QWebFrame::setZoomFactor): + (QWebFrame::zoomFactor): + * Api/qwebframe_p.h: + (QWebFramePrivate::QWebFramePrivate): + Move tracking of text only zoom here from WebCore. + +2010-09-10 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Support click event for notifications + https://bugs.webkit.org/show_bug.cgi?id=44836 + + Propagate click events to JavaScript from either the + platform plugn or from QSystemTrayIcon. + Also added the method NotificationWrapper::openerPageUrl so that + if the platform plugin can reopen the page that created the + notification directly, when the user clicks the notification. + + Added DumpRenderTreeSupportQt::simulateDesktopNotificationClick + for testing purpose. + + * Api/qwebkitplatformplugin.h: + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::simulateDesktopNotificationClick): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (WebCore::NotificationWrapper::openerPageUrl): + (WebCore::NotificationWrapper::notificationClicked): + (WebCore::NotificationPresenterClientQt::displayNotification): + (WebCore::NotificationPresenterClientQt::notificationClicked): + * WebCoreSupport/NotificationPresenterClientQt.h: + * examples/platformplugin/WebNotificationPresenter.cpp: + (WebNotificationWidget::event): + * examples/platformplugin/WebNotificationPresenter.h: + (WebNotificationPresenter::WebNotificationPresenter): + * examples/platformplugin/qwebkitplatformplugin.h: + +2010-09-10 Adam Barth <abarth@webkit.org> + + Attempt to fix the failign Qt tests. This patch adapts code from + Chromium. The long-term fix is to remove the need for this code, but + that's a bit too complicated for a buildfix patch. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::FrameLoaderClientQt): + (WebCore::FrameLoaderClientQt::makeRepresentation): + (WebCore::FrameLoaderClientQt::revertToProvisionalState): + (WebCore::FrameLoaderClientQt::finishedLoading): + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Move code from WebKit-layer to DocumentLoader + https://bugs.webkit.org/show_bug.cgi?id=45569 + + This code didn't know that setEncoding can be called multiple times. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::FrameLoaderClientQt): + (WebCore::FrameLoaderClientQt::finishedLoading): + (WebCore::FrameLoaderClientQt::setMainDocumentError): + (WebCore::FrameLoaderClientQt::committedLoad): + (WebCore::FrameLoaderClientQt::dispatchDidReceiveResponse): + (WebCore::FrameLoaderClientQt::dispatchDidFailLoading): + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Main resource bytes shouldn't bounce through FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=45496 + + Now return the bytes to the DocumentLoader. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::committedLoad): + 2010-09-08 Darin Adler <darin@apple.com> Reviewed by Adam Barth. diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 8b01d4d..a5dfdc7 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -44,6 +44,7 @@ #include "GeolocationPermissionClientQt.h" #include "HitTestResult.h" #include "Icon.h" +#include "NetworkingContext.h" #include "NotImplemented.h" #include "NotificationPresenterClientQt.h" #include "PageClientQt.h" @@ -74,6 +75,8 @@ namespace WebCore { +bool ChromeClientQt::dumpVisitedLinksCallbacks = false; + ChromeClientQt::ChromeClientQt(QWebPage* webPage) : m_webPage(webPage) , m_eventLoop(0) @@ -294,22 +297,22 @@ void ChromeClientQt::closeWindowSoon() void ChromeClientQt::runJavaScriptAlert(Frame* f, const String& msg) { QString x = msg; - FrameLoaderClientQt* fl = static_cast<FrameLoaderClientQt*>(f->loader()->client()); - m_webPage->javaScriptAlert(fl->webFrame(), x); + QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject()); + m_webPage->javaScriptAlert(webFrame, x); } bool ChromeClientQt::runJavaScriptConfirm(Frame* f, const String& msg) { QString x = msg; - FrameLoaderClientQt* fl = static_cast<FrameLoaderClientQt*>(f->loader()->client()); - return m_webPage->javaScriptConfirm(fl->webFrame(), x); + QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject()); + return m_webPage->javaScriptConfirm(webFrame, x); } bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const String& defaultValue, String& result) { QString x = result; - FrameLoaderClientQt* fl = static_cast<FrameLoaderClientQt*>(f->loader()->client()); - bool rc = m_webPage->javaScriptPrompt(fl->webFrame(), (QString)message, (QString)defaultValue, &x); + QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject()); + bool rc = m_webPage->javaScriptPrompt(webFrame, (QString)message, (QString)defaultValue, &x); // Fix up a quirk in the QInputDialog class. If no input happened the string should be empty // but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914. @@ -444,7 +447,8 @@ PlatformPageClient ChromeClientQt::platformPageClient() const void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const { - emit QWebFramePrivate::kit(frame)->contentsSizeChanged(size); + if (frame->loader()->networkingContext()) + QWebFramePrivate::kit(frame)->contentsSizeChanged(size); } void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned) @@ -640,22 +644,9 @@ QWebSelectMethod* ChromeClientQt::createSelectPopup() const void ChromeClientQt::didReceiveViewportArguments(Frame* frame, const ViewportArguments& arguments) const { - if (m_webPage->mainFrame()->d->initialLayoutComplete) - return; - - QSize viewportSize(arguments.width, arguments.height); - bool isUserScalable = arguments.userScalable == 1; - - QWebPage::ViewportHints hints; - hints.m_isValid = true; - hints.m_size = viewportSize; - hints.m_initialScaleFactor = arguments.initialScale; - hints.m_minimumScaleFactor = arguments.minimumScale; - hints.m_maximumScaleFactor = arguments.maximumScale; - hints.m_targetDensityDpi = arguments.targetDensityDpi; - hints.m_isUserScalable = isUserScalable; + m_webPage->mainFrame()->d->viewportArguments = arguments; - emit m_webPage->viewportChangeRequested(hints); + emit m_webPage->viewportChangeRequested(); } bool ChromeClientQt::selectItemWritingDirectionIsNatural() @@ -673,4 +664,14 @@ PassRefPtr<SearchPopupMenu> ChromeClientQt::createSearchPopupMenu(PopupMenuClien return adoptRef(new SearchPopupMenuQt(createPopupMenu(client))); } +void ChromeClientQt::populateVisitedLinks() +{ + // We don't need to do anything here because history is tied to QWebPage rather than stored + // in a separate database + if (dumpVisitedLinksCallbacks) { + printf("Asked to populate visited links for WebView \"%s\"\n", + qPrintable(m_webPage->mainFrame()->url().toString())); + } +} + } // namespace WebCore diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h index d18f993..56801aa 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -173,6 +173,7 @@ namespace WebCore { virtual bool selectItemWritingDirectionIsNatural(); virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const; virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const; + virtual void populateVisitedLinks(); QWebSelectMethod* createSelectPopup() const; @@ -188,6 +189,8 @@ namespace WebCore { bool menuBarVisible; QEventLoop* m_eventLoop; + static bool dumpVisitedLinksCallbacks; + mutable QtPlatformPlugin m_platformPlugin; }; } diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index c1be131..ed7ac32 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -24,6 +24,7 @@ #include "DumpRenderTreeSupportQt.h" #include "CSSComputedStyleDeclaration.h" +#include "ChromeClientQt.h" #include "ContextMenu.h" #include "ContextMenuClientQt.h" #include "ContextMenuController.h" @@ -34,7 +35,12 @@ #include "Frame.h" #include "FrameLoaderClientQt.h" #include "FrameView.h" +#if USE(JSC) #include "GCController.h" +#elif USE(V8) +#include "V8GCController.h" +#include "V8Proxy.h" +#endif #include "Geolocation.h" #include "GeolocationServiceMock.h" #include "Geoposition.h" @@ -296,17 +302,31 @@ void DumpRenderTreeSupportQt::clearFrameName(QWebFrame* frame) int DumpRenderTreeSupportQt::javaScriptObjectsCount() { +#if USE(JSC) return JSDOMWindowBase::commonJSGlobalData()->heap.globalObjectCount(); +#elif USE(V8) + // FIXME: Find a way to do this using V8. + return 1; +#endif } void DumpRenderTreeSupportQt::garbageCollectorCollect() { +#if USE(JSC) gcController().garbageCollectNow(); +#elif USE(V8) + v8::V8::LowMemoryNotification(); +#endif } void DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(bool waitUntilDone) { +#if USE(JSC) gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); +#elif USE(V8) + // FIXME: Find a way to do this using V8. + garbageCollectorCollect(); +#endif } // Returns the value of counter in the element specified by \a id. @@ -347,7 +367,9 @@ void DumpRenderTreeSupportQt::suspendActiveDOMObjects(QWebFrame* frame) { Frame* coreFrame = QWebFramePrivate::core(frame); if (coreFrame->document()) - coreFrame->document()->suspendActiveDOMObjects(); + // FIXME: This function should be changed take a ReasonForSuspension parameter + // https://bugs.webkit.org/show_bug.cgi?id=45732 + coreFrame->document()->suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused); } // Resume active DOM objects in this frame. @@ -511,9 +533,7 @@ bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame* if (!inputElement) return false; - return (inputElement->isTextField() - && inputElement->inputType() != HTMLInputElement::PASSWORD - && inputElement->autoComplete()); + return inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->autoComplete(); } void DumpRenderTreeSupportQt::setEditingBehavior(QWebPage* page, const QString& editingBehavior) @@ -582,6 +602,16 @@ void DumpRenderTreeSupportQt::setCustomPolicyDelegate(bool enabled, bool permiss FrameLoaderClientQt::policyDelegatePermissive = permissive; } +void DumpRenderTreeSupportQt::dumpHistoryCallbacks(bool b) +{ + FrameLoaderClientQt::dumpHistoryCallbacks = b; +} + +void DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(bool b) +{ + ChromeClientQt::dumpVisitedLinksCallbacks = b; +} + void DumpRenderTreeSupportQt::dumpEditingCallbacks(bool b) { EditorClientQt::dumpEditingCallbacks = b; @@ -599,6 +629,27 @@ void DumpRenderTreeSupportQt::dumpNotification(bool b) #endif } +QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, const QSize& availableSize) +{ + WebCore::ViewportArguments args = page->mainFrame()->d->viewportArguments; + WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(args, + /* desktop-width */ 980, + /* device-width */ 320, + /* device-height */ 480, + /* device-dpi */ 160, + availableSize); + + QString res; + res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f]\n", + conf.layoutViewport.width(), + conf.layoutViewport.height(), + conf.initialScale, + conf.minimumScale, + conf.maximumScale); + + return res; +} + void DumpRenderTreeSupportQt::setMockGeolocationPosition(double latitude, double longitude, double accuracy) { #if ENABLE(GEOLOCATION) @@ -670,8 +721,16 @@ void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, in ScriptController* proxy = coreFrame->script(); - if (proxy) - proxy->executeScriptInWorld(scriptWorld->world(), script, true); + if (!proxy) + return; +#if USE(JSC) + proxy->executeScriptInWorld(scriptWorld->world(), script, true); +#elif USE(V8) + ScriptSourceCode source(script); + Vector<ScriptSourceCode> sources; + sources.append(source); + proxy->evaluateInIsolatedWorld(0, sources, true); +#endif } bool DumpRenderTreeSupportQt::isPageBoxVisible(QWebFrame* frame, int pageIndex) @@ -698,6 +757,13 @@ void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPage* page, const QString& s page->handle()->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), 0, 0, WebCore::InjectInAllFrames); } +void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& title) +{ +#if ENABLE(NOTIFICATIONS) + NotificationPresenterClientQt::notificationPresenter()->notificationClicked(title); +#endif +} + // Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame) diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 2069114..5a59475 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -106,6 +106,8 @@ public: static void setWillSendRequestReturnsNullOnRedirect(bool b); static void setWillSendRequestReturnsNull(bool b); static void setWillSendRequestClearHeaders(const QStringList& headers); + static void dumpHistoryCallbacks(bool b); + static void dumpVisitedLinksCallbacks(bool b); static void setDeferMainResourceDataLoad(bool b); @@ -127,7 +129,8 @@ public: static QString pageSizeAndMarginsInPixels(QWebFrame* frame, int pageIndex, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft); static QString pageProperty(QWebFrame* frame, const QString& propertyName, int pageNumber); static void addUserStyleSheet(QWebPage* page, const QString& sourceCode); - + static void simulateDesktopNotificationClick(const QString& title); + static QString viewportAsText(QWebPage*, const QSize&); }; #endif diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 0a9a0ea..080c459 100644 --- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -612,7 +612,7 @@ void EditorClientQt::setInputMethodState(bool active) hints |= Qt::ImhDigitsOnly; if (inputElement->isEmailField()) hints |= Qt::ImhEmailCharactersOnly; - if (inputElement->isUrlField()) + if (inputElement->isURLField()) hints |= Qt::ImhUrlCharactersOnly; // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag // for password fields. The Qt platform is responsible for determining which widget diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 2d73f7f..4aadeb0 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -40,7 +40,11 @@ #include "FrameView.h" #include "DocumentLoader.h" #include "HitTestResult.h" +#if USE(JSC) #include "JSDOMWindowBase.h" +#elif USE(V8) +#include "V8DOMWindow.h" +#endif #include "MIMETypeRegistry.h" #include "MouseEvent.h" #include "ResourceResponse.h" @@ -63,6 +67,7 @@ #include "ScriptString.h" #include "Settings.h" #include "QWebPageClient.h" +#include "ViewportArguments.h" #include "qwebpage.h" #include "qwebpage_p.h" @@ -160,6 +165,7 @@ bool FrameLoaderClientQt::sendRequestReturnsNullOnRedirect = false; bool FrameLoaderClientQt::sendRequestReturnsNull = false; bool FrameLoaderClientQt::dumpResourceResponseMIMETypes = false; bool FrameLoaderClientQt::deferMainResourceDataLoad = true; +bool FrameLoaderClientQt::dumpHistoryCallbacks = false; QStringList FrameLoaderClientQt::sendRequestClearHeaders; QString FrameLoaderClientQt::dumpResourceLoadCallbacksPath; @@ -189,10 +195,10 @@ static const char* navigationTypeToString(NavigationType type) FrameLoaderClientQt::FrameLoaderClientQt() : m_frame(0) , m_webFrame(0) - , m_firstData(false) , m_pluginView(0) , m_hasSentResponseToPlugin(false) - , m_loadError (ResourceError()) + , m_hasRepresentation(false) + , m_loadError(ResourceError()) { } @@ -225,11 +231,6 @@ void FrameLoaderClientQt::setFrame(QWebFrame* webFrame, Frame* frame) m_webFrame, SIGNAL(titleChanged(QString))); } -QWebFrame* FrameLoaderClientQt::webFrame() const -{ - return m_webFrame; -} - void FrameLoaderClientQt::callPolicyFunction(FramePolicyFunction function, PolicyAction action) { (m_frame->loader()->policyChecker()->*function)(action); @@ -277,7 +278,7 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage() void FrameLoaderClientQt::makeRepresentation(DocumentLoader*) { - // don't need this for now I think. + m_hasRepresentation = true; } @@ -357,6 +358,18 @@ void FrameLoaderClientQt::dispatchDidChangeLocationWithinPage() m_webFrame->page()->d->updateNavigationActions(); } +#if USE(V8) +void FrameLoaderClientQt::didCreateScriptContextForFrame() +{ +} +void FrameLoaderClientQt::didDestroyScriptContextForFrame() +{ +} +void FrameLoaderClientQt::didCreateIsolatedScriptContext() +{ +} +#endif + void FrameLoaderClientQt::dispatchDidPushStateWithinPage() { if (dumpFrameLoaderCallbacks) @@ -429,7 +442,8 @@ void FrameLoaderClientQt::dispatchDidCommitLoad() if (m_frame->tree()->parent() || !m_webFrame) return; - m_webFrame->d->initialLayoutComplete = false; + // Clear the viewport arguments. + m_webFrame->d->viewportArguments = WebCore::ViewportArguments(); emit m_webFrame->urlChanged(m_webFrame->url()); m_webFrame->page()->d->updateNavigationActions(); @@ -443,7 +457,7 @@ void FrameLoaderClientQt::dispatchDidCommitLoad() if (!isMainFrame) return; - emit m_webFrame->page()->viewportChangeRequested(QWebPage::ViewportHints()); + emit m_webFrame->page()->viewportChangeRequested(); } @@ -481,7 +495,6 @@ void FrameLoaderClientQt::dispatchDidFinishLoad() void FrameLoaderClientQt::dispatchDidFirstLayout() { - m_webFrame->d->initialLayoutComplete = true; } void FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout() @@ -518,7 +531,7 @@ void FrameLoaderClientQt::dispatchDidLoadMainResource(DocumentLoader*) void FrameLoaderClientQt::revertToProvisionalState(DocumentLoader*) { - notImplemented(); + m_hasRepresentation = true; } @@ -582,21 +595,25 @@ void FrameLoaderClientQt::didChangeTitle(DocumentLoader*) void FrameLoaderClientQt::finishedLoading(DocumentLoader* loader) { if (!m_pluginView) { - if(m_firstData) { - FrameLoader *fl = loader->frameLoader(); - fl->writer()->setEncoding(m_response.textEncodingName(), false); - m_firstData = false; - } - } - else { - if (m_pluginView->isPluginView()) - m_pluginView->didFinishLoading(); - m_pluginView = 0; - m_hasSentResponseToPlugin = false; + // This is necessary to create an empty document. See bug 634004. + // However, we only want to do this if makeRepresentation has been called, to + // match the behavior on the Mac. + if (m_hasRepresentation) + loader->frameLoader()->writer()->setEncoding("", false); + return; } + if (m_pluginView->isPluginView()) + m_pluginView->didFinishLoading(); + m_pluginView = 0; + m_hasSentResponseToPlugin = false; } - +bool FrameLoaderClientQt::canShowMIMETypeAsHTML(const String& MIMEType) const +{ + notImplemented(); + return false; +} + bool FrameLoaderClientQt::canShowMIMEType(const String& MIMEType) const { String type = MIMEType; @@ -657,9 +674,17 @@ void FrameLoaderClientQt::prepareForDataSourceReplacement() { } -void FrameLoaderClientQt::setTitle(const String&, const KURL&) +void FrameLoaderClientQt::setTitle(const String& title, const KURL& url) { - // no need for, dispatchDidReceiveTitle is the right callback + // Used by Apple WebKit to update the title of an existing history item. + // QtWebKit doesn't accomodate this on history items. If it ever does, + // it should be privateBrowsing-aware.For now, we are just passing + // globalhistory layout tests. + if (dumpHistoryCallbacks) { + printf("WebView updated the title for history URL \"%s\" to \"%s\".\n", + qPrintable(drtDescriptionSuitableForTestResult(url)), + qPrintable(QString(title))); + } } @@ -722,12 +747,48 @@ void FrameLoaderClientQt::registerForIconNotification(bool) void FrameLoaderClientQt::updateGlobalHistory() { QWebHistoryInterface *history = QWebHistoryInterface::defaultInterface(); + WebCore::DocumentLoader* loader = m_frame->loader()->documentLoader(); if (history) - history->addHistoryEntry(m_frame->loader()->documentLoader()->urlForHistory().prettyURL()); + history->addHistoryEntry(loader->urlForHistory().prettyURL()); + + if (dumpHistoryCallbacks) { + printf("WebView navigated to url \"%s\" with title \"%s\" with HTTP equivalent method \"%s\". The navigation was %s and was %s%s.\n", + qPrintable(drtDescriptionSuitableForTestResult(loader->urlForHistory())), + qPrintable(QString(loader->title())), + qPrintable(QString(loader->request().httpMethod())), + ((loader->substituteData().isValid() || (loader->response().httpStatusCode() >= 400)) ? "a failure" : "successful"), + ((!loader->clientRedirectSourceForHistory().isEmpty()) ? "a client redirect from " : "not a client redirect"), + (!loader->clientRedirectSourceForHistory().isEmpty()) ? qPrintable(drtDescriptionSuitableForTestResult(loader->clientRedirectSourceForHistory())) : ""); + } } void FrameLoaderClientQt::updateGlobalHistoryRedirectLinks() { + // Apple WebKit is the only port that makes use of this callback. It calls + // WebCore::HistoryItem::addRedirectURL() with the contents of + // loader->[server|client]RedirectDestinationForHistory(). + // WebCore can associate a bunch of redirect URLs with a particular + // item in the history, presumably this allows Safari to skip the redirections + // when navigating to that history item. That might be a feature Qt wants to + // offer through QWebHistoryInterface in the future. For now, we're just + // passing tests in LayoutTests/http/tests/globalhistory. + WebCore::DocumentLoader* loader = m_frame->loader()->documentLoader(); + + if (!loader->clientRedirectSourceForHistory().isNull()) { + if (dumpHistoryCallbacks) { + printf("WebView performed a client redirect from \"%s\" to \"%s\".\n", + qPrintable(QString(loader->clientRedirectSourceForHistory())), + qPrintable(QString(loader->clientRedirectDestinationForHistory()))); + } + } + + if (!loader->serverRedirectSourceForHistory().isNull()) { + if (dumpHistoryCallbacks) { + printf("WebView performed a server redirect from \"%s\" to \"%s\".\n", + qPrintable(QString(loader->serverRedirectSourceForHistory())), + qPrintable(QString(loader->serverRedirectDestinationForHistory()))); + } + } } bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem *) const @@ -776,31 +837,19 @@ bool FrameLoaderClientQt::canCachePage() const void FrameLoaderClientQt::setMainDocumentError(WebCore::DocumentLoader* loader, const WebCore::ResourceError& error) { - if (!m_pluginView) { - if (m_firstData) { - loader->frameLoader()->writer()->setEncoding(m_response.textEncodingName(), false); - m_firstData = false; - } - } else { - if (m_pluginView->isPluginView()) - m_pluginView->didFail(error); - m_pluginView = 0; - m_hasSentResponseToPlugin = false; - } + if (!m_pluginView) + return; + if (m_pluginView->isPluginView()) + m_pluginView->didFail(error); + m_pluginView = 0; + m_hasSentResponseToPlugin = false; } +// FIXME: This function should be moved into WebCore. void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) { - if (!m_pluginView) { - if (!m_frame) - return; - FrameLoader *fl = loader->frameLoader(); - if (m_firstData) { - fl->writer()->setEncoding(m_response.textEncodingName(), false); - m_firstData = false; - } - fl->addData(data, length); - } + if (!m_pluginView) + loader->commitData(data, length); // We re-check here as the plugin can have been created if (m_pluginView && m_pluginView->isPluginView()) { @@ -887,7 +936,12 @@ WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClientQt::createDocumentLoad // Use the default timeout interval for JS as the HTML tokenizer delay. This ensures // that long-running JavaScript will still allow setHtml() to be synchronous, while // still giving a reasonable timeout to prevent deadlock. +#if USE(JSC) double delay = JSDOMWindowBase::commonJSGlobalData()->timeoutChecker.timeoutInterval() / 1000.0f; +#elif USE(V8) + // FIXME: Hard coded for now. + double delay = 10000 / 1000.0f; +#endif m_frame->page()->setCustomHTMLTokenizerTimeDelay(delay); } else m_frame->page()->setCustomHTMLTokenizerTimeDelay(-1); @@ -961,7 +1015,6 @@ void FrameLoaderClientQt::dispatchDidReceiveResponse(WebCore::DocumentLoader*, u { m_response = response; - m_firstData = true; if (dumpResourceLoadCallbacks) printf("%s - didReceiveResponse %s\n", qPrintable(dumpAssignedUrls[identifier]), @@ -991,12 +1044,6 @@ void FrameLoaderClientQt::dispatchDidFailLoading(WebCore::DocumentLoader* loader printf("%s - didFailLoadingWithError: %s\n", (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"), qPrintable(drtDescriptionSuitableForTestResult(error))); - - if (m_firstData) { - FrameLoader *fl = loader->frameLoader(); - fl->writer()->setEncoding(m_response.textEncodingName(), false); - m_firstData = false; - } } bool FrameLoaderClientQt::dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int) @@ -1518,7 +1565,7 @@ String FrameLoaderClientQt::overrideMediaType() const QString FrameLoaderClientQt::chooseFile(const QString& oldFile) { - return webFrame()->page()->chooseFile(webFrame(), oldFile); + return m_webFrame->page()->chooseFile(m_webFrame, oldFile); } PassRefPtr<FrameNetworkingContext> FrameLoaderClientQt::createNetworkingContext() diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index e506900..fffda58 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -75,7 +75,6 @@ public: virtual void frameLoaderDestroyed(); void setFrame(QWebFrame* webFrame, Frame* frame); - QWebFrame* webFrame() const; virtual bool hasWebView() const; // mainly for assertions @@ -174,6 +173,7 @@ public: virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; virtual bool canShowMIMEType(const String& MIMEType) const; + virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const; virtual bool representationExistsForURLScheme(const String& URLScheme) const; virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const; @@ -211,6 +211,21 @@ public: virtual void documentElementAvailable(); virtual void didPerformFirstNavigation() const; +#if USE(V8) + // A frame's V8 context was created or destroyed. + virtual void didCreateScriptContextForFrame(); + virtual void didDestroyScriptContextForFrame(); + + // A context untied to a frame was created (through evaluateInIsolatedWorld). + // This context is not tied to the lifetime of its frame, and is destroyed + // in garbage collection. + virtual void didCreateIsolatedScriptContext(); + + // Returns true if we should allow the given V8 extension to be added to + // the script context at the currently loading page and given extension group. + virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) { return false; } +#endif + virtual void registerForIconNotification(bool); QString chooseFile(const QString& oldFile); @@ -227,17 +242,22 @@ public: static bool policyDelegateEnabled; static bool policyDelegatePermissive; static bool deferMainResourceDataLoad; + static bool dumpHistoryCallbacks; private: Frame *m_frame; QWebFrame *m_webFrame; ResourceResponse m_response; - bool m_firstData; // Plugin view to redirect data to WebCore::PluginView* m_pluginView; bool m_hasSentResponseToPlugin; + // True if makeRepresentation was called. We don't actually have a concept + // of a "representation", but we need to know when we're expected to have one. + // See finishedLoading(). + bool m_hasRepresentation; + ResourceError m_loadError; }; diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 55aca7f..e6e6fde 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -37,12 +37,14 @@ #include "Page.h" #include "PlatformString.h" #include "ScriptController.h" +#include "ScriptDebugServer.h" #include "qwebinspector.h" #include "qwebinspector_p.h" #include "qwebpage.h" #include "qwebpage_p.h" #include "qwebview.h" #include <QtCore/QCoreApplication> +#include <QtCore/QFile> #include <QtCore/QSettings> #include <QtCore/QVariant> @@ -93,6 +95,22 @@ public slots: } }; +#if USE(V8) +static void ensureDebuggerScriptLoaded() +{ + static bool scriptLoaded = false; + if (scriptLoaded) + return; + + QFile debuggerScriptFile(":/webkit/inspector/DebuggerScript.js"); + if (debuggerScriptFile.open(QIODevice::ReadOnly)) { + QByteArray ba = debuggerScriptFile.readAll(); + ScriptDebugServer::shared().setDebuggerScriptSource(String(ba.constData(), ba.length())); + scriptLoaded = true; + } +} +#endif + InspectorClientQt::InspectorClientQt(QWebPage* page) : m_inspectedWebPage(page) , m_frontendWebPage(0) @@ -109,6 +127,10 @@ void InspectorClientQt::inspectorDestroyed() void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController*) { +#if USE(V8) + ensureDebuggerScriptLoaded(); +#endif + QWebView* inspectorView = new QWebView; InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView); inspectorView->setPage(inspectorPage); diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp index c24c4d5..7b33d9e 100644 --- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp @@ -118,6 +118,26 @@ const QByteArray NotificationWrapper::iconData() const return iconData; } +const QUrl NotificationWrapper::openerPageUrl() const +{ + QUrl url; +#if ENABLE(NOTIFICATIONS) + Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this); + if (notification) { + if (notification->scriptExecutionContext()) + url = static_cast<Document*>(notification->scriptExecutionContext())->page()->mainFrame()->document()->url(); + } +#endif + return url; +} + +void NotificationWrapper::notificationClicked() +{ +#if ENABLE(NOTIFICATIONS) + NotificationPresenterClientQt::notificationPresenter()->notificationClicked(this); +#endif +} + void NotificationWrapper::notificationClosed() { #if ENABLE(NOTIFICATIONS) @@ -204,11 +224,13 @@ void NotificationPresenterClientQt::displayNotification(Notification* notificati if (wrapper->m_presenter) { wrapper->connect(wrapper->m_presenter.get(), SIGNAL(notificationClosed()), wrapper, SLOT(notificationClosed()), Qt::QueuedConnection); + wrapper->connect(wrapper->m_presenter.get(), SIGNAL(notificationClicked()), wrapper, SLOT(notificationClicked())); wrapper->m_presenter->showNotification(wrapper); return; } #ifndef QT_NO_SYSTEMTRAYICON + wrapper->connect(wrapper->m_notificationIcon.get(), SIGNAL(messageClicked()), wrapper, SLOT(notificationClicked())); wrapper->m_notificationIcon->show(); wrapper->m_notificationIcon->showMessage(notification->contents().title(), notification->contents().body()); #endif @@ -237,6 +259,35 @@ void NotificationPresenterClientQt::cancel(NotificationWrapper* wrapper) cancel(notification); } +void NotificationPresenterClientQt::notificationClicked(NotificationWrapper* wrapper) +{ + Notification* notification = notificationForWrapper(wrapper); + if (notification) + sendEvent(notification, eventNames().clickEvent); +} + +void NotificationPresenterClientQt::notificationClicked(const QString& title) +{ + if (!dumpNotification) + return; + NotificationsQueue::ConstIterator end = m_notifications.end(); + NotificationsQueue::ConstIterator iter = m_notifications.begin(); + Notification* notification = 0; + while (iter != end) { + notification = iter.key(); + QString notificationTitle; + if (notification->isHTML()) + notificationTitle = notification->url().string(); + else + notificationTitle = notification->contents().title(); + if (notificationTitle == title) + break; + iter++; + } + if (notification) + sendEvent(notification, eventNames().clickEvent); +} + Notification* NotificationPresenterClientQt::notificationForWrapper(const NotificationWrapper* wrapper) const { NotificationsQueue::ConstIterator end = m_notifications.end(); diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h index e8481d4..2520f6c 100644 --- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h +++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h @@ -61,9 +61,11 @@ public: const QString title() const; const QString message() const; const QByteArray iconData() const; + const QUrl openerPageUrl() const; public Q_SLOTS: void notificationClosed(); + void notificationClicked(); public: #ifndef QT_NO_SYSTEMTRAYICON @@ -102,6 +104,8 @@ public: static NotificationPresenterClientQt* notificationPresenter(); Notification* notificationForWrapper(const NotificationWrapper*) const; + void notificationClicked(NotificationWrapper*); + void notificationClicked(const QString& title); private: void sendEvent(Notification*, const AtomicString& eventName); diff --git a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp index 3b53476..3f69a47 100644 --- a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp +++ b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp @@ -232,6 +232,7 @@ void QtFallbackWebPopup::populate(const QWebSelectData& data) case QWebSelectData::Option: m_combo->insertItem(i, data.itemText(i)); model->item(i)->setEnabled(data.itemIsEnabled(i)); + model->item(i)->setToolTip(data.itemToolTip(i)); if (data.itemIsSelected(i)) currentIndex = i; break; diff --git a/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp new file mode 100644 index 0000000..948e0cd --- /dev/null +++ b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp @@ -0,0 +1,675 @@ +/* + * Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008 Collabora Ltd. All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 INdT - Instituto Nokia de Tecnologia + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebPlatformStrategies.h" + +#include "NotImplemented.h" +#include <IntSize.h> +#include <Page.h> +#include <PageGroup.h> +#include <PluginDatabase.h> +#include <QCoreApplication> +#include <QLocale> +#include <qwebpage.h> +#include <qwebpluginfactory.h> +#include <wtf/MathExtras.h> + +using namespace WebCore; + +void WebPlatformStrategies::initialize(QWebPage* webPage) +{ + DEFINE_STATIC_LOCAL(WebPlatformStrategies, platformStrategies, (webPage)); + Q_UNUSED(platformStrategies); +} + +WebPlatformStrategies::WebPlatformStrategies(QWebPage* webPage) + : m_page(webPage) +{ + setPlatformStrategies(this); +} + + +// PluginStrategy + +PluginStrategy* WebPlatformStrategies::createPluginStrategy() +{ + return this; +} + +LocalizationStrategy* WebPlatformStrategies::createLocalizationStrategy() +{ + return this; +} + +VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy() +{ + return this; +} + +void WebPlatformStrategies::refreshPlugins() +{ + PluginDatabase::installedPlugins()->refresh(); +} + +void WebPlatformStrategies::getPluginInfo(Vector<WebCore::PluginInfo>& outPlugins) +{ + QWebPluginFactory* factory = m_page->pluginFactory(); + if (factory) { + + QList<QWebPluginFactory::Plugin> qplugins = factory->plugins(); + for (int i = 0; i < qplugins.count(); ++i) { + const QWebPluginFactory::Plugin& qplugin = qplugins.at(i); + PluginInfo info; + info.name = qplugin.name; + info.desc = qplugin.description; + + for (int j = 0; j < qplugin.mimeTypes.count(); ++j) { + const QWebPluginFactory::MimeType& mimeType = qplugin.mimeTypes.at(j); + + MimeClassInfo mimeInfo; + mimeInfo.type = mimeType.name; + mimeInfo.desc = mimeType.description; + for (int k = 0; k < mimeType.fileExtensions.count(); ++k) + mimeInfo.extensions.append(mimeType.fileExtensions.at(k)); + + info.mimes.append(mimeInfo); + } + outPlugins.append(info); + } + } + + PluginDatabase* db = PluginDatabase::installedPlugins(); + const Vector<PluginPackage*> &plugins = db->plugins(); + + outPlugins.resize(plugins.size()); + + for (unsigned int i = 0; i < plugins.size(); ++i) { + PluginInfo info; + PluginPackage* package = plugins[i]; + + info.name = package->name(); + info.file = package->fileName(); + info.desc = package->description(); + + const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions(); + MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end(); + for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) { + MimeClassInfo mime; + + mime.type = it->first; + mime.desc = it->second; + mime.extensions = package->mimeToExtensions().get(mime.type); + + info.mimes.append(mime); + } + + outPlugins.append(info); + } + +} + + +// LocalizationStrategy + +String WebPlatformStrategies::inputElementAltText() +{ + return QCoreApplication::translate("QWebPage", "Submit", "Submit (input element) alt text for <input> elements with no alt, title, or value"); +} + +String WebPlatformStrategies::resetButtonDefaultLabel() +{ + return QCoreApplication::translate("QWebPage", "Reset", "default label for Reset buttons in forms on web pages"); +} + +String WebPlatformStrategies::searchableIndexIntroduction() +{ + return QCoreApplication::translate("QWebPage", "This is a searchable index. Enter search keywords: ", "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'"); +} + +String WebPlatformStrategies::submitButtonDefaultLabel() +{ + return QCoreApplication::translate("QWebPage", "Submit", "default label for Submit buttons in forms on web pages"); +} + +String WebPlatformStrategies::fileButtonChooseFileLabel() +{ + return QCoreApplication::translate("QWebPage", "Choose File", "title for file button used in HTML forms"); +} + +String WebPlatformStrategies::fileButtonNoFileSelectedLabel() +{ + return QCoreApplication::translate("QWebPage", "No file selected", "text to display in file button used in HTML forms when no file is selected"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenLinkInNewWindow() +{ + return QCoreApplication::translate("QWebPage", "Open in New Window", "Open in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagDownloadLinkToDisk() +{ + return QCoreApplication::translate("QWebPage", "Save Link...", "Download Linked File context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopyLinkToClipboard() +{ + return QCoreApplication::translate("QWebPage", "Copy Link", "Copy Link context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenImageInNewWindow() +{ + return QCoreApplication::translate("QWebPage", "Open Image", "Open Image in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagDownloadImageToDisk() +{ + return QCoreApplication::translate("QWebPage", "Save Image", "Download Image context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard() +{ + return QCoreApplication::translate("QWebPage", "Copy Image", "Copy Link context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow() +{ + return QCoreApplication::translate("QWebPage", "Open Frame", "Open Frame in New Window context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCopy() +{ + return QCoreApplication::translate("QWebPage", "Copy", "Copy context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagGoBack() +{ + return QCoreApplication::translate("QWebPage", "Go Back", "Back context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagGoForward() +{ + return QCoreApplication::translate("QWebPage", "Go Forward", "Forward context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagStop() +{ + return QCoreApplication::translate("QWebPage", "Stop", "Stop context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagReload() +{ + return QCoreApplication::translate("QWebPage", "Reload", "Reload context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCut() +{ + return QCoreApplication::translate("QWebPage", "Cut", "Cut context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagPaste() +{ + return QCoreApplication::translate("QWebPage", "Paste", "Paste context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagNoGuessesFound() +{ + return QCoreApplication::translate("QWebPage", "No Guesses Found", "No Guesses Found context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagIgnoreSpelling() +{ + return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagLearnSpelling() +{ + return QCoreApplication::translate("QWebPage", "Add To Dictionary", "Learn Spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSearchWeb() +{ + return QCoreApplication::translate("QWebPage", "Search The Web", "Search The Web context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary() +{ + return QCoreApplication::translate("QWebPage", "Look Up In Dictionary", "Look Up in Dictionary context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenLink() +{ + return QCoreApplication::translate("QWebPage", "Open Link", "Open Link context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagIgnoreGrammar() +{ + return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Grammar context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagSpellingMenu() +{ + return QCoreApplication::translate("QWebPage", "Spelling", "Spelling and Grammar context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagShowSpellingPanel(bool show) +{ + return show ? QCoreApplication::translate("QWebPage", "Show Spelling and Grammar", "menu item title") : + QCoreApplication::translate("QWebPage", "Hide Spelling and Grammar", "menu item title"); +} + +String WebPlatformStrategies::contextMenuItemTagCheckSpelling() +{ + return QCoreApplication::translate("QWebPage", "Check Spelling", "Check spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCheckSpellingWhileTyping() +{ + return QCoreApplication::translate("QWebPage", "Check Spelling While Typing", "Check spelling while typing context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagCheckGrammarWithSpelling() +{ + return QCoreApplication::translate("QWebPage", "Check Grammar With Spelling", "Check grammar with spelling context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagFontMenu() +{ + return QCoreApplication::translate("QWebPage", "Fonts", "Font context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagBold() +{ + return QCoreApplication::translate("QWebPage", "Bold", "Bold context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagItalic() +{ + return QCoreApplication::translate("QWebPage", "Italic", "Italic context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagUnderline() +{ + return QCoreApplication::translate("QWebPage", "Underline", "Underline context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagOutline() +{ + return QCoreApplication::translate("QWebPage", "Outline", "Outline context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagWritingDirectionMenu() +{ + return QCoreApplication::translate("QWebPage", "Direction", "Writing direction context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagTextDirectionMenu() +{ + return QCoreApplication::translate("QWebPage", "Text Direction", "Text direction context sub-menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagDefaultDirection() +{ + return QCoreApplication::translate("QWebPage", "Default", "Default writing direction context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagLeftToRight() +{ + return QCoreApplication::translate("QWebPage", "Left to Right", "Left to Right context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagRightToLeft() +{ + return QCoreApplication::translate("QWebPage", "Right to Left", "Right to Left context menu item"); +} + +String WebPlatformStrategies::contextMenuItemTagInspectElement() +{ + return QCoreApplication::translate("QWebPage", "Inspect", "Inspect Element context menu item"); +} + +String WebPlatformStrategies::searchMenuNoRecentSearchesText() +{ + return QCoreApplication::translate("QWebPage", "No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed"); +} + +String WebPlatformStrategies::searchMenuRecentSearchesText() +{ + return QCoreApplication::translate("QWebPage", "Recent searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title"); +} + +String WebPlatformStrategies::searchMenuClearRecentSearchesText() +{ + return QCoreApplication::translate("QWebPage", "Clear recent searches", "menu item in Recent Searches menu that empties menu's contents"); +} + +String WebPlatformStrategies::AXWebAreaText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXLinkText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXListMarkerText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXImageMapText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXHeadingText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXDefinitionListTermText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXDefinitionListDefinitionText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXButtonActionVerb() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXRadioButtonActionVerb() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXTextFieldActionVerb() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXCheckedCheckBoxActionVerb() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXUncheckedCheckBoxActionVerb() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXMenuListActionVerb() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXMenuListPopupActionVerb() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::AXLinkActionVerb() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::missingPluginText() +{ + return QCoreApplication::translate("QWebPage", "Missing Plug-in", "Label text to be used when a plug-in is missing"); +} + +String WebPlatformStrategies::crashedPluginText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::multipleFileUploadText(unsigned) +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::unknownFileSizeText() +{ + return QCoreApplication::translate("QWebPage", "Unknown", "Unknown filesize FTP directory listing item"); +} + +String WebPlatformStrategies::imageTitle(const String& filename, const IntSize& size) +{ + return QCoreApplication::translate("QWebPage", "%1 (%2x%3 pixels)", "Title string for images").arg(filename).arg(size.width()).arg(size.height()); +} + +String WebPlatformStrategies::mediaElementLoadingStateText() +{ + return QCoreApplication::translate("QWebPage", "Loading...", "Media controller status message when the media is loading"); +} + +String WebPlatformStrategies::mediaElementLiveBroadcastStateText() +{ + return QCoreApplication::translate("QWebPage", "Live Broadcast", "Media controller status message when watching a live broadcast"); +} + +#if ENABLE(VIDEO) + +String WebPlatformStrategies::localizedMediaControlElementString(const String& name) +{ + if (name == "AudioElement") + return QCoreApplication::translate("QWebPage", "Audio Element", "Media controller element"); + if (name == "VideoElement") + return QCoreApplication::translate("QWebPage", "Video Element", "Media controller element"); + if (name == "MuteButton") + return QCoreApplication::translate("QWebPage", "Mute Button", "Media controller element"); + if (name == "UnMuteButton") + return QCoreApplication::translate("QWebPage", "Unmute Button", "Media controller element"); + if (name == "PlayButton") + return QCoreApplication::translate("QWebPage", "Play Button", "Media controller element"); + if (name == "PauseButton") + return QCoreApplication::translate("QWebPage", "Pause Button", "Media controller element"); + if (name == "Slider") + return QCoreApplication::translate("QWebPage", "Slider", "Media controller element"); + if (name == "SliderThumb") + return QCoreApplication::translate("QWebPage", "Slider Thumb", "Media controller element"); + if (name == "RewindButton") + return QCoreApplication::translate("QWebPage", "Rewind Button", "Media controller element"); + if (name == "ReturnToRealtimeButton") + return QCoreApplication::translate("QWebPage", "Return to Real-time Button", "Media controller element"); + if (name == "CurrentTimeDisplay") + return QCoreApplication::translate("QWebPage", "Elapsed Time", "Media controller element"); + if (name == "TimeRemainingDisplay") + return QCoreApplication::translate("QWebPage", "Remaining Time", "Media controller element"); + if (name == "StatusDisplay") + return QCoreApplication::translate("QWebPage", "Status Display", "Media controller element"); + if (name == "FullscreenButton") + return QCoreApplication::translate("QWebPage", "Fullscreen Button", "Media controller element"); + if (name == "SeekForwardButton") + return QCoreApplication::translate("QWebPage", "Seek Forward Button", "Media controller element"); + if (name == "SeekBackButton") + return QCoreApplication::translate("QWebPage", "Seek Back Button", "Media controller element"); + + return String(); +} + +String WebPlatformStrategies::localizedMediaControlElementHelpText(const String& name) +{ + if (name == "AudioElement") + return QCoreApplication::translate("QWebPage", "Audio element playback controls and status display", "Media controller element"); + if (name == "VideoElement") + return QCoreApplication::translate("QWebPage", "Video element playback controls and status display", "Media controller element"); + if (name == "MuteButton") + return QCoreApplication::translate("QWebPage", "Mute audio tracks", "Media controller element"); + if (name == "UnMuteButton") + return QCoreApplication::translate("QWebPage", "Unmute audio tracks", "Media controller element"); + if (name == "PlayButton") + return QCoreApplication::translate("QWebPage", "Begin playback", "Media controller element"); + if (name == "PauseButton") + return QCoreApplication::translate("QWebPage", "Pause playback", "Media controller element"); + if (name == "Slider") + return QCoreApplication::translate("QWebPage", "Movie time scrubber", "Media controller element"); + if (name == "SliderThumb") + return QCoreApplication::translate("QWebPage", "Movie time scrubber thumb", "Media controller element"); + if (name == "RewindButton") + return QCoreApplication::translate("QWebPage", "Rewind movie", "Media controller element"); + if (name == "ReturnToRealtimeButton") + return QCoreApplication::translate("QWebPage", "Return streaming movie to real-time", "Media controller element"); + if (name == "CurrentTimeDisplay") + return QCoreApplication::translate("QWebPage", "Current movie time", "Media controller element"); + if (name == "TimeRemainingDisplay") + return QCoreApplication::translate("QWebPage", "Remaining movie time", "Media controller element"); + if (name == "StatusDisplay") + return QCoreApplication::translate("QWebPage", "Current movie status", "Media controller element"); + if (name == "FullscreenButton") + return QCoreApplication::translate("QWebPage", "Play movie in full-screen mode", "Media controller element"); + if (name == "SeekForwardButton") + return QCoreApplication::translate("QWebPage", "Seek quickly back", "Media controller element"); + if (name == "SeekBackButton") + return QCoreApplication::translate("QWebPage", "Seek quickly forward", "Media controller element"); + + ASSERT_NOT_REACHED(); + return String(); +} + +String WebPlatformStrategies::localizedMediaTimeDescription(float time) +{ + if (!isfinite(time)) + return QCoreApplication::translate("QWebPage", "Indefinite time", "Media time description"); + + 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 QCoreApplication::translate("QWebPage", "%1 days %2 hours %3 minutes %4 seconds", "Media time description").arg(days).arg(hours).arg(minutes).arg(seconds); + + if (hours) + return QCoreApplication::translate("QWebPage", "%1 hours %2 minutes %3 seconds", "Media time description").arg(hours).arg(minutes).arg(seconds); + + if (minutes) + return QCoreApplication::translate("QWebPage", "%1 minutes %2 seconds", "Media time description").arg(minutes).arg(seconds); + + return QCoreApplication::translate("QWebPage", "%1 seconds", "Media time description").arg(seconds); +} + +#else // ENABLE(VIDEO) +// FIXME: #if ENABLE(VIDEO) should be in the base class + +String WebPlatformStrategies::localizedMediaControlElementString(const String& name) +{ + return String(); +} + +String WebPlatformStrategies::localizedMediaControlElementHelpText(const String& name) +{ + return String(); +} + +String WebPlatformStrategies::localizedMediaTimeDescription(float time) +{ + return String(); +} + +#endif // ENABLE(VIDEO) + + +String WebPlatformStrategies::validationMessageValueMissingText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::validationMessageTypeMismatchText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::validationMessagePatternMismatchText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::validationMessageTooLongText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::validationMessageRangeUnderflowText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::validationMessageRangeOverflowText() +{ + notImplemented(); + return String(); +} + +String WebPlatformStrategies::validationMessageStepMismatchText() +{ + notImplemented(); + return String(); +} + + +// VisitedLinkStrategy + +bool WebPlatformStrategies::isLinkVisited(Page* page, LinkHash hash) +{ + return page->group().isLinkVisited(hash); +} + +void WebPlatformStrategies::addVisitedLink(Page* page, LinkHash hash) +{ + page->group().addVisitedLinkHash(hash); +} diff --git a/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h new file mode 100644 index 0000000..8ea60d9 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 INdT - Instituto Nokia de Tecnologia + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPlatformStrategies_h +#define WebPlatformStrategies_h + +#include <LocalizationStrategy.h> +#include <PlatformStrategies.h> +#include <PluginStrategy.h> +#include <VisitedLinkStrategy.h> + +class QWebPage; + +class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy, private WebCore::VisitedLinkStrategy { +public: + static void initialize(QWebPage* webPage); + +private: + WebPlatformStrategies(QWebPage* webPage); + + // WebCore::PlatformStrategies + virtual WebCore::PluginStrategy* createPluginStrategy(); + virtual WebCore::LocalizationStrategy* createLocalizationStrategy(); + virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy(); + + // WebCore::PluginStrategy + virtual void refreshPlugins(); + virtual void getPluginInfo(Vector<WebCore::PluginInfo>&); + + // WebCore::LocalizationStrategy + virtual WTF::String inputElementAltText(); + virtual WTF::String resetButtonDefaultLabel(); + virtual WTF::String searchableIndexIntroduction(); + virtual WTF::String submitButtonDefaultLabel(); + virtual WTF::String fileButtonChooseFileLabel(); + virtual WTF::String fileButtonNoFileSelectedLabel(); + virtual WTF::String contextMenuItemTagOpenLinkInNewWindow(); + virtual WTF::String contextMenuItemTagDownloadLinkToDisk(); + virtual WTF::String contextMenuItemTagCopyLinkToClipboard(); + virtual WTF::String contextMenuItemTagOpenImageInNewWindow(); + virtual WTF::String contextMenuItemTagDownloadImageToDisk(); + virtual WTF::String contextMenuItemTagCopyImageToClipboard(); + virtual WTF::String contextMenuItemTagOpenFrameInNewWindow(); + virtual WTF::String contextMenuItemTagCopy(); + virtual WTF::String contextMenuItemTagGoBack(); + virtual WTF::String contextMenuItemTagGoForward(); + virtual WTF::String contextMenuItemTagStop(); + virtual WTF::String contextMenuItemTagReload(); + virtual WTF::String contextMenuItemTagCut(); + virtual WTF::String contextMenuItemTagPaste(); + virtual WTF::String contextMenuItemTagNoGuessesFound(); + virtual WTF::String contextMenuItemTagIgnoreSpelling(); + virtual WTF::String contextMenuItemTagLearnSpelling(); + virtual WTF::String contextMenuItemTagSearchWeb(); + virtual WTF::String contextMenuItemTagLookUpInDictionary(); + virtual WTF::String contextMenuItemTagOpenLink(); + virtual WTF::String contextMenuItemTagIgnoreGrammar(); + virtual WTF::String contextMenuItemTagSpellingMenu(); + virtual WTF::String contextMenuItemTagShowSpellingPanel(bool show); + virtual WTF::String contextMenuItemTagCheckSpelling(); + virtual WTF::String contextMenuItemTagCheckSpellingWhileTyping(); + virtual WTF::String contextMenuItemTagCheckGrammarWithSpelling(); + virtual WTF::String contextMenuItemTagFontMenu(); + virtual WTF::String contextMenuItemTagBold(); + virtual WTF::String contextMenuItemTagItalic(); + virtual WTF::String contextMenuItemTagUnderline(); + virtual WTF::String contextMenuItemTagOutline(); + virtual WTF::String contextMenuItemTagWritingDirectionMenu(); + virtual WTF::String contextMenuItemTagTextDirectionMenu(); + virtual WTF::String contextMenuItemTagDefaultDirection(); + virtual WTF::String contextMenuItemTagLeftToRight(); + virtual WTF::String contextMenuItemTagRightToLeft(); + virtual WTF::String contextMenuItemTagInspectElement(); + virtual WTF::String searchMenuNoRecentSearchesText(); + virtual WTF::String searchMenuRecentSearchesText(); + virtual WTF::String searchMenuClearRecentSearchesText(); + virtual WTF::String AXWebAreaText(); + virtual WTF::String AXLinkText(); + virtual WTF::String AXListMarkerText(); + virtual WTF::String AXImageMapText(); + virtual WTF::String AXHeadingText(); + virtual WTF::String AXDefinitionListTermText(); + virtual WTF::String AXDefinitionListDefinitionText(); + virtual WTF::String AXButtonActionVerb(); + virtual WTF::String AXRadioButtonActionVerb(); + virtual WTF::String AXTextFieldActionVerb(); + virtual WTF::String AXCheckedCheckBoxActionVerb(); + virtual WTF::String AXUncheckedCheckBoxActionVerb(); + virtual WTF::String AXMenuListActionVerb(); + virtual WTF::String AXMenuListPopupActionVerb(); + virtual WTF::String AXLinkActionVerb(); + virtual WTF::String missingPluginText(); + virtual WTF::String crashedPluginText(); + virtual WTF::String multipleFileUploadText(unsigned numberOfFiles); + virtual WTF::String unknownFileSizeText(); + virtual WTF::String imageTitle(const WTF::String& filename, const WebCore::IntSize&); + virtual WTF::String mediaElementLoadingStateText(); + virtual WTF::String mediaElementLiveBroadcastStateText(); + virtual WTF::String localizedMediaControlElementString(const WTF::String&); + virtual WTF::String localizedMediaControlElementHelpText(const WTF::String&); + virtual WTF::String localizedMediaTimeDescription(float); + virtual WTF::String validationMessageValueMissingText(); + virtual WTF::String validationMessageTypeMismatchText(); + virtual WTF::String validationMessagePatternMismatchText(); + virtual WTF::String validationMessageTooLongText(); + virtual WTF::String validationMessageRangeUnderflowText(); + virtual WTF::String validationMessageRangeOverflowText(); + virtual WTF::String validationMessageStepMismatchText(); + + // WebCore::VisitedLinkStrategy + virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash); + virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash); + + QWebPage* m_page; +}; + +#endif // WebPlatformStrategies_h diff --git a/WebKit/qt/declarative/qdeclarativewebview.cpp b/WebKit/qt/declarative/qdeclarativewebview.cpp index 9dcba60..94f08bd 100644 --- a/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -91,7 +91,6 @@ GraphicsWebView::GraphicsWebView(QDeclarativeWebView* parent) void GraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent* event) { - setFocus(); pressPoint = event->pos(); if (pressTime) { pressTimer.start(pressTime, this); @@ -101,6 +100,11 @@ void GraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent* event) parent->setKeepMouseGrab(true); } QGraphicsWebView::mousePressEvent(event); + + QWebHitTestResult hit = page()->mainFrame()->hitTestContent(pressPoint.toPoint()); + if (hit.isContentEditable()) + parent->forceActiveFocus(); + setFocus(); } void GraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) @@ -139,47 +143,78 @@ void GraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* event) /*! \qmlclass WebView QDeclarativeWebView + \ingroup qml-view-elements \since 4.7 - \brief The WebView item allows you to add web content to a canvas. + \brief The WebView item allows you to add Web content to a canvas. \inherits Item - A WebView renders web content based on a URL. + A WebView renders Web content based on a URL. This type is made available by importing the \c QtWebKit module: \bold{import QtWebKit 1.0} - 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 for typical online web pages. + The WebView item includes no scrolling, scaling, toolbars, or other common browser + components. These must be implemented around WebView. See the \l{QML Web Browser} + example for a demonstration of this. - If the width or height is explictly set, the rendered website - will be clipped, not scaled, to fit into the set dimensions. + The page to be displayed by the item is specified using the \l url property, + and this can be changed to fetch and display a new page. While the page loads, + the \l progress property is updated to indicate how much of the page has been + loaded. - If the preferredWidth is set, the width will be this amount or larger, - usually laying out the web content to fit the preferredWidth. + \section1 Appearance - \qml - import QtWebKit 1.0 + 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 for typical + online web pages, typically greater than 800 by 600 pixels. - WebView { - url: "http://www.nokia.com" - preferredWidth: 490 - preferredHeight: 400 - scale: 0.5 - smooth: false - smoothCache: true - } - \endqml + If the \l{Item::}{width} or \l{Item::}{height} is explictly set, the rendered Web site will be + clipped, not scaled, to fit into the set dimensions. - \image webview.png + If the preferredWidth property is set, the width will be this amount or larger, + usually laying out the Web content to fit the preferredWidth. - The item includes no scrolling, scaling, - toolbars, etc., those must be implemented around WebView. See the WebBrowser example - for a demonstration of this. + The appearance of the content can be controlled to a certain extent by changing + the settings.standardFontFamily property and other settings related to fonts. + + The page can be zoomed by calling the heuristicZoom() method, which performs a + series of tests to determine whether zoomed content will be displayed in an + appropriate way in the space allocated to the item. + + \section1 User Interaction and Navigation + + By default, certain mouse and touch events are delivered to other items in + preference to the Web content. For example, when a scrolling view is created + by placing a WebView in a Flickable, move events are delivered to the Flickable + so that the user can scroll the page. This prevents the user from accidentally + selecting text in a Web page instead of scrolling. + + The pressGrabTime property defines the time the user must touch or press a + mouse button over the WebView before the Web content will receive the move + events it needs to select text and images. + + When this item has keyboard focus, all keyboard input will be sent directly to + the Web page within. + + When the navigates by clicking on links, the item records the pages visited + in its internal history + + Because this item is designed to be used as a component in a browser, it + exposes \l{Action}{actions} for \l back, \l forward, \l reload and \l stop. + These can be triggered to change the current page displayed by the item. + + \section1 Example Usage + + \beginfloatright + \inlineimage webview.png + \endfloat + + The following example displays a scaled down Web page at a fixed size. + + \snippet doc/src/snippets/declarative/webview/webview.qml document - When this item has keyboard focus, all keyboard input will be sent directly to the - web page within. + \clearfloat \sa {declarative/modelviews/webview}{WebView example}, {demos/declarative/webbrowser}{Web Browser demo} */ @@ -388,7 +423,7 @@ void QDeclarativeWebView::setPreferredHeight(int height) } /*! - \qmlmethod bool WebView::evaluateJavaScript(string) + \qmlmethod bool WebView::evaluateJavaScript(string scriptSource) Evaluates the \a scriptSource JavaScript inside the context of the main web frame, and returns the result of the last executed statement. @@ -512,14 +547,14 @@ void QDeclarativeWebView::setRenderingEnabled(bool enabled) } /*! - \qmlsignal WebView::onDoubleClick(clickx, clicky) + \qmlsignal WebView::onDoubleClick(int clickx, int clicky) The WebView does not pass double-click events to the web engine, but rather emits this signals. */ /*! - \qmlmethod bool WebView::heuristicZoom(clickX,clickY,maxzoom) + \qmlmethod bool WebView::heuristicZoom(int clickX, int clickY, real maxzoom) Finds a zoom that: \list @@ -554,11 +589,11 @@ bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxZoom) \qmlproperty int WebView::pressGrabTime The number of milliseconds the user must press before the WebView - starts passing move events through to the web engine (rather than + starts passing move events through to the Web engine (rather than letting other QML elements such as a Flickable take them). Defaults to 400ms. Set to 0 to always grab and pass move events to - the web engine. + the Web engine. */ int QDeclarativeWebView::pressGrabTime() const { @@ -975,7 +1010,7 @@ QString QDeclarativeWebPage::chooseFile(QWebFrame* originatingFrame, const QStri } /*! - \qmlsignal WebView::onAlert(message) + \qmlsignal WebView::onAlert(string message) The handler is called when the web engine sends a JavaScript alert. The \a message is the text to be displayed in the alert to the user. diff --git a/WebKit/qt/docs/qtwebkit.qdoc b/WebKit/qt/docs/qtwebkit.qdoc index d3f5502..0335d46 100644 --- a/WebKit/qt/docs/qtwebkit.qdoc +++ b/WebKit/qt/docs/qtwebkit.qdoc @@ -1,6 +1,6 @@ /*! \module QtWebKit - \title QtWebKit Module + \title WebKit in Qt \contentspage All Qt Modules \previouspage QtSvg \nextpage QtXml diff --git a/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp b/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp index c992236..d991ab1 100644 --- a/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp +++ b/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp @@ -57,7 +57,11 @@ void WebNotificationWidget::showNotification(const QWebNotificationData* data) bool WebNotificationWidget::event(QEvent* ev) { - if (ev->type() == QEvent::MouseButtonRelease || ev->type() == QEvent::Close) { + if (ev->type() == QEvent::MouseButtonRelease) { + emit notificationClicked(); + return true; + } + if (ev->type() == QEvent::Close) { emit notificationClosed(); return true; } diff --git a/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h b/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h index a2563b2..f46e5cb 100644 --- a/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h +++ b/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h @@ -36,6 +36,7 @@ public: Q_SIGNALS: void notificationClosed(); + void notificationClicked(); }; class WebNotificationPresenter : public QWebNotificationPresenter @@ -47,6 +48,7 @@ public: { m_widget = new WebNotificationWidget(); connect(m_widget, SIGNAL(notificationClosed()), this, SIGNAL(notificationClosed())); + connect(m_widget, SIGNAL(notificationClicked()), this, SIGNAL(notificationClicked())); } virtual ~WebNotificationPresenter() { m_widget->close(); delete m_widget; } diff --git a/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h b/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h index 3c56c98..76496c5 100644 --- a/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h +++ b/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h @@ -27,6 +27,7 @@ */ #include <QObject> +#include <QUrl> class QWebSelectData { @@ -66,6 +67,7 @@ public: virtual const QString title() const = 0; virtual const QString message() const = 0; virtual const QByteArray iconData() const = 0; + virtual const QUrl openerPageUrl() const = 0; }; class QWebNotificationPresenter : public QObject @@ -79,6 +81,7 @@ public: Q_SIGNALS: void notificationClosed(); + void notificationClicked(); }; class QWebHapticFeedbackPlayer @@ -113,6 +116,6 @@ public: }; -Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.3"); +Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.4"); #endif // QWEBKITPLATFORMPLUGIN_H diff --git a/WebKit/qt/qt_webkit_version.pri b/WebKit/qt/qt_webkit_version.pri index ca6299a..4147d8f 100644 --- a/WebKit/qt/qt_webkit_version.pri +++ b/WebKit/qt/qt_webkit_version.pri @@ -2,4 +2,4 @@ QT_WEBKIT_VERSION = 4.9.0 QT_WEBKIT_MAJOR_VERSION = 4 QT_WEBKIT_MINOR_VERSION = 9 QT_WEBKIT_PATCH_VERSION = 0 -QT_CONFIG *= webkit +QT_CONFIG += webkit diff --git a/WebKit/qt/symbian/eabi/QtWebKitu.def b/WebKit/qt/symbian/eabi/QtWebKitu.def index 9c3e152..8291197 100644 --- a/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -797,7 +797,7 @@ EXPORTS _ZN23DumpRenderTreeSupportQtD1Ev @ 796 NONAME _ZN23DumpRenderTreeSupportQtD2Ev @ 797 NONAME _ZN8QWebPage23allowGeolocationRequestEP9QWebFrame @ 798 NONAME - _ZN8QWebPage23viewportChangeRequestedERKNS_13ViewportHintsE @ 799 NONAME + _ZN8QWebPage23viewportChangeRequestedERKNS_13ViewportHintsE @ 799 NONAME ABSENT _ZNK15QWebScriptWorld5worldEv @ 800 NONAME _ZN16QGraphicsWebView13setDeviceSizeERK5QSize @ 801 NONAME _ZN23DumpRenderTreeSupportQt12pagePropertyEP9QWebFrameRK7QStringi @ 802 NONAME @@ -812,4 +812,8 @@ EXPORTS _ZN8QWebPage25requestPermissionFromUserEP9QWebFrameNS_16PermissionDomainE @ 811 NONAME _ZN8QWebPage27cancelRequestsForPermissionEP9QWebFrameNS_16PermissionDomainE @ 812 NONAME _ZNK16QGraphicsWebView10deviceSizeEv @ 813 NONAME + _ZN23DumpRenderTreeSupportQt14viewportAsTextEP8QWebPageRK5QSize @ 814 NONAME + _ZN23DumpRenderTreeSupportQt32simulateDesktopNotificationClickERK7QString @ 815 NONAME + _ZN8QWebPage23viewportChangeRequestedEv @ 816 NONAME + _ZNK8QWebPage28viewportConfigurationForSizeE5QSize @ 817 NONAME diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 9a6c35f..10af94c 100644 --- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -97,6 +97,7 @@ private slots: void backActionUpdate(); void frameAt(); void requestCache(); + void loadCachedPage(); void protectBindingsRuntimeObjectsFromCollector(); void localURLSchemes(); void testOptionalJSObjects(); @@ -1288,6 +1289,37 @@ void tst_QWebPage::requestCache() (int)QNetworkRequest::PreferCache); } +void tst_QWebPage::loadCachedPage() +{ + TestPage page; + QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); + page.settings()->setMaximumPagesInCache(3); + + page.mainFrame()->load(QUrl("data:text/html,This is first page")); + + QTRY_COMPARE(loadSpy.count(), 1); + QTRY_COMPARE(page.navigations.count(), 1); + + QUrl firstPageUrl = page.mainFrame()->url(); + page.mainFrame()->load(QUrl("data:text/html,This is second page")); + + QTRY_COMPARE(loadSpy.count(), 2); + QTRY_COMPARE(page.navigations.count(), 2); + + page.triggerAction(QWebPage::Stop); + QVERIFY(page.history()->canGoBack()); + + QSignalSpy urlSpy(page.mainFrame(), SIGNAL(urlChanged(QUrl))); + QVERIFY(urlSpy.isValid()); + + page.triggerAction(QWebPage::Back); + ::waitForSignal(page.mainFrame(), SIGNAL(urlChanged(QUrl))); + QCOMPARE(urlSpy.size(), 1); + + QList<QVariant> arguments1 = urlSpy.takeFirst(); + QCOMPARE(arguments1.at(0).toUrl(), firstPageUrl); + +} void tst_QWebPage::backActionUpdate() { QWebView view; @@ -1661,6 +1693,22 @@ void tst_QWebPage::inputMethods() QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); #endif +#if QT_VERSION >= 0x040600 + //START - Test for sending empty QInputMethodEvent + page->mainFrame()->setHtml("<html><body>" \ + "<input type='text' id='input3' value='QtWebKit2'/>" \ + "</body></html>"); + page->mainFrame()->evaluateJavaScript("var inputEle = document.getElementById('input3'); inputEle.focus(); inputEle.select();"); + + //Send empty QInputMethodEvent + QInputMethodEvent emptyEvent; + page->event(&emptyEvent); + + QString inputValue = page->mainFrame()->evaluateJavaScript("document.getElementById('input3').value").toString(); + QCOMPARE(inputValue, QString("QtWebKit2")); + //END - Test for sending empty QInputMethodEvent +#endif + delete container; } diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index b7e49cf..251bf91 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,185 @@ +2010-09-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (r60104): Zoom level is unexpectedly reset on page reload + https://bugs.webkit.org/show_bug.cgi?id=42863 + + * WebView.cpp: + (WebView::setZoomMultiplier): + Call functions on Frame instead of FrameView. + +2010-09-17 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Simon Fraser. + + Reduce minimum DOMTimer interval + https://bugs.webkit.org/show_bug.cgi?id=45362 + + * WebView.cpp: Added in a call to set the mimimum allowed DOMTimer to 4ms. + +2010-09-17 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Chris Marrin. + + Remove scroll and clip layers for WKCACFLayerRenderer + https://bugs.webkit.org/show_bug.cgi?id=45922 + + WKCACFLayerRenderer no longer needs its own layers for managing scrolling + and clipping, because RenderLayerCompositor provides this functionality. + + * WebView.cpp: + (WebView::sizeChanged): Moved code that handles the WM_SIZE message + into this method. Use it to resize the layer renderer. + (WebView::WebViewWndProc): Call sizeChanged(). + (WebView::updateRootLayerContents): No need to call setScrollFrame() any more. + (WebView::layerRendererBecameVisible): Move this from the header (no need to be inline). + * WebView.h: + +2010-09-16 Darin Adler <darin@apple.com> + + Reviewed by Andreas Kling. + + Reduce use of HTMLInputElement::inputType so we can remove it later + https://bugs.webkit.org/show_bug.cgi?id=45903 + + * WebFrame.cpp: + (WebFrame::elementDoesAutoComplete): Use isPasswordField. + (WebFrame::elementIsPassword): Use isPasswordField. + +2010-09-14 Ada Chan <adachan@apple.com> + + Reviewed by Adam Roben. + + Add an IWebFramePrivate API to load string as plain text into the WebFrame. + https://bugs.webkit.org/show_bug.cgi?id=45782 + + * Interfaces/IWebFramePrivate.idl: + * Interfaces/WebKit.idl: Touch the file. + * WebFrame.cpp: + (WebFrame::loadPlainTextString): + * WebFrame.h: + +2010-09-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Paste should be implemented in WebCore like Copy and Cut for Mac also. + https://bugs.webkit.org/show_bug.cgi?id=45494 + <rdar://problem/7660537> + + On the Mac platform, the implementation of the paste operation is all done + at the WebKit level. In order to support it on WebKit2 it is necessary to + refactor the code and move this functionality at the level of WebCore like + we already have on Windows. + The original code relies on some in AppKit functions that call back into + WebKit causing problems in WebKit2. All this functionality has been moved + at the level of the editor client where it can be dealt with appropriately. + + * WebFrame.cpp: + (WebFrame::canShowMIMETypeASHTML): Added. + +2010-09-11 Adam Barth <abarth@webkit.org> + + Reviewed by Sam Weinig. + + Make SecurityOrigin::canDisplay an instance function + https://bugs.webkit.org/show_bug.cgi?id=45219 + + * WebFrame.cpp: + (WebFrame::allowsFollowingLink): + +2010-09-10 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Darin Adler. + + Add NetworkingContext to avoid layer violations + https://bugs.webkit.org/show_bug.cgi?id=42292 + + * WebCoreSupport/WebFrameNetworkingContext.cpp: + (WebFrameNetworkingContext::blockedError): + * WebCoreSupport/WebFrameNetworkingContext.h: + +2010-09-10 Jer Noble <jer.noble@apple.com> + + Reviewed by Simon Fraser. + + Movies with track or movie matrices don't display in <video> elements (Safari 5/Windows) + https://bugs.webkit.org/show_bug.cgi?id=45333 + + The rootChild layer must be set as flipped, otherwise transformed movies will appear + incorrectly rotated. + + * FullscreenVideoController.cpp: + (FullscreenVideoController::enterFullscreen): + +2010-09-10 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Remove unnecessary constraint in WebCore of choosing either text zoom or full page zoom. + Precursor to <rdar://problem/7660657> + https://bugs.webkit.org/show_bug.cgi?id=45522 + + * WebFrame.cpp: + * WebFrame.h: + Remove dead code. + + * WebView.cpp: + (WebView::WebView): + (WebView::setZoomMultiplier): + (WebView::zoomMultiplier): + (WebView::canMakeTextLarger): + (WebView::makeTextLarger): + (WebView::canMakeTextSmaller): + (WebView::makeTextSmaller): + (WebView::notifyPreferencesChanged): + * WebView.h: + Move tracking of text only zoom here from WebCore. + +2010-09-10 Brian Weinstein <bweinstein@apple.com> + + Windows Build Fix. Fix some fallout from r67238, currentForm is now off of + SelectionController instead of frame. Also fix a style issue. + + * WebFrame.cpp: + (WebFrame::currentForm): + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Move code from WebKit-layer to DocumentLoader + https://bugs.webkit.org/show_bug.cgi?id=45569 + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::committedLoad): + * WebCoreSupport/WebFrameLoaderClient.h: + +2010-09-09 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to SelectionController as planned + https://bugs.webkit.org/show_bug.cgi?id=45508 + + * WebView.cpp: + (WebView::selectionRect): + (WebView::centerSelectionInVisibleArea): + Call functions on selection(). + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Main resource bytes shouldn't bounce through FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=45496 + + Now return the bytes to the DocumentLoader. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::receivedData): + 2010-09-09 Simon Fraser <simon.fraser@apple.com> Reviewed by Adam Roben. diff --git a/WebKit/win/FullscreenVideoController.cpp b/WebKit/win/FullscreenVideoController.cpp index 4b50889..696aaa5 100644 --- a/WebKit/win/FullscreenVideoController.cpp +++ b/WebKit/win/FullscreenVideoController.cpp @@ -273,9 +273,10 @@ void FullscreenVideoController::enterFullscreen() #if USE(ACCELERATED_COMPOSITING) m_fullscreenWindow->setRootChildLayer(m_rootChild); - WKCACFLayer* videoLayer = m_mediaElement->player()->platformLayer(); + WKCACFLayer* videoLayer = m_mediaElement->platformLayer(); m_rootChild->addSublayer(videoLayer); m_rootChild->setNeedsLayout(); + m_rootChild->setGeometryFlipped(1); #endif RECT windowRect; diff --git a/WebKit/win/Interfaces/IWebFramePrivate.idl b/WebKit/win/Interfaces/IWebFramePrivate.idl index bc9a4bd..499aa03 100755 --- a/WebKit/win/Interfaces/IWebFramePrivate.idl +++ b/WebKit/win/Interfaces/IWebFramePrivate.idl @@ -117,4 +117,6 @@ interface IWebFramePrivate : IUnknown HRESULT suspendAnimations(); HRESULT resumeAnimations(); + + HRESULT loadPlainTextString([in] BSTR string, [in] BSTR url); } diff --git a/WebKit/win/Interfaces/JavaScriptCoreAPITypes.idl b/WebKit/win/Interfaces/JavaScriptCoreAPITypes.idl index f2ef1f1..f2ef1f1 100755..100644 --- a/WebKit/win/Interfaces/JavaScriptCoreAPITypes.idl +++ b/WebKit/win/Interfaces/JavaScriptCoreAPITypes.idl diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl index 98f5da8..d25cdfe 100644 --- a/WebKit/win/Interfaces/WebKit.idl +++ b/WebKit/win/Interfaces/WebKit.idl @@ -300,4 +300,3 @@ library WebKit [default] interface IWebUserContentURLPattern; } } - diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp index 48f7f3b..1fb827d 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp @@ -491,11 +491,8 @@ void WebFrameLoaderClient::postProgressFinishedNotification() void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length) { - // FIXME: This should probably go through the data source. - const String& textEncoding = loader->response().textEncodingName(); - if (!m_manualLoader) - receivedData(data, length, textEncoding); + loader->commitData(data, length); if (!m_manualLoader) return; @@ -512,22 +509,6 @@ void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* dat m_manualLoader->didReceiveData(data, length); } -void WebFrameLoaderClient::receivedData(const char* data, int length, const String& textEncoding) -{ - Frame* coreFrame = core(m_webFrame); - if (!coreFrame) - return; - - // Set the encoding. This only needs to be done once, but it's harmless to do it again later. - String encoding = coreFrame->loader()->documentLoader()->overrideEncoding(); - bool userChosen = !encoding.isNull(); - if (encoding.isNull()) - encoding = textEncoding; - coreFrame->loader()->writer()->setEncoding(encoding, userChosen); - - coreFrame->loader()->addData(data, length); -} - void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader) { // Telling the frame we received some data and passing 0 as the data is our diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h index 648b5bf..6e8e354 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h @@ -126,7 +126,6 @@ protected: private: PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL&, const WTF::String& name, WebCore::HTMLFrameOwnerElement*, const WTF::String& referrer); - void receivedData(const char*, int, const WTF::String&); WebHistory* webHistory() const; WebFrame* m_webFrame; diff --git a/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp b/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp index 9fcd4b1..b87b6d9 100644 --- a/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp +++ b/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp @@ -37,3 +37,8 @@ String WebFrameNetworkingContext::referrer() const { return frame()->loader()->referrer(); } + +WebCore::ResourceError WebFrameNetworkingContext::blockedError(const WebCore::ResourceRequest& request) const +{ + return frame()->loader()->blockedError(request); +} diff --git a/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.h b/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.h index 7fd55d5..a237c9a 100644 --- a/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.h +++ b/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.h @@ -21,6 +21,7 @@ #define WebFrameNetworkingContext_h #include <WebCore/FrameNetworkingContext.h> +#include <WebCore/ResourceError.h> class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext { public: @@ -35,6 +36,7 @@ private: virtual WTF::String userAgent() const; virtual WTF::String referrer() const; + virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const; WTF::String m_userAgent; }; diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp index 014ea15..843f33a 100644 --- a/WebKit/win/WebFrame.cpp +++ b/WebKit/win/WebFrame.cpp @@ -507,9 +507,10 @@ HRESULT STDMETHODCALLTYPE WebFrame::currentForm( *currentForm = 0; - if (Frame* coreFrame = core(this)) - if (HTMLFormElement* formElement = coreFrame->currentForm()) + if (Frame* coreFrame = core(this)) { + if (HTMLFormElement* formElement = coreFrame->selection()->currentForm()) *currentForm = DOMElement::createInstance(formElement); + } return *currentForm ? S_OK : E_FAIL; } @@ -601,6 +602,17 @@ HRESULT STDMETHODCALLTYPE WebFrame::loadData( return S_OK; } +HRESULT WebFrame::loadPlainTextString( + /* [in] */ BSTR string, + /* [in] */ BSTR url) +{ + RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<char*>(string), sizeof(UChar) * SysStringLen(string)); + BString plainTextMimeType(TEXT("text/plain"), 10); + BString utf16Encoding(TEXT("utf-16"), 6); + loadData(sharedBuffer.release(), plainTextMimeType, utf16Encoding, url, 0); + return S_OK; +} + void WebFrame::loadHTMLString(BSTR string, BSTR baseURL, BSTR unreachableURL) { RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<char*>(string), sizeof(UChar) * SysStringLen(string)); @@ -1098,15 +1110,6 @@ void WebFrame::invalidate() document->recalcStyle(Node::Force); } -void WebFrame::setTextSizeMultiplier(float multiplier) -{ - Frame* coreFrame = core(this); - ASSERT(coreFrame); - - if (FrameView* view = coreFrame->view()) - view->setZoomFactor(multiplier, ZoomTextOnly); -} - HRESULT WebFrame::inViewSourceMode(BOOL* flag) { if (!flag) { @@ -1182,7 +1185,7 @@ HRESULT WebFrame::elementDoesAutoComplete(IDOMElement *element, BOOL *result) if (!inputElement) *result = false; else - *result = inputElement->isTextField() && inputElement->inputType() != HTMLInputElement::PASSWORD && inputElement->autoComplete(); + *result = inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->autoComplete(); return S_OK; } @@ -1353,7 +1356,7 @@ HRESULT WebFrame::allowsFollowingLink(BSTR url, BOOL* result) if (!frame) return E_FAIL; - *result = SecurityOrigin::canDisplay(MarshallingHelpers::BSTRToKURL(url), String(), frame->document()); + *result = frame->document()->securityOrigin()->canDisplay(MarshallingHelpers::BSTRToKURL(url)); return S_OK; } @@ -1387,9 +1390,8 @@ HRESULT WebFrame::controlsInForm(IDOMElement* form, IDOMElement** controls, int* HRESULT WebFrame::elementIsPassword(IDOMElement *element, bool *result) { - HTMLInputElement *inputElement = inputElementFromDOMElement(element); - *result = inputElement != 0 - && inputElement->inputType() == HTMLInputElement::PASSWORD; + HTMLInputElement* inputElement = inputElementFromDOMElement(element); + *result = inputElement && inputElement->isPasswordField(); return S_OK; } @@ -1612,6 +1614,12 @@ bool WebFrame::canHandleRequest(const ResourceRequest& request) const return WebView::canHandleRequest(request); } +bool WebFrame::canShowMIMETypeAsHTML(const String& /*MIMEType*/) const +{ + notImplemented(); + return true; +} + bool WebFrame::canShowMIMEType(const String& /*MIMEType*/) const { notImplemented(); diff --git a/WebKit/win/WebFrame.h b/WebKit/win/WebFrame.h index f4795c8..21c3027 100644 --- a/WebKit/win/WebFrame.h +++ b/WebKit/win/WebFrame.h @@ -260,6 +260,7 @@ public: virtual HRESULT STDMETHODCALLTYPE numberOfActiveAnimations(UINT*); virtual HRESULT STDMETHODCALLTYPE suspendAnimations(); virtual HRESULT STDMETHODCALLTYPE resumeAnimations(); + virtual HRESULT STDMETHODCALLTYPE loadPlainTextString(BSTR string, BSTR url); virtual HRESULT STDMETHODCALLTYPE isDisplayingStandaloneImage(BOOL*); @@ -302,6 +303,7 @@ public: virtual void didChangeIcons(WebCore::DocumentLoader*); virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; virtual bool canShowMIMEType(const WTF::String& MIMEType) const; + virtual bool canShowMIMETypeAsHTML(const WTF::String& MIMEType) const; virtual bool representationExistsForURLScheme(const WTF::String& URLScheme) const; virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String& URLScheme) const; virtual void frameLoadCompleted(); @@ -355,7 +357,6 @@ public: void updateBackground(); // WebFrame (matching WebCoreFrameBridge) - void setTextSizeMultiplier(float multiplier); HRESULT inViewSourceMode(BOOL *flag); HRESULT setInViewSourceMode(BOOL flag); HRESULT elementWithName(BSTR name, IDOMElement* form, IDOMElement** element); diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp index 0a1e334..04794c9 100644..100755 --- a/WebKit/win/WebView.cpp +++ b/WebKit/win/WebView.cpp @@ -326,6 +326,7 @@ WebView::WebView() , m_useBackForwardList(true) , m_userAgentOverridden(false) , m_zoomMultiplier(1.0f) + , m_zoomsTextOnly(false) , m_mouseActivated(false) , m_dragData(0) , m_currentCharacterCode(0) @@ -853,6 +854,19 @@ void WebView::scrollBackingStore(FrameView* frameView, int dx, int dy, const Int ::ReleaseDC(m_viewWindow, windowDC); } +void WebView::sizeChanged(const IntSize& newSize) +{ + deleteBackingStore(); + + if (Frame* coreFrame = core(topLevelFrame())) + coreFrame->view()->resize(newSize); + +#if USE(ACCELERATED_COMPOSITING) + if (m_layerRenderer) + m_layerRenderer->resize(); +#endif +} + // This emulates the Mac smarts for painting rects intelligently. This is very // important for us, since we double buffer based off dirty rects. static void getUpdateRects(HRGN region, const IntRect& dirtyRect, Vector<IntRect>& rects) @@ -2079,15 +2093,8 @@ LRESULT CALLBACK WebView::WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, break; // FIXME: We need to check WM_UNICHAR to support supplementary characters (that don't fit in 16 bits). case WM_SIZE: - if (lParam != 0) { - webView->deleteBackingStore(); -#if USE(ACCELERATED_COMPOSITING) - if (webView->isAcceleratedCompositing()) - webView->resizeLayerRenderer(); -#endif - if (Frame* coreFrame = core(mainFrameImpl)) - coreFrame->view()->resize(LOWORD(lParam), HIWORD(lParam)); - } + if (lParam != 0) + webView->sizeChanged(IntSize(LOWORD(lParam), HIWORD(lParam))); break; case WM_SHOWWINDOW: lResult = DefWindowProc(hWnd, message, wParam, lParam); @@ -2560,7 +2567,7 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame( #endif WebKitSetApplicationCachePathIfNecessary(); WebPlatformStrategies::initialize(); - + #if USE(SAFARI_THEME) BOOL shouldPaintNativeControls; if (SUCCEEDED(m_preferences->shouldPaintNativeControls(&shouldPaintNativeControls))) @@ -2582,6 +2589,7 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame( pageClients.geolocationControllerClient = new WebGeolocationControllerClient(this); #endif m_page = new Page(pageClients); + m_page->settings()->setMinDOMTimerInterval(0.004); BSTR localStoragePath; if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) { @@ -2925,10 +2933,13 @@ HRESULT STDMETHODCALLTYPE WebView::setPageSizeMultiplier( void WebView::setZoomMultiplier(float multiplier, bool isTextOnly) { m_zoomMultiplier = multiplier; - m_page->settings()->setZoomMode(isTextOnly ? ZoomTextOnly : ZoomPage); + m_zoomsTextOnly = isTextOnly; + if (Frame* coreFrame = core(m_mainFrame)) { - if (FrameView* view = coreFrame->view()) - view->setZoomFactor(multiplier, isTextOnly ? ZoomTextOnly : ZoomPage); + if (m_zoomsTextOnly) + coreFrame->setPageAndTextZoomFactors(1, multiplier); + else + coreFrame->setPageAndTextZoomFactors(multiplier, 1); } } @@ -2948,8 +2959,7 @@ HRESULT STDMETHODCALLTYPE WebView::pageSizeMultiplier( float WebView::zoomMultiplier(bool isTextOnly) { - ZoomMode zoomMode = isTextOnly ? ZoomTextOnly : ZoomPage; - if (zoomMode != m_page->settings()->zoomMode()) + if (isTextOnly != m_zoomsTextOnly) return 1.0f; return m_zoomMultiplier; } @@ -3401,7 +3411,7 @@ HRESULT STDMETHODCALLTYPE WebView::selectionRect(RECT* rc) WebCore::Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - IntRect ir = enclosingIntRect(frame->selectionBounds()); + IntRect ir = enclosingIntRect(frame->selection()->bounds()); ir = frame->view()->convertToContainingWindow(ir); ir.move(-frame->view()->scrollOffset().width(), -frame->view()->scrollOffset().height()); rc->left = ir.x(); @@ -3561,7 +3571,7 @@ HRESULT STDMETHODCALLTYPE WebView::centerSelectionInVisibleArea( if (!coreFrame) return E_FAIL; - coreFrame->revealSelection(ScrollAlignment::alignCenterAlways); + coreFrame->selection()->revealSelection(ScrollAlignment::alignCenterAlways); return S_OK; } @@ -3732,7 +3742,7 @@ HRESULT STDMETHODCALLTYPE WebView::canMakeTextLarger( /* [in] */ IUnknown* /*sender*/, /* [retval][out] */ BOOL* result) { - bool canGrowMore = canZoomIn(m_page->settings()->zoomMode() == ZoomTextOnly); + bool canGrowMore = canZoomIn(m_zoomsTextOnly); *result = canGrowMore ? TRUE : FALSE; return S_OK; } @@ -3754,7 +3764,7 @@ bool WebView::canZoomIn(bool isTextOnly) HRESULT STDMETHODCALLTYPE WebView::makeTextLarger( /* [in] */ IUnknown* /*sender*/) { - return zoomIn(m_page->settings()->zoomMode() == ZoomTextOnly); + return zoomIn(m_zoomsTextOnly); } HRESULT STDMETHODCALLTYPE WebView::zoomPageIn( @@ -3775,7 +3785,7 @@ HRESULT STDMETHODCALLTYPE WebView::canMakeTextSmaller( /* [in] */ IUnknown* /*sender*/, /* [retval][out] */ BOOL* result) { - bool canShrinkMore = canZoomOut(m_page->settings()->zoomMode() == ZoomTextOnly); + bool canShrinkMore = canZoomOut(m_zoomsTextOnly); *result = canShrinkMore ? TRUE : FALSE; return S_OK; } @@ -3797,7 +3807,7 @@ bool WebView::canZoomOut(bool isTextOnly) HRESULT STDMETHODCALLTYPE WebView::makeTextSmaller( /* [in] */ IUnknown* /*sender*/) { - return zoomOut(m_page->settings()->zoomMode() == ZoomTextOnly); + return zoomOut(m_zoomsTextOnly); } HRESULT STDMETHODCALLTYPE WebView::zoomPageOut( @@ -4634,7 +4644,9 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification) hr = preferences->zoomsTextOnly(&enabled); if (FAILED(hr)) return hr; - settings->setZoomMode(enabled ? ZoomTextOnly : ZoomPage); + + if (m_zoomsTextOnly != !!enabled) + setZoomMultiplier(m_zoomMultiplier, enabled); settings->setShowsURLsInToolTips(false); settings->setForceFTPDirectoryListings(true); @@ -6272,14 +6284,11 @@ void WebView::updateRootLayerContents() m_nextDisplayIsSynchronous = false; } else m_layerRenderer->setRootContents(backingStoreImage.get()); +} - // Set the frame and scroll position - Frame* coreFrame = core(m_mainFrame); - if (!coreFrame) - return; - FrameView* frameView = coreFrame->view(); - - m_layerRenderer->setScrollFrame(IntPoint(frameView->scrollX(), frameView->scrollY()), IntSize(frameView->layoutWidth(), frameView->layoutHeight())); +void WebView::layerRendererBecameVisible() +{ + m_layerRenderer->createRenderer(); } #endif diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h index eec24fd..61eb946 100644..100755 --- a/WebKit/win/WebView.h +++ b/WebKit/win/WebView.h @@ -921,6 +921,8 @@ private: HRESULT resetZoom(bool isTextOnly); bool active(); + void sizeChanged(const WebCore::IntSize&); + enum WindowsToPaint { PaintWebViewOnly, PaintWebViewAndChildren }; void paintIntoBackingStore(WebCore::FrameView*, HDC bitmapDC, const WebCore::IntRect& dirtyRect, WindowsToPaint); void updateBackingStore(WebCore::FrameView*, HDC = 0, bool backingStoreCompletelyDirty = false, WindowsToPaint = PaintWebViewOnly); @@ -995,6 +997,7 @@ protected: WTF::String m_userAgentCustom; WTF::String m_userAgentStandard; float m_zoomMultiplier; + bool m_zoomsTextOnly; WTF::String m_overrideEncoding; WTF::String m_applicationName; bool m_mouseActivated; @@ -1041,8 +1044,7 @@ protected: bool isAcceleratedCompositing() const { return m_isAcceleratedCompositing; } void setAcceleratedCompositing(bool); void updateRootLayerContents(); - void resizeLayerRenderer() { m_layerRenderer->resize(); } - void layerRendererBecameVisible() { m_layerRenderer->createRenderer(); } + void layerRendererBecameVisible(); OwnPtr<WebCore::WKCACFLayerRenderer> m_layerRenderer; bool m_isAcceleratedCompositing; diff --git a/WebKit/wince/ChangeLog b/WebKit/wince/ChangeLog index ea106fe..fba4def 100644 --- a/WebKit/wince/ChangeLog +++ b/WebKit/wince/ChangeLog @@ -1,3 +1,38 @@ +2010-09-20 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Adam Roben. + + Add FrameLoaderClientWinCE + https://bugs.webkit.org/show_bug.cgi?id=45682 + + * WebCoreSupport/FrameLoaderClientWinCE.cpp: Added. + * WebCoreSupport/FrameLoaderClientWinCE.h: Added. + +2010-09-16 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Adam Roben. + + [WINCE] Add missing FrameNetworkingContextWinCE::blockedError + https://bugs.webkit.org/show_bug.cgi?id=45680 + + * WebCoreSupport/FrameNetworkingContextWinCE.cpp: + (WebKit::FrameNetworkingContextWinCE::blockedError): + * WebCoreSupport/FrameNetworkingContextWinCE.h: + +2010-09-13 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Kenneth Rohde Christiansen. + + Add FrameNetworkingContextWinCE + https://bugs.webkit.org/show_bug.cgi?id=45474 + + * WebCoreSupport/FrameNetworkingContextWinCE.cpp: Added. + (WebKit::FrameNetworkingContextWinCE::FrameNetworkingContextWinCE): + (WebKit::FrameNetworkingContextWinCE::userAgent): + (WebKit::FrameNetworkingContextWinCE::referrer): + * WebCoreSupport/FrameNetworkingContextWinCE.h: Added. + (WebKit::FrameNetworkingContextWinCE::create): + 2010-08-31 Patrick Gansterer <paroga@paroga.com> Reviewed by Kenneth Rohde Christiansen. diff --git a/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp b/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp new file mode 100644 index 0000000..b11df84 --- /dev/null +++ b/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp @@ -0,0 +1,627 @@ +/* + * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> + * + * 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 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 "FrameLoaderClientWinCE.h" + +#include "DocumentLoader.h" +#include "FrameLoader.h" +#include "FrameNetworkingContextWinCE.h" +#include "FrameView.h" +#include "HTMLFormElement.h" +#include "MIMETypeRegistry.h" +#include "NotImplemented.h" +#include "PluginDatabase.h" +#include "RenderPart.h" +#include "WebView.h" + +using namespace WebCore; + +namespace WebKit { + +FrameLoaderClientWinCE::FrameLoaderClientWinCE(WebView* view) + : m_webView(view) + , m_pluginView(0) +{ + ASSERT(m_webView); +} + +FrameLoaderClientWinCE::~FrameLoaderClientWinCE() +{ +} + +String FrameLoaderClientWinCE::userAgent(const KURL&) +{ + return "WebKitWinCE"; +} + +PassRefPtr<DocumentLoader> FrameLoaderClientWinCE::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData) +{ + return DocumentLoader::create(request, substituteData); +} + +void FrameLoaderClientWinCE::committedLoad(DocumentLoader* loader, const char* data, int length) +{ + if (m_pluginView) { + if (!m_hasSentResponseToPlugin) { + m_pluginView->didReceiveResponse(loader->response()); + m_hasSentResponseToPlugin = true; + } + m_pluginView->didReceiveData(data, length); + } else + loader->commitData(data, length); +} + +bool FrameLoaderClientWinCE::shouldUseCredentialStorage(DocumentLoader*, unsigned long) +{ + notImplemented(); + return false; +} + +void FrameLoaderClientWinCE::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchWillSendRequest(DocumentLoader*, unsigned long, WebCore::ResourceRequest&, const WebCore::ResourceResponse&) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::assignIdentifierToInitialRequest(unsigned long, DocumentLoader*, const WebCore::ResourceRequest&) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::postProgressStartedNotification() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::postProgressEstimateChangedNotification() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::postProgressFinishedNotification() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::frameLoaderDestroyed() +{ + m_webView = 0; + m_frame = 0; + delete this; +} + +void FrameLoaderClientWinCE::dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse& response) +{ + m_response = response; +} + +void FrameLoaderClientWinCE::dispatchDecidePolicyForMIMEType(FramePolicyFunction policyFunction, const String& mimeType, const WebCore::ResourceRequest&) +{ + if (canShowMIMEType(mimeType)) + (m_frame->loader()->policyChecker()->*policyFunction)(PolicyUse); + else + (m_frame->loader()->policyChecker()->*policyFunction)(PolicyDownload); +} + +void FrameLoaderClientWinCE::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction policyFunction, const NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>, const String&) +{ + (m_frame->loader()->policyChecker()->*policyFunction)(PolicyUse); +} + +void FrameLoaderClientWinCE::dispatchDecidePolicyForNavigationAction(FramePolicyFunction policyFunction, const NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>) +{ + (m_frame->loader()->policyChecker()->*policyFunction)(PolicyUse); +} + +void FrameLoaderClientWinCE::dispatchWillSubmitForm(FramePolicyFunction policyFunction, PassRefPtr<FormState>) +{ + (m_frame->loader()->policyChecker()->*policyFunction)(PolicyUse); +} + +PassRefPtr<Widget> FrameLoaderClientWinCE::createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) +{ + return 0; +} + +PassRefPtr<Frame> FrameLoaderClientWinCE::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, + const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) +{ + return m_webView->createFrame(url, name, ownerElement, referrer, allowsScrolling, marginWidth, marginHeight); +} + +void FrameLoaderClientWinCE::didTransferChildFrameToNewDocument() +{ +} + +void FrameLoaderClientWinCE::redirectDataToPlugin(Widget* pluginWidget) +{ + ASSERT(!m_pluginView); + m_pluginView = static_cast<PluginView*>(pluginWidget); + m_hasSentResponseToPlugin = false; +} + +PassRefPtr<Widget> FrameLoaderClientWinCE::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) +{ + notImplemented(); + return 0; +} + +ObjectContentType FrameLoaderClientWinCE::objectContentType(const KURL& url, const String& mimeType) +{ + return FrameLoader::defaultObjectContentType(url, mimeType); +} + +String FrameLoaderClientWinCE::overrideMediaType() const +{ + notImplemented(); + return String(); +} + +void FrameLoaderClientWinCE::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::documentElementAvailable() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::didPerformFirstNavigation() const +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::registerForIconNotification(bool) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::setMainFrameDocumentReady(bool) +{ + notImplemented(); +} + +bool FrameLoaderClientWinCE::hasWebView() const +{ + return true; +} + +void FrameLoaderClientWinCE::dispatchDidFinishLoad() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::frameLoadCompleted() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::saveViewStateToItem(HistoryItem*) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::restoreViewState() +{ + notImplemented(); +} + +bool FrameLoaderClientWinCE::shouldGoToHistoryItem(HistoryItem* item) const +{ + return item; +} + +void FrameLoaderClientWinCE::dispatchDidAddBackForwardItem(HistoryItem*) const +{ +} + +void FrameLoaderClientWinCE::dispatchDidRemoveBackForwardItem(HistoryItem*) const +{ +} + +void FrameLoaderClientWinCE::dispatchDidChangeBackForwardIndex() const +{ +} + +void FrameLoaderClientWinCE::didDisplayInsecureContent() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::didRunInsecureContent(SecurityOrigin*) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::makeRepresentation(DocumentLoader*) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::forceLayout() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::forceLayoutForNonHTML() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::setCopiesOnScroll() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::detachedFromParent2() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::detachedFromParent3() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidHandleOnloadEvents() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidReceiveServerRedirectForProvisionalLoad() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidCancelClientRedirect() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchWillPerformClientRedirect(const KURL&, double, double) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidChangeLocationWithinPage() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidPushStateWithinPage() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidReplaceStateWithinPage() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidPopStateWithinPage() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchWillClose() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidReceiveIcon() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidStartProvisionalLoad() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidReceiveTitle(const String&) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidChangeIcons() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidCommitLoad() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidFinishDocumentLoad() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidFirstLayout() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidFirstVisuallyNonEmptyLayout() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchShow() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::cancelPolicyCheck() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidLoadMainResource(DocumentLoader*) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::revertToProvisionalState(DocumentLoader*) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::willChangeTitle(DocumentLoader*) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::didChangeTitle(DocumentLoader* documentLoader) +{ + setTitle(documentLoader->title(), documentLoader->url()); +} + +bool FrameLoaderClientWinCE::canHandleRequest(const WebCore::ResourceRequest&) const +{ + notImplemented(); + return true; +} + +bool FrameLoaderClientWinCE::canShowMIMEType(const String& type) const +{ + return (MIMETypeRegistry::isSupportedImageMIMEType(type) + || MIMETypeRegistry::isSupportedNonImageMIMEType(type) + || MIMETypeRegistry::isSupportedMediaMIMEType(type) + || PluginDatabase::installedPlugins()->isMIMETypeRegistered(type)); +} + +bool FrameLoaderClientWinCE::representationExistsForURLScheme(const String&) const +{ + notImplemented(); + return false; +} + +String FrameLoaderClientWinCE::generatedMIMETypeForURLScheme(const String&) const +{ + notImplemented(); + return String(); +} + +void FrameLoaderClientWinCE::finishedLoading(DocumentLoader* documentLoader) +{ + if (!m_pluginView) { + FrameLoader* loader = documentLoader->frameLoader(); + loader->writer()->setEncoding(m_response.textEncodingName(), false); + return; + } + + m_pluginView->didFinishLoading(); + m_pluginView = 0; + m_hasSentResponseToPlugin = false; +} + +void FrameLoaderClientWinCE::provisionalLoadStarted() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::didFinishLoad() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::prepareForDataSourceReplacement() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::setTitle(const String&, const KURL&) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidFinishLoading(DocumentLoader*, unsigned long) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) +{ + notImplemented(); +} + +bool FrameLoaderClientWinCE::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int) +{ + notImplemented(); + return false; +} + +void FrameLoaderClientWinCE::dispatchDidFailProvisionalLoad(const ResourceError& error) +{ + dispatchDidFailLoad(error); +} + +void FrameLoaderClientWinCE::dispatchDidFailLoad(const ResourceError&) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::download(ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&) +{ + notImplemented(); +} + +ResourceError FrameLoaderClientWinCE::cancelledError(const WebCore::ResourceRequest&) +{ + return ResourceError(); +} + +ResourceError FrameLoaderClientWinCE::blockedError(const WebCore::ResourceRequest&) +{ + return ResourceError(); +} + +ResourceError FrameLoaderClientWinCE::cannotShowURLError(const WebCore::ResourceRequest&) +{ + return ResourceError(); +} + +ResourceError FrameLoaderClientWinCE::interruptForPolicyChangeError(const WebCore::ResourceRequest&) +{ + return ResourceError(); +} + +ResourceError FrameLoaderClientWinCE::cannotShowMIMETypeError(const WebCore::ResourceResponse&) +{ + return ResourceError(); +} + +ResourceError FrameLoaderClientWinCE::fileDoesNotExistError(const WebCore::ResourceResponse&) +{ + return ResourceError(); +} + +ResourceError FrameLoaderClientWinCE::pluginWillHandleLoadError(const WebCore::ResourceResponse&) +{ + return ResourceError(); +} + +bool FrameLoaderClientWinCE::shouldFallBack(const ResourceError& error) +{ + return !(error.isCancellation()); +} + +bool FrameLoaderClientWinCE::canCachePage() const +{ + return true; +} + +Frame* FrameLoaderClientWinCE::dispatchCreatePage() +{ + notImplemented(); + return 0; +} + +void FrameLoaderClientWinCE::dispatchUnableToImplementPolicy(const ResourceError&) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::setMainDocumentError(DocumentLoader*, const ResourceError& error) +{ + if (!m_pluginView) + return; + + m_pluginView->didFail(error); + m_pluginView = 0; + m_hasSentResponseToPlugin = false; +} + +void FrameLoaderClientWinCE::startDownload(const WebCore::ResourceRequest&) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::updateGlobalHistory() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::updateGlobalHistoryRedirectLinks() +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::savePlatformDataToCachedFrame(CachedFrame*) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::transitionToCommittedFromCachedFrame(CachedFrame*) +{ + notImplemented(); +} + +void FrameLoaderClientWinCE::transitionToCommittedForNewPage() +{ + Page* page = m_frame->page(); + ASSERT(page); + + bool isMainFrame = m_frame == page->mainFrame(); + + m_frame->setView(0); + + RefPtr<FrameView> frameView; + if (isMainFrame) { + RECT rect; + m_webView->frameRect(&rect); + frameView = FrameView::create(m_frame, IntRect(rect).size()); + } else + frameView = FrameView::create(m_frame); + + m_frame->setView(frameView); + + if (m_frame->ownerRenderer()) + m_frame->ownerRenderer()->setWidget(frameView); +} + +PassRefPtr<WebCore::FrameNetworkingContext> FrameLoaderClientWinCE::createNetworkingContext() +{ + return FrameNetworkingContextWinCE::create(m_frame, userAgent(KURL())); +} + +} // namespace WebKit diff --git a/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h b/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h new file mode 100644 index 0000000..94810bc --- /dev/null +++ b/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h @@ -0,0 +1,196 @@ +/* + * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> + * + * 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 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 FrameLoaderClientWinCE_h +#define FrameLoaderClientWinCE_h + +#include "FrameLoaderClient.h" +#include "PluginView.h" +#include "ResourceResponse.h" + +class WebView; + +namespace WebKit { + +class FrameLoaderClientWinCE : public WebCore::FrameLoaderClient { +public: + FrameLoaderClientWinCE(WebView*); + virtual ~FrameLoaderClientWinCE(); + virtual void frameLoaderDestroyed(); + + WebView* webView() const { return m_webView; } + + virtual bool hasWebView() const; + + virtual void makeRepresentation(WebCore::DocumentLoader*); + virtual void forceLayout(); + virtual void forceLayoutForNonHTML(); + + virtual void setCopiesOnScroll(); + + virtual void detachedFromParent2(); + virtual void detachedFromParent3(); + + virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&); + + virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); + virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier); + virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); + virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); + virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); + virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived); + virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier); + virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&); + virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length); + + virtual void dispatchDidHandleOnloadEvents(); + virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); + virtual void dispatchDidCancelClientRedirect(); + virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double, double); + virtual void dispatchDidChangeLocationWithinPage(); + virtual void dispatchDidPushStateWithinPage(); + virtual void dispatchDidReplaceStateWithinPage(); + virtual void dispatchDidPopStateWithinPage(); + virtual void dispatchWillClose(); + virtual void dispatchDidReceiveIcon(); + virtual void dispatchDidStartProvisionalLoad(); + virtual void dispatchDidReceiveTitle(const WTF::String&); + virtual void dispatchDidChangeIcons(); + virtual void dispatchDidCommitLoad(); + virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); + virtual void dispatchDidFailLoad(const WebCore::ResourceError&); + virtual void dispatchDidFinishDocumentLoad(); + virtual void dispatchDidFinishLoad(); + virtual void dispatchDidFirstLayout(); + virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + + virtual WebCore::Frame* dispatchCreatePage(); + virtual void dispatchShow(); + + virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction, const WTF::String& MIMEType, const WebCore::ResourceRequest&); + virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WTF::PassRefPtr<WebCore::FormState>, const WTF::String& frameName); + virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WTF::PassRefPtr<WebCore::FormState>); + virtual void cancelPolicyCheck(); + + virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); + + virtual void dispatchWillSendSubmitEvent(WebCore::HTMLFormElement*) { } + virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, WTF::PassRefPtr<WebCore::FormState>); + + virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*); + virtual void revertToProvisionalState(WebCore::DocumentLoader*); + virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&); + + virtual void postProgressStartedNotification(); + virtual void postProgressEstimateChangedNotification(); + virtual void postProgressFinishedNotification(); + + virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const WTF::String& name, WebCore::HTMLFrameOwnerElement* ownerElement, + const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); + virtual void didTransferChildFrameToNewDocument(); + virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const WTF::Vector<WTF::String>&, const WTF::Vector<WTF::String>&, const WTF::String&, bool); + virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); + virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& baseURL, const WTF::Vector<WTF::String>& paramNames, const WTF::Vector<WTF::String>& paramValues); + virtual WTF::String overrideMediaType() const; + virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*); + virtual void documentElementAvailable(); + virtual void didPerformFirstNavigation() const; + + virtual void registerForIconNotification(bool); + + virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WTF::String& mimeType); + + virtual void setMainFrameDocumentReady(bool); + + virtual void startDownload(const WebCore::ResourceRequest&); + + virtual void willChangeTitle(WebCore::DocumentLoader*); + virtual void didChangeTitle(WebCore::DocumentLoader*); + + virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); + virtual void finishedLoading(WebCore::DocumentLoader*); + + virtual void updateGlobalHistory(); + virtual void updateGlobalHistoryRedirectLinks(); + virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const; + virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const; + virtual void dispatchDidChangeBackForwardIndex() 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&); + virtual WebCore::ResourceError interruptForPolicyChangeError(const WebCore::ResourceRequest&); + + virtual WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&); + virtual WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&); + virtual WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&); + + virtual bool shouldFallBack(const WebCore::ResourceError&); + + virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; + virtual bool canShowMIMEType(const WTF::String&) const; + virtual bool representationExistsForURLScheme(const WTF::String&) const; + virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String&) const; + + virtual void frameLoadCompleted(); + virtual void saveViewStateToItem(WebCore::HistoryItem*); + virtual void restoreViewState(); + virtual void provisionalLoadStarted(); + virtual void didFinishLoad(); + virtual void prepareForDataSourceReplacement(); + + virtual WTF::PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); + virtual void setTitle(const WTF::String& title, const WebCore::KURL&); + + virtual WTF::String userAgent(const WebCore::KURL&); + + virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedForNewPage(); + + virtual bool canCachePage() const; + virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); + + virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); + + void setFrame(WebCore::Frame *frame) { m_frame = frame; } + WebCore::Frame *frame() { return m_frame; } + +private: + WebView* m_webView; + WebCore::Frame* m_frame; + WebCore::ResourceResponse m_response; + + // Plugin view to redirect data to + WebCore::PluginView* m_pluginView; + bool m_hasSentResponseToPlugin; +}; + +} // namespace WebKit + +#endif // FrameLoaderClientWinCE_h diff --git a/WebKit/wince/WebCoreSupport/FrameNetworkingContextWinCE.cpp b/WebKit/wince/WebCoreSupport/FrameNetworkingContextWinCE.cpp new file mode 100644 index 0000000..477fe97 --- /dev/null +++ b/WebKit/wince/WebCoreSupport/FrameNetworkingContextWinCE.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> + * + * 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 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 "FrameNetworkingContextWinCE.h" + +#include "NotImplemented.h" +#include "ResourceError.h" + +using namespace WebCore; + +namespace WebKit { + +FrameNetworkingContextWinCE::FrameNetworkingContextWinCE(Frame* frame, const String& userAgent) + : FrameNetworkingContext(frame) + , m_userAgent(userAgent) +{ +} + +String FrameNetworkingContextWinCE::userAgent() const +{ + return m_userAgent; +} + +String FrameNetworkingContextWinCE::referrer() const +{ + return frame()->loader()->referrer(); +} + +WebCore::ResourceError FrameNetworkingContextWinCE::blockedError(const WebCore::ResourceRequest&) const +{ + notImplemented(); + return WebCore::ResourceError(); +} + +} // namespace WebKit diff --git a/WebKit/wince/WebCoreSupport/FrameNetworkingContextWinCE.h b/WebKit/wince/WebCoreSupport/FrameNetworkingContextWinCE.h new file mode 100644 index 0000000..436aff7 --- /dev/null +++ b/WebKit/wince/WebCoreSupport/FrameNetworkingContextWinCE.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> + * + * 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 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 FrameNetworkingContextWinCE_h +#define FrameNetworkingContextWinCE_h + +#include "FrameNetworkingContext.h" + +namespace WebKit { + +class FrameNetworkingContextWinCE : public WebCore::FrameNetworkingContext { +public: + static PassRefPtr<FrameNetworkingContextWinCE> create(WebCore::Frame* frame, const WTF::String& userAgent) + { + return adoptRef(new FrameNetworkingContextWinCE(frame, userAgent)); + } + + virtual WTF::String userAgent() const; + virtual WTF::String referrer() const; + virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const; + +private: + FrameNetworkingContextWinCE(WebCore::Frame* frame, const WTF::String& userAgent); + + WTF::String m_userAgent; +}; + +} // namespace WebKit + +#endif // FrameNetworkingContextWinCE_h diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index 8edf46f..7aedbac 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,74 @@ +2010-09-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (r60104): Zoom level is unexpectedly reset on page reload + https://bugs.webkit.org/show_bug.cgi?id=42863 + + * WebFrame.cpp: + (wxWebFrame::IncreaseTextSize): + (wxWebFrame::DecreaseTextSize): + (wxWebFrame::ResetTextSize): + Call functions on Frame instead of FrameView. + +2010-09-14 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix after FrameNetworkingContext changes and setZoomLevel changes. + + * WebFrame.cpp: + (wxWebFrame::IncreaseTextSize): + (wxWebFrame::DecreaseTextSize): + (wxWebFrame::ResetTextSize): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::createNetworkingContext): + * WebKitSupport/FrameLoaderClientWx.h: + * WebKitSupport/FrameNetworkingContextWx.h: Added. + (WebCore::FrameNetworkingContextWx::create): + (WebCore::FrameNetworkingContextWx::coreFrame): + (WebCore::FrameNetworkingContextWx::FrameNetworkingContextWx): + +2010-09-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Paste should be implemented in WebCore like Copy and Cut for Mac also. + https://bugs.webkit.org/show_bug.cgi?id=45494 + <rdar://problem/7660537> + + On the Mac platform, the implementation of the paste operation is all done + at the WebKit level. In order to support it on WebKit2 it is necessary to + refactor the code and move this functionality at the level of WebCore like + we already have on Windows. + The original code relies on some in AppKit functions that call back into + WebKit causing problems in WebKit2. All this functionality has been moved + at the level of the editor client where it can be dealt with appropriately. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::canShowMIMETypeAsHTML): Added stub. + * WebKitSupport/FrameLoaderClientWx.h: + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Move code from WebKit-layer to DocumentLoader + https://bugs.webkit.org/show_bug.cgi?id=45569 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::committedLoad): + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Main resource bytes shouldn't bounce through FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=45496 + + Now return the bytes to the DocumentLoader. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::committedLoad): + 2010-09-08 Darin Adler <darin@apple.com> Reviewed by Adam Barth. diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp index 3a556d5..1c2eebd 100644 --- a/WebKit/wx/WebFrame.cpp +++ b/WebKit/wx/WebFrame.cpp @@ -373,7 +373,7 @@ void wxWebFrame::IncreaseTextSize() { if (CanIncreaseTextSize()) { m_textMagnifier = m_textMagnifier*TextSizeMultiplierRatio; - m_impl->frame->view()->setZoomFactor(m_textMagnifier, WebCore::ZoomTextOnly); + m_impl->frame->setTextZoomFactor(m_textMagnifier); } } @@ -390,15 +390,15 @@ void wxWebFrame::DecreaseTextSize() { if (CanDecreaseTextSize()) { m_textMagnifier = m_textMagnifier/TextSizeMultiplierRatio; - m_impl->frame->view()->setZoomFactor(m_textMagnifier, WebCore::ZoomTextOnly); + m_impl->frame->setTextZoomFactor(m_textMagnifier); } } void wxWebFrame::ResetTextSize() { m_textMagnifier = 1.0; - if (m_impl->frame && m_impl->frame->view()) - m_impl->frame->view()->setZoomFactor(m_textMagnifier, WebCore::ZoomTextOnly); + if (m_impl->frame) + m_impl->frame->setTextZoomFactor(m_textMagnifier); } void wxWebFrame::MakeEditable(bool enable) diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp index 5b708c2..facb387 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -55,6 +55,7 @@ #include <stdio.h> +#include "FrameNetworkingContextWx.h" #include "WebFrame.h" #include "WebFramePrivate.h" #include "WebView.h" @@ -445,7 +446,13 @@ void FrameLoaderClientWx::finishedLoading(DocumentLoader* loader) } } +bool FrameLoaderClientWx::canShowMIMETypeAsHTML(const String& MIMEType) const +{ + notImplemented(); + return true; +} + bool FrameLoaderClientWx::canShowMIMEType(const String& MIMEType) const { notImplemented(); @@ -612,16 +619,14 @@ void FrameLoaderClientWx::setMainDocumentError(WebCore::DocumentLoader* loader, } } +// FIXME: This function should be moved into WebCore. void FrameLoaderClientWx::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) { if (!m_webFrame) return; - if (!m_pluginView) { - FrameLoader* fl = loader->frameLoader(); - fl->writer()->setEncoding(m_response.textEncodingName(), false); - fl->addData(data, length); - } - + if (!m_pluginView) + loader->commitData(data, length); + // We re-check here as the plugin can have been created if (m_pluginView) { if (!m_hasSentResponseToPlugin) { @@ -965,4 +970,9 @@ bool FrameLoaderClientWx::shouldUsePluginDocument(const String &mimeType) const return false; } +PassRefPtr<FrameNetworkingContext> FrameLoaderClientWx::createNetworkingContext() +{ + return FrameNetworkingContextWx::create(m_frame); +} + } diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h index 0dee4bf..20b50d3 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h @@ -131,6 +131,7 @@ namespace WebCore { virtual void finishedLoading(DocumentLoader*); virtual bool canShowMIMEType(const String& MIMEType) const; + virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const; virtual bool representationExistsForURLScheme(const String& URLScheme) const; virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const; @@ -220,6 +221,8 @@ namespace WebCore { virtual void registerForIconNotification(bool listen = true); virtual bool shouldUsePluginDocument(const String &mimeType) const; + + virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext(); private: wxWebFrame *m_webFrame; diff --git a/WebKit/wx/WebKitSupport/FrameNetworkingContextWx.h b/WebKit/wx/WebKitSupport/FrameNetworkingContextWx.h new file mode 100644 index 0000000..3aa2374 --- /dev/null +++ b/WebKit/wx/WebKitSupport/FrameNetworkingContextWx.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010 Kevin Ollivier <kevino@theolliviers.com> + * + * 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 FrameNetworkingContextWx_h +#define FrameNetworkingContextWx_h + +#include "FrameNetworkingContext.h" + +namespace WebCore { + +class FrameNetworkingContextWx : public WebCore::FrameNetworkingContext { +public: + static PassRefPtr<FrameNetworkingContextWx> create(WebCore::Frame* frame) + { + return adoptRef(new FrameNetworkingContextWx(frame)); + } + + WebCore::Frame* coreFrame() const { return frame(); } + +private: + FrameNetworkingContextWx(WebCore::Frame* frame) + : WebCore::FrameNetworkingContext(frame) + { + } +}; + +} + +#endif |