WebCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Jun 2008 08:46:51 +0000 (08:46 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Jun 2008 08:46:51 +0000 (08:46 +0000)
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:
        * bindings/js/JSSVGMatrixCustom.cpp:
        (WebCore::JSSVGMatrix::multiply):
        (WebCore::JSSVGMatrix::inverse):
        (WebCore::JSSVGMatrix::translate):
        (WebCore::JSSVGMatrix::scale):
        (WebCore::JSSVGMatrix::scaleNonUniform):
        (WebCore::JSSVGMatrix::rotate):
        (WebCore::JSSVGMatrix::rotateFromVector):
        (WebCore::JSSVGMatrix::flipX):
        (WebCore::JSSVGMatrix::flipY):
        (WebCore::JSSVGMatrix::skewX):
        (WebCore::JSSVGMatrix::skewY):
        * bindings/js/JSSVGPODTypeWrapper.h:
        (WebCore::JSSVGPODTypeWrapperCreatorReadWrite::create):
        (WebCore::JSSVGPODTypeWrapperCreatorReadWrite::JSSVGPODTypeWrapperCreatorReadWrite):
        (WebCore::JSSVGPODTypeWrapperCreatorReadOnly::create):
        (WebCore::JSSVGPODTypeWrapperCreatorReadOnly::JSSVGPODTypeWrapperCreatorReadOnly):
        (WebCore::JSSVGPODTypeWrapperCreatorForList::create):
        (WebCore::JSSVGPODTypeWrapperCreatorForList::JSSVGPODTypeWrapperCreatorForList):
        (WebCore::JSSVGPODTypeWrapperCache::lookupOrCreateWrapper):
        (WebCore::JSSVGPODTypeWrapperCache::forgetWrapper):
        * bindings/js/JSSVGPointListCustom.cpp:
        (WebCore::finishGetter):
        (WebCore::finishSetter):
        (WebCore::finishSetterReadOnlyResult):
        (WebCore::JSSVGPointList::clear):
        (WebCore::JSSVGPointList::initialize):
        (WebCore::JSSVGPointList::getItem):
        (WebCore::JSSVGPointList::insertItemBefore):
        (WebCore::JSSVGPointList::replaceItem):
        (WebCore::JSSVGPointList::removeItem):
        (WebCore::JSSVGPointList::appendItem):
        * bindings/js/JSSVGTransformListCustom.cpp:
        (WebCore::finishGetter):
        (WebCore::finishSetter):
        (WebCore::finishSetterReadOnlyResult):
        (WebCore::JSSVGTransformList::clear):
        (WebCore::JSSVGTransformList::initialize):
        (WebCore::JSSVGTransformList::getItem):
        (WebCore::JSSVGTransformList::insertItemBefore):
        (WebCore::JSSVGTransformList::replaceItem):
        (WebCore::JSSVGTransformList::removeItem):
        (WebCore::JSSVGTransformList::appendItem):
        * bindings/scripts/CodeGeneratorJS.pm:
        * css/CSSFontSelector.cpp:
        (WebCore::CSSFontSelector::CSSFontSelector):
        (WebCore::CSSFontSelector::~CSSFontSelector):
        * css/CSSFontSelector.h:
        (WebCore::CSSFontSelector::create):
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::CSSStyleSelector):
        (WebCore::CSSStyleSelector::applyProperty):
        * dom/Attribute.cpp:
        (WebCore::Attribute::clone):
        * dom/Attribute.h:
        (WebCore::Attribute::create):
        (WebCore::Attribute::Attribute):
        * dom/BeforeTextInsertedEvent.h:
        (WebCore::BeforeTextInsertedEvent::create):
        * dom/BeforeUnloadEvent.h:
        (WebCore::BeforeUnloadEvent::create):
        * dom/CharacterData.cpp:
        (WebCore::CharacterData::dispatchModifiedEvent):
        * dom/ClipboardEvent.cpp:
        (WebCore::ClipboardEvent::ClipboardEvent):
        * dom/ClipboardEvent.h:
        (WebCore::ClipboardEvent::create):
        * dom/ContainerNode.cpp:
        (WebCore::ContainerNode::removeChild):
        (WebCore::dispatchChildInsertionEvents):
        (WebCore::dispatchChildRemovalEvents):
        * dom/Document.cpp:
        (WebCore::Document::createTextNode):
        (WebCore::Document::createComment):
        (WebCore::Document::createCDATASection):
        (WebCore::Document::createProcessingInstruction):
        (WebCore::Document::createEntityReference):
        (WebCore::Document::createEditingTextNode):
        (WebCore::Document::createEvent):
        (WebCore::Document::createAttributeNS):
        (WebCore::Document::finishedParsing):
        * dom/Document.h:
        * dom/Element.cpp:
        (WebCore::Element::createAttribute):
        * dom/Element.h:
        * dom/Event.cpp:
        (WebCore::Event::Event):
        * dom/Event.h:
        (WebCore::Event::create):
        * dom/EventTargetNode.cpp:
        (WebCore::EventTargetNode::dispatchSubtreeModifiedEvent):
        (WebCore::EventTargetNode::dispatchWindowEvent):
        (WebCore::EventTargetNode::dispatchUIEvent):
        (WebCore::EventTargetNode::dispatchKeyEvent):
        (WebCore::EventTargetNode::dispatchMouseEvent):
        (WebCore::EventTargetNode::dispatchWheelEvent):
        (WebCore::EventTargetNode::dispatchHTMLEvent):
        (WebCore::EventTargetNode::dispatchProgressEvent):
        (WebCore::EventTargetNode::dispatchStorageEvent):
        * dom/KeyboardEvent.h:
        (WebCore::KeyboardEvent::create):
        * dom/MappedAttribute.cpp:
        (WebCore::MappedAttribute::clone):
        * dom/MappedAttribute.h:
        (WebCore::MappedAttribute::create):
        (WebCore::MappedAttribute::setDecl):
        (WebCore::MappedAttribute::MappedAttribute):
        * dom/MessageEvent.cpp:
        (WebCore::MessageEvent::MessageEvent):
        * dom/MessageEvent.h:
        (WebCore::MessageEvent::create):
        * dom/MouseEvent.cpp:
        (WebCore::MouseEvent::MouseEvent):
        (WebCore::MouseEvent::initMouseEvent):
        * dom/MouseEvent.h:
        (WebCore::MouseEvent::create):
        * dom/MouseRelatedEvent.cpp:
        (WebCore::MouseRelatedEvent::MouseRelatedEvent):
        * dom/MouseRelatedEvent.h:
        * dom/MutationEvent.cpp:
        (WebCore::MutationEvent::MutationEvent):
        (WebCore::MutationEvent::initMutationEvent):
        * dom/MutationEvent.h:
        (WebCore::MutationEvent::create):
        * dom/OverflowEvent.h:
        (WebCore::OverflowEvent::create):
        * dom/ProgressEvent.h:
        (WebCore::ProgressEvent::create):
        * dom/StyledElement.cpp:
        (WebCore::StyledElement::getMappedAttributeDecl):
        (WebCore::StyledElement::setMappedAttributeDecl):
        (WebCore::StyledElement::removeMappedAttributeDecl):
        (WebCore::StyledElement::createAttribute):
        * dom/StyledElement.h:
        * dom/TextEvent.cpp:
        (WebCore::TextEvent::TextEvent):
        (WebCore::TextEvent::initTextEvent):
        * dom/TextEvent.h:
        (WebCore::TextEvent::create):
        * dom/UIEvent.cpp:
        (WebCore::UIEvent::UIEvent):
        (WebCore::UIEvent::initUIEvent):
        * dom/UIEvent.h:
        (WebCore::UIEvent::create):
        * dom/UIEventWithKeyState.h:
        (WebCore::UIEventWithKeyState::ctrlKey):
        (WebCore::UIEventWithKeyState::shiftKey):
        (WebCore::UIEventWithKeyState::altKey):
        (WebCore::UIEventWithKeyState::metaKey):
        (WebCore::UIEventWithKeyState::UIEventWithKeyState):
        * dom/WheelEvent.cpp:
        (WebCore::WheelEvent::WheelEvent):
        (WebCore::WheelEvent::initWheelEvent):
        * dom/WheelEvent.h:
        (WebCore::WheelEvent::create):
        * editing/AppendNodeCommand.cpp:
        (WebCore::AppendNodeCommand::AppendNodeCommand):
        * editing/AppendNodeCommand.h:
        (WebCore::AppendNodeCommand::create):
        * editing/ApplyStyleCommand.cpp:
        (WebCore::ApplyStyleCommand::applyBlockStyle):
        * editing/ApplyStyleCommand.h:
        (WebCore::ApplyStyleCommand::create):
        * editing/BreakBlockquoteCommand.h:
        (WebCore::BreakBlockquoteCommand::create):
        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::applyStyle):
        (WebCore::CompositeEditCommand::applyStyledElement):
        (WebCore::CompositeEditCommand::removeStyledElement):
        (WebCore::CompositeEditCommand::insertParagraphSeparator):
        (WebCore::CompositeEditCommand::insertLineBreak):
        (WebCore::CompositeEditCommand::insertNodeBefore):
        (WebCore::CompositeEditCommand::appendNode):
        (WebCore::CompositeEditCommand::removeNode):
        (WebCore::CompositeEditCommand::removeNodePreservingChildren):
        (WebCore::CompositeEditCommand::splitTextNode):
        (WebCore::CompositeEditCommand::splitElement):
        (WebCore::CompositeEditCommand::mergeIdenticalElements):
        (WebCore::CompositeEditCommand::wrapContentsInDummySpan):
        (WebCore::CompositeEditCommand::splitTextNodeContainingElement):
        (WebCore::CompositeEditCommand::joinTextNodes):
        (WebCore::CompositeEditCommand::inputText):
        (WebCore::CompositeEditCommand::insertTextIntoNode):
        (WebCore::CompositeEditCommand::deleteTextFromNode):
        (WebCore::CompositeEditCommand::replaceTextInNode):
        (WebCore::CompositeEditCommand::deleteSelection):
        (WebCore::CompositeEditCommand::removeCSSProperty):
        (WebCore::CompositeEditCommand::removeNodeAttribute):
        (WebCore::CompositeEditCommand::setNodeAttribute):
        (WebCore::CompositeEditCommand::appendBlockPlaceholder):
        (WebCore::CompositeEditCommand::insertBlockPlaceholder):
        (WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
        (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
        (WebCore::CompositeEditCommand::moveParagraphs):
        (WebCore::CompositeEditCommand::splitTreeToNode):
        * editing/CompositeEditCommand.h:
        (WebCore::CompositeEditCommand::isFirstCommand):
        * editing/CreateLinkCommand.h:
        (WebCore::CreateLinkCommand::create):
        * editing/DeleteButtonController.cpp:
        (WebCore::DeleteButtonController::deleteTarget):
        * editing/DeleteFromTextNodeCommand.cpp:
        (WebCore::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand):
        * editing/DeleteFromTextNodeCommand.h:
        (WebCore::DeleteFromTextNodeCommand::create):
        * editing/DeleteSelectionCommand.h:
        (WebCore::DeleteSelectionCommand::create):
        * editing/EditCommand.h:
        (WebCore::SimpleEditCommand::SimpleEditCommand):
        * editing/Editor.cpp:
        (WebCore::Editor::deleteSelectionWithSmartDelete):
        (WebCore::Editor::replaceSelectionWithFragment):
        (WebCore::Editor::removeFormattingAndStyle):
        (WebCore::Editor::clearLastEditCommand):
        (WebCore::Editor::dispatchCPPEvent):
        (WebCore::Editor::applyStyle):
        (WebCore::Editor::applyParagraphStyle):
        (WebCore::Editor::indent):
        (WebCore::Editor::outdent):
        (WebCore::dispatchEditableContentChangedEvents):
        * editing/Editor.h:
        * editing/EditorCommand.cpp:
        (WebCore::executeInsertFragment):
        (WebCore::executeCreateLink):
        (WebCore::executeFormatBlock):
        (WebCore::executeIndent):
        (WebCore::executeInsertOrderedList):
        (WebCore::executeInsertUnorderedList):
        (WebCore::executeOutdent):
        (WebCore::executeUnlink):
        * editing/FormatBlockCommand.h:
        (WebCore::FormatBlockCommand::create):
        * editing/IndentOutdentCommand.cpp:
        (WebCore::IndentOutdentCommand::indentRegion):
        (WebCore::IndentOutdentCommand::outdentParagraph):
        * editing/IndentOutdentCommand.h:
        (WebCore::IndentOutdentCommand::create):
        * editing/InsertIntoTextNodeCommand.cpp:
        (WebCore::InsertIntoTextNodeCommand::InsertIntoTextNodeCommand):
        * editing/InsertIntoTextNodeCommand.h:
        (WebCore::InsertIntoTextNodeCommand::create):
        * editing/InsertLineBreakCommand.h:
        (WebCore::InsertLineBreakCommand::create):
        * editing/InsertListCommand.cpp:
        (WebCore::InsertListCommand::doApply):
        * editing/InsertListCommand.h:
        (WebCore::InsertListCommand::create):
        * editing/InsertNodeBeforeCommand.cpp:
        (WebCore::InsertNodeBeforeCommand::InsertNodeBeforeCommand):
        * editing/InsertNodeBeforeCommand.h:
        (WebCore::InsertNodeBeforeCommand::create):
        * editing/InsertParagraphSeparatorCommand.cpp:
        (WebCore::InsertParagraphSeparatorCommand::doApply):
        * editing/InsertParagraphSeparatorCommand.h:
        (WebCore::InsertParagraphSeparatorCommand::create):
        * editing/InsertTextCommand.h:
        (WebCore::InsertTextCommand::create):
        * editing/JoinTextNodesCommand.cpp:
        (WebCore::JoinTextNodesCommand::JoinTextNodesCommand):
        * editing/JoinTextNodesCommand.h:
        (WebCore::JoinTextNodesCommand::create):
        * editing/MergeIdenticalElementsCommand.cpp:
        (WebCore::MergeIdenticalElementsCommand::MergeIdenticalElementsCommand):
        * editing/MergeIdenticalElementsCommand.h:
        (WebCore::MergeIdenticalElementsCommand::create):
        * editing/ModifySelectionListLevel.cpp:
        (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevelWithType):
        * editing/MoveSelectionCommand.cpp:
        (WebCore::MoveSelectionCommand::doApply):
        * editing/MoveSelectionCommand.h:
        (WebCore::MoveSelectionCommand::create):
        * editing/RemoveCSSPropertyCommand.cpp:
        (WebCore::RemoveCSSPropertyCommand::RemoveCSSPropertyCommand):
        * editing/RemoveCSSPropertyCommand.h:
        (WebCore::RemoveCSSPropertyCommand::create):
        * editing/RemoveFormatCommand.h:
        (WebCore::RemoveFormatCommand::create):
        * editing/RemoveNodeAttributeCommand.cpp:
        (WebCore::RemoveNodeAttributeCommand::RemoveNodeAttributeCommand):
        * editing/RemoveNodeAttributeCommand.h:
        (WebCore::RemoveNodeAttributeCommand::create):
        * editing/RemoveNodeCommand.cpp:
        (WebCore::RemoveNodeCommand::RemoveNodeCommand):
        * editing/RemoveNodeCommand.h:
        (WebCore::RemoveNodeCommand::create):
        * editing/RemoveNodePreservingChildrenCommand.cpp:
        (WebCore::RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand):
        (WebCore::RemoveNodePreservingChildrenCommand::doApply):
        * editing/RemoveNodePreservingChildrenCommand.h:
        (WebCore::RemoveNodePreservingChildrenCommand::create):
        * editing/ReplaceSelectionCommand.cpp:
        (WebCore::):
        (WebCore::ReplacementFragment::hasInterchangeNewlineAtStart):
        (WebCore::ReplacementFragment::hasInterchangeNewlineAtEnd):
        (WebCore::ReplacementFragment::ReplacementFragment):
        * editing/ReplaceSelectionCommand.h:
        (WebCore::ReplaceSelectionCommand::create):
        * editing/SetNodeAttributeCommand.cpp:
        (WebCore::SetNodeAttributeCommand::SetNodeAttributeCommand):
        * editing/SetNodeAttributeCommand.h:
        (WebCore::SetNodeAttributeCommand::create):
        * editing/SplitElementCommand.cpp:
        (WebCore::SplitElementCommand::SplitElementCommand):
        * editing/SplitElementCommand.h:
        (WebCore::SplitElementCommand::create):
        * editing/SplitTextNodeCommand.cpp:
        (WebCore::SplitTextNodeCommand::SplitTextNodeCommand):
        * editing/SplitTextNodeCommand.h:
        (WebCore::SplitTextNodeCommand::create):
        * editing/SplitTextNodeContainingElementCommand.cpp:
        (WebCore::SplitTextNodeContainingElementCommand::SplitTextNodeContainingElementCommand):
        * editing/SplitTextNodeContainingElementCommand.h:
        (WebCore::SplitTextNodeContainingElementCommand::create):
        * editing/TypingCommand.cpp:
        (WebCore::TypingCommand::deleteSelection):
        (WebCore::TypingCommand::deleteKeyPressed):
        (WebCore::TypingCommand::forwardDeleteKeyPressed):
        (WebCore::TypingCommand::insertText):
        (WebCore::TypingCommand::insertLineBreak):
        (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
        (WebCore::TypingCommand::insertParagraphSeparator):
        (WebCore::TypingCommand::insertTextRunWithoutNewlines):
        * editing/TypingCommand.h:
        (WebCore::TypingCommand::create):
        (WebCore::TypingCommand::smartDelete):
        * editing/UnlinkCommand.h:
        (WebCore::UnlinkCommand::create):
        * editing/WrapContentsInDummySpanCommand.cpp:
        (WebCore::WrapContentsInDummySpanCommand::WrapContentsInDummySpanCommand):
        * editing/WrapContentsInDummySpanCommand.h:
        (WebCore::WrapContentsInDummySpanCommand::create):
        * html/HTMLTableElement.cpp:
        (WebCore::HTMLTableElement::additionalAttributeStyleDecls):
        (WebCore::HTMLTableElement::addSharedCellBordersDecl):
        (WebCore::HTMLTableElement::addSharedCellPaddingDecl):
        (WebCore::HTMLTableElement::addSharedGroupDecls):
        * html/HTMLTokenizer.cpp:
        (WebCore::Token::addAttribute):
        * html/HTMLViewSourceDocument.cpp:
        (WebCore::HTMLViewSourceDocument::createContainingTable):
        (WebCore::HTMLViewSourceDocument::addSpanWithClassName):
        (WebCore::HTMLViewSourceDocument::addLine):
        (WebCore::HTMLViewSourceDocument::addLink):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::didOpenURL):
        * loader/appcache/DOMApplicationCache.cpp:
        (WebCore::DOMApplicationCache::callListener):
        * page/ContextMenuController.cpp:
        (WebCore::ContextMenuController::contextMenuItemSelected):
        * page/DOMWindow.cpp:
        (WebCore::PostMessageTimer::PostMessageTimer):
        (WebCore::PostMessageTimer::fired):
        (WebCore::DOMWindow::postMessage):
        * page/DragController.cpp:
        (WebCore::DragController::concludeDrag):
        * page/EventHandler.cpp:
        (WebCore::EventHandler::dispatchDragEvent):
        (WebCore::EventHandler::keyEvent):
        (WebCore::EventHandler::handleTextInputEvent):
        * page/Frame.cpp:
        (WebCore::Frame::computeAndSetTypingStyle):
        (WebCore::Frame::shouldClose):
        * page/FrameView.cpp:
        (WebCore::FrameView::updateOverflowStatus):
        * page/mac/EventHandlerMac.mm:
        (WebCore::EventHandler::currentKeyboardEvent):
        * page/mac/FrameMac.mm:
        * platform/DeprecatedValueListImpl.cpp:
        (WebCore::DeprecatedValueListImpl::Private::Private):
        (WebCore::DeprecatedValueListImpl::DeprecatedValueListImpl):
        (WebCore::DeprecatedValueListImpl::copyOnWrite):
        * platform/graphics/FontSelector.h:
        * platform/graphics/GlyphPageTreeNode.cpp:
        (WebCore::GlyphPageTreeNode::initializePage):
        * platform/graphics/GlyphPageTreeNode.h:
        (WebCore::GlyphPage::create):
        (WebCore::GlyphPage::GlyphPage):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::scrollToOffset):
        (WebCore::RenderLayer::updateOverflowStatus):
        (WebCore::RenderLayer::updateReflectionStyle):
        * rendering/style/RenderStyle.h:
        (WebCore::TransformOperation::~TransformOperation):
        (WebCore::ScaleTransformOperation::create):
        (WebCore::ScaleTransformOperation::ScaleTransformOperation):
        (WebCore::RotateTransformOperation::create):
        (WebCore::RotateTransformOperation::RotateTransformOperation):
        (WebCore::SkewTransformOperation::create):
        (WebCore::SkewTransformOperation::operator==):
        (WebCore::SkewTransformOperation::SkewTransformOperation):
        (WebCore::TranslateTransformOperation::create):
        (WebCore::TranslateTransformOperation::operator==):
        (WebCore::TranslateTransformOperation::TranslateTransformOperation):
        (WebCore::MatrixTransformOperation::create):
        (WebCore::MatrixTransformOperation::MatrixTransformOperation):
        (WebCore::StyleReflection::create):
        (WebCore::StyleReflection::StyleReflection):
        * storage/StorageEvent.cpp:
        (WebCore::StorageEvent::StorageEvent):
        (WebCore::StorageEvent::initStorageEvent):
        * storage/StorageEvent.h:
        (WebCore::StorageEvent::create):
        (WebCore::StorageEvent::StorageEvent):
        * svg/SVGAngle.cpp:
        (WebCore::SVGAngle::SVGAngle):
        * svg/SVGAngle.h:
        (WebCore::SVGAngle::create):
        * svg/SVGAnimatedTemplate.h:
        (WebCore::SVGAnimatedTemplate::SVGAnimatedTemplate):
        (WebCore::lookupOrCreateWrapper):
        * svg/SVGElement.cpp:
        (WebCore::SVGElement::sendSVGLoadEventIfPossible):
        * svg/SVGElement.h:
        * svg/SVGMarkerElement.cpp:
        (WebCore::SVGMarkerElement::SVGMarkerElement):
        (WebCore::SVGMarkerElement::parseMappedAttribute):
        (WebCore::SVGMarkerElement::setOrientToAngle):
        * svg/SVGMarkerElement.h:
        * svg/SVGSVGElement.cpp:
        (WebCore::SVGSVGElement::createSVGAngle):
        * svg/SVGSVGElement.h:
        * svg/SVGZoomEvent.h:
        (WebCore::SVGZoomEvent::create):
        * svg/graphics/SVGImage.cpp:
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::callReadyStateChangeListener):
        (WebCore::XMLHttpRequest::dispatchProgressEvent):
        * xml/XMLHttpRequestProgressEvent.cpp:
        * xml/XMLHttpRequestProgressEvent.h:
        (WebCore::XMLHttpRequestProgressEvent::create):
        (WebCore::XMLHttpRequestProgressEvent::position):
        (WebCore::XMLHttpRequestProgressEvent::totalSize):
        (WebCore::XMLHttpRequestProgressEvent::XMLHttpRequestProgressEvent):

WebKit/mac:

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

        * WebView/WebFrame.mm:
        (-[WebFrame _replaceSelectionWithFragment:selectReplacement:smartReplace:matchStyle:]):
        * WebView/WebPDFView.mm:
        (-[WebPDFView PDFViewWillClickOnLink:withURL:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34536 268f45cc-cd09-0410-ab3c-d52691b4dbfc

152 files changed:
WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/bindings/js/JSSVGMatrixCustom.cpp
WebCore/bindings/js/JSSVGPODTypeWrapper.h
WebCore/bindings/js/JSSVGPointListCustom.cpp
WebCore/bindings/js/JSSVGTransformListCustom.cpp
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/css/CSSFontSelector.cpp
WebCore/css/CSSFontSelector.h
WebCore/css/CSSStyleSelector.cpp
WebCore/dom/Attribute.cpp
WebCore/dom/Attribute.h
WebCore/dom/BeforeTextInsertedEvent.h
WebCore/dom/BeforeUnloadEvent.h
WebCore/dom/CharacterData.cpp
WebCore/dom/ClipboardEvent.cpp
WebCore/dom/ClipboardEvent.h
WebCore/dom/ContainerNode.cpp
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/dom/Element.cpp
WebCore/dom/Element.h
WebCore/dom/Event.cpp
WebCore/dom/Event.h
WebCore/dom/EventTargetNode.cpp
WebCore/dom/KeyboardEvent.h
WebCore/dom/MappedAttribute.cpp
WebCore/dom/MappedAttribute.h
WebCore/dom/MessageEvent.cpp
WebCore/dom/MessageEvent.h
WebCore/dom/MouseEvent.cpp
WebCore/dom/MouseEvent.h
WebCore/dom/MouseRelatedEvent.cpp
WebCore/dom/MouseRelatedEvent.h
WebCore/dom/MutationEvent.cpp
WebCore/dom/MutationEvent.h
WebCore/dom/OverflowEvent.h
WebCore/dom/ProgressEvent.h
WebCore/dom/StyledElement.cpp
WebCore/dom/StyledElement.h
WebCore/dom/TextEvent.cpp
WebCore/dom/TextEvent.h
WebCore/dom/UIEvent.cpp
WebCore/dom/UIEvent.h
WebCore/dom/UIEventWithKeyState.h
WebCore/dom/WheelEvent.cpp
WebCore/dom/WheelEvent.h
WebCore/editing/AppendNodeCommand.cpp
WebCore/editing/AppendNodeCommand.h
WebCore/editing/ApplyStyleCommand.cpp
WebCore/editing/ApplyStyleCommand.h
WebCore/editing/BreakBlockquoteCommand.h
WebCore/editing/CompositeEditCommand.cpp
WebCore/editing/CompositeEditCommand.h
WebCore/editing/CreateLinkCommand.h
WebCore/editing/DeleteButtonController.cpp
WebCore/editing/DeleteFromTextNodeCommand.cpp
WebCore/editing/DeleteFromTextNodeCommand.h
WebCore/editing/DeleteSelectionCommand.h
WebCore/editing/EditCommand.cpp
WebCore/editing/EditCommand.h
WebCore/editing/Editor.cpp
WebCore/editing/Editor.h
WebCore/editing/EditorCommand.cpp
WebCore/editing/FormatBlockCommand.h
WebCore/editing/IndentOutdentCommand.cpp
WebCore/editing/IndentOutdentCommand.h
WebCore/editing/InsertIntoTextNodeCommand.cpp
WebCore/editing/InsertIntoTextNodeCommand.h
WebCore/editing/InsertLineBreakCommand.h
WebCore/editing/InsertListCommand.cpp
WebCore/editing/InsertListCommand.h
WebCore/editing/InsertNodeBeforeCommand.cpp
WebCore/editing/InsertNodeBeforeCommand.h
WebCore/editing/InsertParagraphSeparatorCommand.cpp
WebCore/editing/InsertParagraphSeparatorCommand.h
WebCore/editing/InsertTextCommand.h
WebCore/editing/JoinTextNodesCommand.cpp
WebCore/editing/JoinTextNodesCommand.h
WebCore/editing/MergeIdenticalElementsCommand.cpp
WebCore/editing/MergeIdenticalElementsCommand.h
WebCore/editing/ModifySelectionListLevel.cpp
WebCore/editing/MoveSelectionCommand.cpp
WebCore/editing/MoveSelectionCommand.h
WebCore/editing/RemoveCSSPropertyCommand.cpp
WebCore/editing/RemoveCSSPropertyCommand.h
WebCore/editing/RemoveFormatCommand.h
WebCore/editing/RemoveNodeAttributeCommand.cpp
WebCore/editing/RemoveNodeAttributeCommand.h
WebCore/editing/RemoveNodeCommand.cpp
WebCore/editing/RemoveNodeCommand.h
WebCore/editing/RemoveNodePreservingChildrenCommand.cpp
WebCore/editing/RemoveNodePreservingChildrenCommand.h
WebCore/editing/ReplaceSelectionCommand.cpp
WebCore/editing/ReplaceSelectionCommand.h
WebCore/editing/SetNodeAttributeCommand.cpp
WebCore/editing/SetNodeAttributeCommand.h
WebCore/editing/SplitElementCommand.cpp
WebCore/editing/SplitElementCommand.h
WebCore/editing/SplitTextNodeCommand.cpp
WebCore/editing/SplitTextNodeCommand.h
WebCore/editing/SplitTextNodeContainingElementCommand.cpp
WebCore/editing/SplitTextNodeContainingElementCommand.h
WebCore/editing/TypingCommand.cpp
WebCore/editing/TypingCommand.h
WebCore/editing/UnlinkCommand.h
WebCore/editing/WrapContentsInDummySpanCommand.cpp
WebCore/editing/WrapContentsInDummySpanCommand.h
WebCore/history/HistoryItem.cpp
WebCore/html/HTMLTableElement.cpp
WebCore/html/HTMLTokenizer.cpp
WebCore/html/HTMLViewSourceDocument.cpp
WebCore/loader/FrameLoader.cpp
WebCore/loader/NetscapePlugInStreamLoader.h
WebCore/loader/appcache/DOMApplicationCache.cpp
WebCore/page/ContextMenuController.cpp
WebCore/page/DOMWindow.cpp
WebCore/page/DragController.cpp
WebCore/page/EventHandler.cpp
WebCore/page/Frame.cpp
WebCore/page/FrameView.cpp
WebCore/page/mac/EventHandlerMac.mm
WebCore/page/mac/FrameMac.mm
WebCore/platform/DeprecatedValueListImpl.cpp
WebCore/platform/graphics/FontSelector.h
WebCore/platform/graphics/GlyphPageTreeNode.cpp
WebCore/platform/graphics/GlyphPageTreeNode.h
WebCore/platform/network/FormData.cpp
WebCore/plugins/PluginStream.cpp
WebCore/plugins/PluginStream.h
WebCore/plugins/PluginView.cpp
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/style/RenderStyle.h
WebCore/storage/StorageEvent.cpp
WebCore/storage/StorageEvent.h
WebCore/svg/SVGAngle.cpp
WebCore/svg/SVGAngle.h
WebCore/svg/SVGAnimatedTemplate.h
WebCore/svg/SVGElement.cpp
WebCore/svg/SVGElement.h
WebCore/svg/SVGMarkerElement.cpp
WebCore/svg/SVGMarkerElement.h
WebCore/svg/SVGSVGElement.cpp
WebCore/svg/SVGSVGElement.h
WebCore/svg/SVGZoomEvent.h
WebCore/svg/graphics/SVGImage.cpp
WebCore/xml/XMLHttpRequest.cpp
WebCore/xml/XMLHttpRequestProgressEvent.cpp
WebCore/xml/XMLHttpRequestProgressEvent.h
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebFrame.mm
WebKit/mac/WebView/WebPDFView.mm

index dc53c71..08b9eaa 100644 (file)
@@ -1,3 +1,445 @@
+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:
+        * bindings/js/JSSVGMatrixCustom.cpp:
+        (WebCore::JSSVGMatrix::multiply):
+        (WebCore::JSSVGMatrix::inverse):
+        (WebCore::JSSVGMatrix::translate):
+        (WebCore::JSSVGMatrix::scale):
+        (WebCore::JSSVGMatrix::scaleNonUniform):
+        (WebCore::JSSVGMatrix::rotate):
+        (WebCore::JSSVGMatrix::rotateFromVector):
+        (WebCore::JSSVGMatrix::flipX):
+        (WebCore::JSSVGMatrix::flipY):
+        (WebCore::JSSVGMatrix::skewX):
+        (WebCore::JSSVGMatrix::skewY):
+        * bindings/js/JSSVGPODTypeWrapper.h:
+        (WebCore::JSSVGPODTypeWrapperCreatorReadWrite::create):
+        (WebCore::JSSVGPODTypeWrapperCreatorReadWrite::JSSVGPODTypeWrapperCreatorReadWrite):
+        (WebCore::JSSVGPODTypeWrapperCreatorReadOnly::create):
+        (WebCore::JSSVGPODTypeWrapperCreatorReadOnly::JSSVGPODTypeWrapperCreatorReadOnly):
+        (WebCore::JSSVGPODTypeWrapperCreatorForList::create):
+        (WebCore::JSSVGPODTypeWrapperCreatorForList::JSSVGPODTypeWrapperCreatorForList):
+        (WebCore::JSSVGPODTypeWrapperCache::lookupOrCreateWrapper):
+        (WebCore::JSSVGPODTypeWrapperCache::forgetWrapper):
+        * bindings/js/JSSVGPointListCustom.cpp:
+        (WebCore::finishGetter):
+        (WebCore::finishSetter):
+        (WebCore::finishSetterReadOnlyResult):
+        (WebCore::JSSVGPointList::clear):
+        (WebCore::JSSVGPointList::initialize):
+        (WebCore::JSSVGPointList::getItem):
+        (WebCore::JSSVGPointList::insertItemBefore):
+        (WebCore::JSSVGPointList::replaceItem):
+        (WebCore::JSSVGPointList::removeItem):
+        (WebCore::JSSVGPointList::appendItem):
+        * bindings/js/JSSVGTransformListCustom.cpp:
+        (WebCore::finishGetter):
+        (WebCore::finishSetter):
+        (WebCore::finishSetterReadOnlyResult):
+        (WebCore::JSSVGTransformList::clear):
+        (WebCore::JSSVGTransformList::initialize):
+        (WebCore::JSSVGTransformList::getItem):
+        (WebCore::JSSVGTransformList::insertItemBefore):
+        (WebCore::JSSVGTransformList::replaceItem):
+        (WebCore::JSSVGTransformList::removeItem):
+        (WebCore::JSSVGTransformList::appendItem):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::CSSFontSelector):
+        (WebCore::CSSFontSelector::~CSSFontSelector):
+        * css/CSSFontSelector.h:
+        (WebCore::CSSFontSelector::create):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::CSSStyleSelector):
+        (WebCore::CSSStyleSelector::applyProperty):
+        * dom/Attribute.cpp:
+        (WebCore::Attribute::clone):
+        * dom/Attribute.h:
+        (WebCore::Attribute::create):
+        (WebCore::Attribute::Attribute):
+        * dom/BeforeTextInsertedEvent.h:
+        (WebCore::BeforeTextInsertedEvent::create):
+        * dom/BeforeUnloadEvent.h:
+        (WebCore::BeforeUnloadEvent::create):
+        * dom/CharacterData.cpp:
+        (WebCore::CharacterData::dispatchModifiedEvent):
+        * dom/ClipboardEvent.cpp:
+        (WebCore::ClipboardEvent::ClipboardEvent):
+        * dom/ClipboardEvent.h:
+        (WebCore::ClipboardEvent::create):
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::removeChild):
+        (WebCore::dispatchChildInsertionEvents):
+        (WebCore::dispatchChildRemovalEvents):
+        * dom/Document.cpp:
+        (WebCore::Document::createTextNode):
+        (WebCore::Document::createComment):
+        (WebCore::Document::createCDATASection):
+        (WebCore::Document::createProcessingInstruction):
+        (WebCore::Document::createEntityReference):
+        (WebCore::Document::createEditingTextNode):
+        (WebCore::Document::createEvent):
+        (WebCore::Document::createAttributeNS):
+        (WebCore::Document::finishedParsing):
+        * dom/Document.h:
+        * dom/Element.cpp:
+        (WebCore::Element::createAttribute):
+        * dom/Element.h:
+        * dom/Event.cpp:
+        (WebCore::Event::Event):
+        * dom/Event.h:
+        (WebCore::Event::create):
+        * dom/EventTargetNode.cpp:
+        (WebCore::EventTargetNode::dispatchSubtreeModifiedEvent):
+        (WebCore::EventTargetNode::dispatchWindowEvent):
+        (WebCore::EventTargetNode::dispatchUIEvent):
+        (WebCore::EventTargetNode::dispatchKeyEvent):
+        (WebCore::EventTargetNode::dispatchMouseEvent):
+        (WebCore::EventTargetNode::dispatchWheelEvent):
+        (WebCore::EventTargetNode::dispatchHTMLEvent):
+        (WebCore::EventTargetNode::dispatchProgressEvent):
+        (WebCore::EventTargetNode::dispatchStorageEvent):
+        * dom/KeyboardEvent.h:
+        (WebCore::KeyboardEvent::create):
+        * dom/MappedAttribute.cpp:
+        (WebCore::MappedAttribute::clone):
+        * dom/MappedAttribute.h:
+        (WebCore::MappedAttribute::create):
+        (WebCore::MappedAttribute::setDecl):
+        (WebCore::MappedAttribute::MappedAttribute):
+        * dom/MessageEvent.cpp:
+        (WebCore::MessageEvent::MessageEvent):
+        * dom/MessageEvent.h:
+        (WebCore::MessageEvent::create):
+        * dom/MouseEvent.cpp:
+        (WebCore::MouseEvent::MouseEvent):
+        (WebCore::MouseEvent::initMouseEvent):
+        * dom/MouseEvent.h:
+        (WebCore::MouseEvent::create):
+        * dom/MouseRelatedEvent.cpp:
+        (WebCore::MouseRelatedEvent::MouseRelatedEvent):
+        * dom/MouseRelatedEvent.h:
+        * dom/MutationEvent.cpp:
+        (WebCore::MutationEvent::MutationEvent):
+        (WebCore::MutationEvent::initMutationEvent):
+        * dom/MutationEvent.h:
+        (WebCore::MutationEvent::create):
+        * dom/OverflowEvent.h:
+        (WebCore::OverflowEvent::create):
+        * dom/ProgressEvent.h:
+        (WebCore::ProgressEvent::create):
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::getMappedAttributeDecl):
+        (WebCore::StyledElement::setMappedAttributeDecl):
+        (WebCore::StyledElement::removeMappedAttributeDecl):
+        (WebCore::StyledElement::createAttribute):
+        * dom/StyledElement.h:
+        * dom/TextEvent.cpp:
+        (WebCore::TextEvent::TextEvent):
+        (WebCore::TextEvent::initTextEvent):
+        * dom/TextEvent.h:
+        (WebCore::TextEvent::create):
+        * dom/UIEvent.cpp:
+        (WebCore::UIEvent::UIEvent):
+        (WebCore::UIEvent::initUIEvent):
+        * dom/UIEvent.h:
+        (WebCore::UIEvent::create):
+        * dom/UIEventWithKeyState.h:
+        (WebCore::UIEventWithKeyState::ctrlKey):
+        (WebCore::UIEventWithKeyState::shiftKey):
+        (WebCore::UIEventWithKeyState::altKey):
+        (WebCore::UIEventWithKeyState::metaKey):
+        (WebCore::UIEventWithKeyState::UIEventWithKeyState):
+        * dom/WheelEvent.cpp:
+        (WebCore::WheelEvent::WheelEvent):
+        (WebCore::WheelEvent::initWheelEvent):
+        * dom/WheelEvent.h:
+        (WebCore::WheelEvent::create):
+        * editing/AppendNodeCommand.cpp:
+        (WebCore::AppendNodeCommand::AppendNodeCommand):
+        * editing/AppendNodeCommand.h:
+        (WebCore::AppendNodeCommand::create):
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyBlockStyle):
+        * editing/ApplyStyleCommand.h:
+        (WebCore::ApplyStyleCommand::create):
+        * editing/BreakBlockquoteCommand.h:
+        (WebCore::BreakBlockquoteCommand::create):
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::applyStyle):
+        (WebCore::CompositeEditCommand::applyStyledElement):
+        (WebCore::CompositeEditCommand::removeStyledElement):
+        (WebCore::CompositeEditCommand::insertParagraphSeparator):
+        (WebCore::CompositeEditCommand::insertLineBreak):
+        (WebCore::CompositeEditCommand::insertNodeBefore):
+        (WebCore::CompositeEditCommand::appendNode):
+        (WebCore::CompositeEditCommand::removeNode):
+        (WebCore::CompositeEditCommand::removeNodePreservingChildren):
+        (WebCore::CompositeEditCommand::splitTextNode):
+        (WebCore::CompositeEditCommand::splitElement):
+        (WebCore::CompositeEditCommand::mergeIdenticalElements):
+        (WebCore::CompositeEditCommand::wrapContentsInDummySpan):
+        (WebCore::CompositeEditCommand::splitTextNodeContainingElement):
+        (WebCore::CompositeEditCommand::joinTextNodes):
+        (WebCore::CompositeEditCommand::inputText):
+        (WebCore::CompositeEditCommand::insertTextIntoNode):
+        (WebCore::CompositeEditCommand::deleteTextFromNode):
+        (WebCore::CompositeEditCommand::replaceTextInNode):
+        (WebCore::CompositeEditCommand::deleteSelection):
+        (WebCore::CompositeEditCommand::removeCSSProperty):
+        (WebCore::CompositeEditCommand::removeNodeAttribute):
+        (WebCore::CompositeEditCommand::setNodeAttribute):
+        (WebCore::CompositeEditCommand::appendBlockPlaceholder):
+        (WebCore::CompositeEditCommand::insertBlockPlaceholder):
+        (WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
+        (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
+        (WebCore::CompositeEditCommand::moveParagraphs):
+        (WebCore::CompositeEditCommand::splitTreeToNode):
+        * editing/CompositeEditCommand.h:
+        (WebCore::CompositeEditCommand::isFirstCommand):
+        * editing/CreateLinkCommand.h:
+        (WebCore::CreateLinkCommand::create):
+        * editing/DeleteButtonController.cpp:
+        (WebCore::DeleteButtonController::deleteTarget):
+        * editing/DeleteFromTextNodeCommand.cpp:
+        (WebCore::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand):
+        * editing/DeleteFromTextNodeCommand.h:
+        (WebCore::DeleteFromTextNodeCommand::create):
+        * editing/DeleteSelectionCommand.h:
+        (WebCore::DeleteSelectionCommand::create):
+        * editing/EditCommand.h:
+        (WebCore::SimpleEditCommand::SimpleEditCommand):
+        * editing/Editor.cpp:
+        (WebCore::Editor::deleteSelectionWithSmartDelete):
+        (WebCore::Editor::replaceSelectionWithFragment):
+        (WebCore::Editor::removeFormattingAndStyle):
+        (WebCore::Editor::clearLastEditCommand):
+        (WebCore::Editor::dispatchCPPEvent):
+        (WebCore::Editor::applyStyle):
+        (WebCore::Editor::applyParagraphStyle):
+        (WebCore::Editor::indent):
+        (WebCore::Editor::outdent):
+        (WebCore::dispatchEditableContentChangedEvents):
+        * editing/Editor.h:
+        * editing/EditorCommand.cpp:
+        (WebCore::executeInsertFragment):
+        (WebCore::executeCreateLink):
+        (WebCore::executeFormatBlock):
+        (WebCore::executeIndent):
+        (WebCore::executeInsertOrderedList):
+        (WebCore::executeInsertUnorderedList):
+        (WebCore::executeOutdent):
+        (WebCore::executeUnlink):
+        * editing/FormatBlockCommand.h:
+        (WebCore::FormatBlockCommand::create):
+        * editing/IndentOutdentCommand.cpp:
+        (WebCore::IndentOutdentCommand::indentRegion):
+        (WebCore::IndentOutdentCommand::outdentParagraph):
+        * editing/IndentOutdentCommand.h:
+        (WebCore::IndentOutdentCommand::create):
+        * editing/InsertIntoTextNodeCommand.cpp:
+        (WebCore::InsertIntoTextNodeCommand::InsertIntoTextNodeCommand):
+        * editing/InsertIntoTextNodeCommand.h:
+        (WebCore::InsertIntoTextNodeCommand::create):
+        * editing/InsertLineBreakCommand.h:
+        (WebCore::InsertLineBreakCommand::create):
+        * editing/InsertListCommand.cpp:
+        (WebCore::InsertListCommand::doApply):
+        * editing/InsertListCommand.h:
+        (WebCore::InsertListCommand::create):
+        * editing/InsertNodeBeforeCommand.cpp:
+        (WebCore::InsertNodeBeforeCommand::InsertNodeBeforeCommand):
+        * editing/InsertNodeBeforeCommand.h:
+        (WebCore::InsertNodeBeforeCommand::create):
+        * editing/InsertParagraphSeparatorCommand.cpp:
+        (WebCore::InsertParagraphSeparatorCommand::doApply):
+        * editing/InsertParagraphSeparatorCommand.h:
+        (WebCore::InsertParagraphSeparatorCommand::create):
+        * editing/InsertTextCommand.h:
+        (WebCore::InsertTextCommand::create):
+        * editing/JoinTextNodesCommand.cpp:
+        (WebCore::JoinTextNodesCommand::JoinTextNodesCommand):
+        * editing/JoinTextNodesCommand.h:
+        (WebCore::JoinTextNodesCommand::create):
+        * editing/MergeIdenticalElementsCommand.cpp:
+        (WebCore::MergeIdenticalElementsCommand::MergeIdenticalElementsCommand):
+        * editing/MergeIdenticalElementsCommand.h:
+        (WebCore::MergeIdenticalElementsCommand::create):
+        * editing/ModifySelectionListLevel.cpp:
+        (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevelWithType):
+        * editing/MoveSelectionCommand.cpp:
+        (WebCore::MoveSelectionCommand::doApply):
+        * editing/MoveSelectionCommand.h:
+        (WebCore::MoveSelectionCommand::create):
+        * editing/RemoveCSSPropertyCommand.cpp:
+        (WebCore::RemoveCSSPropertyCommand::RemoveCSSPropertyCommand):
+        * editing/RemoveCSSPropertyCommand.h:
+        (WebCore::RemoveCSSPropertyCommand::create):
+        * editing/RemoveFormatCommand.h:
+        (WebCore::RemoveFormatCommand::create):
+        * editing/RemoveNodeAttributeCommand.cpp:
+        (WebCore::RemoveNodeAttributeCommand::RemoveNodeAttributeCommand):
+        * editing/RemoveNodeAttributeCommand.h:
+        (WebCore::RemoveNodeAttributeCommand::create):
+        * editing/RemoveNodeCommand.cpp:
+        (WebCore::RemoveNodeCommand::RemoveNodeCommand):
+        * editing/RemoveNodeCommand.h:
+        (WebCore::RemoveNodeCommand::create):
+        * editing/RemoveNodePreservingChildrenCommand.cpp:
+        (WebCore::RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand):
+        (WebCore::RemoveNodePreservingChildrenCommand::doApply):
+        * editing/RemoveNodePreservingChildrenCommand.h:
+        (WebCore::RemoveNodePreservingChildrenCommand::create):
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::):
+        (WebCore::ReplacementFragment::hasInterchangeNewlineAtStart):
+        (WebCore::ReplacementFragment::hasInterchangeNewlineAtEnd):
+        (WebCore::ReplacementFragment::ReplacementFragment):
+        * editing/ReplaceSelectionCommand.h:
+        (WebCore::ReplaceSelectionCommand::create):
+        * editing/SetNodeAttributeCommand.cpp:
+        (WebCore::SetNodeAttributeCommand::SetNodeAttributeCommand):
+        * editing/SetNodeAttributeCommand.h:
+        (WebCore::SetNodeAttributeCommand::create):
+        * editing/SplitElementCommand.cpp:
+        (WebCore::SplitElementCommand::SplitElementCommand):
+        * editing/SplitElementCommand.h:
+        (WebCore::SplitElementCommand::create):
+        * editing/SplitTextNodeCommand.cpp:
+        (WebCore::SplitTextNodeCommand::SplitTextNodeCommand):
+        * editing/SplitTextNodeCommand.h:
+        (WebCore::SplitTextNodeCommand::create):
+        * editing/SplitTextNodeContainingElementCommand.cpp:
+        (WebCore::SplitTextNodeContainingElementCommand::SplitTextNodeContainingElementCommand):
+        * editing/SplitTextNodeContainingElementCommand.h:
+        (WebCore::SplitTextNodeContainingElementCommand::create):
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::deleteSelection):
+        (WebCore::TypingCommand::deleteKeyPressed):
+        (WebCore::TypingCommand::forwardDeleteKeyPressed):
+        (WebCore::TypingCommand::insertText):
+        (WebCore::TypingCommand::insertLineBreak):
+        (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
+        (WebCore::TypingCommand::insertParagraphSeparator):
+        (WebCore::TypingCommand::insertTextRunWithoutNewlines):
+        * editing/TypingCommand.h:
+        (WebCore::TypingCommand::create):
+        (WebCore::TypingCommand::smartDelete):
+        * editing/UnlinkCommand.h:
+        (WebCore::UnlinkCommand::create):
+        * editing/WrapContentsInDummySpanCommand.cpp:
+        (WebCore::WrapContentsInDummySpanCommand::WrapContentsInDummySpanCommand):
+        * editing/WrapContentsInDummySpanCommand.h:
+        (WebCore::WrapContentsInDummySpanCommand::create):
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::additionalAttributeStyleDecls):
+        (WebCore::HTMLTableElement::addSharedCellBordersDecl):
+        (WebCore::HTMLTableElement::addSharedCellPaddingDecl):
+        (WebCore::HTMLTableElement::addSharedGroupDecls):
+        * html/HTMLTokenizer.cpp:
+        (WebCore::Token::addAttribute):
+        * html/HTMLViewSourceDocument.cpp:
+        (WebCore::HTMLViewSourceDocument::createContainingTable):
+        (WebCore::HTMLViewSourceDocument::addSpanWithClassName):
+        (WebCore::HTMLViewSourceDocument::addLine):
+        (WebCore::HTMLViewSourceDocument::addLink):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::didOpenURL):
+        * loader/appcache/DOMApplicationCache.cpp:
+        (WebCore::DOMApplicationCache::callListener):
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::contextMenuItemSelected):
+        * page/DOMWindow.cpp:
+        (WebCore::PostMessageTimer::PostMessageTimer):
+        (WebCore::PostMessageTimer::fired):
+        (WebCore::DOMWindow::postMessage):
+        * page/DragController.cpp:
+        (WebCore::DragController::concludeDrag):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::dispatchDragEvent):
+        (WebCore::EventHandler::keyEvent):
+        (WebCore::EventHandler::handleTextInputEvent):
+        * page/Frame.cpp:
+        (WebCore::Frame::computeAndSetTypingStyle):
+        (WebCore::Frame::shouldClose):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::updateOverflowStatus):
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::currentKeyboardEvent):
+        * page/mac/FrameMac.mm:
+        * platform/DeprecatedValueListImpl.cpp:
+        (WebCore::DeprecatedValueListImpl::Private::Private):
+        (WebCore::DeprecatedValueListImpl::DeprecatedValueListImpl):
+        (WebCore::DeprecatedValueListImpl::copyOnWrite):
+        * platform/graphics/FontSelector.h:
+        * platform/graphics/GlyphPageTreeNode.cpp:
+        (WebCore::GlyphPageTreeNode::initializePage):
+        * platform/graphics/GlyphPageTreeNode.h:
+        (WebCore::GlyphPage::create):
+        (WebCore::GlyphPage::GlyphPage):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollToOffset):
+        (WebCore::RenderLayer::updateOverflowStatus):
+        (WebCore::RenderLayer::updateReflectionStyle):
+        * rendering/style/RenderStyle.h:
+        (WebCore::TransformOperation::~TransformOperation):
+        (WebCore::ScaleTransformOperation::create):
+        (WebCore::ScaleTransformOperation::ScaleTransformOperation):
+        (WebCore::RotateTransformOperation::create):
+        (WebCore::RotateTransformOperation::RotateTransformOperation):
+        (WebCore::SkewTransformOperation::create):
+        (WebCore::SkewTransformOperation::operator==):
+        (WebCore::SkewTransformOperation::SkewTransformOperation):
+        (WebCore::TranslateTransformOperation::create):
+        (WebCore::TranslateTransformOperation::operator==):
+        (WebCore::TranslateTransformOperation::TranslateTransformOperation):
+        (WebCore::MatrixTransformOperation::create):
+        (WebCore::MatrixTransformOperation::MatrixTransformOperation):
+        (WebCore::StyleReflection::create):
+        (WebCore::StyleReflection::StyleReflection):
+        * storage/StorageEvent.cpp:
+        (WebCore::StorageEvent::StorageEvent):
+        (WebCore::StorageEvent::initStorageEvent):
+        * storage/StorageEvent.h:
+        (WebCore::StorageEvent::create):
+        (WebCore::StorageEvent::StorageEvent):
+        * svg/SVGAngle.cpp:
+        (WebCore::SVGAngle::SVGAngle):
+        * svg/SVGAngle.h:
+        (WebCore::SVGAngle::create):
+        * svg/SVGAnimatedTemplate.h:
+        (WebCore::SVGAnimatedTemplate::SVGAnimatedTemplate):
+        (WebCore::lookupOrCreateWrapper):
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::sendSVGLoadEventIfPossible):
+        * svg/SVGElement.h:
+        * svg/SVGMarkerElement.cpp:
+        (WebCore::SVGMarkerElement::SVGMarkerElement):
+        (WebCore::SVGMarkerElement::parseMappedAttribute):
+        (WebCore::SVGMarkerElement::setOrientToAngle):
+        * svg/SVGMarkerElement.h:
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::createSVGAngle):
+        * svg/SVGSVGElement.h:
+        * svg/SVGZoomEvent.h:
+        (WebCore::SVGZoomEvent::create):
+        * svg/graphics/SVGImage.cpp:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::callReadyStateChangeListener):
+        (WebCore::XMLHttpRequest::dispatchProgressEvent):
+        * xml/XMLHttpRequestProgressEvent.cpp:
+        * xml/XMLHttpRequestProgressEvent.h:
+        (WebCore::XMLHttpRequestProgressEvent::create):
+        (WebCore::XMLHttpRequestProgressEvent::position):
+        (WebCore::XMLHttpRequestProgressEvent::totalSize):
+        (WebCore::XMLHttpRequestProgressEvent::XMLHttpRequestProgressEvent):
+
 2008-06-13  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index dec1646..6b4309a 100644 (file)
@@ -127,7 +127,7 @@ __ZN7WebCore10CachedPage22cachedPagePlatformDataEv
 __ZN7WebCore10CachedPage25setCachedPagePlatformDataEPNS_22CachedPagePlatformDataE
 __ZN7WebCore10EventNames10clickEventE
 __ZN7WebCore10EventNames12keydownEventE
-__ZN7WebCore10MouseEventC1ERKNS_12AtomicStringEbbPNS_9DOMWindowEiiiiibbbbtPNS_15EventTargetNodeEPNS_9ClipboardEb
+__ZN7WebCore10MouseEventC1ERKNS_12AtomicStringEbbN3WTF10PassRefPtrINS_9DOMWindowEEEiiiiibbbbtNS5_INS_15EventTargetNodeEEENS5_INS_9ClipboardEEEb
 __ZN7WebCore10StringImpl7replaceEtt
 __ZN7WebCore10StringImplD1Ev
 __ZN7WebCore10StringImplcvP8NSStringEv
index 99da930..4f53a6f 100644 (file)
@@ -35,13 +35,13 @@ JSValue* JSSVGMatrix::multiply(ExecState* exec, const List& args)
     AffineTransform imp(*impl());
 
     AffineTransform secondMatrix = toSVGMatrix(args[0]);    
-    return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.multiply(secondMatrix)), m_context.get());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.multiply(secondMatrix)).get(), m_context.get());
 }
 
 JSValue* JSSVGMatrix::inverse(ExecState* exec, const List&)
 {
     AffineTransform imp(*impl());
-    KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.inverse()), m_context.get());
+    KJS::JSValue* result = toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.inverse()).get(), m_context.get());
 
     if (!imp.isInvertible())
         setDOMException(exec, SVGException::SVG_MATRIX_NOT_INVERTABLE);
@@ -56,7 +56,7 @@ JSValue* JSSVGMatrix::translate(ExecState* exec, const List& args)
     float x = args[0]->toFloat(exec);
     float y = args[1]->toFloat(exec);
 
-    return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.translate(x, y)), m_context.get());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.translate(x, y)).get(), m_context.get());
 }
 
 JSValue* JSSVGMatrix::scale(ExecState* exec, const List& args)
@@ -64,7 +64,7 @@ JSValue* JSSVGMatrix::scale(ExecState* exec, const List& args)
     AffineTransform imp(*impl());
 
     float scaleFactor = args[0]->toFloat(exec);
-    return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.scale(scaleFactor)), m_context.get());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.scale(scaleFactor)).get(), m_context.get());
 }
 
 JSValue* JSSVGMatrix::scaleNonUniform(ExecState* exec, const List& args)
@@ -74,7 +74,7 @@ JSValue* JSSVGMatrix::scaleNonUniform(ExecState* exec, const List& args)
     float scaleFactorX = args[0]->toFloat(exec);
     float scaleFactorY = args[1]->toFloat(exec);
 
-    return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.scaleNonUniform(scaleFactorX, scaleFactorY)), m_context.get());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.scaleNonUniform(scaleFactorX, scaleFactorY)).get(), m_context.get());
 }
 
 JSValue* JSSVGMatrix::rotate(ExecState* exec, const List& args)
@@ -82,7 +82,7 @@ JSValue* JSSVGMatrix::rotate(ExecState* exec, const List& args)
     AffineTransform imp(*impl());
 
     float angle = args[0]->toFloat(exec);
-    return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.rotate(angle)), m_context.get());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.rotate(angle)).get(), m_context.get());
 }
 
 JSValue* JSSVGMatrix::rotateFromVector(ExecState* exec, const List& args)
@@ -92,7 +92,7 @@ JSValue* JSSVGMatrix::rotateFromVector(ExecState* exec, const List& args)
     float x = args[0]->toFloat(exec);
     float y = args[1]->toFloat(exec);
 
-    KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.rotateFromVector(x, y)), m_context.get());
+    KJS::JSValue* result = toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.rotateFromVector(x, y)).get(), m_context.get());
 
     if (x == 0.0 || y == 0.0)
         setDOMException(exec, SVGException::SVG_INVALID_VALUE_ERR);
@@ -103,13 +103,13 @@ JSValue* JSSVGMatrix::rotateFromVector(ExecState* exec, const List& args)
 JSValue* JSSVGMatrix::flipX(ExecState* exec, const List&)
 {
     AffineTransform imp(*impl());
-    return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.flipX()), m_context.get());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.flipX()).get(), m_context.get());
 }
 
 JSValue* JSSVGMatrix::flipY(ExecState* exec, const List&)
 {
     AffineTransform imp(*impl());
-    return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.flipY()), m_context.get());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.flipY()).get(), m_context.get());
 }
 
 JSValue* JSSVGMatrix::skewX(ExecState* exec, const List& args)
@@ -117,7 +117,7 @@ JSValue* JSSVGMatrix::skewX(ExecState* exec, const List& args)
     AffineTransform imp(*impl());
 
     float angle = args[0]->toFloat(exec);
-    return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.skewX(angle)), m_context.get());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.skewX(angle)).get(), m_context.get());
 }
 
 JSValue* JSSVGMatrix::skewY(ExecState* exec, const List& args)
@@ -125,7 +125,7 @@ JSValue* JSSVGMatrix::skewY(ExecState* exec, const List& args)
     AffineTransform imp(*impl());
 
     float angle = args[0]->toFloat(exec);
-    return toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>(imp.skewY(angle)), m_context.get());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<AffineTransform>::create(imp.skewY(angle)).get(), m_context.get());
 }
 
 }
index 8ef67c2..545410a 100644 (file)
 #if ENABLE(SVG)
 
 #include "Frame.h"
-#include <wtf/RefCounted.h>
 #include "SVGElement.h"
 
-#include <wtf/Assertions.h>
-#include <wtf/HashMap.h>
-
 namespace WebCore {
 
 template<typename PODType>
 class JSSVGPODTypeWrapper : public RefCounted<JSSVGPODTypeWrapper<PODType> > {
 public:
-    JSSVGPODTypeWrapper() : RefCounted<JSSVGPODTypeWrapper<PODType> >(0) { }
     virtual ~JSSVGPODTypeWrapper() { }
 
     // Getter wrapper
@@ -52,24 +47,16 @@ public:
 };
 
 template<typename PODType, typename PODTypeCreator>
-class JSSVGPODTypeWrapperCreatorReadWrite : public JSSVGPODTypeWrapper<PODType>
-{
+class JSSVGPODTypeWrapperCreatorReadWrite : public JSSVGPODTypeWrapper<PODType> {
 public:
     typedef PODType (PODTypeCreator::*GetterMethod)() const; 
     typedef void (PODTypeCreator::*SetterMethod)(PODType);
 
-    JSSVGPODTypeWrapperCreatorReadWrite(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter)
-        : m_creator(creator)
-        , m_getter(getter)
-        , m_setter(setter)
+    static PassRefPtr<JSSVGPODTypeWrapperCreatorReadWrite> create(PassRefPtr<PODTypeCreator> creator, GetterMethod getter, SetterMethod setter)
     {
-        ASSERT(creator);
-        ASSERT(getter);
-        ASSERT(setter);
+        return adoptRef(new JSSVGPODTypeWrapperCreatorReadWrite(creator, getter, setter));
     }
 
-    virtual ~JSSVGPODTypeWrapperCreatorReadWrite() { }
-
     // Getter wrapper
     virtual operator PODType() { return (m_creator.get()->*m_getter)(); }
 
@@ -86,6 +73,16 @@ public:
     }
 
 private:
+    JSSVGPODTypeWrapperCreatorReadWrite(PassRefPtr<PODTypeCreator> creator, GetterMethod getter, SetterMethod setter)
+        : m_creator(creator)
+        , m_getter(getter)
+        , m_setter(setter)
+    {
+        ASSERT(m_creator);
+        ASSERT(m_getter);
+        ASSERT(m_setter);
+    }
+
     // Update callbacks
     RefPtr<PODTypeCreator> m_creator;
     GetterMethod m_getter;
@@ -93,14 +90,12 @@ private:
 };
 
 template<typename PODType>
-class JSSVGPODTypeWrapperCreatorReadOnly : public JSSVGPODTypeWrapper<PODType>
-{
+class JSSVGPODTypeWrapperCreatorReadOnly : public JSSVGPODTypeWrapper<PODType> {
 public:
-    JSSVGPODTypeWrapperCreatorReadOnly(PODType type)
-        : m_podType(type)
-    { }
-
-    virtual ~JSSVGPODTypeWrapperCreatorReadOnly() { }
+    static PassRefPtr<JSSVGPODTypeWrapperCreatorReadOnly> create(PODType type)
+    {
+        return adoptRef(new JSSVGPODTypeWrapperCreatorReadOnly(type));
+    }
 
     // Getter wrapper
     virtual operator PODType() { return m_podType; }
@@ -112,6 +107,11 @@ public:
     }
 
 private:
+    JSSVGPODTypeWrapperCreatorReadOnly(PODType type)
+        : m_podType(type)
+    {
+    }
+
     PODType m_podType;
 };
 
@@ -119,25 +119,16 @@ template<typename PODType>
 class SVGPODListItem;
 
 template<typename PODType>
-class JSSVGPODTypeWrapperCreatorForList : public JSSVGPODTypeWrapper<PODType>
-{
+class JSSVGPODTypeWrapperCreatorForList : public JSSVGPODTypeWrapper<PODType> {
 public:
     typedef PODType (SVGPODListItem<PODType>::*GetterMethod)() const; 
     typedef void (SVGPODListItem<PODType>::*SetterMethod)(PODType);
 
-    JSSVGPODTypeWrapperCreatorForList(SVGPODListItem<PODType>* creator, const QualifiedName& attributeName)
-        : m_creator(creator)
-        , m_getter(&SVGPODListItem<PODType>::value)
-        , m_setter(&SVGPODListItem<PODType>::setValue)
-        , m_associatedAttributeName(attributeName)
+    static PassRefPtr<JSSVGPODTypeWrapperCreatorForList> create(PassRefPtr<SVGPODListItem<PODType> > creator, const QualifiedName& attributeName)
     {
-        ASSERT(m_creator);
-        ASSERT(m_getter);
-        ASSERT(m_setter);
+        return adoptRef(new JSSVGPODTypeWrapperCreatorForList(creator, attributeName));
     }
 
-    virtual ~JSSVGPODTypeWrapperCreatorForList() { }
-
     // Getter wrapper
     virtual operator PODType() { return (m_creator.get()->*m_getter)(); }
 
@@ -154,6 +145,17 @@ public:
     }
 
 private:
+    JSSVGPODTypeWrapperCreatorForList(PassRefPtr<SVGPODListItem<PODType> > creator, const QualifiedName& attributeName)
+        : m_creator(creator)
+        , m_getter(&SVGPODListItem<PODType>::value)
+        , m_setter(&SVGPODListItem<PODType>::setValue)
+        , m_associatedAttributeName(attributeName)
+    {
+        ASSERT(m_creator);
+        ASSERT(m_getter);
+        ASSERT(m_setter);
+    }
+
     // Update callbacks
     RefPtr<SVGPODListItem<PODType> > m_creator;
     GetterMethod m_getter;
@@ -241,8 +243,7 @@ struct PODTypeReadWriteHashInfoTraits : WTF::GenericHashTraits<PODTypeReadWriteH
 };
 
 template<typename PODType, typename PODTypeCreator>
-class JSSVGPODTypeWrapperCache
-{
+class JSSVGPODTypeWrapperCache {
 public:
     typedef PODType (PODTypeCreator::*GetterMethod)() const; 
     typedef void (PODTypeCreator::*SetterMethod)(PODType);
@@ -257,7 +258,7 @@ public:
     }
 
     // Used for readwrite attributes only
-    static JSSVGPODTypeWrapper<PODType>* lookupOrCreateWrapper(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter)
+    static PassRefPtr<JSSVGPODTypeWrapper<PODType> > lookupOrCreateWrapper(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter)
     {
         ReadWriteHashMap& map(readWriteHashMap());
         PODTypeReadWriteHashInfo<PODType, PODTypeCreator> info(creator, getter, setter);
@@ -265,9 +266,9 @@ public:
         if (map.contains(info))
             return map.get(info);
 
-        JSSVGPODTypeWrapperCreatorReadWrite<PODType, PODTypeCreator>* wrapper = new JSSVGPODTypeWrapperCreatorReadWrite<PODType, PODTypeCreator>(creator, getter, setter);
-        map.set(info, wrapper);
-        return wrapper;
+        RefPtr<JSSVGPODTypeWrapperCreatorReadWrite<PODType, PODTypeCreator> > wrapper = JSSVGPODTypeWrapperCreatorReadWrite<PODType, PODTypeCreator>::create(creator, getter, setter);
+        map.set(info, wrapper.get());
+        return wrapper.release();
     }
 
     static void forgetWrapper(JSSVGPODTypeWrapper<PODType>* wrapper)
@@ -281,7 +282,7 @@ public:
             if (it->second != wrapper)
                 continue;
 
-            // It's guaruanteed that there's just one object we need to take care of.
+            // It's guaranteed that there's just one object we need to take care of.
             map.remove(it->first);
             break;
         }
index af4fc91..56c81c8 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 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
  */
 
 #include "config.h"
+#include "JSSVGPointList.h"
 
 #if ENABLE(SVG)
-#include "JSSVGPointList.h"
 
-#include "Document.h"
-#include "Frame.h"
 #include "JSSVGPoint.h"
-#include "SVGDocumentExtensions.h"
 #include "SVGPointList.h"
-#include "SVGStyledElement.h"
-
-#include <wtf/Assertions.h>
 
 using namespace KJS;
 
 namespace WebCore {
 
-JSValue* JSSVGPointList::clear(ExecState* exec, const List&)
+typedef SVGList<RefPtr<SVGPODListItem<FloatPoint> > > SVGPointListBase;
+
+static JSValue* finishGetter(ExecState* exec, ExceptionCode& ec, SVGElement* context, SVGPointList* list, PassRefPtr<SVGPODListItem<FloatPoint> > item)
 {
-    ExceptionCode ec = 0;
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    return toJS(exec, JSSVGPODTypeWrapperCreatorForList<FloatPoint>::create(item.get(), list->associatedAttributeName()).get(), context);
+}
 
-    SVGPointList* imp = static_cast<SVGPointList*>(impl());
-    imp->clear(ec);
-    setDOMException(exec, ec);
+static JSValue* finishSetter(ExecState* exec, ExceptionCode& ec, SVGElement* context, SVGPointList* list, PassRefPtr<SVGPODListItem<FloatPoint> > item)
+{
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    const QualifiedName& attributeName = list->associatedAttributeName();
+    context->svgAttributeChanged(attributeName);
+    return toJS(exec, JSSVGPODTypeWrapperCreatorForList<FloatPoint>::create(item.get(), attributeName).get(), context);
+}
 
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
+static JSValue* finishSetterReadOnlyResult(ExecState* exec, ExceptionCode& ec, SVGElement* context, SVGPointList* list, PassRefPtr<SVGPODListItem<FloatPoint> > item)
+{
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    context->svgAttributeChanged(list->associatedAttributeName());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<FloatPoint>::create(*item).get(), context);
+}
 
+JSValue* JSSVGPointList::clear(ExecState* exec, const List&)
+{
+    ExceptionCode ec = 0;
+    impl()->clear(ec);
+    setDOMException(exec, ec);
+    m_context->svgAttributeChanged(impl()->associatedAttributeName());
     return jsUndefined();
 }
 
 JSValue* JSSVGPointList::initialize(ExecState* exec, const List& args)
 {
     ExceptionCode ec = 0;
-    FloatPoint newItem = toSVGPoint(args[0]);
-
-    SVGPointList* imp = static_cast<SVGPointList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<FloatPoint> > >* listImp = imp;
-
-    SVGPODListItem<FloatPoint>* listItem = listImp->initialize(SVGPODListItem<FloatPoint>::copy(newItem), ec).get(); 
-    JSSVGPODTypeWrapperCreatorForList<FloatPoint>* obj = new JSSVGPODTypeWrapperCreatorForList<FloatPoint>(listItem, imp->associatedAttributeName());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
-
-    return result;
+    SVGPointListBase* listImp = impl();
+    return finishSetter(exec, ec, context(), impl(),
+        listImp->initialize(SVGPODListItem<FloatPoint>::copy(toSVGPoint(args[0])), ec));
 }
 
 JSValue* JSSVGPointList::getItem(ExecState* exec, const List& args)
 {
-    ExceptionCode ec = 0;
-
     bool indexOk;
-    unsigned index = args[0]->toInt32(exec, indexOk);
+    unsigned index = args[0]->toUInt32(exec, indexOk);
     if (!indexOk) {
         setDOMException(exec, TYPE_MISMATCH_ERR);
         return jsUndefined();
     }
 
-    SVGPointList* imp = static_cast<SVGPointList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<FloatPoint> > >* listImp = imp;
-
-    SVGPODListItem<FloatPoint>* listItem = listImp->getItem(index, ec).get();
-    JSSVGPODTypeWrapperCreatorForList<FloatPoint>* obj = new JSSVGPODTypeWrapperCreatorForList<FloatPoint>(listItem, imp->associatedAttributeName());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-    return result;
+    ExceptionCode ec = 0;
+    SVGPointListBase* listImp = impl();
+    return finishGetter(exec, ec, context(), impl(),
+        listImp->getItem(index, ec));
 }
 
 JSValue* JSSVGPointList::insertItemBefore(ExecState* exec, const List& args)
 {
-    ExceptionCode ec = 0;
-    FloatPoint newItem = toSVGPoint(args[0]);
-
     bool indexOk;
-    unsigned index = args[1]->toInt32(exec, indexOk);
+    unsigned index = args[1]->toUInt32(exec, indexOk);
     if (!indexOk) {
         setDOMException(exec, TYPE_MISMATCH_ERR);
         return jsUndefined();
     }
 
-    SVGPointList* imp = static_cast<SVGPointList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<FloatPoint> > >* listImp = imp;
-
-    SVGPODListItem<FloatPoint>* listItem = listImp->insertItemBefore(SVGPODListItem<FloatPoint>::copy(newItem), index, ec).get();
-    JSSVGPODTypeWrapperCreatorForList<FloatPoint>* obj = new JSSVGPODTypeWrapperCreatorForList<FloatPoint>(listItem, imp->associatedAttributeName());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
-
-    return result;
+    ExceptionCode ec = 0;
+    SVGPointListBase* listImp = impl();
+    return finishSetter(exec, ec, context(), impl(),
+        listImp->insertItemBefore(SVGPODListItem<FloatPoint>::copy(toSVGPoint(args[0])), index, ec));
 }
 
 JSValue* JSSVGPointList::replaceItem(ExecState* exec, const List& args)
 {
-    ExceptionCode ec = 0;
-    FloatPoint newItem = toSVGPoint(args[0]);
-
     bool indexOk;
     unsigned index = args[1]->toInt32(exec, indexOk);
     if (!indexOk) {
@@ -127,24 +118,14 @@ JSValue* JSSVGPointList::replaceItem(ExecState* exec, const List& args)
         return jsUndefined();
     }
 
-    SVGPointList* imp = static_cast<SVGPointList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<FloatPoint> > >* listImp = imp;
-
-    SVGPODListItem<FloatPoint>* listItem = listImp->replaceItem(SVGPODListItem<FloatPoint>::copy(newItem), index, ec).get(); 
-    JSSVGPODTypeWrapperCreatorForList<FloatPoint>* obj = new JSSVGPODTypeWrapperCreatorForList<FloatPoint>(listItem, imp->associatedAttributeName());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
-
-    return result;
+    ExceptionCode ec = 0;
+    SVGPointListBase* listImp = impl();
+    return finishSetter(exec, ec, context(), impl(),
+        listImp->replaceItem(SVGPODListItem<FloatPoint>::copy(toSVGPoint(args[0])), index, ec));
 }
 
 JSValue* JSSVGPointList::removeItem(ExecState* exec, const List& args)
 {
-    ExceptionCode ec = 0;
-    
     bool indexOk;
     unsigned index = args[0]->toInt32(exec, indexOk);
     if (!indexOk) {
@@ -152,37 +133,18 @@ JSValue* JSSVGPointList::removeItem(ExecState* exec, const List& args)
         return jsUndefined();
     }
 
-    SVGPointList* imp = static_cast<SVGPointList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<FloatPoint> > >* listImp = imp;
-
-    RefPtr<SVGPODListItem<FloatPoint> > listItem(listImp->removeItem(index, ec));
-    JSSVGPODTypeWrapper<FloatPoint>* obj = new JSSVGPODTypeWrapperCreatorReadOnly<FloatPoint>(*listItem.get());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
-
-    return result;
+    ExceptionCode ec = 0;
+    SVGPointListBase* listImp = impl();
+    return finishSetterReadOnlyResult(exec, ec, context(), impl(),
+        listImp->removeItem(index, ec));
 }
 
 JSValue* JSSVGPointList::appendItem(ExecState* exec, const List& args)
 {
     ExceptionCode ec = 0;
-    FloatPoint newItem = toSVGPoint(args[0]);
-
-    SVGPointList* imp = static_cast<SVGPointList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<FloatPoint> > >* listImp = imp;
-
-    SVGPODListItem<FloatPoint>* listItem = listImp->appendItem(SVGPODListItem<FloatPoint>::copy(newItem), ec).get(); 
-    JSSVGPODTypeWrapperCreatorForList<FloatPoint>* obj = new JSSVGPODTypeWrapperCreatorForList<FloatPoint>(listItem, imp->associatedAttributeName());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
-
-    return result;
+    SVGPointListBase* listImp = impl();
+    return finishSetter(exec, ec, context(), impl(),
+        listImp->appendItem(SVGPODListItem<FloatPoint>::copy(toSVGPoint(args[0])), ec));
 }
 
 }
index d3d8d25..a03e172 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 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
  */
 
 #include "config.h"
+#include "JSSVGTransformList.h"
 
 #if ENABLE(SVG)
-#include "JSSVGTransformList.h"
 
-#include "Document.h"
-#include "Frame.h"
 #include "JSSVGTransform.h"
-#include "SVGDocumentExtensions.h"
 #include "SVGTransformList.h"
-#include "SVGStyledElement.h"
-
-#include <wtf/Assertions.h>
 
 using namespace KJS;
 
 namespace WebCore {
 
-JSValue* JSSVGTransformList::clear(ExecState* exec, const List&)
+typedef SVGList<RefPtr<SVGPODListItem<SVGTransform> > > SVGTransformListBase;
+
+static JSValue* finishGetter(ExecState* exec, ExceptionCode& ec, SVGElement* context, SVGTransformList* list, PassRefPtr<SVGPODListItem<SVGTransform> > item)
 {
-    ExceptionCode ec = 0;
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    return toJS(exec, JSSVGPODTypeWrapperCreatorForList<SVGTransform>::create(item.get(), list->associatedAttributeName()).get(), context);
+}
 
-    SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
-    imp->clear(ec);
-    setDOMException(exec, ec);
+static JSValue* finishSetter(ExecState* exec, ExceptionCode& ec, SVGElement* context, SVGTransformList* list, PassRefPtr<SVGPODListItem<SVGTransform> > item)
+{
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    const QualifiedName& attributeName = list->associatedAttributeName();
+    context->svgAttributeChanged(attributeName);
+    return toJS(exec, JSSVGPODTypeWrapperCreatorForList<SVGTransform>::create(item.get(), attributeName).get(), context);
+}
 
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
+static JSValue* finishSetterReadOnlyResult(ExecState* exec, ExceptionCode& ec, SVGElement* context, SVGTransformList* list, PassRefPtr<SVGPODListItem<SVGTransform> > item)
+{
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    context->svgAttributeChanged(list->associatedAttributeName());
+    return toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<SVGTransform>::create(*item).get(), context);
+}
 
+JSValue* JSSVGTransformList::clear(ExecState* exec, const List&)
+{
+    ExceptionCode ec = 0;
+    impl()->clear(ec);
+    setDOMException(exec, ec);
+    m_context->svgAttributeChanged(impl()->associatedAttributeName());
     return jsUndefined();
 }
 
 JSValue* JSSVGTransformList::initialize(ExecState* exec, const List& args)
 {
     ExceptionCode ec = 0;
-    SVGTransform newItem = toSVGTransform(args[0]);
-
-    SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
-
-    SVGPODListItem<SVGTransform>* listItem = listImp->initialize(SVGPODListItem<SVGTransform>::copy(newItem), ec).get(); 
-    JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
-
-    return result;
+    SVGTransformListBase* listImp = impl();
+    return finishSetter(exec, ec, context(), impl(),
+        listImp->initialize(SVGPODListItem<SVGTransform>::copy(toSVGTransform(args[0])), ec));
 }
 
 JSValue* JSSVGTransformList::getItem(ExecState* exec, const List& args)
 {
-    ExceptionCode ec = 0;
-
     bool indexOk;
     unsigned index = args[0]->toInt32(exec, indexOk);
     if (!indexOk) {
@@ -78,22 +88,14 @@ JSValue* JSSVGTransformList::getItem(ExecState* exec, const List& args)
         return jsUndefined();
     }
 
-    SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
-
-    SVGPODListItem<SVGTransform>* listItem = listImp->getItem(index, ec).get();
-    JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-    return result;
+    ExceptionCode ec = 0;
+    SVGTransformListBase* listImp = impl();
+    return finishGetter(exec, ec, context(), impl(),
+        listImp->getItem(index, ec));
 }
 
 JSValue* JSSVGTransformList::insertItemBefore(ExecState* exec, const List& args)
 {
-    ExceptionCode ec = 0;
-    SVGTransform newItem = toSVGTransform(args[0]);
-
     bool indexOk;
     unsigned index = args[1]->toInt32(exec, indexOk);
     if (!indexOk) {
@@ -101,25 +103,14 @@ JSValue* JSSVGTransformList::insertItemBefore(ExecState* exec, const List& args)
         return jsUndefined();
     }
 
-    SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
-
-    SVGPODListItem<SVGTransform>* listItem = listImp->insertItemBefore(SVGPODListItem<SVGTransform>::copy(newItem), index, ec).get();
-    JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
-
-    return result;
+    ExceptionCode ec = 0;
+    SVGTransformListBase* listImp = impl();
+    return finishSetter(exec, ec, context(), impl(),
+        listImp->insertItemBefore(SVGPODListItem<SVGTransform>::copy(toSVGTransform(args[0])), index, ec));
 }
 
 JSValue* JSSVGTransformList::replaceItem(ExecState* exec, const List& args)
 {
-    ExceptionCode ec = 0;
-    SVGTransform newItem = toSVGTransform(args[0]);
-
     bool indexOk;
     unsigned index = args[1]->toInt32(exec, indexOk);
     if (!indexOk) {
@@ -127,24 +118,14 @@ JSValue* JSSVGTransformList::replaceItem(ExecState* exec, const List& args)
         return jsUndefined();
     }
 
-    SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
-
-    SVGPODListItem<SVGTransform>* listItem = listImp->replaceItem(SVGPODListItem<SVGTransform>::copy(newItem), index, ec).get(); 
-    JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
-
-    return result;
+    ExceptionCode ec = 0;
+    SVGTransformListBase* listImp = impl();
+    return finishSetter(exec, ec, context(), impl(),
+        listImp->replaceItem(SVGPODListItem<SVGTransform>::copy(toSVGTransform(args[0])), index, ec));
 }
 
 JSValue* JSSVGTransformList::removeItem(ExecState* exec, const List& args)
 {
-    ExceptionCode ec = 0;
-    
     bool indexOk;
     unsigned index = args[0]->toInt32(exec, indexOk);
     if (!indexOk) {
@@ -152,37 +133,18 @@ JSValue* JSSVGTransformList::removeItem(ExecState* exec, const List& args)
         return jsUndefined();
     }
 
-    SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
-
-    RefPtr<SVGPODListItem<SVGTransform> > listItem(listImp->removeItem(index, ec));
-    JSSVGPODTypeWrapper<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorReadOnly<SVGTransform>(*listItem.get());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
-
-    return result;
+    ExceptionCode ec = 0;
+    SVGTransformListBase* listImp = impl();
+    return finishSetterReadOnlyResult(exec, ec, context(), impl(),
+        listImp->removeItem(index, ec));
 }
 
 JSValue* JSSVGTransformList::appendItem(ExecState* exec, const List& args)
 {
     ExceptionCode ec = 0;
-    SVGTransform newItem = toSVGTransform(args[0]);
-
-    SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
-    SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
-
-    SVGPODListItem<SVGTransform>* listItem = listImp->appendItem(SVGPODListItem<SVGTransform>::copy(newItem), ec).get(); 
-    JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
-
-    KJS::JSValue* result = toJS(exec, obj, m_context.get());
-    setDOMException(exec, ec);
-
-    m_context->svgAttributeChanged(imp->associatedAttributeName());
-
-    return result;
+    SVGTransformListBase* listImp = impl();
+    return finishSetter(exec, ec, context(), impl(),
+        listImp->appendItem(SVGPODListItem<SVGTransform>::copy(toSVGTransform(args[0])), ec));
 }
 
 }
index 614343c..3107ba2 100644 (file)
@@ -1572,16 +1572,16 @@ sub NativeToJSValue
 
         if ($implClassNameForValueConversion eq "") {
             if (IsSVGTypeNeedingContextParameter($implClassName)) {
-                return "toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<$nativeType>($value), castedThisObj->context())" if $inFunctionCall eq 1;
+                return "toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<$nativeType>::create($value).get(), castedThisObj->context())" if $inFunctionCall eq 1;
 
                 # Special case: SVGZoomEvent - it doesn't have a context, but it's no problem, as there are no readwrite props
-                return "toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<$nativeType>($value), 0)" if $implClassName eq "SVGZoomEvent";
-                return "toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<$nativeType>($value), context())";
+                return "toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<$nativeType>::create($value).get(), 0)" if $implClassName eq "SVGZoomEvent";
+                return "toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<$nativeType>::create($value).get(), context())";
             } else {
-                return "toJS(exec, new JSSVGPODTypeWrapperCreatorReadOnly<$nativeType>($value), imp)";
+                return "toJS(exec, JSSVGPODTypeWrapperCreatorReadOnly<$nativeType>::create($value).get(), imp)";
             }
         } else { # These classes, always have a m_context pointer!
-            return "toJS(exec, JSSVGPODTypeWrapperCache<$nativeType, $implClassNameForValueConversion>::lookupOrCreateWrapper(imp, &${implClassNameForValueConversion}::$getter, &${implClassNameForValueConversion}::$setter), context())";
+            return "toJS(exec, JSSVGPODTypeWrapperCache<$nativeType, $implClassNameForValueConversion>::lookupOrCreateWrapper(imp, &${implClassNameForValueConversion}::$getter, &${implClassNameForValueConversion}::$setter).get(), context())";
         }
     }
 
index ac3f579..6719622 100644 (file)
@@ -25,8 +25,8 @@
  */
 
 #include "config.h"
-
 #include "CSSFontSelector.h"
+
 #include "AtomicString.h"
 #include "CachedFont.h"
 #include "CSSFontFace.h"
 namespace WebCore {
 
 CSSFontSelector::CSSFontSelector(Document* document)
-: m_document(document)
+    : m_document(document)
 {
+    // FIXME: An old comment used to say there was no need to hold a reference to m_document
+    // because "we are guaranteed to be destroyed before the document". But there does not
+    // seem to be any such guarantee.
+
     ASSERT(m_document);
 }
 
 CSSFontSelector::~CSSFontSelector()
-{}
+{
+}
 
 bool CSSFontSelector::isEmpty() const
 {
index 51de2f2..2526eeb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -27,7 +27,6 @@
 #define CSSFontSelector_h
 
 #include "FontSelector.h"
-
 #include "StringHash.h"
 #include <wtf/HashMap.h>
 #include <wtf/RefPtr.h>
@@ -44,7 +43,10 @@ class String;
 
 class CSSFontSelector : public FontSelector {
 public:
-    CSSFontSelector(Document* doc);
+    static PassRefPtr<CSSFontSelector> create(Document* document)
+    {
+        return adoptRef(new CSSFontSelector(document));
+    }
     virtual ~CSSFontSelector();
 
     virtual FontData* getFontData(const FontDescription& fontDescription, const AtomicString& familyName);
@@ -57,8 +59,10 @@ public:
 
     DocLoader* docLoader() const;
 
-protected:
-    Document* m_document; // No need to ref, since we will always get destroyed before the document does.
+private:
+    CSSFontSelector(Document*);
+
+    Document* m_document;
     HashMap<String, RefPtr<CSSSegmentedFontFace> > m_fonts;
 };
 
index 998b61a..1a70ca0 100644 (file)
 #include "loader.h"
 #include <wtf/Vector.h>
 
+#if ENABLE(DASHBOARD_SUPPORT)
+#include "DashboardRegion.h"
+#endif
+
 #if ENABLE(SVG)
 #include "XLinkNames.h"
 #include "SVGNames.h"
 #endif
 
-#if ENABLE(DASHBOARD_SUPPORT)
-#include "DashboardRegion.h"
-#endif
-
 using namespace std;
 
 namespace WebCore {
@@ -313,11 +313,10 @@ static const MediaQueryEvaluator& printEval()
 CSSStyleSelector::CSSStyleSelector(Document* doc, const String& userStyleSheet, StyleSheetList* styleSheets, CSSStyleSheet* mappedElementSheet, bool strictParsing, bool matchAuthorAndUserStyles)
     : m_backgroundData(BackgroundFillLayer)
     , m_checker(doc, strictParsing, false)
+    , m_fontSelector(CSSFontSelector::create(doc))
 {
     init();
 
-    m_fontSelector = new CSSFontSelector(doc);
-
     m_matchAuthorAndUserStyles = matchAuthorAndUserStyles;
 
     if (!defaultStyle)
@@ -4086,7 +4085,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
             return;
         }
         CSSReflectValue* reflectValue = static_cast<CSSReflectValue*>(value);
-        RefPtr<StyleReflection> reflection = new StyleReflection();
+        RefPtr<StyleReflection> reflection = StyleReflection::create();
         reflection->setDirection(reflectValue->direction());
         if (reflectValue->offset()) {
             int type = reflectValue->offset()->primitiveType();
@@ -4099,7 +4098,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
         mapNinePieceImage(reflectValue->mask(), mask);
         reflection->setMask(mask);
         
-        m_style->setBoxReflect(reflection);
+        m_style->setBoxReflect(reflection.release());
         return;
     }
     case CSSPropertyOpacity:
@@ -4519,9 +4518,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
                                     sy = sx;
                             }
                         }
-                        
-                        ScaleTransformOperation* scale = new ScaleTransformOperation(sx, sy);
-                        operations.append(scale);
+                        operations.append(ScaleTransformOperation::create(sx, sy));
                         break;
                     }
                     case CSSTransformValue::TranslateTransformOperation:
@@ -4541,9 +4538,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
                                 }
                             }
                         }
-                        
-                        TranslateTransformOperation* translate = new TranslateTransformOperation(tx, ty);
-                        operations.append(translate);
+                        operations.append(TranslateTransformOperation::create(tx, ty));
                         break;
                     }
                     case CSSTransformValue::RotateTransformOperation: {
@@ -4552,8 +4547,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
                             angle = rad2deg(angle);
                         else if (firstValue->primitiveType() == CSSPrimitiveValue::CSS_GRAD)
                             angle = grad2deg(angle);
-                        RotateTransformOperation* rotate = new RotateTransformOperation(angle);
-                        operations.append(rotate);
+                        operations.append(RotateTransformOperation::create(angle));
                         break;
                     }
                     case CSSTransformValue::SkewTransformOperation:
@@ -4582,28 +4576,21 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
                                     angleY = angleX;
                             }
                         }
-                        
-                        SkewTransformOperation* skew = new SkewTransformOperation(angleX, angleY);
-                        operations.append(skew);
+                        operations.append(SkewTransformOperation::create(angleX, angleY));
                         break;
                     }
                     case CSSTransformValue::MatrixTransformOperation: {
-                        CSSPrimitiveValue* secondValue = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(1));
-                        CSSPrimitiveValue* thirdValue = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(2));
-                        CSSPrimitiveValue* fourthValue = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(3));
-                        CSSPrimitiveValue* fifthValue = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(4));
-                        CSSPrimitiveValue* sixthValue = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(5));
-                        MatrixTransformOperation* matrix = new MatrixTransformOperation(firstValue->getDoubleValue(),
-                                                                                        secondValue->getDoubleValue(),
-                                                                                        thirdValue->getDoubleValue(),
-                                                                                        fourthValue->getDoubleValue(),
-                                                                                        fifthValue->getDoubleValue(),
-                                                                                        sixthValue->getDoubleValue());
-                        operations.append(matrix);
+                        double a = firstValue->getDoubleValue();
+                        double b = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(1))->getDoubleValue();
+                        double c = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(2))->getDoubleValue();
+                        double d = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(3))->getDoubleValue();
+                        double e = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(4))->getDoubleValue();
+                        double f = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(5))->getDoubleValue();
+                        operations.append(MatrixTransformOperation::create(a, b, c, d, e, f));
                         break;
                     }   
-                    
-                    default:
+                    case CSSTransformValue::UnknownTransformOperation:
+                        ASSERT_NOT_REACHED();
                         break;
                 }
             }
index 351b55a..048ac6a 100644 (file)
@@ -29,9 +29,9 @@
 
 namespace WebCore {
 
-Attribute* Attribute::clone(bool) const
+PassRefPtr<Attribute> Attribute::clone() const
 {
-    return new Attribute(m_name, m_value);
+    return adoptRef(new Attribute(m_name, m_value));
 }
 
 PassRefPtr<Attr> Attribute::createAttrIfNeeded(Element* e)
index d515ea7..44132db 100644 (file)
@@ -1,11 +1,9 @@
 /*
- * This file is part of the DOM implementation for KDE.
- *
  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2001 Peter Kelly (pmk@post.com)
  *           (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 2004, 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
@@ -36,25 +34,17 @@ class CSSStyleDeclaration;
 class Element;
 class NamedAttrMap;
 
-// this has no counterpart in DOM, purely internal
-// representation of the nodevalue of an Attr.
-// the actual Attr (Attr) with its value as textchild
-// is only allocated on demand by the DOM bindings.
-// Any use of Attr inside khtml should be avoided.
+// This has no counterpart in DOM.
+// It is an internal representation of the node value of an Attr.
+// The actual Attr with its value as a Text child is allocated only if needed.
 class Attribute : public RefCounted<Attribute> {
     friend class Attr;
-    friend class Element;
     friend class NamedAttrMap;
 public:
-    // null value is forbidden !
-    Attribute(const QualifiedName& name, const AtomicString& value)
-        : RefCounted<Attribute>(0), m_name(name), m_value(value), m_impl(0)
-    {}
-    
-    Attribute(const AtomicString& name, const AtomicString& value)
-        : RefCounted<Attribute>(0), m_name(nullAtom, name, nullAtom), m_value(value), m_impl(0)
-    {}
-
+    static PassRefPtr<Attribute> create(const QualifiedName& name, const AtomicString& value)
+    {
+        return adoptRef(new Attribute(name, value));
+    }
     virtual ~Attribute() { }
     
     const AtomicString& value() const { return m_value; }
@@ -70,7 +60,7 @@ public:
     bool isNull() const { return m_value.isNull(); }
     bool isEmpty() const { return m_value.isEmpty(); }
     
-    virtual Attribute* clone(bool preserveDecl = true) const;
+    virtual PassRefPtr<Attribute> clone() const;
 
     // An extension to get the style information for presentational attributes.
     virtual CSSStyleDeclaration* style() const { return 0; }
@@ -78,6 +68,16 @@ public:
     void setValue(const AtomicString& value) { m_value = value; }
     void setPrefix(const AtomicString& prefix) { m_name.setPrefix(prefix); }
 
+protected:
+    Attribute(const QualifiedName& name, const AtomicString& value)
+        : m_name(name), m_value(value), m_impl(0)
+    {
+    }
+    Attribute(const AtomicString& name, const AtomicString& value)
+        : m_name(nullAtom, name, nullAtom), m_value(value), m_impl(0)
+    {
+    }
+
 private:
     QualifiedName m_name;
     AtomicString m_value;
index dacfd71..f2a2ac4 100644 (file)
@@ -32,7 +32,10 @@ namespace WebCore {
 
 class BeforeTextInsertedEvent : public Event {
 public:
-    BeforeTextInsertedEvent(const String&);
+    static PassRefPtr<BeforeTextInsertedEvent> create(const String& text)
+    {
+        return adoptRef(new BeforeTextInsertedEvent(text));
+    }
 
     virtual bool isBeforeTextInsertedEvent() const { return true; }
   
@@ -40,6 +43,8 @@ public:
     void setText(const String& s) { m_text = s; }
 
 private:
+    BeforeTextInsertedEvent(const String&);
+
     String m_text;
 };
 
index 6eecb73..39c96fd 100644 (file)
@@ -32,7 +32,10 @@ namespace WebCore {
 
     class BeforeUnloadEvent : public Event {
     public:
-        BeforeUnloadEvent();
+        static PassRefPtr<BeforeUnloadEvent> create()
+        {
+            return adoptRef(new BeforeUnloadEvent);
+        }
 
         virtual bool storesResultAsString() const;
         virtual void storeResult(const String&);
@@ -40,6 +43,8 @@ namespace WebCore {
         String result() const { return m_result; }
 
     private:
+        BeforeUnloadEvent();
+
         String m_result;
     };
 
index bcbb9e2..d6eee51 100644 (file)
@@ -201,7 +201,7 @@ void CharacterData::dispatchModifiedEvent(StringImpl* prevValue)
         parentNode()->childrenChanged();
     if (document()->hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTENER)) {
         ExceptionCode ec;
-        dispatchEvent(new MutationEvent(DOMCharacterDataModifiedEvent, true, false, 0, prevValue, m_data, String(), 0), ec);
+        dispatchEvent(MutationEvent::create(DOMCharacterDataModifiedEvent, true, false, 0, prevValue, m_data, String(), 0), ec);
     }
     dispatchSubtreeModifiedEvent();
 }
index f6c4333..3c427e1 100644 (file)
@@ -1,10 +1,8 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 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
@@ -31,7 +29,7 @@ ClipboardEvent::ClipboardEvent()
 {
 }
 
-ClipboardEvent::ClipboardEvent(const AtomicString& eventType, bool canBubble, bool cancelable, Clipboard* clipboard)
+ClipboardEvent::ClipboardEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<Clipboard> clipboard)
     : Event(eventType, canBubble, cancelable), m_clipboard(clipboard)
 {
 }
index 69fc65b..b9bc705 100644 (file)
@@ -1,10 +1,8 @@
 /*
- * This file is part of the DOM implementation for KDE.
- *
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 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
@@ -33,14 +31,23 @@ namespace WebCore {
 
     class ClipboardEvent : public Event {
     public:
-        ClipboardEvent();
-        ClipboardEvent(const AtomicString& type, bool canBubbleArg, bool cancelableArg, Clipboard* clipboardArg);
+        static PassRefPtr<ClipboardEvent> create()
+        {
+            return adoptRef(new ClipboardEvent);
+        }
+        static PassRefPtr<ClipboardEvent> create(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtr<Clipboard> clipboardArg)
+        {
+            return adoptRef(new ClipboardEvent(type, canBubbleArg, cancelableArg, clipboardArg));
+        }
 
         Clipboard* clipboard() const { return m_clipboard.get(); }
 
         virtual bool isClipboardEvent() const;
 
     private:
+        ClipboardEvent();
+        ClipboardEvent(const AtomicString& type, bool canBubbleArg, bool cancelableArg, PassRefPtr<Clipboard>);
+
         RefPtr<Clipboard> m_clipboard;
     };
 
index dfe9762..544414d 100644 (file)
@@ -949,7 +949,7 @@ static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec)
         doc->hasListenerType(Document::DOMNODEINSERTED_LISTENER) &&
         c->isEventTargetNode()) {
         ec = 0;
-        EventTargetNodeCast(c.get())->dispatchEvent(new MutationEvent(DOMNodeInsertedEvent, true, false,
+        EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(DOMNodeInsertedEvent, true, false,
             c->parentNode(), String(), String(), String(), 0), ec, true);
         if (ec)
             return;
@@ -962,7 +962,7 @@ static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec)
                 continue;
           
             ec = 0;
-            EventTargetNodeCast(c.get())->dispatchEvent(new MutationEvent(DOMNodeInsertedIntoDocumentEvent, false, false,
+            EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(DOMNodeInsertedIntoDocumentEvent, false, false,
                 0, String(), String(), String(), 0), ec, true);
             if (ec)
                 return;
@@ -982,7 +982,7 @@ static void dispatchChildRemovalEvents(Node* child, ExceptionCode& ec)
         doc->hasListenerType(Document::DOMNODEREMOVED_LISTENER) &&
         c->isEventTargetNode()) {
         ec = 0;
-        EventTargetNodeCast(c.get())->dispatchEvent(new MutationEvent(DOMNodeRemovedEvent, true, false,
+        EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(DOMNodeRemovedEvent, true, false,
             c->parentNode(), String(), String(), String(), 0), ec, true);
         if (ec)
             return;
@@ -994,7 +994,7 @@ static void dispatchChildRemovalEvents(Node* child, ExceptionCode& ec)
             if (!c->isEventTargetNode())
                 continue;
             ec = 0;
-            EventTargetNodeCast(c.get())->dispatchEvent(new MutationEvent(DOMNodeRemovedFromDocumentEvent, false, false,
+            EventTargetNodeCast(c.get())->dispatchEvent(MutationEvent::create(DOMNodeRemovedFromDocumentEvent, false, false,
                 0, String(), String(), String(), 0), ec, true);
             if (ec)
                 return;
index 421a865..19a1bd2 100644 (file)
@@ -527,17 +527,17 @@ PassRefPtr<DocumentFragment> Document::createDocumentFragment()
     return new DocumentFragment(document());
 }
 
-PassRefPtr<Text> Document::createTextNode(const String &data)
+PassRefPtr<Text> Document::createTextNode(const Stringdata)
 {
     return new Text(this, data);
 }
 
-PassRefPtr<Comment> Document::createComment (const String &data)
+PassRefPtr<Comment> Document::createComment(const String& data)
 {
     return new Comment(this, data);
 }
 
-PassRefPtr<CDATASection> Document::createCDATASection(const String &data, ExceptionCode& ec)
+PassRefPtr<CDATASection> Document::createCDATASection(const Stringdata, ExceptionCode& ec)
 {
     if (isHTMLDocument()) {
         ec = NOT_SUPPORTED_ERR;
@@ -546,7 +546,7 @@ PassRefPtr<CDATASection> Document::createCDATASection(const String &data, Except
     return new CDATASection(this, data);
 }
 
-PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String &target, const String &data, ExceptionCode& ec)
+PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String& target, const String& data, ExceptionCode& ec)
 {
     if (!isValidName(target)) {
         ec = INVALID_CHARACTER_ERR;
@@ -559,7 +559,7 @@ PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const St
     return new ProcessingInstruction(this, target, data);
 }
 
-PassRefPtr<EntityReference> Document::createEntityReference(const String &name, ExceptionCode& ec)
+PassRefPtr<EntityReference> Document::createEntityReference(const Stringname, ExceptionCode& ec)
 {
     if (!isValidName(name)) {
         ec = INVALID_CHARACTER_ERR;
@@ -572,7 +572,7 @@ PassRefPtr<EntityReference> Document::createEntityReference(const String &name,
     return new EntityReference(this, name);
 }
 
-PassRefPtr<EditingText> Document::createEditingTextNode(const String &text)
+PassRefPtr<EditingText> Document::createEditingTextNode(const Stringtext)
 {
     return new EditingText(this, text);
 }
@@ -2567,31 +2567,31 @@ DOMWindow* Document::domWindow() const
 PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode& ec)
 {
     if (eventType == "UIEvents" || eventType == "UIEvent")
-        return new UIEvent;
+        return UIEvent::create();
     if (eventType == "MouseEvents" || eventType == "MouseEvent")
-        return new MouseEvent;
+        return MouseEvent::create();
     if (eventType == "MutationEvents" || eventType == "MutationEvent")
-        return new MutationEvent;
+        return MutationEvent::create();
     if (eventType == "KeyboardEvents" || eventType == "KeyboardEvent")
-        return new KeyboardEvent;
+        return KeyboardEvent::create();
     if (eventType == "HTMLEvents" || eventType == "Event" || eventType == "Events")
-        return new Event;
+        return Event::create();
     if (eventType == "ProgressEvent")
-        return new ProgressEvent;
+        return ProgressEvent::create();
     if (eventType == "TextEvent")
-        return new TextEvent;
+        return TextEvent::create();
     if (eventType == "OverflowEvent")
-        return new OverflowEvent;
+        return OverflowEvent::create();
     if (eventType == "WheelEvent")
-        return new WheelEvent;
+        return WheelEvent::create();
 #if ENABLE(SVG)
     if (eventType == "SVGEvents")
-        return new Event;
+        return Event::create();
     if (eventType == "SVGZoomEvents")
-        return new SVGZoomEvent;
+        return SVGZoomEvent::create();
 #endif
     if (eventType == "MessageEvent")
-        return new MessageEvent;
+        return MessageEvent::create();
     ec = NOT_SUPPORTED_ERR;
     return 0;
 }
@@ -3623,7 +3623,7 @@ PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S
 
     // FIXME: Assume this is a mapped attribute, since createAttribute isn't namespace-aware.  There's no harm to XML
     // documents if we're wrong.
-    return new Attr(0, this, new MappedAttribute(qName, StringImpl::empty()));
+    return new Attr(0, this, MappedAttribute::create(qName, StringImpl::empty()));
 }
 
 #if ENABLE(SVG)
@@ -3719,7 +3719,7 @@ void Document::finishedParsing()
     setParsing(false);
 
     ExceptionCode ec = 0;
-    dispatchEvent(new Event(DOMContentLoadedEvent, true, false), ec);
+    dispatchEvent(Event::create(DOMContentLoadedEvent, true, false), ec);
 
     if (Frame* f = frame())
         f->loader()->finishedParsing();
index be2d1ca..bfa78be 100644 (file)
@@ -28,7 +28,6 @@
 #include "Attr.h"
 #include "Color.h"
 #include "DeprecatedPtrList.h"
-#include "DeprecatedValueList.h"
 #include "DocumentMarker.h"
 #include "HTMLCollection.h"
 #include "HTMLFormElement.h"
index c710d37..13e4681 100644 (file)
@@ -527,9 +527,9 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value,
     }
 }
 
-Attribute* Element::createAttribute(const QualifiedName& name, const AtomicString& value)
+PassRefPtr<Attribute> Element::createAttribute(const QualifiedName& name, const AtomicString& value)
 {
-    return new Attribute(name, value);
+    return Attribute::create(name, value);
 }
 
 void Element::attributeChanged(Attribute* attr, bool preserveDecls)
index 18df142..75eb49c 100644 (file)
@@ -149,7 +149,7 @@ public:
 
     virtual bool childTypeAllowed(NodeType);
 
-    virtual Attribute* createAttribute(const QualifiedName& name, const AtomicString& value);
+    virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value);
     
     void dispatchAttrRemovalEvent(Attribute*);
     void dispatchAttrAdditionEvent(Attribute*);
index 965d1f1..ad744d1 100644 (file)
@@ -1,10 +1,8 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 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
@@ -21,6 +19,7 @@
  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
+
 #include "config.h"
 #include "Event.h"
 
@@ -30,8 +29,7 @@
 namespace WebCore {
 
 Event::Event()
-    : RefCounted<Event>(0)
-    , m_canBubble(false)
+    : m_canBubble(false)
     , m_cancelable(false)
     , m_propagationStopped(false)
     , m_defaultPrevented(false)
@@ -44,8 +42,7 @@ Event::Event()
 }
 
 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg)
-    : RefCounted<Event>(0)
-    , m_type(eventType)
+    : m_type(eventType)
     , m_canBubble(canBubbleArg)
     , m_cancelable(cancelableArg)
     , m_propagationStopped(false)
index b616d69..6f041b3 100644 (file)
@@ -1,10 +1,8 @@
 /*
- * This file is part of the DOM implementation for KDE.
- *
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 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
@@ -64,8 +62,14 @@ namespace WebCore {
             CHANGE              = 32768
         };
 
-        Event();
-        Event(const AtomicString& type, bool canBubble, bool cancelable);
+        static PassRefPtr<Event> create()
+        {
+            return adoptRef(new Event);
+        }
+        static PassRefPtr<Event> create(const AtomicString& type, bool canBubble, bool cancelable)
+        {
+            return adoptRef(new Event(type, canBubble, cancelable));
+        }
         virtual ~Event();
 
         void initEvent(const AtomicString& type, bool canBubble, bool cancelable);
@@ -135,6 +139,9 @@ namespace WebCore {
         virtual Clipboard* clipboard() const { return 0; }
 
     protected:
+        Event();
+        Event(const AtomicString& type, bool canBubble, bool cancelable);
+
         virtual void receivedTarget();
         bool dispatched() const { return m_target; }
 
index 9a37a28..6474a95 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
  *           (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
  *
  * This library is free software; you can redistribute it and/or
@@ -26,7 +26,6 @@
 #include "EventTargetNode.h"
 
 #include "Document.h"
-#include "Event.h"
 #include "EventException.h"
 #include "EventHandler.h"
 #include "EventListener.h"
@@ -144,8 +143,7 @@ bool EventTargetNode::dispatchSubtreeModifiedEvent()
     if (!document()->hasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER))
         return false;
     ExceptionCode ec = 0;
-    return dispatchEvent(new MutationEvent(DOMSubtreeModifiedEvent,
-                                               true,false,0,String(),String(),String(),0),ec,true);
+    return dispatchEvent(MutationEvent::create(DOMSubtreeModifiedEvent, true, false, 0, String(), String(), String(), 0), ec, true);
 }
 
 void EventTargetNode::dispatchWindowEvent(PassRefPtr<Event> e)
@@ -162,7 +160,7 @@ void EventTargetNode::dispatchWindowEvent(const AtomicString& eventType, bool ca
 {
     ASSERT(!eventDispatchForbidden());
     RefPtr<Document> doc = document();
-    dispatchWindowEvent(new Event(eventType, canBubbleArg, cancelableArg));
+    dispatchWindowEvent(Event::create(eventType, canBubbleArg, cancelableArg));
     
     if (eventType == loadEvent) {
         // For onload events, send a separate load event to the enclosing frame only.
@@ -170,7 +168,7 @@ void EventTargetNode::dispatchWindowEvent(const AtomicString& eventType, bool ca
         // the DOM.
         Element* ownerElement = doc->ownerElement();
         if (ownerElement) {
-            RefPtr<Event> ownerEvent = new Event(eventType, false, cancelableArg);
+            RefPtr<Event> ownerEvent = Event::create(eventType, false, cancelableArg);
             ownerEvent->setTarget(ownerElement);
             ExceptionCode ec = 0;
             ownerElement->dispatchGenericEvent(ownerElement, ownerEvent.release(), ec, true);
@@ -186,7 +184,7 @@ bool EventTargetNode::dispatchUIEvent(const AtomicString& eventType, int detail,
     bool cancelable = eventType == DOMActivateEvent;
     
     ExceptionCode ec = 0;
-    RefPtr<UIEvent> evt = new UIEvent(eventType, true, cancelable, document()->defaultView(), detail);
+    RefPtr<UIEvent> evt = UIEvent::create(eventType, true, cancelable, document()->defaultView(), detail);
     evt->setUnderlyingEvent(underlyingEvent);
     return dispatchEvent(evt.release(), ec, true);
 }
@@ -195,7 +193,7 @@ bool EventTargetNode::dispatchKeyEvent(const PlatformKeyboardEvent& key)
 {
     ASSERT(!eventDispatchForbidden());
     ExceptionCode ec = 0;
-    RefPtr<KeyboardEvent> keyboardEvent = new KeyboardEvent(key, document()->defaultView());
+    RefPtr<KeyboardEvent> keyboardEvent = KeyboardEvent::create(key, document()->defaultView());
     bool r = dispatchEvent(keyboardEvent,ec,true);
     
     // we want to return false if default is prevented (already taken care of)
@@ -298,11 +296,11 @@ bool EventTargetNode::dispatchMouseEvent(const AtomicString& eventType, int butt
     RefPtr<EventTargetNode> relatedTarget = (relatedTargetArg && relatedTargetArg->isEventTargetNode())
         ? static_cast<EventTargetNode*>(relatedTargetArg) : 0;
 
-    RefPtr<Event> mouseEvent = new MouseEvent(eventType,
+    RefPtr<Event> mouseEvent = MouseEvent::create(eventType,
         true, cancelable, document()->defaultView(),
         detail, screenX, screenY, pageX, pageY,
         ctrlKey, altKey, shiftKey, metaKey, button,
-        relatedTarget.get(), 0, isSimulated);
+        relatedTarget, 0, isSimulated);
     mouseEvent->setUnderlyingEvent(underlyingEvent.get());
     
     dispatchEvent(mouseEvent, ec, true);
@@ -315,11 +313,11 @@ bool EventTargetNode::dispatchMouseEvent(const AtomicString& eventType, int butt
     // of the DOM specs, but is used for compatibility with the ondblclick="" attribute.  This is treated
     // as a separate event in other DOM-compliant browsers like Firefox, and so we do the same.
     if (eventType == clickEvent && detail == 2) {
-        RefPtr<Event> doubleClickEvent = new MouseEvent(dblclickEvent,
+        RefPtr<Event> doubleClickEvent = MouseEvent::create(dblclickEvent,
             true, cancelable, document()->defaultView(),
             detail, screenX, screenY, pageX, pageY,
             ctrlKey, altKey, shiftKey, metaKey, button,
-            relatedTarget.get(), 0, isSimulated);
+            relatedTarget, 0, isSimulated);
         doubleClickEvent->setUnderlyingEvent(underlyingEvent.get());
         if (defaultHandled)
             doubleClickEvent->setDefaultHandled();
@@ -343,11 +341,11 @@ void EventTargetNode::dispatchWheelEvent(PlatformWheelEvent& e)
     
     IntPoint pos = view->windowToContents(e.pos());
     
-    RefPtr<WheelEvent> we = new WheelEvent(e.deltaX(), e.deltaY(),
-                                           document()->defaultView(), e.globalX(), e.globalY(), pos.x(), pos.y(),
-                                           e.ctrlKey(), e.altKey(), e.shiftKey(), e.metaKey());
+    RefPtr<WheelEvent> we = WheelEvent::create(e.deltaX(), e.deltaY(),
+        document()->defaultView(), e.globalX(), e.globalY(), pos.x(), pos.y(),
+        e.ctrlKey(), e.altKey(), e.shiftKey(), e.metaKey());
     ExceptionCode ec = 0;
-    if (!dispatchEvent(we, ec, true))
+    if (!dispatchEvent(we.release(), ec, true))
         e.accept();
 }
 
@@ -366,14 +364,14 @@ bool EventTargetNode::dispatchHTMLEvent(const AtomicString &eventType, bool canB
 {
     ASSERT(!eventDispatchForbidden());
     ExceptionCode ec = 0;
-    return dispatchEvent(new Event(eventType, canBubbleArg, cancelableArg), ec, true);
+    return dispatchEvent(Event::create(eventType, canBubbleArg, cancelableArg), ec, true);
 }
 
 bool EventTargetNode::dispatchProgressEvent(const AtomicString &eventType, bool lengthComputableArg, unsigned loadedArg, unsigned totalArg)
 {
     ASSERT(!eventDispatchForbidden());
     ExceptionCode ec = 0;
-    return dispatchEvent(new ProgressEvent(eventType, lengthComputableArg, loadedArg, totalArg), ec, true);
+    return dispatchEvent(ProgressEvent::create(eventType, lengthComputableArg, loadedArg, totalArg), ec, true);
 }
 
 void EventTargetNode::dispatchStorageEvent(const AtomicString &eventType, const String& key, const String& oldValue, const String& newValue, Frame* source)
@@ -381,11 +379,10 @@ void EventTargetNode::dispatchStorageEvent(const AtomicString &eventType, const
 #if ENABLE(DOM_STORAGE)
     ASSERT(!eventDispatchForbidden());
     ExceptionCode ec = 0;
-    dispatchEvent(new StorageEvent(eventType, key, oldValue, newValue, source->document()->documentURI(), source->domWindow()), ec, true); 
+    dispatchEvent(StorageEvent::create(eventType, key, oldValue, newValue, source->document()->documentURI(), source->domWindow()), ec, true); 
 #endif
 }
 
-
 void EventTargetNode::removeHTMLEventListener(const AtomicString &eventType)
 {
     if (!m_regdListeners) // nothing to remove
index c77d3d0..2b0a131 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 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
@@ -51,11 +51,21 @@ namespace WebCore {
             DOM_KEY_LOCATION_NUMPAD        = 0x03
         };
         
-        KeyboardEvent();
-        KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*);
-        KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView*,
-                      const String& keyIdentifier, unsigned keyLocation,
-                      bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey);
+        static PassRefPtr<KeyboardEvent> create()
+        {
+            return adoptRef(new KeyboardEvent);
+        }
+        static PassRefPtr<KeyboardEvent> create(const PlatformKeyboardEvent& platformEvent, AbstractView* view)
+        {
+            return adoptRef(new KeyboardEvent(platformEvent, view));
+        }
+        static PassRefPtr<KeyboardEvent> create(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
+            const String& keyIdentifier, unsigned keyLocation,
+            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey)
+        {
+            return adoptRef(new KeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, keyLocation,
+                ctrlKey, altKey, shiftKey, metaKey, altGraphKey));
+        }
         virtual ~KeyboardEvent();
     
         void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView*,
@@ -83,6 +93,12 @@ namespace WebCore {
 #endif
 
     private:
+        KeyboardEvent();
+        KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*);
+        KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView*,
+                      const String& keyIdentifier, unsigned keyLocation,
+                      bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey);
+
         PlatformKeyboardEvent* m_keyEvent;
         String m_keyIdentifier;
         unsigned m_keyLocation;
index 0bfeb5c..17d32c0 100644 (file)
@@ -1,11 +1,9 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2001 Peter Kelly (pmk@post.com)
  *           (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 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
  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
+
 #include "config.h"
 #include "MappedAttribute.h"
 
 namespace WebCore {
 
-Attribute* MappedAttribute::clone(bool preserveDecl) const
+PassRefPtr<Attribute> MappedAttribute::clone() const
 {
-    return new MappedAttribute(name(), value(), preserveDecl ? m_styleDecl.get() : 0);
+    return adoptRef(new MappedAttribute(name(), value(), m_styleDecl.get()));
 }
 
 }
index 0ecc3cb..3a0ab51 100644 (file)
@@ -1,11 +1,9 @@
 /*
- * This file is part of the DOM implementation for KDE.
- *
  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2001 Peter Kelly (pmk@post.com)
  *           (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 2004, 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
 
 namespace WebCore {
 
-class Attr;
-class CSSStyleDeclaration;
-class CSSStyleSelector;
-class Element;
-class NamedAttrMap;
-
-class MappedAttribute : public Attribute
-{
+class MappedAttribute : public Attribute {
 public:
-    MappedAttribute(const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration* decl = 0)
-    : Attribute(name, value), m_styleDecl(decl)
+    static PassRefPtr<MappedAttribute> create(const QualifiedName& name, const AtomicString& value)
     {
+        return adoptRef(new MappedAttribute(name, value, 0));
     }
-
-    MappedAttribute(const AtomicString& name, const AtomicString& value, CSSMappedAttributeDeclaration* decl = 0)
-    : Attribute(name, value), m_styleDecl(decl)
+    static PassRefPtr<MappedAttribute> create(const AtomicString& name, const AtomicString& value)
     {
+        return adoptRef(new MappedAttribute(name, value, 0));
     }
 
-    virtual Attribute* clone(bool preserveDecl=true) const;
+    virtual PassRefPtr<Attribute> clone() const;
 
     virtual CSSStyleDeclaration* style() const { return m_styleDecl.get(); }
 
     CSSMappedAttributeDeclaration* decl() const { return m_styleDecl.get(); }
-    void setDecl(CSSMappedAttributeDeclaration* decl) { m_styleDecl = decl; }
+    void setDecl(PassRefPtr<CSSMappedAttributeDeclaration> decl) { m_styleDecl = decl; }
 
 private:
+    MappedAttribute(const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration* declaration)
+        : Attribute(name, value), m_styleDecl(declaration)
+    {
+    }
+    MappedAttribute(const AtomicString& name, const AtomicString& value, CSSMappedAttributeDeclaration* declaration)
+        : Attribute(name, value), m_styleDecl(declaration)
+    {
+    }
+
     RefPtr<CSSMappedAttributeDeclaration> m_styleDecl;
 };
 
index 288f458..5b378bb 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2007 Henry Mason (hmason@mac.com)
- * Copyright (C) 2003, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 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
  */
 
 #include "config.h"
+#include "MessageEvent.h"
 
 #include "DOMWindow.h"
 #include "EventNames.h"
-#include "MessageEvent.h"
 
 namespace WebCore {
 
@@ -39,7 +39,7 @@ MessageEvent::MessageEvent()
 {
 }
 
-MessageEvent::MessageEvent(const String& data, const String& origin, const String& lastEventId, DOMWindow* source)
+MessageEvent::MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source)
     : Event(messageEvent, false, true)
     , m_data(data)
     , m_origin(origin)
index 24b57da..a199d3e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2007 Henry Mason (hmason@mac.com)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 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
@@ -36,8 +36,14 @@ namespace WebCore {
 
     class MessageEvent : public Event {
     public:
-        MessageEvent();
-        MessageEvent(const String& data, const String& origin, const String& lastEventId, DOMWindow* source);
+        static PassRefPtr<MessageEvent> create()
+        {
+            return adoptRef(new MessageEvent);
+        }
+        static PassRefPtr<MessageEvent> create(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source)
+        {
+            return adoptRef(new MessageEvent(data, origin, lastEventId, source));
+        }
         virtual ~MessageEvent();
 
         void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source);
@@ -50,6 +56,9 @@ namespace WebCore {
         virtual bool isMessageEvent() const;
 
     private:    
+        MessageEvent();
+        MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source);
+
         String m_data;
         String m_origin;
         String m_lastEventId;
index 245d620..c55093c 100644 (file)
@@ -1,10 +1,8 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 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
@@ -37,11 +35,11 @@ MouseEvent::MouseEvent()
 {
 }
 
-MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, AbstractView* view,
+MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
                        int detail, int screenX, int screenY, int pageX, int pageY,
                        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
-                       unsigned short button, EventTargetNode* relatedTarget,
-                       Clipboard* clipboard, bool isSimulated)
+                       unsigned short button, PassRefPtr<EventTargetNode> relatedTarget,
+                       PassRefPtr<Clipboard> clipboard, bool isSimulated)
     : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, screenX, screenY,
                         pageX, pageY, ctrlKey, altKey, shiftKey, metaKey, isSimulated)
     , m_button(button == (unsigned short)-1 ? 0 : button)
@@ -55,10 +53,10 @@ MouseEvent::~MouseEvent()
 {
 }
 
-void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
+void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
                                 int detail, int screenX, int screenY, int clientX, int clientY,
                                 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
-                                unsigned short button, EventTargetNode* relatedTarget)
+                                unsigned short button, PassRefPtr<EventTargetNode> relatedTarget)
 {
     if (dispatched())
         return;
index 4a2d505..aa3eee5 100644 (file)
@@ -1,10 +1,8 @@
 /*
- * This file is part of the DOM implementation for KDE.
- *
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 2004, 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
@@ -35,17 +33,24 @@ namespace WebCore {
     // Introduced in DOM Level 2
     class MouseEvent : public MouseRelatedEvent {
     public:
-        MouseEvent();
-        MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
-                   int detail, int screenX, int screenY, int pageX, int pageY,
-                   bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
-                   EventTargetNode* relatedTarget, Clipboard* clipboard = 0, bool isSimulated = false);
+        static PassRefPtr<MouseEvent> create()
+        {
+            return adoptRef(new MouseEvent);
+        }
+        static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
+            int detail, int screenX, int screenY, int pageX, int pageY,
+            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
+            PassRefPtr<EventTargetNode> relatedTarget, PassRefPtr<Clipboard> clipboard = 0, bool isSimulated = false)
+        {
+            return adoptRef(new MouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, pageX, pageY,
+                ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, clipboard, isSimulated));
+        }
         virtual ~MouseEvent();
 
-        void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
+        void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
                             int detail, int screenX, int screenY, int clientX, int clientY,
                             bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
-                            unsigned short button, EventTargetNode* relatedTarget);
+                            unsigned short button, PassRefPtr<EventTargetNode> relatedTarget);
 
         // WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
         // but we will match the standard DOM.
@@ -65,6 +70,12 @@ namespace WebCore {
         virtual int which() const;
 
     private:
+        MouseEvent();
+        MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
+                   int detail, int screenX, int screenY, int pageX, int pageY,
+                   bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
+                   PassRefPtr<EventTargetNode> relatedTarget, PassRefPtr<Clipboard> clipboard, bool isSimulated);
+
         unsigned short m_button;
         bool m_buttonDown;
         RefPtr<EventTargetNode> m_relatedTarget;
index 994cab5..015ad34 100644 (file)
@@ -1,10 +1,8 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 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
@@ -29,7 +27,6 @@
 #include "Document.h"
 #include "Frame.h"
 #include "FrameView.h"
-#include "Node.h"
 #include "RenderLayer.h"
 #include "RenderObject.h"
 
@@ -76,14 +73,14 @@ static int contentsY(AbstractView* abstractView)
     return frameView->contentsY();
 }
 
-MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, AbstractView* view,
+MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<AbstractView> viewArg,
                                      int detail, int screenX, int screenY, int pageX, int pageY,
                                      bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated)
-    : UIEventWithKeyState(eventType, canBubble, cancelable, view, detail, ctrlKey, altKey, shiftKey, metaKey)
+    : UIEventWithKeyState(eventType, canBubble, cancelable, viewArg, detail, ctrlKey, altKey, shiftKey, metaKey)
     , m_screenX(screenX)
     , m_screenY(screenY)
-    , m_clientX(pageX - contentsX(view))
-    , m_clientY(pageY - contentsY(view))
+    , m_clientX(pageX - contentsX(view()))
+    , m_clientY(pageY - contentsY(view()))
     , m_pageX(pageX)
     , m_pageY(pageY)
     , m_isSimulated(isSimulated)
index 9d88d58..35c65dd 100644 (file)
@@ -33,11 +33,6 @@ namespace WebCore {
     // Internal only: Helper class for what's common between mouse and wheel events.
     class MouseRelatedEvent : public UIEventWithKeyState {
     public:
-        MouseRelatedEvent();
-        MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
-                          int detail, int screenX, int screenY, int pageX, int pageY,
-                          bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated = false);
-
         int screenX() const { return m_screenX; }
         int screenY() const { return m_screenY; }
         int clientX() const { return m_clientX; }
@@ -53,6 +48,11 @@ namespace WebCore {
         int y() const;
     
     protected:
+        MouseRelatedEvent();
+        MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
+                          int detail, int screenX, int screenY, int pageX, int pageY,
+                          bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated = false);
+
         void initCoordinates();
         void initCoordinates(int clientX, int clientY);
         virtual void receivedTarget();
index 6ab577e..58bce1f 100644 (file)
@@ -1,10 +1,8 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 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
@@ -32,7 +30,7 @@ MutationEvent::MutationEvent()
 {
 }
 
-MutationEvent::MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, Node* relatedNode,
+MutationEvent::MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
                              const String& prevValue, const String& newValue,
                              const String& attrName, unsigned short attrChange)
     : Event(type, canBubble, cancelable)
@@ -44,7 +42,7 @@ MutationEvent::MutationEvent(const AtomicString& type, bool canBubble, bool canc
 {
 }
 
-void MutationEvent::initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, Node* relatedNode,
+void MutationEvent::initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
                                       const String& prevValue, const String& newValue,
                                       const String& attrName, unsigned short attrChange)
 {
index a820ed3..c5f2d1d 100644 (file)
@@ -1,10 +1,8 @@
 /*
- * This file is part of the DOM implementation for KDE.
- *
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 2004, 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
@@ -39,12 +37,17 @@ namespace WebCore {
             REMOVAL         = 3
         };
 
-        MutationEvent();
-        MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, Node* relatedNode,
-                      const String& prevValue, const String& newValue,
-                      const String& attrName, unsigned short attrChange);
+        static PassRefPtr<MutationEvent> create()
+        {
+            return adoptRef(new MutationEvent);
+        }
+        static PassRefPtr<MutationEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
+            const String& prevValue, const String& newValue, const String& attrName, unsigned short attrChange)
+        {
+            return adoptRef(new MutationEvent(type, canBubble, cancelable, relatedNode, prevValue, newValue, attrName, attrChange));
+        }
 
-        void initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, Node* relatedNode,
+        void initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
                                const String& prevValue, const String& newValue,
                                const String& attrName, unsigned short attrChange);
 
@@ -57,6 +60,11 @@ namespace WebCore {
         virtual bool isMutationEvent() const;
 
     private:
+        MutationEvent();
+        MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
+                      const String& prevValue, const String& newValue,
+                      const String& attrName, unsigned short attrChange);
+
         RefPtr<Node> m_relatedNode;
         String m_prevValue;
         String m_newValue;
index fb3e289..9fd0ea1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -38,8 +38,14 @@ namespace WebCore {
             BOTH       = 2
         };
 
-        OverflowEvent();
-        OverflowEvent(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow);
+        static PassRefPtr<OverflowEvent> create()
+        {
+            return adoptRef(new OverflowEvent);
+        }
+        static PassRefPtr<OverflowEvent> create(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow)
+        {
+            return adoptRef(new OverflowEvent(horizontalOverflowChanged, horizontalOverflow, verticalOverflowChanged, verticalOverflow));
+        }
 
         void initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow);
 
@@ -50,6 +56,9 @@ namespace WebCore {
         virtual bool isOverflowEvent() const;
         
     private:
+        OverflowEvent();
+        OverflowEvent(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow);
+
         unsigned short m_orient;
         bool m_horizontalOverflow;
         bool m_verticalOverflow;
index efd7a1d..e30cb1b 100644 (file)
@@ -32,8 +32,14 @@ namespace WebCore {
     
     class ProgressEvent : public Event {
     public:
-        ProgressEvent();
-        ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total);
+        static PassRefPtr<ProgressEvent> create()
+        {
+            return adoptRef(new ProgressEvent);
+        }
+        static PassRefPtr<ProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total)
+        {
+            return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
+        }
 
         void initProgressEvent(const AtomicString& typeArg, 
                                bool canBubbleArg,
@@ -49,6 +55,10 @@ namespace WebCore {
         virtual bool isProgressEvent() const { return true; }
         
     protected:
+        ProgressEvent();
+        ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total);
+
+    private:
         bool m_lengthComputable;
         unsigned m_loaded;
         unsigned m_total;
index f2859a6..f5aef90 100644 (file)
@@ -71,6 +71,13 @@ CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttri
     return mappedAttributeDecls->get(MappedAttributeKey(entryType, attr->name().localName().impl(), attr->value().impl()));
 }
 
+CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& value)
+{
+    if (!mappedAttributeDecls)
+        return 0;
+    return mappedAttributeDecls->get(MappedAttributeKey(type, name.localName().impl(), value.impl()));
+}
+
 void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, Attribute* attr, CSSMappedAttributeDeclaration* decl)
 {
     if (!mappedAttributeDecls)
@@ -78,8 +85,14 @@ void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, Attri
     mappedAttributeDecls->set(MappedAttributeKey(entryType, attr->name().localName().impl(), attr->value().impl()), decl);
 }
 
-void StyledElement::removeMappedAttributeDecl(MappedAttributeEntry entryType,
-                                                  const QualifiedName& attrName, const AtomicString& attrValue)
+void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration* decl)
+{
+    if (!mappedAttributeDecls)
+        mappedAttributeDecls = new MappedAttributeDecls;
+    mappedAttributeDecls->set(MappedAttributeKey(entryType, name.localName().impl(), value.impl()), decl);
+}
+
+void StyledElement::removeMappedAttributeDecl(MappedAttributeEntry entryType, const QualifiedName& attrName, const AtomicString& attrValue)
 {
     if (!mappedAttributeDecls)
         return;
@@ -111,9 +124,9 @@ StyledElement::~StyledElement()
     destroyInlineStyleDecl();
 }
 
-Attribute* StyledElement::createAttribute(const QualifiedName& name, const AtomicString& value)
+PassRefPtr<Attribute> StyledElement::createAttribute(const QualifiedName& name, const AtomicString& value)
 {
-    return new MappedAttribute(name, value);
+    return MappedAttribute::create(name, value);
 }
 
 void StyledElement::createInlineStyleDecl()
index de2f79f..efdd4d2 100644 (file)
@@ -53,9 +53,12 @@ public:
     void addCSSColor(MappedAttribute* attr, int id, const String &c);
     void createMappedDecl(MappedAttribute* attr);
     
+    static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& value);
+    static void setMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration*);
+    static void removeMappedAttributeDecl(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& value);
+
     static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, Attribute*);
     static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*);
-    static void removeMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& attrName, const AtomicString& attrValue);
     
     CSSMutableStyleDeclaration* inlineStyleDecl() const { return m_inlineStyleDecl.get(); }
     virtual bool canHaveAdditionalAttributeStyleDecls() const { return false; }
@@ -73,7 +76,7 @@ public:
     virtual void parseMappedAttribute(MappedAttribute*);
     virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
     virtual void createAttributeMap() const;
-    virtual Attribute* createAttribute(const QualifiedName& name, const AtomicString& value);
+    virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value);
 
     virtual void copyNonAttributeProperties(const Element*);
 
index 3f48a2d..1343e6f 100644 (file)
@@ -39,7 +39,7 @@ TextEvent::TextEvent()
 {
 }
 
-TextEvent::TextEvent(AbstractView* view, const String& data)
+TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data)
     : UIEvent(textInputEvent, true, true, view, 0)
     , m_data(data)
     , m_isLineBreak(false)
@@ -51,7 +51,7 @@ TextEvent::~TextEvent()
 {
 }
 
-void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, const String& data)
+void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, const String& data)
 {
     if (dispatched())
         return;
index 3297a01..9f93fdb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -33,11 +33,17 @@ namespace WebCore {
 
     class TextEvent : public UIEvent {
     public:
-        TextEvent();
-        TextEvent(AbstractView*, const String& data);
+        static PassRefPtr<TextEvent> create()
+        {
+            return adoptRef(new TextEvent);
+        }
+        static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView> view, const String& data)
+        {
+            return adoptRef(new TextEvent(view, data));
+        }
         virtual ~TextEvent();
     
-        void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView*, const String& data);
+        void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, const String& data);
     
         String data() const { return m_data; }
 
@@ -52,6 +58,9 @@ namespace WebCore {
         void setIsBackTab(bool isBackTab) { m_isBackTab = isBackTab; }
 
     private:
+        TextEvent();
+        TextEvent(PassRefPtr<AbstractView>, const String& data);
+
         String m_data;
         bool m_isLineBreak;
         bool m_isBackTab;
index f247eed..401015b 100644 (file)
@@ -1,10 +1,8 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 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
@@ -34,7 +32,7 @@ UIEvent::UIEvent()
 {
 }
 
-UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, AbstractView* viewArg, int detailArg)
+UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, PassRefPtr<AbstractView> viewArg, int detailArg)
     : Event(eventType, canBubbleArg, cancelableArg)
     , m_view(viewArg)
     , m_detail(detailArg)
@@ -45,7 +43,7 @@ UIEvent::~UIEvent()
 {
 }
 
-void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, AbstractView* viewArg, int detailArg)
+void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, PassRefPtr<AbstractView> viewArg, int detailArg)
 {
     if (dispatched())
         return;
index 9c5e0cd..8e330a5 100644 (file)
@@ -1,10 +1,8 @@
 /*
- * This file is part of the DOM implementation for KDE.
- *
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 2004, 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
 #ifndef UIEvent_h
 #define UIEvent_h
 
+#include "DOMWindow.h"
 #include "Event.h"
 
 namespace WebCore {
 
-    class DOMWindow;
-
     typedef DOMWindow AbstractView;
 
     class UIEvent : public Event {
     public:
-        UIEvent();
-        UIEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail);
+        static PassRefPtr<UIEvent> create()
+        {
+            return adoptRef(new UIEvent);
+        }
+        static PassRefPtr<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view, int detail)
+        {
+            return adoptRef(new UIEvent(type, canBubble, cancelable, view, detail));
+        }
         virtual ~UIEvent();
 
-        void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, int detail);
+        void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int detail);
 
         AbstractView* view() const { return m_view.get(); }
         int detail() const { return m_detail; }
@@ -58,6 +61,10 @@ namespace WebCore {
 
         virtual int which() const;
 
+    protected:
+        UIEvent();
+        UIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, int detail);
+
     private:
         RefPtr<AbstractView> m_view;
         int m_detail;
index 9d42129..414161a 100644 (file)
@@ -1,10 +1,8 @@
 /*
- * This file is part of the DOM implementation for KDE.
- *
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 2004, 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
@@ -32,6 +30,12 @@ namespace WebCore {
     
     class UIEventWithKeyState : public UIEvent {
     public:
+        bool ctrlKey() const { return m_ctrlKey; }
+        bool shiftKey() const { return m_shiftKey; }
+        bool altKey() const { return m_altKey; }
+        bool metaKey() const { return m_metaKey; }
+
+    protected:
         UIEventWithKeyState()
             : m_ctrlKey(false)
             , m_altKey(false)
@@ -40,7 +44,7 @@ namespace WebCore {
         {
         }
         
-        UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
+        UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
                             int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
             : UIEvent(type, canBubble, cancelable, view, detail)
             , m_ctrlKey(ctrlKey)
@@ -50,12 +54,6 @@ namespace WebCore {
         {
         }
 
-        bool ctrlKey() const { return m_ctrlKey; }
-        bool shiftKey() const { return m_shiftKey; }
-        bool altKey() const { return m_altKey; }
-        bool metaKey() const { return m_metaKey; }
-
-    protected:
         // Expose these so init functions can set them.
         bool m_ctrlKey : 1;
         bool m_altKey : 1;
index 02b2448..73e0d5e 100644 (file)
@@ -1,10 +1,8 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 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
@@ -26,7 +24,6 @@
 #include "WheelEvent.h"
 
 #include "EventNames.h"
-
 #include <wtf/MathExtras.h>
 
 namespace WebCore {
@@ -39,7 +36,7 @@ WheelEvent::WheelEvent()
 {
 }
 
-WheelEvent::WheelEvent(float wheelDeltaX, float wheelDeltaY, AbstractView* view,
+WheelEvent::WheelEvent(float wheelDeltaX, float wheelDeltaY, PassRefPtr<AbstractView> view,
                        int screenX, int screenY, int pageX, int pageY,
                        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
     : MouseRelatedEvent(mousewheelEvent,
@@ -55,7 +52,7 @@ WheelEvent::WheelEvent(float wheelDeltaX, float wheelDeltaY, AbstractView* view,
         m_wheelDeltaY = (wheelDeltaY > 0) ? 120 : -120;
 }
 
-void WheelEvent::initWheelEvent(int wheelDeltaX, int wheelDeltaY, AbstractView* view,
+void WheelEvent::initWheelEvent(int wheelDeltaX, int wheelDeltaY, PassRefPtr<AbstractView> view,
                                 int screenX, int screenY, int pageX, int pageY,
                                 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
 {
index 9d21949..015796e 100644 (file)
@@ -1,10 +1,8 @@
 /*
- * This file is part of the DOM implementation for KDE.
- *
  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 2004, 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
@@ -33,12 +31,19 @@ namespace WebCore {
     // extension: mouse wheel event
     class WheelEvent : public MouseRelatedEvent {
     public:
-        WheelEvent();
-        WheelEvent(float wheelDeltaX, float wheelDeltaY, AbstractView*,
-                   int screenX, int screenY, int pageX, int pageY,
-                   bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+        static PassRefPtr<WheelEvent> create()
+        {
+            return adoptRef(new WheelEvent);
+        }
+        static PassRefPtr<WheelEvent> create(float wheelDeltaX, float wheelDeltaY, PassRefPtr<AbstractView> view,
+            int screenX, int screenY, int pageX, int pageY,
+            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+        {
+            return adoptRef(new WheelEvent(wheelDeltaX, wheelDeltaY, view, screenX, screenY, pageX, pageY,
+                ctrlKey, altKey, shiftKey, metaKey));
+        }
 
-        void initWheelEvent(int wheelDeltaX, int wheelDeltaY, AbstractView*,
+        void initWheelEvent(int wheelDeltaX, int wheelDeltaY, PassRefPtr<AbstractView>,
                             int screenX, int screenY, int pageX, int pageY,
                             bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
 
@@ -50,6 +55,11 @@ namespace WebCore {
         bool isHorizontal() const { return m_wheelDeltaX; }
 
     private:
+        WheelEvent();
+        WheelEvent(float wheelDeltaX, float wheelDeltaY, PassRefPtr<AbstractView>,
+                   int screenX, int screenY, int pageX, int pageY,
+                   bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+
         virtual bool isWheelEvent() const;
 
         int m_wheelDeltaX;
index ab68d6b..6641877 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -29,8 +29,8 @@
 
 namespace WebCore {
 
-AppendNodeCommand::AppendNodeCommand(Node* parentNode, PassRefPtr<Node> childToAppend)
-    : EditCommand(parentNode->document()), m_parentNode(parentNode), m_childToAppend(childToAppend)
+AppendNodeCommand::AppendNodeCommand(PassRefPtr<Node> parentNode, PassRefPtr<Node> childToAppend)
+    : SimpleEditCommand(parentNode->document()), m_parentNode(parentNode), m_childToAppend(childToAppend)
 {
     ASSERT(m_childToAppend);
     ASSERT(m_parentNode);
index ce9da6d..3210512 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 {
 
-class AppendNodeCommand : public EditCommand {
+class AppendNodeCommand : public SimpleEditCommand {
 public:
-    AppendNodeCommand(Node* parentNode, PassRefPtr<Node> childToAppend);
+    static PassRefPtr<AppendNodeCommand> create(PassRefPtr<Node> parentNode, PassRefPtr<Node> childToAppend)
+    {
+        return adoptRef(new AppendNodeCommand(parentNode, childToAppend));
+    }
+
+private:
+    AppendNodeCommand(PassRefPtr<Node> parentNode, PassRefPtr<Node> childToAppend);
 
     virtual void doApply();
     virtual void doUnapply();
 
-    Node* parentNode() const { return m_parentNode.get(); }
-    Node* childToAppend() const { return m_childToAppend.get(); }
-
-private:
     RefPtr<Node> m_parentNode;
     RefPtr<Node> m_childToAppend;
 };
index 2802f5f..42e14a4 100644 (file)
@@ -398,15 +398,15 @@ void ApplyStyleCommand::applyBlockStyle(CSSMutableStyleDeclaration *style)
     while (paragraphStart.isNotNull() && paragraphStart != beyondEnd) {
         StyleChange styleChange(style, paragraphStart.deepEquivalent(), StyleChange::styleModeForParseMode(document()->inCompatMode()));
         if (styleChange.cssStyle().length() > 0 || m_removeOnly) {
-            Node* block = enclosingBlock(paragraphStart.deepEquivalent().node());
-            Node* newBlock = moveParagraphContentsToNewBlockIfNecessary(paragraphStart.deepEquivalent());
+            RefPtr<Node> block = enclosingBlock(paragraphStart.deepEquivalent().node());
+            RefPtr<Node> newBlock = moveParagraphContentsToNewBlockIfNecessary(paragraphStart.deepEquivalent());
             if (newBlock)
                 block = newBlock;
             ASSERT(block->isHTMLElement());
             if (block->isHTMLElement()) {
-                removeCSSStyle(style, static_cast<HTMLElement*>(block));
+                removeCSSStyle(style, static_cast<HTMLElement*>(block.get()));
                 if (!m_removeOnly)
-                    addBlockStyle(styleChange, static_cast<HTMLElement*>(block));
+                    addBlockStyle(styleChange, static_cast<HTMLElement*>(block.get()));
             }
         }
         paragraphStart = nextParagraphStart;
index eafec59..8df76a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -37,16 +37,29 @@ class ApplyStyleCommand : public CompositeEditCommand {
 public:
     enum EPropertyLevel { PropertyDefault, ForceBlockProperties };
 
-    ApplyStyleCommand(Document*, CSSStyleDeclaration*, EditAction = EditActionChangeAttributes, EPropertyLevel = PropertyDefault);
-    ApplyStyleCommand(Document*, CSSStyleDeclaration*, const Position& start, const Position& end, EditAction = EditActionChangeAttributes, EPropertyLevel = PropertyDefault);
-    ApplyStyleCommand(Element*, bool = false, EditAction = EditActionChangeAttributes);
+    static PassRefPtr<ApplyStyleCommand> create(Document* document, CSSStyleDeclaration* style, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault)
+    {
+        return adoptRef(new ApplyStyleCommand(document, style, action, level));
+    }
+    static PassRefPtr<ApplyStyleCommand> create(Document* document, CSSStyleDeclaration* style, const Position& start, const Position& end, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault)
+    {
+        return adoptRef(new ApplyStyleCommand(document, style, start, end, action, level));
+    }
+    static PassRefPtr<ApplyStyleCommand> create(Element* element, bool removeOnly = false, EditAction action = EditActionChangeAttributes)
+    {
+        return adoptRef(new ApplyStyleCommand(element, removeOnly, action));
+    }
+
+private:
+    ApplyStyleCommand(Document*, CSSStyleDeclaration*, EditAction, EPropertyLevel);
+    ApplyStyleCommand(Document*, CSSStyleDeclaration*, const Position& start, const Position& end, EditAction, EPropertyLevel);
+    ApplyStyleCommand(Element*, bool removeOnly, EditAction);
 
     virtual void doApply();
     virtual EditAction editingAction() const;
 
     CSSMutableStyleDeclaration* style() const { return m_style.get(); }
 
-private:
     // style-removal helpers
     bool isHTMLStyleNode(CSSMutableStyleDeclaration*, HTMLElement*);
     void removeHTMLStyleNode(HTMLElement*);
index 466bf6c..885e5d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,6 +32,12 @@ namespace WebCore {
 
 class BreakBlockquoteCommand : public CompositeEditCommand {
 public:
+    static PassRefPtr<BreakBlockquoteCommand> create(Document* document)
+    {
+        return adoptRef(new BreakBlockquoteCommand(document));
+    }
+
+private:
     BreakBlockquoteCommand(Document*);
     virtual void doApply();
 };
index 63196b9..0fd90b1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 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
@@ -100,38 +100,38 @@ void CompositeEditCommand::applyCommandToComposite(PassRefPtr<EditCommand> cmd)
 
 void CompositeEditCommand::applyStyle(CSSStyleDeclaration* style, EditAction editingAction)
 {
-    applyCommandToComposite(new ApplyStyleCommand(document(), style, editingAction));
+    applyCommandToComposite(ApplyStyleCommand::create(document(), style, editingAction));
 }
 
 void CompositeEditCommand::applyStyle(CSSStyleDeclaration* style, const Position& start, const Position& end, EditAction editingAction)
 {
-    applyCommandToComposite(new ApplyStyleCommand(document(), style, start, end, editingAction));
+    applyCommandToComposite(ApplyStyleCommand::create(document(), style, start, end, editingAction));
 }
 
 void CompositeEditCommand::applyStyledElement(Element* element)
 {
-    applyCommandToComposite(new ApplyStyleCommand(element, false));
+    applyCommandToComposite(ApplyStyleCommand::create(element, false));
 }
 
 void CompositeEditCommand::removeStyledElement(Element* element)
 {
-    applyCommandToComposite(new ApplyStyleCommand(element, true));
+    applyCommandToComposite(ApplyStyleCommand::create(element, true));
 }
 
 void CompositeEditCommand::insertParagraphSeparator(bool useDefaultParagraphElement)
 {
-    applyCommandToComposite(new InsertParagraphSeparatorCommand(document(), useDefaultParagraphElement));
+    applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), useDefaultParagraphElement));
 }
 
 void CompositeEditCommand::insertLineBreak()
 {
-    applyCommandToComposite(new InsertLineBreakCommand(document()));
+    applyCommandToComposite(InsertLineBreakCommand::create(document()));
 }
 
 void CompositeEditCommand::insertNodeBefore(Node* insertChild, Node* refChild)
 {
     ASSERT(!refChild->hasTagName(bodyTag));
-    applyCommandToComposite(new InsertNodeBeforeCommand(insertChild, refChild));
+    applyCommandToComposite(InsertNodeBeforeCommand::create(insertChild, refChild));
 }
 
 void CompositeEditCommand::insertNodeAfter(Node* insertChild, Node* refChild)
@@ -175,7 +175,7 @@ void CompositeEditCommand::insertNodeAt(Node* insertChild, const Position& editi
 void CompositeEditCommand::appendNode(Node* newChild, Node* parent)
 {
     ASSERT(canHaveChildrenForEditing(parent));
-    applyCommandToComposite(new AppendNodeCommand(parent, newChild));
+    applyCommandToComposite(AppendNodeCommand::create(parent, newChild));
 }
 
 void CompositeEditCommand::removeChildrenInRange(Node* node, int from, int to)
@@ -191,12 +191,12 @@ void CompositeEditCommand::removeChildrenInRange(Node* node, int from, int to)
 
 void CompositeEditCommand::removeNode(Node* removeChild)
 {
-    applyCommandToComposite(new RemoveNodeCommand(removeChild));
+    applyCommandToComposite(RemoveNodeCommand::create(removeChild));
 }
 
 void CompositeEditCommand::removeNodePreservingChildren(Node* removeChild)
 {
-    applyCommandToComposite(new RemoveNodePreservingChildrenCommand(removeChild));
+    applyCommandToComposite(RemoveNodePreservingChildrenCommand::create(removeChild));
 }
 
 void CompositeEditCommand::removeNodeAndPruneAncestors(Node* node)
@@ -233,12 +233,12 @@ void CompositeEditCommand::prune(PassRefPtr<Node> node)
 
 void CompositeEditCommand::splitTextNode(Text *text, int offset)
 {
-    applyCommandToComposite(new SplitTextNodeCommand(text, offset));
+    applyCommandToComposite(SplitTextNodeCommand::create(text, offset));
 }
 
 void CompositeEditCommand::splitElement(Element* element, Node* atChild)
 {
-    applyCommandToComposite(new SplitElementCommand(element, atChild));
+    applyCommandToComposite(SplitElementCommand::create(element, atChild));
 }
 
 void CompositeEditCommand::mergeIdenticalElements(Element* first, Element* second)
@@ -248,22 +248,22 @@ void CompositeEditCommand::mergeIdenticalElements(Element* first, Element* secon
         removeNode(second);
         insertNodeAfter(second, first);
     }
-    applyCommandToComposite(new MergeIdenticalElementsCommand(first, second));
+    applyCommandToComposite(MergeIdenticalElementsCommand::create(first, second));
 }
 
 void CompositeEditCommand::wrapContentsInDummySpan(Element* element)
 {
-    applyCommandToComposite(new WrapContentsInDummySpanCommand(element));
+    applyCommandToComposite(WrapContentsInDummySpanCommand::create(element));
 }
 
 void CompositeEditCommand::splitTextNodeContainingElement(Text *text, int offset)
 {
-    applyCommandToComposite(new SplitTextNodeContainingElementCommand(text, offset));
+    applyCommandToComposite(SplitTextNodeContainingElementCommand::create(text, offset));
 }
 
 void CompositeEditCommand::joinTextNodes(Text *text1, Text *text2)
 {
-    applyCommandToComposite(new JoinTextNodesCommand(text1, text2));
+    applyCommandToComposite(JoinTextNodesCommand::create(text1, text2));
 }
 
 void CompositeEditCommand::inputText(const String &text, bool selectInsertedText)
@@ -276,7 +276,7 @@ void CompositeEditCommand::inputText(const String &text, bool selectInsertedText
     do {
         newline = text.find('\n', offset);
         if (newline != offset) {
-            RefPtr<InsertTextCommand> command = new InsertTextCommand(document());
+            RefPtr<InsertTextCommand> command = InsertTextCommand::create(document());
             applyCommandToComposite(command);
             int substringLength = newline == -1 ? length - offset : newline - offset;
             command->input(text.substring(offset, substringLength), false);
@@ -295,18 +295,18 @@ void CompositeEditCommand::inputText(const String &text, bool selectInsertedText
 
 void CompositeEditCommand::insertTextIntoNode(Text *node, int offset, const String &text)
 {
-    applyCommandToComposite(new InsertIntoTextNodeCommand(node, offset, text));
+    applyCommandToComposite(InsertIntoTextNodeCommand::create(node, offset, text));
 }
 
 void CompositeEditCommand::deleteTextFromNode(Text *node, int offset, int count)
 {
-    applyCommandToComposite(new DeleteFromTextNodeCommand(node, offset, count));
+    applyCommandToComposite(DeleteFromTextNodeCommand::create(node, offset, count));
 }
 
 void CompositeEditCommand::replaceTextInNode(Text *node, int offset, int count, const String &replacementText)
 {
-    applyCommandToComposite(new DeleteFromTextNodeCommand(node, offset, count));
-    applyCommandToComposite(new InsertIntoTextNodeCommand(node, offset, replacementText));
+    applyCommandToComposite(DeleteFromTextNodeCommand::create(node, offset, count));
+    applyCommandToComposite(InsertIntoTextNodeCommand::create(node, offset, replacementText));
 }
 
 Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos)
@@ -336,30 +336,30 @@ void CompositeEditCommand::insertNodeAtTabSpanPosition(Node* node, const Positio
 void CompositeEditCommand::deleteSelection(bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements)
 {
     if (endingSelection().isRange())
-        applyCommandToComposite(new DeleteSelectionCommand(document(), smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
+        applyCommandToComposite(DeleteSelectionCommand::create(document(), smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
 }
 
 void CompositeEditCommand::deleteSelection(const Selection &selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements)
 {
     if (selection.isRange())
-        applyCommandToComposite(new DeleteSelectionCommand(selection, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
+        applyCommandToComposite(DeleteSelectionCommand::create(selection, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
 }
 
 void CompositeEditCommand::removeCSSProperty(CSSStyleDeclaration *decl, int property)
 {
-    applyCommandToComposite(new RemoveCSSPropertyCommand(document(), decl, property));
+    applyCommandToComposite(RemoveCSSPropertyCommand::create(document(), decl, property));
 }
 
 void CompositeEditCommand::removeNodeAttribute(Element* element, const QualifiedName& attribute)
 {
     if (element->getAttribute(attribute).isNull())
         return;
-    applyCommandToComposite(new RemoveNodeAttributeCommand(element, attribute));
+    applyCommandToComposite(RemoveNodeAttributeCommand::create(element, attribute));
 }
 
 void CompositeEditCommand::setNodeAttribute(Element* element, const QualifiedName& attribute, const String &value)
 {
-    applyCommandToComposite(new SetNodeAttributeCommand(element, attribute, value));
+    applyCommandToComposite(SetNodeAttributeCommand::create(element, attribute, value));
 }
 
 static inline bool isWhitespace(UChar c)
@@ -546,7 +546,7 @@ void CompositeEditCommand::deleteInsignificantTextDownstream(const Position& pos
     deleteInsignificantText(pos, end);
 }
 
-Node* CompositeEditCommand::appendBlockPlaceholder(Node* node)
+PassRefPtr<Node> CompositeEditCommand::appendBlockPlaceholder(Node* node)
 {
     if (!node)
         return 0;
@@ -556,10 +556,10 @@ Node* CompositeEditCommand::appendBlockPlaceholder(Node* node)
 
     RefPtr<Node> placeholder = createBlockPlaceholderElement(document());
     appendNode(placeholder.get(), node);
-    return placeholder.get();
+    return placeholder.release();
 }
 
-Node* CompositeEditCommand::insertBlockPlaceholder(const Position& pos)
+PassRefPtr<Node> CompositeEditCommand::insertBlockPlaceholder(const Position& pos)
 {
     if (pos.isNull())
         return 0;
@@ -569,10 +569,10 @@ Node* CompositeEditCommand::insertBlockPlaceholder(const Position& pos)
 
     RefPtr<Node> placeholder = createBlockPlaceholderElement(document());
     insertNodeAt(placeholder.get(), pos);
-    return placeholder.get();
+    return placeholder.release();
 }
 
-Node* CompositeEditCommand::addBlockPlaceholderIfNeeded(Node* node)
+PassRefPtr<Node> CompositeEditCommand::addBlockPlaceholderIfNeeded(Node* node)
 {
     if (!node)
         return 0;
@@ -611,7 +611,7 @@ void CompositeEditCommand::removePlaceholderAt(const VisiblePosition& visiblePos
     }
 }
 
-Node* CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary(const Position& pos)
+PassRefPtr<Node> CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary(const Position& pos)
 {
     if (pos.isNull())
         return 0;
@@ -815,7 +815,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
     destinationIndex = TextIterator::rangeLength(startToDestinationRange.get(), true);
     
     setEndingSelection(destination);
-    applyCommandToComposite(new ReplaceSelectionCommand(document(), fragment.get(), true, false, !preserveStyle, false, true));
+    applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment.get(), true, false, !preserveStyle, false, true));
     
     if (preserveSelection && startIndex != -1) {
         // Fragment creation (using createMarkup) incorrectly uses regular
@@ -923,18 +923,18 @@ Position CompositeEditCommand::positionAvoidingSpecialElementBoundary(const Posi
 
 // Splits the tree parent by parent until we reach the specified ancestor. We use VisiblePositions
 // to determine if the split is necessary. Returns the last split node.
-Node* CompositeEditCommand::splitTreeToNode(Node* start, Node* end, bool splitAncestor)
+PassRefPtr<Node> CompositeEditCommand::splitTreeToNode(Node* start, Node* end, bool splitAncestor)
 {
-    Node* node;
+    RefPtr<Node> node;
     for (node = start; node && node->parent() != end; node = node->parent()) {
         VisiblePosition positionInParent(Position(node->parent(), 0), DOWNSTREAM);
         VisiblePosition positionInNode(Position(node, 0), DOWNSTREAM);
         if (positionInParent != positionInNode)
-            applyCommandToComposite(new SplitElementCommand(static_cast<Element*>(node->parent()), node));
+            applyCommandToComposite(SplitElementCommand::create(static_cast<Element*>(node->parent()), node));
     }
     if (splitAncestor)
         return splitTreeToNode(end, end->parent());
-    return node;
+    return node.release();
 }
 
 PassRefPtr<Element> createBlockPlaceholderElement(Document* document)
index 9be8ee7..bbf8b59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -36,11 +36,11 @@ class Text;
 
 class CompositeEditCommand : public EditCommand {
 public:
-    CompositeEditCommand(Document*);
-
-    bool isFirstCommand(EditCommand* c) { return !m_commands.isEmpty() && m_commands.first() == c; }
+    bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() && m_commands.first() == command; }
 
 protected:
+    CompositeEditCommand(Document*);
+
     //
     // sugary-sweet convenience functions to help create and apply edit commands in composite commands
     //
@@ -85,12 +85,12 @@ protected:
     void deleteInsignificantText(const Position& start, const Position& end);
     void deleteInsignificantTextDownstream(const Position&);
 
-    Node *appendBlockPlaceholder(Node*);
-    Node *insertBlockPlaceholder(const Position&);
-    Node *addBlockPlaceholderIfNeeded(Node*);
+    PassRefPtr<Node> appendBlockPlaceholder(Node*);
+    PassRefPtr<Node> insertBlockPlaceholder(const Position&);
+    PassRefPtr<Node> addBlockPlaceholderIfNeeded(Node*);
     void removePlaceholderAt(const VisiblePosition&);
 
-    Node* moveParagraphContentsToNewBlockIfNecessary(const Position&);
+    PassRefPtr<Node> moveParagraphContentsToNewBlockIfNecessary(const Position&);
     
     void pushAnchorElementDown(Node*);
     void pushPartiallySelectedAnchorElementsDown();
@@ -102,7 +102,7 @@ protected:
     
     Position positionAvoidingSpecialElementBoundary(const Position&, bool alwaysAvoidAnchors = true);
     
-    Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false);
+    PassRefPtr<Node> splitTreeToNode(Node*, Node*, bool splitAncestor = false);
 
     Vector<RefPtr<EditCommand> > m_commands;
 
index 9174fd2..ba5fe6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 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 {
 
-class CreateLinkCommand : public CompositeEditCommand
-{
+class CreateLinkCommand : public CompositeEditCommand {
 public:
-    CreateLinkCommand(Document*, const String&);
+    static PassRefPtr<CreateLinkCommand> create(Document* document, const String& linkURL)
+    {
+        return adoptRef(new CreateLinkCommand(document, linkURL));
+    }
+
+private:
+    CreateLinkCommand(Document*, const String& linkURL);
+
     virtual void doApply();
     virtual EditAction editingAction() const { return EditActionCreateLink; }
-private:
+
     String m_url;
 };
 
index 236ca21..cc6e25b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 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
@@ -301,8 +301,7 @@ void DeleteButtonController::deleteTarget()
     // within the target, we unconditionally update the selection to be
     // a caret where the target had been.
     Position pos = positionBeforeNode(element.get());
-    RefPtr<RemoveNodeCommand> command = new RemoveNodeCommand(element.get());
-    command->apply();
+    applyCommand(RemoveNodeCommand::create(element.release()));
     m_frame->selectionController()->setSelection(VisiblePosition(pos));
 }
 
index 90f4514..93a974f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -30,8 +30,8 @@
 
 namespace WebCore {
 
-DeleteFromTextNodeCommand::DeleteFromTextNodeCommand(Text *node, int offset, int count)
-    : EditCommand(node->document()), m_node(node), m_offset(offset), m_count(count)
+DeleteFromTextNodeCommand::DeleteFromTextNodeCommand(PassRefPtr<Text> node, int offset, int count)
+    : SimpleEditCommand(node->document()), m_node(node), m_offset(offset), m_count(count)
 {
     ASSERT(m_node);
     ASSERT(m_offset >= 0);
index dfad153..b3bf10b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,18 +32,19 @@ namespace WebCore {
 
 class Text;
 
-class DeleteFromTextNodeCommand : public EditCommand {
+class DeleteFromTextNodeCommand : public SimpleEditCommand {
 public:
-    DeleteFromTextNodeCommand(Text*, int offset, int count);
+    static PassRefPtr<DeleteFromTextNodeCommand> create(PassRefPtr<Text> node, int offset, int count)
+    {
+        return adoptRef(new DeleteFromTextNodeCommand(node, offset, count));
+    }
+
+private:
+    DeleteFromTextNodeCommand(PassRefPtr<Text>, int offset, int count);
 
     virtual void doApply();
     virtual void doUnapply();
 
-    Text* node() const { return m_node.get(); }
-    int offset() const { return m_offset; }
-    int count() const { return m_count; }
-
-private:
     RefPtr<Text> m_node;
     int m_offset;
     int m_count;
index 7904ffa..ca1327d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,13 +32,22 @@ namespace WebCore {
 
 class DeleteSelectionCommand : public CompositeEditCommand { 
 public:
-    DeleteSelectionCommand(Document*, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false);
-    DeleteSelectionCommand(const Selection&, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false);
+    static PassRefPtr<DeleteSelectionCommand> create(Document* document, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false)
+    {
+        return adoptRef(new DeleteSelectionCommand(document, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
+    }
+    static PassRefPtr<DeleteSelectionCommand> create(const Selection& selection, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false)
+    {
+        return adoptRef(new DeleteSelectionCommand(selection, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
+    }
+
+private:
+    DeleteSelectionCommand(Document*, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements);
+    DeleteSelectionCommand(const Selection&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements);
 
     virtual void doApply();
     virtual EditAction editingAction() const;
     
-private:
     virtual bool preservesTypingStyle() const;
 
     void initializeStartEnd(Position&, Position&);
index a7c7ed0..7a5d752 100644 (file)
@@ -44,8 +44,7 @@ namespace WebCore {
 using namespace EventNames;
 
 EditCommand::EditCommand(Document* document) 
-    : RefCounted<EditCommand>(0)
-    , m_document(document)
+    : m_document(document)
     , m_parent(0)
 {
     ASSERT(m_document);
index 8f4401c..18a7266 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -37,7 +37,6 @@ class CSSMutableStyleDeclaration;
 
 class EditCommand : public RefCounted<EditCommand> {
 public:
-    EditCommand(Document*);
     virtual ~EditCommand();
 
     void setParent(CompositeEditCommand*);
@@ -61,6 +60,8 @@ public:
     virtual bool isTypingCommand() const;
 
 protected:
+    EditCommand(Document*);
+
     Document* document() const { return m_document.get(); }
 
     void setStartingSelection(const Selection&);
@@ -87,6 +88,11 @@ private:
     friend void applyCommand(PassRefPtr<EditCommand>);
 };
 
+class SimpleEditCommand : public EditCommand {
+protected:
+    SimpleEditCommand(Document* document) : EditCommand(document) { }
+};
+
 void applyCommand(PassRefPtr<EditCommand>);
 
 } // namespace WebCore
index 66d3cda..e27bbb3 100644 (file)
@@ -276,7 +276,7 @@ void Editor::deleteSelectionWithSmartDelete(bool smartDelete)
     if (m_frame->selectionController()->isNone())
         return;
     
-    applyCommand(new DeleteSelectionCommand(m_frame->document(), smartDelete));
+    applyCommand(DeleteSelectionCommand::create(m_frame->document(), smartDelete));
 }
 
 void Editor::pasteAsPlainTextWithPasteboard(Pasteboard* pasteboard)
@@ -317,7 +317,7 @@ void Editor::replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment,
     if (m_frame->selectionController()->isNone() || !fragment)
         return;
     
-    applyCommand(new ReplaceSelectionCommand(m_frame->document(), fragment, selectReplacement, smartReplace, matchStyle));
+    applyCommand(ReplaceSelectionCommand::create(m_frame->document(), fragment, selectReplacement, smartReplace, matchStyle));
     revealSelectionAfterEditingOperation();
 }
 
@@ -560,12 +560,12 @@ void Editor::decreaseSelectionListLevel()
 
 void Editor::removeFormattingAndStyle()
 {
-    applyCommand(new RemoveFormatCommand(m_frame->document()));
+    applyCommand(RemoveFormatCommand::create(m_frame->document()));
 }
 
-void Editor::setLastEditCommand(PassRefPtr<EditCommand> lastEditCommand
+void Editor::clearLastEditCommand(
 {
-    m_lastEditCommand = lastEditCommand;
+    m_lastEditCommand.clear();
 }
 
 // Returns whether caller should continue with "the default processing", which is the same as 
@@ -582,7 +582,7 @@ bool Editor::dispatchCPPEvent(const AtomicString &eventType, ClipboardAccessPoli
     RefPtr<Clipboard> clipboard = newGeneralClipboard(policy);
 
     ExceptionCode ec = 0;
-    RefPtr<Event> evt = new ClipboardEvent(eventType, true, true, clipboard.get());
+    RefPtr<Event> evt = ClipboardEvent::create(eventType, true, true, clipboard);
     EventTargetNodeCast(target)->dispatchEvent(evt, ec, true);
     bool noDefaultProcessing = evt->defaultPrevented();
 
@@ -603,7 +603,7 @@ void Editor::applyStyle(CSSStyleDeclaration* style, EditAction editingAction)
             break;
         case Selection::RANGE:
             if (m_frame->document() && style)
-                applyCommand(new ApplyStyleCommand(m_frame->document(), style, editingAction));
+                applyCommand(ApplyStyleCommand::create(m_frame->document(), style, editingAction));
             break;
     }
 }
@@ -622,7 +622,7 @@ void Editor::applyParagraphStyle(CSSStyleDeclaration* style, EditAction editingA
         case Selection::CARET:
         case Selection::RANGE:
             if (m_frame->document() && style)
-                applyCommand(new ApplyStyleCommand(m_frame->document(), style, editingAction, ApplyStyleCommand::ForceBlockProperties));
+                applyCommand(ApplyStyleCommand::create(m_frame->document(), style, editingAction, ApplyStyleCommand::ForceBlockProperties));
             break;
     }
 }
@@ -731,12 +731,12 @@ TriState Editor::selectionHasStyle(CSSStyleDeclaration* style) const
 }
 void Editor::indent()
 {
-    applyCommand(new IndentOutdentCommand(m_frame->document(), IndentOutdentCommand::Indent));
+    applyCommand(IndentOutdentCommand::create(m_frame->document(), IndentOutdentCommand::Indent));
 }
 
 void Editor::outdent()
 {
-    applyCommand(new IndentOutdentCommand(m_frame->document(), IndentOutdentCommand::Outdent));
+    applyCommand(IndentOutdentCommand::create(m_frame->document(), IndentOutdentCommand::Outdent));
 }
 
 static void dispatchEditableContentChangedEvents(const EditCommand& command)
@@ -745,9 +745,9 @@ static void dispatchEditableContentChangedEvents(const EditCommand& command)
     Element* endRoot = command.endingRootEditableElement();
     ExceptionCode ec;
     if (startRoot)
-        startRoot->dispatchEvent(new Event(webkitEditableContentChangedEvent, false, false), ec, true);
+        startRoot->dispatchEvent(Event::create(webkitEditableContentChangedEvent, false, false), ec, true);
     if (endRoot && endRoot != startRoot)
-        endRoot->dispatchEvent(new Event(webkitEditableContentChangedEvent, false, false), ec, true);
+        endRoot->dispatchEvent(Event::create(webkitEditableContentChangedEvent, false, false), ec, true);
 }
 
 void Editor::appliedEditing(PassRefPtr<EditCommand> cmd)
index 776ed50..fe731c1 100644 (file)
@@ -128,9 +128,7 @@ public:
    
     void removeFormattingAndStyle();
 
-    // FIXME: Once the Editor implements all editing commands, it should track 
-    // the lastEditCommand on its own, and we should remove this function.
-    void setLastEditCommand(PassRefPtr<EditCommand> lastEditCommand);
+    void clearLastEditCommand();
 
     bool deleteWithDirection(SelectionController::EDirection, TextGranularity, bool killRing, bool isTypingAction);
     void deleteSelectionWithSmartDelete(bool smartDelete);
index cd0d6fa..78bbd64 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
  * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
@@ -165,7 +165,7 @@ static bool executeApplyParagraphStyle(Frame* frame, EditorCommandSource source,
 
 static bool executeInsertFragment(Frame* frame, PassRefPtr<DocumentFragment> fragment)
 {
-    applyCommand(new ReplaceSelectionCommand(frame->document(), fragment,
+    applyCommand(ReplaceSelectionCommand::create(frame->document(), fragment,
         false, false, false, true, false, EditActionUnspecified));
     return true;
 }
@@ -256,7 +256,7 @@ static bool executeCreateLink(Frame* frame, Event*, EditorCommandSource, const S
     // FIXME: If userInterface is true, we should display a dialog box to let the user enter a URL.
     if (value.isEmpty())
         return false;
-    applyCommand(new CreateLinkCommand(frame->document(), value));
+    applyCommand(CreateLinkCommand::create(frame->document(), value));
     return true;
 }
 
@@ -393,7 +393,7 @@ static bool executeFormatBlock(Frame* frame, Event*, EditorCommandSource, const
         tagName = tagName.substring(1, tagName.length() - 2);
     if (!validBlockTag(tagName))
         return false;
-    applyCommand(new FormatBlockCommand(frame->document(), tagName));
+    applyCommand(FormatBlockCommand::create(frame->document(), tagName));
     return true;
 }
 
@@ -417,7 +417,7 @@ static bool executeForwardDelete(Frame* frame, Event*, EditorCommandSource sourc
 
 static bool executeIndent(Frame* frame, Event*, EditorCommandSource, const String&)
 {
-    applyCommand(new IndentOutdentCommand(frame->document(), IndentOutdentCommand::Indent));
+    applyCommand(IndentOutdentCommand::create(frame->document(), IndentOutdentCommand::Indent));
     return true;
 }
 
@@ -478,7 +478,7 @@ static bool executeInsertNewlineInQuotedContent(Frame* frame, Event*, EditorComm
 
 static bool executeInsertOrderedList(Frame* frame, Event*, EditorCommandSource, const String& value)
 {
-    applyCommand(new InsertListCommand(frame->document(), InsertListCommand::OrderedList, value));
+    applyCommand(InsertListCommand::create(frame->document(), InsertListCommand::OrderedList, value));
     return true;
 }
 
@@ -501,7 +501,7 @@ static bool executeInsertText(Frame* frame, Event*, EditorCommandSource, const S
 
 static bool executeInsertUnorderedList(Frame* frame, Event*, EditorCommandSource, const String& value)
 {
-    applyCommand(new InsertListCommand(frame->document(), InsertListCommand::UnorderedList, value));
+    applyCommand(InsertListCommand::create(frame->document(), InsertListCommand::UnorderedList, value));
     return true;
 }
 
@@ -787,7 +787,7 @@ static bool executeMoveWordRightAndModifySelection(Frame* frame, Event*, EditorC
 
 static bool executeOutdent(Frame* frame, Event*, EditorCommandSource, const String&)
 {
-    applyCommand(new IndentOutdentCommand(frame->document(), IndentOutdentCommand::Outdent));
+    applyCommand(IndentOutdentCommand::create(frame->document(), IndentOutdentCommand::Outdent));
     return true;
 }
 
@@ -926,7 +926,7 @@ static bool executeUndo(Frame* frame, Event*, EditorCommandSource, const String&
 
 static bool executeUnlink(Frame* frame, Event*, EditorCommandSource, const String&)
 {
-    applyCommand(new UnlinkCommand(frame->document()));
+    applyCommand(UnlinkCommand::create(frame->document()));
     return true;
 }
 
index a11d882..0e84bc1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 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
@@ -32,10 +32,17 @@ namespace WebCore {
 
 class FormatBlockCommand : public CompositeEditCommand {
 public:
+    static PassRefPtr<FormatBlockCommand> create(Document* document, const String& tagName)
+    {
+        return adoptRef(new FormatBlockCommand(document, tagName));
+    }
+
+private:
     FormatBlockCommand(Document*, const String& tagName);
+
     virtual void doApply();
     virtual EditAction editingAction() const { return EditActionFormatBlock; }
-private:
+
     bool modifyRange();
     String m_tagName;
 };
index fdc3389..385f1b7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 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
@@ -166,8 +166,8 @@ void IndentOutdentCommand::indentRegion()
             
             Node* enclosingCell = enclosingNodeOfType(start, &isTableCell);
             Node* nodeToSplitTo = enclosingCell ? enclosingCell : editableRootForPosition(start);
-            Node* startOfNewBlock = splitTreeToNode(start.node(), nodeToSplitTo);
-            insertNodeBefore(blockquote.get(), startOfNewBlock);
+            RefPtr<Node> startOfNewBlock = splitTreeToNode(start.node(), nodeToSplitTo);
+            insertNodeBefore(blockquote.get(), startOfNewBlock.get());
             newBlockquote = blockquote.get();
             insertionPoint = prepareBlockquoteLevelForInsertion(endOfCurrentParagraph, &newBlockquote);
             // Don't put the next paragraph in the blockquote we just created for this paragraph unless 
@@ -202,10 +202,11 @@ void IndentOutdentCommand::outdentParagraph()
 
     // Use InsertListCommand to remove the selection from the list
     if (enclosingNode->hasTagName(olTag)) {
-        applyCommandToComposite(new InsertListCommand(document(), InsertListCommand::OrderedList, ""));
+        applyCommandToComposite(InsertListCommand::create(document(), InsertListCommand::OrderedList, ""));
         return;        
-    } else if (enclosingNode->hasTagName(ulTag)) {
-        applyCommandToComposite(new InsertListCommand(document(), InsertListCommand::UnorderedList, ""));
+    }
+    if (enclosingNode->hasTagName(ulTag)) {
+        applyCommandToComposite(InsertListCommand::create(document(), InsertListCommand::UnorderedList, ""));
         return;
     }
     
@@ -227,11 +228,11 @@ void IndentOutdentCommand::outdentParagraph()
         return;
     }
     Node* enclosingBlockFlow = enclosingBlockFlowElement(visibleStartOfParagraph);
-    Node* splitBlockquoteNode = enclosingNode;
+    RefPtr<Node> splitBlockquoteNode = enclosingNode;
     if (enclosingBlockFlow != enclosingNode)
         splitBlockquoteNode = splitTreeToNode(enclosingBlockFlowElement(visibleStartOfParagraph), enclosingNode, true);
     RefPtr<Node> placeholder = createBreakElement(document());
-    insertNodeBefore(placeholder.get(), splitBlockquoteNode);
+    insertNodeBefore(placeholder.get(), splitBlockquoteNode.get());
     moveParagraph(startOfParagraph(visibleStartOfParagraph), endOfParagraph(visibleEndOfParagraph), VisiblePosition(Position(placeholder.get(), 0)), true);
 }
 
index 584eb78..11879e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 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 {
 
-class IndentOutdentCommand : public CompositeEditCommand
-{
+class IndentOutdentCommand : public CompositeEditCommand {
 public:
     enum EIndentType { Indent, Outdent };
-    IndentOutdentCommand(Document*, EIndentType, int marginInPixels = 0);
+    static PassRefPtr<IndentOutdentCommand> create(Document* document, EIndentType type, int marginInPixels = 0)
+    {
+        return adoptRef(new IndentOutdentCommand(document, type, marginInPixels));
+    }
+
+private:
+    IndentOutdentCommand(Document*, EIndentType, int marginInPixels);
+
     virtual void doApply();
     virtual EditAction editingAction() const { return m_typeOfAction == Indent ? EditActionIndent : EditActionOutdent; }
-private:
-    EIndentType m_typeOfAction;
-    int m_marginInPixels;
+
     void indentRegion();
     void outdentRegion();
     void outdentParagraph();
     Node* prepareBlockquoteLevelForInsertion(VisiblePosition&, Node**);
+
+    EIndentType m_typeOfAction;
+    int m_marginInPixels;
 };
 
 } // namespace WebCore
index dc2fbbf..9d5ea6e 100644 (file)
 
 namespace WebCore {
 
-InsertIntoTextNodeCommand::InsertIntoTextNodeCommand(Text* node, int offset, const String& text)
-    : EditCommand(node->document())
+InsertIntoTextNodeCommand::InsertIntoTextNodeCommand(PassRefPtr<Text> node, int offset, const String& text)
+    : SimpleEditCommand(node->document())
     , m_node(node)
     , m_offset(offset)
     , m_text(text)
 {
-    ASSERT(node);
+    ASSERT(m_node);
     ASSERT(offset >= 0);
     ASSERT(!text.isEmpty());
 }
index 8358e8d..aed5da8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,18 +32,19 @@ namespace WebCore {
 
 class Text;
 
-class InsertIntoTextNodeCommand : public EditCommand {
+class InsertIntoTextNodeCommand : public SimpleEditCommand {
 public:
-    InsertIntoTextNodeCommand(Text* node, int offset, const String& text);
+    static PassRefPtr<InsertIntoTextNodeCommand> create(PassRefPtr<Text> node, int offset, const String& text)
+    {
+        return adoptRef(new InsertIntoTextNodeCommand(node, offset, text));
+    }
+
+private:
+    InsertIntoTextNodeCommand(PassRefPtr<Text> node, int offset, const String& text);
 
     virtual void doApply();
     virtual void doUnapply();
 
-    Text* node() const { return m_node.get(); }
-    int offset() const { return m_offset; }
-    String text() const { return m_text; }
-
-private:
     RefPtr<Text> m_node;
     int m_offset;
     String m_text;
index 1f5cdc8..9e73add 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,12 +32,18 @@ namespace WebCore {
 
 class InsertLineBreakCommand : public CompositeEditCommand {
 public:
+    static PassRefPtr<InsertLineBreakCommand> create(Document* document)
+    {
+        return adoptRef(new InsertLineBreakCommand(document));
+    }
+
+private:
     InsertLineBreakCommand(Document*);
 
     virtual void doApply();
 
-private:
     virtual bool preservesTypingStyle() const;
+
     void insertNodeAfterPosition(Node*, const Position&);
     void insertNodeBeforePosition(Node*, const Position&);
     bool shouldUseBreakElement(const Position&);
index d1e2be2..7433516 100644 (file)
@@ -184,7 +184,7 @@ void InsertListCommand::doApply()
             // FIXME: We appear to split at nextListChild as opposed to listChildNode so that when we remove
             // listChildNode below in moveParagraphs, previousListChild will be removed along with it if it is 
             // unrendered. But we ought to remove nextListChild too, if it is unrendered.
-            splitElement(static_cast<Element *>(listNode), splitTreeToNode(nextListChild, listNode));
+            splitElement(static_cast<Element*>(listNode), splitTreeToNode(nextListChild, listNode).get());
             insertNodeBefore(nodeToInsert.get(), listNode);
         } else if (nextListChild || listChildNode->parentNode() != listNode) {
             // Just because listChildNode has no previousListChild doesn't mean there isn't any content
@@ -192,7 +192,7 @@ void InsertListCommand::doApply()
             // between it and listNode. So, we split up to listNode before inserting the placeholder
             // where we're about to move listChildNode to.
             if (listChildNode->parentNode() != listNode)
-                splitElement(static_cast<Element *>(listNode), splitTreeToNode(listChildNode, listNode));
+                splitElement(static_cast<Element *>(listNode), splitTreeToNode(listChildNode, listNode).get());
             insertNodeBefore(nodeToInsert.get(), listNode);
         } else
             insertNodeAfter(nodeToInsert.get(), listNode);
@@ -238,8 +238,8 @@ void InsertListCommand::doApply()
                 // Inserting the list into an empty paragraph that isn't held open 
                 // by a br or a '\n', will invalidate start and end.  Insert 
                 // a placeholder and then recompute start and end.
-                Node* placeholder = insertBlockPlaceholder(start.deepEquivalent());
-                start = VisiblePosition(Position(placeholder, 0));
+                RefPtr<Node> placeholder = insertBlockPlaceholder(start.deepEquivalent());
+                start = VisiblePosition(Position(placeholder.get(), 0));
                 end = start;
             }
             
index 8846248..f276de3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 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
@@ -33,11 +33,20 @@ namespace WebCore {
 class InsertListCommand : public CompositeEditCommand {
 public:
     enum Type { OrderedList, UnorderedList };
+
+    static PassRefPtr<InsertListCommand> create(Document* document, Type listType, const String& listID)
+    {
+        return adoptRef(new InsertListCommand(document, listType, listID));
+    }
+
     static PassRefPtr<Node> insertList(Document*, Type);
+
+private:
     InsertListCommand(Document*, Type, const String&);
+
     virtual void doApply();
     virtual EditAction editingAction() const { return EditActionInsertList; }
-private:
+
     Node* fixOrphanedListChild(Node*);
     bool modifyRange();
     RefPtr<Node> m_listElement;
index ddc4768..2315597 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 2008 Apple Computer, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  */
 
 #include "config.h"
-#include "htmlediting.h"
 #include "InsertNodeBeforeCommand.h"
 
+#include "htmlediting.h"
+
 namespace WebCore {
 
-InsertNodeBeforeCommand::InsertNodeBeforeCommand(PassRefPtr<Node> insertChild, Node* refChild)
-    : EditCommand(refChild->document()), m_insertChild(insertChild), m_refChild(refChild)
+InsertNodeBeforeCommand::InsertNodeBeforeCommand(PassRefPtr<Node> insertChild, PassRefPtr<Node> refChild)
+    : SimpleEditCommand(refChild->document()), m_insertChild(insertChild), m_refChild(refChild)
 {
     ASSERT(m_insertChild);
     ASSERT(m_refChild);
index 0ec5f4f..0904502 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 {
 
-class InsertNodeBeforeCommand : public EditCommand {
+class InsertNodeBeforeCommand : public SimpleEditCommand {
 public:
-    InsertNodeBeforeCommand(PassRefPtr<Node>, Node* refChild);
+    static PassRefPtr<InsertNodeBeforeCommand> create(PassRefPtr<Node> childToInsert, PassRefPtr<Node> childToInsertBefore)
+    {
+        return adoptRef(new InsertNodeBeforeCommand(childToInsert, childToInsertBefore));
+    }
+
+private:
+    InsertNodeBeforeCommand(PassRefPtr<Node> childToInsert, PassRefPtr<Node> childToInsertBefore);
 
     virtual void doApply();
     virtual void doUnapply();
 
-    Node* insertChild() const { return m_insertChild.get(); }
-    Node* refChild() const { return m_refChild.get(); }
-
-private:
     RefPtr<Node> m_insertChild;
     RefPtr<Node> m_refChild; 
 };
index ee469d8..f81fad4 100644 (file)
@@ -129,7 +129,7 @@ void InsertParagraphSeparatorCommand::doApply()
         startBlock->hasTagName(formTag) || 
         canonicalPos.node()->renderer() && canonicalPos.node()->renderer()->isTable() ||
         canonicalPos.node()->hasTagName(hrTag)) {
-        applyCommandToComposite(new InsertLineBreakCommand(document()));
+        applyCommandToComposite(InsertLineBreakCommand::create(document()));
         return;
     }
     
index 23d070b..01c08bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,11 +32,16 @@ namespace WebCore {
 
 class InsertParagraphSeparatorCommand : public CompositeEditCommand {
 public:
-    InsertParagraphSeparatorCommand(Document*, bool useDefaultParagraphElement = false);
+    static PassRefPtr<InsertParagraphSeparatorCommand> create(Document* document, bool useDefaultParagraphElement = false)
+    {
+        return adoptRef(new InsertParagraphSeparatorCommand(document, useDefaultParagraphElement));
+    }
+
+private:
+    InsertParagraphSeparatorCommand(Document*, bool useDefaultParagraphElement);
 
     virtual void doApply();
 
-private:
     void calculateStyleBeforeInsertion(const Position&);
     void applyStyleAfterInsertion(Node* originalEnclosingBlock);
     
index 43d4ec7..650ca65 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,16 +32,20 @@ namespace WebCore {
 
 class InsertTextCommand : public CompositeEditCommand {
 public:
-    InsertTextCommand(Document*);
-
-    virtual void doApply();
+    static PassRefPtr<InsertTextCommand> create(Document* document)
+    {
+        return adoptRef(new InsertTextCommand(document));
+    }
 
-    void deleteCharacter();
     void input(const String& text, bool selectInsertedText = false);
 
+private:
+    InsertTextCommand(Document*);
+
+    void deleteCharacter();
     unsigned charactersAdded() const { return m_charactersAdded; }
     
-private:
+    virtual void doApply();
     virtual bool isInsertTextCommand() const;
 
     Position prepareForTextInsertion(const Position&);
index 9d51043..dddf43c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -30,8 +30,8 @@
 
 namespace WebCore {
 
-JoinTextNodesCommand::JoinTextNodesCommand(Text *text1, Text *text2)
-    : EditCommand(text1->document()), m_text1(text1), m_text2(text2)
+JoinTextNodesCommand::JoinTextNodesCommand(PassRefPtr<Text> text1, PassRefPtr<Text> text2)
+    : SimpleEditCommand(text1->document()), m_text1(text1), m_text2(text2)
 {
     ASSERT(m_text1);
     ASSERT(m_text2);
index a65cb4f..6fb5c56 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,18 +32,19 @@ namespace WebCore {
 
 class Text;
 
-class JoinTextNodesCommand : public EditCommand
-{
+class JoinTextNodesCommand : public SimpleEditCommand {
 public:
-    JoinTextNodesCommand(Text*, Text*);
+    static PassRefPtr<JoinTextNodesCommand> create(PassRefPtr<Text> text1, PassRefPtr<Text> text2)
+    {
+        return adoptRef(new JoinTextNodesCommand(text1, text2));
+    }
+
+private:
+    JoinTextNodesCommand(PassRefPtr<Text>, PassRefPtr<Text>);
 
     virtual void doApply();
     virtual void doUnapply();
 
-    Text* firstNode() const { return m_text1.get(); }
-    Text* secondNode() const { return m_text2.get(); }
-
-private:
     RefPtr<Text> m_text1;
     RefPtr<Text> m_text2;
     unsigned m_offset;
index 0b9b019..1819b92 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -30,8 +30,8 @@
 
 namespace WebCore {
 
-MergeIdenticalElementsCommand::MergeIdenticalElementsCommand(Element* first, Element* second)
-    : EditCommand(first->document()), m_element1(first), m_element2(second)
+MergeIdenticalElementsCommand::MergeIdenticalElementsCommand(PassRefPtr<Element> first, PassRefPtr<Element> second)
+    : SimpleEditCommand(first->document()), m_element1(first), m_element2(second)
 {
     ASSERT(m_element1);
     ASSERT(m_element2);
index 4d0e50d..1ce6302 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 {
 
-class MergeIdenticalElementsCommand : public EditCommand {
+class MergeIdenticalElementsCommand : public SimpleEditCommand {
 public:
-    MergeIdenticalElementsCommand(Element*, Element*);
+    static PassRefPtr<MergeIdenticalElementsCommand> create(PassRefPtr<Element> element1, PassRefPtr<Element> element2)
+    {
+        return adoptRef(new MergeIdenticalElementsCommand(element1, element2));
+    }
+
+private:
+    MergeIdenticalElementsCommand(PassRefPtr<Element>, PassRefPtr<Element>);
 
     virtual void doApply();
     virtual void doUnapply();
 
-private:
     RefPtr<Element> m_element1;
     RefPtr<Element> m_element2;
     RefPtr<Node> m_atChild;
index 674afeb..da4ef8b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 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
@@ -213,7 +213,7 @@ PassRefPtr<Node> IncreaseSelectionListLevelCommand::increaseSelectionListLevelWi
     ASSERT(document->frame());
     RefPtr<IncreaseSelectionListLevelCommand> modCommand = new IncreaseSelectionListLevelCommand(document, listType);
     modCommand->apply();
-    return modCommand->m_listElement.get();
+    return modCommand->m_listElement;
 }
 
 PassRefPtr<Node> IncreaseSelectionListLevelCommand::increaseSelectionListLevel(Document* document)
index b2637a7..08587cb 100644 (file)
@@ -37,10 +37,6 @@ MoveSelectionCommand::MoveSelectionCommand(PassRefPtr<DocumentFragment> fragment
     ASSERT(m_fragment);
 }
 
-MoveSelectionCommand::~MoveSelectionCommand()
-{
-}
-
 void MoveSelectionCommand::doApply()
 {
     Selection selection = endingSelection();
@@ -74,7 +70,7 @@ void MoveSelectionCommand::doApply()
         pos = endingSelection().start();
 
     setEndingSelection(Selection(pos, endingSelection().affinity()));
-    applyCommandToComposite(new ReplaceSelectionCommand(positionNode->document(), m_fragment.get(), true, m_smartMove));
+    applyCommandToComposite(ReplaceSelectionCommand::create(positionNode->document(), m_fragment, true, m_smartMove));
 }
 
 EditAction MoveSelectionCommand::editingAction() const
index d521335..253c02c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -34,13 +34,17 @@ class DocumentFragment;
 
 class MoveSelectionCommand : public CompositeEditCommand {
 public:
-    MoveSelectionCommand(PassRefPtr<DocumentFragment>, const Position&, bool smartMove = false);
-    virtual ~MoveSelectionCommand();
-    
+    static PassRefPtr<MoveSelectionCommand> create(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smartMove = false)
+    {
+        return adoptRef(new MoveSelectionCommand(fragment, position, smartMove));
+    }
+
+private:
+    MoveSelectionCommand(PassRefPtr<DocumentFragment>, const Position&, bool smartMove);
+
     virtual void doApply();
     virtual EditAction editingAction() const;
     
-private:
     RefPtr<DocumentFragment> m_fragment;
     Position m_position;
     bool m_smartMove;
@@ -48,4 +52,4 @@ private:
 
 } // namespace WebCore
 
-#endif // __MoveSelectionCommand_h
+#endif // MoveSelectionCommand_h
index b51ebf3..d4afed0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,7 +32,7 @@
 namespace WebCore {
 
 RemoveCSSPropertyCommand::RemoveCSSPropertyCommand(Document* document, CSSStyleDeclaration* decl, int property)
-    : EditCommand(document)
+    : SimpleEditCommand(document)
     , m_decl(decl->makeMutable())
     , m_property(property)
     , m_important(false)
@@ -40,10 +40,6 @@ RemoveCSSPropertyCommand::RemoveCSSPropertyCommand(Document* document, CSSStyleD
     ASSERT(m_decl);
 }
 
-RemoveCSSPropertyCommand::~RemoveCSSPropertyCommand()
-{
-}
-
 void RemoveCSSPropertyCommand::doApply()
 {
     ASSERT(m_decl);
index 6c97140..8a96b4b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,18 +32,19 @@ namespace WebCore {
 
 class CSSStyleDeclaration;
 
-class RemoveCSSPropertyCommand : public EditCommand {
+class RemoveCSSPropertyCommand : public SimpleEditCommand {
 public:
+    static PassRefPtr<RemoveCSSPropertyCommand> create(Document* document, CSSStyleDeclaration* style, int property)
+    {
+        return adoptRef(new RemoveCSSPropertyCommand(document, style, property));
+    }
+
+private:
     RemoveCSSPropertyCommand(Document*, CSSStyleDeclaration*, int property);
-    virtual ~RemoveCSSPropertyCommand();
 
     virtual void doApply();
     virtual void doUnapply();
 
-    CSSMutableStyleDeclaration* styleDeclaration() const { return m_decl.get(); }
-    int property() const { return m_property; }
-    
-private:
     RefPtr<CSSMutableStyleDeclaration> m_decl;
     int m_property;
     String m_oldValue;
@@ -52,4 +53,4 @@ private:
 
 } // namespace WebCore
 
-#endif // __remove_css_property_command_h__
+#endif // RemoveCSSPropertyCommand_h
index a6df271..daca2db 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Computer, 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
@@ -32,7 +32,14 @@ namespace WebCore {
 
 class RemoveFormatCommand : public CompositeEditCommand {
 public:
+    static PassRefPtr<RemoveFormatCommand> create(Document* document)
+    {
+        return adoptRef(new RemoveFormatCommand(document));
+    }
+
+private:
     RemoveFormatCommand(Document*);
+
     virtual void doApply();
     virtual EditAction editingAction() const { return EditActionUnspecified; }
 };
index ab3d4bd..bcf1fdf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 "config.h"
 #include "RemoveNodeAttributeCommand.h"
-#include "Element.h"
 
+#include "Element.h"
 #include <wtf/Assertions.h>
 
 namespace WebCore {
 
-RemoveNodeAttributeCommand::RemoveNodeAttributeCommand(Element* element, const QualifiedName& attribute)
-    : EditCommand(element->document()), m_element(element), m_attribute(attribute)
+RemoveNodeAttributeCommand::RemoveNodeAttributeCommand(PassRefPtr<Element> element, const QualifiedName& attribute)
+    : SimpleEditCommand(element->document()), m_element(element), m_attribute(attribute)
 {
     ASSERT(m_element);
 }
index 4d1c7a6..fd9127e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 {
 
-class RemoveNodeAttributeCommand : public EditCommand {
+class RemoveNodeAttributeCommand : public SimpleEditCommand {
 public:
-    RemoveNodeAttributeCommand(Element*, const QualifiedName& attribute);
+    static PassRefPtr<RemoveNodeAttributeCommand> create(PassRefPtr<Element> element, const QualifiedName& attribute)
+    {
+        return adoptRef(new RemoveNodeAttributeCommand(element, attribute));
+    }
+    
+private:
+    RemoveNodeAttributeCommand(PassRefPtr<Element>, const QualifiedName& attribute);
 
     virtual void doApply();
     virtual void doUnapply();
 
-    Element* element() const { return m_element.get(); }
-    const QualifiedName& attribute() const { return m_attribute; }
-    
-private:
     RefPtr<Element> m_element;
     QualifiedName m_attribute;
-    String m_oldValue;
+    AtomicString m_oldValue;
 };
 
 } // namespace WebCore
index 6daedd5..2519730 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -31,8 +31,8 @@
 
 namespace WebCore {
 
-RemoveNodeCommand::RemoveNodeCommand(Node* removeChild)
-    : EditCommand(removeChild->document())
+RemoveNodeCommand::RemoveNodeCommand(PassRefPtr<Node> removeChild)
+    : SimpleEditCommand(removeChild->document())
     , m_removeChild(removeChild)
     , m_parent(m_removeChild->parentNode())
     , m_refChild(m_removeChild->nextSibling())
index 0ef0546..802cb8b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 {
 
-class RemoveNodeCommand : public EditCommand {
+class RemoveNodeCommand : public SimpleEditCommand {
 public:
-    RemoveNodeCommand(Node*);
+    static PassRefPtr<RemoveNodeCommand> create(PassRefPtr<Node> node)
+    {
+        return adoptRef(new RemoveNodeCommand(node));
+    }
+
+private:
+    RemoveNodeCommand(PassRefPtr<Node>);
 
     virtual void doApply();
     virtual void doUnapply();
 
-    Node* node() const { return m_removeChild.get(); }
-
-private:
     RefPtr<Node> m_removeChild;
     RefPtr<Node> m_parent;
     RefPtr<Node> m_refChild;    
index 6695a01..f583865 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -31,7 +31,7 @@
 
 namespace WebCore {
 
-RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand(Node* node)
+RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand(PassRefPtr<Node> node)
     : CompositeEditCommand(node->document()), m_node(node)
 {
     ASSERT(m_node);
@@ -39,11 +39,11 @@ RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand(Node* n
 
 void RemoveNodePreservingChildrenCommand::doApply()
 {
-    while (Node* curr = node()->firstChild()) {
+    while (Node* curr = m_node->firstChild()) {
         removeNode(curr);
-        insertNodeBefore(curr, node());
+        insertNodeBefore(curr, m_node.get());
     }
-    removeNode(node());
+    removeNode(m_node.get());
 }
 
 }
index 4282141..d2b635f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,13 +32,16 @@ namespace WebCore {
 
 class RemoveNodePreservingChildrenCommand : public CompositeEditCommand {
 public:
-    RemoveNodePreservingChildrenCommand(Node*);
+    static PassRefPtr<RemoveNodePreservingChildrenCommand> create(PassRefPtr<Node> node)
+    {
+        return adoptRef(new RemoveNodePreservingChildrenCommand(node));
+    }
 
-    virtual void doApply();
+private:
+    RemoveNodePreservingChildrenCommand(PassRefPtr<Node>);
 
-    Node* node() const { return m_node.get(); }
+    virtual void doApply();
 
-private:
     RefPtr<Node> m_node;
 };
 
index 73aa8f0..190968e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -54,6 +54,40 @@ namespace WebCore {
 using namespace EventNames;
 using namespace HTMLNames;
 
+enum EFragmentType { EmptyFragment, SingleTextNodeFragment, TreeFragment };
+
+// --- ReplacementFragment helper class
+
+class ReplacementFragment : Noncopyable {
+public:
+    ReplacementFragment(Document*, DocumentFragment*, bool matchStyle, const Selection&);
+
+    Node* firstChild() const;
+    Node* lastChild() const;
+
+    bool isEmpty() const;
+    
+    bool hasInterchangeNewlineAtStart() const { return m_hasInterchangeNewlineAtStart; }
+    bool hasInterchangeNewlineAtEnd() const { return m_hasInterchangeNewlineAtEnd; }
+    
+    void removeNode(PassRefPtr<Node>);
+    void removeNodePreservingChildren(Node*);
+
+private:
+    PassRefPtr<Node> insertFragmentForTestRendering(Node* context);
+    void removeUnrenderedNodes(Node*);
+    void restoreTestRenderingNodesToFragment(Node*);
+    void removeInterchangeNodes(Node*);
+    
+    void insertNodeBefore(Node* node, Node* refNode);
+
+    RefPtr<Document> m_document;
+    RefPtr<DocumentFragment> m_fragment;
+    bool m_matchStyle;
+    bool m_hasInterchangeNewlineAtStart;
+    bool m_hasInterchangeNewlineAtEnd;
+};
+
 static bool isInterchangeNewlineNode(const Node *node)
 {
     static String interchangeNewlineClassString(AppleInterchangeNewline);
@@ -104,7 +138,7 @@ ReplacementFragment::ReplacementFragment(Document* document, DocumentFragment* f
     RefPtr<Range> range = Selection::selectionFromContentsOfNode(holder.get()).toRange();
     String text = plainText(range.get());
     // Give the root a chance to change the text.
-    RefPtr<BeforeTextInsertedEvent> evt = new BeforeTextInsertedEvent(text);
+    RefPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::create(text);
     ExceptionCode ec = 0;
     editableRoot->dispatchEvent(evt, ec, true);
     ASSERT(ec == 0);
index d900c71..dc669a3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,50 +32,22 @@ namespace WebCore {
 
 class DocumentFragment;
 
-enum EFragmentType { EmptyFragment, SingleTextNodeFragment, TreeFragment };
-
-// --- ReplacementFragment helper class
-
-class ReplacementFragment : Noncopyable {
+class ReplaceSelectionCommand : public CompositeEditCommand {
 public:
-    ReplacementFragment(Document*, DocumentFragment*, bool matchStyle, const Selection&);
-
-    Node* firstChild() const;
-    Node* lastChild() const;
-
-    bool isEmpty() const;
-    
-    bool hasInterchangeNewlineAtStart() const { return m_hasInterchangeNewlineAtStart; }
-    bool hasInterchangeNewlineAtEnd() const { return m_hasInterchangeNewlineAtEnd; }
-    
-    void removeNode(PassRefPtr<Node>);
-    void removeNodePreservingChildren(Node*);
+    static PassRefPtr<ReplaceSelectionCommand> create(Document* document, PassRefPtr<DocumentFragment> fragment,
+        bool selectReplacement = true, bool smartReplace = false, bool matchStyle = false, bool preventNesting = true, bool movingParagraph = false,
+        EditAction action = EditActionPaste)
+    {
+        return adoptRef(new ReplaceSelectionCommand(document, fragment, selectReplacement, smartReplace, matchStyle, preventNesting, movingParagraph, action));
+    }
 
 private:
-    PassRefPtr<Node> insertFragmentForTestRendering(Node* context);
-    void removeUnrenderedNodes(Node*);
-    void restoreTestRenderingNodesToFragment(Node*);
-    void removeInterchangeNodes(Node*);
-    
-    void insertNodeBefore(Node* node, Node* refNode);
-
-    RefPtr<Document> m_document;
-    RefPtr<DocumentFragment> m_fragment;
-    bool m_matchStyle;
-    bool m_hasInterchangeNewlineAtStart;
-    bool m_hasInterchangeNewlineAtEnd;
-};
-
-class ReplaceSelectionCommand : public CompositeEditCommand {
-public:
     ReplaceSelectionCommand(Document*, PassRefPtr<DocumentFragment>,
-        bool selectReplacement = true, bool smartReplace = false, bool matchStyle = false, bool preventNesting = true, bool movingParagraph = false,
-        EditAction = EditActionPaste);
-    
+        bool selectReplacement, bool smartReplace, bool matchStyle, bool preventNesting, bool movingParagraph, EditAction);
+
     virtual void doApply();
     virtual EditAction editingAction() const;
 
-private:
     void completeHTMLReplacement(const Position& lastPositionToSelect);
 
     void insertNodeAfterAndUpdateNodesInserted(Node* insertChild, Node* refChild);
index faa8e5d..995dd1e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 "config.h"
 #include "SetNodeAttributeCommand.h"
-#include "Element.h"
 
+#include "Element.h"
 #include <wtf/Assertions.h>
 
 namespace WebCore {
 
-SetNodeAttributeCommand::SetNodeAttributeCommand(Element* element, 
-                                                 const QualifiedName& attribute, const String &value)
-    : EditCommand(element->document()), m_element(element), m_attribute(attribute), m_value(value)
+SetNodeAttributeCommand::SetNodeAttributeCommand(PassRefPtr<Element> element, 
+        const QualifiedName& attribute, const String &value)
+    : SimpleEditCommand(element->document()), m_element(element), m_attribute(attribute), m_value(value)
 {
     ASSERT(m_element);
     ASSERT(!m_value.isNull());
index b494f33..aec79a3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 {
 
-class SetNodeAttributeCommand : public EditCommand {
+class SetNodeAttributeCommand : public SimpleEditCommand {
 public:
-    SetNodeAttributeCommand(Element*, const QualifiedName& attribute, const String &value);
+    static PassRefPtr<SetNodeAttributeCommand> create(PassRefPtr<Element> element, const QualifiedName& attribute, const AtomicString& value)
+    {
+        return adoptRef(new SetNodeAttributeCommand(element, attribute, value));
+    }
+
+private:
+    SetNodeAttributeCommand(PassRefPtr<Element>, const QualifiedName& attribute, const String& value);
 
     virtual void doApply();
     virtual void doUnapply();
 
-    Element* element() const { return m_element.get(); }
-    const QualifiedName& attribute() const { return m_attribute; }
-    String value() const { return m_value; }
-    
-private:
     RefPtr<Element> m_element;
     QualifiedName m_attribute;
-    String m_value;
-    String m_oldValue;
+    AtomicString m_value;
+    AtomicString m_oldValue;
 };
 
 } // namespace WebCore
index 9b4241d..b056fee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 "config.h"
 #include "SplitElementCommand.h"
-#include "Element.h"
 
+#include "Element.h"
 #include <wtf/Assertions.h>
 
 namespace WebCore {
 
-SplitElementCommand::SplitElementCommand(Element* element, Node* atChild)
-    : EditCommand(element->document()), m_element2(element), m_atChild(atChild)
+SplitElementCommand::SplitElementCommand(PassRefPtr<Element> element, PassRefPtr<Node> atChild)
+    : SimpleEditCommand(element->document()), m_element2(element), m_atChild(atChild)
 {
     ASSERT(m_element2);
     ASSERT(m_atChild);
index f404882..2732762 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 {
 
-class SplitElementCommand : public EditCommand {
+class SplitElementCommand : public SimpleEditCommand {
 public:
-    SplitElementCommand(Element*, Node* splitPointChild);
+    static PassRefPtr<SplitElementCommand> create(PassRefPtr<Element> element, PassRefPtr<Node> splitPointChild)
+    {
+        return adoptRef(new SplitElementCommand(element, splitPointChild));
+    }
+
+private:
+    SplitElementCommand(PassRefPtr<Element>, PassRefPtr<Node> splitPointChild);
 
     virtual void doApply();
     virtual void doUnapply();
 
-private:
     RefPtr<Element> m_element1;
     RefPtr<Element> m_element2;
     RefPtr<Node> m_atChild;
index 0aef323..be6cd1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 "Document.h"
 #include "Text.h"
-
 #include <wtf/Assertions.h>
 
 namespace WebCore {
 
-SplitTextNodeCommand::SplitTextNodeCommand(Text* text, int offset)
-    : EditCommand(text->document()), m_text2(text), m_offset(offset)
+SplitTextNodeCommand::SplitTextNodeCommand(PassRefPtr<Text> text, int offset)
+    : SimpleEditCommand(text->document()), m_text2(text), m_offset(offset)
 {
     ASSERT(m_text2);
     ASSERT(m_text2->length() > 0);
index 3b3319b..48d444c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
 #define SplitTextNodeCommand_h
 
 #include "EditCommand.h"
-#include "Text.h"
 
 namespace WebCore {
 
-class SplitTextNodeCommand : public EditCommand {
+class Text;
+
+class SplitTextNodeCommand : public SimpleEditCommand {
 public:
-    SplitTextNodeCommand(Text*, int offset);
-    virtual ~SplitTextNodeCommand() { }
+    static PassRefPtr<SplitTextNodeCommand> create(PassRefPtr<Text> node, int offset)
+    {
+        return adoptRef(new SplitTextNodeCommand(node, offset));
+    }
+
+private:
+    SplitTextNodeCommand(PassRefPtr<Text>, int offset);
 
     virtual void doApply();
     virtual void doUnapply();
 
-    Text* node() const { return m_text2.get(); }
-    int offset() const { return m_offset; }
-
-private:
     RefPtr<Text> m_text1;
     RefPtr<Text> m_text2;
     unsigned m_offset;
index eb1b3e1..7038a17 100644 (file)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-SplitTextNodeContainingElementCommand::SplitTextNodeContainingElementCommand(Text* text, int offset)
+SplitTextNodeContainingElementCommand::SplitTextNodeContainingElementCommand(PassRefPtr<Text> text, int offset)
     : CompositeEditCommand(text->document()), m_text(text), m_offset(offset)
 {
     ASSERT(m_text);
index cd19a1f..4e6af4f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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
@@ -32,11 +32,16 @@ namespace WebCore {
 
 class SplitTextNodeContainingElementCommand : public CompositeEditCommand {
 public:
-    SplitTextNodeContainingElementCommand(Text*, int offset);
+    static PassRefPtr<SplitTextNodeContainingElementCommand> create(PassRefPtr<Text> node, int offset)
+    {
+        return adoptRef(new SplitTextNodeContainingElementCommand(node, offset));
+    }
+
+private:
+    SplitTextNodeContainingElementCommand(PassRefPtr<Text>, int offset);
 
     virtual void doApply();
 
-private:
     RefPtr<Text> m_text;
     int m_offset;
 };
index 2c0518e..abea91b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 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
@@ -72,7 +72,7 @@ void TypingCommand::deleteSelection(Document* document, bool smartDelete)
         return;
     }
     
-    RefPtr<TypingCommand> typingCommand = new TypingCommand(document, DeleteSelection, "", false);
+    RefPtr<TypingCommand> typingCommand = TypingCommand::create(document, DeleteSelection, "", false);
     typingCommand->setSmartDelete(smartDelete);
     typingCommand->apply();
 }
@@ -90,7 +90,7 @@ void TypingCommand::deleteKeyPressed(Document *document, bool smartDelete, TextG
         return;
     }
     
-    RefPtr<TypingCommand> typingCommand = new TypingCommand(document, DeleteKey, "", false, granularity);
+    RefPtr<TypingCommand> typingCommand = TypingCommand::create(document, DeleteKey, "", false, granularity);
     typingCommand->setSmartDelete(smartDelete);
     typingCommand->apply();
 }
@@ -109,7 +109,7 @@ void TypingCommand::forwardDeleteKeyPressed(Document *document, bool smartDelete
         return;
     }
 
-    RefPtr<TypingCommand> typingCommand = new TypingCommand(document, ForwardDeleteKey, "", false, granularity);
+    RefPtr<TypingCommand> typingCommand = TypingCommand::create(document, ForwardDeleteKey, "", false, granularity);
     typingCommand->setSmartDelete(smartDelete);
     typingCommand->apply();
 }
@@ -140,7 +140,7 @@ void TypingCommand::insertText(Document* document, const String& text, const Sel
     if (startNode && startNode->rootEditableElement() && !insertedTextIsComposition) {        
         // Send BeforeTextInsertedEvent. The event handler will update text if necessary.
         ExceptionCode ec = 0;
-        RefPtr<BeforeTextInsertedEvent> evt = new BeforeTextInsertedEvent(text);
+        RefPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::create(text);
         startNode->rootEditableElement()->dispatchEvent(evt, ec, true);
         newText = evt->text();
     }
@@ -166,7 +166,7 @@ void TypingCommand::insertText(Document* document, const String& text, const Sel
         return;
     }
 
-    RefPtr<TypingCommand> cmd = new TypingCommand(document, InsertText, newText, selectInsertedText);
+    RefPtr<TypingCommand> cmd = TypingCommand::create(document, InsertText, newText, selectInsertedText);
     if (changeSelection)  {
         cmd->setStartingSelection(selectionForInsertion);
         cmd->setEndingSelection(selectionForInsertion);
@@ -191,7 +191,7 @@ void TypingCommand::insertLineBreak(Document *document)
         return;
     }
 
-    applyCommand(new TypingCommand(document, InsertLineBreak));
+    applyCommand(TypingCommand::create(document, InsertLineBreak));
 }
 
 void TypingCommand::insertParagraphSeparatorInQuotedContent(Document *document)
@@ -207,7 +207,7 @@ void TypingCommand::insertParagraphSeparatorInQuotedContent(Document *document)
         return;
     }
 
-    applyCommand(new TypingCommand(document, InsertParagraphSeparatorInQuotedContent));
+    applyCommand(TypingCommand::create(document, InsertParagraphSeparatorInQuotedContent));
 }
 
 void TypingCommand::insertParagraphSeparator(Document *document)
@@ -223,7 +223,7 @@ void TypingCommand::insertParagraphSeparator(Document *document)
         return;
     }
 
-    applyCommand(new TypingCommand(document, InsertParagraphSeparator));
+    applyCommand(TypingCommand::create(document, InsertParagraphSeparator));
 }
 
 bool TypingCommand::isOpenForMoreTypingCommand(const EditCommand* cmd)
@@ -342,7 +342,7 @@ void TypingCommand::insertTextRunWithoutNewlines(const String &text, bool select
             command = static_cast<InsertTextCommand*>(lastCommand);
     }
     if (!command) {
-        command = new InsertTextCommand(document());
+        command = InsertTextCommand::create(document());
         applyCommandToComposite(command);
     }
     command->input(text, selectInsertedText);
@@ -351,19 +351,19 @@ void TypingCommand::insertTextRunWithoutNewlines(const String &text, bool select
 
 void TypingCommand::insertLineBreak()
 {
-    applyCommandToComposite(new InsertLineBreakCommand(document()));
+    applyCommandToComposite(InsertLineBreakCommand::create(document()));
     typingAddedToOpenCommand();
 }
 
 void TypingCommand::insertParagraphSeparator()
 {
-    applyCommandToComposite(new InsertParagraphSeparatorCommand(document()));
+    applyCommandToComposite(InsertParagraphSeparatorCommand::create(document()));
     typingAddedToOpenCommand();
 }
 
 void TypingCommand::insertParagraphSeparatorInQuotedContent()
 {
-    applyCommandToComposite(new BreakBlockquoteCommand(document()));
+    applyCommandToComposite(BreakBlockquoteCommand::create(document()));
     typingAddedToOpenCommand();
 }
 
index c939da4..17ea526 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 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
@@ -42,8 +42,6 @@ public:
         InsertParagraphSeparatorInQuotedContent
     };
 
-    TypingCommand(Document*, ETypingCommand, const String& text = "", bool selectInsertedText = false, TextGranularity = CharacterGranularity);
-
     static void deleteSelection(Document*, bool smartDelete = false);
     static void deleteKeyPressed(Document*, bool smartDelete = false, TextGranularity = CharacterGranularity);
     static void forwardDeleteKeyPressed(Document*, bool smartDelete = false, TextGranularity = CharacterGranularity);
@@ -55,9 +53,6 @@ public:
     static bool isOpenForMoreTypingCommand(const EditCommand*);
     static void closeTyping(EditCommand*);
     
-    virtual void doApply();
-    virtual EditAction editingAction() const;
-
     bool isOpenForMoreTyping() const { return m_openForMoreTyping; }
     void closeTyping() { m_openForMoreTyping = false; }
 
@@ -71,9 +66,18 @@ public:
     void deleteSelection(bool);
 
 private:
-    bool smartDelete() { return m_smartDelete; }
+    static PassRefPtr<TypingCommand> create(Document* document, ETypingCommand command, const String& text = "", bool selectInsertedText = false, TextGranularity granularity = CharacterGranularity)
+    {
+        return adoptRef(new TypingCommand(document, command, text, selectInsertedText, granularity));
+    }
+
+    TypingCommand(Document*, ETypingCommand, const String& text, bool selectInsertedText, TextGranularity);
+
+    bool smartDelete() const { return m_smartDelete; }
     void setSmartDelete(bool smartDelete) { m_smartDelete = smartDelete; }
     
+    virtual void doApply();
+    virtual EditAction editingAction() const;
     virtual bool isTypingCommand() const;
     virtual bool preservesTypingStyle() const;
 
index 9c88068..f3d560f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 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
@@ -32,7 +32,14 @@ namespace WebCore {
 
 class UnlinkCommand : public CompositeEditCommand {
 public:
+    static PassRefPtr<UnlinkCommand> create(Document* document)
+    {
+        return adoptRef(new UnlinkCommand(document));
+    }
+
+private:
     UnlinkCommand(Document*);
+
     virtual void doApply();
     virtual EditAction editingAction() const { return EditActionUnlink; }
 };
index 89be9a4..86bf440 100644 (file)
@@ -31,8 +31,8 @@
 
 namespace WebCore {
 
-WrapContentsInDummySpanCommand::WrapContentsInDummySpanCommand(Element* element)
-    : EditCommand(element->document()), m_element(element)
+WrapContentsInDummySpanCommand::WrapContentsInDummySpanCommand(PassRefPtr<Element> element)
+    : SimpleEditCommand(element->document()), m_element(element)
 {
     ASSERT(m_element);
 }
index 02574ba..63a2ae7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 {
 
-class WrapContentsInDummySpanCommand : public EditCommand {
+class WrapContentsInDummySpanCommand : public SimpleEditCommand {
 public:
-    WrapContentsInDummySpanCommand(Element*);
+    static PassRefPtr<WrapContentsInDummySpanCommand> create(PassRefPtr<Element> element)
+    {
+        return adoptRef(new WrapContentsInDummySpanCommand(element));
+    }
+
+private:
+    WrapContentsInDummySpanCommand(PassRefPtr<Element>);
 
     virtual void doApply();
     virtual void doUnapply();
 
-private:
     RefPtr<Element> m_element;
     RefPtr<Element> m_dummySpan;
 };
index 6983b94..66f3ba1 100644 (file)
@@ -98,7 +98,7 @@ HistoryItem::~HistoryItem()
 }
 
 inline HistoryItem::HistoryItem(const HistoryItem& item)
-    : RefCounted<HistoryItem>(1)
+    : RefCounted<HistoryItem>()
     , m_urlString(item.m_urlString)
     , m_originalURLString(item.m_originalURLString)
     , m_target(item.m_target)
index 6cc4d65..4322f3d 100644 (file)
@@ -462,9 +462,9 @@ void HTMLTableElement::additionalAttributeStyleDecls(Vector<CSSMutableStyleDecla
 {
     if ((!m_borderAttr && !m_borderColorAttr) || m_frameAttr)
         return;
-        
-    MappedAttribute attr(tableborderAttr, m_borderColorAttr ? "solid" : "outset");
-    CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(ePersistent, &attr);
+
+    AtomicString borderValue = m_borderColorAttr ? "solid" : "outset";
+    CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(ePersistent, tableborderAttr, borderValue);
     if (!decl) {
         decl = new CSSMappedAttributeDeclaration(0);
         decl->setParent(document()->elementSheet());
@@ -479,10 +479,10 @@ void HTMLTableElement::additionalAttributeStyleDecls(Vector<CSSMutableStyleDecla
         decl->setProperty(CSSPropertyBorderLeftStyle, v, false);
         decl->setProperty(CSSPropertyBorderRightStyle, v, false);
 
-        setMappedAttributeDecl(ePersistent, &attr, decl);
+        setMappedAttributeDecl(ePersistent, tableborderAttr, borderValue, decl);
         decl->setParent(0);
         decl->setNode(0);
-        decl->setMappedState(ePersistent, attr.name(), attr.value());
+        decl->setMappedState(ePersistent, tableborderAttr, borderValue);
     }
     
     
@@ -522,10 +522,9 @@ void HTMLTableElement::addSharedCellBordersDecl(Vector<CSSMutableStyleDeclaratio
 {
     CellBorders borders = cellBorders();
 
-    static AtomicString cellBorderNames[] = { "none", "solid", "inset", "solid-cols", "solid-rows" };
-    MappedAttribute attr(cellborderAttr, cellBorderNames[borders]);
-
-    CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(ePersistent, &attr);
+    static const AtomicString cellBorderNames[] = { "none", "solid", "inset", "solid-cols", "solid-rows" };
+    const AtomicString& cellborderValue = cellBorderNames[borders];
+    CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(ePersistent, cellborderAttr, cellborderValue);
     if (!decl) {
         decl = new CSSMappedAttributeDeclaration(0);
         decl->setParent(document()->elementSheet());
@@ -570,10 +569,10 @@ void HTMLTableElement::addSharedCellBordersDecl(Vector<CSSMutableStyleDeclaratio
                 break;
         }
 
-        setMappedAttributeDecl(ePersistent, &attr, decl);
+        setMappedAttributeDecl(ePersistent, cellborderAttr, cellBorderNames[borders], decl);
         decl->setParent(0);
         decl->setNode(0);
-        decl->setMappedState(ePersistent, attr.name(), attr.value());
+        decl->setMappedState(ePersistent, cellborderAttr, cellborderValue);
     }
     
     results.append(decl);
@@ -585,37 +584,35 @@ void HTMLTableElement::addSharedCellPaddingDecl(Vector<CSSMutableStyleDeclaratio
         return;
 
     if (!m_paddingDecl) {
-        String numericStr = String::number(m_padding);
-        MappedAttribute attr(cellpaddingAttr, numericStr);
-        m_paddingDecl = getMappedAttributeDecl(eUniversal, &attr);
+        String paddingValue = String::number(m_padding);
+        m_paddingDecl = getMappedAttributeDecl(eUniversal, cellpaddingAttr, paddingValue);
         if (!m_paddingDecl) {
             m_paddingDecl = new CSSMappedAttributeDeclaration(0);
             m_paddingDecl->setParent(document()->elementSheet());
             m_paddingDecl->setNode(this);
             m_paddingDecl->setStrictParsing(false); // Mapped attributes are just always quirky.
             
-            m_paddingDecl->setProperty(CSSPropertyPaddingTop, numericStr, false);
-            m_paddingDecl->setProperty(CSSPropertyPaddingRight, numericStr, false);
-            m_paddingDecl->setProperty(CSSPropertyPaddingBottom, numericStr, false);
-            m_paddingDecl->setProperty(CSSPropertyPaddingLeft, numericStr, false);
+            m_paddingDecl->setProperty(CSSPropertyPaddingTop, paddingValue, false);
+            m_paddingDecl->setProperty(CSSPropertyPaddingRight, paddingValue, false);
+            m_paddingDecl->setProperty(CSSPropertyPaddingBottom, paddingValue, false);
+            m_paddingDecl->setProperty(CSSPropertyPaddingLeft, paddingValue, false);
         }
-        setMappedAttributeDecl(eUniversal, &attr, m_paddingDecl.get());
+        setMappedAttributeDecl(eUniversal, cellpaddingAttr, paddingValue, m_paddingDecl.get());
         m_paddingDecl->setParent(0);
         m_paddingDecl->setNode(0);
-        m_paddingDecl->setMappedState(eUniversal, attr.name(), attr.value());
+        m_paddingDecl->setMappedState(eUniversal, cellpaddingAttr, paddingValue);
     }
     
     results.append(m_paddingDecl.get());
 }
 
 void HTMLTableElement::addSharedGroupDecls(bool rows, Vector<CSSMutableStyleDeclaration*>& results)
-
 {
     if (m_rulesAttr != GroupsRules)
         return;
 
-    MappedAttribute attr(rulesAttr, rows ? "rowgroups" : "colgroups");
-    CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(ePersistent, &attr);
+    AtomicString rulesValue = rows ? "rowgroups" : "colgroups";
+    CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(ePersistent, rulesAttr, rulesValue);
     if (!decl) {
         decl = new CSSMappedAttributeDeclaration(0);
         decl->setParent(document()->elementSheet());
@@ -636,10 +633,10 @@ void HTMLTableElement::addSharedGroupDecls(bool rows, Vector<CSSMutableStyleDecl
             decl->setProperty(CSSPropertyBorderRightStyle, CSSValueSolid, false);
         }
 
-        setMappedAttributeDecl(ePersistent, &attr, decl);
+        setMappedAttributeDecl(ePersistent, rulesAttr, rulesValue, decl);
         decl->setParent(0);
         decl->setNode(0);
-        decl->setMappedState(ePersistent, attr.name(), attr.value());
+        decl->setMappedState(ePersistent, rulesAttr, rulesValue);
     }
 
     results.append(decl);
index 2e8078f..7f16017 100644 (file)
@@ -137,7 +137,7 @@ inline void Token::addAttribute(Document* doc, AtomicString& attrName, const Ato
 {
     if (!attrName.isEmpty()) {
         ASSERT(!attrName.contains('/'));
-        RefPtr<MappedAttribute> a = new MappedAttribute(attrName, v);
+        RefPtr<MappedAttribute> a = MappedAttribute::create(attrName, v);
         if (!attrs) {
             attrs = NamedMappedAttrMap::create();
             attrs->reserveCapacity(10);
index a2db865..0e63e5a 100644 (file)
@@ -72,7 +72,7 @@ void HTMLViewSourceDocument::createContainingTable()
     // document.
     RefPtr<Element> div = new HTMLDivElement(this);
     RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
-    attrs->insertAttribute(new MappedAttribute(classAttr, "webkit-line-gutter-backdrop"), true);
+    attrs->insertAttribute(MappedAttribute::create(classAttr, "webkit-line-gutter-backdrop"), true);
     div->setAttributeMap(attrs.release());
     body->addChild(div);
     div->attach();
@@ -194,7 +194,7 @@ PassRefPtr<Element> HTMLViewSourceDocument::addSpanWithClassName(const String& c
 
     RefPtr<Element> span = new HTMLElement(spanTag, this);
     RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
-    attrs->insertAttribute(new MappedAttribute(classAttr, className), true);
+    attrs->insertAttribute(MappedAttribute::create(classAttr, className), true);
     span->setAttributeMap(attrs.release());
     m_current->addChild(span);
     span->attach();
@@ -211,7 +211,7 @@ void HTMLViewSourceDocument::addLine(const String& className)
     // Create a cell that will hold the line number (it is generated in the stylesheet using counters).
     RefPtr<Element> td = new HTMLTableCellElement(tdTag, this);
     RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
-    attrs->insertAttribute(new MappedAttribute(classAttr, "webkit-line-number"), true);
+    attrs->insertAttribute(MappedAttribute::create(classAttr, "webkit-line-number"), true);
     td->setAttributeMap(attrs.release());
     trow->addChild(td);
     td->attach();
@@ -219,7 +219,7 @@ void HTMLViewSourceDocument::addLine(const String& className)
     // Create a second cell for the line contents
     td = new HTMLTableCellElement(tdTag, this);
     attrs = NamedMappedAttrMap::create();
-    attrs->insertAttribute(new MappedAttribute(classAttr, "webkit-line-content"), true);
+    attrs->insertAttribute(MappedAttribute::create(classAttr, "webkit-line-content"), true);
     td->setAttributeMap(attrs.release());
     trow->addChild(td);
     td->attach();
@@ -282,9 +282,9 @@ PassRefPtr<Element> HTMLViewSourceDocument::addLink(const String& url, bool isAn
         classValue = "webkit-html-attribute-value webkit-html-external-link";
     else
         classValue = "webkit-html-attribute-value webkit-html-resource-link";
-    attrs->insertAttribute(new MappedAttribute(classAttr, classValue), true);
-    attrs->insertAttribute(new MappedAttribute(targetAttr, "_blank"), true);
-    attrs->insertAttribute(new MappedAttribute(hrefAttr, url), true);
+    attrs->insertAttribute(MappedAttribute::create(classAttr, classValue), true);
+    attrs->insertAttribute(MappedAttribute::create(targetAttr, "_blank"), true);
+    attrs->insertAttribute(MappedAttribute::create(hrefAttr, url), true);
     anchor->setAttributeMap(attrs.release());
     m_current->addChild(anchor);
     anchor->attach();
index e0dfc38..ed6f41b 100644 (file)
 #include "config.h"
 #include "FrameLoader.h"
 
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-#include "ApplicationCache.h"
-#include "ApplicationCacheResource.h"
-#endif
 #include "Archive.h"
 #include "ArchiveFactory.h"
 #include "CString.h"
@@ -45,7 +41,6 @@
 #include "DocLoader.h"
 #include "Document.h"
 #include "DocumentLoader.h"
-#include "EditCommand.h"
 #include "Editor.h"
 #include "EditorClient.h"
 #include "Element.h"
 #include <kjs/JSLock.h>
 #include <kjs/object.h>
 
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+#include "ApplicationCache.h"
+#include "ApplicationCacheResource.h"
+#endif
+
 #if ENABLE(SVG)
 #include "SVGDocument.h"
 #include "SVGLocatable.h"
@@ -702,7 +702,7 @@ bool FrameLoader::didOpenURL(const KURL& url)
         return false;
 
     cancelRedirection();
-    m_frame->editor()->setLastEditCommand(0);
+    m_frame->editor()->clearLastEditCommand();
     closeURL();
 
     m_isComplete = false;
index 19b0428..535fda9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 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 <wtf/Forward.h>
 
 namespace WebCore {
+
     class NetscapePlugInStreamLoader;
 
     class NetscapePlugInStreamLoaderClient {
     public:
-        virtual ~NetscapePlugInStreamLoaderClient() { }
         virtual void didReceiveResponse(NetscapePlugInStreamLoader*, const ResourceResponse&) = 0;
         virtual void didReceiveData(NetscapePlugInStreamLoader*, const char*, int) = 0;
         virtual void didFail(NetscapePlugInStreamLoader*, const ResourceError&) = 0;
         virtual void didFinishLoading(NetscapePlugInStreamLoader*) { }
+
+    protected:
+        virtual ~NetscapePlugInStreamLoaderClient() { }
     };
 
     class NetscapePlugInStreamLoader : public ResourceLoader {
@@ -48,6 +51,7 @@ namespace WebCore {
 
         bool isDone() const;
 
+    private:
         virtual void didReceiveResponse(const ResourceResponse&);
         virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce);
         virtual void didFinishLoading();
@@ -55,7 +59,6 @@ namespace WebCore {
 
         virtual void releaseResources();
 
-    private:
         NetscapePlugInStreamLoader(Frame*, NetscapePlugInStreamLoaderClient*);
 
         virtual void didCancel(const ResourceError& error);
index 5402a39..ee13117 100644 (file)
@@ -231,7 +231,7 @@ void DOMApplicationCache::callListener(const AtomicString& eventType, EventListe
 {
     ASSERT(m_frame);
     
-    RefPtr<Event> event = new Event(eventType, false, false);
+    RefPtr<Event> event = Event::create(eventType, false, false);
     if (listener) {
         event->setTarget(this);
         event->setCurrentTarget(this);
index 8f0f7b5..07b8ce3 100644 (file)
@@ -195,7 +195,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
                 EditorInsertActionPasted)) {
                 Document* document = frame->document();
                 RefPtr<ReplaceSelectionCommand> command =
-                    new ReplaceSelectionCommand(document, createFragmentFromMarkup(document, item->title(), ""),
+                    ReplaceSelectionCommand::create(document, createFragmentFromMarkup(document, item->title(), ""),
                                                                                    true, false, true);
                 applyCommand(command);
                 frame->revealSelection(RenderLayer::gAlignToEdgeIfNeeded);
index 23658e1..72852a1 100644 (file)
@@ -78,7 +78,7 @@ namespace WebCore {
 
 class PostMessageTimer : public TimerBase {
 public:
-    PostMessageTimer(DOMWindow* window, MessageEvent* event, SecurityOrigin* targetOrigin)
+    PostMessageTimer(DOMWindow* window, PassRefPtr<MessageEvent> event, SecurityOrigin* targetOrigin)
         : m_window(window)
         , m_event(event)
         , m_targetOrigin(targetOrigin)
@@ -89,7 +89,7 @@ public:
     SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); }
 
 private:
-    virtual void fired() 
+    virtual void fired()
     {
         m_window->postMessageTimerFired(this);
     }
@@ -371,7 +371,7 @@ void DOMWindow::postMessage(const String& message, const String& targetOrigin, D
     String sourceOrigin = sourceDocument->securityOrigin()->toString();
 
     // Schedule the message.
-    PostMessageTimer* timer = new PostMessageTimer(this, new MessageEvent(message, sourceOrigin, "", source), target.get());
+    PostMessageTimer* timer = new PostMessageTimer(this, MessageEvent::create(message, sourceOrigin, "", source), target.get());
     timer->startOneShot(0);
 }
 
index b99e750..5e87afd 100644 (file)
@@ -403,10 +403,10 @@ bool DragController::concludeDrag(DragData* dragData, DragDestinationAction acti
             bool smartMove = innerFrame->selectionGranularity() == WordGranularity 
                           && innerFrame->editor()->smartInsertDeleteEnabled() 
                           && dragData->canSmartReplace();
-            applyCommand(new MoveSelectionCommand(fragment, dragCaret.base(), smartMove));
+            applyCommand(MoveSelectionCommand::create(fragment, dragCaret.base(), smartMove));
         } else {
             if (setSelectionToDragCaret(innerFrame, dragCaret, range, point))
-                applyCommand(new ReplaceSelectionCommand(m_document, fragment, true, dragData->canSmartReplace(), chosePlainText)); 
+                applyCommand(ReplaceSelectionCommand::create(m_document, fragment, true, dragData->canSmartReplace(), chosePlainText)); 
         }    
     } else {
         String text = dragData->asPlainText();
@@ -417,7 +417,7 @@ bool DragController::concludeDrag(DragData* dragData, DragDestinationAction acti
         
         m_client->willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
         if (setSelectionToDragCaret(innerFrame, dragCaret, range, point))
-            applyCommand(new ReplaceSelectionCommand(m_document, createFragmentFromText(range.get(), text), true, false, true)); 
+            applyCommand(ReplaceSelectionCommand::create(m_document, createFragmentFromText(range.get(), text), true, false, true)); 
     }
     loader->setAllowStaleResources(false);
 
index 34346f6..ac948b3 100644 (file)
@@ -1117,7 +1117,7 @@ bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTa
 {
     IntPoint contentsPos = m_frame->view()->windowToContents(event.pos());
     
-    RefPtr<MouseEvent> me = new MouseEvent(eventType,
+    RefPtr<MouseEvent> me = MouseEvent::create(eventType,
         true, true, m_frame->document()->defaultView(),
         0, event.globalX(), event.globalY(), contentsPos.x(), contentsPos.y(),
         event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
@@ -1524,7 +1524,7 @@ bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent)
     PlatformKeyboardEvent keyDownEvent = initialKeyEvent;    
     if (keyDownEvent.type() != PlatformKeyboardEvent::RawKeyDown)
         keyDownEvent.disambiguateKeyDownEvent(PlatformKeyboardEvent::RawKeyDown, backwardCompatibilityMode);
-    RefPtr<KeyboardEvent> keydown = new KeyboardEvent(keyDownEvent, m_frame->document()->defaultView());
+    RefPtr<KeyboardEvent> keydown = KeyboardEvent::create(keyDownEvent, m_frame->document()->defaultView());
     if (matchedAnAccessKey)
         keydown->setDefaultPrevented(true);
     keydown->setTarget(node);
@@ -1545,7 +1545,7 @@ bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent)
     
     if (handledByInputMethod) {
         keyDownEvent.setWindowsVirtualKeyCode(CompositionEventKeyCode);
-        keydown = new KeyboardEvent(keyDownEvent, m_frame->document()->defaultView());
+        keydown = KeyboardEvent::create(keyDownEvent, m_frame->document()->defaultView());
         keydown->setTarget(node);
         keydown->setDefaultHandled();
     }
@@ -1567,7 +1567,7 @@ bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent)
     keyPressEvent.disambiguateKeyDownEvent(PlatformKeyboardEvent::Char, backwardCompatibilityMode);
     if (keyPressEvent.text().isEmpty())
         return keydownResult;
-    RefPtr<KeyboardEvent> keypress = new KeyboardEvent(keyPressEvent, m_frame->document()->defaultView());
+    RefPtr<KeyboardEvent> keypress = KeyboardEvent::create(keyPressEvent, m_frame->document()->defaultView());
     keypress->setTarget(node);
     if (keydownResult)
         keypress->setDefaultPrevented(true);
@@ -1828,7 +1828,7 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve
         target = eventTargetNodeForDocument(m_frame->document());
     if (!target)
         return false;
-    RefPtr<TextEvent> event = new TextEvent(m_frame->domWindow(), text);
+    RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text);
     event->setUnderlyingEvent(underlyingEvent);
     event->setIsLineBreak(isLineBreak);
     event->setIsBackTab(isBackTab);