2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- more of https://bugs.webkit.org/show_bug.cgi?id=17257
start ref counts at 1 instead of 0 for speed
* kjs/nodes.cpp:
(KJS::ParserRefCounted::hasOneRef): Added. Replaces refcount.
* kjs/nodes.h: Replaced refcount with hasOneRef.
* wtf/ListRefPtr.h:
(WTF::ListRefPtr::~ListRefPtr): Changed to use hasOneRef instead of
refcount, so this class can be used with the RefCounted template.
* wtf/RefCounted.h:
(WTF::RefCounted::hasOneRef): Made const, since there's no reason for
it to be non-const.
WebCore:
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- more work on https://bugs.webkit.org/show_bug.cgi?id=17257
start ref counts at 1 instead of 0 for speed
* WebCore.base.exp: Added some new exports needed for functions that are now
non-virtual.
* WebCore.xcodeproj/project.pbxproj: Moved the "icon" group to the correct
location in the project. Before it was inside "appcache"!
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* dom/Clipboard.cpp:
(WebCore::Clipboard::Clipboard):
* editing/mac/EditorMac.mm:
(WebCore::Editor::newGeneralClipboard):
* editing/qt/EditorQt.cpp:
(WebCore::Editor::newGeneralClipboard):
* editing/wx/EditorWx.cpp:
(WebCore::Editor::newGeneralClipboard):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::DocumentLoader):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::create):
* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::defaultIcon):
(WebCore::IconDatabase::setIconDataForIconURL):
(WebCore::IconDatabase::setIconURLForPageURL):
(WebCore::IconDatabase::getOrCreateIconRecord):
(WebCore::IconDatabase::performURLImport):
* loader/icon/IconDatabase.h:
* loader/icon/IconRecord.cpp:
(WebCore::IconRecord::IconRecord):
* loader/icon/IconRecord.h:
(WebCore::IconRecord::create):
* page/EventHandler.h:
* page/Frame.cpp:
(WebCore::Frame::Frame):
* page/Frame.h:
(WebCore::Frame::create):
* page/gtk/EventHandlerGtk.cpp:
(WebCore::EventHandler::createDraggingClipboard):
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::createDraggingClipboard):
* page/qt/EventHandlerQt.cpp:
(WebCore::EventHandler::createDraggingClipboard):
* page/win/EventHandlerWin.cpp:
(WebCore::EventHandler::createDraggingClipboard):
* page/wx/EventHandlerWx.cpp:
(WebCore::EventHandler::createDraggingClipboard):
* platform/Cursor.h:
(WebCore::SharedCursor::create):
(WebCore::SharedCursor::~SharedCursor):
(WebCore::SharedCursor::SharedCursor):
* platform/DragData.h:
* platform/PopupMenu.h:
(WebCore::PopupMenu::create):
(WebCore::PopupMenu::isActive):
* platform/ScrollBar.cpp:
(WebCore::Scrollbar::Scrollbar):
* platform/SearchPopupMenu.h:
(WebCore::SearchPopupMenu::create):
* platform/graphics/FontFamily.cpp:
(WebCore::FontFamily::FontFamily):
(WebCore::operator==):
* platform/graphics/FontFamily.h:
(WebCore::FontFamily::FontFamily):
(WebCore::SharedFontFamily::create):
(WebCore::SharedFontFamily::SharedFontFamily):
(WebCore::operator!=):
(WebCore::FontFamily::next):
(WebCore::FontFamily::appendFamily):
(WebCore::FontFamily::releaseNext):
* platform/graphics/Icon.h:
* platform/graphics/gtk/IconGtk.cpp:
(WebCore::Icon::Icon):
(WebCore::Icon::~Icon):
(WebCore::Icon::newIconForFile):
* platform/graphics/mac/IconMac.mm:
(WebCore::Icon::Icon):
(WebCore::Icon::newIconForFile):
* platform/graphics/qt/IconQt.cpp:
(WebCore::Icon::Icon):
(WebCore::Icon::newIconForFile):
* platform/graphics/win/IconWin.cpp:
(WebCore::Icon::Icon):
(WebCore::Icon::~Icon):
(WebCore::Icon::newIconForFile):
* platform/gtk/ClipboardGtk.cpp:
(WebCore::Editor::newGeneralClipboard):
* platform/gtk/ClipboardGtk.h:
(WebCore::ClipboardGtk::create):
* platform/gtk/PlatformScrollBar.h:
(WebCore::PlatformScrollbar::create):
* platform/gtk/PopupMenuGtk.cpp:
(WebCore::PopupMenu::PopupMenu):
* platform/gtk/ScrollViewGtk.cpp:
(WebCore::ScrollViewScrollbar::create):
(WebCore::ScrollView::ScrollViewPrivate::setHasHorizontalScrollbar):
(WebCore::ScrollView::ScrollViewPrivate::setHasVerticalScrollbar):
* platform/mac/ClipboardMac.h:
(WebCore::ClipboardMac::create):
* platform/mac/DragDataMac.mm:
(WebCore::DragData::createClipboard):
(WebCore::DragData::containsCompatibleContent):
* platform/mac/PlatformScrollBar.h:
(WebCore::PlatformScrollbar::create):
(WebCore::PlatformScrollbar::horizontalScrollbarHeight):
(WebCore::PlatformScrollbar::verticalScrollbarWidth):
* platform/mac/PopupMenuMac.mm:
(WebCore::PopupMenu::PopupMenu):
* platform/qt/ClipboardQt.h:
(WebCore::ClipboardQt::create):
* platform/qt/DragDataQt.cpp:
(WebCore::DragData::createClipboard):
* platform/qt/PlatformScrollBar.h:
(WebCore::PlatformScrollbar::create):
* platform/qt/PopupMenuQt.cpp:
(WebCore::PopupMenu::PopupMenu):
* platform/qt/ScrollViewQt.cpp:
(WebCore::ScrollView::ScrollViewPrivate::setHasHorizontalScrollbar):
(WebCore::ScrollView::ScrollViewPrivate::setHasVerticalScrollbar):
* platform/win/ClipboardWin.h:
(WebCore::ClipboardWin::create):
* platform/win/CursorWin.cpp:
(WebCore::Cursor::Cursor):
(WebCore::loadSharedCursor):
* platform/win/DragDataWin.cpp:
(WebCore::DragData::createClipboard):
* platform/win/EditorWin.cpp:
(WebCore::Editor::newGeneralClipboard):
* platform/win/PlatformScrollBar.h:
(WebCore::PlatformScrollbar::create):
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenu::PopupMenu):
(WebCore::PopupMenu::show):
* platform/win/ScrollViewWin.cpp:
(WebCore::ScrollView::ScrollViewPrivate::setHasHorizontalScrollbar):
(WebCore::ScrollView::ScrollViewPrivate::setHasVerticalScrollbar):
* platform/wx/ClipboardWx.h:
(WebCore::ClipboardWx::create):
* platform/wx/PlatformScrollBar.h:
(WebCore::PlatformScrollbar::create):
* platform/wx/PopupMenuWx.cpp:
(WebCore::PopupMenu::PopupMenu):
* platform/wx/TemporaryLinkStubs.cpp:
(Icon::Icon):
(Icon::newIconForFile):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::createScrollbar):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::updateFromElement):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):
* svg/graphics/SVGImageEmptyClients.h:
(WebCore::SVGEmptyFrameLoaderClient::createDocumentLoader):
WebKit/gtk:
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- more https://bugs.webkit.org/show_bug.cgi?id=17257
start ref counts at 1 instead of 0 for speed
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::createDocumentLoader): Use create instead of new.
* webkit/webkitwebframe.cpp:
(webkit_web_frame_new): Ditto.
(webkit_web_frame_init_with_web_view): Ditto.
WebKit/mac:
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- more of https://bugs.webkit.org/show_bug.cgi?id=17257
start ref counts at 1 instead of 0 for speed
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::createDocumentLoader): Use create instead of new.
(WebFrameLoaderClient::createFrame): Remove now-obsolete adoptRef that was balanced by
a ref call inside the Frame constructor. The lifetime rules for Frame are now the
conventional ones without a special case.
* WebView/WebDataSource.mm:
(-[WebDataSource _initWithDocumentLoader:]): Changed argument to be a PassRefPtr, since
this function takes ownership of the DocumentLoader.
(-[WebDataSource initWithRequest:]): Use create instead of new.
* WebView/WebDataSourceInternal.h: Changed _initWithDocumentLoader argument to be a
PassRefPtr and also cleaned up the header a bit.
* WebView/WebDocumentLoaderMac.h:
(WebDocumentLoaderMac::create): Added. Also made the constructor and a couple of virtual
functions private.
* WebView/WebFrame.mm:
(+[WebFrame _createFrameWithPage:frameName:frameView:ownerElement:]): Use create instead
of new.
WebKit/qt:
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- more https://bugs.webkit.org/show_bug.cgi?id=17257
start ref counts at 1 instead of 0 for speed
* Api/qwebframe.cpp:
(QWebFramePrivate::init): Use create instead of new.
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::createDocumentLoader): Ditto.
WebKit/win:
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- more of https://bugs.webkit.org/show_bug.cgi?id=17257
start ref counts at 1 instead of 0 for speed
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::createFrame): Remove now-obsolete adoptRef that was balanced by
a ref call inside the Frame constructor. The lifetime rules for Frame are now the
conventional ones without a special case.
* WebFrame.cpp:
(WebFrame::init): Renamed function from initWithWebFrameView and removed the unused
IWebFrameView argument (every caller was passing 0). Also changed this to return the
WebCore Frame object, which is needed to straighten out the lifetime and ownership
issues.
* WebFrame.h: Ditto.
* WebView.cpp:
(WebView::initWithFrame): Changed to call new init function and use the return value.
WebKit/wx:
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
- more https://bugs.webkit.org/show_bug.cgi?id=17257
start ref counts at 1 instead of 0 for speed
* WebKitSupport/FrameLoaderClientWx.cpp:
(WebCore::FrameLoaderClientWx::createDocumentLoader): Use create function
instead of new.
LayoutTests:
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- test for https://bugs.webkit.org/show_bug.cgi?id=19538
<rdar://problem/
5957595> Reading transition property from the style JS gives the wrong value
* fast/dom/CSSStyleDeclaration/resources/transition-property-names.js: Added.
* fast/dom/CSSStyleDeclaration/transition-property-names-expected.txt: Added.
* fast/dom/CSSStyleDeclaration/transition-property-names.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34544
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - more of https://bugs.webkit.org/show_bug.cgi?id=17257
+ start ref counts at 1 instead of 0 for speed
+
+ * kjs/nodes.cpp:
+ (KJS::ParserRefCounted::hasOneRef): Added. Replaces refcount.
+ * kjs/nodes.h: Replaced refcount with hasOneRef.
+
+ * wtf/ListRefPtr.h:
+ (WTF::ListRefPtr::~ListRefPtr): Changed to use hasOneRef instead of
+ refcount, so this class can be used with the RefCounted template.
+
+ * wtf/RefCounted.h:
+ (WTF::RefCounted::hasOneRef): Made const, since there's no reason for
+ it to be non-const.
+
2008-06-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
2008-05-21 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Yet more windows build fixes
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-05-21 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Yet more windows build fixes
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-05-21 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Add DebuggerCallFrame.{h,cpp} to the project file
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-05-20 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Fixerate the windows build.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2008-05-09 Oliver Hunt <oliver@apple.com>
- Reviewed by Nobody (build fix).
-
Debug build fix
* kjs/JSGlobalObject.cpp:
2008-04-21 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY(Build fix)
-
Fix debug build
* kjs/nodes.cpp:
2008-03-24 Geoffrey Garen <ggaren@apple.com>
- Reviewed by NOBODY.
-
SquirrelFish lives.
Initial check-in of the code I've been carrying around. Lots of stuff
2007-12-04 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Build fix).
-
Fix gtk build.
* wtf/TCSystemAlloc.cpp:
trackedObjectExtraRefCounts->remove(it);
}
-unsigned ParserRefCounted::refcount()
+bool ParserRefCounted::hasOneRef()
{
if (newTrackedObjects && newTrackedObjects->contains(this)) {
ASSERT(!trackedObjectExtraRefCounts || !trackedObjectExtraRefCounts->contains(this));
- return 0;
+ return false;
}
ASSERT(!newTrackedObjects || !newTrackedObjects->contains(this));
if (!trackedObjectExtraRefCounts)
- return 1;
+ return true;
- return 1 + trackedObjectExtraRefCounts->count(this);
+ return !trackedObjectExtraRefCounts->contains(this);
}
void ParserRefCounted::deleteNewObjects()
public:
void ref() KJS_FAST_CALL;
void deref() KJS_FAST_CALL;
- unsigned refcount() KJS_FAST_CALL;
+ bool hasOneRef() KJS_FAST_CALL;
static void deleteNewObjects() KJS_FAST_CALL;
// -*- mode: c++; c-basic-offset: 4 -*-
/*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
// see comment in PassRefPtr.h for why this takes const reference
template <typename U> ListRefPtr(const PassRefPtr<U>& o) : RefPtr<T>(o) {}
- ~ListRefPtr() {
+ ~ListRefPtr()
+ {
RefPtr<T> reaper = this->release();
- while (reaper && reaper->refcount() == 1)
+ while (reaper && reaper->hasOneRef())
reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper
}
--m_refCount;
}
- bool hasOneRef()
+ bool hasOneRef() const
{
ASSERT(!m_deletionHasBegun);
return m_refCount == 1;
+2008-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - test for https://bugs.webkit.org/show_bug.cgi?id=19538
+ <rdar://problem/5957595> Reading transition property from the style JS gives the wrong value
+
+ * fast/dom/CSSStyleDeclaration/resources/transition-property-names.js: Added.
+ * fast/dom/CSSStyleDeclaration/transition-property-names-expected.txt: Added.
+ * fast/dom/CSSStyleDeclaration/transition-property-names.html: Added.
+
2008-06-14 Sam Weinig <sam@webkit.org>
Reviewed by Dan Bernstein.
* fast/dynamic/insertAdjacentText.html: Copied from fast/dynamic/insertAdjacentElement.html.
* platform/mac/fast/dynamic/insertAdjacentElement-expected.txt:
-2008-06-14 Darin Adler <darin@apple.com>
-
- Reviewed by Maciej.
-
- - test for https://bugs.webkit.org/show_bug.cgi?id=19538
- <rdar://problem/5957595> Reading transition property from the style JS gives the wrong value
-
- * fast/dom/CSSStyleDeclaration/resources/transition-property-names.js: Added.
- * fast/dom/CSSStyleDeclaration/transition-property-names-expected.txt: Added.
- * fast/dom/CSSStyleDeclaration/transition-property-names.html: Added.
-
2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
2008-04-03 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Rollout).
-
Rollout layout test changes for r31566
2008-04-03 Brady Eidson <beidson@apple.com>
+2008-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - more work on https://bugs.webkit.org/show_bug.cgi?id=17257
+ start ref counts at 1 instead of 0 for speed
+
+ * WebCore.base.exp: Added some new exports needed for functions that are now
+ non-virtual.
+
+ * WebCore.xcodeproj/project.pbxproj: Moved the "icon" group to the correct
+ location in the project. Before it was inside "appcache"!
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+ * dom/Clipboard.cpp:
+ (WebCore::Clipboard::Clipboard):
+ * editing/mac/EditorMac.mm:
+ (WebCore::Editor::newGeneralClipboard):
+ * editing/qt/EditorQt.cpp:
+ (WebCore::Editor::newGeneralClipboard):
+ * editing/wx/EditorWx.cpp:
+ (WebCore::Editor::newGeneralClipboard):
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::DocumentLoader):
+ * loader/DocumentLoader.h:
+ (WebCore::DocumentLoader::create):
+ * loader/icon/IconDatabase.cpp:
+ (WebCore::IconDatabase::defaultIcon):
+ (WebCore::IconDatabase::setIconDataForIconURL):
+ (WebCore::IconDatabase::setIconURLForPageURL):
+ (WebCore::IconDatabase::getOrCreateIconRecord):
+ (WebCore::IconDatabase::performURLImport):
+ * loader/icon/IconDatabase.h:
+ * loader/icon/IconRecord.cpp:
+ (WebCore::IconRecord::IconRecord):
+ * loader/icon/IconRecord.h:
+ (WebCore::IconRecord::create):
+ * page/EventHandler.h:
+ * page/Frame.cpp:
+ (WebCore::Frame::Frame):
+ * page/Frame.h:
+ (WebCore::Frame::create):
+ * page/gtk/EventHandlerGtk.cpp:
+ (WebCore::EventHandler::createDraggingClipboard):
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::EventHandler::createDraggingClipboard):
+ * page/qt/EventHandlerQt.cpp:
+ (WebCore::EventHandler::createDraggingClipboard):
+ * page/win/EventHandlerWin.cpp:
+ (WebCore::EventHandler::createDraggingClipboard):
+ * page/wx/EventHandlerWx.cpp:
+ (WebCore::EventHandler::createDraggingClipboard):
+ * platform/Cursor.h:
+ (WebCore::SharedCursor::create):
+ (WebCore::SharedCursor::~SharedCursor):
+ (WebCore::SharedCursor::SharedCursor):
+ * platform/DragData.h:
+ * platform/PopupMenu.h:
+ (WebCore::PopupMenu::create):
+ (WebCore::PopupMenu::isActive):
+ * platform/ScrollBar.cpp:
+ (WebCore::Scrollbar::Scrollbar):
+ * platform/SearchPopupMenu.h:
+ (WebCore::SearchPopupMenu::create):
+ * platform/graphics/FontFamily.cpp:
+ (WebCore::FontFamily::FontFamily):
+ (WebCore::operator==):
+ * platform/graphics/FontFamily.h:
+ (WebCore::FontFamily::FontFamily):
+ (WebCore::SharedFontFamily::create):
+ (WebCore::SharedFontFamily::SharedFontFamily):
+ (WebCore::operator!=):
+ (WebCore::FontFamily::next):
+ (WebCore::FontFamily::appendFamily):
+ (WebCore::FontFamily::releaseNext):
+ * platform/graphics/Icon.h:
+ * platform/graphics/gtk/IconGtk.cpp:
+ (WebCore::Icon::Icon):
+ (WebCore::Icon::~Icon):
+ (WebCore::Icon::newIconForFile):
+ * platform/graphics/mac/IconMac.mm:
+ (WebCore::Icon::Icon):
+ (WebCore::Icon::newIconForFile):
+ * platform/graphics/qt/IconQt.cpp:
+ (WebCore::Icon::Icon):
+ (WebCore::Icon::newIconForFile):
+ * platform/graphics/win/IconWin.cpp:
+ (WebCore::Icon::Icon):
+ (WebCore::Icon::~Icon):
+ (WebCore::Icon::newIconForFile):
+ * platform/gtk/ClipboardGtk.cpp:
+ (WebCore::Editor::newGeneralClipboard):
+ * platform/gtk/ClipboardGtk.h:
+ (WebCore::ClipboardGtk::create):
+ * platform/gtk/PlatformScrollBar.h:
+ (WebCore::PlatformScrollbar::create):
+ * platform/gtk/PopupMenuGtk.cpp:
+ (WebCore::PopupMenu::PopupMenu):
+ * platform/gtk/ScrollViewGtk.cpp:
+ (WebCore::ScrollViewScrollbar::create):
+ (WebCore::ScrollView::ScrollViewPrivate::setHasHorizontalScrollbar):
+ (WebCore::ScrollView::ScrollViewPrivate::setHasVerticalScrollbar):
+ * platform/mac/ClipboardMac.h:
+ (WebCore::ClipboardMac::create):
+ * platform/mac/DragDataMac.mm:
+ (WebCore::DragData::createClipboard):
+ (WebCore::DragData::containsCompatibleContent):
+ * platform/mac/PlatformScrollBar.h:
+ (WebCore::PlatformScrollbar::create):
+ (WebCore::PlatformScrollbar::horizontalScrollbarHeight):
+ (WebCore::PlatformScrollbar::verticalScrollbarWidth):
+ * platform/mac/PopupMenuMac.mm:
+ (WebCore::PopupMenu::PopupMenu):
+ * platform/qt/ClipboardQt.h:
+ (WebCore::ClipboardQt::create):
+ * platform/qt/DragDataQt.cpp:
+ (WebCore::DragData::createClipboard):
+ * platform/qt/PlatformScrollBar.h:
+ (WebCore::PlatformScrollbar::create):
+ * platform/qt/PopupMenuQt.cpp:
+ (WebCore::PopupMenu::PopupMenu):
+ * platform/qt/ScrollViewQt.cpp:
+ (WebCore::ScrollView::ScrollViewPrivate::setHasHorizontalScrollbar):
+ (WebCore::ScrollView::ScrollViewPrivate::setHasVerticalScrollbar):
+ * platform/win/ClipboardWin.h:
+ (WebCore::ClipboardWin::create):
+ * platform/win/CursorWin.cpp:
+ (WebCore::Cursor::Cursor):
+ (WebCore::loadSharedCursor):
+ * platform/win/DragDataWin.cpp:
+ (WebCore::DragData::createClipboard):
+ * platform/win/EditorWin.cpp:
+ (WebCore::Editor::newGeneralClipboard):
+ * platform/win/PlatformScrollBar.h:
+ (WebCore::PlatformScrollbar::create):
+ * platform/win/PopupMenuWin.cpp:
+ (WebCore::PopupMenu::PopupMenu):
+ (WebCore::PopupMenu::show):
+ * platform/win/ScrollViewWin.cpp:
+ (WebCore::ScrollView::ScrollViewPrivate::setHasHorizontalScrollbar):
+ (WebCore::ScrollView::ScrollViewPrivate::setHasVerticalScrollbar):
+ * platform/wx/ClipboardWx.h:
+ (WebCore::ClipboardWx::create):
+ * platform/wx/PlatformScrollBar.h:
+ (WebCore::PlatformScrollbar::create):
+ * platform/wx/PopupMenuWx.cpp:
+ (WebCore::PopupMenu::PopupMenu):
+ * platform/wx/TemporaryLinkStubs.cpp:
+ (Icon::Icon):
+ (Icon::newIconForFile):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::createScrollbar):
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::updateFromElement):
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::dataChanged):
+ * svg/graphics/SVGImageEmptyClients.h:
+ (WebCore::SVGEmptyFrameLoaderClient::createDocumentLoader):
+
2008-06-14 Sam Weinig <sam@webkit.org>
Reviewed by Dan Bernstein.
2008-04-03 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Rollout).
-
Rollout r31566 as there were a few issues i missed during review (thanks to antti for pointing them out)
* dom/Element.h:
__ZN7WebCore5Frame34setMarkedTextMatchesAreHighlightedEb
__ZN7WebCore5Frame4initEv
__ZN7WebCore5Frame5paintEPNS_15GraphicsContextERKNS_7IntRectE
+__ZN7WebCore5Frame7setViewEPNS_9FrameViewE
__ZN7WebCore5FrameC1EPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE
+__ZN7WebCore5FrameD1Ev
__ZN7WebCore5Image12supportsTypeERKNS_6StringE
__ZN7WebCore5Image20loadPlatformResourceEPKc
__ZN7WebCore5Range6createEN3WTF10PassRefPtrINS_8DocumentEEENS2_INS_4NodeEEEiS6_i
1A8F6BB00DB55CDC001DB794 /* appcache */ = {
isa = PBXGroup;
children = (
- 5126E6B60A2E3AEF005C29FA /* icon */,
1A8F6BB10DB55CDC001DB794 /* ApplicationCache.cpp */,
1A8F6BB20DB55CDC001DB794 /* ApplicationCache.h */,
1A8F6BB30DB55CDC001DB794 /* ApplicationCacheGroup.cpp */,
51E1ECBC0C91C90400DC255B /* PageURLRecord.cpp */,
51E1ECBD0C91C90400DC255B /* PageURLRecord.h */,
);
- name = icon;
- path = ../icon;
+ path = icon;
sourceTree = "<group>";
};
512DD8E80D91E691000F89EE /* archive */ = {
children = (
1A8F6BB00DB55CDC001DB794 /* appcache */,
512DD8E80D91E691000F89EE /* archive */,
+ 5126E6B60A2E3AEF005C29FA /* icon */,
93A1EAA20A5634D8006960A0 /* mac */,
BCB16BFE0979C3BD00467741 /* Cache.cpp */,
BCB16BFF0979C3BD00467741 /* Cache.h */,
currFamily = &firstFamily;
}
else {
- FontFamily *newFamily = new FontFamily;
+ RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create();
newFamily->setFamily(face);
currFamily->appendFamily(newFamily);
- currFamily = newFamily;
+ currFamily = newFamily.get();
}
if (fontDescription.keywordSize() && (fontDescription.genericFamily() == FontDescription::MonospaceFamily) != oldFamilyIsMonospace)
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
namespace WebCore {
Clipboard::Clipboard(ClipboardAccessPolicy policy, bool isForDragging)
- : RefCounted<Clipboard>(0)
- , m_policy(policy)
+ : m_policy(policy)
, m_dragStarted(false)
, m_forDragging(isForDragging)
, m_dragImage(0)
PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy)
{
- return new ClipboardMac(false, [NSPasteboard generalPasteboard], policy);
+ return ClipboardMac::create(false, [NSPasteboard generalPasteboard], policy, 0);
}
static void initializeKillRingIfNeeded()
/*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
- * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy)
{
- return new ClipboardQt(policy);
+ return ClipboardQt::create(policy);
}
} // namespace WebCore
*/
#include "config.h"
-
#include "Editor.h"
+
#include "ClipboardWx.h"
namespace WebCore {
PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy)
{
- return new ClipboardWx(policy, true);
+ return ClipboardWx::create(policy, true);
}
}
-
-
}
DocumentLoader::DocumentLoader(const ResourceRequest& req, const SubstituteData& substituteData)
- : RefCounted<DocumentLoader>(0)
- , m_deferMainResourceDataLoad(true)
+ : m_deferMainResourceDataLoad(true)
, m_frame(0)
, m_originalRequest(req)
, m_substituteData(substituteData)
class DocumentLoader : public RefCounted<DocumentLoader> {
public:
- DocumentLoader(const ResourceRequest&, const SubstituteData&);
+ static PassRefPtr<DocumentLoader> create(const ResourceRequest& request, const SubstituteData& data)
+ {
+ return adoptRef(new DocumentLoader(request, data));
+ }
virtual ~DocumentLoader();
void setFrame(Frame*);
ApplicationCache* mainResourceApplicationCache() const;
#endif
+
protected:
+ DocumentLoader(const ResourceRequest&, const SubstituteData&);
+
bool m_deferMainResourceDataLoad;
private:
static RefPtr<SharedBuffer> defaultIconBuffer(SharedBuffer::create(defaultIconData, sizeof(defaultIconData)));
if (!m_defaultIconRecord) {
- m_defaultIconRecord = new IconRecord("urlIcon");
+ m_defaultIconRecord = IconRecord::create("urlIcon");
m_defaultIconRecord->setImageData(defaultIconBuffer);
}
MutexLocker locker(m_urlAndIconLock);
// If this icon was pending a read, remove it from that set because this new data should override what is on disk
- IconRecord* icon = m_iconURLToRecordMap.get(iconURL);
+ RefPtr<IconRecord> icon = m_iconURLToRecordMap.get(iconURL);
if (icon) {
MutexLocker locker(m_pendingReadingLock);
- m_iconsPendingReading.remove(icon);
+ m_iconsPendingReading.remove(icon.get());
} else
icon = getOrCreateIconRecord(iconURL);
RefPtr<IconRecord> iconRecord = pageRecord->iconRecord();
// Otherwise, set the new icon record for this page
- IconRecord* newIconRecord = getOrCreateIconRecord(iconURL);
- pageRecord->setIconRecord(newIconRecord);
+ pageRecord->setIconRecord(getOrCreateIconRecord(iconURL));
// If the current icon has only a single ref left, it is about to get wiped out.
// Remove it from the in-memory records and don't bother reading it in from disk anymore
}
// Unlike getOrCreatePageURLRecord(), getOrCreateIconRecord() does not mark the icon as "interested in import"
-IconRecord* IconDatabase::getOrCreateIconRecord(const String& iconURL)
+PassRefPtr<IconRecord> IconDatabase::getOrCreateIconRecord(const String& iconURL)
{
// Clients of getOrCreateIconRecord() are required to acquire the m_urlAndIconLock before calling this method
ASSERT(!m_urlAndIconLock.tryLock());
if (IconRecord* icon = m_iconURLToRecordMap.get(iconURL))
return icon;
-
- IconRecord* newIcon = new IconRecord(iconURL);
- m_iconURLToRecordMap.set(iconURL, newIcon);
-
- return newIcon;
+
+ RefPtr<IconRecord> newIcon = IconRecord::create(iconURL);
+ m_iconURLToRecordMap.set(iconURL, newIcon.get());
+
+ return newIcon.release();
}
// This method retrieves the existing PageURLRecord, or creates a new one and marks it as "interested in the import" for later notification
IconRecord* currentIcon = pageRecord->iconRecord();
if (!currentIcon || currentIcon->iconURL() != iconURL) {
- currentIcon = getOrCreateIconRecord(iconURL);
- pageRecord->setIconRecord(currentIcon);
+ pageRecord->setIconRecord(getOrCreateIconRecord(iconURL));
+ currentIcon = pageRecord->iconRecord();
}
// Regardless, the time stamp from disk still takes precedence. Until we read this icon from disk, we didn't think we'd seen it before
HashSet<RefPtr<DocumentLoader> > m_loadersPendingDecision;
- IconRecord* m_defaultIconRecord;
+ RefPtr<IconRecord> m_defaultIconRecord;
#endif // ENABLE(ICONDATABASE)
// *** Any Thread ***
#if ENABLE(ICONDATABASE)
private:
- IconRecord* getOrCreateIconRecord(const String& iconURL);
+ PassRefPtr<IconRecord> getOrCreateIconRecord(const String& iconURL);
PageURLRecord* getOrCreatePageURLRecord(const String& pageURL);
bool m_isEnabled;
namespace WebCore {
IconRecord::IconRecord(const String& url)
- : RefCounted<IconRecord>(0)
- , m_iconURL(url)
+ : m_iconURL(url)
, m_stamp(0)
, m_dataSet(false)
{
class IconRecord : public RefCounted<IconRecord> {
friend class PageURLRecord;
public:
- IconRecord(const String& url);
+ static PassRefPtr<IconRecord> create(const String& url)
+ {
+ return adoptRef(new IconRecord(url));
+ }
~IconRecord();
time_t getTimestamp() { return m_stamp; }
const HashSet<String>& retainingPageURLs() { return m_retainingPageURLs; }
IconSnapshot snapshot(bool forDeletion = false) const;
+
private:
+ IconRecord(const String& url);
+
String m_iconURL;
time_t m_stamp;
OwnPtr<Image> m_image;
static EventHandlerDragState& dragState();
static const double TextDragDelay;
- Clipboard* createDraggingClipboard() const;
+ PassRefPtr<Clipboard> createDraggingClipboard() const;
bool eventActivatedView(const PlatformMouseEvent&) const;
void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults& event);
}
Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* frameLoaderClient)
- : RefCounted<Frame>(0)
- , d(new FramePrivate(page, parentFromOwnerElement(ownerElement), this, ownerElement, frameLoaderClient))
+ : d(new FramePrivate(page, parentFromOwnerElement(ownerElement), this, ownerElement, frameLoaderClient))
{
AtomicString::init();
EventNames::init();
if (!ownerElement)
page->setMainFrame(this);
else {
- // FIXME: It's bad to have a ref() here but not in the !ownerElement case.
- // We need to straighten this out.
- ref();
page->incrementFrameCount();
ownerElement->m_contentFrame = this;
}
class Frame : public RefCounted<Frame> {
public:
- Frame(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
- virtual void setView(FrameView*);
- virtual ~Frame();
+ static PassRefPtr<Frame> create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client)
+ {
+ return adoptRef(new Frame(page, ownerElement, client));
+ }
+ void setView(FrameView*);
+ ~Frame();
void init();
friend class FramePrivate;
private:
+ Frame(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
+
FramePrivate* d;
// === undecided, would like to consider moving to another class
return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheelEvent(event);
}
-Clipboard* EventHandler::createDraggingClipboard() const
+PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
{
- return new ClipboardGtk(ClipboardWritable, true);
+ return ClipboardGtk::create(ClipboardWritable, true);
}
bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
return true;
}
-Clipboard* EventHandler::createDraggingClipboard() const
+PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
{
NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
// Must be done before ondragstart adds types and data to the pboard,
// also done for security, as it erases data from the last drag
[pasteboard declareTypes:[NSArray array] owner:nil];
- return new ClipboardMac(true, pasteboard, ClipboardWritable, m_frame);
+ return ClipboardMac::create(true, pasteboard, ClipboardWritable, m_frame);
}
bool EventHandler::eventLoopHandleMouseUp(const MouseEventWithHitTestResults&)
/*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007 Trolltech ASA
*
* Redistribution and use in source and binary forms, with or without
return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheelEvent(event);
}
-Clipboard* EventHandler::createDraggingClipboard() const
+PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
{
- return new ClipboardQt(ClipboardWritable, true);
+ return ClipboardQt::create(ClipboardWritable, true);
}
bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
return event.activatedWebView();
}
-Clipboard* EventHandler::createDraggingClipboard() const
+PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
{
COMPtr<WCDataObject> dataObject;
WCDataObject::createInstance(&dataObject);
- return new ClipboardWin(true, dataObject.get(), ClipboardWritable);
+ return ClipboardWin::create(true, dataObject.get(), ClipboardWritable);
}
void EventHandler::focusDocumentView()
*/
#include "config.h"
+#include "EventHandler.h"
#include "ClipboardWx.h"
-#include "EventHandler.h"
#include "FocusController.h"
#include "Frame.h"
#include "FrameView.h"
return false;
}
-Clipboard* EventHandler::createDraggingClipboard() const
+PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
{
- return new ClipboardWx(ClipboardWritable, true);
+ return ClipboardWx::create(ClipboardWritable, true);
}
}
/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#if PLATFORM(WIN)
typedef struct HICON__* HICON;
typedef HICON HCURSOR;
+#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#elif PLATFORM(GTK)
#if PLATFORM(WIN)
class SharedCursor : public RefCounted<SharedCursor> {
public:
- SharedCursor(HCURSOR nativeCursor) : RefCounted<SharedCursor>(0), m_nativeCursor(nativeCursor) {}
- ~SharedCursor() {
- DestroyIcon(m_nativeCursor);
- }
+ static PassRefPtr<SharedCursor> create(HCURSOR nativeCursor) { return adoptRef(new SharedCursor(nativeCursor)); }
+ ~SharedCursor() { DestroyIcon(m_nativeCursor); }
HCURSOR nativeCursor() const { return m_nativeCursor; }
private:
+ SharedCursor(HCURSOR nativeCursor) : m_nativeCursor(nativeCursor) { }
HCURSOR m_nativeCursor;
};
typedef RefPtr<SharedCursor> PlatformCursor;
const IntPoint& globalPosition() const { return m_globalPosition; }
DragDataRef platformData() const { return m_platformDragData; }
DragOperation draggingSourceOperationMask() const { return m_draggingSourceOperationMask; }
- Clipboard* createClipboard(ClipboardAccessPolicy) const;
+ PassRefPtr<Clipboard> createClipboard(ClipboardAccessPolicy) const;
bool containsURL() const;
bool containsPlainText() const;
bool containsCompatibleContent() const;
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
#ifndef PopupMenu_h
#define PopupMenu_h
-#include <wtf/RefCounted.h>
-
#include "IntRect.h"
#include "PopupMenuClient.h"
#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
#endif
{
public:
- static PassRefPtr<PopupMenu> create(PopupMenuClient* client) { return new PopupMenu(client); }
+ static PassRefPtr<PopupMenu> create(PopupMenuClient* client) { return adoptRef(new PopupMenu(client)); }
~PopupMenu();
void disconnectClient() { m_popupClient = 0; }
void focusFirst();
void focusLast();
- void paint(const IntRect& damageRect, HDC hdc = 0);
+ void paint(const IntRect& damageRect, HDC = 0);
HWND popupHandle() const { return m_popup; }
#endif
protected:
- PopupMenu(PopupMenuClient* client);
-
-#if PLATFORM(WIN)
- // ScrollBarClient
- virtual void valueChanged(Scrollbar*);
- virtual IntRect windowClipRect() const;
- virtual bool isActive() const { return true; }
-#endif
+ PopupMenu(PopupMenuClient*);
private:
PopupMenuClient* m_popupClient;
void populate(const IntRect&);
QWebPopup* m_popup;
#elif PLATFORM(WIN)
+ // ScrollBarClient
+ virtual void valueChanged(Scrollbar*);
+ virtual IntRect windowClipRect() const;
+ virtual bool isActive() const { return true; }
+
void calculatePositionAndSize(const IntRect&, FrameView*);
void invalidateItem(int index);
/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
namespace WebCore {
Scrollbar::Scrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize)
- : RefCounted<Scrollbar>(0)
- , m_client(client)
+ : m_client(client)
, m_orientation(orientation)
, m_controlSize(controlSize)
, m_visibleSize(0)
// return true even if the integer value did not change so that scroll event gets eaten
return true;
}
+
}
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
#define SearchPopupMenu_h
#include "PopupMenu.h"
-#include <wtf/Forward.h>
#include <wtf/Vector.h>
namespace WebCore {
class SearchPopupMenu : public PopupMenu {
public:
- static PassRefPtr<SearchPopupMenu> create(PopupMenuClient* client) { return new SearchPopupMenu(client); }
+ static PassRefPtr<SearchPopupMenu> create(PopupMenuClient* client) { return adoptRef(new SearchPopupMenu(client)); }
void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems);
void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems);
bool enabled();
-protected:
- SearchPopupMenu(PopupMenuClient* client);
-
+private:
+ SearchPopupMenu(PopupMenuClient*);
};
}
/*
- * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
namespace WebCore {
FontFamily::FontFamily(const FontFamily& other)
- : RefCounted<FontFamily>(0)
- , m_family(other.m_family)
+ : m_family(other.m_family)
, m_next(other.m_next)
{
}
return *this;
}
-bool FontFamily::operator==(const FontFamily &compareFontFamily) const
+bool operator==(const FontFamily& a, const FontFamily& b)
{
- if ((!m_next && compareFontFamily.m_next) ||
- (m_next && !compareFontFamily.m_next) ||
- ((m_next && compareFontFamily.m_next) && (*m_next != *(compareFontFamily.m_next))))
+ if (a.family() != b.family())
return false;
-
- return m_family == compareFontFamily.m_family;
+ const FontFamily* ap;
+ const FontFamily* bp;
+ for (ap = a.next(), bp = b.next(); ap != bp; ap = ap->next(), bp = bp->next()) {
+ if (!ap || !bp)
+ return false;
+ if (ap->family() != bp->family())
+ return false;
+ }
+ return true;
}
}
/*
- * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "AtomicString.h"
#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include <wtf/ListRefPtr.h>
namespace WebCore {
-class FontFamily : public RefCounted<FontFamily> {
+class SharedFontFamily;
+
+class FontFamily {
public:
- FontFamily() : RefCounted<FontFamily>(0) { }
-
+ FontFamily() { }
FontFamily(const FontFamily&);
FontFamily& operator=(const FontFamily&);
const AtomicString& family() const { return m_family; }
bool familyIsEmpty() const { return m_family.isEmpty(); }
- FontFamily* next() { return m_next.get(); }
- const FontFamily* next() const { return m_next.get(); }
+ const FontFamily* next() const;
- void appendFamily(PassRefPtr<FontFamily> family) { m_next = family; }
+ void appendFamily(PassRefPtr<SharedFontFamily>);
+ PassRefPtr<SharedFontFamily> releaseNext();
- bool operator==(const FontFamily&) const;
- bool operator!=(const FontFamily& x) const { return !(*this == x); }
-
private:
AtomicString m_family;
- RefPtr<FontFamily> m_next;
+ ListRefPtr<SharedFontFamily> m_next;
};
+class SharedFontFamily : public FontFamily, public RefCounted<SharedFontFamily> {
+public:
+ static PassRefPtr<SharedFontFamily> create()
+ {
+ return adoptRef(new SharedFontFamily);
+ }
+
+private:
+ SharedFontFamily() { }
+};
+
+bool operator==(const FontFamily&, const FontFamily&);
+inline bool operator!=(const FontFamily& a, const FontFamily& b) { return !(a == b); }
+
+inline const FontFamily* FontFamily::next() const
+{
+ return m_next.get();
+}
+
+inline void FontFamily::appendFamily(PassRefPtr<SharedFontFamily> family)
+{
+ m_next = family;
+}
+
+inline PassRefPtr<SharedFontFamily> FontFamily::releaseNext()
+{
+ return m_next.release();
+}
+
}
#endif
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
class Icon : public RefCounted<Icon> {
public:
- Icon();
- ~Icon();
-
static PassRefPtr<Icon> newIconForFile(const String& filename);
+ ~Icon();
void paint(GraphicsContext*, const IntRect&);
-#if PLATFORM(WIN)
- Icon(HICON);
-#endif
-
private:
#if PLATFORM(MAC)
Icon(NSImage*);
-#endif
-#if PLATFORM(MAC)
RetainPtr<NSImage> m_nsImage;
#elif PLATFORM(WIN)
+ Icon(HICON);
HICON m_hIcon;
#elif PLATFORM(QT)
+ Icon();
QIcon m_icon;
#elif PLATFORM(GTK)
+ Icon();
GdkPixbuf* m_icon;
#endif
};
namespace WebCore {
Icon::Icon()
- : RefCounted<Icon>(0)
- , m_icon(0)
+ : m_icon(0)
{
- notImplemented();
}
Icon::~Icon()
{
- if(m_icon)
+ if (m_icon)
g_object_unref(m_icon);
}
String MIMEType = MIMETypeRegistry::getMIMETypeForPath(filename);
String iconName = lookupIconName(MIMEType);
- Icon* icon = new Icon;
+ RefPtr<Icon> icon = adoptRef(new Icon);
icon->m_icon = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), iconName.utf8().data(), 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
- return icon->m_icon ? icon : 0;
+ if (!icon->m_icon)
+ return 0;
+ return icon.release();
}
void Icon::paint(GraphicsContext* context, const IntRect& rect)
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
namespace WebCore {
-Icon::Icon()
- : RefCounted<Icon>(0)
-{
-}
-
Icon::Icon(NSImage *image)
- : RefCounted<Icon>(0)
- , m_nsImage(image)
+ : m_nsImage(image)
{
// Need this because WebCore uses AppKit's flipped coordinate system exclusively.
[image setFlipped:YES];
if (!image)
return 0;
- return new Icon(image);
+ return adoptRef(new Icon(image));
}
void Icon::paint(GraphicsContext* context, const IntRect& rect)
namespace WebCore {
Icon::Icon()
- : RefCounted<Icon>(0)
{
}
PassRefPtr<Icon> Icon::newIconForFile(const String& filename)
{
- Icon *i = new Icon;
+ RefPtr<Icon> i = adoptRef(new Icon);
i->m_icon = QIcon(filename);
- return PassRefPtr<Icon>(i);
+ return i.release();
}
void Icon::paint(GraphicsContext* ctx, const IntRect& rect)
/*
-* Copyright (C) 2006, 2007 Apple Inc.
+* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
namespace WebCore {
-Icon::Icon()
- : RefCounted<Icon>(0)
- , m_hIcon(0)
-{
-}
-
Icon::Icon(HICON icon)
- : RefCounted<Icon>(0)
- , m_hIcon(icon)
+ : m_hIcon(icon)
{
+ ASSERT(icon);
}
Icon::~Icon()
{
- if (m_hIcon)
- DestroyIcon(m_hIcon);
+ DestroyIcon(m_hIcon);
}
PassRefPtr<Icon> Icon::newIconForFile(const String& filename)
if (!SHGetFileInfo(tmpFilename.charactersWithNullTermination(), 0, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_SHELLICONSIZE | SHGFI_SMALLICON))
return 0;
- Icon* icon = new Icon();
- icon->m_hIcon = sfi.hIcon;
- return icon;
+ return adoptRef(new Icon(sfi.hIcon));
}
void Icon::paint(GraphicsContext* context, const IntRect& r)
#include "Editor.h"
namespace WebCore {
+
PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy)
{
- return new ClipboardGtk(policy, false);
+ return ClipboardGtk::create(policy, false);
}
ClipboardGtk::ClipboardGtk(ClipboardAccessPolicy policy, bool forDragging)
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2007, Holger Hans Peter Freyther
*
* Redistribution and use in source and binary forms, with or without
// Created from the EventHandlerGtk to be used by the dom
class ClipboardGtk : public Clipboard {
public:
- ClipboardGtk(ClipboardAccessPolicy, bool);
- ~ClipboardGtk();
-
+ static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, bool isForDragging)
+ {
+ return adoptRef(new ClipboardGtk(policy, isForDragging));
+ }
+ virtual ~ClipboardGtk();
void clearData(const String&);
void clearAllData();
virtual void writeRange(Range*, Frame*);
virtual bool hasData();
+
+ private:
+ ClipboardGtk(ClipboardAccessPolicy, bool);
};
}
/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#ifndef PlatformScrollBar_h
#define PlatformScrollBar_h
-#include "Widget.h"
#include "ScrollBar.h"
+#include "Widget.h"
+#include <wtf/PassRefPtr.h>
typedef struct _GtkAdjustment GtkAdjustment;
class PlatformScrollbar : public Widget, public Scrollbar {
public:
- PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+ static PassRefPtr<PlatformScrollbar> create(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size)
+ {
+ return adoptRef(new PlatformScrollbar(client, orientation, size));
+ }
virtual ~PlatformScrollbar();
virtual bool isWidget() const { return true; }
static int verticalScrollbarWidth();
protected:
+ PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+
virtual void updateThumbPosition();
virtual void updateThumbProportion();
virtual void geometryChanged();
/*
* This file is part of the popup menu implementation for <select> elements in WebCore.
*
- * Copyright (C) 2006, 2007 Apple Inc.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
* Copyright (C) 2008 Collabora Ltd.
*
namespace WebCore {
PopupMenu::PopupMenu(PopupMenuClient* client)
- : RefCounted<PopupMenu>(0)
- , m_popupClient(client)
+ : m_popupClient(client)
, m_popup(0)
{
}
/*
- * Copyright (C) 2006, 2007 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
* Copyright (C) 2007 Holger Hans Peter Freyther
* Copyright (C) 2008 Collabora Ltd.
class ScrollViewScrollbar : public PlatformScrollbar {
public:
+ static PassRefPtr<ScrollViewScrollbar> create(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size)
+ {
+ return adoptRef(new ScrollViewScrollbar(client, orientation, size));
+ }
+
+private:
ScrollViewScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
-protected:
- void geometryChanged() const;
+ virtual void geometryChanged() const;
};
class ScrollView::ScrollViewPrivate : public ScrollbarClient
{
if (Scrollbar::hasPlatformScrollbars()) {
if (hasBar && !hBar && !horizontalAdjustment) {
- hBar = new ScrollViewScrollbar(this, HorizontalScrollbar, RegularScrollbar);
+ hBar = ScrollViewScrollbar::create(this, HorizontalScrollbar, RegularScrollbar);
view->addChild(hBar.get());
} else if (!hasBar && hBar) {
view->removeChild(hBar.get());
{
if (Scrollbar::hasPlatformScrollbars()) {
if (hasBar && !vBar && !verticalAdjustment) {
- vBar = new ScrollViewScrollbar(this, VerticalScrollbar, RegularScrollbar);
+ vBar = ScrollViewScrollbar::create(this, VerticalScrollbar, RegularScrollbar);
view->addChild(vBar.get());
} else if (!hasBar && vBar) {
view->removeChild(vBar.get());
/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// An implementation of the clipboard class from IE that talks to the Cocoa Pasteboard
-
#ifndef ClipboardMac_h
#define ClipboardMac_h
-#include "IntPoint.h"
-#include "Clipboard.h"
-#include "ClipboardAccessPolicy.h"
#include "CachedResourceClient.h"
+#include "Clipboard.h"
#include <wtf/RetainPtr.h>
#ifdef __OBJC__
#else
class NSImage;
class NSPasteboard;
-typedef unsigned NSDragOperation;
#endif
namespace WebCore {
class ClipboardMac : public Clipboard, public CachedResourceClient {
public:
- ClipboardMac(bool forDragging, NSPasteboard *, ClipboardAccessPolicy, Frame* = 0);
+ static PassRefPtr<ClipboardMac> create(bool forDragging, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, Frame* frame)
+ {
+ return adoptRef(new ClipboardMac(forDragging, pasteboard, policy, frame));
+ }
+
virtual ~ClipboardMac();
void clearData(const String& type);
// Methods for getting info in Cocoa's type system
NSImage *dragNSImage(NSPoint&) const; // loc converted from dragLoc, based on whole image size
NSPasteboard *pasteboard() { return m_pasteboard.get(); }
+
private:
+ ClipboardMac(bool forDragging, NSPasteboard *, ClipboardAccessPolicy, Frame*);
+
void setDragImage(CachedImage*, Node*, const IntPoint&);
RetainPtr<NSPasteboard> m_pasteboard;
{
return m_pasteboardHelper->plainTextFromPasteboard([m_platformDragData draggingPasteboard]);
}
-
+
Color DragData::asColor() const
{
NSColor *color = [NSColor colorFromPasteboard:[m_platformDragData draggingPasteboard]];
(int)([color blueComponent] * 255.0 + 0.5), (int)([color alphaComponent] * 255.0 + 0.5));
}
-Clipboard* DragData::createClipboard(ClipboardAccessPolicy policy) const
+PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const
{
- return new ClipboardMac(true, [m_platformDragData draggingPasteboard], policy);
+ return ClipboardMac::create(true, [m_platformDragData draggingPasteboard], policy, 0);
}
bool DragData::containsCompatibleContent() const
{
-
NSPasteboard *pasteboard = [m_platformDragData draggingPasteboard];
NSMutableSet *types = [NSMutableSet setWithArray:[pasteboard types]];
[types intersectSet:[NSSet setWithArray:m_pasteboardHelper->insertablePasteboardTypes()]];
{
return m_pasteboardHelper->urlFromPasteboard([m_platformDragData draggingPasteboard], title);
}
-
-
+
PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const
{
return [m_pasteboardHelper->fragmentFromPasteboard([m_platformDragData draggingPasteboard]) _documentFragment];
/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#ifndef PlatformScrollBar_h
#define PlatformScrollBar_h
-#include "Widget.h"
#include "ScrollBar.h"
+#include "Widget.h"
+#include <wtf/PassRefPtr.h>
#ifdef __OBJC__
@class NSScroller;
class PlatformScrollbar : public Widget, public Scrollbar {
public:
- PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+ static PassRefPtr<PlatformScrollbar> create(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size)
+ {
+ return adoptRef(new PlatformScrollbar(client, orientation, size));
+ }
virtual ~PlatformScrollbar();
+ bool scrollbarHit(NSScrollerPart);
+
+ static int horizontalScrollbarHeight() { return 15; }
+ static int verticalScrollbarWidth() { return 15; }
+
+private:
+ PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+
virtual bool isWidget() const { return true; }
virtual int width() const;
virtual void setEnabled(bool);
virtual void paint(GraphicsContext*, const IntRect& damageRect);
- bool scrollbarHit(NSScrollerPart);
-
- static int horizontalScrollbarHeight() { return 15; }
- static int verticalScrollbarWidth() { return 15; }
-
-protected:
virtual void updateThumbPosition();
virtual void updateThumbProportion();
};
}
#endif // PlatformScrollBar_h
-
using namespace HTMLNames;
PopupMenu::PopupMenu(PopupMenuClient* client)
- : RefCounted<PopupMenu>(0)
- , m_popupClient(client)
+ : m_popupClient(client)
{
}
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "Clipboard.h"
#include "CachedResourceClient.h"
-#include "ClipboardAccessPolicy.h"
QT_BEGIN_NAMESPACE
class QMimeData;
// State available during IE's events for drag and drop and copy/paste
class ClipboardQt : public Clipboard, public CachedResourceClient {
public:
- ClipboardQt(ClipboardAccessPolicy policy, const QMimeData* readableClipboard);
-
- // Clipboard is writable so it will create its own QMimeData object
- ClipboardQt(ClipboardAccessPolicy policy, bool forDragging = false);
- ~ClipboardQt();
+ static PassRefPtr<ClipboardQt> create(ClipboardAccessPolicy policy, const QMimeData* readableClipboard)
+ {
+ return adoptRef(new ClipboardQt(policy, readableClipboard));
+ }
+ static PassRefPtr<ClipboardQt> create(ClipboardAccessPolicy policy, bool forDragging = false)
+ {
+ return adoptRef(new ClipboardQt(policy, forDragging));
+ }
+ virtual ~ClipboardQt();
void clearData(const String& type);
void clearAllData();
void invalidateWritableData() { m_writableData = 0; }
private:
- void setDragImage(CachedImage* image, Node *node, const IntPoint &loc);
+ ClipboardQt(ClipboardAccessPolicy, const QMimeData* readableClipboard);
+
+ // Clipboard is writable so it will create its own QMimeData object
+ ClipboardQt(ClipboardAccessPolicy, bool forDragging);
+
+ void setDragImage(CachedImage*, Node*, const IntPoint& loc);
const QMimeData* m_readableData;
QMimeData* m_writableData;
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
return qvariant_cast<QColor>(m_platformDragData->colorData());
}
-Clipboard* DragData::createClipboard(ClipboardAccessPolicy policy) const
+PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const
{
- return new ClipboardQt(policy, m_platformDragData);
+ return ClipboardQt::create(policy, m_platformDragData);
}
bool DragData::containsCompatibleContent() const
/*
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net>
* Copyright (C) 2007 Trolltech ASA
*
#ifndef PlatformScrollbar_h
#define PlatformScrollbar_h
-#include "Widget.h"
#include "ScrollBar.h"
#include "Timer.h"
-
+#include "Widget.h"
#include <QStyleOptionSlider>
+#include <wtf/PassRefPtr.h>
namespace WebCore {
class PlatformScrollbar : public Widget, public Scrollbar {
public:
- PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+ static PassRefPtr<PlatformScrollbar> create(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size)
+ {
+ return adoptRef(new PlatformScrollbar(client, orientation, size));
+ }
virtual ~PlatformScrollbar();
virtual bool isWidget() const { return true; }
virtual void updateThumbProportion();
private:
+ PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+
int thumbPosition() const;
int thumbLength() const;
int trackLength() const;
namespace WebCore {
PopupMenu::PopupMenu(PopupMenuClient* client)
- : RefCounted<PopupMenu>(0)
- , m_popupClient(client)
+ : m_popupClient(client)
{
m_popup = new QWebPopup(client);
}
/*
- * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
* Copyright (C) 2006 George Staikos <staikos@kde.org>
{
if (Scrollbar::hasPlatformScrollbars()) {
if (hasBar && !m_hBar) {
- m_hBar = new PlatformScrollbar(this, HorizontalScrollbar, RegularScrollbar);
+ m_hBar = PlatformScrollbar::create(this, HorizontalScrollbar, RegularScrollbar);
m_view->addChild(m_hBar.get());
} else if (!hasBar && m_hBar) {
m_view->removeChild(m_hBar.get());;
{
if (Scrollbar::hasPlatformScrollbars()) {
if (hasBar && !m_vBar) {
- m_vBar = new PlatformScrollbar(this, VerticalScrollbar, RegularScrollbar);
+ m_vBar = PlatformScrollbar::create(this, VerticalScrollbar, RegularScrollbar);
m_view->addChild(m_vBar.get());
} else if (!hasBar && m_vBar) {
m_view->removeChild(m_vBar.get());
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#ifndef ClipboardWin_h
#define ClipboardWin_h
-#include "Clipboard.h"
-
#include "CachedResourceClient.h"
-#include "IntPoint.h"
+#include "Clipboard.h"
#include "COMPtr.h"
struct IDataObject;
// State available during IE's events for drag and drop and copy/paste
class ClipboardWin : public Clipboard, public CachedResourceClient {
public:
- ClipboardWin(bool isForDragging, IDataObject* dataObject, ClipboardAccessPolicy policy);
- ClipboardWin(bool isForDragging, WCDataObject* dataObject, ClipboardAccessPolicy policy);
+ static PassRefPtr<ClipboardWin> create(bool isForDragging, IDataObject* dataObject, ClipboardAccessPolicy policy)
+ {
+ return adoptRef(new ClipboardWin(isForDragging, dataObject, policy));
+ }
+ static PassRefPtr<ClipboardWin> create(bool isForDragging, WCDataObject* dataObject, ClipboardAccessPolicy policy)
+ {
+ return adoptRef(new ClipboardWin(isForDragging, dataObject, policy));
+ }
~ClipboardWin();
void clearData(const String& type);
virtual bool hasData();
COMPtr<IDataObject> dataObject() { return m_dataObject; }
+
private:
+ ClipboardWin(bool isForDragging, IDataObject*, ClipboardAccessPolicy);
+ ClipboardWin(bool isForDragging, WCDataObject*, ClipboardAccessPolicy);
+
void resetFromClipboard();
void setDragImage(CachedImage*, Node*, const IntPoint&);
+
COMPtr<IDataObject> m_dataObject;
COMPtr<WCDataObject> m_writableDataObject;
Frame* m_frame;
/*
* Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
ii.hbmMask = hMask.get();
ii.hbmColor = hCursor.get();
- m_impl = new SharedCursor(CreateIconIndirect(&ii));
+ m_impl = SharedCursor::create(CreateIconIndirect(&ii));
} else {
// Platform doesn't support alpha blended cursors, so we need
// to create the mask manually
icon.yHotspot = hotspot.y();
icon.hbmMask = andMask.get();
icon.hbmColor = xorMask.get();
- m_impl = new SharedCursor(CreateIconIndirect(&icon));
+ m_impl = SharedCursor::create(CreateIconIndirect(&icon));
DeleteDC(xorMaskDC);
DeleteDC(andMaskDC);
static PassRefPtr<SharedCursor> loadSharedCursor(HINSTANCE hInstance, LPCTSTR lpCursorName)
{
- return new SharedCursor(LoadCursor(hInstance, lpCursorName));
+ return SharedCursor::create(LoadCursor(hInstance, lpCursorName));
}
const Cursor& pointerCursor()
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
namespace WebCore {
-Clipboard* DragData::createClipboard(ClipboardAccessPolicy policy) const
+PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const
{
- return new ClipboardWin(true, m_platformDragData, policy);
+ return ClipboardWin::create(true, m_platformDragData, policy);
}
bool DragData::containsURL() const
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
if (!SUCCEEDED(OleGetClipboard(&clipboardData)))
clipboardData = 0;
- return new ClipboardWin(false, clipboardData.get(), policy);
+ return ClipboardWin::create(false, clipboardData.get(), policy);
}
} // namespace WebCore
/*
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#ifndef PlatformScrollbar_h
#define PlatformScrollbar_h
-#include "Widget.h"
#include "ScrollBar.h"
#include "Timer.h"
+#include "Widget.h"
+#include <wtf/PassRefPtr.h>
typedef struct HDC__* HDC;
class PlatformScrollbar : public Widget, public Scrollbar {
public:
- PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+ static PassRefPtr<PlatformScrollbar> create(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size)
+ {
+ return adoptRef(new PlatformScrollbar(client, orientation, size));
+ }
virtual ~PlatformScrollbar();
virtual void updateThumbProportion();
private:
+ PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+
bool hasButtons() const;
bool hasThumb() const;
IntRect backButtonRect() const;
/*
- * Copyright (C) 2006, 2007 Apple Inc.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
}
PopupMenu::PopupMenu(PopupMenuClient* client)
- : RefCounted<PopupMenu>(0)
- , m_popupClient(client)
+ : m_popupClient(client)
, m_scrollBar(0)
, m_popup(0)
, m_DC(0)
if (!m_scrollBar)
if (visibleItems() < client()->listSize()) {
// We need a scroll bar
- m_scrollBar = new PlatformScrollbar(this, VerticalScrollbar, SmallScrollbar);
+ m_scrollBar = PlatformScrollbar::create(this, VerticalScrollbar, SmallScrollbar);
m_scrollBar->setContainingWindow(m_popup);
}
{
if (Scrollbar::hasPlatformScrollbars()) {
if (hasBar && !m_hBar) {
- m_hBar = new PlatformScrollbar(this, HorizontalScrollbar, RegularScrollbar);
+ m_hBar = PlatformScrollbar::create(this, HorizontalScrollbar, RegularScrollbar);
m_view->addChild(m_hBar.get());
} else if (!hasBar && m_hBar) {
m_view->removeChild(m_hBar.get());
{
if (Scrollbar::hasPlatformScrollbars()) {
if (hasBar && !m_vBar) {
- m_vBar = new PlatformScrollbar(this, VerticalScrollbar, RegularScrollbar);
+ m_vBar = PlatformScrollbar::create(this, VerticalScrollbar, RegularScrollbar);
m_view->addChild(m_vBar.get());
} else if (!hasBar && m_vBar) {
m_view->removeChild(m_vBar.get());
// State available during IE's events for drag and drop and copy/paste
class ClipboardWx : public Clipboard {
public:
- ClipboardWx(ClipboardAccessPolicy policy, bool forDragging);
- ~ClipboardWx() { }
-
+ static PassRefPtr<ClipboardWx> create(ClipboardAccessPolicy policy, bool forDragging)
+ {
+ return adoptRef(new ClipboardWx(policy, forDragging));
+ }
+
void clearData(const String& type);
void clearAllData();
String getData(const String& type, bool& success) const;
virtual void writeRange(Range*, Frame*);
virtual bool hasData();
+
+ private:
+ ClipboardWx(ClipboardAccessPolicy, bool forDragging);
};
}
/*
- * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#ifndef PlatformScrollbar_h
#define PlatformScrollbar_h
-#include "Widget.h"
#include "ScrollBar.h"
+#include "Widget.h"
+#include <wtf/PassRefPtr.h>
namespace WebCore {
class PlatformScrollbar : public Widget, public Scrollbar {
public:
- PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
+ static PassRefPtr<PlatformScrollbar> create(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size)
+ {
+ return adoptRef(new PlatformScrollbar(client, orientation, size));
+ }
virtual ~PlatformScrollbar();
virtual bool isWidget() const { return true; }
protected:
virtual void updateThumbPosition();
virtual void updateThumbProportion();
+
+private:
+ PlatformScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize);
};
}
namespace WebCore {
PopupMenu::PopupMenu(PopupMenuClient* client)
- : RefCounted<PopupMenu>(0)
- , m_popupClient(client)
+ : m_popupClient(client)
, m_menu(NULL)
{
}
void FileChooser::openFileChooser(Document*) { notImplemented(); }
String FileChooser::basenameForWidth(const Font&, int width) const { notImplemented(); return String(); }
-Icon::Icon() : RefCounted<Icon>(0) { notImplemented(); }
+Icon::Icon() { notImplemented(); }
Icon::~Icon() { notImplemented(); }
-PassRefPtr<Icon> Icon::newIconForFile(const String& filename) { notImplemented(); return PassRefPtr<Icon>(new Icon()); }
+PassRefPtr<Icon> Icon::newIconForFile(const String& filename) { notImplemented(); return 0; }
void Icon::paint(GraphicsContext*, const IntRect&) { notImplemented(); }
ContextMenu::ContextMenu(const HitTestResult& result) : m_hitTestResult(result) { notImplemented(); }
PassRefPtr<Scrollbar> RenderLayer::createScrollbar(ScrollbarOrientation orientation)
{
if (Scrollbar::hasPlatformScrollbars()) {
- RefPtr<PlatformScrollbar> widget = new PlatformScrollbar(this, orientation, RegularScrollbar);
+ RefPtr<PlatformScrollbar> widget = PlatformScrollbar::create(this, orientation, RegularScrollbar);
m_object->document()->view()->addChild(widget.get());
return widget.release();
}
/*
* This file is part of the select element renderer in WebCore.
*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
if (!m_vBar && Scrollbar::hasPlatformScrollbars())
if (FrameView* view = node()->document()->view()) {
- RefPtr<PlatformScrollbar> widget = new PlatformScrollbar(this, VerticalScrollbar, SmallScrollbar);
+ RefPtr<PlatformScrollbar> widget = PlatformScrollbar::create(this, VerticalScrollbar, SmallScrollbar);
view->addChild(widget.get());
m_vBar = widget.release();
}
m_page.set(new Page(dummyChromeClient, dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient));
m_page->settings()->setJavaScriptEnabled(false);
- m_frame = new Frame(m_page.get(), 0, dummyFrameLoaderClient);
+ m_frame = Frame::create(m_page.get(), 0, dummyFrameLoaderClient);
m_frameView = new FrameView(m_frame.get());
m_frameView->deref(); // FIXME: FrameView starts with a refcount of 1
m_frame->setView(m_frameView.get());
virtual void didFinishLoad() { }
virtual void prepareForDataSourceReplacement() { }
- virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) { return new DocumentLoader(request, substituteData); }
+ virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) { return DocumentLoader::create(request, substituteData); }
virtual void setTitle(const String& title, const KURL&) { }
virtual String userAgent(const KURL&) { return ""; }
+2008-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - more https://bugs.webkit.org/show_bug.cgi?id=17257
+ start ref counts at 1 instead of 0 for speed
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::createDocumentLoader): Use create instead of new.
+ * webkit/webkitwebframe.cpp:
+ (webkit_web_frame_new): Ditto.
+ (webkit_web_frame_init_with_web_view): Ditto.
+
2008-06-13 Darin Adler <darin@apple.com>
- try to fix build
WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClient::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData)
{
- RefPtr<DocumentLoader> loader = new DocumentLoader(request, substituteData);
- return loader.release();
+ return DocumentLoader::create(request, substituteData);
}
void FrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction policyFunction, PassRefPtr<FormState>)
priv->webView = webView;
priv->client = new WebKit::FrameLoaderClient(frame);
- priv->coreFrame = new Frame(viewPriv->corePage, 0, priv->client);
+ priv->coreFrame = Frame::create(viewPriv->corePage, 0, priv->client).get();
priv->coreFrame->init();
return frame;
priv->webView = webView;
priv->client = new WebKit::FrameLoaderClient(frame);
- priv->coreFrame = new Frame(viewPriv->corePage, element, priv->client);
+ priv->coreFrame = Frame::create(viewPriv->corePage, element, priv->client).release().releaseRef();
priv->coreFrame->init();
return frame;
+2008-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - more of https://bugs.webkit.org/show_bug.cgi?id=17257
+ start ref counts at 1 instead of 0 for speed
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::createDocumentLoader): Use create instead of new.
+ (WebFrameLoaderClient::createFrame): Remove now-obsolete adoptRef that was balanced by
+ a ref call inside the Frame constructor. The lifetime rules for Frame are now the
+ conventional ones without a special case.
+
+ * WebView/WebDataSource.mm:
+ (-[WebDataSource _initWithDocumentLoader:]): Changed argument to be a PassRefPtr, since
+ this function takes ownership of the DocumentLoader.
+ (-[WebDataSource initWithRequest:]): Use create instead of new.
+ * WebView/WebDataSourceInternal.h: Changed _initWithDocumentLoader argument to be a
+ PassRefPtr and also cleaned up the header a bit.
+
+ * WebView/WebDocumentLoaderMac.h:
+ (WebDocumentLoaderMac::create): Added. Also made the constructor and a couple of virtual
+ functions private.
+
+ * WebView/WebFrame.mm:
+ (+[WebFrame _createFrameWithPage:frameName:frameView:ownerElement:]): Use create instead
+ of new.
+
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Sam.
PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
{
- RefPtr<WebDocumentLoaderMac> loader = new WebDocumentLoaderMac(request, substituteData);
+ RefPtr<WebDocumentLoaderMac> loader = WebDocumentLoaderMac::create(request, substituteData);
WebDataSource *dataSource = [[WebDataSource alloc] _initWithDocumentLoader:loader.get()];
loader->setDataSource(dataSource, getWebView(m_webFrame.get()));
WebFrame *newFrame = kit(newCoreFrame.get());
- core(m_webFrame.get())->tree()->appendChild(adoptRef(newCoreFrame.get()));
+ core(m_webFrame.get())->tree()->appendChild(newCoreFrame);
if ([newFrame _dataSource])
[[newFrame _dataSource] _documentLoader]->setOverrideEncoding([[m_webFrame.get() _dataSource] _documentLoader]->overrideEncoding());
return _private->loader;
}
-- (id)_initWithDocumentLoader:(WebDocumentLoaderMac *)loader
+- (id)_initWithDocumentLoader:(PassRefPtr<WebDocumentLoaderMac>)loader
{
self = [super init];
if (!self)
_private = [[WebDataSourcePrivate alloc] init];
- _private->loader = loader;
- loader->ref();
+ _private->loader = loader.releaseRef();
LOG(Loading, "creating datasource for %@", static_cast<NSURL *>(_private->loader->request().url()));
- (id)initWithRequest:(NSURLRequest *)request
{
- return [self _initWithDocumentLoader:new WebDocumentLoaderMac(request, SubstituteData())];
+ return [self _initWithDocumentLoader:WebDocumentLoaderMac::create(request, SubstituteData())];
}
- (void)dealloc
*/
#import "WebDataSourcePrivate.h"
+#import <wtf/Forward.h>
-#ifdef __cplusplus
namespace WebCore {
class DocumentLoader;
}
-typedef WebCore::DocumentLoader WebCoreDocumentLoader;
+
class WebDocumentLoaderMac;
-#else
-@class WebCoreDocumentLoader;
-@class WebDocumentLoaderMac;
-#endif
@class DOMDocumentFragment;
@class DOMElement;
@class WebResource;
@class WebView;
-@protocol WebDocumentRepresentation;
-
@interface WebDataSource (WebInternal)
- (void)_makeRepresentation;
- (BOOL)_isDocumentHTML;
- (DOMDocumentFragment *)_documentFragmentWithArchive:(WebArchive *)archive;
+ (NSMutableDictionary *)_repTypesAllowImageTypeOmission:(BOOL)allowImageTypeOmission;
- (void)_replaceSelectionWithArchive:(WebArchive *)archive selectReplacement:(BOOL)selectReplacement;
-- (id)_initWithDocumentLoader:(WebDocumentLoaderMac*)loader;
+- (id)_initWithDocumentLoader:(PassRefPtr<WebDocumentLoaderMac>)loader;
- (void)_finishedLoading;
- (void)_receivedData:(NSData *)data;
- (void)_revertToProvisionalState;
- (void)_setMainDocumentError:(NSError *)error;
-- (WebCoreDocumentLoader*)_documentLoader;
+- (WebCore::DocumentLoader*)_documentLoader;
@end
class WebDocumentLoaderMac : public WebCore::DocumentLoader {
public:
- WebDocumentLoaderMac(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
+ static PassRefPtr<WebDocumentLoaderMac> create(const WebCore::ResourceRequest& request, const WebCore::SubstituteData& data)
+ {
+ return adoptRef(new WebDocumentLoaderMac(request, data));
+ }
void setDataSource(WebDataSource *, WebView*);
void detachDataSource();
WebDataSource *dataSource() const;
- virtual void attachToFrame();
- virtual void detachFromFrame();
-
void increaseLoadCount(unsigned long identifier);
void decreaseLoadCount(unsigned long identifier);
private:
+ WebDocumentLoaderMac(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
+
+ virtual void attachToFrame();
+ virtual void detachFromFrame();
+
void retainDataSource();
void releaseDataSource();
WebView *webView = kit(page);
WebFrame *frame = [[self alloc] _initWithWebFrameView:frameView webView:webView];
- RefPtr<Frame> coreFrame = new Frame(page, ownerElement, new WebFrameLoaderClient(frame));
+ RefPtr<Frame> coreFrame = Frame::create(page, ownerElement, new WebFrameLoaderClient(frame));
[frame release];
frame->_private->coreFrame = coreFrame.get();
marginHeight = frameData->marginHeight;
frameLoaderClient = new FrameLoaderClientQt();
- frame = new Frame(webcorePage, frameData->ownerElement, frameLoaderClient);
+ RefPtr<Frame> newFrame = Frame::create(webcorePage, frameData->ownerElement, frameLoaderClient)
+ frame = newFrame.get();
+ if (frameData->ownerElement)
+ frame->ref(); // balanced by adoptRef in FrameLoaderClientQt::createFrame
frameLoaderClient->setFrame(qframe, frame);
frame->init();
}
+2008-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - more https://bugs.webkit.org/show_bug.cgi?id=17257
+ start ref counts at 1 instead of 0 for speed
+
+ * Api/qwebframe.cpp:
+ (QWebFramePrivate::init): Use create instead of new.
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::createDocumentLoader): Ditto.
+
2008-06-13 Darin Adler <darin@apple.com>
- try to fix build
2007-11-07 Simon Hausmann <hausmann@kde.org>
- Build fix, reviewed by nobody.
-
Fix the Qt build by setting up WindowFeatures before calling
createWindow on the Chrome. This is similar to openNewWindow in
page/ContextMenuController.cpp
2007-02-18 Oliver Hunt <oliver@apple.com>
- Reviewed by NOBODY (Buildfix).
-
Build fix -- adding DragClientQt method stubs
* WebCoreSupport/DragClientQt.cpp:
WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClientQt::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData)
{
- RefPtr<DocumentLoader> loader = new DocumentLoader(request, substituteData);
- return loader.release();
+ return DocumentLoader::create(request, substituteData);
}
void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&)
+2008-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - more of https://bugs.webkit.org/show_bug.cgi?id=17257
+ start ref counts at 1 instead of 0 for speed
+
+ * WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebFrameLoaderClient::createFrame): Remove now-obsolete adoptRef that was balanced by
+ a ref call inside the Frame constructor. The lifetime rules for Frame are now the
+ conventional ones without a special case.
+
+ * WebFrame.cpp:
+ (WebFrame::init): Renamed function from initWithWebFrameView and removed the unused
+ IWebFrameView argument (every caller was passing 0). Also changed this to return the
+ WebCore Frame object, which is needed to straighten out the lifetime and ownership
+ issues.
+ * WebFrame.h: Ditto.
+
+ * WebView.cpp:
+ (WebView::initWithFrame): Changed to call new init function and use the return value.
+
2008-06-13 Darin Adler <darin@apple.com>
Reviewed by John Sullivan.
Update WebKit.sln for the removal of Release dftables
- Reviewed by NOBODY.
-
* WebKit.vcproj/WebKit.sln:
2007-10-25 Kevin McCullough <kmccullough@apple.com>
Fix for clean builds needed after r26683
- Reviewed by NOBODY.
-
* WebView.cpp: Remove #include of non-existant file.
2007-10-17 Anders Carlsson <andersca@apple.com>
2007-01-11 Brady Eidson <beidson@apple.com>
- Reviewed by NOBODY.
-
Make it build again after my OpenSource http auth checkin
* WebFrame.cpp:
COMPtr<WebFrame> webFrame(AdoptCOM, WebFrame::createInstance());
- webFrame->initWithWebFrameView(0, m_webFrame->webView(), coreFrame->page(), ownerElement);
-
- RefPtr<Frame> childFrame(adoptRef(core(webFrame.get()))); // We have to adopt, because Frames start out with a refcount of 1.
- ASSERT(childFrame);
+ RefPtr<Frame> childFrame = webFrame->init(m_webFrame->webView(), coreFrame->page(), ownerElement);
coreFrame->tree()->appendChild(childFrame);
childFrame->tree()->setName(name);
// WebFrame ---------------------------------------------------------------
-void WebFrame::initWithWebFrameView(IWebFrameView* /*view*/, IWebView* webView, Page* page, HTMLFrameOwnerElement* ownerElement)
+PassRefPtr<Frame> WebFrame::init(IWebView* webView, Page* page, HTMLFrameOwnerElement* ownerElement)
{
- if (FAILED(webView->QueryInterface(&d->webView)))
- return;
+ webView->QueryInterface(&d->webView);
d->webView->Release(); // don't hold the extra ref
HWND viewWindow;
d->webView->viewWindow((OLE_HANDLE*)&viewWindow);
this->AddRef(); // We release this ref in frameLoaderDestroyed()
- Frame* frame = new Frame(page, ownerElement, this);
- d->frame = frame;
+ RefPtr<Frame> frame = Frame::create(page, ownerElement, this);
+ d->frame = frame.get();
+ return frame.release();
}
Frame* WebFrame::impl()
virtual void registerForIconNotification(bool listen);
// WebFrame
- void initWithWebFrameView(IWebFrameView*, IWebView*, WebCore::Page*, WebCore::HTMLFrameOwnerElement*);
+ PassRefPtr<WebCore::Frame> init(IWebView*, WebCore::Page*, WebCore::HTMLFrameOwnerElement*);
WebCore::Frame* impl();
void invalidate();
void unmarkAllMisspellings();
}
WebFrame* webFrame = WebFrame::createInstance();
- webFrame->initWithWebFrameView(0 /*FIXME*/, this, m_page, 0);
+ RefPtr<Frame> coreFrame = webFrame->init(this, m_page, 0);
m_mainFrame = webFrame;
webFrame->Release(); // The WebFrame is owned by the Frame, so release our reference to it.
- m_page->mainFrame()->tree()->setName(String(frameName, SysStringLen(frameName)));
- m_page->mainFrame()->init();
+ coreFrame->tree()->setName(String(frameName, SysStringLen(frameName)));
+ coreFrame->init();
setGroupName(groupName);
addToAllWebViewsSet();
+2008-06-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Sam.
+
+ - more https://bugs.webkit.org/show_bug.cgi?id=17257
+ start ref counts at 1 instead of 0 for speed
+
+ * WebKitSupport/FrameLoaderClientWx.cpp:
+ (WebCore::FrameLoaderClientWx::createDocumentLoader): Use create function
+ instead of new.
+
2008-06-13 Darin Adler <darin@apple.com>
- try to fix build
WTF::PassRefPtr<DocumentLoader> FrameLoaderClientWx::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
{
- RefPtr<DocumentLoader> loader = new DocumentLoader(request, substituteData);
- return loader.release();
+ return DocumentLoader::create(request, substituteData);
}
void FrameLoaderClientWx::download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&)