diff options
author | eseidel@chromium.org <eseidel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-09 23:40:50 +0000 |
---|---|---|
committer | eseidel@chromium.org <eseidel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-09 23:40:50 +0000 |
commit | 3faae0c0329ca109f719a84676386382f3e1ff0a (patch) | |
tree | fb413827ae55b097cca7ad977ada49cf88ccf1c3 /webkit | |
parent | 6a0b409cead16ffe8015df1f7cff948f16f4296f (diff) | |
download | chromium_src-3faae0c0329ca109f719a84676386382f3e1ff0a.zip chromium_src-3faae0c0329ca109f719a84676386382f3e1ff0a.tar.gz chromium_src-3faae0c0329ca109f719a84676386382f3e1ff0a.tar.bz2 |
Second batch of style fixes for src/.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/376029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31505 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/api/src/DOMUtilitiesPrivate.h | 12 | ||||
-rw-r--r-- | webkit/api/src/EditorClientImpl.cpp | 4 | ||||
-rw-r--r-- | webkit/api/src/FrameLoaderClientImpl.cpp | 52 | ||||
-rw-r--r-- | webkit/api/src/GraphicsContext3D.cpp | 328 | ||||
-rw-r--r-- | webkit/api/src/NotificationPresenterImpl.cpp | 7 | ||||
-rw-r--r-- | webkit/api/src/PlatformMessagePortChannel.cpp | 14 | ||||
-rw-r--r-- | webkit/api/src/ResourceHandle.cpp | 6 | ||||
-rw-r--r-- | webkit/api/src/SharedWorkerRepository.cpp | 16 | ||||
-rw-r--r-- | webkit/api/src/StorageEventDispatcherImpl.cpp | 2 | ||||
-rw-r--r-- | webkit/api/src/WebAccessibilityCacheImpl.cpp | 4 | ||||
-rw-r--r-- | webkit/api/src/WebCString.cpp | 4 | ||||
-rw-r--r-- | webkit/api/src/WebFrameImpl.cpp | 54 | ||||
-rw-r--r-- | webkit/api/src/WebImageCG.cpp | 11 | ||||
-rw-r--r-- | webkit/api/src/WebInputEventConversion.cpp | 34 | ||||
-rw-r--r-- | webkit/api/src/WebKit.cpp | 4 | ||||
-rw-r--r-- | webkit/api/src/WebMediaPlayerClientImpl.cpp | 26 | ||||
-rw-r--r-- | webkit/api/src/WebNode.cpp | 3 |
17 files changed, 294 insertions, 287 deletions
diff --git a/webkit/api/src/DOMUtilitiesPrivate.h b/webkit/api/src/DOMUtilitiesPrivate.h index b402ce0..c701d0a 100644 --- a/webkit/api/src/DOMUtilitiesPrivate.h +++ b/webkit/api/src/DOMUtilitiesPrivate.h @@ -44,16 +44,16 @@ class String; namespace WebKit { // If node is an HTML node with a tag name of name it is casted and returned. -// If node is not an HTML node or the tag name is not name NULL is returned. -WebCore::HTMLInputElement* toHTMLInputElement(WebCore::Node* node); -WebCore::HTMLLinkElement* toHTMLLinkElement(WebCore::Node* node); -WebCore::HTMLMetaElement* toHTMLMetaElement(WebCore::Node* node); -WebCore::HTMLOptionElement* toHTMLOptionElement(WebCore::Node* node); +// If node is not an HTML node or the tag name is not name, 0 is returned. +WebCore::HTMLInputElement* toHTMLInputElement(WebCore::Node*); +WebCore::HTMLLinkElement* toHTMLLinkElement(WebCore::Node*); +WebCore::HTMLMetaElement* toHTMLMetaElement(WebCore::Node*); +WebCore::HTMLOptionElement* toHTMLOptionElement(WebCore::Node*); // Returns the name that should be used for the specified |element| when // storing autofill data. This is either the field name or its id, an empty // string if it has no name and no id. -WebCore::String nameOfInputElement(WebCore::HTMLInputElement* element); +WebCore::String nameOfInputElement(WebCore::HTMLInputElement*); } // namespace WebKit diff --git a/webkit/api/src/EditorClientImpl.cpp b/webkit/api/src/EditorClientImpl.cpp index 77c09fc..d84ce12 100644 --- a/webkit/api/src/EditorClientImpl.cpp +++ b/webkit/api/src/EditorClientImpl.cpp @@ -33,9 +33,9 @@ #include "EventHandler.h" #include "EventNames.h" #include "Frame.h" -#include "KeyboardCodes.h" #include "HTMLInputElement.h" #include "HTMLNames.h" +#include "KeyboardCodes.h" #include "KeyboardEvent.h" #include "PlatformKeyboardEvent.h" #include "PlatformString.h" @@ -707,7 +707,7 @@ bool EditorClientImpl::autofill(HTMLInputElement* inputElement, return false; WebString name = WebKit::nameOfInputElement(inputElement); - if (name.length() == 0) // If the field has no name, then we won't have values. + if (name.isEmpty()) // If the field has no name, then we won't have values. return false; // Don't attempt to autofill with values that are too large. diff --git a/webkit/api/src/FrameLoaderClientImpl.cpp b/webkit/api/src/FrameLoaderClientImpl.cpp index 359abb7..75a8507 100644 --- a/webkit/api/src/FrameLoaderClientImpl.cpp +++ b/webkit/api/src/FrameLoaderClientImpl.cpp @@ -35,19 +35,21 @@ #include "CString.h" #include "Document.h" #include "DocumentLoader.h" -#include "HTMLAppletElement.h" -#include "HTMLFormElement.h" // needed by FormState.h -#include "HTMLNames.h" #include "FormState.h" #include "FrameLoader.h" #include "FrameLoadRequest.h" #include "HitTestResult.h" +#include "HTMLAppletElement.h" +#include "HTMLFormElement.h" // needed by FormState.h +#include "HTMLNames.h" #include "MIMETypeRegistry.h" #include "MouseEvent.h" #include "Page.h" #include "PlatformString.h" #include "PluginData.h" #include "StringExtras.h" +#include "WebDataSourceImpl.h" +#include "WebDevToolsAgentPrivate.h" #include "WebFormElement.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" @@ -56,6 +58,8 @@ #include "WebMimeRegistry.h" #include "WebNode.h" #include "WebPlugin.h" +#include "WebPluginContainerImpl.h" +#include "WebPluginLoadObserver.h" #include "WebPluginParams.h" #include "WebSecurityOrigin.h" #include "WebURL.h" @@ -63,10 +67,6 @@ #include "WebVector.h" #include "WebViewClient.h" #include "WebViewImpl.h" -#include "WebDataSourceImpl.h" -#include "WebDevToolsAgentPrivate.h" -#include "WebPluginContainerImpl.h" -#include "WebPluginLoadObserver.h" #include "WindowFeatures.h" #include "WrappedResourceRequest.h" #include "WrappedResourceResponse.h" @@ -88,10 +88,12 @@ FrameLoaderClientImpl::FrameLoaderClientImpl(WebFrameImpl* frame) : m_webFrame(frame) , m_hasRepresentation(false) , m_sentInitialResponseToPlugin(false) - , m_nextNavigationPolicy(WebNavigationPolicyIgnore) { + , m_nextNavigationPolicy(WebNavigationPolicyIgnore) +{ } -FrameLoaderClientImpl::~FrameLoaderClientImpl() { +FrameLoaderClientImpl::~FrameLoaderClientImpl() +{ } void FrameLoaderClientImpl::frameLoaderDestroyed() @@ -163,7 +165,7 @@ bool FrameLoaderClientImpl::allowJavaScript(bool enabledPerSettings) bool FrameLoaderClientImpl::hasWebView() const { - return m_webFrame->viewImpl() != 0; + return !m_webFrame->viewImpl(); } bool FrameLoaderClientImpl::hasFrameView() const @@ -171,7 +173,7 @@ bool FrameLoaderClientImpl::hasFrameView() const // The Mac port has this notion of a WebFrameView, which seems to be // some wrapper around an NSView. Since our equivalent is HWND, I guess // we have a "frameview" whenever we have the toplevel HWND. - return m_webFrame->viewImpl() != 0; + return !m_webFrame->viewImpl(); } void FrameLoaderClientImpl::makeDocumentView() @@ -239,14 +241,12 @@ void FrameLoaderClientImpl::assignIdentifierToInitialRequest( // // The important edge cases to consider when modifying this function are // how synchronous resource loads are treated during load/unload threshold. -static ResourceRequest::TargetType determineTargetTypeFromLoader( - DocumentLoader* loader) +static ResourceRequest::TargetType determineTargetTypeFromLoader(DocumentLoader* loader) { if (loader == loader->frameLoader()->provisionalDocumentLoader()) { if (loader->frameLoader()->isLoadingMainFrame()) return ResourceRequest::TargetIsMainFrame; - else - return ResourceRequest::TargetIsSubFrame; + return ResourceRequest::TargetIsSubFrame; } return ResourceRequest::TargetIsSubResource; } @@ -594,7 +594,8 @@ void FrameLoaderClientImpl::dispatchDidReceiveIcon() ASSERT_NOT_REACHED(); } -void FrameLoaderClientImpl::dispatchDidStartProvisionalLoad() { +void FrameLoaderClientImpl::dispatchDidStartProvisionalLoad() +{ // In case a redirect occurs, we need this to be set so that the redirect // handling code can tell where the redirect came from. Server redirects // will occur on the provisional load, so we need to keep track of the most @@ -711,9 +712,8 @@ void FrameLoaderClientImpl::dispatchDidFirstLayout() void FrameLoaderClientImpl::dispatchDidFirstVisuallyNonEmptyLayout() { - // FIXME: called when webkit finished layout of a page that was visually - // non-empty. - // All resources have not necessarily finished loading. + // FIXME: called when webkit finished layout of a page that was visually non-empty. + // All resources have not necessarily finished loading. } Frame* FrameLoaderClientImpl::dispatchCreatePage() @@ -981,7 +981,8 @@ void FrameLoaderClientImpl::didChangeTitle(DocumentLoader*) } // Called whenever data is received. -void FrameLoaderClientImpl::committedLoad(DocumentLoader* loader, const char* data, int length) { +void FrameLoaderClientImpl::committedLoad(DocumentLoader* loader, const char* data, int length) +{ if (!m_pluginWidget.get()) { if (m_webFrame->client()) { bool preventDefault = false; @@ -1046,8 +1047,8 @@ void FrameLoaderClientImpl::didDisplayInsecureContent() void FrameLoaderClientImpl::didRunInsecureContent(SecurityOrigin* origin) { - if (m_webFrame->client()) - m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigin(origin)); + if (m_webFrame->client()) + m_webFrame->client()->didRunInsecureContent(m_webFrame, WebSecurityOrigin(origin)); } ResourceError FrameLoaderClientImpl::blockedError(const ResourceRequest&) @@ -1318,9 +1319,10 @@ PassRefPtr<Widget> FrameLoaderClientImpl::createPlugin( // This method gets called when a plugin is put in place of html content // (e.g., acrobat reader). -void FrameLoaderClientImpl::redirectDataToPlugin(Widget* pluginWidget) { - m_pluginWidget = static_cast<WebPluginContainerImpl*>(pluginWidget); - ASSERT(m_pluginWidget.get()); +void FrameLoaderClientImpl::redirectDataToPlugin(Widget* pluginWidget) +{ + m_pluginWidget = static_cast<WebPluginContainerImpl*>(pluginWidget); + ASSERT(m_pluginWidget.get()); } PassRefPtr<Widget> FrameLoaderClientImpl::createJavaAppletWidget( diff --git a/webkit/api/src/GraphicsContext3D.cpp b/webkit/api/src/GraphicsContext3D.cpp index 45f6444..8a93285 100644 --- a/webkit/api/src/GraphicsContext3D.cpp +++ b/webkit/api/src/GraphicsContext3D.cpp @@ -53,9 +53,9 @@ #include "ImageBuffer.h" #include "ImageData.h" #include "NotImplemented.h" -#include <wtf/FastMalloc.h> #include <stdio.h> +#include <wtf/FastMalloc.h> #if PLATFORM(WIN_OS) #include <windows.h> @@ -95,7 +95,7 @@ namespace WebCore { // Uncomment this to render to a separate window for debugging // #define RENDER_TO_DEBUGGING_WINDOW -#define EXTRACT(val) (val == NULL ? 0 : val->object()) +#define EXTRACT(val) (!val ? 0 : val->object()) class GraphicsContext3DInternal { public: @@ -217,7 +217,8 @@ GraphicsContext3DInternal::VertexAttribPointerState::VertexAttribPointerState() } #if PLATFORM(LINUX) -static void* tryLoad(const char* libName) { +static void* tryLoad(const char* libName) +{ // We use RTLD_GLOBAL semantics so that GLEW initialization works; // GLEW expects to be able to open the current process's handle // and do dlsym's of GL entry points from there. @@ -230,42 +231,42 @@ GraphicsContext3DInternal::GraphicsContext3DInternal() , m_fbo(0) , m_depthBuffer(0) #ifdef FLIP_FRAMEBUFFER_VERTICALLY - , m_scanline(NULL) + , m_scanline(0) #endif , m_boundArrayBuffer(0) #if PLATFORM(SKIA) , m_resizingBitmap(0) #endif #if PLATFORM(WIN_OS) - , m_canvasWindow(NULL) - , m_canvasDC(NULL) - , m_contextObj(NULL) + , m_canvasWindow(0) + , m_canvasDC(0) + , m_contextObj(0) #elif PLATFORM(CG) - , m_pbuffer(NULL) - , m_contextObj(NULL) - , m_renderOutput(NULL) - , m_cgContext(NULL) + , m_pbuffer(0) + , m_contextObj(0) + , m_renderOutput(0) + , m_cgContext(0) #elif PLATFORM(LINUX) - , m_display(NULL) - , m_contextObj(NULL) - , m_pbuffer(NULL) - , m_glXChooseFBConfig(NULL) - , m_glXCreateNewContext(NULL) - , m_glXCreatePbuffer(NULL) - , m_glXDestroyPbuffer(NULL) - , m_glXMakeCurrent(NULL) - , m_glXDestroyContext(NULL) - , m_glXGetCurrentContext(NULL) + , m_display(0) + , m_contextObj(0) + , m_pbuffer(0) + , m_glXChooseFBConfig(0) + , m_glXCreateNewContext(0) + , m_glXCreatePbuffer(0) + , m_glXDestroyPbuffer(0) + , m_glXMakeCurrent(0) + , m_glXDestroyContext(0) + , m_glXGetCurrentContext(0) #else #error Must port to your platform #endif { #if PLATFORM(WIN_OS) WNDCLASS wc; - if (!GetClassInfo(GetModuleHandle(NULL), L"CANVASGL", &wc)) { + if (!GetClassInfo(GetModuleHandle(0), L"CANVASGL", &wc)) { ZeroMemory(&wc, sizeof(WNDCLASS)); wc.style = CS_OWNDC; - wc.hInstance = GetModuleHandle(NULL); + wc.hInstance = GetModuleHandle(0); wc.lpfnWndProc = DefWindowProc; wc.lpszClassName = L"CANVASGL"; @@ -278,7 +279,7 @@ GraphicsContext3DInternal::GraphicsContext3DInternal() m_canvasWindow = CreateWindow(L"CANVASGL", L"CANVASGL", WS_CAPTION, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, NULL, NULL, GetModuleHandle(NULL), NULL); + CW_USEDEFAULT, 0, 0, GetModuleHandle(0), 0); if (!m_canvasWindow) { printf("GraphicsContext3DInternal: CreateWindow failed\n"); return; @@ -323,9 +324,9 @@ GraphicsContext3DInternal::GraphicsContext3DInternal() #ifdef RENDER_TO_DEBUGGING_WINDOW typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); - PFNWGLSWAPINTERVALEXTPROC setSwapInterval = NULL; + PFNWGLSWAPINTERVALEXTPROC setSwapInterval = 0; setSwapInterval = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT"); - if (setSwapInterval != NULL) + if (setSwapInterval) setSwapInterval(1); #endif // RENDER_TO_DEBUGGING_WINDOW @@ -341,12 +342,12 @@ GraphicsContext3DInternal::GraphicsContext3DInternal() printf("GraphicsContext3D: error choosing pixel format\n"); return; } - if (pixelFormat == NULL) { + if (!pixelFormat) { printf("GraphicsContext3D: no pixel format selected\n"); return; } CGLContextObj context; - CGLError res = CGLCreateContext(pixelFormat, NULL, &context); + CGLError res = CGLCreateContext(pixelFormat, 0, &context); CGLDestroyPixelFormat(pixelFormat); if (res != kCGLNoError) { printf("GraphicsContext3D: error creating context\n"); @@ -373,8 +374,8 @@ GraphicsContext3DInternal::GraphicsContext3DInternal() m_pbuffer = pbuffer; m_contextObj = context; #elif PLATFORM(LINUX) - m_display = XOpenDisplay(NULL); - if (m_display == NULL) { + m_display = XOpenDisplay(0); + if (!m_display) { printf("GraphicsContext3D: error opening X display\n"); return; } @@ -386,15 +387,14 @@ GraphicsContext3DInternal::GraphicsContext3DInternal() }; for (int i = 0; i < sizeof(libNames) / sizeof(const char*); i++) { m_libGL = tryLoad(libNames[i]); - if (m_libGL != NULL) + if (m_libGL) break; } - if (m_libGL == NULL) { + if (!m_libGL) { printf("GraphicsContext3D: error opening libGL.so.1\n"); printf("GraphicsContext3D: tried:"); - for (int i = 0; i < sizeof(libNames) / sizeof(const char*); i++) { + for (int i = 0; i < sizeof(libNames) / sizeof(const char*); i++) printf(" %s", libNames[i]); - } return; } m_glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC) dlsym(m_libGL, "glXChooseFBConfig"); @@ -404,9 +404,9 @@ GraphicsContext3DInternal::GraphicsContext3DInternal() m_glXMakeCurrent = (PFNGLXMAKECURRENTPROC) dlsym(m_libGL, "glXMakeCurrent"); m_glXDestroyContext = (PFNGLXDESTROYCONTEXTPROC) dlsym(m_libGL, "glXDestroyContext"); m_glXGetCurrentContext = (PFNGLXGETCURRENTCONTEXTPROC) dlsym(m_libGL, "glXGetCurrentContext"); - if (!m_glXChooseFBConfig || !m_glXCreateNewContext || !m_glXCreatePbuffer || - !m_glXDestroyPbuffer || !m_glXMakeCurrent || !m_glXDestroyContext || - !m_glXGetCurrentContext) { + if (!m_glXChooseFBConfig || !m_glXCreateNewContext || !m_glXCreatePbuffer + || !m_glXDestroyPbuffer || !m_glXMakeCurrent || !m_glXDestroyContext + || !m_glXGetCurrentContext) { printf("GraphicsContext3D: error looking up bootstrapping entry points\n"); return; } @@ -421,17 +421,17 @@ GraphicsContext3DInternal::GraphicsContext3DInternal() }; int nelements = 0; GLXFBConfig* config = m_glXChooseFBConfig(m_display, 0, configAttrs, &nelements); - if (config == NULL) { + if (!config) { printf("GraphicsContext3D: glXChooseFBConfig failed\n"); return; } - if (nelements == 0) { + if (!nelements) { printf("GraphicsContext3D: glXChooseFBConfig returned 0 elements\n"); XFree(config); return; } - GLXContext context = m_glXCreateNewContext(m_display, config[0], GLX_RGBA_TYPE, NULL, True); - if (context == NULL) { + GLXContext context = m_glXCreateNewContext(m_display, config[0], GLX_RGBA_TYPE, 0, True); + if (!context) { printf("GraphicsContext3D: glXCreateNewContext failed\n"); XFree(config); return; @@ -482,7 +482,7 @@ GraphicsContext3DInternal::~GraphicsContext3DInternal() glDeleteRenderbuffersEXT(1, &m_depthBuffer); glDeleteTextures(1, &m_texture); #ifdef FLIP_FRAMEBUFFER_VERTICALLY - if (m_scanline != NULL) + if (m_scanline) delete[] m_scanline; #endif glDeleteFramebuffersEXT(1, &m_fbo); @@ -492,20 +492,20 @@ GraphicsContext3DInternal::~GraphicsContext3DInternal() delete m_resizingBitmap; #endif #if PLATFORM(WIN_OS) - wglMakeCurrent(NULL, NULL); + wglMakeCurrent(0, 0); wglDeleteContext(m_contextObj); ReleaseDC(m_canvasWindow, m_canvasDC); DestroyWindow(m_canvasWindow); #elif PLATFORM(CG) - CGLSetCurrentContext(NULL); + CGLSetCurrentContext(0); CGLDestroyContext(m_contextObj); CGLDestroyPBuffer(m_pbuffer); - if (m_cgContext != NULL) + if (m_cgContext) CGContextRelease(m_cgContext); - if (m_renderOutput != NULL) + if (m_renderOutput) delete[] m_renderOutput; #elif PLATFORM(LINUX) - m_glXMakeCurrent(m_display, NULL, NULL); + m_glXMakeCurrent(m_display, 0, 0); m_glXDestroyContext(m_display, m_contextObj); m_glXDestroyPbuffer(m_display, m_pbuffer); XCloseDisplay(m_display); @@ -513,7 +513,7 @@ GraphicsContext3DInternal::~GraphicsContext3DInternal() #else #error Must port to your platform #endif - m_contextObj = NULL; + m_contextObj = 0; } void GraphicsContext3DInternal::checkError() const @@ -586,7 +586,7 @@ void GraphicsContext3DInternal::reshape(int width, int height) #else GLenum target = GL_TEXTURE_2D; #endif - if (m_texture == 0) { + if (!m_texture) { // Generate the texture object m_texture = createTextureObject(target); // Generate the framebuffer object @@ -618,9 +618,9 @@ void GraphicsContext3DInternal::reshape(int width, int height) #endif // RENDER_TO_DEBUGGING_WINDOW #ifdef FLIP_FRAMEBUFFER_VERTICALLY - if (m_scanline != NULL) { + if (m_scanline) { delete[] m_scanline; - m_scanline = NULL; + m_scanline = 0; } m_scanline = new unsigned char[width * 4]; #endif // FLIP_FRAMEBUFFER_VERTICALLY @@ -631,13 +631,13 @@ void GraphicsContext3DInternal::reshape(int width, int height) #if PLATFORM(CG) // Need to reallocate the client-side backing store. // FIXME: make this more efficient. - if (m_cgContext != NULL) { + if (m_cgContext) { CGContextRelease(m_cgContext); - m_cgContext = NULL; + m_cgContext = 0; } - if (m_renderOutput != NULL) { + if (m_renderOutput) { delete[] m_renderOutput; - m_renderOutput = NULL; + m_renderOutput = 0; } int rowBytes = width * 4; m_renderOutput = new unsigned char[height * rowBytes]; @@ -654,7 +654,7 @@ void GraphicsContext3DInternal::flipVertically(unsigned char* framebuffer, unsigned int height) { unsigned char* scanline = m_scanline; - if (scanline == NULL) + if (!scanline) return; unsigned int rowBytes = width * 4; unsigned int count = height / 2; @@ -693,12 +693,11 @@ void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext3D* context) const SkBitmap* canvasBitmap = imageBuffer->context()->platformContext()->bitmap(); const SkBitmap* readbackBitmap = 0; ASSERT(canvasBitmap->config() == SkBitmap::kARGB_8888_Config); - if (canvasBitmap->width() == m_cachedWidth && - canvasBitmap->height() == m_cachedHeight) { + if (canvasBitmap->width() == m_cachedWidth && canvasBitmap->height() == m_cachedHeight) { // This is the fastest and most common case. We read back // directly into the canvas's backing store. readbackBitmap = canvasBitmap; - if (m_resizingBitmap != NULL) { + if (m_resizingBitmap) { delete m_resizingBitmap; m_resizingBitmap = 0; } @@ -706,13 +705,11 @@ void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext3D* context) // We need to allocate a temporary bitmap for reading back the // pixel data. We will then use Skia to rescale this bitmap to // the size of the canvas's backing store. - if (m_resizingBitmap && - (m_resizingBitmap->width() != m_cachedWidth || - m_resizingBitmap->height() != m_cachedHeight)) { + if (m_resizingBitmap && (m_resizingBitmap->width() != m_cachedWidth || m_resizingBitmap->height() != m_cachedHeight)) { delete m_resizingBitmap; m_resizingBitmap = 0; } - if (m_resizingBitmap == 0) { + if (!m_resizingBitmap) { m_resizingBitmap = new SkBitmap(); m_resizingBitmap->setConfig(SkBitmap::kARGB_8888_Config, m_cachedWidth, @@ -731,7 +728,7 @@ void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext3D* context) pixels = static_cast<unsigned char*>(readbackBitmap->getPixels()); glReadPixels(0, 0, m_cachedWidth, m_cachedHeight, GL_BGRA, GL_UNSIGNED_BYTE, pixels); #elif PLATFORM(CG) - if (m_renderOutput != NULL) { + if (m_renderOutput) { ASSERT(CGBitmapContextGetWidth(m_cgContext) == m_cachedWidth); ASSERT(CGBitmapContextGetHeight(m_cgContext) == m_cachedHeight); pixels = m_renderOutput; @@ -742,7 +739,7 @@ void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext3D* context) #endif #ifdef FLIP_FRAMEBUFFER_VERTICALLY - if (pixels != NULL) + if (pixels) flipVertically(pixels, m_cachedWidth, m_cachedHeight); #endif @@ -755,7 +752,7 @@ void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext3D* context) canvas.drawBitmapRect(*m_resizingBitmap, 0, dst); } #elif PLATFORM(CG) - if (m_renderOutput != NULL) { + if (m_renderOutput) { CGImageRef cgImage = CGBitmapContextCreateImage(m_cgContext); // CSS styling may cause the canvas's content to be resized on // the page. Go back to the Canvas to figure out the correct @@ -780,16 +777,15 @@ void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext3D* context) bool GraphicsContext3DInternal::validateTextureTarget(int target) { - return (target == GL_TEXTURE_2D || - target == GL_TEXTURE_CUBE_MAP); + return (target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP); } bool GraphicsContext3DInternal::validateTextureParameter(int param) { - return (param == GL_TEXTURE_MAG_FILTER || - param == GL_TEXTURE_MIN_FILTER || - param == GL_TEXTURE_WRAP_S || - param == GL_TEXTURE_WRAP_T); + return (param == GL_TEXTURE_MAG_FILTER + || param == GL_TEXTURE_MIN_FILTER + || param == GL_TEXTURE_WRAP_S + || param == GL_TEXTURE_WRAP_T); } void GraphicsContext3DInternal::activeTexture(unsigned long texture) @@ -828,7 +824,7 @@ void GraphicsContext3DInternal::bindTexture(unsigned long target, // API. On desktop OpenGL implementations it seems necessary to // set this wrap mode to GL_CLAMP_TO_EDGE to get correct behavior // of cube maps. - if (texture != NULL) { + if (texture) { if (target == GL_TEXTURE_CUBE_MAP) { if (!texture->isCubeMapRWrapModeInitialized()) { glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); @@ -863,9 +859,8 @@ void GraphicsContext3DInternal::bufferDataImpl(unsigned long target, int size, c void GraphicsContext3DInternal::disableVertexAttribArray(unsigned long index) { makeContextCurrent(); - if (index < NumTrackedPointerStates) { + if (index < NumTrackedPointerStates) m_vertexAttribPointerState[index].enabled = false; - } glDisableVertexAttribArray(index); } @@ -918,91 +913,106 @@ void GraphicsContext3DInternal::viewportImpl(long x, long y, unsigned long width #define GL_SAME_METHOD_0(glname, name) \ void GraphicsContext3D::name() \ { \ - makeContextCurrent(); gl##glname(); \ + makeContextCurrent(); \ + gl##glname(); \ } #define GL_SAME_METHOD_1(glname, name, t1) \ void GraphicsContext3D::name(t1 a1) \ { \ - makeContextCurrent(); gl##glname(a1); \ + makeContextCurrent(); \ + gl##glname(a1); \ } #define GL_SAME_METHOD_1_X(glname, name, t1) \ void GraphicsContext3D::name(t1 a1) \ { \ - makeContextCurrent(); gl##glname(EXTRACT(a1)); \ + makeContextCurrent(); \ + gl##glname(EXTRACT(a1)); \ } #define GL_SAME_METHOD_2(glname, name, t1, t2) \ void GraphicsContext3D::name(t1 a1, t2 a2) \ { \ - makeContextCurrent(); gl##glname(a1,a2); \ + makeContextCurrent(); \ + gl##glname(a1, a2); \ } #define GL_SAME_METHOD_2_X12(glname, name, t1, t2) \ void GraphicsContext3D::name(t1 a1, t2 a2) \ { \ - makeContextCurrent(); gl##glname(EXTRACT(a1),EXTRACT(a2)); \ + makeContextCurrent(); \ + gl##glname(EXTRACT(a1), EXTRACT(a2)); \ } #define GL_SAME_METHOD_2_X2(glname, name, t1, t2) \ void GraphicsContext3D::name(t1 a1, t2 a2) \ { \ - makeContextCurrent(); gl##glname(a1,EXTRACT(a2)); \ + makeContextCurrent(); \ + gl##glname(a1, EXTRACT(a2)); \ } #define GL_SAME_METHOD_3(glname, name, t1, t2, t3) \ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3) \ { \ - makeContextCurrent(); gl##glname(a1,a2,a3); \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3); \ } #define GL_SAME_METHOD_3_X12(glname, name, t1, t2, t3) \ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3) \ { \ - makeContextCurrent(); gl##glname(EXTRACT(a1),EXTRACT(a2),a3); \ + makeContextCurrent(); \ + gl##glname(EXTRACT(a1), EXTRACT(a2), a3); \ } #define GL_SAME_METHOD_3_X2(glname, name, t1, t2, t3) \ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3) \ { \ - makeContextCurrent(); gl##glname(a1,EXTRACT(a2),a3); \ + makeContextCurrent(); \ + gl##glname(a1, EXTRACT(a2), a3); \ } #define GL_SAME_METHOD_4(glname, name, t1, t2, t3, t4) \ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \ { \ - makeContextCurrent(); gl##glname(a1,a2,a3,a4); \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, a4); \ } #define GL_SAME_METHOD_4_X4(glname, name, t1, t2, t3, t4) \ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4) \ { \ - makeContextCurrent(); gl##glname(a1,a2,a3,EXTRACT(a4)); \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, EXTRACT(a4)); \ } #define GL_SAME_METHOD_5(glname, name, t1, t2, t3, t4, t5) \ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ { \ - makeContextCurrent(); gl##glname(a1,a2,a3,a4,a5); \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, a4, a5); \ } #define GL_SAME_METHOD_5_X4(glname, name, t1, t2, t3, t4, t5) \ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \ { \ - makeContextCurrent(); gl##glname(a1,a2,a3,EXTRACT(a4),a5); \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, EXTRACT(a4), a5); \ } #define GL_SAME_METHOD_6(glname, name, t1, t2, t3, t4, t5, t6) \ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) \ { \ - makeContextCurrent(); gl##glname(a1,a2,a3,a4,a5,a6); \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, a4, a5, a6); \ } -#define GL_SAME_METHOD_8(glname, name, t1, t2, t3, t4, t5, t6, t7, t8) \ +#define GL_SAME_METHOD_8(glname, name, t1, t2, t3, t4, t5, t6, t7, t8) \ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8 a8) \ -{ \ - makeContextCurrent(); gl##glname(a1,a2,a3,a4,a5,a6,a7,a8); \ +{ \ + makeContextCurrent(); \ + gl##glname(a1, a2, a3, a4, a5, a6, a7, a8); \ } PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create() @@ -1066,22 +1076,22 @@ void GraphicsContext3D::endPaint() int GraphicsContext3D::sizeInBytes(int type) { switch (type) { - case GL_BYTE: - return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: - return sizeof(GLubyte); - case GL_SHORT: - return sizeof(GLshort); - case GL_UNSIGNED_SHORT: - return sizeof(GLushort); - case GL_INT: - return sizeof(GLint); - case GL_UNSIGNED_INT: - return sizeof(GLuint); - case GL_FLOAT: - return sizeof(GLfloat); - default: - return 0; + case GL_BYTE: + return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: + return sizeof(GLubyte); + case GL_SHORT: + return sizeof(GLshort); + case GL_UNSIGNED_SHORT: + return sizeof(GLushort); + case GL_INT: + return sizeof(GLint); + case GL_UNSIGNED_INT: + return sizeof(GLuint); + case GL_FLOAT: + return sizeof(GLfloat); + default: // FIXME: default cases are discouraged in WebKit. + return 0; } } @@ -1213,7 +1223,7 @@ GL_SAME_METHOD_4(BlendFuncSeparate, blendFuncSeparate, unsigned long, unsigned l void GraphicsContext3D::bufferData(unsigned long target, int size, unsigned long usage) { - m_internal->bufferDataImpl(target, size, NULL, usage); + m_internal->bufferDataImpl(target, size, 0, usage); } void GraphicsContext3D::bufferData(unsigned long target, CanvasArray* array, unsigned long usage) @@ -1290,19 +1300,19 @@ void GraphicsContext3D::disableVertexAttribArray(unsigned long index) void GraphicsContext3D::drawArrays(unsigned long mode, long first, long count) { switch (mode) { - case GL_TRIANGLES: - case GL_TRIANGLE_STRIP: - case GL_TRIANGLE_FAN: - case GL_POINTS: - case GL_LINE_STRIP: - case GL_LINE_LOOP: - case GL_LINES: - break; - default: - // FIXME: output log message, raise exception. - // LogMessage(NS_LITERAL_CSTRING("drawArrays: invalid mode")); - // return NS_ERROR_DOM_SYNTAX_ERR; - return; + case GL_TRIANGLES: + case GL_TRIANGLE_STRIP: + case GL_TRIANGLE_FAN: + case GL_POINTS: + case GL_LINE_STRIP: + case GL_LINE_LOOP: + case GL_LINES: + break; + default: // FIXME: default cases are discouraged in WebKit. + // FIXME: output log message, raise exception. + // LogMessage(NS_LITERAL_CSTRING("drawArrays: invalid mode")); + // return NS_ERROR_DOM_SYNTAX_ERR; + return; } if (first+count < first || first+count < count) { @@ -1356,9 +1366,8 @@ GL_SAME_METHOD_1(FrontFace, frontFace, unsigned long) void GraphicsContext3D::generateMipmap(unsigned long target) { makeContextCurrent(); - if (glGenerateMipmapEXT) { + if (glGenerateMipmapEXT) glGenerateMipmapEXT(target); - } // FIXME: provide alternative code path? This will be unpleasant // to implement if glGenerateMipmapEXT is not available -- it will // require a texture readback and re-upload. @@ -1372,7 +1381,7 @@ bool GraphicsContext3D::getActiveAttrib(CanvasProgram* program, unsigned long in glGetProgramiv(EXTRACT(program), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxNameLength); if (maxNameLength < 0) return false; - GLchar* name = NULL; + GLchar* name = 0; if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) return false; GLsizei length = 0; @@ -1399,7 +1408,7 @@ bool GraphicsContext3D::getActiveUniform(CanvasProgram* program, unsigned long i glGetProgramiv(EXTRACT(program), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameLength); if (maxNameLength < 0) return false; - GLchar* name = NULL; + GLchar* name = 0; if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) return false; GLsizei length = 0; @@ -1440,7 +1449,7 @@ PassRefPtr<CanvasUnsignedByteArray> GraphicsContext3D::getBooleanv(unsigned long { // FIXME: implement. notImplemented(); - return NULL; + return 0; } int GraphicsContext3D::getBufferParameteri(unsigned long target, unsigned long pname) @@ -1455,7 +1464,7 @@ PassRefPtr<CanvasIntArray> GraphicsContext3D::getBufferParameteriv(unsigned long { // FIXME: implement. notImplemented(); - return NULL; + return 0; } unsigned long GraphicsContext3D::getError() @@ -1477,7 +1486,7 @@ PassRefPtr<CanvasFloatArray> GraphicsContext3D::getFloatv(unsigned long pname) { // FIXME: implement. notImplemented(); - return NULL; + return 0; } int GraphicsContext3D::getFramebufferAttachmentParameteri(unsigned long target, @@ -1496,7 +1505,7 @@ PassRefPtr<CanvasIntArray> GraphicsContext3D::getFramebufferAttachmentParameteri { // FIXME: implement. notImplemented(); - return NULL; + return 0; } int GraphicsContext3D::getInteger(unsigned long pname) @@ -1512,7 +1521,7 @@ PassRefPtr<CanvasIntArray> GraphicsContext3D::getIntegerv(unsigned long pname) { // FIXME: implement. notImplemented(); - return NULL; + return 0; } int GraphicsContext3D::getProgrami(CanvasProgram* program, @@ -1529,7 +1538,7 @@ PassRefPtr<CanvasIntArray> GraphicsContext3D::getProgramiv(CanvasProgram* progra { // FIXME: implement. notImplemented(); - return NULL; + return 0; } String GraphicsContext3D::getProgramInfoLog(CanvasProgram* program) @@ -1538,9 +1547,9 @@ String GraphicsContext3D::getProgramInfoLog(CanvasProgram* program) GLuint programID = EXTRACT(program); GLint logLength; glGetProgramiv(programID, GL_INFO_LOG_LENGTH, &logLength); - if (logLength == 0) + if (!logLength) return String(); - GLchar* log = NULL; + GLchar* log = 0; if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) return String(); GLsizei returnedLogLength; @@ -1565,7 +1574,7 @@ PassRefPtr<CanvasIntArray> GraphicsContext3D::getRenderbufferParameteriv(unsigne { // FIXME: implement. notImplemented(); - return NULL; + return 0; } int GraphicsContext3D::getShaderi(CanvasShader* shader, @@ -1582,7 +1591,7 @@ PassRefPtr<CanvasIntArray> GraphicsContext3D::getShaderiv(CanvasShader* shader, { // FIXME: implement. notImplemented(); - return NULL; + return 0; } String GraphicsContext3D::getShaderInfoLog(CanvasShader* shader) @@ -1591,9 +1600,9 @@ String GraphicsContext3D::getShaderInfoLog(CanvasShader* shader) GLuint shaderID = EXTRACT(shader); GLint logLength; glGetShaderiv(shaderID, GL_INFO_LOG_LENGTH, &logLength); - if (logLength == 0) + if (!logLength) return String(); - GLchar* log = NULL; + GLchar* log = 0; if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) return String(); GLsizei returnedLogLength; @@ -1610,9 +1619,9 @@ String GraphicsContext3D::getShaderSource(CanvasShader* shader) GLuint shaderID = EXTRACT(shader); GLint logLength; glGetShaderiv(shaderID, GL_SHADER_SOURCE_LENGTH, &logLength); - if (logLength == 0) + if (!logLength) return String(); - GLchar* log = NULL; + GLchar* log = 0; if (!tryFastMalloc(logLength * sizeof(GLchar)).getValue(log)) return String(); GLsizei returnedLogLength; @@ -1651,7 +1660,7 @@ PassRefPtr<CanvasFloatArray> GraphicsContext3D::getTexParameterfv(unsigned long { // FIXME: implement. notImplemented(); - return NULL; + return 0; } int GraphicsContext3D::getTexParameteri(unsigned long target, unsigned long pname) @@ -1676,7 +1685,7 @@ PassRefPtr<CanvasIntArray> GraphicsContext3D::getTexParameteriv(unsigned long ta { // FIXME: implement. notImplemented(); - return NULL; + return 0; } float GraphicsContext3D::getUniformf(CanvasProgram* program, long location) @@ -1690,7 +1699,7 @@ PassRefPtr<CanvasFloatArray> GraphicsContext3D::getUniformfv(CanvasProgram* prog { // FIXME: implement. notImplemented(); - return NULL; + return 0; } int GraphicsContext3D::getUniformi(CanvasProgram* program, long location) @@ -1704,7 +1713,7 @@ PassRefPtr<CanvasIntArray> GraphicsContext3D::getUniformiv(CanvasProgram* progra { // FIXME: implement. notImplemented(); - return NULL; + return 0; } long GraphicsContext3D::getUniformLocation(CanvasProgram* program, const String& name) @@ -1729,7 +1738,7 @@ PassRefPtr<CanvasFloatArray> GraphicsContext3D::getVertexAttribfv(unsigned long { // FIXME: implement. notImplemented(); - return NULL; + return 0; } int GraphicsContext3D::getVertexAttribi(unsigned long index, @@ -1737,7 +1746,7 @@ int GraphicsContext3D::getVertexAttribi(unsigned long index, { // FIXME: implement. notImplemented(); - return NULL; + return 0; } PassRefPtr<CanvasIntArray> GraphicsContext3D::getVertexAttribiv(unsigned long index, @@ -1745,7 +1754,7 @@ PassRefPtr<CanvasIntArray> GraphicsContext3D::getVertexAttribiv(unsigned long in { // FIXME: implement. notImplemented(); - return NULL; + return 0; } long GraphicsContext3D::getVertexAttribOffset(unsigned long index, unsigned long pname) @@ -1805,10 +1814,8 @@ GL_SAME_METHOD_1_X(LinkProgram, linkProgram, CanvasProgram*) void GraphicsContext3D::pixelStorei(unsigned long pname, long param) { - if (pname != GL_PACK_ALIGNMENT && - pname != GL_UNPACK_ALIGNMENT) { - // FIXME: force fake GL error to be produced and throw - // exception. + if (pname != GL_PACK_ALIGNMENT && pname != GL_UNPACK_ALIGNMENT) { + // FIXME: Create a fake GL error and throw an exception. return; } @@ -1822,9 +1829,8 @@ PassRefPtr<CanvasArray> GraphicsContext3D::readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type) { // FIXME: support more pixel formats and types. - if (!((format == GL_RGBA) && (type == GL_UNSIGNED_BYTE))) { + if (!((format == GL_RGBA) && (type == GL_UNSIGNED_BYTE))) return 0; - } // FIXME: take into account pack alignment. RefPtr<CanvasUnsignedByteArray> array = CanvasUnsignedByteArray::create(width * height * 4); @@ -1953,8 +1959,8 @@ static int texImage2DHelper(unsigned target, unsigned level, 0, format, GL_UNSIGNED_BYTE, - NULL); - unsigned char* row = NULL; + 0); + unsigned char* row = 0; bool allocatedRow = false; if (!premultiplyAlpha) { row = new unsigned char[rowBytes]; @@ -1994,7 +2000,7 @@ static int texImage2DHelper(unsigned target, unsigned level, 0, format, GL_UNSIGNED_BYTE, - NULL); + 0); unsigned char* row = new unsigned char[rowBytes]; for (int i = 0; i < height; i++) { memcpy(row, pixels + (rowBytes * i), rowBytes); @@ -2019,7 +2025,7 @@ int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image, int res = -1; #if PLATFORM(SKIA) NativeImageSkia* skiaImage = image->nativeImageForCurrentFrame(); - if (skiaImage == NULL) { + if (!skiaImage) { ASSERT_NOT_REACHED(); return -1; } @@ -2045,7 +2051,7 @@ int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image, pixels); #elif PLATFORM(CG) CGImageRef cgImage = image->nativeImageForCurrentFrame(); - if (cgImage == NULL) { + if (!cgImage) { ASSERT_NOT_REACHED(); return -1; } @@ -2053,9 +2059,9 @@ int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image, int height = CGImageGetHeight(cgImage); int rowBytes = width * 4; CGImageAlphaInfo info = CGImageGetAlphaInfo(cgImage); - bool skipAlpha = (info == kCGImageAlphaNone || - info == kCGImageAlphaNoneSkipLast || - info == kCGImageAlphaNoneSkipFirst); + 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, diff --git a/webkit/api/src/NotificationPresenterImpl.cpp b/webkit/api/src/NotificationPresenterImpl.cpp index 6f879b3..6b22319 100644 --- a/webkit/api/src/NotificationPresenterImpl.cpp +++ b/webkit/api/src/NotificationPresenterImpl.cpp @@ -33,12 +33,13 @@ #if ENABLE(NOTIFICATIONS) +#include "Notification.h" +#include "SecurityOrigin.h" + #include "WebNotification.h" #include "WebNotificationPermissionCallback.h" #include "WebNotificationPresenter.h" -#include "Notification.h" -#include "SecurityOrigin.h" #include <wtf/PassRefPtr.h> using namespace WebCore; @@ -70,7 +71,7 @@ void NotificationPresenterImpl::initialize(WebNotificationPresenter* presenter) bool NotificationPresenterImpl::isInitialized() { - return m_presenter != 0; + return !!m_presenter; } bool NotificationPresenterImpl::show(Notification* notification) diff --git a/webkit/api/src/PlatformMessagePortChannel.cpp b/webkit/api/src/PlatformMessagePortChannel.cpp index dda7c31..f8c41d3 100644 --- a/webkit/api/src/PlatformMessagePortChannel.cpp +++ b/webkit/api/src/PlatformMessagePortChannel.cpp @@ -31,15 +31,15 @@ #include "config.h" #include "PlatformMessagePortChannel.h" +#include "MessagePort.h" +#include "ScriptExecutionContext.h" +#include "SerializedScriptValue.h" + #include "WebKit.h" #include "WebKitClient.h" #include "WebMessagePortChannel.h" #include "WebString.h" -#include "MessagePort.h" -#include "ScriptExecutionContext.h" -#include "SerializedScriptValue.h" - using namespace WebKit; namespace WebCore { @@ -102,8 +102,8 @@ bool MessagePortChannel::hasPendingActivity() MessagePort* MessagePortChannel::locallyEntangledPort(const ScriptExecutionContext* context) { - // This is just an optimization, so return NULL always. - return NULL; + // This is just an optimization, so return 0 always. + return 0; } @@ -181,7 +181,7 @@ void PlatformMessagePortChannel::postMessageToRemote(PassOwnPtr<MessagePortChann WebString messageString = message->message()->toString(); OwnPtr<WebCore::MessagePortChannelArray> channels = message->channels(); - WebMessagePortChannelArray* webChannels = NULL; + WebMessagePortChannelArray* webChannels = 0; if (channels.get() && channels->size()) { webChannels = new WebMessagePortChannelArray(channels->size()); for (size_t i = 0; i < channels->size(); ++i) { diff --git a/webkit/api/src/ResourceHandle.cpp b/webkit/api/src/ResourceHandle.cpp index 6efbcd2..6cecd1d 100644 --- a/webkit/api/src/ResourceHandle.cpp +++ b/webkit/api/src/ResourceHandle.cpp @@ -31,6 +31,9 @@ #include "config.h" #include "ResourceHandle.h" +#include "ResourceHandleClient.h" +#include "ResourceRequest.h" + #include "WebKit.h" #include "WebKitClient.h" #include "WebURLError.h" @@ -41,9 +44,6 @@ #include "WrappedResourceRequest.h" #include "WrappedResourceResponse.h" -#include "ResourceHandleClient.h" -#include "ResourceRequest.h" - using namespace WebKit; namespace WebCore { diff --git a/webkit/api/src/SharedWorkerRepository.cpp b/webkit/api/src/SharedWorkerRepository.cpp index 5154548..f67a7dd 100644 --- a/webkit/api/src/SharedWorkerRepository.cpp +++ b/webkit/api/src/SharedWorkerRepository.cpp @@ -55,7 +55,7 @@ namespace WebCore { class Document; -using WebKit::WebFrameImpl;; +using WebKit::WebFrameImpl; using WebKit::WebMessagePortChannel; using WebKit::WebSharedWorker; using WebKit::WebSharedWorkerRepository; @@ -63,13 +63,13 @@ using WebKit::WebSharedWorkerRepository; // Callback class that keeps the SharedWorker and WebSharedWorker objects alive while loads are potentially happening, and also translates load errors into error events on the worker. class SharedWorkerScriptLoader : private WorkerScriptLoaderClient, private WebSharedWorker::ConnectListener, private ActiveDOMObject { public: - SharedWorkerScriptLoader(PassRefPtr<SharedWorker> worker, const KURL& url, const String& name, PassOwnPtr<MessagePortChannel> port, PassOwnPtr<WebSharedWorker> webWorker) - : ActiveDOMObject(worker->scriptExecutionContext(), this) - , m_worker(worker) - , m_url(url) - , m_name(name) - , m_webWorker(webWorker) - , m_port(port) + SharedWorkerScriptLoader(PassRefPtr<SharedWorker> worker, const KURL& url, const String& name, PassOwnPtr<MessagePortChannel> port, PassOwnPtr<WebSharedWorker> webWorker) + : ActiveDOMObject(worker->scriptExecutionContext(), this) + , m_worker(worker) + , m_url(url) + , m_name(name) + , m_webWorker(webWorker) + , m_port(port) { } diff --git a/webkit/api/src/StorageEventDispatcherImpl.cpp b/webkit/api/src/StorageEventDispatcherImpl.cpp index f07a5e0..3518796 100644 --- a/webkit/api/src/StorageEventDispatcherImpl.cpp +++ b/webkit/api/src/StorageEventDispatcherImpl.cpp @@ -73,7 +73,7 @@ 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) { - frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key,oldValue, newValue, + frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, frames[i]->domWindow()->localStorage())); } } diff --git a/webkit/api/src/WebAccessibilityCacheImpl.cpp b/webkit/api/src/WebAccessibilityCacheImpl.cpp index 232a765..03e5f46 100644 --- a/webkit/api/src/WebAccessibilityCacheImpl.cpp +++ b/webkit/api/src/WebAccessibilityCacheImpl.cpp @@ -35,6 +35,7 @@ #include "AXObjectCache.h" #include "Document.h" #include "Frame.h" + #include "WebAccessibilityObject.h" #include "WebFrameImpl.h" #include "WebViewImpl.h" @@ -145,7 +146,8 @@ void WebAccessibilityCacheImpl::clear() m_idMap.clear(); } -int WebAccessibilityCacheImpl::addOrGetId(const WebAccessibilityObject& object) { +int WebAccessibilityCacheImpl::addOrGetId(const WebAccessibilityObject& object) +{ if (object.isNull()) return invalidObjectId; diff --git a/webkit/api/src/WebCString.cpp b/webkit/api/src/WebCString.cpp index 8e10659..82fbac0 100644 --- a/webkit/api/src/WebCString.cpp +++ b/webkit/api/src/WebCString.cpp @@ -31,11 +31,11 @@ #include "config.h" #include "WebCString.h" -#include "WebString.h" - #include "CString.h" #include "TextEncoding.h" +#include "WebString.h" + namespace WebKit { class WebCStringPrivate : public WebCore::CStringBuffer { diff --git a/webkit/api/src/WebFrameImpl.cpp b/webkit/api/src/WebFrameImpl.cpp index 3ef8631..19f7d42 100644 --- a/webkit/api/src/WebFrameImpl.cpp +++ b/webkit/api/src/WebFrameImpl.cpp @@ -71,8 +71,6 @@ #include "config.h" #include "WebFrameImpl.h" -#include <algorithm> - #include "Chrome.h" #include "ChromiumBridge.h" #include "ClipboardUtilitiesChromium.h" @@ -81,8 +79,8 @@ #include "DocumentFragment.h" // Only needed for ReplaceSelectionCommand.h :( #include "DocumentLoader.h" #include "DocumentMarker.h" -#include "DOMWindow.h" #include "DOMUtilitiesPrivate.h" +#include "DOMWindow.h" #include "Editor.h" #include "EventHandler.h" #include "FormState.h" @@ -92,14 +90,14 @@ #include "FrameTree.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "HistoryItem.h" #include "HTMLCollection.h" -#include "HTMLHeadElement.h" -#include "HTMLInputElement.h" #include "HTMLFormElement.h" #include "HTMLFrameOwnerElement.h" +#include "HTMLHeadElement.h" +#include "HTMLInputElement.h" #include "HTMLLinkElement.h" #include "HTMLNames.h" -#include "HistoryItem.h" #include "InspectorController.h" #include "markup.h" #include "Page.h" @@ -120,9 +118,8 @@ #include "Settings.h" #include "SkiaUtils.h" #include "SubstituteData.h" -#include "TextIterator.h" #include "TextAffinity.h" -#include "XPathResult.h" +#include "TextIterator.h" #include "WebConsoleMessage.h" #include "WebDataSourceImpl.h" #include "WebFindOptions.h" @@ -139,8 +136,12 @@ #include "WebURLError.h" #include "WebVector.h" #include "WebViewImpl.h" +#include "XPathResult.h" + +#include <algorithm> #include <wtf/CurrentTime.h> + #if PLATFORM(DARWIN) #include "LocalCurrentGraphicsContext.h" #endif @@ -184,7 +185,7 @@ static void frameContentAsPlainText(size_t maxChars, Frame* frame, ExceptionCode exception = 0; range->selectNodeContents(doc->body(), exception); - if (exception == 0) { + if (!exception) { // The text iterator will walk nodes giving us text. This is similar to // the plainText() function in TextIterator.h, but we implement the maximum // size and also copy the results directly into a wstring, avoiding the @@ -192,7 +193,7 @@ static void frameContentAsPlainText(size_t maxChars, Frame* frame, for (TextIterator it(range.get()); !it.atEnd(); it.advance()) { const UChar* chars = it.characters(); if (!chars) { - if (it.length() != 0) { + if (it.length()) { // It appears from crash reports that an iterator can get into a state // where the character count is nonempty but the character pointer is // null. advance()ing it will then just add that many to the null @@ -377,7 +378,7 @@ WebURL WebFrameImpl::openSearchDescriptionURL() const HTMLHeadElement* head = m_frame->document()->head(); if (head) { RefPtr<HTMLCollection> children = head->children(); - for (Node* child = children->firstItem(); child != 0; child = children->nextItem()) { + for (Node* child = children->firstItem(); child; child = children->nextItem()) { HTMLLinkElement* linkElement = toHTMLLinkElement(child); if (linkElement && linkElement->type() == osdType @@ -406,9 +407,8 @@ WebSize WebFrameImpl::contentsSize() const int WebFrameImpl::contentsPreferredWidth() const { - if ((m_frame->document() != 0) && (m_frame->document()->renderView() != 0)) + if (m_frame->document() && m_frame->document()->renderView()) return m_frame->document()->renderView()->minPrefWidth(); - return 0; } @@ -432,7 +432,7 @@ WebFrame* WebFrameImpl::opener() const WebFrame* WebFrameImpl::parent() const { - Frame *parent = 0; + Frame* parent = 0; if (m_frame) parent = m_frame->tree()->parent(); return fromFrame(parent); @@ -1163,7 +1163,7 @@ bool WebFrameImpl::find(int identifier, options.forward ? ++m_activeMatchIndex : --m_activeMatchIndex; if (m_activeMatchIndex + 1 > m_lastMatchCount) m_activeMatchIndex = 0; - if (m_activeMatchIndex + 1 == 0) + if (m_activeMatchIndex == -1) m_activeMatchIndex = m_lastMatchCount - 1; } if (selectionRect) { @@ -1244,8 +1244,8 @@ void WebFrameImpl::scopeStringMatches(int identifier, searchRange->setStart(m_resumeScopingFromRange->startContainer(), m_resumeScopingFromRange->startOffset(ec2) + 1, ec); - if (ec != 0 || ec2 != 0) { - if (ec2 != 0) // A non-zero |ec| happens when navigating during search. + if (ec || ec2) { + if (ec2) // A non-zero |ec| happens when navigating during search. ASSERT_NOT_REACHED(); return; } @@ -1372,7 +1372,7 @@ void WebFrameImpl::scopeStringMatches(int identifier, // If this is the last frame to finish scoping we need to trigger the final // update to be sent. - if (mainFrameImpl->m_framesScopingCount == 0) + if (!mainFrameImpl->m_framesScopingCount) mainFrameImpl->increaseMatchCount(0, identifier); // This frame is done, so show any scrollbar tickmarks we haven't drawn yet. @@ -1395,10 +1395,8 @@ void WebFrameImpl::increaseMatchCount(int count, int identifier) m_totalMatchCount += count; // Update the UI with the latest findings. - if (client()) { - client()->reportFindInPageMatchCount(identifier, m_totalMatchCount, - m_framesScopingCount == 0); - } + if (client()) + client()->reportFindInPageMatchCount(identifier, m_totalMatchCount, !m_framesScopingCount); } void WebFrameImpl::reportFindInPageSelection(const WebRect& selectionRect, @@ -1406,11 +1404,8 @@ void WebFrameImpl::reportFindInPageSelection(const WebRect& selectionRect, int identifier) { // Update the UI with the latest selection rect. - if (client()) { - client()->reportFindInPageSelection( - identifier, ordinalOfFirstMatchForFrame(this) + activeMatchOrdinal, - selectionRect); - } + if (client()) + client()->reportFindInPageSelection(identifier, ordinalOfFirstMatchForFrame(this) + activeMatchOrdinal, selectionRect); } void WebFrameImpl::resetMatchCount() @@ -1576,8 +1571,7 @@ void WebFrameImpl::createFrameView() Page* page = m_frame->page(); ASSERT(page); - - ASSERT(page->mainFrame() != 0); + ASSERT(page->mainFrame()); bool isMainFrame = m_frame == page->mainFrame(); if (isMainFrame && m_frame->view()) @@ -1805,7 +1799,7 @@ bool WebFrameImpl::shouldScopeMatches(const String& searchText) // If the frame completed the scoping operation and found 0 matches the last // time it was searched, then we don't have to search it again if the user is // just adding to the search string or sending the same search string again. - if (m_scopingComplete && !m_lastSearchString.isEmpty() && m_lastMatchCount == 0) { + if (m_scopingComplete && !m_lastSearchString.isEmpty() && !m_lastMatchCount) { // Check to see if the search string prefixes match. String previousSearchPrefix = searchText.substring(0, m_lastSearchString.length()); diff --git a/webkit/api/src/WebImageCG.cpp b/webkit/api/src/WebImageCG.cpp index 9e7692b..60b2449 100644 --- a/webkit/api/src/WebImageCG.cpp +++ b/webkit/api/src/WebImageCG.cpp @@ -31,14 +31,15 @@ #include "config.h" #include "WebImage.h" -#include <CoreGraphics/CGImage.h> +#include "Image.h" +#include "ImageSource.h" +#include "SharedBuffer.h" #include "WebData.h" #include "WebSize.h" -#include "Image.h" -#include "ImageSource.h" -#include "SharedBuffer.h" +#include <CoreGraphics/CGImage.h> + #include <wtf/PassRefPtr.h> #include <wtf/RetainPtr.h> @@ -77,7 +78,7 @@ void WebImage::assign(const WebImage& image) bool WebImage::isNull() const { - return m_imageRef == 0; + return !m_imageRef; } WebSize WebImage::size() const diff --git a/webkit/api/src/WebInputEventConversion.cpp b/webkit/api/src/WebInputEventConversion.cpp index 125789a..1500129 100644 --- a/webkit/api/src/WebInputEventConversion.cpp +++ b/webkit/api/src/WebInputEventConversion.cpp @@ -31,8 +31,6 @@ #include "config.h" #include "WebInputEventConversion.h" -#include "WebInputEvent.h" - #include "EventNames.h" #include "KeyboardCodes.h" #include "KeyboardEvent.h" @@ -41,6 +39,7 @@ #include "PlatformMouseEvent.h" #include "PlatformWheelEvent.h" #include "ScrollView.h" +#include "WebInputEvent.h" #include "Widget.h" using namespace WebCore; @@ -56,10 +55,10 @@ PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMo m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y)); m_globalPosition = IntPoint(e.globalX, e.globalY); m_button = static_cast<MouseButton>(e.button); - m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey) != 0; - m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey) != 0; - m_altKey = (e.modifiers & WebInputEvent::AltKey) != 0; - m_metaKey = (e.modifiers & WebInputEvent::MetaKey) != 0; + m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey); + m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey); + m_altKey = (e.modifiers & WebInputEvent::AltKey); + m_metaKey = (e.modifiers & WebInputEvent::MetaKey); m_modifierFlags = e.modifiers; m_timestamp = e.timeStampSeconds; m_clickCount = e.clickCount; @@ -96,10 +95,10 @@ PlatformWheelEventBuilder::PlatformWheelEventBuilder(Widget* widget, const WebMo m_isAccepted = false; m_granularity = e.scrollByPage ? ScrollByPageWheelEvent : ScrollByPixelWheelEvent; - m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey) != 0; - m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey) != 0; - m_altKey = (e.modifiers & WebInputEvent::AltKey) != 0; - m_metaKey = (e.modifiers & WebInputEvent::MetaKey) != 0; + m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey); + m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey); + m_altKey = (e.modifiers & WebInputEvent::AltKey); + m_metaKey = (e.modifiers & WebInputEvent::MetaKey); } // MakePlatformKeyboardEvent -------------------------------------------------- @@ -127,14 +126,14 @@ PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven m_text = String(e.text); m_unmodifiedText = String(e.unmodifiedText); m_keyIdentifier = String(e.keyIdentifier); - m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat) != 0; + m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); m_windowsVirtualKeyCode = e.windowsKeyCode; m_nativeVirtualKeyCode = e.nativeKeyCode; - m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad) != 0; - m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey) != 0; - m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey) != 0; - m_altKey = (e.modifiers & WebInputEvent::AltKey) != 0; - m_metaKey = (e.modifiers & WebInputEvent::MetaKey) != 0; + m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); + m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey); + m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey); + m_altKey = (e.modifiers & WebInputEvent::AltKey); + m_metaKey = (e.modifiers & WebInputEvent::MetaKey); m_isSystemKey = e.isSystemKey; } @@ -232,7 +231,8 @@ WebMouseEventBuilder::WebMouseEventBuilder(const ScrollView* view, const MouseEv y = event.offsetY(); } -WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) { +WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) +{ if (event.type() == eventNames().keydownEvent) type = KeyDown; else if (event.type() == eventNames().keyupEvent) diff --git a/webkit/api/src/WebKit.cpp b/webkit/api/src/WebKit.cpp index 45af097..a129f85 100644 --- a/webkit/api/src/WebKit.cpp +++ b/webkit/api/src/WebKit.cpp @@ -31,15 +31,15 @@ #include "config.h" #include "WebKit.h" -#include "WebMediaPlayerClientImpl.h" - #include "AtomicString.h" #include "DOMTimer.h" #include "Page.h" #include "RuntimeEnabledFeatures.h" #include "TextEncoding.h" +#include "WebMediaPlayerClientImpl.h" #include "WebSocket.h" #include "WorkerContextExecutionProxy.h" + #include <wtf/Assertions.h> #include <wtf/Threading.h> diff --git a/webkit/api/src/WebMediaPlayerClientImpl.cpp b/webkit/api/src/WebMediaPlayerClientImpl.cpp index 27de367..a873af4 100644 --- a/webkit/api/src/WebMediaPlayerClientImpl.cpp +++ b/webkit/api/src/WebMediaPlayerClientImpl.cpp @@ -7,6 +7,19 @@ #if ENABLE(VIDEO) +#include "CString.h" +#include "Frame.h" +#include "GraphicsContext.h" +#include "HTMLMediaElement.h" +#include "IntSize.h" +#include "KURL.h" +#include "MediaPlayer.h" +#include "NotImplemented.h" +#if WEBKIT_USING_SKIA +#include "PlatformContextSkia.h" +#endif +#include "TimeRanges.h" + #include "WebCanvas.h" #include "WebCString.h" #include "WebFrameClient.h" @@ -20,21 +33,8 @@ #include "WebString.h" #include "WebURL.h" -#include "CString.h" -#include "Frame.h" -#include "GraphicsContext.h" -#include "HTMLMediaElement.h" -#include "IntSize.h" -#include "KURL.h" -#include "MediaPlayer.h" -#include "NotImplemented.h" -#include "TimeRanges.h" #include <wtf/Assertions.h> -#if WEBKIT_USING_SKIA -#include "PlatformContextSkia.h" -#endif - using namespace WebCore; namespace WebKit { diff --git a/webkit/api/src/WebNode.cpp b/webkit/api/src/WebNode.cpp index 0d0695a..de676c3 100644 --- a/webkit/api/src/WebNode.cpp +++ b/webkit/api/src/WebNode.cpp @@ -33,11 +33,12 @@ #include "Document.h" #include "Frame.h" +#include "FrameLoaderClientImpl.h" #include "Node.h" -#include "FrameLoaderClientImpl.h" #include "WebFrameImpl.h" #include "WebString.h" + #include <wtf/PassRefPtr.h> using namespace WebCore; |