diff options
author | Ben Murdoch <benm@google.com> | 2010-05-11 18:35:50 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-05-14 10:23:05 +0100 |
commit | 21939df44de1705786c545cd1bf519d47250322d (patch) | |
tree | ef56c310f5c0cdc379c2abb2e212308a3281ce20 /WebKit/chromium/src | |
parent | 4ff1d8891d520763f17675827154340c7c740f90 (diff) | |
download | external_webkit-21939df44de1705786c545cd1bf519d47250322d.zip external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.gz external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.bz2 |
Merge Webkit at r58956: Initial merge by Git.
Change-Id: I1d9fb60ea2c3f2ddc04c17a871acdb39353be228
Diffstat (limited to 'WebKit/chromium/src')
47 files changed, 429 insertions, 287 deletions
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index c7acab5..74f0bd8 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -74,6 +74,7 @@ #include "WebURLRequest.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include "WebWindowFeatures.h" #include "WindowFeatures.h" #include "WrappedResourceRequest.h" @@ -233,7 +234,7 @@ Page* ChromeClientImpl::createWindow( return 0; WebViewImpl* newView = static_cast<WebViewImpl*>( - m_webView->client()->createView(WebFrameImpl::fromFrame(frame))); + m_webView->client()->createView(WebFrameImpl::fromFrame(frame), features)); if (!newView) return 0; @@ -622,15 +623,11 @@ void ChromeClientImpl::popupOpened(PopupContainer* popupContainer, } else { webwidget = m_webView->client()->createPopupMenu( convertPopupType(popupContainer->popupType())); - // Try the deprecated methods. - // FIXME: Remove the deprecated methods once the Chromium side use the - // new method. - if (!webwidget) - webwidget = m_webView->client()->createPopupMenu(); - if (!webwidget) - webwidget = m_webView->client()->createPopupMenu(false); + // We only notify when the WebView has to handle the popup, as when + // the popup is handled externally, the fact that a popup is showing is + // transparent to the WebView. + m_webView->popupOpened(popupContainer); } - m_webView->popupOpened(popupContainer); static_cast<WebPopupMenuImpl*>(webwidget)->Init(popupContainer, bounds); } diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index cffd166..a0e8d3b 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -40,6 +40,7 @@ #include "WebCookieJar.h" #include "WebCursorInfo.h" #include "WebData.h" +#include "WebFileSystem.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" #include "WebImage.h" @@ -270,63 +271,118 @@ void ChromiumBridge::prefetchDNS(const String& hostname) bool ChromiumBridge::fileExists(const String& path) { + if (webKitClient()->fileSystem()) + return webKitClient()->fileSystem()->fileExists(path); return webKitClient()->fileExists(path); } bool ChromiumBridge::deleteFile(const String& path) { + if (webKitClient()->fileSystem()) + return webKitClient()->fileSystem()->deleteFile(path); return webKitClient()->deleteFile(path); } bool ChromiumBridge::deleteEmptyDirectory(const String& path) { + if (webKitClient()->fileSystem()) + return webKitClient()->fileSystem()->deleteEmptyDirectory(path); return webKitClient()->deleteEmptyDirectory(path); } bool ChromiumBridge::getFileSize(const String& path, long long& result) { + if (webKitClient()->fileSystem()) + return webKitClient()->fileSystem()->getFileSize(path, result); return webKitClient()->getFileSize(path, result); } bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result) { double modificationTime; - if (!webKitClient()->getFileModificationTime(path, modificationTime)) - return false; + if (webKitClient()->fileSystem()) { + if (!webKitClient()->fileSystem()->getFileModificationTime(path, modificationTime)) + return false; + } else { + if (!webKitClient()->getFileModificationTime(path, modificationTime)) + return false; + } result = static_cast<time_t>(modificationTime); return true; } String ChromiumBridge::directoryName(const String& path) { + if (webKitClient()->fileSystem()) + return webKitClient()->fileSystem()->directoryName(path); return webKitClient()->directoryName(path); } String ChromiumBridge::pathByAppendingComponent(const String& path, const String& component) { + if (webKitClient()->fileSystem()) + return webKitClient()->fileSystem()->pathByAppendingComponent(path, component); return webKitClient()->pathByAppendingComponent(path, component); } bool ChromiumBridge::makeAllDirectories(const String& path) { + if (webKitClient()->fileSystem()) + return webKitClient()->fileSystem()->makeAllDirectories(path); return webKitClient()->makeAllDirectories(path); } String ChromiumBridge::getAbsolutePath(const String& path) { + if (webKitClient()->fileSystem()) + return webKitClient()->fileSystem()->getAbsolutePath(path); return webKitClient()->getAbsolutePath(path); } bool ChromiumBridge::isDirectory(const String& path) { + if (webKitClient()->fileSystem()) + return webKitClient()->fileSystem()->isDirectory(path); return webKitClient()->isDirectory(path); } KURL ChromiumBridge::filePathToURL(const String& path) { + if (webKitClient()->fileSystem()) + return webKitClient()->fileSystem()->filePathToURL(path); return webKitClient()->filePathToURL(path); } +PlatformFileHandle ChromiumBridge::openFile(const String& path, FileOpenMode mode) +{ + return webKitClient()->fileSystem()->openFile(path, mode); +} + +void ChromiumBridge::closeFile(PlatformFileHandle& handle) +{ + webKitClient()->fileSystem()->closeFile(handle); +} + +long long ChromiumBridge::seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) +{ + return webKitClient()->fileSystem()->seekFile(handle, offset, origin); +} + +bool ChromiumBridge::truncateFile(PlatformFileHandle handle, long long offset) +{ + return webKitClient()->fileSystem()->truncateFile(handle, offset); +} + +int ChromiumBridge::readFromFile(PlatformFileHandle handle, char* data, int length) +{ + return webKitClient()->fileSystem()->readFromFile(handle, data, length); +} + +int ChromiumBridge::writeToFile(PlatformFileHandle handle, const char* data, int length) +{ + return webKitClient()->fileSystem()->writeToFile(handle, data, length); +} + // Font ----------------------------------------------------------------------- #if OS(WINDOWS) diff --git a/WebKit/chromium/src/ChromiumThreading.cpp b/WebKit/chromium/src/ChromiumThreading.cpp index 902a433..c6fefac 100644 --- a/WebKit/chromium/src/ChromiumThreading.cpp +++ b/WebKit/chromium/src/ChromiumThreading.cpp @@ -38,13 +38,9 @@ namespace WTF { -void ChromiumThreading::initializeMainThread() +void ChromiumThreading::callOnMainThread(void (*func)(void*), void* context) { -} - -void ChromiumThreading::scheduleDispatchFunctionsOnMainThread() -{ - WebKit::webKitClient()->callOnMainThread(&WTF::dispatchFunctionsFromMainThread); + WebKit::webKitClient()->callOnMainThread(func, context); } } // namespace WTF diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 135392b..17d9416 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -628,14 +628,9 @@ void FrameLoaderClientImpl::dispatchDidNavigateWithinPage() bool isNewNavigation; webView->didCommitLoad(&isNewNavigation); - if (m_webFrame->client()) { + if (m_webFrame->client()) m_webFrame->client()->didNavigateWithinPage(m_webFrame, isNewNavigation); - // FIXME: Remove this notification once it is no longer consumed downstream. - if (isHashChange) - m_webFrame->client()->didChangeLocationWithinPage(m_webFrame, isNewNavigation); - } - // Generate didStopLoading if loader is completed. if (webView->client() && loaderCompleted) webView->client()->didStopLoading(); @@ -726,6 +721,12 @@ void FrameLoaderClientImpl::dispatchDidReceiveTitle(const String& title) m_webFrame->client()->didReceiveTitle(m_webFrame, title); } +void FrameLoaderClientImpl::dispatchDidChangeIcons() +{ + if (m_webFrame->client()) + m_webFrame->client()->didChangeIcons(m_webFrame); +} + void FrameLoaderClientImpl::dispatchDidCommitLoad() { WebViewImpl* webview = m_webFrame->viewImpl(); @@ -788,12 +789,14 @@ void FrameLoaderClientImpl::dispatchDidFinishLoad() void FrameLoaderClientImpl::dispatchDidFirstLayout() { + if (m_webFrame->client()) + m_webFrame->client()->didFirstLayout(m_webFrame); } void FrameLoaderClientImpl::dispatchDidFirstVisuallyNonEmptyLayout() { - // FIXME: called when webkit finished layout of a page that was visually non-empty. - // All resources have not necessarily finished loading. + if (m_webFrame->client()) + m_webFrame->client()->didFirstVisuallyNonEmptyLayout(m_webFrame); } Frame* FrameLoaderClientImpl::dispatchCreatePage() @@ -949,6 +952,12 @@ void FrameLoaderClientImpl::dispatchUnableToImplementPolicy(const ResourceError& m_webFrame->client()->unableToImplementPolicyWithError(m_webFrame, error); } +void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(HTMLFormElement* form) +{ + if (m_webFrame->client()) + m_webFrame->client()->willSendSubmitEvent(m_webFrame, WebFormElement(form)); +} + void FrameLoaderClientImpl::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState) { diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h index 1cbc1de..c163f62 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -102,6 +102,7 @@ public: virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); virtual void dispatchDidReceiveTitle(const WebCore::String& title); + virtual void dispatchDidChangeIcons(); virtual void dispatchDidCommitLoad(); virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); virtual void dispatchDidFailLoad(const WebCore::ResourceError&); @@ -116,6 +117,7 @@ public: virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state); virtual void cancelPolicyCheck(); virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); + virtual void dispatchWillSendSubmitEvent(WebCore::HTMLFormElement*); virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, PassRefPtr<WebCore::FormState>); virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*); virtual void revertToProvisionalState(WebCore::DocumentLoader*); diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index 0f9c959..e51f433 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -111,6 +111,8 @@ public: void beginPaint(WebGLRenderingContext* context); void endPaint(); + bool isGLES2Compliant() const; + //---------------------------------------------------------------------- // Entry points for WebGL. // @@ -617,6 +619,11 @@ rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 DELEGATE_TO_IMPL_R(makeContextCurrent, bool) DELEGATE_TO_IMPL_1R(sizeInBytes, int, int) +bool GraphicsContext3DInternal::isGLES2Compliant() const +{ + return m_impl->isGLES2Compliant(); +} + DELEGATE_TO_IMPL_1(activeTexture, unsigned long) DELEGATE_TO_IMPL_2_X12(attachShader, WebGLProgram*, WebGLShader*) @@ -1202,41 +1209,10 @@ DELEGATE_TO_INTERNAL_3(stencilOp, unsigned long, unsigned long, unsigned long) DELEGATE_TO_INTERNAL_4(stencilOpSeparate, unsigned long, unsigned long, unsigned long, unsigned long) DELEGATE_TO_INTERNAL_9R(texImage2D, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, void*, int) - -int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image, - bool flipY, bool premultiplyAlpha) -{ - Vector<uint8_t> imageData; - unsigned int format, internalFormat; - if (!extractImageData(image, flipY, premultiplyAlpha, imageData, &format, &internalFormat)) - return -1; - return m_internal->texImage2D(target, level, internalFormat, - image->width(), image->height(), 0, - format, UNSIGNED_BYTE, imageData.data()); -} - DELEGATE_TO_INTERNAL_3(texParameterf, unsigned, unsigned, float) DELEGATE_TO_INTERNAL_3(texParameteri, unsigned, unsigned, int) - DELEGATE_TO_INTERNAL_9R(texSubImage2D, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, void*, int) -int GraphicsContext3D::texSubImage2D(unsigned target, - unsigned level, - unsigned xoffset, - unsigned yoffset, - Image* image, - bool flipY, - bool premultiplyAlpha) -{ - Vector<uint8_t> imageData; - unsigned int format, internalFormat; - if (!extractImageData(image, flipY, premultiplyAlpha, imageData, &format, &internalFormat)) - return -1; - return m_internal->texSubImage2D(target, level, xoffset, yoffset, - image->width(), image->height(), - format, UNSIGNED_BYTE, imageData.data()); -} - DELEGATE_TO_INTERNAL_2(uniform1f, long, float) DELEGATE_TO_INTERNAL_3(uniform1fv, long, float*, int) DELEGATE_TO_INTERNAL_2(uniform1i, long, int) @@ -1291,6 +1267,11 @@ DELEGATE_TO_INTERNAL_1(deleteTexture, unsigned) DELEGATE_TO_INTERNAL_1(synthesizeGLError, unsigned long) +bool GraphicsContext3D::isGLES2Compliant() const +{ + return m_internal->isGLES2Compliant(); +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebKit/chromium/src/SharedWorkerRepository.cpp b/WebKit/chromium/src/SharedWorkerRepository.cpp index f0a8ec8..a2b513f 100644 --- a/WebKit/chromium/src/SharedWorkerRepository.cpp +++ b/WebKit/chromium/src/SharedWorkerRepository.cpp @@ -70,6 +70,7 @@ public: , m_name(name) , m_webWorker(webWorker) , m_port(port) + , m_scriptLoader(ResourceRequestBase::TargetIsSharedWorker) , m_loading(false) { } diff --git a/WebKit/chromium/src/StorageAreaProxy.cpp b/WebKit/chromium/src/StorageAreaProxy.cpp index 0e44250..5311b65 100644 --- a/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/WebKit/chromium/src/StorageAreaProxy.cpp @@ -125,8 +125,12 @@ void StorageAreaProxy::storageEvent(const String& key, const String& oldValue, c frames.append(frame); } - for (unsigned i = 0; i < frames.size(); ++i) - frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->sessionStorage())); + for (unsigned i = 0; i < frames.size(); ++i) { + ExceptionCode ec = 0; + Storage* storage = frames[i]->domWindow()->sessionStorage(ec); + if (!ec) + frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage)); + } } else { // Send events to every page. const HashSet<Page*>& pages = page->group().pages(); diff --git a/WebKit/chromium/src/StorageEventDispatcherImpl.cpp b/WebKit/chromium/src/StorageEventDispatcherImpl.cpp index ae25d44..631753b 100644 --- a/WebKit/chromium/src/StorageEventDispatcherImpl.cpp +++ b/WebKit/chromium/src/StorageEventDispatcherImpl.cpp @@ -71,13 +71,11 @@ void StorageEventDispatcherImpl::dispatchStorageEvent(const String& key, const S } } - // FIXME: Figure out how to pass in the document URI. for (unsigned i = 0; i < frames.size(); ++i) { ExceptionCode ec = 0; Storage* storage = frames[i]->domWindow()->localStorage(ec); if (!ec) - frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, - url, storage)); + frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, storage)); } } diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp b/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp index aaf9036..dd7d9b8 100644 --- a/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp +++ b/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp @@ -156,11 +156,9 @@ void SuggestionsPopupMenuClient::initialize(HTMLInputElement* textField, FontDescription fontDescription; RenderTheme::defaultTheme()->systemFont(CSSValueWebkitControl, fontDescription); + RenderStyle* style = m_textField->computedStyle(); + fontDescription.setComputedSize(style->fontDescription().computedSize()); - // Use a smaller font size to match IE/Firefox. - // FIXME: http://crbug.com/7376 use the system size instead of a - // fixed font size value. - fontDescription.setComputedSize(12.0); Font font(fontDescription, 0, 0); font.update(textField->document()->styleSelector()->fontSelector()); // The direction of text in popup menu is set the same as the direction of diff --git a/WebKit/chromium/src/WebElement.cpp b/WebKit/chromium/src/WebElement.cpp index 3ed16e6..25a396e 100644 --- a/WebKit/chromium/src/WebElement.cpp +++ b/WebKit/chromium/src/WebElement.cpp @@ -32,6 +32,8 @@ #include "WebElement.h" #include "Element.h" +#include "RenderBoxModelObject.h" +#include "RenderObject.h" #include <wtf/PassRefPtr.h> using namespace WebCore; diff --git a/WebKit/chromium/src/WebFormElement.cpp b/WebKit/chromium/src/WebFormElement.cpp index 610c36d..7952479 100644 --- a/WebKit/chromium/src/WebFormElement.cpp +++ b/WebKit/chromium/src/WebFormElement.cpp @@ -78,18 +78,6 @@ void WebFormElement::getNamedElements(const WebString& name, result.assign(tempVector); } -void WebFormElement::getInputElements(WebVector<WebInputElement>& result) const -{ - const HTMLFormElement* form = constUnwrap<HTMLFormElement>(); - Vector<RefPtr<HTMLInputElement> > tempVector; - for (size_t i = 0; i < form->formElements.size(); i++) { - if (form->formElements[i]->hasLocalName(HTMLNames::inputTag)) - tempVector.append(static_cast<HTMLInputElement*>( - form->formElements[i])); - } - result.assign(tempVector); -} - void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& result) const { const HTMLFormElement* form = constUnwrap<HTMLFormElement>(); diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp index 2ff1c11..52bc645 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp @@ -464,6 +464,11 @@ int WebGraphicsContext3DDefaultImpl::sizeInBytes(int type) return 0; } +bool WebGraphicsContext3DDefaultImpl::isGLES2Compliant() +{ + return false; +} + static int createTextureObject(GLenum target) { GLuint texture = 0; @@ -1050,7 +1055,23 @@ void WebGraphicsContext3DDefaultImpl::getFramebufferAttachmentParameteriv(unsign glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, value); } -DELEGATE_TO_GL_2(getIntegerv, GetIntegerv, unsigned long, int*) +void WebGraphicsContext3DDefaultImpl::getIntegerv(unsigned long pname, int* value) +{ + // Need to emulate IMPLEMENTATION_COLOR_READ_FORMAT/TYPE for GL. Any valid + // combination should work, but GL_RGB/GL_UNSIGNED_BYTE might be the most + // useful for desktop WebGL users. + makeContextCurrent(); + switch (pname) { + case 0x8B9B: // IMPLEMENTATION_COLOR_READ_FORMAT + *value = GL_RGB; + break; + case 0x8B9A: // IMPLEMENTATION_COLOR_READ_TYPE + *value = GL_UNSIGNED_BYTE; + break; + default: + glGetIntegerv(pname, value); + } +} DELEGATE_TO_GL_3(getProgramiv, GetProgramiv, WebGLId, unsigned long, int*) diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h index cc283e3..2518a37 100644 --- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h +++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h @@ -75,6 +75,8 @@ public: virtual int sizeInBytes(int type); + virtual bool isGLES2Compliant(); + virtual void reshape(int width, int height); virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize); diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp index 1eab91f..2f65ad2 100644 --- a/WebKit/chromium/src/WebInputElement.cpp +++ b/WebKit/chromium/src/WebInputElement.cpp @@ -94,24 +94,6 @@ void WebInputElement::setSelectionRange(int start, int end) { unwrap<HTMLInputElement>()->setSelectionRange(start, end); } - -WebString WebInputElement::name() const -{ - return constUnwrap<HTMLInputElement>()->name(); -} - -WebString WebInputElement::nameForAutofill() const -{ - String name = constUnwrap<HTMLInputElement>()->name(); - String trimmedName = name.stripWhiteSpace(); - if (!trimmedName.isEmpty()) - return trimmedName; - name = constUnwrap<HTMLInputElement>()->getAttribute(HTMLNames::idAttr); - trimmedName = name.stripWhiteSpace(); - if (!trimmedName.isEmpty()) - return trimmedName; - return String(); -} WebInputElement::WebInputElement(const PassRefPtr<HTMLInputElement>& elem) : WebFormControlElement(elem) diff --git a/WebKit/chromium/src/WebKit.cpp b/WebKit/chromium/src/WebKit.cpp index a8e1851..8346ef8 100644 --- a/WebKit/chromium/src/WebKit.cpp +++ b/WebKit/chromium/src/WebKit.cpp @@ -56,6 +56,7 @@ void initialize(WebKitClient* webKitClient) s_webKitClient = webKitClient; WTF::initializeThreading(); + WTF::initializeMainThread(); WebCore::AtomicString::init(); // Chromium sets the minimum interval timeout to 4ms, overriding the diff --git a/WebKit/chromium/src/WebNode.cpp b/WebKit/chromium/src/WebNode.cpp index e050c79..90bbb34 100644 --- a/WebKit/chromium/src/WebNode.cpp +++ b/WebKit/chromium/src/WebNode.cpp @@ -178,6 +178,11 @@ WebNodeList WebNode::getElementsByTagName(const WebString& tag) const return WebNodeList(m_private->getElementsByTagName(tag)); } +bool WebNode::hasNonEmptyBoundingBox() const +{ + return m_private->hasNonEmptyBoundingBox(); +} + WebNode::WebNode(const PassRefPtr<Node>& node) : m_private(node) { diff --git a/WebKit/chromium/src/WebNotification.cpp b/WebKit/chromium/src/WebNotification.cpp index 5200d17..5ae1557 100644 --- a/WebKit/chromium/src/WebNotification.cpp +++ b/WebKit/chromium/src/WebNotification.cpp @@ -94,6 +94,16 @@ WebString WebNotification::body() const return m_private->contents().body(); } +WebString WebNotification::dir() const +{ + return m_private->dir(); +} + +WebString WebNotification::replaceId() const +{ + return m_private->replaceId(); +} + void WebNotification::dispatchDisplayEvent() { RefPtr<Event> event = Event::create("display", false, true); diff --git a/WebKit/chromium/src/WebPasswordFormData.cpp b/WebKit/chromium/src/WebPasswordFormData.cpp index 64b1754..eb230d5 100644 --- a/WebKit/chromium/src/WebPasswordFormData.cpp +++ b/WebKit/chromium/src/WebPasswordFormData.cpp @@ -162,7 +162,10 @@ WebPasswordFormData::WebPasswordFormData(const WebFormElement& webForm) KURL fullOrigin(ParsedURLString, form->document()->documentURI()); // Calculate the canonical action URL - KURL fullAction = frame->loader()->completeURL(form->action()); + String action = form->action(); + if (action.isNull()) + action = ""; // missing 'action' attribute implies current URL + KURL fullAction = frame->loader()->completeURL(action); if (!fullAction.isValid()) return; diff --git a/WebKit/chromium/src/WebPluginContainerImpl.cpp b/WebKit/chromium/src/WebPluginContainerImpl.cpp index 2cdf255..b207a25 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -128,10 +128,10 @@ void WebPluginContainerImpl::invalidateRect(const IntRect& rect) parent()->hostWindow()->invalidateContentsAndWindow(damageRect, false /*immediate*/); } -void WebPluginContainerImpl::setFocus() +void WebPluginContainerImpl::setFocus(bool focused) { - Widget::setFocus(); - m_webPlugin->updateFocus(true); + Widget::setFocus(focused); + m_webPlugin->updateFocus(focused); } void WebPluginContainerImpl::show() diff --git a/WebKit/chromium/src/WebPluginContainerImpl.h b/WebKit/chromium/src/WebPluginContainerImpl.h index 3160394..4163ee5 100644 --- a/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/WebKit/chromium/src/WebPluginContainerImpl.h @@ -67,7 +67,7 @@ public: virtual void setFrameRect(const WebCore::IntRect&); virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); virtual void invalidateRect(const WebCore::IntRect&); - virtual void setFocus(); + virtual void setFocus(bool); virtual void show(); virtual void hide(); virtual void handleEvent(WebCore::Event*); diff --git a/WebKit/chromium/src/WebPopupMenuImpl.h b/WebKit/chromium/src/WebPopupMenuImpl.h index 7390394..ca50b81 100644 --- a/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/WebKit/chromium/src/WebPopupMenuImpl.h @@ -75,6 +75,7 @@ public: int targetStart, int targetEnd, const WebString& text); virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect); virtual void setTextDirection(WebTextDirection direction); + virtual bool isAcceleratedCompositingActive() const { return false; } // WebPopupMenuImpl void Init(WebCore::FramelessScrollView* widget, diff --git a/WebKit/chromium/src/WebRuntimeFeatures.cpp b/WebKit/chromium/src/WebRuntimeFeatures.cpp index 464834d..8e73d6f 100644 --- a/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -210,4 +210,20 @@ bool WebRuntimeFeatures::isPushStateEnabled(bool enable) return RuntimeEnabledFeatures::pushStateEnabled(); } +void WebRuntimeFeatures::enableTouch(bool enable) +{ +#if ENABLE(TOUCH_EVENTS) + RuntimeEnabledFeatures::setTouchEnabled(enable); +#endif +} + +bool WebRuntimeFeatures::isTouchEnabled() +{ +#if ENABLE(TOUCH_EVENTS) + return RuntimeEnabledFeatures::touchEnabled(); +#else + return false; +#endif +} + } // namespace WebKit diff --git a/WebKit/chromium/src/WebSecurityPolicy.cpp b/WebKit/chromium/src/WebSecurityPolicy.cpp index 24ef7d1..cb7ded0 100644 --- a/WebKit/chromium/src/WebSecurityPolicy.cpp +++ b/WebKit/chromium/src/WebSecurityPolicy.cpp @@ -56,7 +56,8 @@ void WebSecurityPolicy::registerURLSchemeAsSecure(const WebString& scheme) SecurityOrigin::registerURLSchemeAsSecure(scheme); } -void WebSecurityPolicy::whiteListAccessFromOrigin(const WebURL& sourceOrigin, +void WebSecurityPolicy::addOriginAccessWhitelistEntry( + const WebURL& sourceOrigin, const WebString& destinationProtocol, const WebString& destinationHost, bool allowDestinationSubdomains) @@ -66,11 +67,38 @@ void WebSecurityPolicy::whiteListAccessFromOrigin(const WebURL& sourceOrigin, destinationHost, allowDestinationSubdomains); } -void WebSecurityPolicy::resetOriginAccessWhiteLists() +void WebSecurityPolicy::removeOriginAccessWhitelistEntry( + const WebURL& sourceOrigin, + const WebString& destinationProtocol, + const WebString& destinationHost, + bool allowDestinationSubdomains) +{ + SecurityOrigin::removeOriginAccessWhitelistEntry( + *SecurityOrigin::create(sourceOrigin), destinationProtocol, + destinationHost, allowDestinationSubdomains); +} + +void WebSecurityPolicy::resetOriginAccessWhitelists() { SecurityOrigin::resetOriginAccessWhitelists(); } +// To be removed when Chromium's test_shell has proper references. +void WebSecurityPolicy::whiteListAccessFromOrigin(const WebURL& sourceOrigin, + const WebString& destinationProtocol, + const WebString& destinationHost, + bool allowDestinationSubdomains) +{ + addOriginAccessWhitelistEntry(sourceOrigin, + destinationProtocol, destinationHost, + allowDestinationSubdomains); +} + +void WebSecurityPolicy::resetOriginAccessWhiteLists() +{ + resetOriginAccessWhitelists(); +} + bool WebSecurityPolicy::shouldHideReferrer(const WebURL& url, const WebString& referrer) { return SecurityOrigin::shouldHideReferrer(url, referrer); diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp index 9e0fa91..3adf3ac 100644 --- a/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/WebKit/chromium/src/WebSettingsImpl.cpp @@ -200,6 +200,11 @@ void WebSettingsImpl::setDownloadableBinaryFontsEnabled(bool enabled) m_settings->setDownloadableBinaryFontsEnabled(enabled); } +void WebSettingsImpl::setJavaScriptCanAccessClipboard(bool enabled) +{ + m_settings->setJavaScriptCanAccessClipboard(enabled); +} + void WebSettingsImpl::setXSSAuditorEnabled(bool enabled) { m_settings->setXSSAuditorEnabled(enabled); diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h index 7a809c7..54c660b 100644 --- a/WebKit/chromium/src/WebSettingsImpl.h +++ b/WebKit/chromium/src/WebSettingsImpl.h @@ -74,6 +74,7 @@ public: virtual void setAuthorAndUserStylesEnabled(bool); virtual void setUsesPageCache(bool); virtual void setDownloadableBinaryFontsEnabled(bool); + virtual void setJavaScriptCanAccessClipboard(bool); virtual void setXSSAuditorEnabled(bool); virtual void setLocalStorageEnabled(bool); virtual void setEditableLinkBehaviorNeverLive(); diff --git a/WebKit/chromium/src/WebStorageNamespaceImpl.cpp b/WebKit/chromium/src/WebStorageNamespaceImpl.cpp index 66be027..5fc6e16 100644 --- a/WebKit/chromium/src/WebStorageNamespaceImpl.cpp +++ b/WebKit/chromium/src/WebStorageNamespaceImpl.cpp @@ -45,9 +45,9 @@ WebStorageNamespace* WebStorageNamespace::createLocalStorageNamespace(const WebS return new WebStorageNamespaceImpl(WebCore::StorageNamespaceImpl::localStorageNamespace(path, quota)); } -WebStorageNamespace* WebStorageNamespace::createSessionStorageNamespace() +WebStorageNamespace* WebStorageNamespace::createSessionStorageNamespace(unsigned quota) { - return new WebStorageNamespaceImpl(WebCore::StorageNamespaceImpl::sessionStorageNamespace(noQuota)); + return new WebStorageNamespaceImpl(WebCore::StorageNamespaceImpl::sessionStorageNamespace(quota)); } WebStorageNamespaceImpl::WebStorageNamespaceImpl(PassRefPtr<WebCore::StorageNamespace> storageNamespace) diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index 671a8c9..81a4ff3 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -183,7 +183,9 @@ void WebView::willEnterModalLoop() PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); ASSERT(pageGroup); - ASSERT(!pageGroup->pages().isEmpty()); + + if (pageGroup->pages().isEmpty()) + return; // Pick any page in the page group since we are deferring all pages. pageGroupLoadDeferrer = new PageGroupLoadDeferrer(*pageGroup->pages().begin(), true); @@ -191,9 +193,6 @@ void WebView::willEnterModalLoop() void WebView::didExitModalLoop() { - // The embedder must have called willEnterNestedEventLoop. - ASSERT(pageGroupLoadDeferrer); - delete pageGroupLoadDeferrer; pageGroupLoadDeferrer = 0; } @@ -243,13 +242,14 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_haveMouseCapture(false) #if USE(ACCELERATED_COMPOSITING) , m_layerRenderer(0) - , m_isAcceleratedCompositing(false) + , m_isAcceleratedCompositingActive(false) #endif { // WebKit/win/WebView.cpp does the same thing, except they call the // KJS specific wrapper around this method. We need to have threading // initialized because CollatorICU requires it. WTF::initializeThreading(); + WTF::initializeMainThread(); // set to impossible point so we always get the first mouse pos m_lastMousePosition = WebPoint(-1, -1); @@ -326,9 +326,15 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event) if (!mainFrameImpl() || !mainFrameImpl()->frameView()) return; - // If there is a select popup opened, close it as the user is clicking on - // the page (outside of the popup). - hideSelectPopup(); + // If there is a select popup open, close it as the user is clicking on + // the page (outside of the popup). We also save it so we can prevent a + // click on the select element from immediately reopening the popup. + RefPtr<WebCore::PopupContainer> selectPopup; + if (event.button == WebMouseEvent::ButtonLeft) { + selectPopup = m_selectPopup; + hideSelectPopup(); + ASSERT(!m_selectPopup); + } m_lastMouseDownPoint = WebPoint(event.x, event.y); m_haveMouseCapture = true; @@ -362,6 +368,13 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event) static_cast<EditorClientImpl*>(m_page->editorClient())-> showFormAutofillForNode(clickedNode.get()); } + if (m_selectPopup && m_selectPopup == selectPopup) { + // That click triggered a select popup which is the same as the one that + // was showing before the click. It means the user clicked the select + // while the popup was showing, and as a result we first closed then + // immediately reopened the select popup. It needs to be closed. + hideSelectPopup(); + } // Dispatch the contextmenu event regardless of if the click was swallowed. // On Windows, we handle it on mouse up, not down. @@ -849,6 +862,14 @@ void WebViewImpl::popupClosed(WebCore::PopupContainer* popupContainer) } } +void WebViewImpl::hideSuggestionsPopup() +{ + if (m_suggestionsPopupShowing) { + m_suggestionsPopup->hidePopup(); + m_suggestionsPopupShowing = false; + } +} + Frame* WebViewImpl::focusedWebCoreFrame() { return m_page.get() ? m_page->focusController()->focusedOrMainFrame() : 0; @@ -931,7 +952,7 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) { #if USE(ACCELERATED_COMPOSITING) - if (!isAcceleratedCompositing()) { + if (!isAcceleratedCompositingActive()) { #endif WebFrameImpl* webframe = mainFrameImpl(); if (webframe) @@ -1267,6 +1288,15 @@ void WebViewImpl::setTextDirection(WebTextDirection direction) } } +bool WebViewImpl::isAcceleratedCompositingActive() const +{ +#if USE(ACCELERATED_COMPOSITING) + return m_isAcceleratedCompositingActive; +#else + return false; +#endif +} + // WebView -------------------------------------------------------------------- WebSettings* WebViewImpl::settings() @@ -1667,14 +1697,6 @@ WebAccessibilityObject WebViewImpl::accessibilityObject() document->axObjectCache()->getOrCreate(document->renderer())); } -void WebViewImpl::applyAutofillSuggestions( - const WebNode& node, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex) -{ - applyAutocompleteSuggestions(node, suggestions, defaultSuggestionIndex); -} - void WebViewImpl::applyAutoFillSuggestions( const WebNode& node, const WebVector<WebString>& names, @@ -1789,19 +1811,12 @@ void WebViewImpl::applyAutocompleteSuggestions( } } -void WebViewImpl::hideAutofillPopup() +void WebViewImpl::hidePopups() { + hideSelectPopup(); hideSuggestionsPopup(); } -void WebViewImpl::hideSuggestionsPopup() -{ - if (m_suggestionsPopupShowing) { - m_suggestionsPopup->hidePopup(); - m_suggestionsPopupShowing = false; - } -} - void WebViewImpl::performCustomContextMenuAction(unsigned action) { if (!m_page) @@ -2038,29 +2053,29 @@ bool WebViewImpl::tabsToLinks() const #if USE(ACCELERATED_COMPOSITING) void WebViewImpl::setRootGraphicsLayer(WebCore::PlatformLayer* layer) { - setAcceleratedCompositing(layer ? true : false); + setIsAcceleratedCompositingActive(layer ? true : false); if (m_layerRenderer) m_layerRenderer->setRootLayer(layer); } -void WebViewImpl::setAcceleratedCompositing(bool accelerated) +void WebViewImpl::setIsAcceleratedCompositingActive(bool active) { - if (m_isAcceleratedCompositing == accelerated) + if (m_isAcceleratedCompositingActive == active) return; - if (accelerated) { + if (active) { m_layerRenderer = LayerRendererChromium::create(); if (m_layerRenderer) - m_isAcceleratedCompositing = true; + m_isAcceleratedCompositingActive = true; } else { m_layerRenderer = 0; - m_isAcceleratedCompositing = false; + m_isAcceleratedCompositingActive = false; } } void WebViewImpl::updateRootLayerContents(const WebRect& rect) { - if (!isAcceleratedCompositing()) + if (!isAcceleratedCompositingActive()) return; WebFrameImpl* webframe = mainFrameImpl(); diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index ba2dc25..0bed223 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -100,6 +100,7 @@ public: virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect); virtual void setTextDirection(WebTextDirection direction); + virtual bool isAcceleratedCompositingActive() const; // WebView methods: virtual void initializeMainFrame(WebFrameClient*); @@ -156,10 +157,6 @@ public: virtual WebDevToolsAgent* devToolsAgent(); virtual void setDevToolsAgent(WebDevToolsAgent*); virtual WebAccessibilityObject accessibilityObject(); - virtual void applyAutofillSuggestions( - const WebNode&, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex); virtual void applyAutoFillSuggestions( const WebNode&, const WebVector<WebString>& names, @@ -169,8 +166,7 @@ public: const WebNode&, const WebVector<WebString>& suggestions, int defaultSuggestionIndex); - virtual void hideAutofillPopup(); - virtual void hideSuggestionsPopup(); + virtual void hidePopups(); virtual void setScrollbarColors(unsigned inactiveColor, unsigned activeColor, unsigned trackColor); @@ -299,6 +295,8 @@ public: void popupOpened(WebCore::PopupContainer* popupContainer); void popupClosed(WebCore::PopupContainer* popupContainer); + void hideSuggestionsPopup(); + // HACK: currentInputEvent() is for ChromeClientImpl::show(), until we can // fix WebKit to pass enough information up into ChromeClient::show() so we // can decide if the window.open event was caused by a middle-mouse click @@ -343,7 +341,6 @@ private: // Returns true if the view was scrolled. bool scrollViewWithKeyboard(int keyCode, int modifiers); - // Hides the select popup if one is opened. void hideSelectPopup(); // Converts |pos| from window coordinates to contents coordinates and gets @@ -358,8 +355,7 @@ private: DragAction); #if USE(ACCELERATED_COMPOSITING) - void setAcceleratedCompositing(bool); - bool isAcceleratedCompositing() const { return m_isAcceleratedCompositing; } + void setIsAcceleratedCompositingActive(bool); void updateRootLayerContents(const WebRect&); #endif @@ -495,7 +491,7 @@ private: #if USE(ACCELERATED_COMPOSITING) OwnPtr<WebCore::LayerRendererChromium> m_layerRenderer; - bool m_isAcceleratedCompositing; + bool m_isAcceleratedCompositingActive; #endif static const WebInputEvent* m_currentInputEvent; }; diff --git a/WebKit/chromium/src/WebWorkerBase.cpp b/WebKit/chromium/src/WebWorkerBase.cpp index da51414..8e26560 100644 --- a/WebKit/chromium/src/WebWorkerBase.cpp +++ b/WebKit/chromium/src/WebWorkerBase.cpp @@ -51,30 +51,6 @@ namespace WebKit { #if ENABLE(WORKERS) -// Dummy WebViewDelegate - we only need it in Worker process to load a -// 'shadow page' which will initialize WebCore loader. -class WorkerWebFrameClient : public WebFrameClient { -public: - // Tell the loader to load the data into the 'shadow page' synchronously, - // so we can grab the resulting Document right after load. - virtual void didCreateDataSource(WebFrame* frame, WebDataSource* ds) - { - static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false); - } - - // Lazy allocate and leak this instance. - static WorkerWebFrameClient* sharedInstance() - { - static WorkerWebFrameClient client; - return &client; - } - -private: - WorkerWebFrameClient() - { - } -}; - // This function is called on the main thread to force to initialize some static // values used in WebKit before any worker thread is started. This is because in // our worker processs, we do not run any WebKit code in main thread and thus @@ -103,6 +79,9 @@ WebWorkerBase::WebWorkerBase() WebWorkerBase::~WebWorkerBase() { ASSERT(m_webView); + WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); + if (webFrame) + webFrame->setClient(0); m_webView->close(); } @@ -122,7 +101,7 @@ void WebWorkerBase::initializeLoader(const WebURL& url) // infrastructure. ASSERT(!m_webView); m_webView = WebView::create(0); - m_webView->initializeMainFrame(WorkerWebFrameClient::sharedInstance()); + m_webView->initializeMainFrame(this); WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); @@ -151,6 +130,20 @@ void WebWorkerBase::invokeTaskMethod(void* param) delete task; } +void WebWorkerBase::didCreateDataSource(WebFrame*, WebDataSource* ds) +{ + // Tell the loader to load the data into the 'shadow page' synchronously, + // so we can grab the resulting Document right after load. + static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false); +} + +WebApplicationCacheHost* WebWorkerBase::createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient* appcacheHostClient) +{ + if (commonClient()) + return commonClient()->createApplicationCacheHost(appcacheHostClient); + return 0; +} + // WorkerObjectProxy ----------------------------------------------------------- void WebWorkerBase::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, diff --git a/WebKit/chromium/src/WebWorkerBase.h b/WebKit/chromium/src/WebWorkerBase.h index 1252770..a470ee4 100644 --- a/WebKit/chromium/src/WebWorkerBase.h +++ b/WebKit/chromium/src/WebWorkerBase.h @@ -34,6 +34,7 @@ #if ENABLE(WORKERS) #include "ScriptExecutionContext.h" +#include "WebFrameClient.h" #include "WorkerLoaderProxy.h" #include "WorkerObjectProxy.h" #include <wtf/PassOwnPtr.h> @@ -44,6 +45,8 @@ class WorkerThread; } namespace WebKit { +class WebApplicationCacheHost; +class WebApplicationCacheHostClient; class WebCommonWorkerClient; class WebSecurityOrigin; class WebString; @@ -56,7 +59,8 @@ class WebWorkerClient; // code used by both implementation classes, including implementations of the // WorkerObjectProxy and WorkerLoaderProxy interfaces. class WebWorkerBase : public WebCore::WorkerObjectProxy - , public WebCore::WorkerLoaderProxy { + , public WebCore::WorkerLoaderProxy + , public WebFrameClient { public: WebWorkerBase(); virtual ~WebWorkerBase(); @@ -80,6 +84,10 @@ public: virtual void postTaskForModeToWorkerContext( PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WebCore::String& mode); + // WebFrameClient methods to support resource loading thru the 'shadow page'. + virtual void didCreateDataSource(WebFrame*, WebDataSource*); + virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*); + // Executes the given task on the main thread. static void dispatchTaskToMainThread(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); diff --git a/WebKit/chromium/src/WebWorkerClientImpl.h b/WebKit/chromium/src/WebWorkerClientImpl.h index 4bdc332..907499a 100644 --- a/WebKit/chromium/src/WebWorkerClientImpl.h +++ b/WebKit/chromium/src/WebWorkerClientImpl.h @@ -94,6 +94,7 @@ public: // FIXME: Notifications not yet supported in workers. return 0; } + virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) { return 0; } private: virtual ~WebWorkerClientImpl(); diff --git a/WebKit/chromium/src/js/DebuggerAgent.js b/WebKit/chromium/src/js/DebuggerAgent.js index 8230616..67e54aa 100644 --- a/WebKit/chromium/src/js/DebuggerAgent.js +++ b/WebKit/chromium/src/js/DebuggerAgent.js @@ -182,6 +182,7 @@ devtools.DebuggerAgent.prototype.initUI = function() for (var scriptId in this.parsedScripts_) { var script = this.parsedScripts_[scriptId]; WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset() + 1); + this.restoreBreakpoints_(scriptId, script.getUrl()); } return; } @@ -245,7 +246,7 @@ devtools.DebuggerAgent.prototype.pauseExecution = function() * @param {number} line Number of the line for the breakpoint. * @param {?string} condition The breakpoint condition. */ -devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, condition) +devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, enabled, condition) { var script = this.parsedScripts_[sourceId]; if (!script) @@ -263,7 +264,7 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, condit this.urlToBreakpoints_[script.getUrl()] = breakpoints; } - var breakpointInfo = new devtools.BreakpointInfo(line); + var breakpointInfo = new devtools.BreakpointInfo(line, enabled, condition); breakpoints[line] = breakpointInfo; commandArguments = { @@ -278,7 +279,7 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, condit if (breakpointInfo) return; - breakpointInfo = new devtools.BreakpointInfo(line); + breakpointInfo = new devtools.BreakpointInfo(line, enabled, condition); script.addBreakpointInfo(breakpointInfo); commandArguments = { @@ -290,6 +291,9 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, condit }; } + if (!enabled) + return; + var cmd = new devtools.DebugCommand("setbreakpoint", commandArguments); this.requestNumberToBreakpointInfo_[cmd.getSequenceNumber()] = breakpointInfo; @@ -305,18 +309,11 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, condit /** * Changes given line of the script. */ -devtools.DebuggerAgent.prototype.editScriptLine = function(sourceId, line, newContent, callback) +devtools.DebuggerAgent.prototype.editScriptSource = function(sourceId, newContent, callback) { - var script = this.parsedScripts_[sourceId]; - if (!script || !script.source) - return; - - var lines = script.source.split("\n"); - lines[line] = newContent; - var commandArguments = { "script_id": sourceId, - "new_source": lines.join("\n") + "new_source": newContent }; var cmd = new devtools.DebugCommand("changelive", commandArguments); @@ -962,6 +959,7 @@ devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) if (this.scriptsPanelInitialized_) { // Only report script as parsed after scripts panel has been shown. WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset + 1); + this.restoreBreakpoints_(script.id, script.name); } }; @@ -1085,6 +1083,23 @@ devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame) /** + * Restores breakpoints associated with the URL of a newly parsed script. + * @param {number} sourceID The id of the script. + * @param {string} scriptUrl URL of the script. + */ +devtools.DebuggerAgent.prototype.restoreBreakpoints_ = function(sourceID, scriptUrl) +{ + var breakpoints = this.urlToBreakpoints_[scriptUrl]; + for (var line in breakpoints) { + if (parseInt(line) == line) { + var v8Line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(parseInt(line)); + WebInspector.restoredBreakpoint(sourceID, scriptUrl, v8Line, breakpoints[line].enabled(), breakpoints[line].condition()); + } + } +}; + + +/** * Collects properties for an object from the debugger response. * @param {Object} object An object from the debugger protocol response. * @param {Array.<WebInspector.ObjectPropertyProxy>} result An array to put the @@ -1279,9 +1294,11 @@ devtools.ScriptInfo.prototype.removeBreakpointInfo = function(breakpoint) * @param {number} line Breakpoint 0-based line number in the containing script. * @constructor */ -devtools.BreakpointInfo = function(line) +devtools.BreakpointInfo = function(line, enabled, condition) { this.line_ = line; + this.enabled_ = enabled; + this.condition_ = condition; this.v8id_ = -1; this.removed_ = false; }; @@ -1316,7 +1333,7 @@ devtools.BreakpointInfo.prototype.setV8Id = function(id) /** - * Marks this breakpoint as removed from the front-end. + * Marks this breakpoint as removed from the front-end. */ devtools.BreakpointInfo.prototype.markAsRemoved = function() { @@ -1335,6 +1352,24 @@ devtools.BreakpointInfo.prototype.isRemoved = function() /** + * @return {boolean} Whether this breakpoint is enabled. + */ +devtools.BreakpointInfo.prototype.enabled = function() +{ + return this.enabled_; +}; + + +/** + * @return {?string} Breakpoint condition. + */ +devtools.BreakpointInfo.prototype.condition = function() +{ + return this.condition_; +}; + + +/** * Call stack frame data. * @param {string} id CallFrame id. * @param {string} type CallFrame type. diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js index 75c5467..7c4d126 100644 --- a/WebKit/chromium/src/js/DebuggerScript.js +++ b/WebKit/chromium/src/js/DebuggerScript.js @@ -33,18 +33,29 @@ function debuggerScriptConstructor() { var DebuggerScript = {}; DebuggerScript._breakpoints = {}; +DebuggerScript.PauseOnExceptionsState = { + DontPauseOnExceptions : 0, + PauseOnAllExceptions : 1, + PauseOnUncaughtExceptions: 2 +}; + +DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.DontPauseOnExceptions; +Debug.clearBreakOnException(); +Debug.clearBreakOnUncaughtException(); DebuggerScript.getAfterCompileScript = function(execState, args) { return DebuggerScript._formatScript(args.eventData.script_.script_); } -DebuggerScript.getScripts = function(execState, args) +DebuggerScript.getScripts = function(contextData) { var scripts = Debug.scripts(); var result = []; for (var i = 0; i < scripts.length; ++i) { - result.push(DebuggerScript._formatScript(scripts[i])); + var script = scripts[i]; + if (contextData === script.context_data) + result.push(DebuggerScript._formatScript(script)); } return result; } @@ -92,6 +103,26 @@ DebuggerScript.removeBreakpoint = function(execState, args) delete DebuggerScript._breakpoints[key]; } +DebuggerScript.pauseOnExceptionsState = function() +{ + return DebuggerScript._pauseOnExceptionsState; +} + +DebuggerScript.setPauseOnExceptionsState = function(newState) +{ + DebuggerScript._pauseOnExceptionsState = newState; + + if (DebuggerScript.PauseOnExceptionsState.PauseOnAllExceptions === newState) + Debug.setBreakOnException(); + else + Debug.clearBreakOnException(); + + if (DebuggerScript.PauseOnExceptionsState.PauseOnUncaughtExceptions === newState) + Debug.setBreakOnUncaughtException(); + else + Debug.clearBreakOnUncaughtException(); +} + DebuggerScript.currentCallFrame = function(execState, args) { var frameCount = execState.frameCount(); @@ -160,7 +191,7 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) var sourceID = script && script.id(); // Get line number. - var line = DebuggerScript._v8ToWwebkitLineNumber(frameMirror.sourceLine()); + var line = DebuggerScript._v8ToWebkitLineNumber(frameMirror.sourceLine()); // Get this object. var thisObject = frameMirror.details_.receiver(); @@ -201,7 +232,7 @@ DebuggerScript._webkitToV8LineNumber = function(line) return line - 1; }; -DebuggerScript._v8ToWwebkitLineNumber = function(line) +DebuggerScript._v8ToWebkitLineNumber = function(line) { return line + 1; }; diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index a530fe5..59b88db 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -190,6 +190,23 @@ WebInspector.loaded = function() InspectorFrontendHost.loaded(); }; +devtools.domContentLoaded = function() +{ + var queryParams = window.location.search; + if (queryParams) { + var params = queryParams.substring(1).split("&"); + var paramsObject = {}; + for (var i = 0; i < params.length; ++i) { + var pair = params[i].split("="); + paramsObject[pair[0]] = pair[1]; + } + WebInspector.setAttachedWindow(paramsObject.docked); + if (paramsObject.toolbar_color && paramsObject.text_color) + WebInspector.setToolbarColors(paramsObject.toolbar_color, paramsObject.text_color); + } +} +document.addEventListener("DOMContentLoaded", devtools.domContentLoaded, false); + if (!window.v8ScriptDebugServerEnabled) { @@ -415,78 +432,14 @@ WebInspector.setToolbarColors = function(backgroundColor, color) document.head.appendChild(WebInspector._themeStyleElement); } WebInspector._themeStyleElement.textContent = - "body #toolbar, body.inactive #toolbar {\ + "#toolbar {\ background-image: none !important;\ background-color: " + backgroundColor + " !important;\ }\ \ - body .status-bar {\ - background-image: url(Images/statusbarBackgroundChromium2.png) !important;\ - background-color: " + backgroundColor + " !important;\ - }\ - \ - body button.status-bar-item {\ - background-image: none !important;\ - }\ - \ - button.status-bar-item {\ - background-image: none;\ - border-right: 1px solid " + backgroundColor + ";\ - }\ - \ - .status-bar {\ - background-image: none;\ - color: " + color + ";\ - }\ - \ - body #drawer {\ - background-image: none !important;\ - }\ - \ - #drawer-status-bar {\ - background-image: url(Images/statusbarBackgroundChromium2.png);\ - background-color: " + backgroundColor + ";\ - }\ - \ - \ - body.drawer-visible #main-status-bar {\ - background-image: url(Images/statusbarBackgroundChromium2.png) !important;\ - }\ - \ - body .crumbs .crumb, body .crumbs .crumb.end {\ - -webkit-border-image: url(Images/segmentChromium2.png) 0 12 0 2 !important;\ - background-color: " + backgroundColor + " !important;\ - }\ - \ - body .crumbs .crumb:hover, body .crumbs .crumb.dimmed:hover {\ - -webkit-border-image: url(Images/segmentHoverChromium2.png) 0 12 0 2 !important;\ - }\ - \ - body .crumbs .crumb.end {\ - -webkit-border-image: url(Images/segmentChromium2.png) 0 12 0 2 !important;\ - }\ - \ - body .crumbs .crumb.selected:hover, body .crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {\ - -webkit-border-image: url(Images/segmentSelectedChromium2.png) 0 12 0 2 !important;\ - }\ - \ - body select.status-bar-item {\ - -webkit-border-image: url(Images/statusbarMenuButtonChromium2.png) 0 17 0 2 !important;\ - background-color: " + backgroundColor + " !important;\ - text-shadow: none !important;\ - }\ - \ - .glyph {\ - background-color: " + color + ";\ - }\ - \ - button.status-bar-item .glyph.shadow {\ - display: none;\ - }\ - \ - .crumbs, .crumbs .crumb:hover, #drawer .scope-bar:not(.console-filter-top) li, .toolbar-label, select.status-bar-item {\ + .toolbar-label {\ + color: " + color + " !important;\ text-shadow: none;\ - color: " + color + ";\ }"; } diff --git a/WebKit/chromium/src/js/Images/segmentChromium.png b/WebKit/chromium/src/js/Images/segmentChromium.png Binary files differindex 607559b..f4248e1 100755 --- a/WebKit/chromium/src/js/Images/segmentChromium.png +++ b/WebKit/chromium/src/js/Images/segmentChromium.png diff --git a/WebKit/chromium/src/js/Images/segmentChromium2.png b/WebKit/chromium/src/js/Images/segmentChromium2.png Binary files differdeleted file mode 100755 index e94f570..0000000 --- a/WebKit/chromium/src/js/Images/segmentChromium2.png +++ /dev/null diff --git a/WebKit/chromium/src/js/Images/segmentHoverChromium2.png b/WebKit/chromium/src/js/Images/segmentHoverChromium2.png Binary files differdeleted file mode 100755 index 4d4a211..0000000 --- a/WebKit/chromium/src/js/Images/segmentHoverChromium2.png +++ /dev/null diff --git a/WebKit/chromium/src/js/Images/segmentSelectedChromium2.png b/WebKit/chromium/src/js/Images/segmentSelectedChromium2.png Binary files differdeleted file mode 100755 index f2b695b..0000000 --- a/WebKit/chromium/src/js/Images/segmentSelectedChromium2.png +++ /dev/null diff --git a/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png b/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png Binary files differindex 9d326ac..7a760c1 100755 --- a/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png +++ b/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png diff --git a/WebKit/chromium/src/js/Images/statusbarBackgroundChromium2.png b/WebKit/chromium/src/js/Images/statusbarBackgroundChromium2.png Binary files differdeleted file mode 100755 index 12d62b1..0000000 --- a/WebKit/chromium/src/js/Images/statusbarBackgroundChromium2.png +++ /dev/null diff --git a/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png b/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png Binary files differindex 7c7db0a..e3bc944 100755 --- a/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png +++ b/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png diff --git a/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png b/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png Binary files differindex 0c6635d..136d5a8 100755 --- a/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png +++ b/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png diff --git a/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png b/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png Binary files differindex bf26684..5ff61d9 100755 --- a/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png +++ b/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png diff --git a/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium2.png b/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium2.png Binary files differdeleted file mode 100755 index 9527ac8..0000000 --- a/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium2.png +++ /dev/null diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js index becc076..5c3e8bd 100644 --- a/WebKit/chromium/src/js/InspectorControllerImpl.js +++ b/WebKit/chromium/src/js/InspectorControllerImpl.js @@ -128,8 +128,7 @@ if (!window.v8ScriptDebugServerEnabled) { devtools.InspectorBackendImpl.prototype.setBreakpoint = function(sourceID, line, enabled, condition) { this.removeBreakpoint(sourceID, line); - if (enabled) - devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line, condition); + devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line, enabled, condition); }; @@ -139,10 +138,10 @@ devtools.InspectorBackendImpl.prototype.removeBreakpoint = function(sourceID, li }; -devtools.InspectorBackendImpl.prototype.editScriptLine = function(callID, sourceID, line, newContent) +devtools.InspectorBackendImpl.prototype.editScriptSource = function(callID, sourceID, newContent) { - devtools.tools.getDebuggerAgent().editScriptLine(sourceID, line, newContent, function(newFullBody) { - WebInspector.didEditScriptLine(callID, newFullBody); + devtools.tools.getDebuggerAgent().editScriptSource(sourceID, newContent, function(newFullBody) { + WebInspector.didEditScriptSource(callID, newFullBody); }); }; diff --git a/WebKit/chromium/src/js/devTools.css b/WebKit/chromium/src/js/devTools.css index bb33f72..6b4b3e5 100755 --- a/WebKit/chromium/src/js/devTools.css +++ b/WebKit/chromium/src/js/devTools.css @@ -15,12 +15,8 @@ body.attached #toolbar { /* Chrome theme overrides */ -body.platform-windows #toolbar { - background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(242, 247, 253)), to(rgb(223, 234, 248))); -} - -body.platform-windows.inactive #toolbar { - background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(248, 248, 248)), to(rgb(237, 237, 237))); +body.platform-windows #toolbar, body.platform-windows.inactive #toolbar { + background-image: none; } body.detached.platform-mac-leopard #toolbar { @@ -39,6 +35,12 @@ body.detached.platform-mac-snowleopard.inactive #toolbar { background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(215, 215, 215)), to(rgb(207, 207, 207))) !important; } +body.platform-linux #scripts-files { + font-size: 11px; + font-weight: normal; + line-height: 12px; +} + /* Heap Profiler Styles */ .heap-snapshot-status-bar-item .glyph { @@ -151,77 +153,79 @@ body.detached.platform-mac-snowleopard.inactive #toolbar { left: 25%; } -body.platform-windows .section > .header { +.section > .header { border: 1px solid rgb(92, 116, 157); background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(105, 133, 180)), to(rgb(92, 116, 157))); } -body.platform-windows .console-group-messages .section > .header { +.console-group-messages .section > .header { padding: 0 8px 0 0; background-image: none; border: none; min-height: 0; } -body.platform-windows #resources-filter { +#resources-filter { background: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(233, 233, 233))); } -body.platform-windows .crumbs .crumb { +.crumbs .crumb { -webkit-border-image: url(Images/segmentChromium.png) 0 12 0 2; + margin-right: -3px; + padding-left: 6px; } -body.platform-windows .crumbs .crumb.end { +.crumbs .crumb.end { -webkit-border-image: url(Images/segmentEndChromium.png) 0 2 0 2; } -body.platform-windows .crumbs .crumb.selected { +.crumbs .crumb.selected { -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2; color: white; text-shadow: rgba(255, 255, 255, 0.5) 0 0px 0; } -body.platform-windows .crumbs .crumb.selected:hover { +.crumbs .crumb.selected:hover { -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2; } -body.platform-windows .crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover { +.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover { -webkit-border-image: url(Images/segmentSelectedEndChromium.png) 0 2 0 2; } -body.platform-windows .crumbs .crumb:hover { +.crumbs .crumb:hover { -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2; } -body.platform-windows .crumbs .crumb.dimmed:hover { +.crumbs .crumb.dimmed:hover { -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2; } -body.platform-windows .crumbs .crumb.end:hover { +.crumbs .crumb.end:hover { -webkit-border-image: url(Images/segmentHoverEndChromium.png) 0 2 0 2; } -body.platform-windows body.drawer-visible #main-status-bar { +body.drawer-visible #main-status-bar { background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackgroundChromium.png); } -body.platform-windows .status-bar { +.status-bar { background-image: url(Images/statusbarBackgroundChromium.png); } -body.platform-windows button.status-bar-item { +button.status-bar-item { background-image: url(Images/statusbarButtonsChromium.png); } -body.platform-windows select.status-bar-item:active { +select.status-bar-item:active { -webkit-border-image: url(Images/statusbarMenuButtonSelectedChromium.png) 0 17 0 2; } -body.platform-windows #drawer { +#drawer { background-image: url(Images/statusbarBottomBackgroundChromium.png); } -body.platform-windows select.status-bar-item { +select.status-bar-item { -webkit-border-image: url(Images/statusbarMenuButtonChromium.png) 0 17 0 2; } |