diff options
author | Iain Merrick <husky@google.com> | 2010-09-13 16:35:48 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-09-16 12:10:42 +0100 |
commit | 5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306 (patch) | |
tree | ddce1aa5e3b6967a69691892e500897558ff8ab6 /WebKit | |
parent | 12bec63ec71e46baba27f0bd9bd9d8067683690a (diff) | |
download | external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.zip external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.gz external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.bz2 |
Merge WebKit at r67178 : Initial merge by git.
Change-Id: I57e01163b6866cb029cdadf405a0394a3918bc18
Diffstat (limited to 'WebKit')
122 files changed, 3321 insertions, 1383 deletions
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog index 898fc8d..bdddda0 100644 --- a/WebKit/ChangeLog +++ b/WebKit/ChangeLog @@ -1,3 +1,12 @@ +2010-09-02 Steve Block <steveblock@google.com> + + Reviewed by Adam Barth. + + Hook up LayoutTestController.setMockDeviceOrientation() on Mac. + https://bugs.webkit.org/show_bug.cgi?id=43181 + + * WebKit.xcodeproj/project.pbxproj: + 2010-08-30 Andy Estes <aestes@apple.com> Reviewed by Darin Adler. diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj index b76bd24..5b44054 100644 --- a/WebKit/WebKit.xcodeproj/project.pbxproj +++ b/WebKit/WebKit.xcodeproj/project.pbxproj @@ -111,6 +111,15 @@ 51FDC4D30B0AF5C100F84EB3 /* WebHistoryItemPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5241ADF50B1BC48A004012BD /* WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5241ADF30B1BC48A004012BD /* WebCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5241ADF60B1BC48A004012BD /* WebCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5241ADF40B1BC48A004012BD /* WebCache.mm */; }; + 598AD91A1201CEC900ABAE4E /* WebDeviceOrientationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9191201CEC900ABAE4E /* WebDeviceOrientationClient.h */; }; + 598AD91E1201CECF00ABAE4E /* WebDeviceOrientationClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 598AD91D1201CECF00ABAE4E /* WebDeviceOrientationClient.mm */; }; + 598AD9201201CF0700ABAE4E /* WebDeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD91F1201CF0700ABAE4E /* WebDeviceOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 598AD9221201CF1000ABAE4E /* WebDeviceOrientation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 598AD9211201CF1000ABAE4E /* WebDeviceOrientation.mm */; }; + 598AD9241201CF1900ABAE4E /* WebDeviceOrientationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9231201CF1900ABAE4E /* WebDeviceOrientationInternal.h */; }; + 598AD9261201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9251201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 598AD9281201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm in Sources */ = {isa = PBXBuildFile; fileRef = 598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */; }; + 598AD92A1201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */; }; + 598ADA461202275000ABAE4E /* WebDeviceOrientationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D7BF8120C2A1D90008CE06D /* WebInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5D7BF8150C2A1D90008CE06D /* WebInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */; }; 5DE83A7A0D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = 5DE83A740D0F7F9400CAD12A /* WebJavaScriptTextInputPanel.nib */; }; @@ -523,6 +532,15 @@ 51FDC4D20B0AF5C100F84EB3 /* WebHistoryItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItemPrivate.h; sourceTree = "<group>"; }; 5241ADF30B1BC48A004012BD /* WebCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCache.h; sourceTree = "<group>"; }; 5241ADF40B1BC48A004012BD /* WebCache.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCache.mm; sourceTree = "<group>"; }; + 598AD9191201CEC900ABAE4E /* WebDeviceOrientationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationClient.h; sourceTree = "<group>"; }; + 598AD91D1201CECF00ABAE4E /* WebDeviceOrientationClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDeviceOrientationClient.mm; sourceTree = "<group>"; }; + 598AD91F1201CF0700ABAE4E /* WebDeviceOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientation.h; sourceTree = "<group>"; }; + 598AD9211201CF1000ABAE4E /* WebDeviceOrientation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDeviceOrientation.mm; sourceTree = "<group>"; }; + 598AD9231201CF1900ABAE4E /* WebDeviceOrientationInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationInternal.h; sourceTree = "<group>"; }; + 598AD9251201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProviderMock.h; sourceTree = "<group>"; }; + 598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDeviceOrientationProviderMock.mm; sourceTree = "<group>"; }; + 598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProviderMockInternal.h; sourceTree = "<group>"; }; + 598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProvider.h; sourceTree = "<group>"; }; 5D7BF8120C2A1D90008CE06D /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; }; 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspector.mm; sourceTree = "<group>"; }; 5DE83A750D0F7F9400CAD12A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/WebJavaScriptTextInputPanel.nib; sourceTree = SOURCE_ROOT; }; @@ -1124,6 +1142,13 @@ 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 */, @@ -1249,6 +1274,8 @@ F5B36B400281DE87018635CB /* WebCoreSupport */ = { isa = PBXGroup; children = ( + 598AD91D1201CECF00ABAE4E /* WebDeviceOrientationClient.mm */, + 598AD9191201CEC900ABAE4E /* WebDeviceOrientationClient.h */, B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */, B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */, A5DEFC1111D5344B00885273 /* WebApplicationCacheQuotaManager.h */, @@ -1589,6 +1616,12 @@ A57E2F24120749E600048DF3 /* WebQuotaManager.h in Headers */, B804176F1217A83100466BAE /* WebInspectorFrontend.h in Headers */, 9391F275121B38BD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */, + 598AD91A1201CEC900ABAE4E /* WebDeviceOrientationClient.h in Headers */, + 598AD9201201CF0700ABAE4E /* WebDeviceOrientation.h in Headers */, + 598AD9241201CF1900ABAE4E /* WebDeviceOrientationInternal.h in Headers */, + 598AD9261201CF2500ABAE4E /* WebDeviceOrientationProviderMock.h in Headers */, + 598AD92A1201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h in Headers */, + 598ADA461202275000ABAE4E /* WebDeviceOrientationProvider.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1952,6 +1985,9 @@ A5DEFC1411D5344B00885273 /* WebApplicationCacheQuotaManager.mm in Sources */, B80417701217A83100466BAE /* WebInspectorFrontend.mm in Sources */, 9391F276121B38BD00EBF7E8 /* WebFrameNetworkingContext.mm in Sources */, + 598AD91E1201CECF00ABAE4E /* WebDeviceOrientationClient.mm in Sources */, + 598AD9221201CF1000ABAE4E /* WebDeviceOrientation.mm in Sources */, + 598AD9281201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog index 527e8ef..e9f6354 100644 --- a/WebKit/chromium/ChangeLog +++ b/WebKit/chromium/ChangeLog @@ -1,3 +1,437 @@ +2010-09-08 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to Editor as planned + https://bugs.webkit.org/show_bug.cgi?id=45218 + + * src/ContextMenuClientImpl.cpp: + (WebKit::selectMisspelledWord): + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::find): + (WebKit::WebFrameImpl::stopFinding): + (WebKit::WebFrameImpl::scopeStringMatches): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::caretOrSelectionBounds): + Changed call sites to use editor(). + +2010-09-09 Kenneth Russell <kbr@google.com> + + Reviewed by James Robinson. + + Memory leak in red/black tree + https://bugs.webkit.org/show_bug.cgi?id=45472 + + Fixed memory leak in red/black tree where it was using operator + new directly to allocate its internal nodes rather than the arena + with which it was configured. Added allocateObject variant to + arena supporting single-argument constructors. Added test to + red/black tree unit tests to cover this functionality, and + refactored TrackedAllocator into helper file to share between + arena and red/black tree tests. + + * WebKit.gyp: + * tests/ArenaTestHelpers.h: Added. + (WebCore::ArenaTestHelpers::TrackedAllocator::create): + (WebCore::ArenaTestHelpers::TrackedAllocator::allocate): + (WebCore::ArenaTestHelpers::TrackedAllocator::free): + (WebCore::ArenaTestHelpers::TrackedAllocator::isEmpty): + (WebCore::ArenaTestHelpers::TrackedAllocator::numRegions): + (WebCore::ArenaTestHelpers::TrackedAllocator::TrackedAllocator): + * tests/PODArenaTest.cpp: + * tests/PODRedBlackTreeTest.cpp: + (WebCore::TEST): + +2010-09-09 Tony Chang <tony@chromium.org> + + Reviewed by Dimitri Glazkov. + + [chromium] make linux checksums computed from pngs to match windows + https://bugs.webkit.org/show_bug.cgi?id=45465 + + * src/WebKit.cpp: + (WebKit::areLayoutTestImagesOpaque): Make linux match windows. + +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: + (WebKit::WebAccessibilityObject::canSetSelectedAttribute): + (WebKit::WebAccessibilityObject::isCollapsed): + (WebKit::WebAccessibilityObject::isLinked): + (WebKit::WebAccessibilityObject::isReadOnly): + (WebKit::WebAccessibilityObject::isVisible): + +2010-09-08 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: add a sanity test for DOM storage view in the storage panel + https://bugs.webkit.org/show_bug.cgi?id=45294 + + * src/js/Tests.js: removed testStoragePanel which was superseded by inspector layout tests. + +2010-09-08 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: test that debugger won't pause on syntax errors + https://bugs.webkit.org/show_bug.cgi?id=45388 + + * src/js/Tests.js: removed testAutoContinueOnSyntaxError which is now covered by + inspector/debugger-autocontinue-on-syntax-error.html layout test + +2010-09-08 Peter Kasting <pkasting@google.com> + + Reviewed by David Hyatt. + + Add smooth scrolling framework, and a Windows implementation. + https://bugs.webkit.org/show_bug.cgi?id=32356 + + * src/WebScrollbarImpl.cpp: Plumb new ScrollbarClient functions. Allow wheel scrolls to be animated. + (WebKit::WebScrollbarImpl::setLocation): + (WebKit::WebScrollbarImpl::setValue): + (WebKit::WebScrollbarImpl::scroll): + (WebKit::WebScrollbarImpl::onMouseWheel): + (WebKit::WebScrollbarImpl::onKeyDown): + (WebKit::WebScrollbarImpl::setScrollOffsetFromAnimation): + * src/WebScrollbarImpl.h: Plumb new ScrollbarClient functions. + * src/win/WebInputEventFactory.cpp: Update comments now that we have smooth scrolling. + (WebKit::WebInputEventFactory::mouseWheelEvent): + +2010-09-08 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: remove some obsolete interactive tests + https://bugs.webkit.org/show_bug.cgi?id=45371 + + * src/js/Tests.js: + +2010-09-08 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + Plug leak in WebDeviceOrientationClientMock + https://bugs.webkit.org/show_bug.cgi?id=45305 + + WebDeviceOrientationClientMock is responsible for destroying the + WebDeviceOrientationController object pointed to by the argument + passed to the setController() member function. + + Also use the new WebPrivateOnwPtr for m_clientMock. + + * public/WebDeviceOrientationClientMock.h: + * src/WebDeviceOrientationClientMock.cpp: + (WebKit::WebDeviceOrientationClientMock::setController): + (WebKit::WebDeviceOrientationClientMock::initialize): + (WebKit::WebDeviceOrientationClientMock::reset): + +2010-09-07 Tony Chang <tony@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Make a public flag for how DRT generates bitmaps on Linux + https://bugs.webkit.org/show_bug.cgi?id=45133 + + This is so it's possible for me to fix + http://code.google.com/p/chromium/issues/detail?id=21386 . + + * public/WebKit.h: Add areLayoutTestImagesOpaque() + * src/WebKit.cpp: + (WebKit::areLayoutTestImagesOpaque): + +2010-09-07 Dimitri Glazkov <dglazkov@chromium.org> + + Unreviewed, rolling out r66886. + http://trac.webkit.org/changeset/66886 + https://bugs.webkit.org/show_bug.cgi?id=45112 + + Made + + * public/WebGeolocationService.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::getWebViewClient): + (WebKit::WebGeolocationServiceBridgeImpl::onWebGeolocationServiceDestroyed): + * src/WebGeolocationServiceMock.cpp: + +2010-09-07 Jonathan Dixon <joth@chromium.org> + + Reviewed by Jeremy Orlow. + + 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 + + * public/WebGeolocationServiceBridge.h: + (WebKit::WebGeolocationServiceBridge::~WebGeolocationServiceBridge): + * src/WebGeolocationServiceBridgeImpl.cpp: + (WebKit::WebGeolocationServiceBridgeImpl::WebGeolocationServiceBridgeImpl): + (WebKit::WebGeolocationServiceBridgeImpl::~WebGeolocationServiceBridgeImpl): + (WebKit::WebGeolocationServiceBridgeImpl::startUpdating): + (WebKit::WebGeolocationServiceBridgeImpl::stopUpdating): + (WebKit::WebGeolocationServiceBridgeImpl::suspend): + (WebKit::WebGeolocationServiceBridgeImpl::resume): + (WebKit::WebGeolocationServiceBridgeImpl::attachBridgeIfNeeded): + +2010-09-07 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: upstream two debugger tests + https://bugs.webkit.org/show_bug.cgi?id=45262 + + * src/js/Tests.js: + +2010-09-06 Jonathan Dixon <joth@chromium.org> + + Reviewed by Jeremy Orlow. + + Add new interface and empty impl. as precursor to bug 45112 + https://bugs.webkit.org/show_bug.cgi?id=45257 + + * public/WebGeolocationServiceBridge.h: + (WebKit::WebGeolocationServiceBridge::~WebGeolocationServiceBridge): + * src/WebGeolocationServiceBridgeImpl.cpp: + (WebKit::WebGeolocationServiceBridgeImpl::onWebGeolocationServiceDestroyed): + +2010-09-06 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: fix chromium devtools tests + https://bugs.webkit.org/show_bug.cgi?id=45258 + + * src/js/Tests.js: + (.TestSuite.prototype._waitForScriptPause): + +2010-08-26 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Add index insertion support to IndexedDB. + https://bugs.webkit.org/show_bug.cgi?id=44695 + + Add asserts on the [] operator. + + * public/WebVector.h: + (WebKit::WebVector::operator[]): + +2010-09-06 Anton Muhin <antonm@chromium.org> + + Reviewed by Adam Barth. + + [v8] bypass caches when query memory usage from post GC and in crash handler. + https://bugs.webkit.org/show_bug.cgi?id=45036 + + Add Chromium-specific API to query actual memory usage which bypasses any caches. + + * public/WebKitClient.h: + (WebKit::WebKitClient::actualMemoryUsageMB): + * src/ChromiumBridge.cpp: + (WebCore::ChromiumBridge::actualMemoryUsageMB): + +2010-09-05 Peter Kasting <pkasting@google.com> + + Reviewed by Adam Barth. + + Make Chromium/Mac generate continuous mousewheel events with the same wheelDelta values as Safari/Mac. + https://bugs.webkit.org/show_bug.cgi?id=45155 + + * src/mac/WebInputEventFactory.mm: + (WebKit::WebInputEventFactory::mouseWheelEvent): + +2010-09-05 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: remove WebDevToolsAgentClient::forceRepaint which is not used + https://bugs.webkit.org/show_bug.cgi?id=45179 + + * public/WebDevToolsAgentClient.h: + * src/DebuggerAgentImpl.cpp: + (WebKit::DebuggerAgentImpl::debuggerOutput): + * src/WebDevToolsAgentImpl.cpp: + * src/WebDevToolsAgentImpl.h: + +2010-09-05 Kenneth Russell <kbr@google.com> + + Reviewed by Darin Fisher. + + Add unit tests for interval tree + https://bugs.webkit.org/show_bug.cgi?id=45161 + + * WebKit.gyp: + * tests/PODIntervalTreeTest.cpp: Added. + (WebCore::valueToString): + (WebCore::TEST): + (WebCore::UserData1::valueToString): + (WebCore::EndpointType1::valueToString): + +2010-09-05 Kenneth Russell <kbr@google.com> + + Reviewed by Darin Fisher. + + Add unit tests for red-black tree and (POD) arena + https://bugs.webkit.org/show_bug.cgi?id=45060 + + * WebKit.gyp: + * tests/PODArenaTest.cpp: Added. + (WebCore::TestClass1::TestClass2::TestClass2): + (WebCore::TEST_F): + * tests/PODRedBlackTreeTest.cpp: Added. + (WebCore::TEST): + * tests/TreeTestHelpers.cpp: Added. + (WebCore::TreeTestHelpers::generateSeed): + (WebCore::TreeTestHelpers::initRandom): + (WebCore::TreeTestHelpers::nextRandom): + * tests/TreeTestHelpers.h: Added. + +2010-09-03 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 + + Add Chromium's implementation of NetworkingContext. + + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::createNetworkingContext): + * src/FrameLoaderClientImpl.h: + +2010-09-02 Vangelis Kokkevis <vangelis@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Revert to software compositing if the accelerated + compositor fails to initialize. If we tried to initialize the compositor + for this WebView and failed, next time the associated chrome client is + asked whether it can do accelerated compositing it will return false. + https://bugs.webkit.org/show_bug.cgi?id=45124 + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::allowsAcceleratedCompositing): + * src/ChromeClientImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::paint): + (WebKit::WebViewImpl::allowsAcceleratedCompositing): + (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): + (WebKit::WebViewImpl::getOnscreenGLES2Context): + * src/WebViewImpl.h: + +2010-09-03 James Robinson <jamesr@chromium.org> + + [chromium] Add one more include to fix the mac compile. + + * src/GraphicsContext3D.cpp: + +2010-09-03 James Robinson <jamesr@chromium.org> + + [chromium] Compile fixes for 66746. + + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::paintRenderingResultsToCanvas): + +2010-09-03 Tony Chang <tony@chromium.org> + + Unreviewed, remove svn:executable flag from images and css files. + + * src/js/Images/segmentChromium.png: Removed property svn:executable. + * src/js/Images/segmentHoverChromium.png: Removed property svn:executable. + * src/js/Images/segmentHoverEndChromium.png: Removed property svn:executable. + * src/js/Images/segmentSelectedChromium.png: Removed property svn:executable. + * src/js/Images/segmentSelectedEndChromium.png: Removed property svn:executable. + * src/js/Images/statusbarBackgroundChromium.png: Removed property svn:executable. + * src/js/Images/statusbarBottomBackgroundChromium.png: Removed property svn:executable. + * src/js/Images/statusbarButtonsChromium.png: Removed property svn:executable. + * src/js/Images/statusbarMenuButtonChromium.png: Removed property svn:executable. + * src/js/Images/statusbarMenuButtonSelectedChromium.png: Removed property svn:executable. + * src/js/devTools.css: Removed property svn:executable. + +2010-09-03 James Robinson <jamesr@chromium.org> + + Reviewed by Chris Marrin. + + Multiple accelerated 2D canvases should be able to use the same GraphicsContext3D + https://bugs.webkit.org/show_bug.cgi?id=44926 + + Adds a SharedContext3D to WebViewImpl. The SharedContext3D has to live on WebViewImpl to be + tied to the lifetime of the compositor context. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::getSharedGraphicsContext3D): + * src/ChromeClientImpl.h: + * src/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3DInternal::initialize): + (WebCore::GraphicsContext3DInternal::platformLayer): + (WebCore::GraphicsContext3D::platformLayer): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::getSharedGraphicsContext3D): + * src/WebViewImpl.h: + +2010-08-31 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + IDBCursor.continue() should reuse the .openCursor's IDBRequest object + https://bugs.webkit.org/show_bug.cgi?id=44953 + + * src/WebIDBCallbacksImpl.cpp: + (WebCore::WebIDBCallbacksImpl::onError): + (WebCore::WebIDBCallbacksImpl::onSuccess): + +2010-09-02 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + REGRESSION: Crash occurs at objc_msgSend when closing a window that is displaying the web inspector + https://bugs.webkit.org/show_bug.cgi?id=44230 + + * src/InspectorFrontendClientImpl.cpp: + (WebKit::InspectorFrontendClientImpl::disconnectFromBackend): + * src/InspectorFrontendClientImpl.h: + +2010-09-02 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Remove obsolete public/API methods in chromium port + https://bugs.webkit.org/show_bug.cgi?id=45108 + + * public/WebSpeechInputController.h: + (WebKit::WebSpeechInputController::startRecognition): + +2010-09-02 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Remove dependency to base/task.h and base/timer.h + https://bugs.webkit.org/show_bug.cgi?id=45091 + + * DEPS: Roll Chromium revision to 58277 in order to have + webkit_support::PostDelayedTask(). + 2010-09-02 Ilya Sherman <isherman@google.com> Reviewed by Eric Seidel. diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS index 6252f08..2fc218b 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': '57823', + 'chromium_rev': '58277', } deps = { diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp index c75cac7..11246fa 100644 --- a/WebKit/chromium/WebKit.gyp +++ b/WebKit/chromium/WebKit.gyp @@ -733,13 +733,19 @@ 'src', ], 'sources': [ + 'tests/ArenaTestHelpers.h', 'tests/DragImageTest.cpp', 'tests/IDBBindingUtilitiesTest.cpp', 'tests/IDBKeyPathTest.cpp', 'tests/KeyboardTest.cpp', 'tests/KURLTest.cpp', + 'tests/PODArenaTest.cpp', + 'tests/PODIntervalTreeTest.cpp', + 'tests/PODRedBlackTreeTest.cpp', 'tests/RunAllTests.cpp', 'tests/TilingDataTest.cpp', + 'tests/TreeTestHelpers.cpp', + 'tests/TreeTestHelpers.h', ], 'conditions': [ ['OS=="win"', { diff --git a/WebKit/chromium/public/WebAccessibilityObject.h b/WebKit/chromium/public/WebAccessibilityObject.h index ddb9bda..6b55376 100644 --- a/WebKit/chromium/public/WebAccessibilityObject.h +++ b/WebKit/chromium/public/WebAccessibilityObject.h @@ -81,17 +81,22 @@ public: WEBKIT_API WebAccessibilityObject parentObject() const; WEBKIT_API WebAccessibilityObject previousSibling() const; + WEBKIT_API bool canSetSelectedAttribute() const; WEBKIT_API bool isAnchor() const; WEBKIT_API bool isChecked() const; + WEBKIT_API bool isCollapsed() const; WEBKIT_API bool isFocused() const; WEBKIT_API bool isEnabled() const; WEBKIT_API bool isHovered() const; WEBKIT_API bool isIndeterminate() const; + WEBKIT_API bool isLinked() const; WEBKIT_API bool isMultiSelectable() const; WEBKIT_API bool isOffScreen() const; WEBKIT_API bool isPasswordField() const; WEBKIT_API bool isPressed() const; WEBKIT_API bool isReadOnly() const; + WEBKIT_API bool isSelected() const; + WEBKIT_API bool isVisible() const; WEBKIT_API bool isVisited() const; WEBKIT_API WebRect boundingBoxRect() const; diff --git a/WebKit/chromium/public/WebDevToolsAgentClient.h b/WebKit/chromium/public/WebDevToolsAgentClient.h index 087ac0b..b373b60 100644 --- a/WebKit/chromium/public/WebDevToolsAgentClient.h +++ b/WebKit/chromium/public/WebDevToolsAgentClient.h @@ -44,9 +44,6 @@ public: virtual void sendDebuggerOutput(const WebString&) { } virtual void sendDispatchToAPU(const WebString&) { } - // Invalidates widget which leads to the repaint. - virtual void forceRepaint() { } - // Returns the identifier of the entity hosting this agent. virtual int hostIdentifier() { return -1; } diff --git a/WebKit/chromium/public/WebDeviceOrientationClientMock.h b/WebKit/chromium/public/WebDeviceOrientationClientMock.h index fce964b..9cbccf7 100644 --- a/WebKit/chromium/public/WebDeviceOrientationClientMock.h +++ b/WebKit/chromium/public/WebDeviceOrientationClientMock.h @@ -28,6 +28,7 @@ #include "WebCommon.h" #include "WebDeviceOrientationClient.h" +#include "WebPrivateOwnPtr.h" namespace WebCore { class DeviceOrientationClientMock; } @@ -49,7 +50,7 @@ private: WEBKIT_API void initialize(); WEBKIT_API void reset(); - WebCore::DeviceOrientationClientMock* m_clientMock; + WebPrivateOwnPtr<WebCore::DeviceOrientationClientMock> m_clientMock; }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebGeolocationServiceBridge.h b/WebKit/chromium/public/WebGeolocationServiceBridge.h index 9f0ffd4..422b32b 100644 --- a/WebKit/chromium/public/WebGeolocationServiceBridge.h +++ b/WebKit/chromium/public/WebGeolocationServiceBridge.h @@ -47,6 +47,10 @@ 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; + +protected: + virtual ~WebGeolocationServiceBridge() {} }; } // namespace WebKit diff --git a/WebKit/chromium/public/WebKit.h b/WebKit/chromium/public/WebKit.h index 732cac6..5550db1 100644 --- a/WebKit/chromium/public/WebKit.h +++ b/WebKit/chromium/public/WebKit.h @@ -55,6 +55,11 @@ 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/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h index 9c0b4c2..0f282e0 100644 --- a/WebKit/chromium/public/WebKitClient.h +++ b/WebKit/chromium/public/WebKitClient.h @@ -163,6 +163,9 @@ public: // That is committed size for Windows and virtual memory size for POSIX virtual size_t memoryUsageMB() { return 0; } + // Same as above, but always returns actual value, without any caches. + virtual size_t actualMemoryUsageMB() { return 0; } + // Message Ports ------------------------------------------------------- diff --git a/WebKit/chromium/public/WebSpeechInputController.h b/WebKit/chromium/public/WebSpeechInputController.h index 0315722..5408741 100644 --- a/WebKit/chromium/public/WebSpeechInputController.h +++ b/WebKit/chromium/public/WebSpeechInputController.h @@ -45,11 +45,6 @@ public: // text are returned via the listener interface. virtual bool startRecognition(int requestId, const WebRect&) { - return startRecognition(requestId); - } - // FIXME: Remove this once chromium has picked up this change. - virtual bool startRecognition(int) - { WEBKIT_ASSERT_NOT_REACHED(); return false; } diff --git a/WebKit/chromium/public/WebVector.h b/WebKit/chromium/public/WebVector.h index 0520895..cf3ec95 100644 --- a/WebKit/chromium/public/WebVector.h +++ b/WebKit/chromium/public/WebVector.h @@ -115,8 +115,16 @@ public: size_t size() const { return m_size; } bool isEmpty() const { return !m_size; } - T& operator[](size_t i) { return m_ptr[i]; } - const T& operator[](size_t i) const { return m_ptr[i]; } + T& operator[](size_t i) + { + WEBKIT_ASSERT(i < m_size); + return m_ptr[i]; + } + const T& operator[](size_t i) const + { + WEBKIT_ASSERT(i < m_size); + return m_ptr[i]; + } T* data() { return m_ptr; } const T* data() const { return m_ptr; } diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index e6f1400..8a3eda6 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -59,6 +59,7 @@ #include "SearchPopupMenuChromium.h" #include "ScriptController.h" #include "SecurityOrigin.h" +#include "SharedGraphicsContext3D.h" #include "WebGeolocationService.h" #if USE(V8) #include "V8Proxy.h" @@ -749,8 +750,18 @@ void ChromeClientImpl::scheduleCompositingLayerSync() { m_webView->setRootLayerNeedsDisplay(); } + +bool ChromeClientImpl::allowsAcceleratedCompositing() const +{ + return m_webView->allowsAcceleratedCompositing(); +} #endif +WebCore::SharedGraphicsContext3D* ChromeClientImpl::getSharedGraphicsContext3D() +{ + return m_webView->getSharedGraphicsContext3D(); +} + bool ChromeClientImpl::supportsFullscreenForNode(const WebCore::Node* node) { if (m_webView->client() && node->hasTagName(WebCore::HTMLNames::videoTag)) diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h index bff9f90..d16d8f6 100644 --- a/WebKit/chromium/src/ChromeClientImpl.h +++ b/WebKit/chromium/src/ChromeClientImpl.h @@ -150,8 +150,13 @@ public: // Sets a flag to specify that the view needs to be updated, so we need // to do an eager layout before the drawing. virtual void scheduleCompositingLayerSync(); + + // Returns true if accelerated compositing is supported. + virtual bool allowsAcceleratedCompositing() const; #endif + virtual WebCore::SharedGraphicsContext3D* getSharedGraphicsContext3D(); + virtual bool supportsFullscreenForNode(const WebCore::Node*); virtual void enterFullscreenForNode(WebCore::Node*); virtual void exitFullscreenForNode(WebCore::Node*); diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index 911dcf3..3ced7b8 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -823,6 +823,11 @@ int ChromiumBridge::memoryUsageMB() return static_cast<int>(webKitClient()->memoryUsageMB()); } +int ChromiumBridge::actualMemoryUsageMB() +{ + return static_cast<int>(webKitClient()->actualMemoryUsageMB()); +} + int ChromiumBridge::screenDepth(Widget* widget) { WebWidgetClient* client = toWebWidgetClient(widget); diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp index 1dc2ee7..ef611e1 100644 --- a/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -98,7 +98,7 @@ static bool isASingleWord(const String& text) static String selectMisspelledWord(const ContextMenu* defaultMenu, Frame* selectedFrame) { // First select from selectedText to check for multiple word selection. - String misspelledWord = selectedFrame->selectedText().stripWhiteSpace(); + String misspelledWord = selectedFrame->editor()->selectedText().stripWhiteSpace(); // If some texts were already selected, we don't change the selection. if (!misspelledWord.isEmpty()) { @@ -119,7 +119,7 @@ static String selectMisspelledWord(const ContextMenu* defaultMenu, Frame* select return misspelledWord; // It is empty. WebFrameImpl::selectWordAroundPosition(selectedFrame, pos); - misspelledWord = selectedFrame->selectedText().stripWhiteSpace(); + misspelledWord = selectedFrame->editor()->selectedText().stripWhiteSpace(); #if OS(DARWIN) // If misspelled word is still empty, then that portion should not be @@ -233,7 +233,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( data.frameURL = urlFromFrame(selectedFrame); if (r.isSelected()) - data.selectedText = selectedFrame->selectedText().stripWhiteSpace(); + data.selectedText = selectedFrame->editor()->selectedText().stripWhiteSpace(); if (r.isContentEditable()) { data.isEditable = true; diff --git a/WebKit/chromium/src/DebuggerAgentImpl.cpp b/WebKit/chromium/src/DebuggerAgentImpl.cpp index 46c6e7c..5dd5c58 100644 --- a/WebKit/chromium/src/DebuggerAgentImpl.cpp +++ b/WebKit/chromium/src/DebuggerAgentImpl.cpp @@ -60,7 +60,6 @@ DebuggerAgentImpl::~DebuggerAgentImpl() void DebuggerAgentImpl::debuggerOutput(const String& command) { m_webdevtoolsAgentClient->sendDebuggerOutput(command); - m_webdevtoolsAgent->forceRepaint(); } WebCore::Page* DebuggerAgentImpl::page() diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 74186bf..ea668c7 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -37,6 +37,7 @@ #include "FormState.h" #include "FrameLoader.h" #include "FrameLoadRequest.h" +#include "FrameNetworkingContextImpl.h" #include "FrameView.h" #include "HTTPParsers.h" #include "HistoryItem.h" @@ -1512,4 +1513,9 @@ PassOwnPtr<WebPluginLoadObserver> FrameLoaderClientImpl::pluginLoadObserver() return ds->releasePluginLoadObserver(); } +PassRefPtr<FrameNetworkingContext> FrameLoaderClientImpl::createNetworkingContext() +{ + return FrameNetworkingContextImpl::create(m_webFrame->frame()); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h index 3a8a714..361bae4 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -198,6 +198,8 @@ public: virtual void didNotAllowScript(); virtual void didNotAllowPlugins(); + virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); + private: void makeDocumentView(); diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index 6bc5ffe..3051b9b 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -35,7 +35,7 @@ #include "GraphicsContext3D.h" #include "CachedImage.h" -#include "CanvasLayerChromium.h" +#include "WebGLLayerChromium.h" #include "CanvasRenderingContext.h" #include "Chrome.h" #include "ChromeClientImpl.h" @@ -55,6 +55,7 @@ #if PLATFORM(CG) #include "GraphicsContext.h" +#include "WebGLRenderingContext.h" #include <CoreGraphics/CGContext.h> #include <CoreGraphics/CGImage.h> #endif @@ -103,7 +104,7 @@ public: void prepareTexture(); #if USE(ACCELERATED_COMPOSITING) - CanvasLayerChromium* platformLayer() const; + WebGLLayerChromium* platformLayer() const; #endif bool isGLES2Compliant() const; bool isGLES2NPOTStrict() const; @@ -298,7 +299,7 @@ private: OwnPtr<WebKit::WebGraphicsContext3D> m_impl; WebKit::WebViewImpl* m_webViewImpl; #if USE(ACCELERATED_COMPOSITING) - RefPtr<CanvasLayerChromium> m_compositingLayer; + RefPtr<WebGLLayerChromium> m_compositingLayer; #endif #if PLATFORM(SKIA) // If the width and height of the Canvas's backing store don't @@ -360,7 +361,7 @@ bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, m_impl.set(webContext); #if USE(ACCELERATED_COMPOSITING) - m_compositingLayer = CanvasLayerChromium::create(0); + m_compositingLayer = WebGLLayerChromium::create(0); #endif return true; } @@ -381,7 +382,7 @@ void GraphicsContext3DInternal::prepareTexture() } #if USE(ACCELERATED_COMPOSITING) -CanvasLayerChromium* GraphicsContext3DInternal::platformLayer() const +WebGLLayerChromium* GraphicsContext3DInternal::platformLayer() const { return m_compositingLayer.get(); } @@ -436,10 +437,10 @@ void GraphicsContext3DInternal::paintRenderingResultsToCanvas(CanvasRenderingCon canvas.drawBitmapRect(m_resizingBitmap, 0, dst); } #elif PLATFORM(CG) - if (m_renderOutput) - context->graphicsContext3D()->paintToCanvas(m_renderOutput, m_impl->width(), m_impl->height(), - canvas->width(), canvas->height(), - imageBuffer->context()->platformContext()); + if (m_renderOutput && context->is3d()) { + WebGLRenderingContext* webGLContext = static_cast<WebGLRenderingContext*>(context); + webGLContext->graphicsContext3D()->paintToCanvas(m_renderOutput, m_impl->width(), m_impl->height(), canvas->width(), canvas->height(), imageBuffer->context()->platformContext()); + } #else #error Must port to your platform #endif @@ -1039,7 +1040,7 @@ void GraphicsContext3D::prepareTexture() #if USE(ACCELERATED_COMPOSITING) PlatformLayer* GraphicsContext3D::platformLayer() const { - CanvasLayerChromium* canvasLayer = m_internal->platformLayer(); + WebGLLayerChromium* canvasLayer = m_internal->platformLayer(); canvasLayer->setContext(this); return canvasLayer; } diff --git a/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index 46f2cb6..51864f1 100644 --- a/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -105,6 +105,11 @@ void InspectorFrontendClientImpl::closeWindow() m_client->closeWindow(); } +void InspectorFrontendClientImpl::disconnectFromBackend() +{ + m_client->closeWindow(); +} + void InspectorFrontendClientImpl::requestAttachWindow() { m_client->requestDockWindow(); diff --git a/WebKit/chromium/src/InspectorFrontendClientImpl.h b/WebKit/chromium/src/InspectorFrontendClientImpl.h index 1507bf2..fc21f3e 100644 --- a/WebKit/chromium/src/InspectorFrontendClientImpl.h +++ b/WebKit/chromium/src/InspectorFrontendClientImpl.h @@ -61,6 +61,7 @@ public: virtual void bringToFront(); virtual void closeWindow(); + virtual void disconnectFromBackend(); virtual void requestAttachWindow(); virtual void requestDetachWindow(); diff --git a/WebKit/chromium/src/WebAccessibilityObject.cpp b/WebKit/chromium/src/WebAccessibilityObject.cpp index 4263e8b..3a3e94b 100644 --- a/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -182,6 +182,15 @@ WebAccessibilityObject WebAccessibilityObject::previousSibling() const return WebAccessibilityObject(m_private->previousSibling()); } +bool WebAccessibilityObject::canSetSelectedAttribute() const +{ + if (!m_private) + return 0; + + m_private->updateBackingStore(); + return m_private->canSetSelectedAttribute(); +} + bool WebAccessibilityObject::isAnchor() const { if (!m_private) @@ -200,6 +209,15 @@ bool WebAccessibilityObject::isChecked() const return m_private->isChecked(); } +bool WebAccessibilityObject::isCollapsed() const +{ + if (!m_private) + return 0; + + m_private->updateBackingStore(); + return m_private->isCollapsed(); +} + bool WebAccessibilityObject::isFocused() const { @@ -237,6 +255,15 @@ bool WebAccessibilityObject::isIndeterminate() const return m_private->isIndeterminate(); } +bool WebAccessibilityObject::isLinked() const +{ + if (!m_private) + return 0; + + m_private->updateBackingStore(); + return m_private->isLinked(); +} + bool WebAccessibilityObject::isMultiSelectable() const { if (!m_private) @@ -282,6 +309,24 @@ bool WebAccessibilityObject::isReadOnly() const return m_private->isReadOnly(); } +bool WebAccessibilityObject::isSelected() const +{ + if (!m_private) + return 0; + + m_private->updateBackingStore(); + return m_private->isSelected(); +} + +bool WebAccessibilityObject::isVisible() const +{ + if (!m_private) + return 0; + + m_private->updateBackingStore(); + return m_private->isVisible(); +} + bool WebAccessibilityObject::isVisited() const { if (!m_private) diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index fbb06f8..971c290 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -239,11 +239,6 @@ void WebDevToolsAgentImpl::didClearWindowObject(WebFrameImpl* webframe) DebuggerAgentManager::setHostId(webframe, m_hostId); } -void WebDevToolsAgentImpl::forceRepaint() -{ - m_client->forceRepaint(); -} - void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message) { inspectorController()->inspectorBackendDispatcher()->dispatch(message); diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.h b/WebKit/chromium/src/WebDevToolsAgentImpl.h index da584fb..36cafcf 100644 --- a/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -99,8 +99,6 @@ public: virtual void timelineProfilerWasStopped(); virtual bool sendMessageToFrontend(const WTF::String&); - void forceRepaint(); - int hostId() { return m_hostId; } private: diff --git a/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp b/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp index 4011d12..820c970 100644 --- a/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp +++ b/WebKit/chromium/src/WebDeviceOrientationClientMock.cpp @@ -35,6 +35,7 @@ namespace WebKit { void WebDeviceOrientationClientMock::setController(WebDeviceOrientationController* controller) { m_clientMock->setController(controller->controller()); + delete controller; } void WebDeviceOrientationClientMock::startUpdating() @@ -59,13 +60,12 @@ void WebDeviceOrientationClientMock::setOrientation(WebDeviceOrientation& orient void WebDeviceOrientationClientMock::initialize() { - m_clientMock = new WebCore::DeviceOrientationClientMock(); + m_clientMock.reset(new WebCore::DeviceOrientationClientMock()); } void WebDeviceOrientationClientMock::reset() { - delete m_clientMock; - m_clientMock = 0; + m_clientMock.reset(0); } } // namespace WebKit diff --git a/WebKit/chromium/src/WebFrameImpl.cpp b/WebKit/chromium/src/WebFrameImpl.cpp index eb0db7e..a2d6a46 100644 --- a/WebKit/chromium/src/WebFrameImpl.cpp +++ b/WebKit/chromium/src/WebFrameImpl.cpp @@ -1356,7 +1356,7 @@ bool WebFrameImpl::find(int identifier, } ASSERT(frame() && frame()->view()); - bool found = frame()->findString( + bool found = frame()->editor()->findString( searchText, options.forward, options.matchCase, wrapWithinFrame, startInSelection); if (found) { @@ -1439,7 +1439,7 @@ void WebFrameImpl::stopFinding(bool clearSelection) // Remove all markers for matches found and turn off the highlighting. frame()->document()->markers()->removeMarkers(DocumentMarker::TextMatch); - frame()->setMarkedTextMatchesAreHighlighted(false); + frame()->editor()->setMarkedTextMatchesAreHighlighted(false); // Let the frame know that we don't want tickmarks or highlighting anymore. invalidateArea(InvalidateAll); @@ -1460,7 +1460,7 @@ void WebFrameImpl::scopeStringMatches(int identifier, // Scoping is just about to begin. m_scopingComplete = false; // Clear highlighting for this frame. - if (frame()->markedTextMatchesAreHighlighted()) + if (frame()->editor()->markedTextMatchesAreHighlighted()) frame()->page()->unmarkAllTextMatches(); // Clear the counters from last operation. m_lastMatchCount = 0; @@ -1585,7 +1585,7 @@ void WebFrameImpl::scopeStringMatches(int identifier, m_lastSearchString = searchText; if (matchCount > 0) { - frame()->setMarkedTextMatchesAreHighlighted(true); + frame()->editor()->setMarkedTextMatchesAreHighlighted(true); m_lastMatchCount += matchCount; diff --git a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp index 3c3a1db..bbb7162 100644 --- a/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp +++ b/WebKit/chromium/src/WebGeolocationServiceBridgeImpl.cpp @@ -79,6 +79,7 @@ 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(); private: WebViewClient* getWebViewClient(); @@ -176,6 +177,10 @@ WebViewClient* WebGeolocationServiceBridgeImpl::getWebViewClient() return webViewClient; } +void WebGeolocationServiceBridgeImpl::onWebGeolocationServiceDestroyed() +{ +} + } // namespace WebKit #endif // ENABLE(GEOLOCATION) diff --git a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp index e543123..fe67789 100644 --- a/WebKit/chromium/src/WebIDBCallbacksImpl.cpp +++ b/WebKit/chromium/src/WebIDBCallbacksImpl.cpp @@ -57,49 +57,41 @@ WebIDBCallbacksImpl::~WebIDBCallbacksImpl() void WebIDBCallbacksImpl::onError(const WebKit::WebIDBDatabaseError& error) { m_callbacks->onError(error); - m_callbacks.clear(); } void WebIDBCallbacksImpl::onSuccess() { m_callbacks->onSuccess(); - m_callbacks.clear(); } void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBCursor* cursor) { m_callbacks->onSuccess(IDBCursorBackendProxy::create(cursor)); - m_callbacks.clear(); } void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBDatabase* webKitInstance) { m_callbacks->onSuccess(IDBDatabaseProxy::create(webKitInstance)); - m_callbacks.clear(); } void WebIDBCallbacksImpl::onSuccess(const WebKit::WebIDBKey& key) { m_callbacks->onSuccess(key); - m_callbacks.clear(); } void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBIndex* webKitInstance) { m_callbacks->onSuccess(IDBIndexBackendProxy::create(webKitInstance)); - m_callbacks.clear(); } void WebIDBCallbacksImpl::onSuccess(WebKit::WebIDBObjectStore* webKitInstance) { m_callbacks->onSuccess(IDBObjectStoreProxy::create(webKitInstance)); - m_callbacks.clear(); } void WebIDBCallbacksImpl::onSuccess(const WebKit::WebSerializedScriptValue& serializedScriptValue) { m_callbacks->onSuccess(serializedScriptValue); - m_callbacks.clear(); } } // namespace WebCore diff --git a/WebKit/chromium/src/WebKit.cpp b/WebKit/chromium/src/WebKit.cpp index cadcb6c..f3336ea 100644 --- a/WebKit/chromium/src/WebKit.cpp +++ b/WebKit/chromium/src/WebKit.cpp @@ -103,6 +103,11 @@ 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/WebScrollbarImpl.cpp b/WebKit/chromium/src/WebScrollbarImpl.cpp index c0131cb..8b9e287 100644 --- a/WebKit/chromium/src/WebScrollbarImpl.cpp +++ b/WebKit/chromium/src/WebScrollbarImpl.cpp @@ -94,7 +94,7 @@ int WebScrollbarImpl::value() const void WebScrollbarImpl::setValue(int position) { - m_scrollbar->setValue(position); + m_scrollbar->setValue(position, Scrollbar::NotFromScrollAnimator); } void WebScrollbarImpl::setDocumentSize(int size) @@ -218,7 +218,7 @@ bool WebScrollbarImpl::onMouseWheel(const WebInputEvent& event) if (negative) delta *= -1; } - m_scrollbar->setValue(m_scrollbar->value() - delta); + m_scrollbar->scroll((m_scrollbar->orientation() == HorizontalScrollbar) ? WebCore::ScrollLeft : WebCore::ScrollUp, WebCore::ScrollByPixel, delta); return true; } @@ -262,6 +262,16 @@ bool WebScrollbarImpl::onKeyDown(const WebInputEvent& event) return false; } +int WebScrollbarImpl::scrollSize(WebCore::ScrollbarOrientation orientation) const +{ + return (orientation == m_scrollbar->orientation()) ? (m_scrollbar->totalSize() - m_scrollbar->visibleSize()) : 0; +} + +void WebScrollbarImpl::setScrollOffsetFromAnimation(const WebCore::IntPoint& offset) +{ + m_scrollbar->setValue((m_scrollbar->orientation() == HorizontalScrollbar) ? offset.x() : offset.y(), Scrollbar::FromScrollAnimator); +} + void WebScrollbarImpl::valueChanged(WebCore::Scrollbar*) { m_client->valueChanged(this); diff --git a/WebKit/chromium/src/WebScrollbarImpl.h b/WebKit/chromium/src/WebScrollbarImpl.h index a041ccc..5512867 100644 --- a/WebKit/chromium/src/WebScrollbarImpl.h +++ b/WebKit/chromium/src/WebScrollbarImpl.h @@ -58,6 +58,8 @@ public: virtual bool handleInputEvent(const WebInputEvent&); // WebCore::ScrollbarClient methods + virtual int scrollSize(WebCore::ScrollbarOrientation orientation) const; + virtual void setScrollOffsetFromAnimation(const WebCore::IntPoint&); virtual void valueChanged(WebCore::Scrollbar*); virtual void invalidateScrollbarRect(WebCore::Scrollbar*, const WebCore::IntRect&); virtual bool isActive() const; diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 4b129d6..137bf06 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -58,6 +58,7 @@ #include "GLES2Context.h" #include "GLES2ContextInternal.h" #include "GraphicsContext.h" +#include "GraphicsContext3D.h" #include "HTMLInputElement.h" #include "HTMLMediaElement.h" #include "HitTestResult.h" @@ -86,6 +87,7 @@ #include "SecurityOrigin.h" #include "SelectionController.h" #include "Settings.h" +#include "SharedGraphicsContext3D.h" #include "Timer.h" #include "TypingCommand.h" #include "UserGestureIndicator.h" @@ -263,6 +265,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devTools #if USE(ACCELERATED_COMPOSITING) , m_layerRenderer(0) , m_isAcceleratedCompositingActive(false) + , m_compositorCreationFailed(false) #endif #if ENABLE(INPUT_SPEECH) , m_speechInputClient(client) @@ -967,6 +970,7 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) IntRect contentRect = view->visibleContentRect(false); // Ask the layer compositor to redraw all the layers. + ASSERT(m_layerRenderer->hardwareCompositing()); m_layerRenderer->drawLayers(rect, visibleRect, contentRect, IntPoint(view->scrollX(), view->scrollY())); } #endif @@ -1274,7 +1278,7 @@ WebRect WebViewImpl::caretOrSelectionBounds() if (!node || !node->renderer()) return rect; RefPtr<Range> range = controller->toNormalizedRange(); - rect = view->contentsToWindow(focused->firstRectForRange(range.get())); + rect = view->contentsToWindow(focused->editor()->firstRectForRange(range.get())); } return rect; } @@ -2103,6 +2107,11 @@ bool WebViewImpl::tabsToLinks() const } #if USE(ACCELERATED_COMPOSITING) +bool WebViewImpl::allowsAcceleratedCompositing() +{ + return !m_compositorCreationFailed; +} + void WebViewImpl::setRootGraphicsLayer(WebCore::PlatformLayer* layer) { setIsAcceleratedCompositingActive(layer ? true : false); @@ -2117,15 +2126,15 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) if (active) { m_layerRenderer = LayerRendererChromium::create(getOnscreenGLES2Context()); - if (m_layerRenderer->hardwareCompositing()) { + 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_layerRenderer.clear(); m_isAcceleratedCompositingActive = false; + m_compositorCreationFailed = true; } } else { m_layerRenderer = 0; @@ -2212,17 +2221,21 @@ void WebViewImpl::setRootLayerNeedsDisplay() PassOwnPtr<GLES2Context> WebViewImpl::getOnscreenGLES2Context() { - return GLES2Context::create(GLES2ContextInternal::create(gles2Context(), false)); + WebGLES2Context* context = gles2Context(); + if (!context) + return 0; + return GLES2Context::create(GLES2ContextInternal::create(context, false)); } -PassOwnPtr<GLES2Context> WebViewImpl::getOffscreenGLES2Context() +SharedGraphicsContext3D* WebViewImpl::getSharedGraphicsContext3D() { - WebGLES2Context* context = webKitClient()->createGLES2Context(); - if (!context) - return 0; - if (!context->initialize(0, gles2Context())) - return 0; - return GLES2Context::create(GLES2ContextInternal::create(context, true)); + if (!m_sharedContext3D) { + GraphicsContext3D::Attributes attr; + OwnPtr<GraphicsContext3D> context = GraphicsContext3D::create(attr, m_page->chrome()); + m_sharedContext3D = SharedGraphicsContext3D::create(context.release()); + } + + return m_sharedContext3D.get(); } // Returns the GLES2 context associated with this View. If one doesn't exist diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index c296121..a42099c 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -324,15 +324,16 @@ public: #if USE(ACCELERATED_COMPOSITING) void setRootLayerNeedsDisplay(); void setRootGraphicsLayer(WebCore::PlatformLayer*); + bool allowsAcceleratedCompositing(); #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(); - PassOwnPtr<WebCore::GLES2Context> getOffscreenGLES2Context(); // Returns an onscreen context virtual WebGLES2Context* gles2Context(); + virtual WebCore::SharedGraphicsContext3D* getSharedGraphicsContext3D(); WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); } @@ -512,6 +513,7 @@ private: #if USE(ACCELERATED_COMPOSITING) OwnPtr<WebCore::LayerRendererChromium> m_layerRenderer; bool m_isAcceleratedCompositingActive; + bool m_compositorCreationFailed; #endif static const WebInputEvent* m_currentInputEvent; @@ -521,6 +523,8 @@ private: OwnPtr<WebGLES2Context> m_gles2Context; + RefPtr<WebCore::SharedGraphicsContext3D> m_sharedContext3D; + OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy; }; diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index 41574b4..2233463 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -219,40 +219,6 @@ TestSuite.prototype.addSniffer = function(receiver, methodName, override, opt_st /** - * Tests that the real injected host is present in the context. - */ -TestSuite.prototype.testHostIsPresent = function() -{ - this.assertTrue(typeof InspectorFrontendHost === "object" && !InspectorFrontendHost.isStub); -}; - - -/** - * Tests elements tree has an "HTML" root. - */ -TestSuite.prototype.testElementsTreeRoot = function() -{ - var doc = WebInspector.domAgent.document; - this.assertEquals("HTML", doc.documentElement.nodeName); - this.assertTrue(doc.documentElement.hasChildNodes()); -}; - - -/** - * Tests that main resource is present in the system and that it is - * the only resource. - */ -TestSuite.prototype.testMainResource = function() -{ - var tokens = []; - var resources = WebInspector.resources; - for (var id in resources) - tokens.push(resources[id].lastPathComponent); - this.assertEquals("simple_page.html", tokens.join(",")); -}; - - -/** * Tests that resources tab is enabled when corresponding item is selected. */ TestSuite.prototype.testEnableResourcesTab = function() @@ -628,71 +594,6 @@ TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function() }; -/** - * Tests that a breakpoint can be set. - */ -TestSuite.prototype.testSetBreakpoint = function() -{ - var test = this; - this.showPanel("scripts"); - - var breakpointLine = 16 - - this._waitUntilScriptsAreParsed(["debugger_test_page.html"], - function() { - test.showMainPageScriptSource_( - "debugger_test_page.html", - function(view, url) { - view._addBreakpoint(breakpointLine); - - test.evaluateInConsole_( - 'setTimeout("calculate()" , 0)', - function(resultText) { - test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); - }); - }); - }); - - this._waitForScriptPause( - { - functionsOnStack: ["calculate", ""], - lineNumber: breakpointLine, - lineText: " result = fib(lastVal++);" - }, - function() { - test.releaseControl(); - }); - - this.takeControl(); -}; - - -/** - * Tests that pause on exception works. - */ -TestSuite.prototype.testPauseOnException = function() -{ - this.showPanel("scripts"); - var test = this; - - InspectorBackend.setPauseOnExceptionsState(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions); - - this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html"]); - - this._waitForScriptPause( - { - functionsOnStack: ["throwAnException", "handleClick", ""], - lineNumber: 6, - lineText: " return unknown_var;" - }, - function() { - test.releaseControl(); - }); - - this.takeControl(); -}; - - // Tests that debugger works correctly if pause event occurs when DevTools // frontend is being loaded. TestSuite.prototype.testPauseWhenLoadingDevTools = function() @@ -864,54 +765,6 @@ TestSuite.prototype.evaluateInConsole_ = function(code, callback) /** - * Tests eval on call frame. - */ -TestSuite.prototype.testEvalOnCallFrame = function() -{ - this.showPanel("scripts"); - - var breakpointLine = 16; - - var test = this; - this._waitUntilScriptsAreParsed(["debugger_test_page.html"], - function() { - test.showMainPageScriptSource_( - "debugger_test_page.html", - function(view, url) { - view._addBreakpoint(breakpointLine); - - // Since breakpoints are ignored in evals' calculate() function is - // execute after zero-timeout so that the breakpoint is hit. - test.evaluateInConsole_( - 'setTimeout("calculate(123)" , 0)', - function(resultText) { - test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); - waitForBreakpointHit(); - }); - }); - }); - - function waitForBreakpointHit() { - test.addSniffer(WebInspector, - "pausedScript", - function(callFrames) { - test.assertEquals(2, callFrames.length, "Unexpected stack depth on the breakpoint. " + JSON.stringify(callFrames, null, 4)); - test.assertEquals("calculate", callFrames[0].functionName, "Unexpected top frame function."); - // Evaluate "e+1" where "e" is an argument of "calculate" function. - test.evaluateInConsole_( - "e+1", - function(resultText) { - test.assertEquals("124", resultText, 'Unexpected "e+1" value.'); - test.releaseControl(); - }); - }); - } - - this.takeControl(); -}; - - -/** * Tests that console auto completion works when script execution is paused. */ TestSuite.prototype.testCompletionOnPause = function() @@ -968,16 +821,6 @@ TestSuite.prototype.testCompletionOnPause = function() /** - * Tests that inspected page doesn't hang on reload if it contains a syntax - * error and DevTools window is open. - */ -TestSuite.prototype.testAutoContinueOnSyntaxError = function() -{ - // TODO(yurys): provide an implementation that works with ScriptDebugServer. -}; - - -/** * Checks current execution line against expectations. * @param {WebInspector.SourceFrame} sourceFrame * @param {number} lineNumber Expected line number @@ -1029,7 +872,8 @@ TestSuite.prototype._waitForScriptPause = function(expectations, callback) test.addSniffer( WebInspector, "pausedScript", - function(callFrames) { + function(details) { + var callFrames = details.callFrames; var functionsOnStack = []; for (var i = 0; i < callFrames.length; i++) functionsOnStack.push(callFrames[i].functionName); @@ -1393,85 +1237,6 @@ TestSuite.createKeyEvent = function(keyIdentifier) /** - * Tests the message loop re-entrancy. - */ -TestSuite.prototype.testMessageLoopReentrant = function() -{ - var test = this; - this.showPanel("scripts"); - - var breakpointLine = 16; - - WebInspector.showConsole(); - - this._waitUntilScriptsAreParsed(["debugger_test_page.html"], - function() { - test.showMainPageScriptSource_( - "debugger_test_page.html", - function(view, url) { - view._addBreakpoint(breakpointLine); - - test.evaluateInConsole_( - 'setTimeout("calculate()", 0)', - function(resultText) { - test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); - }); - - }); - }); - - // Wait until script is paused. - this.addSniffer( - WebInspector, - "pausedScript", - function(callFrames) { - test.evaluateInConsole_( - 'document.cookie', - test.releaseControl.bind(test)); // This callback will be invoked only if the test succeeds (i.e. no crash). - }); - - this.takeControl(); -}; - - -/** - * Tests that Storage panel can be open and that local DOM storage is added - * to the panel. - */ -TestSuite.prototype.testShowStoragePanel = function() -{ - var test = this; - this.addSniffer(WebInspector.panels.storage, "addDOMStorage", - function(storage) { - var orig = storage.getEntries; - storage.getEntries = function(callback) { - orig.call(this, function(entries) { - callback(entries); - test.releaseControl(); - }); - }; - try { - WebInspector.currentPanel.selectDOMStorage(storage.id); - storage.getEntries = orig; - } catch (e) { - test.fail("Exception in selectDOMStorage: " + e); - } - }); - this.showPanel("storage"); - - // Access localStorage so that it's pushed to the frontend. - this.evaluateInConsole_( - 'setTimeout("localStorage.x = 10" , 0)', - function(resultText) { - test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText); - }); - - // Wait until DOM storage is added to the panel. - this.takeControl(); -}; - - -/** * Test runner for the test suite. */ var uiTests = {}; diff --git a/WebKit/chromium/src/js/devTools.css b/WebKit/chromium/src/js/devTools.css index 9495fb8..9495fb8 100755..100644 --- a/WebKit/chromium/src/js/devTools.css +++ b/WebKit/chromium/src/js/devTools.css diff --git a/WebKit/chromium/src/mac/WebInputEventFactory.mm b/WebKit/chromium/src/mac/WebInputEventFactory.mm index 694155f..b4e09c0 100644 --- a/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -1178,22 +1178,19 @@ WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(NSEvent* event, NSView* // the point delta data instead, since we cannot distinguish trackpad data // from data from any other continuous device. + // Conversion between wheel delta amounts and number of pixels to scroll. + static const double scrollbarPixelsPerCocoaTick = 40.0; + if (CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventIsContinuous)) { - result.wheelTicksY = result.deltaY = - CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis1); - result.wheelTicksX = result.deltaX = - CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis2); + result.deltaX = CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis2); + result.deltaY = CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis1); + result.wheelTicksX = result.deltaX / scrollbarPixelsPerCocoaTick; + result.wheelTicksY = result.deltaY / scrollbarPixelsPerCocoaTick; } else { - result.wheelTicksY = - CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventDeltaAxis1); - result.wheelTicksX = - CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventDeltaAxis2); - - // Convert wheel delta amount to a number of pixels to scroll. - static const double scrollbarPixelsPerCocoaTick = 40.0; - result.deltaX = [event deltaX] * scrollbarPixelsPerCocoaTick; result.deltaY = [event deltaY] * scrollbarPixelsPerCocoaTick; + result.wheelTicksY = CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventDeltaAxis1); + result.wheelTicksX = CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventDeltaAxis2); } result.timeStampSeconds = [event timestamp]; diff --git a/WebKit/chromium/src/win/WebInputEventFactory.cpp b/WebKit/chromium/src/win/WebInputEventFactory.cpp index 4d83f22..d1d5869 100644 --- a/WebKit/chromium/src/win/WebInputEventFactory.cpp +++ b/WebKit/chromium/src/win/WebInputEventFactory.cpp @@ -403,6 +403,9 @@ WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(HWND hwnd, UINT message // smooth scrolling while Firefox doesn't, so it can get away with somewhat // larger scroll values without feeling as jerky. Here we use 100 px per // three lines (the default scroll amount is three lines per wheel tick). + // Even though we have smooth scrolling, we don't make this as large as IE + // because subjectively IE feels like it scrolls farther than you want while + // reading articles. static const float scrollbarPixelsPerLine = 100.0f / 3.0f; wheelDelta /= WHEEL_DELTA; float scrollDelta = wheelDelta; diff --git a/WebKit/chromium/tests/ArenaTestHelpers.h b/WebKit/chromium/tests/ArenaTestHelpers.h new file mode 100644 index 0000000..87f827d --- /dev/null +++ b/WebKit/chromium/tests/ArenaTestHelpers.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 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 ArenaTestHelpers_h +#define ArenaTestHelpers_h + +#include "PODArena.h" +#include <gtest/gtest.h> +#include <wtf/Vector.h> + +namespace WebCore { +namespace ArenaTestHelpers { + +// An allocator for the PODArena which tracks the regions which have +// been allocated. +class TrackedAllocator : public PODArena::FastMallocAllocator { +public: + static PassRefPtr<TrackedAllocator> create() + { + return adoptRef(new TrackedAllocator); + } + + virtual void* allocate(size_t size) + { + void* result = PODArena::FastMallocAllocator::allocate(size); + m_allocatedRegions.append(result); + return result; + } + + virtual void free(void* ptr) + { + size_t slot = m_allocatedRegions.find(ptr); + ASSERT_GE(slot, 0); + m_allocatedRegions.remove(slot); + PODArena::FastMallocAllocator::free(ptr); + } + + bool isEmpty() const + { + return !numRegions(); + } + + int numRegions() const + { + return m_allocatedRegions.size(); + } + +private: + TrackedAllocator() { } + Vector<void*> m_allocatedRegions; +}; + +} // namespace ArenaTestHelpers +} // namespace WebCore + +#endif // ArenaTestHelpers_h diff --git a/WebKit/chromium/tests/PODArenaTest.cpp b/WebKit/chromium/tests/PODArenaTest.cpp new file mode 100644 index 0000000..c5b1ede --- /dev/null +++ b/WebKit/chromium/tests/PODArenaTest.cpp @@ -0,0 +1,106 @@ +/* + * 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. + */ + +#include "config.h" + +#include "PODArena.h" + +#include "ArenaTestHelpers.h" +#include <algorithm> +#include <gtest/gtest.h> +#include <wtf/FastMalloc.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { + +using ArenaTestHelpers::TrackedAllocator; + +namespace { + +// A couple of simple structs to allocate. +struct TestClass1 { + TestClass1() + : x(0), y(0), z(0), w(1) { } + + float x, y, z, w; +}; + +struct TestClass2 { + TestClass2() + : a(1), b(2), c(3), d(4) { } + + float a, b, c, d; +}; + +} // anonymous namespace + +class PODArenaTest : public testing::Test { +}; + +// Make sure the arena can successfully allocate from more than one +// region. +TEST_F(PODArenaTest, CanAllocateFromMoreThanOneRegion) +{ + RefPtr<TrackedAllocator> allocator = TrackedAllocator::create(); + RefPtr<PODArena> arena = PODArena::create(allocator); + int numIterations = 10 * PODArena::DefaultChunkSize / sizeof(TestClass1); + for (int i = 0; i < numIterations; ++i) + arena->allocateObject<TestClass1>(); + EXPECT_GT(allocator->numRegions(), 1); +} + +// Make sure the arena frees all allocated regions during destruction. +TEST_F(PODArenaTest, FreesAllAllocatedRegions) +{ + RefPtr<TrackedAllocator> allocator = TrackedAllocator::create(); + { + RefPtr<PODArena> arena = PODArena::create(allocator); + for (int i = 0; i < 3; i++) + arena->allocateObject<TestClass1>(); + EXPECT_GT(allocator->numRegions(), 0); + } + EXPECT_TRUE(allocator->isEmpty()); +} + +// Make sure the arena runs constructors of the objects allocated within. +TEST_F(PODArenaTest, RunsConstructors) +{ + RefPtr<PODArena> arena = PODArena::create(); + for (int i = 0; i < 10000; i++) { + TestClass1* tc1 = arena->allocateObject<TestClass1>(); + EXPECT_EQ(0, tc1->x); + EXPECT_EQ(0, tc1->y); + EXPECT_EQ(0, tc1->z); + EXPECT_EQ(1, tc1->w); + TestClass2* tc2 = arena->allocateObject<TestClass2>(); + EXPECT_EQ(1, tc2->a); + EXPECT_EQ(2, tc2->b); + EXPECT_EQ(3, tc2->c); + EXPECT_EQ(4, tc2->d); + } +} + +} // namespace WebCore diff --git a/WebKit/chromium/tests/PODIntervalTreeTest.cpp b/WebKit/chromium/tests/PODIntervalTreeTest.cpp new file mode 100644 index 0000000..3a8a245 --- /dev/null +++ b/WebKit/chromium/tests/PODIntervalTreeTest.cpp @@ -0,0 +1,323 @@ +/* + * 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. + */ + +// Tests for the interval tree class. + +#include "config.h" + +#include "PODIntervalTree.h" + +#include "Logging.h" +#include "TreeTestHelpers.h" +#include <gtest/gtest.h> +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +using TreeTestHelpers::generateSeed; +using TreeTestHelpers::initRandom; +using TreeTestHelpers::nextRandom; + +inline String valueToString(const float& value) +{ + return String::number(value); +} + +inline String valueToString(void* const& value) +{ + return String::format("0x%p", value); +} + +TEST(PODIntervalTreeTest, TestInsertion) +{ + PODIntervalTree<float> tree; + tree.add(PODInterval<float>(2, 4)); + ASSERT_TRUE(tree.checkInvariants()); +} + +TEST(PODIntervalTreeTest, TestInsertionAndQuery) +{ + PODIntervalTree<float> tree; + tree.add(PODInterval<float>(2, 4)); + ASSERT_TRUE(tree.checkInvariants()); + Vector<PODInterval<float> > result = tree.allOverlaps(PODInterval<float>(1, 3)); + EXPECT_EQ(1U, result.size()); + EXPECT_EQ(2, result[0].low()); + EXPECT_EQ(4, result[0].high()); +} + +TEST(PODIntervalTreeTest, TestQueryAgainstZeroSizeInterval) +{ + PODIntervalTree<float> tree; + tree.add(PODInterval<float>(1, 2.5)); + tree.add(PODInterval<float>(3.5, 5)); + tree.add(PODInterval<float>(2, 4)); + ASSERT_TRUE(tree.checkInvariants()); + Vector<PODInterval<float> > result = tree.allOverlaps(PODInterval<float>(3, 3)); + EXPECT_EQ(1U, result.size()); + EXPECT_EQ(2, result[0].low()); + EXPECT_EQ(4, result[0].high()); +} + +TEST(PODIntervalTreeTest, TestDuplicateElementInsertion) +{ + PODIntervalTree<float, int*> tree; + int tmp1 = 1; + int tmp2 = 2; + typedef PODIntervalTree<float, int*>::IntervalType IntervalType; + IntervalType interval1(1, 3, &tmp1); + IntervalType interval2(1, 3, &tmp2); + tree.add(interval1); + tree.add(interval2); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(interval1)); + EXPECT_TRUE(tree.contains(interval2)); + EXPECT_TRUE(tree.remove(interval1)); + EXPECT_TRUE(tree.contains(interval2)); + EXPECT_FALSE(tree.contains(interval1)); + EXPECT_TRUE(tree.remove(interval2)); + EXPECT_EQ(0, tree.size()); +} + +namespace { + +struct UserData1 { +public: + UserData1() + : a(0), b(1) { } + + float a; + int b; +}; + +inline String valueToString(const UserData1& value) +{ + return String("[UserData1 a=") + String::number(value.a) + " b=" + String::number(value.b) + "]"; +} + +} // anonymous namespace + +TEST(PODIntervalTreeTest, TestInsertionOfComplexUserData) +{ + PODIntervalTree<float, UserData1> tree; + UserData1 data1; + data1.a = 5; + data1.b = 6; + tree.add(tree.createInterval(2, 4, data1)); + ASSERT_TRUE(tree.checkInvariants()); +} + +TEST(PODIntervalTreeTest, TestQueryingOfComplexUserData) +{ + PODIntervalTree<float, UserData1> tree; + UserData1 data1; + data1.a = 5; + data1.b = 6; + tree.add(tree.createInterval(2, 4, data1)); + ASSERT_TRUE(tree.checkInvariants()); + Vector<PODInterval<float, UserData1> > overlaps = tree.allOverlaps(tree.createInterval(3, 5, data1)); + EXPECT_EQ(1U, overlaps.size()); + EXPECT_EQ(5, overlaps[0].data().a); + EXPECT_EQ(6, overlaps[0].data().b); +} + +namespace { + +class EndpointType1 { +public: + explicit EndpointType1(int value) + : m_value(value) { } + + int value() const { return m_value; } + + bool operator<(const EndpointType1& other) const { return m_value < other.m_value; } + bool operator==(const EndpointType1& other) const { return m_value == other.m_value; } + +private: + int m_value; + // These operators should not be called by the interval tree. + bool operator>(const EndpointType1& other); + bool operator<=(const EndpointType1& other); + bool operator>=(const EndpointType1& other); + bool operator!=(const EndpointType1& other); +}; + +inline String valueToString(const EndpointType1& value) +{ + return String("[EndpointType1 value=") + String::number(value.value()) + "]"; +} + +} // anonymous namespace + +TEST(PODIntervalTreeTest, TestTreeDoesNotRequireMostOperators) +{ + PODIntervalTree<EndpointType1> tree; + tree.add(tree.createInterval(EndpointType1(1), EndpointType1(2))); + ASSERT_TRUE(tree.checkInvariants()); +} + +// Uncomment to debug a failure of the insertion and deletion test. +// #define DEBUG_INSERTION_AND_DELETION_TEST + +namespace { + +void InsertionAndDeletionTest(int32_t seed, int treeSize) +{ + initRandom(seed); + int maximumValue = treeSize; + // Build the tree + PODIntervalTree<int> tree; + Vector<PODInterval<int> > addedElements; + Vector<PODInterval<int> > removedElements; + for (int i = 0; i < treeSize; i++) { + int left = nextRandom(maximumValue); + int length = nextRandom(maximumValue); + PODInterval<int> interval(left, left + length); + tree.add(interval); +#ifdef DEBUG_INSERTION_AND_DELETION_TEST + LOG_ERROR("*** Adding element %s", valueToString(interval).ascii().data()); +#endif + addedElements.append(interval); + } + // Churn the tree's contents. + // First remove half of the elements in random order. + for (int i = 0; i < treeSize / 2; i++) { + int index = nextRandom(addedElements.size()); +#ifdef DEBUG_INSERTION_AND_DELETION_TEST + LOG_ERROR("*** Removing element %s", valueToString(addedElements[index]).ascii().data()); +#endif + ASSERT_TRUE(tree.contains(addedElements[index])) << "Test failed for seed " << seed; + tree.remove(addedElements[index]); + removedElements.append(addedElements[index]); + addedElements.remove(index); + ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed; + } + // Now randomly add or remove elements. + for (int i = 0; i < 2 * treeSize; i++) { + bool add = false; + if (!addedElements.size()) + add = true; + else if (!removedElements.size()) + add = false; + else + add = (nextRandom(2) == 1); + if (add) { + int index = nextRandom(removedElements.size()); +#ifdef DEBUG_INSERTION_AND_DELETION_TEST + LOG_ERROR("*** Adding element %s", valueToString(removedElements[index]).ascii().data()); +#endif + tree.add(removedElements[index]); + addedElements.append(removedElements[index]); + removedElements.remove(index); + } else { + int index = nextRandom(addedElements.size()); +#ifdef DEBUG_INSERTION_AND_DELETION_TEST + LOG_ERROR("*** Removing element %s", valueToString(addedElements[index]).ascii().data()); +#endif + ASSERT_TRUE(tree.contains(addedElements[index])) << "Test failed for seed " << seed; + ASSERT_TRUE(tree.remove(addedElements[index])) << "Test failed for seed " << seed; + removedElements.append(addedElements[index]); + addedElements.remove(index); + } + ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed; + } +} + +} // anonymous namespace + +TEST(PODIntervalTreeTest, RandomDeletionAndInsertionRegressionTest1) +{ + InsertionAndDeletionTest(13972, 100); +} + +TEST(PODIntervalTreeTest, RandomDeletionAndInsertionRegressionTest2) +{ + InsertionAndDeletionTest(1283382113, 10); +} + +TEST(PODIntervalTreeTest, RandomDeletionAndInsertionRegressionTest3) +{ + // This is the sequence of insertions and deletions that triggered + // the failure in RandomDeletionAndInsertionRegressionTest2. + PODIntervalTree<int> tree; + tree.add(tree.createInterval(0, 5)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(4, 5)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(8, 9)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(1, 4)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(3, 5)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(4, 12)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(0, 2)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(0, 2)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(9, 13)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(0, 1)); + ASSERT_TRUE(tree.checkInvariants()); + tree.remove(tree.createInterval(0, 2)); + ASSERT_TRUE(tree.checkInvariants()); + tree.remove(tree.createInterval(9, 13)); + ASSERT_TRUE(tree.checkInvariants()); + tree.remove(tree.createInterval(0, 2)); + ASSERT_TRUE(tree.checkInvariants()); + tree.remove(tree.createInterval(0, 1)); + ASSERT_TRUE(tree.checkInvariants()); + tree.remove(tree.createInterval(4, 5)); + ASSERT_TRUE(tree.checkInvariants()); + tree.remove(tree.createInterval(4, 12)); + ASSERT_TRUE(tree.checkInvariants()); +} + +TEST(PODIntervalTreeTest, RandomDeletionAndInsertionRegressionTest4) +{ + // Even further reduced test case for RandomDeletionAndInsertionRegressionTest3. + PODIntervalTree<int> tree; + tree.add(tree.createInterval(0, 5)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(8, 9)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(1, 4)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(3, 5)); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(tree.createInterval(4, 12)); + ASSERT_TRUE(tree.checkInvariants()); + tree.remove(tree.createInterval(4, 12)); + ASSERT_TRUE(tree.checkInvariants()); +} + +TEST(PODIntervalTreeTest, TestRandomDeletionAndInsertion) +{ + InsertionAndDeletionTest(generateSeed(), 1000); +} + +} // namespace WebCore diff --git a/WebKit/chromium/tests/PODRedBlackTreeTest.cpp b/WebKit/chromium/tests/PODRedBlackTreeTest.cpp new file mode 100644 index 0000000..0cc10e7 --- /dev/null +++ b/WebKit/chromium/tests/PODRedBlackTreeTest.cpp @@ -0,0 +1,213 @@ +/* + * 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. + */ + +// Tests for the red-black tree class. + +#include "config.h" + +#include "PODRedBlackTree.h" + +#include "ArenaTestHelpers.h" +#include "TreeTestHelpers.h" +#include <gtest/gtest.h> +#include <wtf/Vector.h> + +namespace WebCore { + +using ArenaTestHelpers::TrackedAllocator; +using TreeTestHelpers::generateSeed; +using TreeTestHelpers::initRandom; +using TreeTestHelpers::nextRandom; + +TEST(PODRedBlackTreeTest, TestTreeAllocatesFromArena) +{ + RefPtr<TrackedAllocator> allocator = TrackedAllocator::create(); + { + RefPtr<PODArena> arena = PODArena::create(allocator); + PODRedBlackTree<int> tree(arena); + int numAdditions = 2 * PODArena::DefaultChunkSize / sizeof(int); + for (int i = 0; i < numAdditions; ++i) + tree.add(i); + EXPECT_GT(allocator->numRegions(), 1); + } + EXPECT_EQ(allocator->numRegions(), 0); +} + +TEST(PODRedBlackTreeTest, TestSingleElementInsertion) +{ + PODRedBlackTree<int> tree; + tree.add(5); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(5)); +} + +TEST(PODRedBlackTreeTest, TestMultipleElementInsertion) +{ + PODRedBlackTree<int> tree; + tree.add(4); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(4)); + tree.add(3); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(3)); + tree.add(5); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(5)); + EXPECT_TRUE(tree.contains(4)); + EXPECT_TRUE(tree.contains(3)); +} + +TEST(PODRedBlackTreeTest, TestDuplicateElementInsertion) +{ + PODRedBlackTree<int> tree; + tree.add(3); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(3); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(3); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_EQ(3, tree.size()); + EXPECT_TRUE(tree.contains(3)); +} + +TEST(PODRedBlackTreeTest, TestSingleElementInsertionAndDeletion) +{ + PODRedBlackTree<int> tree; + tree.add(5); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(5)); + tree.remove(5); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_FALSE(tree.contains(5)); +} + +TEST(PODRedBlackTreeTest, TestMultipleElementInsertionAndDeletion) +{ + PODRedBlackTree<int> tree; + tree.add(4); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(4)); + tree.add(3); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(3)); + tree.add(5); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(5)); + EXPECT_TRUE(tree.contains(4)); + EXPECT_TRUE(tree.contains(3)); + tree.remove(4); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(3)); + EXPECT_FALSE(tree.contains(4)); + EXPECT_TRUE(tree.contains(5)); + tree.remove(5); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_TRUE(tree.contains(3)); + EXPECT_FALSE(tree.contains(4)); + EXPECT_FALSE(tree.contains(5)); + EXPECT_EQ(1, tree.size()); +} + +TEST(PODRedBlackTreeTest, TestDuplicateElementInsertionAndDeletion) +{ + PODRedBlackTree<int> tree; + tree.add(3); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(3); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(3); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_EQ(3, tree.size()); + EXPECT_TRUE(tree.contains(3)); + tree.remove(3); + ASSERT_TRUE(tree.checkInvariants()); + tree.remove(3); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_EQ(1, tree.size()); + EXPECT_TRUE(tree.contains(3)); + tree.remove(3); + ASSERT_TRUE(tree.checkInvariants()); + EXPECT_EQ(0, tree.size()); + EXPECT_FALSE(tree.contains(3)); +} + +TEST(PODRedBlackTreeTest, FailingInsertionRegressionTest1) +{ + // These numbers came from a previously-failing randomized test run. + PODRedBlackTree<int> tree; + tree.add(5113); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(4517); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(3373); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(9307); + ASSERT_TRUE(tree.checkInvariants()); + tree.add(7077); + ASSERT_TRUE(tree.checkInvariants()); +} + +namespace { +void InsertionAndDeletionTest(const int32_t seed, const int treeSize) +{ + initRandom(seed); + const int maximumValue = treeSize; + // Build the tree. + PODRedBlackTree<int> tree; + Vector<int> values; + for (int i = 0; i < treeSize; i++) { + int value = nextRandom(maximumValue); + tree.add(value); + ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed; + values.append(value); + } + // Churn the tree's contents. + for (int i = 0; i < treeSize; i++) { + // Pick a random value to remove. + int index = nextRandom(treeSize); + int value = values[index]; + // Remove this value. + tree.remove(value); + ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed; + // Replace it with a new one. + value = nextRandom(maximumValue); + values[index] = value; + tree.add(value); + ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed; + } +} +} // anonymous namespace + +TEST(PODRedBlackTreeTest, RandomDeletionAndInsertionRegressionTest1) +{ + InsertionAndDeletionTest(12311, 100); +} + +TEST(PODRedBlackTreeTest, TestRandomDeletionAndInsertion) +{ + InsertionAndDeletionTest(generateSeed(), 100); +} + +} // namespace WebCore diff --git a/WebKit/chromium/tests/TreeTestHelpers.cpp b/WebKit/chromium/tests/TreeTestHelpers.cpp new file mode 100644 index 0000000..103b871 --- /dev/null +++ b/WebKit/chromium/tests/TreeTestHelpers.cpp @@ -0,0 +1,60 @@ +/* + * 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. + */ + +#include "config.h" + +#include "TreeTestHelpers.h" + +#include <cstdlib> +#include <wtf/CurrentTime.h> + +namespace WebCore { +namespace TreeTestHelpers { + +int32_t generateSeed() +{ + // A seed of 1 has the special behavior of resetting the random + // number generator. Assume that if we call this routine that we + // don't want this behavior. + int32_t seed; + do { + seed = static_cast<int32_t>(currentTime()); + } while (seed <= 1); + return seed; +} + +void initRandom(const int32_t seed) +{ + srand(seed); +} + +int32_t nextRandom(const int32_t maximumValue) +{ + // rand_r is not available on Windows + return rand() % maximumValue; +} + +} // namespace TreeTestHelpers +} // namespace WebCore diff --git a/WebKit/chromium/tests/TreeTestHelpers.h b/WebKit/chromium/tests/TreeTestHelpers.h new file mode 100644 index 0000000..af07b2a --- /dev/null +++ b/WebKit/chromium/tests/TreeTestHelpers.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +// Simple pseudorandom number generator helper functions, used by the +// red-black and interval tree tests. +// +// These are **not** thread safe! + +#ifndef TreeTestHelpers_h +#define TreeTestHelpers_h + +#include <stdint.h> + +namespace WebCore { +namespace TreeTestHelpers { + +// Generates a seed value to be passed to initRandom(). +int32_t generateSeed(); + +// Initializes the pseudo-random number generator with a specific seed. +void initRandom(const int32_t seed); + +// Produces the next pseudo-random number in the sequence, in the +// range from [0..maximumValue). Negative numbers are not allowed and will +// produce undefined results. +int32_t nextRandom(const int32_t maximumValue); + +} // namespace TreeTestHelpers +} // namespace WebCore + +#endif // TreeTestHelpers_h diff --git a/WebKit/efl/CMakeListsEfl.txt b/WebKit/efl/CMakeListsEfl.txt index 7b5865b..2ea5ee5 100644 --- a/WebKit/efl/CMakeListsEfl.txt +++ b/WebKit/efl/CMakeListsEfl.txt @@ -24,10 +24,10 @@ LIST(APPEND WebKit_INCLUDE_DIRECTORIES IF (ENABLE_VIDEO) LIST(APPEND WebKit_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/graphics/gstreamer" - ${Gstreamer-App_INCLUDE_DIRS} - ${Gstreamer-Interfaces_INCLUDE_DIRS} - ${Gstreamer-Pbutils_INCLUDE_DIRS} - ${Gstreamer-Video_INCLUDE_DIRS} + ${GStreamer-App_INCLUDE_DIRS} + ${GStreamer-Interfaces_INCLUDE_DIRS} + ${GStreamer-Pbutils_INCLUDE_DIRS} + ${GStreamer-Video_INCLUDE_DIRS} ) ENDIF() @@ -70,6 +70,7 @@ IF (ENABLE_GLIB_SUPPORT) LIST(APPEND WebKit_INCLUDE_DIRECTORIES ${Gdk_INCLUDE_DIRS} ${Glib_INCLUDE_DIRS} + ${JAVASCRIPTCORE_DIR}/wtf/gobject ) LIST(APPEND WebKit_LIBRARIES ${Glib_LIBRARIES} @@ -158,54 +159,10 @@ ADD_CUSTOM_COMMAND( VERBATIM ) -SET(EWebLauncher_SOURCES - efl/DefaultTheme/default.edj - efl/EWebLauncher/main.c -) - -SET(EWebLauncher_LIBRARIES - ${JavaScriptCore_LIBRARY_NAME} - ${WebCore_LIBRARY_NAME} - ${WebKit_LIBRARY_NAME} - ${Cairo_LIBRARIES} - ${ECORE_X_LIBRARIES} - ${EDJE_LIBRARIES} - ${EFLDEPS_LIBRARIES} - ${EVAS_LIBRARIES} - ${LIBXML2_LIBRARIES} - ${LIBXSLT_LIBRARIES} - ${SQLITE_LIBRARIES} -) - -SET(EWebLauncher_LINK_FLAGS - ${ECORE_X_LDFLAGS} - ${EDJE_LDFLAGS} - ${EFLDEPS_LDFLAGS} - ${EVAS_LDFLAGS} +LIST(APPEND WebKit_SOURCES + ${WebKit_THEME} ) -IF (ENABLE_GLIB_SUPPORT) - LIST(APPEND EWebLauncher_LIBRARIES - ${Gdk_LIBRARIES} - ${Glib_LIBRARIES} - ${Gthread_LIBRARIES} - ) -ENDIF () - -IF (WTF_USE_SOUP) - LIST(APPEND EWebLauncher_LIBRARIES ${LIBSOUP24_LIBRARIES}) - LIST(APPEND EWebLauncher_LINK_FLAGS ${LIBSOUP24_LDFLAGS}) -ENDIF () - -IF (WTF_USE_CURL) - LIST(APPEND EWebLauncher_LIBRARIES ${CURL_LIBRARIES}) - LIST(APPEND EWebLauncher_LINK_FLAGS ${CURL_LDFLAGS}) -ENDIF () - -ADD_EXECUTABLE(../Programs/EWebLauncher ${EWebLauncher_SOURCES}) -TARGET_LINK_LIBRARIES(../Programs/EWebLauncher ${EWebLauncher_LIBRARIES}) -ADD_TARGET_PROPERTIES(../Programs/EWebLauncher LINK_FLAGS "${EWebLauncher_LINK_FLAGS}") - IF (SHARED_CORE) SET(LIBS_PRIVATE "-l${WTF_LIBRARY_NAME} -l${JavaScriptCore_LIBRARY_NAME} -l${WebCore_LIBRARY_NAME}") ELSE () @@ -225,4 +182,7 @@ FILE(GLOB EWebKit_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/*.h") LIST(REMOVE_ITEM EWebKit_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/efl/ewk/ewk_private.h") INSTALL(FILES ${EWebKit_HEADERS} - DESTINATION include/EWebKit) + DESTINATION include/${WebKit_LIBRARY_NAME}-${PROJECT_VERSION_MAJOR}) + +INSTALL(FILES ${WebKit_THEME} + DESTINATION share/${WebKit_LIBRARY_NAME}-${PROJECT_VERSION_MAJOR}/themes) diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog index bafa48d..e805d2c 100644 --- a/WebKit/efl/ChangeLog +++ b/WebKit/efl/ChangeLog @@ -1,3 +1,138 @@ +2010-09-08 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to Editor as planned + https://bugs.webkit.org/show_bug.cgi?id=45218 + + * ewk/ewk_frame.cpp: + (ewk_frame_editable_set): + (ewk_frame_selection_get): + (ewk_frame_text_search): + (ewk_frame_text_matches_mark): + (ewk_frame_text_matches_highlight_set): + (ewk_frame_text_matches_highlight_get): + * ewk/ewk_view.cpp: + (ewk_view_selection_get): + Changed call sites to use editor(). + +2010-09-09 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Unreviewed build fix. + + [EFL] Fix duplicate gstreamer macro in CMakeListEfl.txt + https://bugs.webkit.org/show_bug.cgi?id=45433 + + In WebKit/efl/CMakeListEfl.txt, duplicated ENABLE_VIDEO macros were added. + So, unnecessary ENABLE_VIDEO macro is deleted. + + * CMakeListsEfl.txt: + +2010-09-08 Ryuan Choi <ryuan.choi@samsung.com> + + Unreviewed build fix. + + [EFL] Need to add custom dependencies. + https://bugs.webkit.org/show_bug.cgi?id=45247 + + Add WebKit_Theme into WebKit_SOURCES to make it while building. + + * CMakeListsEfl.txt: + +2010-09-08 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Kenneth Rohde Christiansen. + + [EFL] Export data directory through pkg-config + https://bugs.webkit.org/show_bug.cgi?id=45385 + + Using pkg-config it's possible for a browser to know the location of + installed themes. When compiling the browser, a variable might be + defined with the datadir, like below: + + gcc -o browser browser.c $(pkg-config --libs --cflags ewebkit) \ + -DEWEBKIT_DATA_DIR=$(pkg-config --variable=datadir) + + * ewebkit.pc.in: Export datadir variable. + +2010-09-06 Ryuan Choi <ryuan.choi@samsung.com> + + Unreviewed build fix. + + [EFL] REGRESSION(66794) Need to fix build break. + https://bugs.webkit.org/show_bug.cgi?id=45241 + + Add dummy class(FrameNetworkingContextEfl) like GTK+ port and implement + as EFL style. + + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::createNetworkingContext): + * WebCoreSupport/FrameNetworkingContextEfl.h: Added. + (WebCore::FrameNetworkingContextEfl::create): + (WebCore::FrameNetworkingContextEfl::coreFrame): + (WebCore::FrameNetworkingContextEfl::FrameNetworkingContextEfl): + +2010-09-04 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Kenneth Rohde Christiansen. + + [EFL] Move test browser to WebKitTools directory + https://bugs.webkit.org/show_bug.cgi?id=45212 + + Follow other ports like QT and GTK which moved the test browser to + WebKitTools directory. + + * CMakeListsEfl.txt: Remove build for test browser. + * EWebLauncher/main.c: Removed. + +2010-09-03 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 + + Add createNetworkingContext to EFL's FrameLoaderClient. + + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::createNetworkingContext): + * WebCoreSupport/FrameLoaderClientEfl.h: + +2010-09-03 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Martin Robinson. + + [EFL] Regression (66531) Build break with Glib Support + https://bugs.webkit.org/show_bug.cgi?id=45011 + + Move GtkTypedefs.h to GTypedefs.h and let it inside gobject directory + since when glib is enabled, EFL port needs it, too. + + * CMakeListsEfl.txt: Include gobject directory to find new header + file. + +2010-09-03 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Install default theme + https://bugs.webkit.org/show_bug.cgi?id=45154 + + Since a theme is needed in order to create a new browser, install the + default one to serve as example and fall-back. + + * CMakeListsEfl.txt: + +2010-09-02 Lucas De Marchi <lucas.demarchi@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Name install directories according to library name + https://bugs.webkit.org/show_bug.cgi?id=45126 + + * CMakeListsEfl.txt: include diretory follows library name. + * ewebkit.pc.in: Ditto. + 2010-08-31 Dave Hyatt <hyatt@apple.com> Reviewed by Sam Weinig. diff --git a/WebKit/efl/EWebLauncher/main.c b/WebKit/efl/EWebLauncher/main.c deleted file mode 100644 index c1956a2..0000000 --- a/WebKit/efl/EWebLauncher/main.c +++ /dev/null @@ -1,850 +0,0 @@ -/* - * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia - * Copyright (C) 2009, 2010 ProFUSION embedded systems - * Copyright (C) 2009, 2010 Samsung Electronics - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "EWebKit.h" - -#include <ctype.h> -#include <Ecore.h> -#include <Ecore_Evas.h> -#include <Ecore_File.h> -#include <Ecore_Getopt.h> -#include <Ecore_X.h> -#include <Edje.h> -#include <Evas.h> -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> - -#define DEFAULT_WIDTH 800 -#define DEFAULT_HEIGHT 600 -#define DEFAULT_ZOOM_INIT 1.0 - -#define info(format, args...) \ - do { \ - if (verbose) \ - printf(format, ##args); \ - } while (0) - -#define MIN_ZOOM_LEVEL 0 -#define DEFAULT_ZOOM_LEVEL 5 -#define MAX_ZOOM_LEVEL 13 - -static int currentZoomLevel = DEFAULT_ZOOM_LEVEL; - -// the zoom values are chosen to be like in Mozilla Firefox 3 -static int zoomLevels[] = {30, 50, 67, 80, 90, - 100, - 110, 120, 133, 150, 170, 200, 240, 300}; - -static int verbose = 0; - -static Eina_List *windows = NULL; - -static char *themePath = NULL; - -typedef struct _Window_Properties { - Eina_Bool toolbarsVisible:1; - Eina_Bool statusbarVisible:1; - Eina_Bool scrollbarsVisible:1; - Eina_Bool menubarVisible:1; -} Window_Properties; - -Window_Properties windowProperties = { /* Pretend we have them and they are initially visible */ - EINA_TRUE, - EINA_TRUE, - EINA_TRUE, - EINA_TRUE -}; - -static const Ecore_Getopt options = { - "EWebLauncher", - "%prog [options] [url]", - "0.0.1", - "(C)2008 INdT (The Nokia Technology Institute)\n" - "(C)2009, 2010 ProFUSION embedded systems\n" - "(C)2009, 2010 Samsung Electronics", - "GPL", - "Test Web Browser using the Enlightenment Foundation Libraries of WebKit", - EINA_TRUE, { - ECORE_GETOPT_STORE_STR - ('e', "engine", "ecore-evas engine to use."), - ECORE_GETOPT_CALLBACK_NOARGS - ('E', "list-engines", "list ecore-evas engines.", - ecore_getopt_callback_ecore_evas_list_engines, NULL), - ECORE_GETOPT_STORE_DEF_BOOL - ('F', "fullscreen", "fullscreen mode.", 0), - ECORE_GETOPT_CALLBACK_ARGS - ('g', "geometry", "geometry to use in x:y:w:h form.", "X:Y:W:H", - ecore_getopt_callback_geometry_parse, NULL), - ECORE_GETOPT_STORE_STR - ('t', "theme", "path to read the theme file from."), - ECORE_GETOPT_STORE_STR - ('U', "user-agent", "custom user agent string to use."), - ECORE_GETOPT_STORE_DEF_BOOL - ('S', "sudo-workaround", "Workaround mode for making Flash work with sudo.", 0), - ECORE_GETOPT_COUNT - ('v', "verbose", "be more verbose."), - ECORE_GETOPT_VERSION - ('V', "version"), - ECORE_GETOPT_COPYRIGHT - ('R', "copyright"), - ECORE_GETOPT_LICENSE - ('L', "license"), - ECORE_GETOPT_HELP - ('h', "help"), - ECORE_GETOPT_SENTINEL - } -}; - -typedef struct _Viewport { - int w; - int h; - float initScale; - float minScale; - float maxScale; - Eina_Bool userScalable; -} Viewport; - -typedef struct _ELauncher { - Ecore_Evas *ee; - Evas *evas; - Evas_Object *bg; - Evas_Object *browser; - const char *theme; - const char *userAgent; - Viewport viewport; -} ELauncher; - -static void browserDestroy(Ecore_Evas *ee); -static void closeWindow(Ecore_Evas *ee); -static int browserCreate(const char *url, const char *theme, const char *userAgent, Eina_Rectangle geometry, const char *engine, unsigned char isFullscreen); - -static void -print_history(Eina_List *list) -{ - Eina_List *l; - void *d; - - if (!verbose) - return; - - printf("Session history contains:\n"); - - EINA_LIST_FOREACH(list, l, d) { - Ewk_History_Item *item = (Ewk_History_Item*)d; - cairo_surface_t *cs = ewk_history_item_icon_surface_get(item); - char buf[PATH_MAX]; - int s = snprintf(buf, sizeof(buf), "/tmp/favicon-%s.png", ewk_history_item_uri_original_get(item)); - for (s--; s >= (int)sizeof("/tmp/favicon-"); s--) { - if (!isalnum(buf[s]) && buf[s] != '.') - buf[s] = '_'; - } - cs = ewk_history_item_icon_surface_get(item); - - if (cs && cairo_surface_status(cs) == CAIRO_STATUS_SUCCESS) - cairo_surface_write_to_png(cs, buf); - else - buf[0] = '\0'; - - printf("* '%s' title='%s' icon='%s'\n", - ewk_history_item_uri_original_get(item), - ewk_history_item_title_get(item), buf); - } -} - -static void -zoom_level_set(Evas_Object *webview, int level) -{ - float factor = ((float) zoomLevels[level]) / 100.0; - Evas_Coord ox, oy, mx, my, cx, cy; - evas_pointer_canvas_xy_get(evas_object_evas_get(webview), &mx, &my); - evas_object_geometry_get(webview, &ox, &oy, NULL, NULL); - cx = mx - ox; - cy = my - oy; - ewk_view_zoom_animated_set(webview, factor, 0.5, cx, cy); -} - -static void -on_ecore_evas_resize(Ecore_Evas *ee) -{ - Evas_Object *webview; - Evas_Object *bg; - int w, h; - - ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); - - bg = evas_object_name_find(ecore_evas_get(ee), "bg"); - evas_object_move(bg, 0, 0); - evas_object_resize(bg, w, h); - - webview = evas_object_name_find(ecore_evas_get(ee), "browser"); - evas_object_move(webview, 10, 10); - evas_object_resize(webview, w - 20, h - 20); -} - -static void -title_set(Ecore_Evas *ee, const char *title, int progress) -{ - const char *appname = "EFL Test Launcher"; - const char *separator = " - "; - char label[4096]; - int size; - - if (!title || !strcmp(title, "")) { - ecore_evas_title_set(ee, appname); - return; - } - - if (progress < 100) - size = snprintf(label, sizeof(label), "%s (%d%%)%s%s", title, progress, separator, appname); - else - size = snprintf(label, sizeof(label), "%s %s%s", title, separator, appname); - - if (size >= (int)sizeof(label)) - return; - - ecore_evas_title_set(ee, label); -} - -/** - * This is en example function to adjust viewport via viewport tag's arguments. - * Application can invoke this function in order to adjust viewport tag when it is required. - */ -static void -viewport_set() -{ - ELauncher *app; - app = (ELauncher*) eina_list_data_get(windows); - - ewk_view_fixed_layout_size_set(app->browser, app->viewport.w, app->viewport.h); - ewk_view_zoom_set(app->browser, app->viewport.initScale, 0, 0); - if (!ewk_view_zoom_range_set(app->browser, app->viewport.minScale, app->viewport.maxScale)) - info(" Fail to set zoom range. minScale = %f, maxScale = %f\n", app->viewport.minScale, app->viewport.maxScale); - ewk_view_user_scalable_set(app->browser, app->viewport.userScalable); -} - -static void -on_title_changed(void *user_data, Evas_Object *webview, void *event_info) -{ - ELauncher *app = (ELauncher *)user_data; - const char *title = (const char *)event_info; - - title_set(app->ee, title, 100); -} - -static void -on_progress(void *user_data, Evas_Object *webview, void *event_info) -{ - ELauncher *app = (ELauncher *)user_data; - double *progress = (double *)event_info; - - title_set(app->ee, ewk_view_title_get(app->browser), *progress * 100); -} - -static void -on_load_finished(void *user_data, Evas_Object *webview, void *event_info) -{ - const Ewk_Frame_Load_Error *err = (const Ewk_Frame_Load_Error *)event_info; - - if (!err) - info("Succeeded loading page.\n"); - else if (err->is_cancellation) - info("Load was cancelled.\n"); - else - info("Failed loading page: %d %s \"%s\", url=%s\n", - err->code, err->domain, err->description, err->failing_url); -} - -static void -on_toolbars_visible_set(void* user_data, Evas_Object* webview, void* event_info) -{ - Eina_Bool *visible = (Eina_Bool *)event_info; - if (*visible) { - info("Toolbars visible changed: show"); - windowProperties.toolbarsVisible = EINA_TRUE; - } else { - info("Toolbars visible changed: hide"); - windowProperties.toolbarsVisible = EINA_FALSE; - } -} - -static void -on_toolbars_visible_get(void* user_data, Evas_Object* webview, void* event_info) -{ - Eina_Bool *visible = (Eina_Bool *)event_info; - *visible = windowProperties.toolbarsVisible; -} - -static void -on_statusbar_visible_set(void* user_data, Evas_Object* webview, void* event_info) -{ - Eina_Bool *visible = (Eina_Bool *)event_info; - if (*visible) { - info("Statusbar visible changed: show"); - windowProperties.statusbarVisible = EINA_TRUE; - } else { - info("Statusbar visible changed: hide"); - windowProperties.statusbarVisible = EINA_FALSE; - } -} - -static void -on_statusbar_visible_get(void* user_data, Evas_Object* webview, void* event_info) -{ - Eina_Bool *visible = (Eina_Bool *)event_info; - *visible = windowProperties.statusbarVisible; -} - -static void -on_scrollbars_visible_set(void* user_data, Evas_Object* webview, void* event_info) -{ - Eina_Bool *visible = (Eina_Bool *)event_info; - if (*visible) { - info("Scrollbars visible changed: show"); - windowProperties.scrollbarsVisible = EINA_TRUE; - } else { - info("Scrollbars visible changed: hide"); - windowProperties.scrollbarsVisible = EINA_FALSE; - } -} - -static void -on_scrollbars_visible_get(void* user_data, Evas_Object* webview, void* event_info) -{ - Eina_Bool *visible = (Eina_Bool *)event_info; - *visible = windowProperties.scrollbarsVisible; -} - -static void -on_menubar_visible_set(void* user_data, Evas_Object* webview, void* event_info) -{ - Eina_Bool *visible = (Eina_Bool *)event_info; - if (*visible) { - info("Menubar visible changed: show"); - windowProperties.menubarVisible = EINA_TRUE; - } else { - info("Menubar visible changed: hide"); - windowProperties.menubarVisible = EINA_FALSE; - } -} - -static void -on_menubar_visible_get(void* user_data, Evas_Object* webview, void* event_info) -{ - Eina_Bool *visible = (Eina_Bool *)event_info; - *visible = windowProperties.menubarVisible; -} - -static void -on_tooltip_text_set(void* user_data, Evas_Object* webview, void* event_info) -{ - const char *text = (const char *)event_info; - if (text && *text != '\0') - info("%s\n", text); -} - -static void -on_inputmethod_changed(void* user_data, Evas_Object* webview, void* event_info) -{ - Eina_Bool active = (Eina_Bool)(long)event_info; - unsigned int imh; - info("Keyboard changed: %d\n", active); - - if (!active) - return; - - imh = ewk_view_imh_get(webview); - info(" Keyboard flags: %#.2x\n", imh); - -} - -/** - * "viewport,changed" signal will be always emitted regardless of the viewport existence. - * - * If you don't want to process the viewport tag, you can either do nothing in this callback - * or simply ignore the signal in your application. - * - * More information about this can be found at http://developer.apple.com/safari/library/docum - * entation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html - */ -static void -on_viewport_changed(void* user_data, Evas_Object* webview, void* event_info) -{ - ELauncher *app = (ELauncher *)user_data; - - float w, h, initScale, minScale, maxScale, userScalable; - - ewk_view_viewport_get(webview, &w, &h, &initScale, &maxScale, &minScale, &userScalable); - - /** - * If there is no argument in viewport tag, argument's value is -1. - */ - if ((int)w == -1) - w = DEFAULT_WIDTH; - if ((int)h == -1) - h = DEFAULT_HEIGHT; - if ((int)initScale == -1) - initScale = DEFAULT_ZOOM_INIT; // There's no scale separated from zooming in webkit-efl. - if ((int)minScale == -1) - minScale = ewk_view_zoom_range_min_get(webview); - if ((int)maxScale == -1) - maxScale = ewk_view_zoom_range_max_get(webview); - if ((int)userScalable == -1) - userScalable = EINA_TRUE; - - app->viewport.w = (int)w; - app->viewport.h = (int)h; - app->viewport.initScale = initScale; - app->viewport.minScale = minScale; - app->viewport.maxScale = maxScale; - app->viewport.userScalable = (Eina_Bool)userScalable; - viewport_set(); -} - -static void -on_mouse_down(void* data, Evas* e, Evas_Object* webview, void* event_info) -{ - Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down*) event_info; - if (ev->button == 2) - evas_object_focus_set(webview, !evas_object_focus_get(webview)); -} - -static void -on_focus_out(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - info("the webview lost keyboard focus\n"); -} - -static void -on_focus_in(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - info("the webview gained keyboard focus\n"); -} - -static void -on_resized(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Coord w, h; - evas_object_geometry_get(obj, NULL, NULL, &w, &h); - ewk_view_fixed_layout_size_set(obj, w, h); -} - -static void -on_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Evas_Event_Key_Down *ev = (Evas_Event_Key_Down*) event_info; - ELauncher *app = data; - static const char *encodings[] = { - "ISO-8859-1", - "UTF-8", - NULL - }; - static int currentEncoding = -1; - - if (!strcmp(ev->key, "Escape")) { - closeWindow(app->ee); - } else if (!strcmp(ev->key, "F1")) { - info("Back (F1) was pressed\n"); - if (ewk_view_back_possible(obj)) { - Ewk_History *history = ewk_view_history_get(obj); - Eina_List *list = ewk_history_back_list_get(history); - print_history(list); - ewk_history_item_list_free(list); - ewk_view_back(obj); - } else - info("Back ignored: No back history\n"); - } else if (!strcmp(ev->key, "F2")) { - info("Forward (F2) was pressed\n"); - if (ewk_view_forward_possible(obj)) { - Ewk_History *history = ewk_view_history_get(obj); - Eina_List *list = ewk_history_forward_list_get(history); - print_history(list); - ewk_history_item_list_free(list); - ewk_view_forward(obj); - } else - info("Forward ignored: No forward history\n"); - } else if (!strcmp(ev->key, "F3")) { - currentEncoding++; - currentEncoding %= (sizeof(encodings) / sizeof(encodings[0])); - info("Set encoding (F3) pressed. New encoding to %s", encodings[currentEncoding]); - ewk_view_setting_encoding_custom_set(obj, encodings[currentEncoding]); - } else if (!strcmp(ev->key, "F4")) { - Evas_Object *frame = ewk_view_frame_main_get(obj); - Evas_Coord x, y; - Ewk_Hit_Test *ht; - - evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); - ht = ewk_frame_hit_test_new(frame, x, y); - if (!ht) - printf("No hit test returned for point %d,%d\n", x, y); - else { - printf("Hit test for point %d,%d\n" - " pos=%3d,%3d\n" - " bounding_box=%d,%d + %dx%d\n" - " title='%s'\n" - " alternate_text='%s'\n" - " frame=%p (%s)\n" - " link {\n" - " text='%s'\n" - " url='%s'\n" - " title='%s'\n" - " target frame=%p (%s)\n" - " }\n" - " flags {\n" - " editable=%hhu\n" - " selected=%hhu\n" - " }\n", - x, y, - ht->x, ht->y, - ht->bounding_box.x, ht->bounding_box.y, ht->bounding_box.w, ht->bounding_box.h, - ht->title, - ht->alternate_text, - ht->frame, evas_object_name_get(ht->frame), - ht->link.text, - ht->link.url, - ht->link.title, - ht->link.target_frame, evas_object_name_get(ht->link.target_frame), - ht->flags.editable, - ht->flags.selected); - ewk_frame_hit_test_free(ht); - } - - } else if (!strcmp(ev->key, "F5")) { - info("Reload (F5) was pressed, reloading.\n"); - ewk_view_reload(obj); - } else if (!strcmp(ev->key, "F6")) { - info("Stop (F6) was pressed, stop loading.\n"); - ewk_view_stop(obj); - /* } FIXME: uncomment code below after Bug 18662 lands upstream. - else if (!strcmp(ev->key, "F12")) { - bool status = ewk_webframe_object_keyboard_navigation_get(page); - ewk_webframe_object_keyboard_navigation_set(page, !status); - info("Command::keyboard navigation toggle\n");*/ - } else if (!strcmp(ev->key, "F7")) { - info("Zoom out (F7) was pressed.\n"); - if (currentZoomLevel > MIN_ZOOM_LEVEL) - zoom_level_set(obj, --currentZoomLevel); - } else if (!strcmp(ev->key, "F8")) { - info("Zoom in (F8) was pressed.\n"); - if (currentZoomLevel < MAX_ZOOM_LEVEL) - zoom_level_set(obj, ++currentZoomLevel); - } else if (!strcmp(ev->key, "F9")) { - info("Create new window (F9) was pressed.\n"); - Eina_Rectangle geometry = {0, 0, 0, 0}; - browserCreate("http://www.google.com", - app->theme, app->userAgent, geometry, NULL, 0); - } else if (!strcmp(ev->key, "F10")) { - Evas_Coord x, y, w, h; - Evas_Object *frame = ewk_view_frame_main_get(obj); - float zoom = zoomLevels[currentZoomLevel] / 100.0; - - ewk_frame_visible_content_geometry_get(frame, EINA_FALSE, &x, &y, &w, &h); - x -= w; - y -= h; - w *= 4; - h *= 4; - info("Pre-render %d,%d + %dx%d\n", x, y, w, h); - ewk_view_pre_render_region(obj, x, y, w, h, zoom); - } -} - -static void -on_browser_del(void *data, Evas *evas, Evas_Object *browser, void *event) -{ - ELauncher *app = (ELauncher*) data; - - evas_object_event_callback_del(app->browser, EVAS_CALLBACK_KEY_DOWN, on_key_down); - evas_object_event_callback_del(app->browser, EVAS_CALLBACK_MOUSE_DOWN, on_mouse_down); - evas_object_event_callback_del(app->browser, EVAS_CALLBACK_FOCUS_IN, on_focus_in); - evas_object_event_callback_del(app->browser, EVAS_CALLBACK_FOCUS_OUT, on_focus_out); - evas_object_event_callback_del(app->browser, EVAS_CALLBACK_DEL, on_browser_del); -} - -static void -on_closeWindow(Ecore_Evas *ee) -{ - browserDestroy(ee); -} - -static int -quit(Eina_Bool success, const char *msg) -{ - edje_shutdown(); - ecore_evas_shutdown(); - - if (msg) - fputs(msg, (success) ? stdout : stderr); - - free(themePath); - - if (!success) - return EXIT_FAILURE; - - return EXIT_SUCCESS; -} - -static int -browserCreate(const char *url, const char *theme, const char *userAgent, Eina_Rectangle geometry, const char *engine, unsigned char isFullscreen) -{ - if ((geometry.w <= 0) && (geometry.h <= 0)) { - geometry.w = DEFAULT_WIDTH; - geometry.h = DEFAULT_HEIGHT; - } - - ELauncher *app = (ELauncher*) malloc(sizeof(ELauncher)); - if (!app) - return quit(EINA_FALSE, "ERROR: could not create EWebLauncher window\n"); - - app->ee = ecore_evas_new(engine, 0, 0, geometry.w, geometry.h, NULL); - - if (!app->ee) - return quit(EINA_FALSE, "ERROR: could not construct evas-ecore\n"); - - if (isFullscreen) - ecore_evas_fullscreen_set(app->ee, EINA_TRUE); - - ecore_evas_title_set(app->ee, "EFL Test Launcher"); - ecore_evas_callback_resize_set(app->ee, on_ecore_evas_resize); - ecore_evas_callback_delete_request_set(app->ee, closeWindow); - - app->evas = ecore_evas_get(app->ee); - - if (!app->evas) - return quit(EINA_FALSE, "ERROR: could not get evas from evas-ecore\n"); - - if (!theme) - theme = themePath; - - app->theme = theme; - app->userAgent = userAgent; - - app->bg = evas_object_rectangle_add(app->evas); - evas_object_name_set(app->bg, "bg"); - evas_object_color_set(app->bg, 255, 0, 255, 255); - evas_object_move(app->bg, 0, 0); - evas_object_resize(app->bg, geometry.w, geometry.h); - evas_object_layer_set(app->bg, EVAS_LAYER_MIN); - evas_object_show(app->bg); - app->browser = ewk_view_single_add(app->evas); - - ewk_view_theme_set(app->browser, theme); - if (userAgent) - ewk_view_setting_user_agent_set(app->browser, userAgent); - evas_object_name_set(app->browser, "browser"); - - evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app); - evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app); - evas_object_smart_callback_add(app->browser, "load,finished", on_load_finished, app); - evas_object_smart_callback_add(app->browser, "viewport,changed", on_viewport_changed, app); - - evas_object_smart_callback_add(app->browser, "toolbars,visible,set", on_toolbars_visible_set, app); - evas_object_smart_callback_add(app->browser, "toolbars,visible,get", on_toolbars_visible_get, app); - evas_object_smart_callback_add(app->browser, "statusbar,visible,set", on_statusbar_visible_set, app); - evas_object_smart_callback_add(app->browser, "statusbar,visible,get", on_statusbar_visible_get, app); - evas_object_smart_callback_add(app->browser, "scrollbars,visible,set", on_scrollbars_visible_set, app); - evas_object_smart_callback_add(app->browser, "scrollbars,visible,get", on_scrollbars_visible_get, app); - evas_object_smart_callback_add(app->browser, "menubar,visible,set", on_menubar_visible_set, app); - evas_object_smart_callback_add(app->browser, "menubar,visible,get", on_menubar_visible_get, app); - evas_object_smart_callback_add(app->browser, "tooltip,text,set", on_tooltip_text_set, app); - evas_object_smart_callback_add(app->browser, "inputmethod,changed", on_inputmethod_changed, app); - -/* ewk_callback_resize_requested_add(app->browser, on_resize_requested, app->ee); */ - - evas_object_event_callback_add(app->browser, EVAS_CALLBACK_RESIZE, on_resized, app); - evas_object_event_callback_add(app->browser, EVAS_CALLBACK_KEY_DOWN, on_key_down, app); - evas_object_event_callback_add(app->browser, EVAS_CALLBACK_MOUSE_DOWN, on_mouse_down, app); - evas_object_event_callback_add(app->browser, EVAS_CALLBACK_FOCUS_IN, on_focus_in, app); - evas_object_event_callback_add(app->browser, EVAS_CALLBACK_FOCUS_OUT, on_focus_out, app); - evas_object_event_callback_add(app->browser, EVAS_CALLBACK_DEL, on_browser_del, app); - - evas_object_move(app->browser, 10, 10); - evas_object_resize(app->browser, geometry.w - 20, geometry.h - 20); - - if (url && (url[0] != '\0')) - ewk_view_uri_set(app->browser, url); - - evas_object_show(app->browser); - ecore_evas_show(app->ee); - - evas_object_focus_set(app->browser, EINA_TRUE); - - windows = eina_list_append(windows, app); - - return 1; -} - -static void -browserDestroy(Ecore_Evas *ee) -{ - ecore_evas_free(ee); - if (!eina_list_count(windows)) - ecore_main_loop_quit(); -} - -static void -closeWindow(Ecore_Evas *ee) -{ - Eina_List *l; - void *app; - EINA_LIST_FOREACH(windows, l, app) - { - if (((ELauncher*) app)->ee == ee) - break; - } - windows = eina_list_remove(windows, app); - browserDestroy(ee); - free(app); -} - -static Eina_Bool -main_signal_exit(void *data, int ev_type, void *ev) -{ - ELauncher *app; - while (windows) { - app = (ELauncher*) eina_list_data_get(windows); - ecore_evas_free(app->ee); - windows = eina_list_remove(windows, app); - } - if (!eina_list_count(windows)) - ecore_main_loop_quit(); - return EINA_TRUE; -} - -static char * -findThemePath(void) -{ - const char **itr, *locations[] = { - "./default.edj", - "./WebKit/efl/DefaultTheme/default.edj", - "../WebKit/efl/DefaultTheme/default.edj", - DATA_DIR"/themes/default.edj", - NULL - }; - - for (itr = locations; *itr; itr++) { - struct stat st; - if (!stat(*itr, &st)) { - char path[PATH_MAX]; - if (realpath(*itr, path)) - return strdup(path); - } - } - - return NULL; -} - -int -main(int argc, char *argv[]) -{ - const char *default_url = "http://www.google.com/"; - - Eina_Rectangle geometry = {0, 0, 0, 0}; - char *url = NULL; - char *userAgent = NULL; - const char *tmp; - const char *proxyUri; - char path[PATH_MAX]; - - char *engine = NULL; - char *theme = NULL; - - unsigned char quitOption = 0; - unsigned char isFullscreen = 0; - unsigned char sudoWorkaround = 0; - int args; - - Ecore_Getopt_Value values[] = { - ECORE_GETOPT_VALUE_STR(engine), - ECORE_GETOPT_VALUE_BOOL(quitOption), - ECORE_GETOPT_VALUE_BOOL(isFullscreen), - ECORE_GETOPT_VALUE_PTR_CAST(geometry), - ECORE_GETOPT_VALUE_STR(theme), - ECORE_GETOPT_VALUE_STR(userAgent), - ECORE_GETOPT_VALUE_BOOL(sudoWorkaround), - ECORE_GETOPT_VALUE_INT(verbose), - ECORE_GETOPT_VALUE_BOOL(quitOption), - ECORE_GETOPT_VALUE_BOOL(quitOption), - ECORE_GETOPT_VALUE_BOOL(quitOption), - ECORE_GETOPT_VALUE_BOOL(quitOption), - ECORE_GETOPT_VALUE_NONE - }; - - if (!ecore_evas_init()) - return EXIT_FAILURE; - - if (!edje_init()) { - ecore_evas_shutdown(); - return EXIT_FAILURE; - } - - ecore_app_args_set(argc, (const char**) argv); - args = ecore_getopt_parse(&options, values, argc, argv); - - if (args < 0) - return quit(EINA_FALSE, "ERROR: could not parse options.\n"); - - if (quitOption) - return quit(EINA_TRUE, NULL); - - if (args < argc) - url = argv[args]; - else - url = (char*) default_url; - - if (sudoWorkaround) - strcat(getenv("HOME"), "blah"); - - themePath = findThemePath(); - - ewk_init(); - tmp = getenv("TMPDIR"); - if (!tmp) - tmp = "/tmp"; - snprintf(path, sizeof(path), "%s/.ewebkit-%u", tmp, getuid()); - ecore_file_mkpath(path); - ewk_settings_icon_database_path_set(path); - ewk_settings_web_database_path_set(path); - - proxyUri = getenv("http_proxy"); - if (proxyUri) - ewk_settings_proxy_uri_set(proxyUri); - - browserCreate(url, theme, userAgent, geometry, engine, isFullscreen); - ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, &windows); - - ecore_main_loop_begin(); - - ewk_shutdown(); - - return quit(EINA_TRUE, NULL); -} diff --git a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp index 499d6c2..8ec783a 100644 --- a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp +++ b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp @@ -39,6 +39,7 @@ #include "EWebKit.h" #include "FormState.h" #include "FrameLoader.h" +#include "FrameNetworkingContextEfl.h" #include "FrameTree.h" #include "FrameView.h" #include "HTMLFormElement.h" @@ -945,4 +946,9 @@ void FrameLoaderClientEfl::transitionToCommittedForNewPage() ewk_view_frame_main_cleared(m_view); } +PassRefPtr<FrameNetworkingContext> FrameLoaderClientEfl::createNetworkingContext() +{ + return FrameNetworkingContextEfl::create(ewk_frame_core_get(m_frame)); +} + } diff --git a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h index 561760c..bd105cd 100644 --- a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h +++ b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h @@ -202,6 +202,8 @@ class FrameLoaderClientEfl : public FrameLoaderClient { virtual bool canCachePage() const; virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&); + + virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); private: Evas_Object *m_view; Evas_Object *m_frame; diff --git a/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.h b/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.h new file mode 100644 index 0000000..4e67512 --- /dev/null +++ b/WebKit/efl/WebCoreSupport/FrameNetworkingContextEfl.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2010 Samsung Electronics + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FrameNetworkingContextEfl_h +#define FrameNetworkingContextEfl_h + +#include "FrameNetworkingContext.h" + +namespace WebCore { + +class FrameNetworkingContextEfl : public WebCore::FrameNetworkingContext { +public: + static PassRefPtr<FrameNetworkingContextEfl> create(WebCore::Frame* frame) + { + return adoptRef(new FrameNetworkingContextEfl(frame)); + } + + WebCore::Frame* coreFrame() const { return frame(); } + +private: + FrameNetworkingContextEfl(WebCore::Frame* frame) + : WebCore::FrameNetworkingContext(frame) + { + } +}; + +} + +#endif diff --git a/WebKit/efl/ewebkit.pc.in b/WebKit/efl/ewebkit.pc.in index d618e30..3a1c8f5 100644 --- a/WebKit/efl/ewebkit.pc.in +++ b/WebKit/efl/ewebkit.pc.in @@ -2,6 +2,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include +datadir=${prefix}/share/@WebKit_LIBRARY_NAME@-@PROJECT_VERSION_MAJOR@ Name: WebKit-EFL Description: Web content engine for EFL applications @@ -9,4 +10,4 @@ Version: @PROJECT_VERSION@ Requires: cairo evas ecore Libs: -L${libdir} -lewebkit @EXTRA_EWEBKIT_LINK@ Libs.private: @LIBS_PRIVATE@ -Cflags: -I${includedir}/EWebKit +Cflags: -I${includedir}/@WebKit_LIBRARY_NAME@-@PROJECT_VERSION_MAJOR@ diff --git a/WebKit/efl/ewk/ewk_frame.cpp b/WebKit/efl/ewk/ewk_frame.cpp index a7ce1ff..8945ee7 100644 --- a/WebKit/efl/ewk/ewk_frame.cpp +++ b/WebKit/efl/ewk/ewk_frame.cpp @@ -636,7 +636,7 @@ Eina_Bool ewk_frame_editable_set(Evas_Object* o, Eina_Bool editable) if (sd->editable == editable) return EINA_TRUE; if (editable) - sd->frame->applyEditingStyleToBodyElement(); + sd->frame->editor()->applyEditingStyleToBodyElement(); return EINA_TRUE; } @@ -651,7 +651,7 @@ char* ewk_frame_selection_get(const Evas_Object* o) { EWK_FRAME_SD_GET_OR_RETURN(o, sd, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, 0); - WTF::CString s = sd->frame->selectedText().utf8(); + WTF::CString s = sd->frame->editor()->selectedText().utf8(); if (s.isNull()) return 0; return strdup(s.data()); @@ -751,7 +751,7 @@ Eina_Bool ewk_frame_text_search(const Evas_Object* o, const char* string, Eina_B EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(string, EINA_FALSE); - return sd->frame->findString(WTF::String::fromUTF8(string), forward, case_sensitive, wrap, true); + return sd->frame->editor()->findString(WTF::String::fromUTF8(string), forward, case_sensitive, wrap, true); } /** @@ -771,8 +771,8 @@ unsigned int ewk_frame_text_matches_mark(Evas_Object* o, const char* string, Ein EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(string, 0); - sd->frame->setMarkedTextMatchesAreHighlighted(highlight); - return sd->frame->countMatchesForText(WTF::String::fromUTF8(string), case_sensitive, limit, true); + sd->frame->editor()->setMarkedTextMatchesAreHighlighted(highlight); + return sd->frame->editor()->countMatchesForText(WTF::String::fromUTF8(string), case_sensitive, limit, true); } /** @@ -803,7 +803,7 @@ Eina_Bool ewk_frame_text_matches_highlight_set(Evas_Object* o, Eina_Bool highlig { EWK_FRAME_SD_GET_OR_RETURN(o, sd, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, EINA_FALSE); - sd->frame->setMarkedTextMatchesAreHighlighted(highlight); + sd->frame->editor()->setMarkedTextMatchesAreHighlighted(highlight); return EINA_TRUE; } @@ -818,7 +818,7 @@ Eina_Bool ewk_frame_text_matches_highlight_get(const Evas_Object* o) { EWK_FRAME_SD_GET_OR_RETURN(o, sd, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, EINA_FALSE); - return sd->frame->markedTextMatchesAreHighlighted(); + return sd->frame->editor()->markedTextMatchesAreHighlighted(); } /** diff --git a/WebKit/efl/ewk/ewk_view.cpp b/WebKit/efl/ewk/ewk_view.cpp index ea54167..254fdfd 100644 --- a/WebKit/efl/ewk/ewk_view.cpp +++ b/WebKit/efl/ewk/ewk_view.cpp @@ -1445,7 +1445,7 @@ char* ewk_view_selection_get(const Evas_Object* o) { EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0); EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0); - WTF::CString s = priv->page->focusController()->focusedOrMainFrame()->selectedText().utf8(); + WTF::CString s = priv->page->focusController()->focusedOrMainFrame()->editor()->selectedText().utf8(); if (s.isNull()) return 0; return strdup(s.data()); diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index 8098b7f..25fe4fd 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,90 @@ +2010-09-08 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to Editor as planned + https://bugs.webkit.org/show_bug.cgi?id=45218 + + * webkit/webkitwebview.cpp: + (webkit_web_view_set_highlight_text_matches): + (webkit_web_view_get_selected_text): + (webkit_web_view_set_editable): + Changed call sites to use editor(). + +2010-09-09 Philippe Normand <pnormand@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] testmimehandling falsely succeeds testing Ogg mime type + https://bugs.webkit.org/show_bug.cgi?id=45349 + + Make this actually test an ogg file request instead of pdf and + changed the expected result to match libsoup content-sniffing + result in the case of ogg/vorbis file. + + * tests/testmimehandling.c: + (mime_type_policy_decision_requested_cb): + (test_mime_ogg): + +2010-09-08 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Martin Robinson. + + [Gtk] A list item's number/bullet should not be a child of that list item + https://bugs.webkit.org/show_bug.cgi?id=45190 + + New unit test added. + + * tests/testatk.c: + (testWebkitAtkListsOfItems): New test to check ordered/unordered + list of items are properly exposed to AT technologies. + (main): + +2010-09-07 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Fix some feature guards + https://bugs.webkit.org/show_bug.cgi?id=45302 + + * webkit/webkitprivate.h: Add ENABLE(VIDEO) guards for video specific members. + +2010-09-03 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 + + Add GTK's specific implementation of FrameNetworkingContext. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::createNetworkingContext): + * WebCoreSupport/FrameLoaderClientGtk.h: + +2010-09-03 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Dialog separators are gone in GTK+ 3.x. + + * webkit/webkitsoupauthdialog.c: + (show_auth_dialog): + +2010-09-02 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + REGRESSION: Crash occurs at objc_msgSend when closing a window that is displaying the web inspector + https://bugs.webkit.org/show_bug.cgi?id=44230 + + * WebCoreSupport/InspectorClientGtk.cpp: + (WebKit::notifyWebViewDestroyed): + (WebKit::InspectorFrontendClient::destroyInspectorWindow): + (WebKit::InspectorFrontendClient::closeWindow): + (WebKit::InspectorFrontendClient::disconnectFromBackend): + * WebCoreSupport/InspectorClientGtk.h: + 2010-08-31 Dave Hyatt <hyatt@apple.com> Reviewed by Sam Weinig. diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 2cf4f36..4b0da3d 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -32,6 +32,7 @@ #include "DocumentLoaderGtk.h" #include "FormState.h" #include "FrameLoader.h" +#include "FrameNetworkingContextGtk.h" #include "FrameView.h" #include "FrameTree.h" #include "GOwnPtr.h" @@ -1193,4 +1194,9 @@ void FrameLoaderClient::transitionToCommittedForNewPage() postCommitFrameViewSetup(m_frame, frame->view(), true); } +PassRefPtr<FrameNetworkingContext> FrameLoaderClient::createNetworkingContext() +{ + return FrameNetworkingContextGtk::create(core(m_frame)); +} + } diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h index 33e9ee5..753576b 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h @@ -181,6 +181,9 @@ namespace WebKit { virtual bool canCachePage() const; virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); + + virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); + private: WebKitWebFrame* m_frame; WebCore::ResourceResponse m_response; diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp index aedf21f..c8b42d7 100644 --- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp @@ -36,7 +36,7 @@ namespace WebKit { static void notifyWebViewDestroyed(WebKitWebView* webView, InspectorFrontendClient* inspectorFrontendClient) { - inspectorFrontendClient->destroyInspectorWindow(); + inspectorFrontendClient->destroyInspectorWindow(true); } InspectorClient::InspectorClient(WebKitWebView* webView) @@ -274,7 +274,7 @@ InspectorFrontendClient::~InspectorFrontendClient() ASSERT(!m_webInspector); } -void InspectorFrontendClient::destroyInspectorWindow() +void InspectorFrontendClient::destroyInspectorWindow(bool notifyInspectorController) { if (!m_webInspector) return; @@ -284,7 +284,8 @@ void InspectorFrontendClient::destroyInspectorWindow() g_signal_handlers_disconnect_by_func(m_inspectorWebView, (gpointer)notifyWebViewDestroyed, (gpointer)this); m_inspectorWebView = 0; - core(m_inspectedWebView)->inspectorController()->disconnectFrontend(); + if (notifyInspectorController) + core(m_inspectedWebView)->inspectorController()->disconnectFrontend(); if (m_inspectorClient) m_inspectorClient->releaseFrontendPage(); @@ -326,7 +327,12 @@ void InspectorFrontendClient::bringToFront() void InspectorFrontendClient::closeWindow() { - destroyInspectorWindow(); + destroyInspectorWindow(true); +} + +void InspectorFrontendClient::disconnectFromBackend() +{ + destroyInspectorWindow(false); } void InspectorFrontendClient::attachWindow() diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h index 8b68405..08038f6 100644 --- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h @@ -80,7 +80,7 @@ namespace WebKit { void disconnectInspectorClient() { m_inspectorClient = 0; } - void destroyInspectorWindow(); + void destroyInspectorWindow(bool notifyInspectorController); virtual WTF::String localizedStringsURL(); @@ -88,6 +88,7 @@ namespace WebKit { virtual void bringToFront(); virtual void closeWindow(); + virtual void disconnectFromBackend(); virtual void attachWindow(); virtual void detachWindow(); diff --git a/WebKit/gtk/tests/testatk.c b/WebKit/gtk/tests/testatk.c index e159f8a..9930bc2 100644 --- a/WebKit/gtk/tests/testatk.c +++ b/WebKit/gtk/tests/testatk.c @@ -46,6 +46,8 @@ static const char* contentsInTableWithHeaders = "<html><body><table><tr><th>foo< 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 gboolean bail_out(GMainLoop* loop) { if (g_main_loop_is_running(loop)) @@ -843,6 +845,81 @@ static void test_webkit_atk_get_extents(void) g_object_unref(webView); } +static void testWebkitAtkListsOfItems(void) +{ + WebKitWebView* webView; + AtkObject* obj; + AtkObject* uList; + AtkObject* oList; + AtkObject* item1; + AtkObject* item2; + AtkObject* item3; + GMainLoop* loop; + + 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, listsOfItems, 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); + + // Unordered list + + uList = atk_object_ref_accessible_child(obj, 0); + g_assert(ATK_OBJECT(uList)); + 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)); + + 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_object_unref(item1); + g_object_unref(item2); + g_object_unref(item3); + + // Ordered list + + oList = atk_object_ref_accessible_child(obj, 1); + g_assert(ATK_OBJECT(oList)); + 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)); + + 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_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_object_unref(item1); + g_object_unref(item2); + g_object_unref(item3); + + g_object_unref(uList); + g_object_unref(oList); + g_object_unref(webView); +} + int main(int argc, char** argv) { g_thread_init(NULL); @@ -860,6 +937,7 @@ int main(int argc, char** argv) g_test_add_func("/webkit/atk/getHeadersInTable", testWebkitAtkGetHeadersInTable); g_test_add_func("/webkit/atk/textAttributes", testWebkitAtkTextAttributes); 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/tests/testmimehandling.c b/WebKit/gtk/tests/testmimehandling.c index 2ab0257..3a0eded 100644 --- a/WebKit/gtk/tests/testmimehandling.c +++ b/WebKit/gtk/tests/testmimehandling.c @@ -125,7 +125,7 @@ static gboolean mime_type_policy_decision_requested_cb(WebKitWebView* view, WebK g_assert_cmpstr(mime_type, ==, "text/plain"); g_assert(webkit_web_view_can_show_mime_type(view, mime_type)); } else if (g_str_equal(type, "ogg")) { - g_assert_cmpstr(mime_type, ==, "audio/ogg"); + g_assert_cmpstr(mime_type, ==, "audio/x-vorbis+ogg"); g_assert(webkit_web_view_can_show_mime_type(view, mime_type)); } @@ -172,7 +172,7 @@ static void test_mime_text() static void test_mime_ogg() { - test_mime_type("pdf"); + test_mime_type("ogg"); } int main(int argc, char** argv) diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index 92bb27d..bde5b55 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -163,7 +163,9 @@ extern "C" { gboolean disposing; gboolean usePrimaryForPaste; +#if ENABLE(VIDEO) FullscreenVideoController* fullscreenVideoController; +#endif // These are hosted here because the DataSource object is // created too late in the frame loading process. diff --git a/WebKit/gtk/webkit/webkitsoupauthdialog.c b/WebKit/gtk/webkit/webkitsoupauthdialog.c index daecc73..0cf1c23 100644 --- a/WebKit/gtk/webkit/webkitsoupauthdialog.c +++ b/WebKit/gtk/webkit/webkitsoupauthdialog.c @@ -213,7 +213,9 @@ static void show_auth_dialog(WebKitAuthData* authData, const char* login, const NULL); /* Set the dialog up with HIG properties */ +#ifdef GTK_API_VERSION_2 gtk_dialog_set_has_separator(dialog, FALSE); +#endif gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(dialog)), 2); /* 2 * 5 + 2 = 12 */ gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_action_area(dialog)), 5); diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index 98f8e4e..480983f 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -3693,7 +3693,7 @@ void webkit_web_view_set_highlight_text_matches(WebKitWebView* webView, gboolean Frame *frame = core(webView)->mainFrame(); do { - frame->setMarkedTextMatchesAreHighlighted(shouldHighlight); + frame->editor()->setMarkedTextMatchesAreHighlighted(shouldHighlight); frame = frame->tree()->traverseNextWithWrap(false); } while (frame); } @@ -3875,7 +3875,7 @@ gchar* webkit_web_view_get_selected_text(WebKitWebView* webView) g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); - return g_strdup(frame->selectedText().utf8().data()); + return g_strdup(frame->editor()->selectedText().utf8().data()); } /** @@ -3947,7 +3947,7 @@ void webkit_web_view_set_editable(WebKitWebView* webView, gboolean flag) priv->editable = flag; if (flag) { - frame->applyEditingStyleToBodyElement(); + frame->editor()->applyEditingStyleToBodyElement(); // TODO: If the WebKitWebView is made editable and the selection is empty, set it to something. //if (!webkit_web_view_get_selected_dom_range(webView)) // mainFrame->setSelectionFromNone(); diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index 88a2fbf..df5ca46 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,245 @@ +2010-09-09 John Therrell <jtherrell@apple.com> + + Reviewed by Alexey Proskuryakov. + + Added statistics sampling and reporting for JavaScriptCore's RegisterFile and ExecutableAllocator classes + https://bugs.webkit.org/show_bug.cgi?id=45134 + + Added ability to enable new JavaScriptCore statistics sampling and reporting for RegisterFile + and ExecutableAllocator classes. Added reporting of JavaScriptCore's stack committed memory + and JIT code committed memory statistics to WebCoreStatistics memoryStatistics. + + * Misc/WebCoreStatistics.mm: + (+[WebCoreStatistics memoryStatistics]): + Added statistics reporting for JSC RegisterFile and ExecutableAllocator. + +2010-09-09 Jer Noble <jer.noble@apple.com> + + Reviewed by Mark Rowe. + + Use of ENABLE macro in WebUIDelegatePrivate.h breaks use from outside WebKit + <rdar://problem/8412657> + + * WebView/WebUIDelegatePrivate.h: Use ENABLE_FULLSCREEN_API instead of ENABLE(FULLSCREEN_API) + +2010-09-08 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to Editor as planned + https://bugs.webkit.org/show_bug.cgi?id=45218 + + * WebView/WebFrame.mm: + (-[WebFrame _selectedString]): + (-[WebFrame _firstRectForDOMRange:]): + (-[WebFrame _markDOMRange]): + (-[WebFrame _setTypingStyle:withUndoAction:]): + * WebView/WebHTMLRepresentation.mm: + (-[WebHTMLRepresentation finishedLoadingWithDataSource:]): + * WebView/WebHTMLView.mm: + (-[WebHTMLView _selectionStartFontAttributesAsRTF]): + (-[WebHTMLView toggleBaseWritingDirection:]): + (-[WebHTMLView searchFor:direction:caseSensitive:wrap:startInSelection:]): + (-[WebHTMLView countMatchesForText:caseSensitive:limit:markMatches:]): + (-[WebHTMLView setMarkedTextMatchesAreHighlighted:]): + (-[WebHTMLView markedTextMatchesAreHighlighted]): + * WebView/WebView.mm: + (-[WebView setEditable:]): + Changed call sites to use editor(). + +2010-09-08 MORITA Hajime <morrita@google.com> + + Reviewed by Tony Chang. + + spelling underline gets lost on backspace + https://bugs.webkit.org/show_bug.cgi?id=41423 + + Switched to use a anchorNode of the selection instead of a focused + node for finer control of node selection in spellingNode(): + With the focused node, we cannot select other nodes but the first + child of that node. In some case, we need to inspect these. + + The API is only for LayoutTests, and the change is compatible for + existing test cases. + + * WebView/WebFrame.mm: + (spellingNode): + +2010-09-08 Adam Barth <abarth@webkit.org> + + Rubber-stamped by Eric Seidel. + + Rename DocLoader to CachedResourceLoader because that's what it does. + + * WebView/WebFrame.mm: + +2010-09-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Oliver Hunt. + + Fix clang++ build. + + * Misc/WebLocalizableStrings.h: + Fix a struct/tag mismatch. + + * WebView/WebDeviceOrientationProviderMock.mm: + (-[WebDeviceOrientationProviderMock init]): + Remove stray semicolon. + + * WebView/WebViewData.h: + Remove unused class forward declaration. + +2010-09-07 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8381749> -Wcast-align warning emitted when building with clang + + Remove the -Wcast-align-warning since it isn't really useful, and clang is more aggressive about warning than gcc. + + * Configurations/Base.xcconfig: + +2010-09-06 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Rename SecurityOrigin::canLoad to canDisplay + https://bugs.webkit.org/show_bug.cgi?id=45214 + + Propagate name change. + + * 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-03 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 + + Add Mac's specific implementation of FrameNetworkingContext. + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + * WebCoreSupport/WebFrameNetworkingContext.mm: + (WebFrameNetworkingContext::needsSiteSpecificQuirks): + (WebFrameNetworkingContext::localFileContentSniffingEnabled): + (WebFrameNetworkingContext::scheduledRunLoopPairs): + (WebFrameNetworkingContext::blockedError): + +2010-09-03 John Sullivan <sullivan@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=45175 + [WebView unmarkAllTextMatches] will crash if the webview is already closed + + Made this and related methods robust against being called when the WebView is closed. + + * WebView/WebView.mm: + (-[WebView markAllMatchesForText:caseSensitive:highlight:limit:]): + Bail out if the WebView is closed. + (-[WebView countMatchesForText:caseSensitive:highlight:limit:markMatches:]): + Ditto. + (-[WebView unmarkAllTextMatches]): + Ditto. + (-[WebView rectsForTextMatches]): + Ditto. + +2010-09-03 Hironori Bono <hbono@chromium.org> + + Reviewed by Kent Tamura. + + Adds textInputController.hasSpellingMarker() to avoid using pixel tests for spellchecking tests + and implements it for Mac. + https://bugs.webkit.org/show_bug.cgi?id=41832 + + * WebView/WebFrame.mm: Implemented [WebFrame hasSpellingMarker:length:]. + (spellingNode): + (-[WebFrame hasSpellingMarker:length:]): + * WebView/WebFramePrivate.h: Added [WebFrame hasSpellingMarker:length:] so TextInputController can use it. + +2010-09-02 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + REGRESSION: Crash occurs at objc_msgSend when closing a window that is displaying the web inspector + https://bugs.webkit.org/show_bug.cgi?id=44230 + + * WebCoreSupport/WebInspectorClient.h: + * WebCoreSupport/WebInspectorClient.mm: + (WebInspectorFrontendClient::closeWindow): + (WebInspectorFrontendClient::disconnectFromBackend): + (-[WebInspectorWindowController windowShouldClose:]): + (-[WebInspectorWindowController destroyInspectorView:]): + +2010-09-02 Steve Block <steveblock@google.com> + + Reviewed by Adam Barth. + + Hook up LayoutTestController.setMockDeviceOrientation() on Mac. + https://bugs.webkit.org/show_bug.cgi?id=43181 + + This patch hooks up the mock device orientation client on Mac for use + in DumpRenderTree. + + The patch adds a new WebDeviceOrientationClient for Mac. This client acts + as a proxy to either a real or mock device orientation provider, both of + which implement a new WebDeviceOrientationProvider interface. + + The provider is created by the embedder and passed to the WebView, from + where WebDeviceOrientationClient can access it. + + The mock provider, WebDeviceOrientationProviderMock, is a wrapper around + the existing WebCore mock. + + * WebCoreSupport/WebDeviceOrientationClient.h: Added. + * WebCoreSupport/WebDeviceOrientationClient.mm: Added. + (WebDeviceOrientationClient::WebDeviceOrientationClient): + (WebDeviceOrientationClient::setController): + (WebDeviceOrientationClient::startUpdating): + (WebDeviceOrientationClient::stopUpdating): + (WebDeviceOrientationClient::lastOrientation): + * WebKit.exp: + * WebView/WebDeviceOrientation.h: Added. + * WebView/WebDeviceOrientation.mm: Added. + (-[WebDeviceOrientation initWithCoreDeviceOrientation:WebCore::]): + (core): + (-[WebDeviceOrientation initWithCanProvideAlpha:alpha:canProvideBeta:beta:canProvideGamma:gamma:]): + (-[WebDeviceOrientation dealloc]): + * WebView/WebDeviceOrientationInternal.h: Added. + * WebView/WebDeviceOrientationProvider.h: Added. + * WebView/WebDeviceOrientationProviderMock.h: Added. + * WebView/WebDeviceOrientationProviderMock.mm: Added. + (-[WebDeviceOrientationProviderMockInternal setOrientation:]): + (-[WebDeviceOrientationProviderMockInternal setController:]): + (-[WebDeviceOrientationProviderMockInternal startUpdating]): + (-[WebDeviceOrientationProviderMockInternal stopUpdating]): + (-[WebDeviceOrientationProviderMockInternal lastOrientation]): + (-[WebDeviceOrientationProviderMock init]): + (-[WebDeviceOrientationProviderMock dealloc]): + (-[WebDeviceOrientationProviderMock setOrientation:]): + (-[WebDeviceOrientationProviderMock setController:]): + (-[WebDeviceOrientationProviderMock startUpdating]): + (-[WebDeviceOrientationProviderMock stopUpdating]): + (-[WebDeviceOrientationProviderMock lastOrientation]): + * WebView/WebDeviceOrientationProviderMockInternal.h: Added. + * WebView/WebView.mm: + (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]): + (-[WebView _setDeviceOrientationProvider:]): + (-[WebView _deviceOrientationProvider]): + * WebView/WebViewData.h: + * WebView/WebViewPrivate.h: + 2010-09-01 Jia Pu <jpu@apple.com> Reviewed by Dan Bernstein. diff --git a/WebKit/mac/Configurations/Base.xcconfig b/WebKit/mac/Configurations/Base.xcconfig index b3f8ea6..0e84791 100644 --- a/WebKit/mac/Configurations/Base.xcconfig +++ b/WebKit/mac/Configurations/Base.xcconfig @@ -56,8 +56,8 @@ VALID_ARCHS_macosx = i386 ppc x86_64 ppc64; WARNING_CFLAGS_BASE = -Wall -Wextra -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; WARNING_CFLAGS = $(WARNING_CFLAGS_$(REAL_PLATFORM_NAME)); WARNING_CFLAGS_iphoneos = $(WARNING_CFLAGS_BASE); -WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE) -Wcast-align; -WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_BASE) -Wcast-align; +WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE); +WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_BASE); REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); diff --git a/WebKit/mac/Configurations/Version.xcconfig b/WebKit/mac/Configurations/Version.xcconfig index 659ac62..9f9441c 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 = 7; +MINOR_VERSION = 8; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm index a5d5ae1..cc68cef 100644 --- a/WebKit/mac/Misc/WebCoreStatistics.mm +++ b/WebKit/mac/Misc/WebCoreStatistics.mm @@ -29,6 +29,8 @@ #import "WebCoreStatistics.h" #import "DOMElementInternal.h" +#import <JavaScriptCore/RegisterFile.h> +#import <JavaScriptCore/ExecutableAllocator.h> #import "WebCache.h" #import "WebFrameInternal.h" #import <runtime/JSLock.h> @@ -196,12 +198,16 @@ using namespace WebCore; 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(); 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", nil]; } diff --git a/WebKit/mac/Misc/WebLocalizableStrings.h b/WebKit/mac/Misc/WebLocalizableStrings.h index ecad83d..853b601 100644 --- a/WebKit/mac/Misc/WebLocalizableStrings.h +++ b/WebKit/mac/Misc/WebLocalizableStrings.h @@ -28,6 +28,8 @@ #if __OBJC__ @class NSBundle; +#elif __cplusplus +class NSBundle; #else typedef struct NSBundle NSBundle; #endif diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm index a8dd09b..88df4cf 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::canLoad(URL, String(), core([m_pluginView webFrame])->document())) + if (!SecurityOrigin::canDisplay(URL, String(), core([m_pluginView webFrame])->document())) return NPERR_GENERIC_ERROR; } diff --git a/WebKit/mac/Plugins/WebNetscapePluginStream.mm b/WebKit/mac/Plugins/WebNetscapePluginStream.mm index 5c1e8ee..35af439 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::canLoad([request URL], String(), core([view webFrame])->document())); + ASSERT(SecurityOrigin::canDisplay([request URL], String(), core([view webFrame])->document())); ASSERT([request URL]); ASSERT(plugin); diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm index a4481bc..e98c6b7 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::canLoad(URL, String(), core([self webFrame])->document())) + if (!SecurityOrigin::canDisplay(URL, String(), core([self webFrame])->document())) return NPERR_GENERIC_ERROR; } diff --git a/WebKit/mac/Plugins/WebPluginContainerCheck.mm b/WebKit/mac/Plugins/WebPluginContainerCheck.mm index 5609d80..e273bfc 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::canLoad([_request URL], String(), coreFrame->document())) { + if (!SecurityOrigin::canDisplay([_request URL], String(), coreFrame->document())) { [self _continueWithPolicy:PolicyIgnore]; return YES; } diff --git a/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.h b/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.h new file mode 100644 index 0000000..1cbc8e2 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationProvider.h" +#import <WebCore/DeviceOrientationClient.h> + +namespace WebCore { +class DeviceOrientationController; +} + +@class WebView; + +// This class is the Mac implementation of DeviceOrientationClient. It is +// passed to the Page constructor by the WebView. It is a simple proxy to +// either the real or mock client which is passed to the WebView. It is +// required because the WebView must pass a client to the Page constructor, +// but the real or mock client can not be specified until after the Page has +// been constructed. +class WebDeviceOrientationClient : public WebCore::DeviceOrientationClient { +public: + WebDeviceOrientationClient(WebView*); + + // DeviceOrientationClient methods + virtual void setController(WebCore::DeviceOrientationController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual WebCore::DeviceOrientation* lastOrientation() const; + +private: + id<WebDeviceOrientationProvider> getProvider() const; + + WebView* m_webView; + WebCore::DeviceOrientationController* m_controller; + mutable id<WebDeviceOrientationProvider> m_provider; +}; diff --git a/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm b/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm new file mode 100644 index 0000000..278e835 --- /dev/null +++ b/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationClient.h" + +#import "WebDeviceOrientationInternal.h" +#import "WebDeviceOrientationProvider.h" +#import "WebViewInternal.h" +#import <objc/objc-runtime.h> + +using namespace WebCore; + +WebDeviceOrientationClient::WebDeviceOrientationClient(WebView* webView) + : m_webView(webView) + , m_controller(0) +{ +} + +void WebDeviceOrientationClient::setController(DeviceOrientationController* controller) +{ + // This is called by the Page constructor before our WebView has the provider set up. + // Cache the controller for later use. + m_controller = controller; +} + +void WebDeviceOrientationClient::startUpdating() +{ + [getProvider() startUpdating]; +} + +void WebDeviceOrientationClient::stopUpdating() +{ + [getProvider() stopUpdating]; +} + +DeviceOrientation* WebDeviceOrientationClient::lastOrientation() const +{ + return core([getProvider() lastOrientation]); +} + +id<WebDeviceOrientationProvider> WebDeviceOrientationClient::getProvider() const +{ + if (!m_provider) { + m_provider = [m_webView _deviceOrientationProvider]; + if ([m_provider respondsToSelector:@selector(setController:)]) + objc_msgSend(m_provider, @selector(setController:), m_controller); + } + return m_provider; +} diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index d932e66..cbb89ec 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -228,6 +228,8 @@ private: virtual bool canCachePage() const; + virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); + RetainPtr<WebFrame> m_webFrame; RetainPtr<WebFramePolicyListener> m_policyListener; diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 3f7c471..dcbca28 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -47,6 +47,7 @@ #import "WebFormDelegate.h" #import "WebFrameInternal.h" #import "WebFrameLoadDelegate.h" +#import "WebFrameNetworkingContext.h" #import "WebFrameViewInternal.h" #import "WebHTMLRepresentationPrivate.h" #import "WebHTMLViewInternal.h" @@ -1904,6 +1905,11 @@ void WebFrameLoaderClient::didPerformFirstNavigation() const [preferences setCacheModel:WebCacheModelDocumentBrowser]; } +PassRefPtr<FrameNetworkingContext> WebFrameLoaderClient::createNetworkingContext() +{ + return WebFrameNetworkingContext::create(core(m_webFrame.get())); +} + #if ENABLE(JAVA_BRIDGE) jobject WebFrameLoaderClient::javaApplet(NSView* view) { diff --git a/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm b/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm index 941cfaa..98b8ce1 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm @@ -17,5 +17,30 @@ Boston, MA 02110-1301, USA. */ -// Checking this file in empty to get the build system work out of the way. -// Will put the code in here later. +#import "WebFrameNetworkingContext.h" + +#import <WebCore/Page.h> +#import <WebCore/ResourceError.h> +#import <WebCore/Settings.h> + +using namespace WebCore; + +bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const +{ + return frame() && frame()->settings() && frame()->settings()->needsSiteSpecificQuirks(); +} + +bool WebFrameNetworkingContext::localFileContentSniffingEnabled() const +{ + return frame() && frame()->settings() && frame()->settings()->localFileContentSniffingEnabled(); +} + +SchedulePairHashSet* WebFrameNetworkingContext::scheduledRunLoopPairs() const +{ + return frame() && frame()->page() ? frame()->page()->scheduledRunLoopPairs() : 0; +} + +ResourceError WebFrameNetworkingContext::blockedError(const ResourceRequest& request) const +{ + return frame()->loader()->blockedError(request); +} diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.h b/WebKit/mac/WebCoreSupport/WebInspectorClient.h index d33e3b9..75a3cc6 100644 --- a/WebKit/mac/WebCoreSupport/WebInspectorClient.h +++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.h @@ -84,6 +84,7 @@ public: virtual void bringToFront(); virtual void closeWindow(); + virtual void disconnectFromBackend(); virtual void attachWindow(); virtual void detachWindow(); diff --git a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm index 7cae8fc..d4d0213 100644 --- a/WebKit/mac/WebCoreSupport/WebInspectorClient.mm +++ b/WebKit/mac/WebCoreSupport/WebInspectorClient.mm @@ -66,7 +66,7 @@ using namespace WebCore; - (void)setFrontendClient:(WebInspectorFrontendClient*)frontendClient; - (void)setInspectorClient:(WebInspectorClient*)inspectorClient; - (void)setAttachedWindowHeight:(unsigned)height; -- (void)destroyInspectorView; +- (void)destroyInspectorView:(bool)notifyInspectorController; @end #pragma mark - @@ -169,7 +169,12 @@ void WebInspectorFrontendClient::bringToFront() void WebInspectorFrontendClient::closeWindow() { - [m_windowController.get() destroyInspectorView]; + [m_windowController.get() destroyInspectorView:true]; +} + +void WebInspectorFrontendClient::disconnectFromBackend() +{ + [m_windowController.get() destroyInspectorView:false]; } void WebInspectorFrontendClient::attachWindow() @@ -308,7 +313,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const - (BOOL)windowShouldClose:(id)sender { - [self destroyInspectorView]; + [self destroyInspectorView:true]; return YES; } @@ -439,7 +444,7 @@ void WebInspectorFrontendClient::updateWindowTitle() const [frameView setFrame:frameViewRect]; } -- (void)destroyInspectorView +- (void)destroyInspectorView:(bool)notifyInspectorController { if (_destroyingInspectorView) return; @@ -450,10 +455,12 @@ void WebInspectorFrontendClient::updateWindowTitle() const _visible = NO; - if (Page* inspectedPage = [_inspectedWebView page]) - inspectedPage->inspectorController()->disconnectFrontend(); + if (notifyInspectorController) { + if (Page* inspectedPage = [_inspectedWebView page]) + inspectedPage->inspectorController()->disconnectFrontend(); - _inspectorClient->releaseFrontendPage(); + _inspectorClient->releaseFrontendPage(); + } [_webView close]; } diff --git a/WebKit/mac/WebKit.exp b/WebKit/mac/WebKit.exp index a22179f..463ab00 100644 --- a/WebKit/mac/WebKit.exp +++ b/WebKit/mac/WebKit.exp @@ -7,6 +7,8 @@ .objc_class_name_WebDataSource .objc_class_name_WebDatabaseManager .objc_class_name_WebDefaultPolicyDelegate +.objc_class_name_WebDeviceOrientation +.objc_class_name_WebDeviceOrientationProviderMock .objc_class_name_WebDownload .objc_class_name_WebDynamicScrollBarsView .objc_class_name_WebFormDelegate diff --git a/WebKit/mac/WebView/WebDeviceOrientation.h b/WebKit/mac/WebView/WebDeviceOrientation.h new file mode 100644 index 0000000..ee04199 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientation.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +@class WebDeviceOrientationInternal; + +@interface WebDeviceOrientation : NSObject { + WebDeviceOrientationInternal* m_internal; +} + +- (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvideBeta:(bool)canProvideBeta beta:(double)beta canProvideGamma:(bool)canProvideGamma gamma:(double)gamma; + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientation.mm b/WebKit/mac/WebView/WebDeviceOrientation.mm new file mode 100644 index 0000000..7be5d0c --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientation.mm @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationInternal.h" + +using namespace WebCore; + +@implementation WebDeviceOrientationInternal + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<DeviceOrientation>)coreDeviceOrientation +{ + self = [super init]; + if (!self) + return nil; + m_orientation = coreDeviceOrientation; + return self; +} + +@end + +@implementation WebDeviceOrientation (Internal) + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation +{ + self = [super init]; + if (!self) + return nil; + m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:coreDeviceOrientation]; + return self; +} + +@end + +@implementation WebDeviceOrientation + +DeviceOrientation* core(WebDeviceOrientation* orientation) +{ + return orientation ? orientation->m_internal->m_orientation.get() : 0; +} + +- (id)initWithCanProvideAlpha:(bool)canProvideAlpha alpha:(double)alpha canProvideBeta:(bool)canProvideBeta beta:(double)beta canProvideGamma:(bool)canProvideGamma gamma:(double)gamma +{ + self = [super init]; + if (!self) + return nil; + m_internal = [[WebDeviceOrientationInternal alloc] initWithCoreDeviceOrientation:DeviceOrientation::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)]; + return self; +} + +- (void)dealloc +{ + [m_internal release]; + [super dealloc]; +} + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationInternal.h b/WebKit/mac/WebView/WebDeviceOrientationInternal.h new file mode 100644 index 0000000..b7c6aa5 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationInternal.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientation.h" + +#import <WebCore/DeviceOrientation.h> +#import <wtf/RefPtr.h> + +@interface WebDeviceOrientationInternal : NSObject { +@public + RefPtr<WebCore::DeviceOrientation> m_orientation; +} + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation; +@end + +@interface WebDeviceOrientation (Internal) + +- (id)initWithCoreDeviceOrientation:(PassRefPtr<WebCore::DeviceOrientation>)coreDeviceOrientation; + +@end + +WebCore::DeviceOrientation* core(WebDeviceOrientation*); diff --git a/WebKit/mac/WebView/WebDeviceOrientationProvider.h b/WebKit/mac/WebView/WebDeviceOrientationProvider.h new file mode 100644 index 0000000..18b688c --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProvider.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +@class WebDeviceOrientation; + +@protocol WebDeviceOrientationProvider <NSObject> +- (void)startUpdating; +- (void)stopUpdating; +- (WebDeviceOrientation*)lastOrientation; +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationProviderMock.h b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.h new file mode 100644 index 0000000..be5a764 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationProvider.h" + +@class WebDeviceOrientationProviderMockInternal; +@class WebDeviceOrientation; + +@interface WebDeviceOrientationProviderMock : NSObject<WebDeviceOrientationProvider> { + WebDeviceOrientationProviderMockInternal* m_internal; +} + +- (id)init; +- (void)setOrientation:(WebDeviceOrientation*)orientation; + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationProviderMock.mm b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.mm new file mode 100644 index 0000000..0435264 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProviderMock.mm @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationProviderMockInternal.h" + +#import "WebDeviceOrientationInternal.h" + +using namespace WebCore; + +@implementation WebDeviceOrientationProviderMockInternal + +- (id)init +{ + self = [super init]; + if (!self) + return nil; + m_core.set(new DeviceOrientationClientMock()); + return self; +} + +- (void)setOrientation:(WebDeviceOrientation*)orientation +{ + m_core->setOrientation(core(orientation)); +} + +- (void)setController:(DeviceOrientationController*)controller +{ + m_core->setController(controller); +} + +- (void)startUpdating +{ + m_core->startUpdating(); +} + +- (void)stopUpdating +{ + m_core->stopUpdating(); +} + +- (WebDeviceOrientation*)lastOrientation +{ + return [[WebDeviceOrientation alloc] initWithCoreDeviceOrientation:m_core->lastOrientation()]; +} + +@end + +@implementation WebDeviceOrientationProviderMock (Internal) + +- (void)setController:(WebCore::DeviceOrientationController*)controller +{ + [m_internal setController:controller]; +} + +@end + +@implementation WebDeviceOrientationProviderMock + +- (id)init +{ + self = [super init]; + if (!self) + return nil; + m_internal = [[WebDeviceOrientationProviderMockInternal alloc] init]; + return self; +} + +- (void)dealloc +{ + [super dealloc]; + [m_internal release]; +} + +- (void)setOrientation:(WebDeviceOrientation*)orientation +{ + [m_internal setOrientation:orientation]; +} + +- (void)startUpdating +{ + [m_internal startUpdating]; +} + +- (void)stopUpdating +{ + [m_internal stopUpdating]; +} + +- (WebDeviceOrientation*)lastOrientation +{ + return [m_internal lastOrientation]; +} + +@end diff --git a/WebKit/mac/WebView/WebDeviceOrientationProviderMockInternal.h b/WebKit/mac/WebView/WebDeviceOrientationProviderMockInternal.h new file mode 100644 index 0000000..5ac38e5 --- /dev/null +++ b/WebKit/mac/WebView/WebDeviceOrientationProviderMockInternal.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "WebDeviceOrientationProviderMock.h" + +#import <WebCore/DeviceOrientationClientMock.h> +#import <wtf/OwnPtr.h> + +@interface WebDeviceOrientationProviderMockInternal : NSObject { + OwnPtr<WebCore::DeviceOrientationClientMock> m_core; +} + +- (id)init; + +- (void)setOrientation:(WebDeviceOrientation*)orientation; + +- (void)setController:(WebCore::DeviceOrientationController*)controller; + +- (void)startUpdating; +- (void)stopUpdating; +- (WebDeviceOrientation*)lastOrientation; +@end + +@interface WebDeviceOrientationProviderMock (Internal) +- (void)setController:(WebCore::DeviceOrientationController*)controller; +@end diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm index 1feb97e..8d564a3 100644 --- a/WebKit/mac/WebView/WebFrame.mm +++ b/WebKit/mac/WebView/WebFrame.mm @@ -60,7 +60,7 @@ #import <WebCore/Chrome.h> #import <WebCore/ColorMac.h> #import <WebCore/DOMImplementation.h> -#import <WebCore/DocLoader.h> +#import <WebCore/CachedResourceLoader.h> #import <WebCore/DocumentFragment.h> #import <WebCore/EventHandler.h> #import <WebCore/EventNames.h> @@ -529,7 +529,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (NSString *)_selectedString { - return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->selectedText()); + return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->editor()->selectedText()); } - (NSString *)_stringForRange:(DOMRange *)range @@ -662,7 +662,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (NSRect)_firstRectForDOMRange:(DOMRange *)range { - return _private->coreFrame->firstRectForRange(core(range)); + return _private->coreFrame->editor()->firstRectForRange(core(range)); } - (void)_scrollDOMRangeToVisible:(DOMRange *)range @@ -788,7 +788,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) - (DOMRange *)_markDOMRange { - return kit(_private->coreFrame->mark().toNormalizedRange().get()); + return kit(_private->coreFrame->editor()->mark().toNormalizedRange().get()); } // Given proposedRange, returns an extended range that includes adjacent whitespace that should @@ -904,7 +904,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return; - _private->coreFrame->computeAndSetTypingStyle(core(style), undoAction); + _private->coreFrame->editor()->computeAndSetTypingStyle(core(style), undoAction); } - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation @@ -1282,7 +1282,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return YES; - return SecurityOrigin::canLoad(URL, String(), _private->coreFrame->document()); + return SecurityOrigin::canDisplay(URL, String(), _private->coreFrame->document()); } - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObjectRef inScriptWorld:(WebScriptWorld *)world @@ -1366,6 +1366,40 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) return coreFrame->layerTreeAsText(); } +static Node* spellingNode(Frame* coreFrame) +{ + Node* focusedNode = coreFrame->selection()->start().node(); + if (!focusedNode || !focusedNode->renderer()) + return 0; + + for (const RenderObject* renderer = focusedNode->renderer(); renderer; renderer = renderer->childAt(0)) { + if (renderer->isText()) + return renderer->node(); + } + return 0; +} + +- (BOOL)hasSpellingMarker:(int)from length:(int)length +{ + Frame* coreFrame = _private->coreFrame; + if (!coreFrame) + return NO; + + Node* node = spellingNode(coreFrame); + if (!node) + return NO; + + unsigned int startOffset = static_cast<unsigned int>(from); + unsigned int endOffset = static_cast<unsigned int>(from + length); + Vector<DocumentMarker> markers = coreFrame->document()->markers()->markersForNode(node); + for (size_t i = 0; i < markers.size(); ++i) { + DocumentMarker marker = markers[i]; + if (marker.startOffset <= startOffset && endOffset <= marker.endOffset && marker.type == DocumentMarker::Spelling) + return YES; + } + return NO; +} + @end @implementation WebFrame diff --git a/WebKit/mac/WebView/WebFramePrivate.h b/WebKit/mac/WebView/WebFramePrivate.h index a1031f3..9cb6232 100644 --- a/WebKit/mac/WebView/WebFramePrivate.h +++ b/WebKit/mac/WebView/WebFramePrivate.h @@ -143,4 +143,7 @@ typedef enum { - (NSString*)_layerTreeAsText; +// Returns whether there is a spelling marker in the specified range of the focused node. +- (BOOL)hasSpellingMarker:(int)location length:(int)length; + @end diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.mm b/WebKit/mac/WebView/WebHTMLRepresentation.mm index 7843c9a..188747d 100644 --- a/WebKit/mac/WebView/WebHTMLRepresentation.mm +++ b/WebKit/mac/WebView/WebHTMLRepresentation.mm @@ -212,7 +212,7 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second) WebView *webView = [frame webView]; if ([webView isEditable]) - core(frame)->applyEditingStyleToBodyElement(); + core(frame)->editor()->applyEditingStyleToBodyElement(); } } diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index 34745a1..bd71eff 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -4204,7 +4204,7 @@ static BOOL isInPasswordField(Frame* coreFrame) { Frame* coreFrame = core([self _frame]); NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"x" - attributes:coreFrame ? coreFrame->fontAttributesForSelectionStart() : nil]; + attributes:coreFrame ? coreFrame->editor()->fontAttributesForSelectionStart() : nil]; NSData *data = [string RTFFromRange:NSMakeRange(0, [string length]) documentAttributes:nil]; [string release]; return data; @@ -4831,7 +4831,7 @@ NSStrokeColorAttributeName /* NSColor, default nil: same as foreground co return; WritingDirection direction = RightToLeftWritingDirection; - switch (coreFrame->baseWritingDirectionForSelectionStart()) { + switch (coreFrame->editor()->baseWritingDirectionForSelectionStart()) { case NSWritingDirectionLeftToRight: break; case NSWritingDirectionRightToLeft: @@ -6167,7 +6167,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde if (![string length]) return NO; Frame* coreFrame = core([self _frame]); - return coreFrame && coreFrame->findString(string, forward, caseFlag, wrapFlag, startInSelection); + return coreFrame && coreFrame->editor()->findString(string, forward, caseFlag, wrapFlag, startInSelection); } @end @@ -6197,7 +6197,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde Frame* coreFrame = core([self _frame]); if (!coreFrame) return 0; - return coreFrame->countMatchesForText(string, caseFlag, limit, markMatches); + return coreFrame->editor()->countMatchesForText(string, caseFlag, limit, markMatches); } - (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue @@ -6205,13 +6205,13 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde Frame* coreFrame = core([self _frame]); if (!coreFrame) return; - coreFrame->setMarkedTextMatchesAreHighlighted(newValue); + coreFrame->editor()->setMarkedTextMatchesAreHighlighted(newValue); } - (BOOL)markedTextMatchesAreHighlighted { Frame* coreFrame = core([self _frame]); - return coreFrame && coreFrame->markedTextMatchesAreHighlighted(); + return coreFrame && coreFrame->editor()->markedTextMatchesAreHighlighted(); } - (void)unmarkAllTextMatches diff --git a/WebKit/mac/WebView/WebUIDelegatePrivate.h b/WebKit/mac/WebView/WebUIDelegatePrivate.h index 22752ae..4565a4e 100644 --- a/WebKit/mac/WebView/WebUIDelegatePrivate.h +++ b/WebKit/mac/WebView/WebUIDelegatePrivate.h @@ -32,6 +32,10 @@ #define ENABLE_DASHBOARD_SUPPORT 1 #endif +#if !defined(ENABLE_FULLSCREEN_API) +#define ENABLE_FULLSCREEN_API 1 +#endif + // Mail on Tiger expects the old value for WebMenuItemTagSearchInGoogle #define WebMenuItemTagSearchInGoogle OldWebMenuItemTagSearchWeb @@ -95,7 +99,7 @@ enum { - (void)deny; @end -#if ENABLE(FULLSCREEN_API) +#if ENABLE_FULLSCREEN_API @protocol WebKitFullScreenListener<NSObject> - (void)webkitWillEnterFullScreen; - (void)webkitDidEnterFullScreen; @@ -173,7 +177,7 @@ enum { */ - (void)webView:(WebView *)sender printFrame:(WebFrame *)frame; -#if ENABLE(FULLSCREEN_API) +#if ENABLE_FULLSCREEN_API - (BOOL)webView:(WebView *)sender supportsFullScreenForElement:(DOMElement *)element; - (void)webView:(WebView *)sender enterFullScreenForElement:(DOMElement *)element; - (void)webView:(WebView *)sender exitFullScreenForElement:(DOMElement *)element; diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index f2e76c1..0125e1c 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -47,6 +47,8 @@ #import "WebDefaultPolicyDelegate.h" #import "WebDefaultUIDelegate.h" #import "WebDelegateImplementationCaching.h" +#import "WebDeviceOrientationClient.h" +#import "WebDeviceOrientationProvider.h" #import "WebDocument.h" #import "WebDocumentInternal.h" #import "WebDownload.h" @@ -683,6 +685,9 @@ static bool shouldEnableLoadDeferring() #if ENABLE(CLIENT_BASED_GEOLOCATION) pageClients.geolocationControllerClient = new WebGeolocationControllerClient(self); #endif +#if ENABLE(DEVICE_ORIENTATION) + pageClients.deviceOrientationClient = new WebDeviceOrientationClient(self); +#endif _private->page = new Page(pageClients); _private->page->setCanStartMedia([self window]); @@ -4375,11 +4380,17 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit { + if (_private->closed) + return 0; + return [self countMatchesForText:string caseSensitive:caseFlag highlight:highlight limit:limit markMatches:YES]; } - (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit markMatches:(BOOL)markMatches { + if (_private->closed) + return 0; + WebFrame *frame = [self mainFrame]; unsigned matchCount = 0; do { @@ -4404,6 +4415,9 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (void)unmarkAllTextMatches { + if (_private->closed) + return; + WebFrame *frame = [self mainFrame]; do { id <WebDocumentView> view = [[frame frameView] documentView]; @@ -4416,6 +4430,9 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (NSArray *)rectsForTextMatches { + if (_private->closed) + return [NSArray array]; + NSMutableArray *result = [NSMutableArray array]; WebFrame *frame = [self mainFrame]; do { @@ -4749,7 +4766,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu Frame* mainFrame = [self _mainCoreFrame]; if (mainFrame) { if (flag) { - mainFrame->applyEditingStyleToBodyElement(); + mainFrame->editor()->applyEditingStyleToBodyElement(); // If the WebView is made editable and the selection is empty, set it to something. if (![self selectedDOMRange]) mainFrame->setSelectionFromNone(); @@ -5883,6 +5900,23 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity @end +@implementation WebView (WebViewDeviceOrientation) + +- (void)_setDeviceOrientationProvider:(id<WebDeviceOrientationProvider>)deviceOrientationProvider +{ + if (_private) + _private->m_deviceOrientationProvider = deviceOrientationProvider; +} + +- (id<WebDeviceOrientationProvider>)_deviceOrientationProvider +{ + if (_private) + return _private->m_deviceOrientationProvider; + return nil; +} + +@end + @implementation WebView (WebViewGeolocation) - (void)_setGeolocationProvider:(id<WebGeolocationProvider>)geolocationProvider diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h index 3b80a89..558770e 100644 --- a/WebKit/mac/WebView/WebViewData.h +++ b/WebKit/mac/WebView/WebViewData.h @@ -44,6 +44,7 @@ namespace WebCore { @class WebPreferences; @class WebTextCompletionController; @protocol WebFormDelegate; +@protocol WebDeviceOrientationProvider; @protocol WebGeolocationProvider; #if ENABLE(VIDEO) @class WebVideoFullscreenController; @@ -174,5 +175,6 @@ extern int pluginDatabaseClientCount; CFRunLoopObserverRef glibRunLoopObserver; #endif id<WebGeolocationProvider> _geolocationProvider; + id<WebDeviceOrientationProvider> m_deviceOrientationProvider; } @end diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h index 28348cc..aeb36c7 100644 --- a/WebKit/mac/WebView/WebViewPrivate.h +++ b/WebKit/mac/WebView/WebViewPrivate.h @@ -44,12 +44,14 @@ @class NSError; @class WebFrame; +@class WebDeviceOrientation; @class WebGeolocationPosition; @class WebInspector; @class WebPreferences; @class WebScriptWorld; @class WebTextIterator; +@protocol WebDeviceOrientationProvider; @protocol WebFormDelegate; extern NSString *_WebCanGoBackKey; @@ -605,6 +607,11 @@ Could be worth adding to the API. - (BOOL)_selectionIsAll; @end +@interface WebView (WebViewDeviceOrientation) +- (void)_setDeviceOrientationProvider:(id<WebDeviceOrientationProvider>)deviceOrientationProvider; +- (id<WebDeviceOrientationProvider>)_deviceOrientationProvider; +@end + @protocol WebGeolocationProvider <NSObject> - (void)registerWebView:(WebView *)webView; - (void)unregisterWebView:(WebView *)webView; diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index 81eabfc..464b4a0 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -929,7 +929,7 @@ void QWebFrame::setScrollBarValue(Qt::Orientation orientation, int value) value = 0; else if (value > scrollBarMaximum(orientation)) value = scrollBarMaximum(orientation); - sb->setValue(value); + sb->setValue(value, Scrollbar::NotFromScrollAnimator); } } diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index ec415bb..8bf9208 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -2417,7 +2417,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest & QString QWebPage::selectedText() const { d->createMainFrame(); - return d->page->focusController()->focusedOrMainFrame()->selectedText(); + return d->page->focusController()->focusedOrMainFrame()->editor()->selectedText(); } #ifndef QT_NO_ACTION @@ -2881,7 +2881,7 @@ void QWebPage::setContentEditable(bool editable) if (d->mainFrame) { WebCore::Frame* frame = d->mainFrame->d->frame; if (editable) { - frame->applyEditingStyleToBodyElement(); + frame->editor()->applyEditingStyleToBodyElement(); // FIXME: mac port calls this if there is no selectedDOMRange //frame->setSelectionFromNone(); } diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 996435b..95e79a4 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,134 @@ +2010-09-08 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to Editor as planned + https://bugs.webkit.org/show_bug.cgi?id=45218 + + * Api/qwebpage.cpp: + (QWebPage::selectedText): + (QWebPage::setContentEditable): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::firstRectForCharacterRange): + Changed call sites to use editor(). + +2010-09-08 Peter Kasting <pkasting@google.com> + + Reviewed by David Hyatt. + + Add smooth scrolling framework, and a Windows implementation. + https://bugs.webkit.org/show_bug.cgi?id=32356 + + * Api/qwebframe.cpp: + (QWebFrame::setScrollBarValue): + +2010-09-06 Diego Gonzalez <diegohcg@webkit.org> + + Reviewed by Antonio Gomes. + + [Qt] Update NetworkAccessManager in Qt FrameNetworkingContext + https://bugs.webkit.org/show_bug.cgi?id=45231 + + Make possible to get the current QNAM when NetwokingContext request it. + + * WebCoreSupport/FrameNetworkingContextQt.cpp: + (WebCore::FrameNetworkingContextQt::networkAccessManager): + +2010-09-06 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Antonio Gomes. + + Web Inspector: Tests crash on Qt bots revealed by r66720 + https://bugs.webkit.org/show_bug.cgi?id=45256 + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::InspectorClientQt): m_frontendClient must be initialized by constructor + +2010-09-06 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Attempt to fix random test crashes after r66720. + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorFrontendClientQt::~InspectorFrontendClientQt): + * WebCoreSupport/InspectorClientQt.h: + +2010-09-05 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r66801. + http://trac.webkit.org/changeset/66801 + https://bugs.webkit.org/show_bug.cgi?id=45242 + + 'breaks editing/pasteboard/onpaste-text-html.html' (Requested + by mwenge4 on #webkit). + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::addMessageToConsole): + +2010-09-05 Robert Hogan <robert@webkit.org> + + Reviewed by Antonio Gomes. + + [Qt] utf8 encoding of console() messages + + http/tests/security/xssAuditor/embed-tag-null-char.html + http/tests/security/xssAuditor/object-embed-tag-null-char.html + + both fail because ChromeClientQt::addMessageToConsole() is + casting String to QString rather than String::utf8().data() + + https://bugs.webkit.org/show_bug.cgi?id=45240 + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::addMessageToConsole): + +2010-09-03 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 + + Add Qt's specific implementation of NetworkingContext. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::setFrame): + (WebCore::FrameLoaderClientQt::createNetworkingContext): + * WebCoreSupport/FrameLoaderClientQt.h: + * WebCoreSupport/FrameNetworkingContextQt.cpp: + (WebCore::FrameNetworkingContextQt::FrameNetworkingContextQt): + (WebCore::FrameNetworkingContextQt::create): + (WebCore::FrameNetworkingContextQt::originatingObject): + (WebCore::FrameNetworkingContextQt::networkAccessManager): + +2010-09-02 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + REGRESSION: Crash occurs at objc_msgSend when closing a window that is displaying the web inspector + https://bugs.webkit.org/show_bug.cgi?id=44230 + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::inspectorDestroyed): + (WebCore::InspectorClientQt::openInspectorFrontend): + (WebCore::InspectorClientQt::releaseFrontendPage): + (WebCore::InspectorFrontendClientQt::closeWindow): + (WebCore::InspectorFrontendClientQt::disconnectFromBackend): + (WebCore::InspectorFrontendClientQt::destroyInspectorView): + (WebCore::InspectorFrontendClientQt::inspectorClientDestroyed): + * WebCoreSupport/InspectorClientQt.h: + +2010-09-02 Andreas Kling <andreas.kling@nokia.com> + + Rubber-stamped by Simon Hausmann. + + [Qt] REGRESSION(r62898): tst_QWebFrame crashing + https://bugs.webkit.org/show_bug.cgi?id=43039 + + Rolling out the offending change <http://trac.webkit.org/changeset/62898> + + * tests/qwebframe/tst_qwebframe.cpp: + (tst_QWebFrame::evalJSV): + 2010-09-01 Mahesh Kulkarni <mahesh.kulkarni@nokia.com> Reviewed by Laszlo Gombos. diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 026866c..c1be131 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -489,7 +489,7 @@ QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page, if (!range) return QVariantList(); - QRect resultRect = frame->firstRectForRange(range.get()); + QRect resultRect = frame->editor()->firstRectForRange(range.get()); rect << resultRect.x() << resultRect.y() << resultRect.width() << resultRect.height(); return rect; } diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 59f6ac6..2d73f7f 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -35,6 +35,7 @@ #include "CSSPropertyNames.h" #include "FormState.h" #include "FrameLoaderClientQt.h" +#include "FrameNetworkingContextQt.h" #include "FrameTree.h" #include "FrameView.h" #include "DocumentLoader.h" @@ -204,6 +205,7 @@ void FrameLoaderClientQt::setFrame(QWebFrame* webFrame, Frame* frame) { m_webFrame = webFrame; m_frame = frame; + if (!m_webFrame || !m_webFrame->page()) { qWarning("FrameLoaderClientQt::setFrame frame without Page!"); return; @@ -1519,6 +1521,11 @@ QString FrameLoaderClientQt::chooseFile(const QString& oldFile) return webFrame()->page()->chooseFile(webFrame(), oldFile); } +PassRefPtr<FrameNetworkingContext> FrameLoaderClientQt::createNetworkingContext() +{ + return FrameNetworkingContextQt::create(m_frame, m_webFrame, m_webFrame->page()->networkAccessManager()); +} + } #include "moc_FrameLoaderClientQt.cpp" diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index c72b82f..e506900 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -35,6 +35,7 @@ #include "FrameLoader.h" #include "FrameLoaderClient.h" #include "KURL.h" +#include <wtf/OwnPtr.h> #include "PluginView.h" #include "RefCounted.h" #include "ResourceError.h" @@ -51,6 +52,7 @@ class DocumentLoader; class Element; class FormState; class NavigationAction; +class FrameNetworkingContext; class ResourceLoader; struct LoadErrorResetToken; @@ -213,6 +215,8 @@ public: QString chooseFile(const QString& oldFile); + virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext(); + static bool dumpFrameLoaderCallbacks; static bool dumpResourceLoadCallbacks; static bool dumpResourceResponseMIMETypes; diff --git a/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp b/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp index 941cfaa..b3b0f00 100644 --- a/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp @@ -17,5 +17,37 @@ Boston, MA 02110-1301, USA. */ -// Checking this file in empty to get the build system work out of the way. -// Will put the code in here later. +#include "config.h" + +#include "FrameNetworkingContextQt.h" + +#include <QNetworkAccessManager> +#include <QObject> +#include <QWebFrame> +#include <QWebPage> + +namespace WebCore { + +FrameNetworkingContextQt::FrameNetworkingContextQt(Frame* frame, QObject* originatingObject, QNetworkAccessManager* networkAccessManager) + : FrameNetworkingContext(frame) + , m_originatingObject(originatingObject) + , m_networkAccessManager(networkAccessManager) +{ +} + +PassRefPtr<FrameNetworkingContextQt> FrameNetworkingContextQt::create(Frame* frame, QObject* originatingObject, QNetworkAccessManager* networkAccessManager) +{ + return adoptRef(new FrameNetworkingContextQt(frame, originatingObject, networkAccessManager)); +} + +QObject* FrameNetworkingContextQt::originatingObject() const +{ + return m_originatingObject; +} + +QNetworkAccessManager* FrameNetworkingContextQt::networkAccessManager() const +{ + return (qobject_cast<QWebFrame*>(m_originatingObject))->page()->networkAccessManager(); +} + +} diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index e13f6c3..55aca7f 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -96,10 +96,13 @@ public slots: InspectorClientQt::InspectorClientQt(QWebPage* page) : m_inspectedWebPage(page) , m_frontendWebPage(0) + , m_frontendClient(0) {} void InspectorClientQt::inspectorDestroyed() { + if (m_frontendClient) + m_frontendClient->inspectorClientDestroyed(); delete this; } @@ -131,13 +134,15 @@ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController*) m_inspectedWebPage->d->inspectorFrontend = inspectorView; inspector->d->setFrontend(inspectorView); - inspectorView->page()->d->page->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView, this)); + m_frontendClient = new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView, this); + inspectorView->page()->d->page->inspectorController()->setInspectorFrontendClient(m_frontendClient); m_frontendWebPage = inspectorPage; } void InspectorClientQt::releaseFrontendPage() { m_frontendWebPage = 0; + m_frontendClient = 0; } void InspectorClientQt::highlight(Node*) @@ -250,6 +255,13 @@ InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, { } +InspectorFrontendClientQt::~InspectorFrontendClientQt() +{ + ASSERT(m_destroyingInspectorView); + if (m_inspectorClient) + m_inspectorClient->releaseFrontendPage(); +} + void InspectorFrontendClientQt::frontendLoaded() { InspectorFrontendClientLocal::frontendLoaded(); @@ -275,19 +287,12 @@ void InspectorFrontendClientQt::bringToFront() void InspectorFrontendClientQt::closeWindow() { - if (m_destroyingInspectorView) - return; - m_destroyingInspectorView = true; - - // Clear reference from QWebInspector to the frontend view. - m_inspectedWebPage->d->getOrCreateInspector()->d->setFrontend(0); -#if ENABLE(INSPECTOR) - m_inspectedWebPage->d->inspectorController()->disconnectFrontend(); -#endif - m_inspectorClient->releaseFrontendPage(); + destroyInspectorView(true); +} - // Clear pointer before deleting WebView to avoid recursive calls to its destructor. - OwnPtr<QWebView> inspectorView = m_inspectorView.release(); +void InspectorFrontendClientQt::disconnectFromBackend() +{ + destroyInspectorView(false); } void InspectorFrontendClientQt::attachWindow() @@ -319,6 +324,35 @@ void InspectorFrontendClientQt::updateWindowTitle() } } +void InspectorFrontendClientQt::destroyInspectorView(bool notifyInspectorController) +{ + if (m_destroyingInspectorView) + return; + m_destroyingInspectorView = true; + + // Inspected page may have already been destroyed. + if (m_inspectedWebPage) { + // Clear reference from QWebInspector to the frontend view. + m_inspectedWebPage->d->getOrCreateInspector()->d->setFrontend(0); + } + +#if ENABLE(INSPECTOR) + if (notifyInspectorController) + m_inspectedWebPage->d->inspectorController()->disconnectFrontend(); +#endif + if (m_inspectorClient) + m_inspectorClient->releaseFrontendPage(); + + // Clear pointer before deleting WebView to avoid recursive calls to its destructor. + OwnPtr<QWebView> inspectorView = m_inspectorView.release(); +} + +void InspectorFrontendClientQt::inspectorClientDestroyed() +{ + m_inspectorClient = 0; + m_inspectedWebPage = 0; +} + } #include "InspectorClientQt.moc" diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/WebKit/qt/WebCoreSupport/InspectorClientQt.h index 9526c88..0074159 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.h +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.h @@ -41,6 +41,7 @@ class QWebPage; class QWebView; namespace WebCore { +class InspectorFrontendClientQt; class Node; class Page; @@ -65,11 +66,13 @@ public: private: QWebPage* m_inspectedWebPage; QWebPage* m_frontendWebPage; + InspectorFrontendClientQt* m_frontendClient; }; class InspectorFrontendClientQt : public InspectorFrontendClientLocal { public: InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient); + virtual ~InspectorFrontendClientQt(); virtual void frontendLoaded(); @@ -79,6 +82,7 @@ public: virtual void bringToFront(); virtual void closeWindow(); + virtual void disconnectFromBackend(); virtual void attachWindow(); virtual void detachWindow(); @@ -87,8 +91,11 @@ public: virtual void inspectedURLChanged(const String& newURL); + void inspectorClientDestroyed(); + private: void updateWindowTitle(); + void destroyInspectorView(bool notifyInspectorController); QWebPage* m_inspectedWebPage; OwnPtr<QWebView> m_inspectorView; QString m_inspectedURL; diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 98ce663..2c63739 100644 --- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -38,7 +38,6 @@ #include <qsslerror.h> #endif #include "../util.h" -#include "../WebCoreSupport/DumpRenderTreeSupportQt.h" struct CustomType { QString string; @@ -572,11 +571,9 @@ public slots: void cleanup(); private slots: + void getSetStaticProperty(); void getSetDynamicProperty(); - void getSetDynamicProperty_data(); void getSetChildren(); - void getSetChildren_data(); - void getSetStaticProperty(); void callQtInvokable(); void connectAndDisconnect(); void classEnums(); @@ -674,10 +671,6 @@ private: evalJS("delete retvalue; delete typevalue"); return ret; } - void garbageCollectJS() - { - DumpRenderTreeSupportQt::garbageCollectorCollect(); - } QObject* firstChildByClassName(QObject* parent, const char* className) { const QObjectList & children = parent->children(); foreach (QObject* child, children) { @@ -954,8 +947,6 @@ void tst_QWebFrame::getSetStaticProperty() void tst_QWebFrame::getSetDynamicProperty() { - QFETCH(bool, garbageCollect); - // initially the object does not have the property // In WebKit, RuntimeObjects do not inherit Object, so don't have hasOwnProperty @@ -967,34 +958,11 @@ void tst_QWebFrame::getSetDynamicProperty() //QCOMPARE(evalJS("myObject.hasOwnProperty('dynamicProperty')"), sTrue); QCOMPARE(evalJS("typeof myObject.dynamicProperty != 'undefined'"), sTrue); QCOMPARE(evalJS("myObject.dynamicProperty == 123"), sTrue); - if( garbageCollect ) { - garbageCollectJS(); - QCOMPARE(evalJS("typeof myObject.dynamicProperty != 'undefined'"), sTrue); - } // property change in script should be reflected in C++ QCOMPARE(evalJS("myObject.dynamicProperty = 'foo';" "myObject.dynamicProperty"), QLatin1String("foo")); QCOMPARE(m_myObject->property("dynamicProperty").toString(), QLatin1String("foo")); - if( garbageCollect ) { - garbageCollectJS(); - QCOMPARE(m_myObject->property("dynamicProperty").toString(), QLatin1String("foo")); - } - - // add a dynamic property in C++ to another QObject - QObject* propertyObject = new QObject(m_myObject); - QCOMPARE(m_myObject->setProperty("dynamicObjectProperty", qVariantFromValue(propertyObject)), false); - QCOMPARE(evalJS("typeof myObject.dynamicObjectProperty != 'undefined'"), sTrue); - evalJS("myObject.dynamicObjectProperty.jsProperty = 123"); - QCOMPARE(evalJS("myObject.dynamicObjectProperty.jsProperty == 123"), sTrue); - if( garbageCollect ) { - garbageCollectJS(); - QCOMPARE(evalJS("typeof myObject.dynamicObjectProperty != 'undefined'"), sTrue); - QCOMPARE(evalJS("myObject.dynamicObjectProperty.jsProperty == 123"), sTrue); - } - QCOMPARE(m_myObject->setProperty("dynamicObjectProperty", QVariant()), false); - delete propertyObject; - QCOMPARE(evalJS("typeof myObject.dynamicObjectProperty == 'undefined'"), sTrue); // delete the property (XFAIL - can't delete properties) QEXPECT_FAIL("", "can't delete properties", Continue); @@ -1005,21 +973,10 @@ void tst_QWebFrame::getSetDynamicProperty() // QCOMPARE(evalJS("myObject.hasOwnProperty('dynamicProperty')"), sFalse); QCOMPARE(evalJS("typeof myObject.dynamicProperty"), sUndefined); */ - - evalJS("myObject.dynamicProperty = undefined"); -} - -void tst_QWebFrame::getSetDynamicProperty_data() -{ - QTest::addColumn<bool>("garbageCollect"); - QTest::newRow("with garbageCollect") << true; - QTest::newRow("without garbageCollect") << false; } void tst_QWebFrame::getSetChildren() { - QFETCH(bool, garbageCollect); - // initially the object does not have the child // (again, no hasOwnProperty) @@ -1031,27 +988,12 @@ void tst_QWebFrame::getSetChildren() child->setObjectName("child"); // QCOMPARE(evalJS("myObject.hasOwnProperty('child')"), sTrue); QCOMPARE(evalJS("typeof myObject.child != 'undefined'"), sTrue); - evalJS("myObject.child.jsProperty = 123"); - QCOMPARE(evalJS("myObject.child.jsProperty == 123"), sTrue); - - if( garbageCollect ) { - garbageCollectJS(); - QCOMPARE(evalJS("typeof myObject.child != 'undefined'"), sTrue); - QCOMPARE(evalJS("myObject.child.jsProperty == 123"), sTrue); - } // add a grandchild MyQObject* grandChild = new MyQObject(child); grandChild->setObjectName("grandChild"); // QCOMPARE(evalJS("myObject.child.hasOwnProperty('grandChild')"), sTrue); QCOMPARE(evalJS("typeof myObject.child.grandChild != 'undefined'"), sTrue); - evalJS("myObject.child.grandChild.jsProperty = 123"); - evalJS("myObject.child.grandChild.jsProperty = 123"); - if( garbageCollect ) { - garbageCollectJS(); - QCOMPARE(evalJS("typeof myObject.child.grandChild != 'undefined'"), sTrue); - QCOMPARE(evalJS("myObject.child.grandChild.jsProperty == 123"), sTrue); - } // delete grandchild delete grandChild; @@ -1062,18 +1004,6 @@ void tst_QWebFrame::getSetChildren() delete child; // QCOMPARE(evalJS("myObject.hasOwnProperty('child')"), sFalse); QCOMPARE(evalJS("typeof myObject.child == 'undefined'"), sTrue); - if( garbageCollect ) { - garbageCollectJS(); - QCOMPARE(evalJS("typeof myObject.child == 'undefined'"), sTrue); - } -} - - -void tst_QWebFrame::getSetChildren_data() -{ - QTest::addColumn<bool>("garbageCollect"); - QTest::newRow("with garbageCollect") << true; - QTest::newRow("without garbageCollect") << false; } Q_DECLARE_METATYPE(QVector<int>) @@ -1740,7 +1670,7 @@ void tst_QWebFrame::connectAndDisconnect() m_myObject->emitMySignal(); QCOMPARE(m_myObject->qtFunctionInvoked(), 20); evalJS("myObject = null"); - garbageCollectJS(); + evalJS("gc()"); m_myObject->resetQtFunctionInvoked(); m_myObject->emitMySignal(); QCOMPARE(m_myObject->qtFunctionInvoked(), 20); diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index b3877dc..b7e49cf 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,142 @@ +2010-09-09 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Adam Roben. + + Scrollbars fail to render in composited iframes. + https://bugs.webkit.org/show_bug.cgi?id=45335 + + Use LocalWindowsContext when painting scrollbars. + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::paintCustomScrollbar): + (WebChromeClient::paintCustomScrollCorner): + +2010-09-08 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to Editor as planned + https://bugs.webkit.org/show_bug.cgi?id=45218 + + * WebCoreSupport/WebContextMenuClient.cpp: + (WebContextMenuClient::searchWithGoogle): + * WebFrame.cpp: + (WebFrame::selectedString): + * WebView.cpp: + (WebView::selectedText): + (WebView::prepareCandidateWindow): + (WebView::onIMERequestCharPosition): + Changed call sites to use editor(). + +2010-09-08 Peter Kasting <pkasting@google.com> + + Not reviewed, build fix. + + * WebScrollBar.cpp: + (WebScrollBar::setScrollOffsetFromAnimation): + +2010-09-08 Peter Kasting <pkasting@google.com> + + Not reviewed, build fix. + + * WebScrollBar.cpp: + (WebScrollBar::scrollSize): + (WebScrollBar::setScrollOffsetFromAnimation): + +2010-09-08 Peter Kasting <pkasting@google.com> + + Not reviewed, build fix. + + * WebScrollBar.cpp: + (WebScrollBar::setValue): + (WebScrollBar::scrollSize): + (WebScrollBar::setScrollOffsetFromAnimation): + * WebScrollBar.h: + +2010-09-08 Adam Barth <abarth@webkit.org> + + Attempted Window build fix. + + * WebDataSource.cpp: + (WebDataSource::subresourceForURL): + +2010-09-08 Adam Barth <abarth@webkit.org> + + Rubber-stamped by Eric Seidel. + + Rename DocLoader to CachedResourceLoader because that's what it does. + + * WebDataSource.cpp: + +2010-09-07 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Adam Roben. + + Clean up a potential resource leak. + https://bugs.webkit.org/show_bug.cgi?id=45198 + + Several bitmap device context were being created and used, + and destroyed without returning the context to its original + state. This showed up as bitmap leaks in BoundsChecker. + + * FullscreenVideoController.cpp: + * WebView.cpp: + (WebView::scrollBackingStore): + (WebView::paint): + +2010-09-06 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Rename SecurityOrigin::canLoad to canDisplay + https://bugs.webkit.org/show_bug.cgi?id=45214 + + Propagate name change. + + * WebFrame.cpp: + (WebFrame::allowsFollowingLink): + +2010-09-03 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 + + Add Win's specific implementation of NetworkingContext. + + * WebCoreSupport/WebFrameNetworkingContext.cpp: + (WebFrameNetworkingContext::create): + (WebFrameNetworkingContext::userAgent): + (WebFrameNetworkingContext::referrer): + * WebFrame.cpp: + (WebFrame::createNetworkingContext): + * WebFrame.h: + +2010-09-03 Adam Roben <aroben@apple.com> + + Attempt to fixing Windows nightlies again + + The fix in r66438 should be sufficient, but we have to touch + WebKit.idl to force that change to be picked up by the build. + + * Interfaces/WebKit.idl: Touched this file to force a build. + +2010-09-02 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by PavelFeldman. + + REGRESSION: Crash occurs at objc_msgSend when closing a window that is displaying the web inspector + https://bugs.webkit.org/show_bug.cgi?id=44230 + + * WebCoreSupport/WebInspectorClient.cpp: + (WebInspectorFrontendClient::~WebInspectorFrontendClient): + (WebInspectorFrontendClient::closeWindow): + (WebInspectorFrontendClient::disconnectFromBackend): + (WebInspectorFrontendClient::closeWindowWithoutNotifications): + (WebInspectorFrontendClient::destroyInspectorView): + * WebCoreSupport/WebInspectorClient.h: + 2010-09-01 Jessie Berlin <jberlin@apple.com> Reviewed by Adam Roben. diff --git a/WebKit/win/FullscreenVideoController.cpp b/WebKit/win/FullscreenVideoController.cpp index 3aeb1ba..4b50889 100644 --- a/WebKit/win/FullscreenVideoController.cpp +++ b/WebKit/win/FullscreenVideoController.cpp @@ -476,7 +476,7 @@ void FullscreenVideoController::draw() HDC windowDC = GetDC(m_hudWindow); HDC bitmapDC = CreateCompatibleDC(windowDC); ::ReleaseDC(m_hudWindow, windowDC); - SelectObject(bitmapDC, m_bitmap.get()); + HGDIOBJ oldBitmap = SelectObject(bitmapDC, m_bitmap.get()); GraphicsContext context(bitmapDC, true); @@ -543,6 +543,7 @@ void FullscreenVideoController::draw() context.restore(); + ::SelectObject(bitmapDC, oldBitmap); ::DeleteDC(bitmapDC); } diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl index d25cdfe..98f5da8 100644 --- a/WebKit/win/Interfaces/WebKit.idl +++ b/WebKit/win/Interfaces/WebKit.idl @@ -300,3 +300,4 @@ library WebKit [default] interface IWebUserContentURLPattern; } } + diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp index d5aea25..7a025a7 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.cpp +++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp @@ -53,6 +53,7 @@ #endif #include <WebCore/HTMLNames.h> #include <WebCore/Icon.h> +#include <WebCore/LocalWindowsContext.h> #include <WebCore/LocalizedStrings.h> #include <WebCore/NotImplemented.h> #include <WebCore/Page.h> @@ -705,10 +706,9 @@ bool WebChromeClient::paintCustomScrollbar(GraphicsContext* context, const Float webState |= WebPressedScrollbarState; RECT webRect = enclosingIntRect(rect); - HDC hDC = context->getWindowsContext(webRect); - HRESULT hr = delegate->paintCustomScrollbar(m_webView, hDC, webRect, webSize, webState, webPressedPart, + LocalWindowsContext windowsContext(context, webRect); + HRESULT hr = delegate->paintCustomScrollbar(m_webView, windowsContext.hdc(), webRect, webSize, webState, webPressedPart, vertical, value, proportion, webParts); - context->releaseWindowsContext(hDC, webRect); return SUCCEEDED(hr); } @@ -722,9 +722,8 @@ bool WebChromeClient::paintCustomScrollCorner(GraphicsContext* context, const Fl return false; RECT webRect = enclosingIntRect(rect); - HDC hDC = context->getWindowsContext(webRect); - HRESULT hr = delegate->paintCustomScrollCorner(m_webView, hDC, webRect); - context->releaseWindowsContext(hDC, webRect); + LocalWindowsContext windowsContext(context, webRect); + HRESULT hr = delegate->paintCustomScrollCorner(m_webView, windowsContext.hdc(), webRect); return SUCCEEDED(hr); } diff --git a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp index 078b725..ca0374a 100644 --- a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp +++ b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp @@ -131,7 +131,7 @@ void WebContextMenuClient::downloadURL(const KURL& url) void WebContextMenuClient::searchWithGoogle(const Frame* frame) { - String searchString = frame->selectedText(); + String searchString = frame->editor()->selectedText(); searchString.stripWhiteSpace(); String encoded = encodeWithURLEscapeSequences(searchString); encoded.replace("%20", "+"); diff --git a/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp b/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp index 941cfaa..9fcd4b1 100644 --- a/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp +++ b/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp @@ -17,5 +17,23 @@ Boston, MA 02110-1301, USA. */ -// Checking this file in empty to get the build system work out of the way. -// Will put the code in here later. +#include "config.h" + +#include "WebFrameNetworkingContext.h" + +using namespace WebCore; + +PassRefPtr<WebFrameNetworkingContext> WebFrameNetworkingContext::create(Frame* frame, const String& userAgent) +{ + return adoptRef(new WebFrameNetworkingContext(frame, userAgent)); +} + +String WebFrameNetworkingContext::userAgent() const +{ + return m_userAgent; +} + +String WebFrameNetworkingContext::referrer() const +{ + return frame()->loader()->referrer(); +} diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp index 34fb827..1b79dde 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp @@ -228,7 +228,7 @@ WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView WebInspectorFrontendClient::~WebInspectorFrontendClient() { - destroyInspectorView(); + destroyInspectorView(true); } void WebInspectorFrontendClient::frontendLoaded() @@ -260,7 +260,12 @@ void WebInspectorFrontendClient::bringToFront() void WebInspectorFrontendClient::closeWindow() { - destroyInspectorView(); + destroyInspectorView(true); +} + +void WebInspectorFrontendClient::disconnectFromBackend() +{ + destroyInspectorView(false); } void WebInspectorFrontendClient::attachWindow() @@ -344,8 +349,6 @@ void WebInspectorFrontendClient::closeWindowWithoutNotifications() HWND hostWindow; if (SUCCEEDED(m_inspectedWebView->hostWindow((OLE_HANDLE*)&hostWindow))) SendMessage(hostWindow, WM_SIZE, 0, 0); - - m_inspectorClient->updateHighlight(); } void WebInspectorFrontendClient::showWindowWithoutNotifications() @@ -397,16 +400,20 @@ void WebInspectorFrontendClient::showWindowWithoutNotifications() m_inspectorClient->updateHighlight(); } -void WebInspectorFrontendClient::destroyInspectorView() +void WebInspectorFrontendClient::destroyInspectorView(bool notifyInspectorController) { if (m_destroyingInspectorView) return; m_destroyingInspectorView = true; - m_inspectedWebView->page()->inspectorController()->disconnectFrontend(); closeWindowWithoutNotifications(); - m_inspectorClient->frontendClosing(); + + if (notifyInspectorController) { + m_inspectedWebView->page()->inspectorController()->disconnectFrontend(); + m_inspectorClient->updateHighlight(); + m_inspectorClient->frontendClosing(); + } ::DestroyWindow(m_frontendHwnd); } diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.h b/WebKit/win/WebCoreSupport/WebInspectorClient.h index 4da3984..0c38247 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.h +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.h @@ -93,6 +93,7 @@ public: virtual void bringToFront(); virtual void closeWindow(); + virtual void disconnectFromBackend(); virtual void attachWindow(); virtual void detachWindow(); @@ -106,7 +107,7 @@ private: void closeWindowWithoutNotifications(); void showWindowWithoutNotifications(); - void destroyInspectorView(); + void destroyInspectorView(bool notifyInspectorController); void updateWindowTitle(); diff --git a/WebKit/win/WebDataSource.cpp b/WebKit/win/WebDataSource.cpp index 566f174..0350373 100644 --- a/WebKit/win/WebDataSource.cpp +++ b/WebKit/win/WebDataSource.cpp @@ -39,7 +39,7 @@ #include "WebResource.h" #include "WebURLResponse.h" #include <WebCore/BString.h> -#include <WebCore/DocLoader.h> +#include <WebCore/CachedResourceLoader.h> #include <WebCore/Document.h> #include <WebCore/Frame.h> #include <WebCore/FrameLoader.h> @@ -297,7 +297,7 @@ HRESULT STDMETHODCALLTYPE WebDataSource::subresourceForURL( if (!doc) return E_FAIL; - CachedResource *cachedResource = doc->docLoader()->cachedResource(String(url)); + CachedResource *cachedResource = doc->cachedResourceLoader()->cachedResource(String(url)); if (!cachedResource) return E_FAIL; diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp index d12989b..014ea15 100644 --- a/WebKit/win/WebFrame.cpp +++ b/WebKit/win/WebFrame.cpp @@ -42,6 +42,7 @@ #include "WebDownload.h" #include "WebEditorClient.h" #include "WebError.h" +#include "WebFrameNetworkingContext.h" #include "WebFramePolicyListener.h" #include "WebHistory.h" #include "WebHistoryItem.h" @@ -1044,7 +1045,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::selectedString( if (!coreFrame) return E_FAIL; - String text = coreFrame->displayStringModifiedByEncoding(coreFrame->selectedText()); + String text = coreFrame->displayStringModifiedByEncoding(coreFrame->editor()->selectedText()); *result = BString(text).release(); return S_OK; @@ -1352,7 +1353,7 @@ HRESULT WebFrame::allowsFollowingLink(BSTR url, BOOL* result) if (!frame) return E_FAIL; - *result = SecurityOrigin::canLoad(MarshallingHelpers::BSTRToKURL(url), String(), frame->document()); + *result = SecurityOrigin::canDisplay(MarshallingHelpers::BSTRToKURL(url), String(), frame->document()); return S_OK; } @@ -2614,3 +2615,7 @@ void WebFrame::updateBackground() coreFrame->view()->updateBackgroundRecursively(backgroundColor, webView()->transparent()); } +PassRefPtr<FrameNetworkingContext> WebFrame::createNetworkingContext() +{ + return WebFrameNetworkingContext::create(core(this), userAgent(url())); +} diff --git a/WebKit/win/WebFrame.h b/WebKit/win/WebFrame.h index 24a7e2b..f4795c8 100644 --- a/WebKit/win/WebFrame.h +++ b/WebKit/win/WebFrame.h @@ -343,6 +343,8 @@ public: virtual void registerForIconNotification(bool listen); + virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); + // WebFrame PassRefPtr<WebCore::Frame> init(IWebView*, WebCore::Page*, WebCore::HTMLFrameOwnerElement*); WebCore::Frame* impl(); diff --git a/WebKit/win/WebScrollBar.cpp b/WebKit/win/WebScrollBar.cpp index ccf40d9..8613c1c 100644 --- a/WebKit/win/WebScrollBar.cpp +++ b/WebKit/win/WebScrollBar.cpp @@ -143,7 +143,7 @@ HRESULT STDMETHODCALLTYPE WebScrollBar::setRect( HRESULT STDMETHODCALLTYPE WebScrollBar::setValue( /* [in] */ int value) { - m_scrollBar->setValue(value); + m_scrollBar->setValue(value, Scrollbar::NotFromScrollAnimator); return S_OK; } @@ -252,6 +252,16 @@ HRESULT STDMETHODCALLTYPE WebScrollBar::scroll( } // ScrollbarClient ------------------------------------------------------- +int WebScrollBar::scrollSize(ScrollbarOrientation orientation) const +{ + return (orientation == m_scrollBar->orientation()) ? (m_scrollBar->totalSize() - m_scrollBar->visibleSize()) : 0; +} + +void WebScrollBar::setScrollOffsetFromAnimation(const IntPoint& offset) +{ + m_scrollBar->setValue((m_scrollBar->orientation() == HorizontalScrollbar) ? offset.x() : offset.y(), Scrollbar::FromScrollAnimator); +} + void WebScrollBar::valueChanged(Scrollbar* scrollBar) { if (m_scrollBar != scrollBar) { diff --git a/WebKit/win/WebScrollBar.h b/WebKit/win/WebScrollBar.h index 0fed8a3..90f2491 100644 --- a/WebKit/win/WebScrollBar.h +++ b/WebKit/win/WebScrollBar.h @@ -116,6 +116,8 @@ public: protected: // ScrollbarClient + virtual int scrollSize(ScrollbarOrientation orientation) const; + virtual void setScrollOffsetFromAnimation(const IntPoint&); virtual void valueChanged(Scrollbar*); virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp index 5aa4fc4..0a1e334 100644 --- a/WebKit/win/WebView.cpp +++ b/WebKit/win/WebView.cpp @@ -826,7 +826,7 @@ void WebView::scrollBackingStore(FrameView* frameView, int dx, int dy, const Int // Collect our device context info and select the bitmap to scroll. HDC windowDC = ::GetDC(m_viewWindow); HDC bitmapDC = ::CreateCompatibleDC(windowDC); - ::SelectObject(bitmapDC, m_backingStoreBitmap->handle()); + HGDIOBJ oldBitmap = ::SelectObject(bitmapDC, m_backingStoreBitmap->handle()); // Scroll the bitmap. RECT scrollRectWin(scrollViewRect); @@ -848,6 +848,7 @@ void WebView::scrollBackingStore(FrameView* frameView, int dx, int dy, const Int updateBackingStore(frameView, bitmapDC, false); // Clean up. + ::SelectObject(bitmapDC, oldBitmap); ::DeleteDC(bitmapDC); ::ReleaseDC(m_viewWindow, windowDC); } @@ -987,7 +988,7 @@ void WebView::paint(HDC dc, LPARAM options) m_paintCount++; HDC bitmapDC = ::CreateCompatibleDC(hdc); - ::SelectObject(bitmapDC, m_backingStoreBitmap->handle()); + HGDIOBJ oldBitmap = ::SelectObject(bitmapDC, m_backingStoreBitmap->handle()); // Update our backing store if needed. updateBackingStore(frameView, bitmapDC, backingStoreCompletelyDirty, windowsToPaint); @@ -1012,6 +1013,7 @@ void WebView::paint(HDC dc, LPARAM options) updateRootLayerContents(); #endif + ::SelectObject(bitmapDC, oldBitmap); ::DeleteDC(bitmapDC); if (!dc) @@ -3545,7 +3547,7 @@ HRESULT STDMETHODCALLTYPE WebView::selectedText( if (!focusedFrame) return E_FAIL; - String frameSelectedText = focusedFrame->selectedText(); + String frameSelectedText = focusedFrame->editor()->selectedText(); *text = SysAllocStringLen(frameSelectedText.characters(), frameSelectedText.length()); if (!*text && frameSelectedText.length()) return E_OUTOFMEMORY; @@ -5265,7 +5267,7 @@ void WebView::prepareCandidateWindow(Frame* targetFrame, HIMC hInputContext) if (RefPtr<Range> range = targetFrame->selection()->selection().toNormalizedRange()) { ExceptionCode ec = 0; RefPtr<Range> tempRange = range->cloneRange(ec); - caret = targetFrame->firstRectForRange(tempRange.get()); + caret = targetFrame->editor()->firstRectForRange(tempRange.get()); } caret = targetFrame->view()->contentsToWindow(caret); CANDIDATEFORM form; @@ -5536,7 +5538,7 @@ LRESULT WebView::onIMERequestCharPosition(Frame* targetFrame, IMECHARPOSITION* c ExceptionCode ec = 0; RefPtr<Range> tempRange = range->cloneRange(ec); tempRange->setStart(tempRange->startContainer(ec), tempRange->startOffset(ec) + charPos->dwCharPos, ec); - caret = targetFrame->firstRectForRange(tempRange.get()); + caret = targetFrame->editor()->firstRectForRange(tempRange.get()); } caret = targetFrame->view()->contentsToWindow(caret); charPos->pt.x = caret.x(); diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index 757981f..8edf46f 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,14 @@ +2010-09-08 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to Editor as planned + https://bugs.webkit.org/show_bug.cgi?id=45218 + + * WebFrame.cpp: + (wxWebFrame::FindString): + Changed call sites to use editor(). + 2010-08-31 Dave Hyatt <hyatt@apple.com> Reviewed by Sam Weinig. diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp index fe45eea..3a556d5 100644 --- a/WebKit/wx/WebFrame.cpp +++ b/WebKit/wx/WebFrame.cpp @@ -273,7 +273,7 @@ wxString wxWebFrame::GetEditCommandValue(const wxString& command) const bool wxWebFrame::FindString(const wxString& string, bool forward, bool caseSensitive, bool wrapSelection, bool startInSelection) { if (m_impl->frame) - return m_impl->frame->findString(string, forward, caseSensitive, wrapSelection, startInSelection); + return m_impl->frame->editor()->findString(string, forward, caseSensitive, wrapSelection, startInSelection); return false; } |