diff options
Diffstat (limited to 'WebKit/chromium/src')
24 files changed, 364 insertions, 235 deletions
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp index ce2f00c..6e5bfc2 100644 --- a/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/WebKit/chromium/src/ChromeClientImpl.cpp @@ -43,6 +43,10 @@ #include "FloatRect.h" #include "FrameLoadRequest.h" #include "FrameView.h" +#include "Geolocation.h" +#include "GeolocationService.h" +#include "GeolocationServiceBridgeChromium.h" +#include "GeolocationServiceChromium.h" #include "HitTestResult.h" #include "IntRect.h" #include "Node.h" @@ -576,6 +580,11 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh chooserCompletion->didChooseFile(WebVector<WebString>()); } +void ChromeClientImpl::iconForFiles(const Vector<WebCore::String>&, PassRefPtr<WebCore::FileChooser>) +{ + notImplemented(); +} + void ChromeClientImpl::popupOpened(PopupContainer* popupContainer, const IntRect& bounds, bool activatable, @@ -674,4 +683,10 @@ NotificationPresenter* ChromeClientImpl::notificationPresenter() const } #endif +void ChromeClientImpl::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation) +{ + GeolocationServiceChromium* geolocationService = reinterpret_cast<GeolocationServiceChromium*>(geolocation->getGeolocationService()); + m_webView->client()->getGeolocationService()->requestPermissionForFrame(geolocationService->geolocationServiceBridge()->getBridgeId(), frame->document()->url()); +} + } // namespace WebKit diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h index 9e8c2e3..3a4035b 100644 --- a/WebKit/chromium/src/ChromeClientImpl.h +++ b/WebKit/chromium/src/ChromeClientImpl.h @@ -121,9 +121,9 @@ public: #if ENABLE(NOTIFICATIONS) virtual WebCore::NotificationPresenter* notificationPresenter() const; #endif - virtual void requestGeolocationPermissionForFrame( - WebCore::Frame*, WebCore::Geolocation*) { } + virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); + virtual void iconForFiles(const Vector<WebCore::String>&, PassRefPtr<WebCore::FileChooser>); virtual bool setCursor(WebCore::PlatformCursorHandle) { return false; } virtual void formStateDidChange(const WebCore::Node*); virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; } diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp index 0fd0825..e04226e 100644 --- a/WebKit/chromium/src/ChromiumBridge.cpp +++ b/WebKit/chromium/src/ChromiumBridge.cpp @@ -37,6 +37,7 @@ #include "ChromeClientImpl.h" #include "WebClipboard.h" #include "WebCookie.h" +#include "WebCookieJar.h" #include "WebCursorInfo.h" #include "WebData.h" #include "WebFrameClient.h" @@ -73,6 +74,7 @@ #include "BitmapImage.h" #include "Cookie.h" #include "FrameView.h" +#include "GeolocationServiceBridgeChromium.h" #include "GraphicsContext.h" #include "KURL.h" #include "NotImplemented.h" @@ -112,6 +114,17 @@ static WebWidgetClient* toWebWidgetClient(Widget* widget) return chromeClientImpl->webView()->client(); } +static WebCookieJar* getCookieJar(const Document* document) +{ + WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(document->frame()); + if (!frameImpl || !frameImpl->client()) + return 0; + WebCookieJar* cookieJar = frameImpl->client()->cookieJar(); + if (!cookieJar) + cookieJar = webKitClient()->cookieJar(); + return cookieJar; +} + // Clipboard ------------------------------------------------------------------ bool ChromiumBridge::clipboardIsFormatAvailable( @@ -173,25 +186,51 @@ void ChromiumBridge::clipboardWriteImage(NativeImagePtr image, // Cookies -------------------------------------------------------------------- -void ChromiumBridge::setCookies(const KURL& url, - const KURL& firstPartyForCookies, - const String& cookie) +void ChromiumBridge::setCookies(const Document* document, const KURL& url, + const String& value) { - webKitClient()->setCookies(url, firstPartyForCookies, cookie); + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + cookieJar->setCookie(url, document->firstPartyForCookies(), value); + else + webKitClient()->setCookies(url, document->firstPartyForCookies(), value); // DEPRECATED +} + +String ChromiumBridge::cookies(const Document* document, const KURL& url) +{ + String result; + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + result = cookieJar->cookies(url, document->firstPartyForCookies()); + else + result = webKitClient()->cookies(url, document->firstPartyForCookies()); // DEPRECATED + return result; } -String ChromiumBridge::cookies(const KURL& url, - const KURL& firstPartyForCookies) +String ChromiumBridge::cookieRequestHeaderFieldValue(const Document* document, + const KURL& url) { - return webKitClient()->cookies(url, firstPartyForCookies); + String result; + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + result = cookieJar->cookieRequestHeaderFieldValue(url, document->firstPartyForCookies()); + else { + // FIXME: This does not return http-only cookies + result = webKitClient()->cookies(url, document->firstPartyForCookies()); // DEPRECATED + } + return result; } -bool ChromiumBridge::rawCookies(const KURL& url, const KURL& firstPartyForCookies, Vector<Cookie>* rawCookies) +bool ChromiumBridge::rawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies) { - rawCookies->clear(); + rawCookies.clear(); WebVector<WebCookie> webCookies; - if (!webKitClient()->rawCookies(url, firstPartyForCookies, &webCookies)) - return false; + + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + cookieJar->rawCookies(url, document->firstPartyForCookies(), webCookies); + else + webKitClient()->rawCookies(url, document->firstPartyForCookies(), &webCookies); // DEPRECATED for (unsigned i = 0; i < webCookies.size(); ++i) { const WebCookie& webCookie = webCookies[i]; @@ -203,20 +242,29 @@ bool ChromiumBridge::rawCookies(const KURL& url, const KURL& firstPartyForCookie webCookie.httpOnly, webCookie.secure, webCookie.session); - rawCookies->append(cookie); + rawCookies.append(cookie); } return true; } -void ChromiumBridge::deleteCookie(const KURL& url, const String& cookieName) +void ChromiumBridge::deleteCookie(const Document* document, const KURL& url, const String& cookieName) { - webKitClient()->deleteCookie(url, cookieName); + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + cookieJar->deleteCookie(url, cookieName); + else + webKitClient()->deleteCookie(url, cookieName); // DEPRECATED } -bool ChromiumBridge::cookiesEnabled(const KURL& url, - const KURL& firstPartyForCookies) +bool ChromiumBridge::cookiesEnabled(const Document* document) { - return webKitClient()->cookiesEnabled(url, firstPartyForCookies); + bool result; + WebCookieJar* cookieJar = getCookieJar(document); + if (cookieJar) + result = cookieJar->cookiesEnabled(document->cookieURL(), document->firstPartyForCookies()); + else + result = webKitClient()->cookiesEnabled(document->cookieURL(), document->firstPartyForCookies()); // DEPRECATED + return result; } // DNS ------------------------------------------------------------------------ @@ -310,6 +358,13 @@ String ChromiumBridge::getFontFamilyForCharacters(const UChar* characters, size_ } #endif +// Geolocation ---------------------------------------------------------------- + +GeolocationServiceBridge* ChromiumBridge::createGeolocationServiceBridge(GeolocationServiceChromium* geolocationServiceChromium) +{ + return createGeolocationServiceBridgeImpl(geolocationServiceChromium); +} + // HTML5 DB ------------------------------------------------------------------- #if ENABLE(DATABASE) diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp index 8472082..06a29ff 100644 --- a/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -182,6 +182,10 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( if (mediaElement->hasAudio()) data.mediaFlags |= WebContextMenuData::MediaHasAudio; } + + data.isImageBlocked = + (data.mediaType == WebContextMenuData::MediaTypeImage) && !r.image(); + // If it's not a link, an image, a media element, or an image/media link, // show a selection menu or a more generic page menu. data.frameEncoding = selectedFrame->loader()->encoding(); diff --git a/WebKit/chromium/src/EditorClientImpl.cpp b/WebKit/chromium/src/EditorClientImpl.cpp index d5bddc5..cfd8ec4 100644 --- a/WebKit/chromium/src/EditorClientImpl.cpp +++ b/WebKit/chromium/src/EditorClientImpl.cpp @@ -784,7 +784,7 @@ void EditorClientImpl::cancelPendingAutofill() m_autofillTimer.stop(); } -void EditorClientImpl::onAutofillSuggestionAccepted(HTMLInputElement* textField) +void EditorClientImpl::onAutocompleteSuggestionAccepted(HTMLInputElement* textField) { WebFrameImpl* webframe = WebFrameImpl::fromFrame(textField->document()->frame()); if (!webframe) diff --git a/WebKit/chromium/src/EditorClientImpl.h b/WebKit/chromium/src/EditorClientImpl.h index fd08b4d..006b609 100644 --- a/WebKit/chromium/src/EditorClientImpl.h +++ b/WebKit/chromium/src/EditorClientImpl.h @@ -118,10 +118,10 @@ public: virtual bool showFormAutofillForNode(WebCore::Node*); // Notification that the text changed due to acceptance of a suggestion - // provided by an autofill popup. Having a separate callback in this case - // is a simple way to break the cycle that would otherwise occur if + // provided by an Autocomplete popup. Having a separate callback in this + // case is a simple way to break the cycle that would otherwise occur if // textDidChangeInTextField was called. - virtual void onAutofillSuggestionAccepted(WebCore::HTMLInputElement*); + virtual void onAutocompleteSuggestionAccepted(WebCore::HTMLInputElement*); private: void modifySelection(WebCore::Frame*, WebCore::KeyboardEvent*); diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp index b984308..8fb267d 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -235,7 +235,7 @@ void FrameLoaderClientImpl::detachedFromParent3() // Stop communicating with the WebFrameClient at this point since we are no // longer associated with the Page. - m_webFrame->dropClient(); + m_webFrame->setClient(0); } // This function is responsible for associating the |identifier| with a given @@ -1332,6 +1332,19 @@ PassRefPtr<Frame> FrameLoaderClientImpl::createFrame( return m_webFrame->createChildFrame(frameRequest, ownerElement); } +void FrameLoaderClientImpl::didTransferChildFrameToNewDocument() +{ + ASSERT(m_webFrame->frame()->ownerElement()); + + WebFrameImpl* newParent = static_cast<WebFrameImpl*>(m_webFrame->parent()); + if (!newParent || !newParent->client()) + return; + + // Replace the client since the old client may be destroyed when the + // previous page is closed. + m_webFrame->setClient(newParent->client()); +} + PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( const IntSize& size, // FIXME: how do we use this? HTMLPlugInElement* element, diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h index 901600c..8a39393 100644 --- a/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -174,6 +174,7 @@ public: WebCore::HTMLFrameOwnerElement* ownerElement, const WebCore::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); + virtual void didTransferChildFrameToNewDocument(); virtual PassRefPtr<WebCore::Widget> createPlugin( const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<WebCore::String>&, const Vector<WebCore::String>&, diff --git a/WebKit/chromium/src/GeolocationServiceBridgeChromium.cpp b/WebKit/chromium/src/GeolocationServiceBridgeChromium.cpp new file mode 100644 index 0000000..abbb9c6 --- /dev/null +++ b/WebKit/chromium/src/GeolocationServiceBridgeChromium.cpp @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "GeolocationServiceBridgeChromium.h" + +#include "Chrome.h" +#include "ChromeClientImpl.h" +#include "Frame.h" +#include "Geolocation.h" +#include "GeolocationServiceChromium.h" +#include "Geoposition.h" +#include "Page.h" +#include "PositionError.h" +#include "PositionOptions.h" +#include "WebFrame.h" +#include "WebFrameImpl.h" +#include "WebViewClient.h" +#include "WebViewImpl.h" + +#if ENABLE(GEOLOCATION) + +using WebCore::Coordinates; +using WebCore::Frame; +using WebCore::Geolocation; +using WebCore::GeolocationServiceBridge; +using WebCore::GeolocationServiceChromium; +using WebCore::GeolocationServiceClient; +using WebCore::Geoposition; +using WebCore::PositionError; +using WebCore::PositionOptions; +using WebCore::String; + +namespace WebKit { + +class GeolocationServiceBridgeImpl : public GeolocationServiceBridge, public WebGeolocationServiceBridge { +public: + explicit GeolocationServiceBridgeImpl(GeolocationServiceChromium*); + virtual ~GeolocationServiceBridgeImpl(); + + // GeolocationServiceBridge + virtual bool startUpdating(PositionOptions*); + virtual void stopUpdating(); + virtual void suspend(); + virtual void resume(); + virtual int getBridgeId() const; + + // WebGeolocationServiceBridge + 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); + +private: + WebViewClient* getWebViewClient(); + + // GeolocationServiceChromium owns us, we only have a pointer back to it. + GeolocationServiceChromium* m_GeolocationServiceChromium; + int m_bridgeId; +}; + +GeolocationServiceBridge* createGeolocationServiceBridgeImpl(GeolocationServiceChromium* geolocationServiceChromium) +{ + return new GeolocationServiceBridgeImpl(geolocationServiceChromium); +} + +GeolocationServiceBridgeImpl::GeolocationServiceBridgeImpl(GeolocationServiceChromium* geolocationServiceChromium) + : m_GeolocationServiceChromium(geolocationServiceChromium) +{ + // We need to attach ourselves here: Geolocation calls requestPermissionForFrame() + // directly, and we need to be attached so that the embedder can call + // our setIsAllowed(). + m_bridgeId = getWebViewClient()->getGeolocationService()->attachBridge(this); + ASSERT(m_bridgeId); +} + +GeolocationServiceBridgeImpl::~GeolocationServiceBridgeImpl() +{ + WebKit::WebViewClient* webViewClient = getWebViewClient(); + // Geolocation has an OwnPtr to us, and it's destroyed after the frame has + // been potentially disconnected. In this case, it calls stopUpdating() + // has been called and we have already dettached ourselves. + if (!webViewClient) { + ASSERT(!m_bridgeId); + } else if (m_bridgeId) + webViewClient->getGeolocationService()->dettachBridge(m_bridgeId); +} + +bool GeolocationServiceBridgeImpl::startUpdating(PositionOptions* positionOptions) +{ + if (!m_bridgeId) + m_bridgeId = getWebViewClient()->getGeolocationService()->attachBridge(this); + getWebViewClient()->getGeolocationService()->startUpdating(m_bridgeId, positionOptions->enableHighAccuracy()); + //// FIXME: this will trigger a permission request regardless. + //// Is it correct? confirm with andreip. + // positionChanged(); + return true; +} + +void GeolocationServiceBridgeImpl::stopUpdating() +{ + if (m_bridgeId) { + WebGeolocationServiceInterface* geolocationService = getWebViewClient()->getGeolocationService(); + geolocationService->stopUpdating(m_bridgeId); + geolocationService->dettachBridge(m_bridgeId); + m_bridgeId = 0; + } +} + +void GeolocationServiceBridgeImpl::suspend() +{ + getWebViewClient()->getGeolocationService()->suspend(m_bridgeId); +} + +void GeolocationServiceBridgeImpl::resume() +{ + getWebViewClient()->getGeolocationService()->resume(m_bridgeId); +} + +int GeolocationServiceBridgeImpl::getBridgeId() const +{ + return m_bridgeId; +} + +void GeolocationServiceBridgeImpl::setIsAllowed(bool allowed) +{ + m_GeolocationServiceChromium->setIsAllowed(allowed); +} + +void GeolocationServiceBridgeImpl::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) +{ + m_GeolocationServiceChromium->setLastPosition(latitude, longitude, providesAltitude, altitude, accuracy, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed, timestamp); +} + +void GeolocationServiceBridgeImpl::setLastError(int errorCode, const WebString& message) +{ + m_GeolocationServiceChromium->setLastError(errorCode, message); +} + +WebViewClient* GeolocationServiceBridgeImpl::getWebViewClient() +{ + Frame* frame = m_GeolocationServiceChromium->frame(); + if (!frame || !frame->page()) + return 0; + WebKit::ChromeClientImpl* chromeClientImpl = static_cast<WebKit::ChromeClientImpl*>(frame->page()->chrome()->client()); + WebKit::WebViewClient* webViewClient = chromeClientImpl->webView()->client(); + return webViewClient; +} + +} // namespace WebKit + +#endif // ENABLE(GEOLOCATION) diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp index 83574da..807a794 100644 --- a/WebKit/chromium/src/GraphicsContext3D.cpp +++ b/WebKit/chromium/src/GraphicsContext3D.cpp @@ -65,17 +65,12 @@ #if PLATFORM(CG) #include "GraphicsContext.h" #include <CoreGraphics/CGContext.h> -#include <CoreGraphics/CGBitmapContext.h> #include <CoreGraphics/CGImage.h> #include <OpenGL/OpenGL.h> #else #define FLIP_FRAMEBUFFER_VERTICALLY #endif -#if PLATFORM(SKIA) -#include "NativeImageSkia.h" -#endif - #if OS(DARWIN) #define USE_TEXTURE_RECTANGLE_FOR_FRAMEBUFFER #endif @@ -1878,178 +1873,17 @@ int GraphicsContext3D::texImage2D(unsigned target, return 0; } -// Remove premultiplied alpha from color channels. -// FIXME: this is lossy. Must retrieve original values from HTMLImageElement. -static void unmultiplyAlpha(unsigned char* rgbaData, int numPixels) -{ - for (int j = 0; j < numPixels; j++) { - float b = rgbaData[4*j+0] / 255.0f; - float g = rgbaData[4*j+1] / 255.0f; - float r = rgbaData[4*j+2] / 255.0f; - float a = rgbaData[4*j+3] / 255.0f; - if (a > 0.0f) { - b /= a; - g /= a; - r /= a; - b = (b > 1.0f) ? 1.0f : b; - g = (g > 1.0f) ? 1.0f : g; - r = (r > 1.0f) ? 1.0f : r; - rgbaData[4*j+0] = (unsigned char) (b * 255.0f); - rgbaData[4*j+1] = (unsigned char) (g * 255.0f); - rgbaData[4*j+2] = (unsigned char) (r * 255.0f); - } - } -} - -// FIXME: this must be changed to refer to the original image data -// rather than unmultiplying the alpha channel. -static int texImage2DHelper(unsigned target, unsigned level, - int width, int height, - int rowBytes, - bool flipY, - bool premultiplyAlpha, - GLenum format, - bool skipAlpha, - unsigned char* pixels) -{ - ASSERT(format == GL_RGBA || format == GL_BGRA); - GLint internalFormat = GL_RGBA8; - if (skipAlpha) { - internalFormat = GL_RGB8; - // Ignore the alpha channel - premultiplyAlpha = true; - } - if (flipY) { - // Need to flip images vertically. To avoid making a copy of - // the entire image, we perform a ton of glTexSubImage2D - // calls. FIXME: should rethink this strategy for efficiency. - glTexImage2D(target, level, internalFormat, - width, - height, - 0, - format, - GL_UNSIGNED_BYTE, - 0); - unsigned char* row = 0; - bool allocatedRow = false; - if (!premultiplyAlpha) { - row = new unsigned char[rowBytes]; - allocatedRow = true; - } - for (int i = 0; i < height; i++) { - if (premultiplyAlpha) - row = pixels + (rowBytes * i); - else { - memcpy(row, pixels + (rowBytes * i), rowBytes); - unmultiplyAlpha(row, width); - } - glTexSubImage2D(target, level, 0, height - i - 1, - width, 1, - format, - GL_UNSIGNED_BYTE, - row); - } - if (allocatedRow) - delete[] row; - } else { - // The pixels of cube maps' faces are defined with a top-down - // scanline ordering, unlike GL_TEXTURE_2D, so when uploading - // these, the above vertical flip is the wrong thing to do. - if (premultiplyAlpha) - glTexImage2D(target, level, internalFormat, - width, - height, - 0, - format, - GL_UNSIGNED_BYTE, - pixels); - else { - glTexImage2D(target, level, internalFormat, - width, - height, - 0, - format, - GL_UNSIGNED_BYTE, - 0); - unsigned char* row = new unsigned char[rowBytes]; - for (int i = 0; i < height; i++) { - memcpy(row, pixels + (rowBytes * i), rowBytes); - unmultiplyAlpha(row, width); - glTexSubImage2D(target, level, 0, i, - width, 1, - format, - GL_UNSIGNED_BYTE, - row); - } - delete[] row; - } - } - return 0; -} - int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image, bool flipY, bool premultiplyAlpha) { - ASSERT(image); - - int res = -1; -#if PLATFORM(SKIA) - NativeImageSkia* skiaImage = image->nativeImageForCurrentFrame(); - if (!skiaImage) { - ASSERT_NOT_REACHED(); + Vector<uint8_t> imageData; + unsigned int format, internalFormat; + if (!extractImageData(image, flipY, premultiplyAlpha, imageData, &format, &internalFormat)) return -1; - } - SkBitmap::Config skiaConfig = skiaImage->config(); - // FIXME: must support more image configurations. - if (skiaConfig != SkBitmap::kARGB_8888_Config) { - ASSERT_NOT_REACHED(); - return -1; - } - SkBitmap& skiaImageRef = *skiaImage; - SkAutoLockPixels lock(skiaImageRef); - int width = skiaImage->width(); - int height = skiaImage->height(); - unsigned char* pixels = - reinterpret_cast<unsigned char*>(skiaImage->getPixels()); - int rowBytes = skiaImage->rowBytes(); - res = texImage2DHelper(target, level, - width, height, - rowBytes, - flipY, premultiplyAlpha, - GL_BGRA, - false, - pixels); -#elif PLATFORM(CG) - CGImageRef cgImage = image->nativeImageForCurrentFrame(); - if (!cgImage) { - ASSERT_NOT_REACHED(); - return -1; - } - int width = CGImageGetWidth(cgImage); - int height = CGImageGetHeight(cgImage); - int rowBytes = width * 4; - CGImageAlphaInfo info = CGImageGetAlphaInfo(cgImage); - bool skipAlpha = (info == kCGImageAlphaNone - || info == kCGImageAlphaNoneSkipLast - || info == kCGImageAlphaNoneSkipFirst); - unsigned char* imageData = new unsigned char[height * rowBytes]; - CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); - CGContextRef tmpContext = CGBitmapContextCreate(imageData, width, height, 8, rowBytes, - colorSpace, - kCGImageAlphaPremultipliedLast); - CGColorSpaceRelease(colorSpace); - CGContextSetBlendMode(tmpContext, kCGBlendModeCopy); - CGContextDrawImage(tmpContext, - CGRectMake(0, 0, static_cast<CGFloat>(width), static_cast<CGFloat>(height)), - cgImage); - CGContextRelease(tmpContext); - res = texImage2DHelper(target, level, width, height, rowBytes, - flipY, premultiplyAlpha, GL_RGBA, skipAlpha, imageData); - delete[] imageData; -#else -#error Must port to your platform -#endif - return res; + glTexImage2D(target, level, internalFormat, + image->width(), image->height(), 0, + format, GL_UNSIGNED_BYTE, imageData.data()); + return 0; } GL_SAME_METHOD_3(TexParameterf, texParameterf, unsigned, unsigned, float); @@ -2078,9 +1912,14 @@ int GraphicsContext3D::texSubImage2D(unsigned target, bool flipY, bool premultiplyAlpha) { - // FIXME: implement. - notImplemented(); - return -1; + Vector<uint8_t> imageData; + unsigned int format, internalFormat; + if (!extractImageData(image, flipY, premultiplyAlpha, imageData, &format, &internalFormat)) + return -1; + glTexSubImage2D(target, level, xoffset, yoffset, + image->width(), image->height(), + format, GL_UNSIGNED_BYTE, imageData.data()); + return 0; } GL_SAME_METHOD_2(Uniform1f, uniform1f, long, float) diff --git a/WebKit/chromium/src/StorageNamespaceProxy.cpp b/WebKit/chromium/src/StorageNamespaceProxy.cpp index 1be1967..3c87554 100644 --- a/WebKit/chromium/src/StorageNamespaceProxy.cpp +++ b/WebKit/chromium/src/StorageNamespaceProxy.cpp @@ -67,13 +67,14 @@ StorageNamespaceProxy::~StorageNamespaceProxy() PassRefPtr<StorageNamespace> StorageNamespaceProxy::copy() { ASSERT(m_storageType == SessionStorage); - // The WebViewClient knows what its session storage namespace id is but we - // do not. Returning 0 here causes it to be fetched (via the WebViewClient) - // on its next use. Note that it is WebViewClient::createView's - // responsibility to clone the session storage namespace id and that the - // only time copy() is called is directly after the createView call...which - // is why all of this is safe. - return 0; + WebKit::WebStorageNamespace* newNamespace = m_storageNamespace->copy(); + // Some embedders hook into WebViewClient::createView to make the copy of + // session storage and then return the object lazily. Other embedders + // choose to make the copy now and return a pointer immediately. So handle + // both cases. + if (!newNamespace) + return 0; + return adoptRef(new StorageNamespaceProxy(newNamespace, m_storageType)); } PassRefPtr<StorageArea> StorageNamespaceProxy::storageArea(PassRefPtr<SecurityOrigin> origin) diff --git a/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp b/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp index b4a77a3..aaf9036 100644 --- a/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp +++ b/WebKit/chromium/src/SuggestionsPopupMenuClient.cpp @@ -65,7 +65,7 @@ void SuggestionsPopupMenuClient::valueChanged(unsigned listIndex, bool fireEvent EditorClientImpl* editor = static_cast<EditorClientImpl*>(webView->page()->editorClient()); ASSERT(editor); - editor->onAutofillSuggestionAccepted( + editor->onAutocompleteSuggestionAccepted( static_cast<HTMLInputElement*>(m_textField.get())); } diff --git a/WebKit/chromium/src/WebDocument.cpp b/WebKit/chromium/src/WebDocument.cpp index 84f3004..2a91e22 100644 --- a/WebKit/chromium/src/WebDocument.cpp +++ b/WebKit/chromium/src/WebDocument.cpp @@ -53,7 +53,7 @@ using namespace WebCore; namespace WebKit { WebDocument::WebDocument(const PassRefPtr<Document>& elem) - : WebNode(elem.releaseRef()) + : WebNode(elem) { } @@ -98,6 +98,11 @@ WebElement WebDocument::head() return WebElement(unwrap<Document>()->head()); } +WebString WebDocument::title() const +{ + return WebString(constUnwrap<Document>()->title()); +} + WebNodeCollection WebDocument::all() { return WebNodeCollection(unwrap<Document>()->all()); diff --git a/WebKit/chromium/src/WebDragData.cpp b/WebKit/chromium/src/WebDragData.cpp index b18ab1b..2f476a7 100644 --- a/WebKit/chromium/src/WebDragData.cpp +++ b/WebKit/chromium/src/WebDragData.cpp @@ -88,18 +88,6 @@ void WebDragData::setURLTitle(const WebString& urlTitle) m_private->urlTitle = urlTitle; } -WebURL WebDragData::downloadURL() const -{ - ASSERT(!isNull()); - return m_private->downloadURL; -} - -void WebDragData::setDownloadURL(const WebURL& downloadURL) -{ - ensureMutable(); - m_private->downloadURL = downloadURL; -} - WebString WebDragData::downloadMetadata() const { ASSERT(!isNull()); diff --git a/WebKit/chromium/src/WebElement.cpp b/WebKit/chromium/src/WebElement.cpp index d0a0862..6501771 100644 --- a/WebKit/chromium/src/WebElement.cpp +++ b/WebKit/chromium/src/WebElement.cpp @@ -39,7 +39,7 @@ using namespace WebCore; namespace WebKit { WebElement::WebElement(const WTF::PassRefPtr<WebCore::Element>& elem) - : WebNode(elem.releaseRef()) + : WebNode(elem) { } diff --git a/WebKit/chromium/src/WebFormElement.cpp b/WebKit/chromium/src/WebFormElement.cpp index 5471608..0024892 100644 --- a/WebKit/chromium/src/WebFormElement.cpp +++ b/WebKit/chromium/src/WebFormElement.cpp @@ -47,7 +47,7 @@ class WebFormPrivate : public HTMLFormElement { }; WebFormElement::WebFormElement(const WTF::PassRefPtr<HTMLFormElement>& e) - : WebElement(e.releaseRef()) + : WebElement(e) { } diff --git a/WebKit/chromium/src/WebFrameImpl.cpp b/WebKit/chromium/src/WebFrameImpl.cpp index 2f911f1..665f6a3 100644 --- a/WebKit/chromium/src/WebFrameImpl.cpp +++ b/WebKit/chromium/src/WebFrameImpl.cpp @@ -713,12 +713,13 @@ bool WebFrameImpl::insertStyleText( return success; } -void WebFrameImpl::reload() +void WebFrameImpl::reload(bool ignoreCache) { m_frame->loader()->history()->saveDocumentAndScrollState(); stopLoading(); // Make sure existing activity stops. - m_frame->loader()->reload(); + + m_frame->loader()->reload(ignoreCache); } void WebFrameImpl::loadRequest(const WebURLRequest& request) diff --git a/WebKit/chromium/src/WebFrameImpl.h b/WebKit/chromium/src/WebFrameImpl.h index ccba6d4..f23106c 100644 --- a/WebKit/chromium/src/WebFrameImpl.h +++ b/WebKit/chromium/src/WebFrameImpl.h @@ -103,7 +103,7 @@ public: virtual v8::Local<v8::Context> mainWorldScriptContext() const; #endif virtual bool insertStyleText(const WebString& css, const WebString& id); - virtual void reload(); + virtual void reload(bool ignoreCache); virtual void loadRequest(const WebURLRequest&); virtual void loadHistoryItem(const WebHistoryItem&); virtual void loadData( @@ -221,7 +221,7 @@ public: WebPasswordAutocompleteListener* getPasswordListener(WebCore::HTMLInputElement*); WebFrameClient* client() const { return m_client; } - void dropClient() { m_client = 0; } + void setClient(WebFrameClient* client) { m_client = client; } static void selectWordAroundPosition(WebCore::Frame*, WebCore::VisiblePosition); diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp index 9fd317f..4ee1b93 100644 --- a/WebKit/chromium/src/WebInputElement.cpp +++ b/WebKit/chromium/src/WebInputElement.cpp @@ -41,7 +41,7 @@ using namespace WebCore; namespace WebKit { WebInputElement::WebInputElement(const WTF::PassRefPtr<HTMLInputElement>& elem) - : WebElement(elem.releaseRef()) + : WebElement(elem) { } diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp index 5cfbd4f..a680321 100644 --- a/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/WebKit/chromium/src/WebSettingsImpl.cpp @@ -236,6 +236,11 @@ void WebSettingsImpl::setAllowUniversalAccessFromFileURLs(bool allow) m_settings->setAllowUniversalAccessFromFileURLs(allow); } +void WebSettingsImpl::setAllowFileAccessFromFileURLs(bool allow) +{ + m_settings->setAllowFileAccessFromFileURLs(allow); +} + void WebSettingsImpl::setTextDirectionSubmenuInclusionBehaviorNeverIncluded() { // FIXME: If you ever need more behaviors than this, then we should probably @@ -254,6 +259,11 @@ void WebSettingsImpl::setExperimentalWebGLEnabled(bool enabled) m_settings->setWebGLEnabled(enabled); } +void WebSettingsImpl::setShowDebugBorders(bool show) +{ + m_settings->setShowDebugBorders(show); +} + void WebSettingsImpl::setGeolocationEnabled(bool enabled) { m_settings->setGeolocationEnabled(enabled); diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h index 3b69fe6..64ccab5 100644 --- a/WebKit/chromium/src/WebSettingsImpl.h +++ b/WebKit/chromium/src/WebSettingsImpl.h @@ -80,10 +80,12 @@ public: virtual void setShouldPaintCustomScrollbars(bool); virtual void setDatabasesEnabled(bool); virtual void setAllowUniversalAccessFromFileURLs(bool); + virtual void setAllowFileAccessFromFileURLs(bool); virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); virtual void setOfflineWebApplicationCacheEnabled(bool); virtual void setExperimentalWebGLEnabled(bool); virtual void setGeolocationEnabled(bool); + virtual void setShowDebugBorders(bool); private: WebCore::Settings* m_settings; diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp index ce03523..97665d4 100644 --- a/WebKit/chromium/src/WebViewImpl.cpp +++ b/WebKit/chromium/src/WebViewImpl.cpp @@ -540,11 +540,11 @@ bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event) int selectedIndex = m_suggestionsPopup->selectedIndex(); HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element); WebString name = inputElement->name(); - WebString value = m_autocompletePopupClient->itemText(selectedIndex); + WebString value = m_suggestionsPopupClient->itemText(selectedIndex); m_client->removeAutofillSuggestions(name, value); // Update the entries in the currently showing popup to reflect the // deletion. - m_autocompletePopupClient->removeSuggestionAtIndex(selectedIndex); + m_suggestionsPopupClient->removeSuggestionAtIndex(selectedIndex); refreshSuggestionsPopup(); return false; } @@ -1871,7 +1871,7 @@ void WebViewImpl::refreshSuggestionsPopup() ASSERT(m_suggestionsPopupShowing); // Hide the popup if it has become empty. - if (!m_autocompletePopupClient->listSize()) { + if (!m_suggestionsPopupClient->listSize()) { hideSuggestionsPopup(); return; } diff --git a/WebKit/chromium/src/js/DebuggerAgent.js b/WebKit/chromium/src/js/DebuggerAgent.js index 301620a..bb655c7 100644 --- a/WebKit/chromium/src/js/DebuggerAgent.js +++ b/WebKit/chromium/src/js/DebuggerAgent.js @@ -1053,7 +1053,7 @@ devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame) for (var i = 0; i < stackFrame.scopes.length; i++) { var scope = stackFrame.scopes[i]; scope.frameNumber = stackFrame.index; - var scopeObjectProxy = new WebInspector.ObjectProxy(0, scope, [], 0, "", true); + var scopeObjectProxy = new WebInspector.ObjectProxy(0, scope, [], "", true); scopeObjectProxy.isScope = true; switch(scope.type) { case ScopeType.Global: @@ -1149,7 +1149,7 @@ devtools.DebuggerAgent.formatObjectProxy_ = function(v) } else description = "<unresolved ref: " + v.ref + ", type: " + v.type + ">"; - var proxy = new WebInspector.ObjectProxy(0, v, [], 0, description, hasChildren); + var proxy = new WebInspector.ObjectProxy(0, v, [], description, hasChildren); proxy.type = v.type; proxy.isV8Ref = true; return proxy; @@ -1364,7 +1364,8 @@ devtools.CallFrame.prototype.evaluate_ = function(expression, callback) "frame": this.id, "global": false, "disable_break": false, - "compactFormat": true + "compactFormat": true, + "maxStringLength": -1 }, function(response) { var result = {}; diff --git a/WebKit/chromium/src/js/devTools.css b/WebKit/chromium/src/js/devTools.css index 1fa935f..bb33f72 100755 --- a/WebKit/chromium/src/js/devTools.css +++ b/WebKit/chromium/src/js/devTools.css @@ -13,8 +13,8 @@ body.attached #toolbar { padding-left: 0; } - /* 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))); } @@ -23,6 +23,21 @@ 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.detached.platform-mac-leopard #toolbar { + background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(175, 175, 175)), to(rgb(151, 151, 151))) !important; +} + +body.detached.platform-mac-leopard.inactive #toolbar { + background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(221, 221, 221)), to(rgb(207, 207, 207))) !important; +} + +body.detached.platform-mac-snowleopard #toolbar { + background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(189, 189, 189)), to(rgb(151, 151, 151))) !important; +} + +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; +} /* Heap Profiler Styles */ |
