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) ...@@ -1082,13 +1082,17 @@ void* HTMLInputElement::preDispatchEventHandler(Event* event)
return 0; return 0;
if (!event->isMouseEvent() || toMouseEvent(event)->button() != LeftButton) if (!event->isMouseEvent() || toMouseEvent(event)->button() != LeftButton)
return 0; return 0;
#if ENABLE(OILPAN)
return m_inputTypeView->willDispatchClick();
#else
// FIXME: Check whether there are any cases where this actually ends up leaking. // FIXME: Check whether there are any cases where this actually ends up leaking.
return m_inputTypeView->willDispatchClick().leakPtr(); return m_inputTypeView->willDispatchClick().leakPtr();
#endif
} }
void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreDispatch) 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) if (!state)
return; return;
m_inputTypeView->didDispatchClick(event, *state); m_inputTypeView->didDispatchClick(event, *state);
......
...@@ -68,12 +68,12 @@ void CheckboxInputType::handleKeyupEvent(KeyboardEvent* event) ...@@ -68,12 +68,12 @@ void CheckboxInputType::handleKeyupEvent(KeyboardEvent* event)
dispatchSimulatedClickIfActive(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. // 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. // 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->checked = element().checked();
state->indeterminate = element().indeterminate(); state->indeterminate = element().indeterminate();
......
...@@ -45,7 +45,7 @@ private: ...@@ -45,7 +45,7 @@ private:
virtual bool valueMissing(const String&) const OVERRIDE; virtual bool valueMissing(const String&) const OVERRIDE;
virtual String valueMissingText() const OVERRIDE; virtual String valueMissingText() const OVERRIDE;
virtual void handleKeyupEvent(KeyboardEvent*) OVERRIDE; virtual void handleKeyupEvent(KeyboardEvent*) OVERRIDE;
virtual PassOwnPtr<ClickHandlingState> willDispatchClick() OVERRIDE; virtual PassOwnPtrWillBeRawPtr<ClickHandlingState> willDispatchClick() OVERRIDE;
virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE; virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE;
virtual bool isCheckbox() const OVERRIDE; virtual bool isCheckbox() const OVERRIDE;
virtual bool supportsIndeterminateAppearance() const OVERRIDE; virtual bool supportsIndeterminateAppearance() const OVERRIDE;
......
...@@ -159,7 +159,7 @@ void InputTypeView::stepAttributeChanged() ...@@ -159,7 +159,7 @@ void InputTypeView::stepAttributeChanged()
{ {
} }
PassOwnPtr<ClickHandlingState> InputTypeView::willDispatchClick() PassOwnPtrWillBeRawPtr<ClickHandlingState> InputTypeView::willDispatchClick()
{ {
return nullptr; return nullptr;
} }
...@@ -218,4 +218,9 @@ void InputTypeView::updatePlaceholderText() ...@@ -218,4 +218,9 @@ void InputTypeView::updatePlaceholderText()
{ {
} }
void ClickHandlingState::trace(Visitor* visitor)
{
visitor->trace(checkedRadioButton);
}
} // namespace WebCore } // namespace WebCore
...@@ -54,13 +54,15 @@ class RenderObject; ...@@ -54,13 +54,15 @@ class RenderObject;
class RenderStyle; class RenderStyle;
class TouchEvent; class TouchEvent;
struct ClickHandlingState { struct ClickHandlingState FINAL : public NoBaseWillBeGarbageCollected<ClickHandlingState> {
WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public: public:
void trace(Visitor*);
bool checked; bool checked;
bool indeterminate; bool indeterminate;
RefPtrWillBePersistent<HTMLInputElement> checkedRadioButton; RefPtrWillBeMember<HTMLInputElement> checkedRadioButton;
}; };
// An InputTypeView object represents the UI-specific part of an // An InputTypeView object represents the UI-specific part of an
...@@ -78,7 +80,7 @@ public: ...@@ -78,7 +80,7 @@ public:
virtual bool sizeShouldIncludeDecoration(int defaultSize, int& preferredSize) const; virtual bool sizeShouldIncludeDecoration(int defaultSize, int& preferredSize) const;
virtual void handleClickEvent(MouseEvent*); virtual void handleClickEvent(MouseEvent*);
virtual void handleMouseDownEvent(MouseEvent*); virtual void handleMouseDownEvent(MouseEvent*);
virtual PassOwnPtr<ClickHandlingState> willDispatchClick(); virtual PassOwnPtrWillBeRawPtr<ClickHandlingState> willDispatchClick();
virtual void didDispatchClick(Event*, const ClickHandlingState&); virtual void didDispatchClick(Event*, const ClickHandlingState&);
virtual void handleKeydownEvent(KeyboardEvent*); virtual void handleKeydownEvent(KeyboardEvent*);
virtual void handleKeypressEvent(KeyboardEvent*); virtual void handleKeypressEvent(KeyboardEvent*);
......
...@@ -145,7 +145,7 @@ bool RadioInputType::shouldSendChangeEventAfterCheckedChanged() ...@@ -145,7 +145,7 @@ bool RadioInputType::shouldSendChangeEventAfterCheckedChanged()
return element().checked(); 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. // 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. // The ClickHandlingState object contains what we need to undo what we did here in didDispatchClick.
...@@ -154,7 +154,7 @@ PassOwnPtr<ClickHandlingState> RadioInputType::willDispatchClick() ...@@ -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 // 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. // 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->checked = element().checked();
state->checkedRadioButton = element().checkedRadioButtonForGroup(); state->checkedRadioButton = element().checkedRadioButtonForGroup();
......
...@@ -49,7 +49,7 @@ private: ...@@ -49,7 +49,7 @@ private:
virtual void handleKeyupEvent(KeyboardEvent*) OVERRIDE; virtual void handleKeyupEvent(KeyboardEvent*) OVERRIDE;
virtual bool isKeyboardFocusable() const OVERRIDE; virtual bool isKeyboardFocusable() const OVERRIDE;
virtual bool shouldSendChangeEventAfterCheckedChanged() OVERRIDE; virtual bool shouldSendChangeEventAfterCheckedChanged() OVERRIDE;
virtual PassOwnPtr<ClickHandlingState> willDispatchClick() OVERRIDE; virtual PassOwnPtrWillBeRawPtr<ClickHandlingState> willDispatchClick() OVERRIDE;
virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE; virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE;
virtual bool isRadioButton() const OVERRIDE; virtual bool isRadioButton() const OVERRIDE;
virtual bool supportsIndeterminateAppearance() 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