Commit faced26e authored by darin@apple.com's avatar darin@apple.com

2009-01-11 Darin Adler <darin@apple.com>

        Reviewed by Oliver Hunt.

        Bug 23102: turn on unused parameter warnings in WebCore
        https://bugs.webkit.org/show_bug.cgi?id=23102

        Fourth step: Remove arguments entirely in the many cases where they are not
        needed at all. This step is a little less mechanical than the earlier ones.

        * dom/DOMImplementation.cpp:
        (WebCore::DOMImplementation::isXMLMIMEType): Pass TextCaseSensitive when creating
        the regular expression, since we already specify a-zA-Z in our expression.

        * dom/Document.cpp:
        (WebCore::Document::databaseThread): Don't pass in the document when creating
        a DatabaseThread.

        * dom/Element.cpp:
        (WebCore::Element::createRareData): Don't pass the element when creating an
        ElementRareData.
        (WebCore::Element::detach): Don't pass the element when calling resetComputedStyle.
        (WebCore::Element::recalcStyle): Ditto.

        * dom/ElementRareData.h: Remove the unused Element* from the constructor and
        the resetComputedStyle function.

        * dom/EventTargetNode.cpp:
        (WebCore::EventTargetNode::dispatchEvent): Don't pass ec to dispatchGenericEvent.
        (WebCore::EventTargetNode::dispatchGenericEvent): Remove the unused ec argument.
        (WebCore::EventTargetNode::dispatchWindowEvent): Don't pass ec to dispatchGenericEvent.
        * dom/EventTargetNode.h: Remove the ExceptionCode& argument form disaptchGenericEvent.

        * editing/ApplyStyleCommand.cpp: Remove the empty removeBlockStyle function.
        (WebCore::ApplyStyleCommand::pushDownTextDecorationStyleAroundNode): Remove the unused
        start and end arguments.
        (WebCore::ApplyStyleCommand::pushDownTextDecorationStyleAtBoundaries): Don't pass start
        and end to pushDownTextDecorationStyleAroundNode.

        * editing/ApplyStyleCommand.h: Remove the empty removeBlockStyle function. Removed the
        unused start and end arguments from pushDownTextDecorationStyleAroundNode.

        * editing/htmlediting.cpp: Removed include of unused RegularExpression.h header.

        * html/HTMLTokenizer.cpp:
        (WebCore::Token::addAttribute): Removed unused Document* argument.
        (WebCore::HTMLTokenizer::parseTag): Don't pass document to addAttribute.

        * html/HTMLTokenizer.h: Removed unused Document* argument to to addAttribute.

        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::localStorage): Don't pass the frame to storageArea.

        * page/DragController.cpp:
        (WebCore::DragController::dragIsMove): Removed unused DragData argument.
        (WebCore::DragController::performDrag): Call concludeEditDrag rather than
        concludeDrag.
        (WebCore::DragController::tryDocumentDrag): Don't pass dragData to dragIsMove.
        (WebCore::DragController::concludeEditDrag): Renamed to make it clear this
        should only be called for edit drags. Removed the action mask argument. Also
        changed dragIsMove call sites to not pass dragData.

        * page/DragController.h: Updated for above changes and tweaked comment format.

        * page/Frame.cpp:
        (WebCore::createRegExpForLabels): Pass TextCaseSensitive and TextCaseInsensitive
        when creating regular expressions for clarity. Call match instead of search,
        since both do the same thing except for with negative start offsets, and none
        used here are negative.
        (WebCore::Frame::matchLabelsAgainstElement): Ditto.

        * page/Page.h: Moved TextCaseSensitivity from here to StringImpl.h in platform.

        * page/mac/AccessibilityObjectWrapper.mm:
        (AXAttributeStringSetHeadingLevel): Removed unused object argument.
        (AXAttributedStringAppendText): Ditto.
        (-[AccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): Ditto.

        * page/mac/FrameMac.mm:
        (WebCore::regExpForLabels): Pass TextCaseSensitive and TextCaseInsensitive
        when creating regular expressions for clarity. Call match instead of search,
        since both do the same thing except for with negative start offsets, and none
        used here are negative.
        (WebCore::Frame::matchLabelsAgainstElement): Ditto.

        * platform/graphics/SegmentedFontData.cpp:
        (WebCore::SegmentedFontData::containsCharacter): Added.
        (WebCore::SegmentedFontData::containsCharacters): Updated to check all characters
        instead of just the first one, using containsCharacter.

        * platform/graphics/SegmentedFontData.h: Made more members private.
        Added containsCharacter function member.

        * platform/mac/DragImageMac.mm:
        (WebCore::dragImageSize): Changed to use RetainPtr<NSImage> directly instead of
        DragImageRef for clarity, since this is platform-specific code.
        (WebCore::deleteDragImage): Ditto. Also remove argument name to get rid of unused
        variable warning.
        (WebCore::scaleDragImage): Ditto.
        (WebCore::dissolveDragImageToFraction): Ditto.
        (WebCore::createDragImageFromImage): Ditto.
        (WebCore::createDragImageIconForCachedImage): Ditto.

        * platform/mac/WebFontCache.mm:
        (acceptableChoice): Removed the unused weight-related arguments.
        (betterChoice): Ditto.
        (+[WebFontCache internalFontWithFamily:traits:weight:size:]): Ditto.

        * platform/posix/FileSystemPOSIX.cpp: Removed the implementation of listDirectory
        because we'd rather get a link error rather than a runtime error if we use it
        for anything, and right now it's not used.

        * platform/text/RegularExpression.cpp: Removed unused private data,
        including pattern, lastMatchString, lastMatchOffsets, lastMatchCount,
        and lastMatchPos. Made the RegularExpression::Private::regex be private
        and use an accessor function to get at it.
        (WebCore::RegularExpression::RegularExpression): Removed the const char* version
        of the constructor because it's not any more efficient. Changed the boolean
        constructor argument to use TextCaseSensitivity instead to make it less likely
        we'll use it wrong.
        (WebCore::RegularExpression::operator=): Since the only member is a single RefPtr,
        just use plain old assignment on it. The only reason we do this instead of using
        the compiler generated assignment operator is that we want the Private structure
        to be internal to the .cpp file.
        (WebCore::RegularExpression::match): Added a null check so we won't crash if
        we fail to compile the regular expression. Removed the code to handle multiple
        match strings, since that was unused.

        * platform/text/RegularExpression.h: Changed the case sensitivity argument to use
        TextCaseSensitivity and not have a default value. Removed the default constructor,
        and the pattern, match, and pos functions.

        * platform/text/StringImpl.h: Moved the TextCaseSensitivity enum here from
        Page.h, because we should eventually use it in all the places where we have
        an argument to control case sensitivity, starting with the functions in this
        class.

        * platform/text/mac/ShapeArabic.c:
        (shapeUnicode): Removed the unused options and pErrorCode arguments. Even though
        this is code borrowed from ICU, this seems like a simple safe change to make.
        (shapeArabic): Don't pass options or pErrorCode in to shapeUnicode.

        * rendering/RenderPath.cpp:
        (WebCore::RenderPath::RenderPath): Removed the unused style argument.
        Also removed the type check. The argument already has the correct type,
        so it's not helpful to upcast it and then check its type again, unless
        we have some reason to believe the type is not reliable. And we don't.

        * rendering/RenderPath.h: Removed the RenderStyle* argument to the
        constructor. Also removed the explicit declaration of the destructor.
        It's not helpful or needed.

        * rendering/RenderSVGInlineText.cpp:
        (WebCore::RenderSVGInlineText::localCaretRect): Updated the comment here to
        make it clear that just returning an empty rect is not a good implementation.
        Removed the argument names to get rid of the warning.

        * rendering/RenderTreeAsText.cpp:
        (WebCore::printBorderStyle): Removed the unused RenderObject argument.
        (WebCore::operator<<): Updated for the change to printBorderStyle function.

        * storage/DatabaseThread.cpp:
        (WebCore::DatabaseThread::DatabaseThread): Removed the unused document argument.
        * storage/DatabaseThread.h: Ditto.

        * storage/LocalStorage.cpp:
        (WebCore::LocalStorage::storageArea): Removed the unused Frame* argument.
        * storage/LocalStorage.h: Ditto.

        * svg/SVGElement.cpp:
        (WebCore::SVGElement::sendSVGLoadEventIfPossible): Don't pass an exception
        code location to dispatchGenericEvent.
        * svg/SVGElementInstance.cpp:
        (WebCore::SVGElementInstance::dispatchEvent): Ditto.

        * svg/SVGStyledTransformableElement.cpp: Removed include of unused RegularExpression.h.
        (WebCore::SVGStyledTransformableElement::createRenderer): Don't pass style in to
        the RenderPath constructor.

        * svg/SVGTransformable.cpp: Removed include of unused RegularExpression.h.

        * xml/XSLTProcessor.cpp:
        (WebCore::createFragmentFromSource): Removed unused sourceNode argument.
        (WebCore::XSLTProcessor::transformToFragment): Don't pass sourceNode to createFragmentFromSource.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@39818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e1016fc0
2009-01-11 Darin Adler <darin@apple.com>
Reviewed by Oliver Hunt.
Bug 23102: turn on unused parameter warnings in WebCore
https://bugs.webkit.org/show_bug.cgi?id=23102
Fourth step: Remove arguments entirely in the many cases where they are not
needed at all. This step is a little less mechanical than the earlier ones.
* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::isXMLMIMEType): Pass TextCaseSensitive when creating
the regular expression, since we already specify a-zA-Z in our expression.
* dom/Document.cpp:
(WebCore::Document::databaseThread): Don't pass in the document when creating
a DatabaseThread.
* dom/Element.cpp:
(WebCore::Element::createRareData): Don't pass the element when creating an
ElementRareData.
(WebCore::Element::detach): Don't pass the element when calling resetComputedStyle.
(WebCore::Element::recalcStyle): Ditto.
* dom/ElementRareData.h: Remove the unused Element* from the constructor and
the resetComputedStyle function.
* dom/EventTargetNode.cpp:
(WebCore::EventTargetNode::dispatchEvent): Don't pass ec to dispatchGenericEvent.
(WebCore::EventTargetNode::dispatchGenericEvent): Remove the unused ec argument.
(WebCore::EventTargetNode::dispatchWindowEvent): Don't pass ec to dispatchGenericEvent.
* dom/EventTargetNode.h: Remove the ExceptionCode& argument form disaptchGenericEvent.
* editing/ApplyStyleCommand.cpp: Remove the empty removeBlockStyle function.
(WebCore::ApplyStyleCommand::pushDownTextDecorationStyleAroundNode): Remove the unused
start and end arguments.
(WebCore::ApplyStyleCommand::pushDownTextDecorationStyleAtBoundaries): Don't pass start
and end to pushDownTextDecorationStyleAroundNode.
* editing/ApplyStyleCommand.h: Remove the empty removeBlockStyle function. Removed the
unused start and end arguments from pushDownTextDecorationStyleAroundNode.
* editing/htmlediting.cpp: Removed include of unused RegularExpression.h header.
* html/HTMLTokenizer.cpp:
(WebCore::Token::addAttribute): Removed unused Document* argument.
(WebCore::HTMLTokenizer::parseTag): Don't pass document to addAttribute.
* html/HTMLTokenizer.h: Removed unused Document* argument to to addAttribute.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::localStorage): Don't pass the frame to storageArea.
* page/DragController.cpp:
(WebCore::DragController::dragIsMove): Removed unused DragData argument.
(WebCore::DragController::performDrag): Call concludeEditDrag rather than
concludeDrag.
(WebCore::DragController::tryDocumentDrag): Don't pass dragData to dragIsMove.
(WebCore::DragController::concludeEditDrag): Renamed to make it clear this
should only be called for edit drags. Removed the action mask argument. Also
changed dragIsMove call sites to not pass dragData.
* page/DragController.h: Updated for above changes and tweaked comment format.
* page/Frame.cpp:
(WebCore::createRegExpForLabels): Pass TextCaseSensitive and TextCaseInsensitive
when creating regular expressions for clarity. Call match instead of search,
since both do the same thing except for with negative start offsets, and none
used here are negative.
(WebCore::Frame::matchLabelsAgainstElement): Ditto.
* page/Page.h: Moved TextCaseSensitivity from here to StringImpl.h in platform.
* page/mac/AccessibilityObjectWrapper.mm:
(AXAttributeStringSetHeadingLevel): Removed unused object argument.
(AXAttributedStringAppendText): Ditto.
(-[AccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): Ditto.
* page/mac/FrameMac.mm:
(WebCore::regExpForLabels): Pass TextCaseSensitive and TextCaseInsensitive
when creating regular expressions for clarity. Call match instead of search,
since both do the same thing except for with negative start offsets, and none
used here are negative.
(WebCore::Frame::matchLabelsAgainstElement): Ditto.
* platform/graphics/SegmentedFontData.cpp:
(WebCore::SegmentedFontData::containsCharacter): Added.
(WebCore::SegmentedFontData::containsCharacters): Updated to check all characters
instead of just the first one, using containsCharacter.
* platform/graphics/SegmentedFontData.h: Made more members private.
Added containsCharacter function member.
* platform/mac/DragImageMac.mm:
(WebCore::dragImageSize): Changed to use RetainPtr<NSImage> directly instead of
DragImageRef for clarity, since this is platform-specific code.
(WebCore::deleteDragImage): Ditto. Also remove argument name to get rid of unused
variable warning.
(WebCore::scaleDragImage): Ditto.
(WebCore::dissolveDragImageToFraction): Ditto.
(WebCore::createDragImageFromImage): Ditto.
(WebCore::createDragImageIconForCachedImage): Ditto.
* platform/mac/WebFontCache.mm:
(acceptableChoice): Removed the unused weight-related arguments.
(betterChoice): Ditto.
(+[WebFontCache internalFontWithFamily:traits:weight:size:]): Ditto.
* platform/posix/FileSystemPOSIX.cpp: Removed the implementation of listDirectory
because we'd rather get a link error rather than a runtime error if we use it
for anything, and right now it's not used.
* platform/text/RegularExpression.cpp: Removed unused private data,
including pattern, lastMatchString, lastMatchOffsets, lastMatchCount,
and lastMatchPos. Made the RegularExpression::Private::regex be private
and use an accessor function to get at it.
(WebCore::RegularExpression::RegularExpression): Removed the const char* version
of the constructor because it's not any more efficient. Changed the boolean
constructor argument to use TextCaseSensitivity instead to make it less likely
we'll use it wrong.
(WebCore::RegularExpression::operator=): Since the only member is a single RefPtr,
just use plain old assignment on it. The only reason we do this instead of using
the compiler generated assignment operator is that we want the Private structure
to be internal to the .cpp file.
(WebCore::RegularExpression::match): Added a null check so we won't crash if
we fail to compile the regular expression. Removed the code to handle multiple
match strings, since that was unused.
* platform/text/RegularExpression.h: Changed the case sensitivity argument to use
TextCaseSensitivity and not have a default value. Removed the default constructor,
and the pattern, match, and pos functions.
* platform/text/StringImpl.h: Moved the TextCaseSensitivity enum here from
Page.h, because we should eventually use it in all the places where we have
an argument to control case sensitivity, starting with the functions in this
class.
* platform/text/mac/ShapeArabic.c:
(shapeUnicode): Removed the unused options and pErrorCode arguments. Even though
this is code borrowed from ICU, this seems like a simple safe change to make.
(shapeArabic): Don't pass options or pErrorCode in to shapeUnicode.
* rendering/RenderPath.cpp:
(WebCore::RenderPath::RenderPath): Removed the unused style argument.
Also removed the type check. The argument already has the correct type,
so it's not helpful to upcast it and then check its type again, unless
we have some reason to believe the type is not reliable. And we don't.
* rendering/RenderPath.h: Removed the RenderStyle* argument to the
constructor. Also removed the explicit declaration of the destructor.
It's not helpful or needed.
* rendering/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::localCaretRect): Updated the comment here to
make it clear that just returning an empty rect is not a good implementation.
Removed the argument names to get rid of the warning.
* rendering/RenderTreeAsText.cpp:
(WebCore::printBorderStyle): Removed the unused RenderObject argument.
(WebCore::operator<<): Updated for the change to printBorderStyle function.
* storage/DatabaseThread.cpp:
(WebCore::DatabaseThread::DatabaseThread): Removed the unused document argument.
* storage/DatabaseThread.h: Ditto.
* storage/LocalStorage.cpp:
(WebCore::LocalStorage::storageArea): Removed the unused Frame* argument.
* storage/LocalStorage.h: Ditto.
* svg/SVGElement.cpp:
(WebCore::SVGElement::sendSVGLoadEventIfPossible): Don't pass an exception
code location to dispatchGenericEvent.
* svg/SVGElementInstance.cpp:
(WebCore::SVGElementInstance::dispatchEvent): Ditto.
* svg/SVGStyledTransformableElement.cpp: Removed include of unused RegularExpression.h.
(WebCore::SVGStyledTransformableElement::createRenderer): Don't pass style in to
the RenderPath constructor.
* svg/SVGTransformable.cpp: Removed include of unused RegularExpression.h.
* xml/XSLTProcessor.cpp:
(WebCore::createFragmentFromSource): Removed unused sourceNode argument.
(WebCore::XSLTProcessor::transformToFragment): Don't pass sourceNode to createFragmentFromSource.
2009-01-11 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin Adler.
......@@ -287,8 +287,8 @@ bool DOMImplementation::isXMLMIMEType(const String& mimeType)
{
if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "text/xsl")
return true;
static const char* validChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; // per RFCs: 3023, 2045
DEFINE_STATIC_LOCAL(RegularExpression, xmlTypeRegExp, (String("^") + validChars + "+/" + validChars + "+\\+xml$"));
static const char* const validChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; // per RFCs: 3023, 2045
DEFINE_STATIC_LOCAL(RegularExpression, xmlTypeRegExp, (String("^") + validChars + "+/" + validChars + "+\\+xml$", TextCaseSensitive));
return xmlTypeRegExp.match(mimeType) > -1;
}
......
......@@ -93,7 +93,6 @@
#include "ProcessingInstruction.h"
#include "ProgressEvent.h"
#include "RegisteredEventListener.h"
#include "RegularExpression.h"
#include "RenderArena.h"
#include "RenderView.h"
#include "RenderWidget.h"
......@@ -4200,7 +4199,7 @@ DatabaseThread* Document::databaseThread()
if (!m_databaseThread && !m_hasOpenDatabases) {
// Create the database thread on first request - but not if at least one database was already opened,
// because in that case we already had a database thread and terminated it and should not create another.
m_databaseThread = DatabaseThread::create(this);
m_databaseThread = DatabaseThread::create();
if (!m_databaseThread->start())
m_databaseThread = 0;
}
......
......@@ -4,7 +4,7 @@
* (C) 2001 Peter Kelly (pmk@post.com)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* (C) 2007 David Smith (catfish.man@gmail.com)
* Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* (C) 2007 Eric Seidel (eric@webkit.org)
*
* This library is free software; you can redistribute it and/or
......@@ -78,7 +78,7 @@ inline ElementRareData* Element::ensureRareData()
NodeRareData* Element::createRareData()
{
return new ElementRareData(this);
return new ElementRareData;
}
PassRefPtr<Node> Element::cloneNode(bool deep)
......@@ -659,7 +659,7 @@ void Element::detach()
{
cancelFocusAppearanceUpdate();
if (hasRareData())
rareData()->resetComputedStyle(this);
rareData()->resetComputedStyle();
ContainerNode::detach();
}
......@@ -677,7 +677,7 @@ void Element::recalcStyle(StyleChange change)
if ((change > NoChange || changed())) {
if (hasRareData())
rareData()->resetComputedStyle(this);
rareData()->resetComputedStyle();
}
if (hasParentStyle && (change >= Inherit || changed())) {
RefPtr<RenderStyle> newStyle = document()->styleSelector()->styleForElement(this);
......
/**
*
* Copyright (C) 2008 Apple Computer, Inc.
/*
* Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2008 David Smith <catfish.man@gmail.com>
*
* This library is free software; you can redistribute it and/or
......@@ -30,9 +29,9 @@ namespace WebCore {
class ElementRareData : public NodeRareData {
public:
ElementRareData(Element*);
ElementRareData();
void resetComputedStyle(Element*);
void resetComputedStyle();
using NodeRareData::needsFocusAppearanceUpdateSoonAfterAttach;
using NodeRareData::setNeedsFocusAppearanceUpdateSoonAfterAttach;
......@@ -46,12 +45,12 @@ inline IntSize defaultMinimumSizeForResizing()
return IntSize(INT_MAX, INT_MAX);
}
inline ElementRareData::ElementRareData(Element* e)
inline ElementRareData::ElementRareData()
: m_minimumSizeForResizing(defaultMinimumSizeForResizing())
{
}
inline void ElementRareData::resetComputedStyle(Element* element)
inline void ElementRareData::resetComputedStyle()
{
m_computedStyle.clear();
}
......
......@@ -270,10 +270,10 @@ bool EventTargetNode::dispatchEvent(PassRefPtr<Event> e, ExceptionCode& ec)
evt->setTarget(eventTargetRespectingSVGTargetRules(this));
RefPtr<FrameView> view = document()->view();
return dispatchGenericEvent(evt.release(), ec);
return dispatchGenericEvent(evt.release());
}
bool EventTargetNode::dispatchGenericEvent(PassRefPtr<Event> prpEvent, ExceptionCode& ec)
bool EventTargetNode::dispatchGenericEvent(PassRefPtr<Event> prpEvent)
{
RefPtr<Event> event(prpEvent);
......@@ -435,8 +435,7 @@ void EventTargetNode::dispatchWindowEvent(const AtomicString& eventType, bool ca
if (ownerElement) {
RefPtr<Event> ownerEvent = Event::create(eventType, false, cancelableArg);
ownerEvent->setTarget(ownerElement);
ExceptionCode ec = 0;
ownerElement->dispatchGenericEvent(ownerEvent.release(), ec);
ownerElement->dispatchGenericEvent(ownerEvent.release());
}
}
}
......
......@@ -75,7 +75,7 @@ public:
void dispatchStorageEvent(const AtomicString &eventType, const String& key, const String& oldValue, const String& newValue, Frame* source);
bool dispatchWebKitAnimationEvent(const AtomicString& eventType, const String& animationName, double elapsedTime);
bool dispatchWebKitTransitionEvent(const AtomicString& eventType, const String& propertyName, double elapsedTime);
bool dispatchGenericEvent(PassRefPtr<Event>, ExceptionCode&);
bool dispatchGenericEvent(PassRefPtr<Event>);
virtual void handleLocalEvents(Event*, bool useCapture);
......
/*
* Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -1006,16 +1006,6 @@ void ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration *style, HTMLEl
removeNodePreservingChildren(elem);
}
void ApplyStyleCommand::removeBlockStyle(CSSMutableStyleDeclaration *style, const Position &start, const Position &end)
{
ASSERT(start.isNotNull());
ASSERT(end.isNotNull());
ASSERT(start.node()->inDocument());
ASSERT(end.node()->inDocument());
ASSERT(Range::compareBoundaryPoints(start, end) <= 0);
}
static bool hasTextDecorationProperty(Node *node)
{
if (!node->isElementNode())
......@@ -1115,7 +1105,7 @@ void ApplyStyleCommand::applyTextDecorationStyle(Node *node, CSSMutableStyleDecl
}
}
void ApplyStyleCommand::pushDownTextDecorationStyleAroundNode(Node *node, const Position &start, const Position &end, bool force)
void ApplyStyleCommand::pushDownTextDecorationStyleAroundNode(Node* node, bool force)
{
Node *highestAncestor = highestAncestorWithTextDecoration(node);
......@@ -1152,13 +1142,13 @@ void ApplyStyleCommand::pushDownTextDecorationStyleAtBoundaries(const Position &
// styles (caused by stylesheets) and explicitly negate text
// decoration while pushing down.
pushDownTextDecorationStyleAroundNode(start.node(), start, end, false);
pushDownTextDecorationStyleAroundNode(start.node(), false);
updateLayout();
pushDownTextDecorationStyleAroundNode(start.node(), start, end, true);
pushDownTextDecorationStyleAroundNode(start.node(), true);
pushDownTextDecorationStyleAroundNode(end.node(), start, end, false);
pushDownTextDecorationStyleAroundNode(end.node(), false);
updateLayout();
pushDownTextDecorationStyleAroundNode(end.node(), start, end, true);
pushDownTextDecorationStyleAroundNode(end.node(), true);
}
static int maxRangeOffset(Node *n)
......
/*
* Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -67,14 +67,13 @@ private:
void removeHTMLFontStyle(CSSMutableStyleDeclaration*, HTMLElement*);
void removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration*, HTMLElement*);
void removeCSSStyle(CSSMutableStyleDeclaration*, HTMLElement*);
void removeBlockStyle(CSSMutableStyleDeclaration*, const Position& start, const Position& end);
void removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration>, const Position& start, const Position& end);
bool nodeFullySelected(Node*, const Position& start, const Position& end) const;
bool nodeFullyUnselected(Node*, const Position& start, const Position& end) const;
PassRefPtr<CSSMutableStyleDeclaration> extractTextDecorationStyle(Node*);
PassRefPtr<CSSMutableStyleDeclaration> extractAndNegateTextDecorationStyle(Node*);
void applyTextDecorationStyle(Node*, CSSMutableStyleDeclaration *style);
void pushDownTextDecorationStyleAroundNode(Node*, const Position& start, const Position& end, bool force);
void pushDownTextDecorationStyleAroundNode(Node*, bool force);
void pushDownTextDecorationStyleAtBoundaries(const Position& start, const Position& end);
// style-application helpers
......
......@@ -39,7 +39,6 @@
#include "HTMLUListElement.h"
#include "PositionIterator.h"
#include "RenderObject.h"
#include "RegularExpression.h"
#include "Range.h"
#include "Selection.h"
#include "Text.h"
......
......@@ -5,7 +5,7 @@
(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, 2008 Apple Inc. All rights reserved.
Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
Copyright (C) 2005, 2006 Alexey Proskuryakov (ap@nypop.com)
This library is free software; you can redistribute it and/or
......@@ -133,7 +133,7 @@ static inline bool tagMatch(const char* s1, const UChar* s2, unsigned length)
return true;
}
inline void Token::addAttribute(Document* doc, AtomicString& attrName, const AtomicString& attributeValue, bool viewSourceMode)
inline void Token::addAttribute(AtomicString& attrName, const AtomicString& attributeValue, bool viewSourceMode)
{
if (!attrName.isEmpty()) {
ASSERT(!attrName.contains('/'));
......@@ -1309,7 +1309,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
m_currentToken.addViewSourceChar(curchar);
src.advancePastNonNewline();
} else {
m_currentToken.addAttribute(m_doc, m_attrName, emptyAtom, inViewSourceMode());
m_currentToken.addAttribute(m_attrName, emptyAtom, inViewSourceMode());
m_dest = m_buffer;
state.setTagState(SearchAttribute);
lastIsSlash = false;
......@@ -1363,7 +1363,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1);
if (!attributeValue.contains('/'))
m_attrName = attributeValue; // Just make the name/value match. (FIXME: Is this some WinIE quirk?)
m_currentToken.addAttribute(m_doc, m_attrName, attributeValue, inViewSourceMode());
m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode());
if (inViewSourceMode())
m_currentToken.addViewSourceChar('x');
state.setTagState(SearchAttribute);
......@@ -1389,7 +1389,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
m_currentToken.addViewSourceChar('x');
} else if (inViewSourceMode())
m_currentToken.addViewSourceChar('v');
m_currentToken.addAttribute(m_doc, m_attrName, attributeValue, inViewSourceMode());
m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode());
m_dest = m_buffer;
state.setTagState(SearchAttribute);
tquote = NoQuote;
......@@ -1419,7 +1419,7 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
// '/' does not delimit in IE!
if (isASCIISpace(curchar) || curchar == '>') {
AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1);
m_currentToken.addAttribute(m_doc, m_attrName, attributeValue, inViewSourceMode());
m_currentToken.addAttribute(m_attrName, attributeValue, inViewSourceMode());
if (inViewSourceMode())
m_currentToken.addViewSourceChar('v');
m_dest = m_buffer;
......
......@@ -3,7 +3,7 @@
(C) 1997 Torben Weis (weis@kde.org)
(C) 1998 Waldo Bastian (bastian@kde.org)
(C) 2001 Dirk Mueller (mueller@kde.org)
Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 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
......@@ -63,7 +63,7 @@ struct Token {
{ }
~Token() { }
void addAttribute(Document*, AtomicString& attrName, const AtomicString& v, bool viewSourceMode);
void addAttribute(AtomicString& attrName, const AtomicString& v, bool viewSourceMode);
bool isOpenTag(const QualifiedName& fullName) const { return beginTag && fullName.localName() == tagName; }
bool isCloseTag(const QualifiedName& fullName) const { return !beginTag && fullName.localName() == tagName; }
......
......@@ -346,7 +346,7 @@ Storage* DOMWindow::localStorage() const
return 0;
LocalStorage* localStorage = page->group().localStorage();
RefPtr<StorageArea> storageArea = localStorage ? localStorage->storageArea(m_frame, document->securityOrigin()) : 0;
RefPtr<StorageArea> storageArea = localStorage ? localStorage->storageArea(document->securityOrigin()) : 0;
if (storageArea)
m_localStorage = Storage::create(m_frame, storageArea.release());
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -126,11 +126,9 @@ static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragD
return 0;
}
bool DragController::dragIsMove(SelectionController* selection, DragData* dragData)
bool DragController::dragIsMove(SelectionController* selection)
{
return m_document == m_dragInitiator
&& selection->isContentEditable()
&& !isCopyKeyDown();
return m_document == m_dragInitiator && selection->isContentEditable() && !isCopyKeyDown();
}
void DragController::cancelDrag()
......@@ -191,7 +189,7 @@ bool DragController::performDrag(DragData* dragData)
return true;
}
if ((m_dragDestinationAction & DragDestinationActionEdit) && concludeDrag(dragData, m_dragDestinationAction)) {
if ((m_dragDestinationAction & DragDestinationActionEdit) && concludeEditDrag(dragData)) {
m_document = 0;
return true;
}
......@@ -288,7 +286,7 @@ DragOperation DragController::tryDocumentDrag(DragData* dragData, DragDestinatio
m_page->dragCaretController()->setSelection(dragCaret);
}
return dragIsMove(innerFrame->selection(), dragData) ? DragOperationMove : DragOperationCopy;
return dragIsMove(innerFrame->selection()) ? DragOperationMove : DragOperationCopy;
}
m_page->dragCaretController()->clear();
......@@ -322,11 +320,10 @@ static bool setSelectionToDragCaret(Frame* frame, Selection& dragCaret, RefPtr<R
return !frame->selection()->isNone() && frame->selection()->isContentEditable();
}
bool DragController::concludeDrag(DragData* dragData, DragDestinationAction actionMask)
bool DragController::concludeEditDrag(DragData* dragData)
{
ASSERT(dragData);
ASSERT(!m_isHandlingDrag);
ASSERT(actionMask & DragDestinationActionEdit);
if (!m_document)
return false;
......@@ -394,7 +391,7 @@ bool DragController::concludeDrag(DragData* dragData, DragDestinationAction acti
return false;
DocLoader* loader = range->ownerDocument()->docLoader();
loader->setAllowStaleResources(true);
if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRichlyEditable()) {
if (dragIsMove(innerFrame->selection()) || dragCaret.isContentRichlyEditable()) {
bool chosePlainText = false;
RefPtr<DocumentFragment> fragment = documentFragmentFromDragData(dragData, range, true, chosePlainText);
if (!fragment || !innerFrame->editor()->shouldInsertFragment(fragment, range, EditorInsertActionDropped)) {
......@@ -403,7 +400,7 @@ bool DragController::concludeDrag(DragData* dragData, DragDestinationAction acti
}
m_client->willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
if (dragIsMove(innerFrame->selection(), dragData)) {
if (dragIsMove(innerFrame->selection())) {
bool smartMove = innerFrame->selectionGranularity() == WordGranularity
&& innerFrame->editor()->smartInsertDeleteEnabled()
&& dragData->canSmartReplace();
......@@ -701,7 +698,7 @@ bool DragController::startDrag(Frame* src, Clipboard* clipboard, DragOperation s
deleteDragImage(dragImage);
return startedDrag;
}
void DragController::doImageDrag(Element* element, const IntPoint& dragOrigin, const IntRect& rect, Clipboard* clipboard, Frame* frame, IntPoint& dragImageOffset)
{
IntPoint mouseDownPoint = dragOrigin;
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2009 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,7 +29,6 @@
#include "DragActions.h"
#include "DragImage.h"
#include "IntPoint.h"
#include "IntRect.h"
#include "KURL.h"
namespace WebCore {
......@@ -41,6 +40,7 @@ namespace WebCore {
class Element;
class Frame;
class Image;
class IntRect;
class Node;
class Page;
class PlatformMouseEvent;
......@@ -58,8 +58,8 @@ namespace WebCore {
DragOperation dragUpdated(DragData*);
bool performDrag(DragData*);
//FIXME: It should be possible to remove a number of these accessors once all
//drag logic is in WebCore
// FIXME: It should be possible to remove a number of these accessors once all
// drag logic is in WebCore.
void setDidInitiateDrag(bool initiated) { m_didInitiateDrag = initiated; }
bool didInitiateDrag() const { return m_didInitiateDrag; }
void setIsHandlingDrag(bool handling) { m_isHandlingDrag = handling; }
......@@ -73,7 +73,7 @@ namespace WebCore {
void setDragOffset(const IntPoint& offset) { m_dragOffset = offset; }
const IntPoint& dragOffset() const { return m_dragOffset; }
DragSourceAction dragSourceAction() const { return m_dragSourceAction; }
Document* document() const { return m_document; }
DragDestinationAction dragDestinationAction() const { return m_dragDestinationAction; }
DragSourceAction delegateDragSourceAction(const IntPoint& pagePoint);
......@@ -91,16 +91,17 @@ namespace WebCore {
static const int DragIconRightInset;
static const int DragIconBottomInset;
static const float DragImageAlpha;
private:
bool canProcessDrag(DragData*);
bool concludeDrag(DragData*, DragDestinationAction);
bool concludeEditDrag(DragData*);
DragOperation dragEnteredOrUpdated(DragData*);
DragOperation operationForLoad(DragData*);
DragOperation tryDocumentDrag(DragData*, DragDestinationAction);
DragOperation tryDHTMLDrag(DragData*);
DragOperation dragOperation(DragData*);
void cancelDrag();
bool dragIsMove(SelectionController*, DragData*);
bool dragIsMove(SelectionController*);
bool isCopyKeyDown();
IntRect selectionDraggingRect(Frame*);
......@@ -108,14 +109,12 @@ namespace WebCore {
void doImageDrag(Element*, const IntPoint&, const IntRect&, Clipboard*, Frame*, IntPoint&);
void doSystemDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool forLink);
void cleanupAfterSystemDrag();
Page* m_page;
DragClient* m_client;
//The Document the mouse was last dragged over
Document* m_document;
//The Document (if any) that initiated the drag
Document* m_dragInitiator;
Document* m_document; // The document the mouse was last dragged over.
Document* m_dragInitiator; // The Document (if any) that initiated the drag.
DragDestinationAction m_dragDestinationAction;
DragSourceAction m_dragSourceAction;
......
......@@ -333,7 +333,7 @@ static RegularExpression* createRegExpForLabels(const Vector<String>& labels)
// REVIEW- version of this call in FrameMac.mm caches based on the NSArray ptrs being
// the same across calls. We can't do that.
DEFINE_STATIC_LOCAL(RegularExpression, wordRegExp, ("\\w"));
DEFINE_STATIC_LOCAL(RegularExpression, wordRegExp, ("\\w", TextCaseSensitive));
String pattern("(");
unsigned int numLabels = labels.size();
unsigned int i;
......@@ -343,8 +343,8 @@ static RegularExpression* createRegExpForLabels(const Vector<String>& labels)
bool startsWithWordChar = false;
bool endsWithWordChar = false;
if (label.length() != 0) {
startsWithWordChar = wordRegExp.search(label.substring(0, 1)) >= 0;
endsWithWordChar = wordRegExp.search(label.substring(label.length() - 1, 1)) >= 0;
startsWithWordChar = wordRegExp.match(label.substring(0, 1)) >= 0;
endsWithWordChar = wordRegExp.match(label.substring(label.length() - 1, 1)) >= 0;
}
if (i != 0)
......@@ -361,7 +361,7 @@ static RegularExpression* createRegExpForLabels(const Vector<String>& labels)
}
}
pattern.append(")");
return new RegularExpression(pattern, false);
return new RegularExpression(pattern, TextCaseInsensitive);
}
String Frame::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell)
......@@ -453,7 +453,7 @@ String Frame::matchLabelsAgainstElement(const Vector<String>& labels, Element* e
return String();