Commit f58818f5 authored by keishi@chromium.org's avatar keishi@chromium.org

Oilpan: Move ClickHandlingState to heap

BUG=357163

Review URL: https://codereview.chromium.org/298963003

git-svn-id: svn://svn.chromium.org/blink/trunk@175533 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9e882a70
......@@ -1082,13 +1082,17 @@ void* HTMLInputElement::preDispatchEventHandler(Event* event)
return 0;
if (!event->isMouseEvent() || toMouseEvent(event)->button() != LeftButton)
return 0;
#if ENABLE(OILPAN)
return m_inputTypeView->willDispatchClick();
#else
// FIXME: Check whether there are any cases where this actually ends up leaking.
return m_inputTypeView->willDispatchClick().leakPtr();
#endif
}
void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreDispatch)
{
OwnPtr<ClickHandlingState> state = adoptPtr(static_cast<ClickHandlingState*>(dataFromPreDispatch));
OwnPtrWillBeRawPtr<ClickHandlingState> state = adoptPtrWillBeNoop(static_cast<ClickHandlingState*>(dataFromPreDispatch));
if (!state)
return;
m_inputTypeView->didDispatchClick(event, *state);
......
......@@ -68,12 +68,12 @@ void CheckboxInputType::handleKeyupEvent(KeyboardEvent* event)
dispatchSimulatedClickIfActive(event);
}
PassOwnPtr<ClickHandlingState> CheckboxInputType::willDispatchClick()
PassOwnPtrWillBeRawPtr<ClickHandlingState> CheckboxInputType::willDispatchClick()
{
// An event handler can use preventDefault or "return false" to reverse the checking we do here.
// The ClickHandlingState object contains what we need to undo what we did here in didDispatchClick.
OwnPtr<ClickHandlingState> state = adoptPtr(new ClickHandlingState);
OwnPtrWillBeRawPtr<ClickHandlingState> state = adoptPtrWillBeNoop(new ClickHandlingState);
state->checked = element().checked();
state->indeterminate = element().indeterminate();
......
......@@ -45,7 +45,7 @@ private:
virtual bool valueMissing(const String&) const OVERRIDE;
virtual String valueMissingText() const OVERRIDE;
virtual void handleKeyupEvent(KeyboardEvent*) OVERRIDE;
virtual PassOwnPtr<ClickHandlingState> willDispatchClick() OVERRIDE;
virtual PassOwnPtrWillBeRawPtr<ClickHandlingState> willDispatchClick() OVERRIDE;
virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE;
virtual bool isCheckbox() const OVERRIDE;
virtual bool supportsIndeterminateAppearance() const OVERRIDE;
......
......@@ -159,7 +159,7 @@ void InputTypeView::stepAttributeChanged()
{
}
PassOwnPtr<ClickHandlingState> InputTypeView::willDispatchClick()
PassOwnPtrWillBeRawPtr<ClickHandlingState> InputTypeView::willDispatchClick()
{
return nullptr;
}
......@@ -218,4 +218,9 @@ void InputTypeView::updatePlaceholderText()
{
}
void ClickHandlingState::trace(Visitor* visitor)
{
visitor->trace(checkedRadioButton);
}
} // namespace WebCore
......@@ -54,13 +54,15 @@ class RenderObject;
class RenderStyle;
class TouchEvent;
struct ClickHandlingState {
WTF_MAKE_FAST_ALLOCATED;
struct ClickHandlingState FINAL : public NoBaseWillBeGarbageCollected<ClickHandlingState> {
WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public:
void trace(Visitor*);
bool checked;
bool indeterminate;
RefPtrWillBePersistent<HTMLInputElement> checkedRadioButton;
RefPtrWillBeMember<HTMLInputElement> checkedRadioButton;
};
// An InputTypeView object represents the UI-specific part of an
......@@ -78,7 +80,7 @@ public:
virtual bool sizeShouldIncludeDecoration(int defaultSize, int& preferredSize) const;
virtual void handleClickEvent(MouseEvent*);
virtual void handleMouseDownEvent(MouseEvent*);
virtual PassOwnPtr<ClickHandlingState> willDispatchClick();
virtual PassOwnPtrWillBeRawPtr<ClickHandlingState> willDispatchClick();
virtual void didDispatchClick(Event*, const ClickHandlingState&);
virtual void handleKeydownEvent(KeyboardEvent*);
virtual void handleKeypressEvent(KeyboardEvent*);
......
......@@ -145,7 +145,7 @@ bool RadioInputType::shouldSendChangeEventAfterCheckedChanged()
return element().checked();
}
PassOwnPtr<ClickHandlingState> RadioInputType::willDispatchClick()
PassOwnPtrWillBeRawPtr<ClickHandlingState> RadioInputType::willDispatchClick()
{
// An event handler can use preventDefault or "return false" to reverse the selection we do here.
// The ClickHandlingState object contains what we need to undo what we did here in didDispatchClick.
......@@ -154,7 +154,7 @@ PassOwnPtr<ClickHandlingState> RadioInputType::willDispatchClick()
// Therefore if nothing is currently selected, we won't allow the upcoming action to be "undone", since
// we want some object in the radio group to actually get selected.
OwnPtr<ClickHandlingState> state = adoptPtr(new ClickHandlingState);
OwnPtrWillBeRawPtr<ClickHandlingState> state = adoptPtrWillBeNoop(new ClickHandlingState);
state->checked = element().checked();
state->checkedRadioButton = element().checkedRadioButtonForGroup();
......
......@@ -49,7 +49,7 @@ private:
virtual void handleKeyupEvent(KeyboardEvent*) OVERRIDE;
virtual bool isKeyboardFocusable() const OVERRIDE;
virtual bool shouldSendChangeEventAfterCheckedChanged() OVERRIDE;
virtual PassOwnPtr<ClickHandlingState> willDispatchClick() OVERRIDE;
virtual PassOwnPtrWillBeRawPtr<ClickHandlingState> willDispatchClick() OVERRIDE;
virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE;
virtual bool isRadioButton() const OVERRIDE;
virtual bool supportsIndeterminateAppearance() const OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment