提交 2b1e6cfc 编写于 作者: E Elliott Sprehn

Remove overflowchanged event.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/672353002
上级 fb0dcf78
......@@ -650,8 +650,6 @@ sky_core_files = [
"events/MouseRelatedEvent.cpp",
"events/NodeEventContext.cpp",
"events/NodeEventContext.h",
"events/OverflowEvent.cpp",
"events/OverflowEvent.h",
"events/PageTransitionEvent.cpp",
"events/PageTransitionEvent.h",
"events/PopStateEvent.cpp",
......@@ -1296,7 +1294,6 @@ core_idl_files = get_path_info([
"events/HashChangeEvent.idl",
"events/KeyboardEvent.idl",
"events/MouseEvent.idl",
"events/OverflowEvent.idl",
"events/PageTransitionEvent.idl",
"events/PopStateEvent.idl",
"events/ProgressEvent.idl",
......@@ -1416,7 +1413,6 @@ core_event_idl_files = get_path_info([
"events/HashChangeEvent.idl",
"events/KeyboardEvent.idl",
"events/MouseEvent.idl",
"events/OverflowEvent.idl",
"events/PageTransitionEvent.idl",
"events/PopStateEvent.idl",
"events/ProgressEvent.idl",
......
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "core/events/OverflowEvent.h"
namespace blink {
OverflowEventInit::OverflowEventInit()
: orient(0)
, horizontalOverflow(false)
, verticalOverflow(false)
{
}
OverflowEvent::OverflowEvent()
: Event(EventTypeNames::overflowchanged, false, false)
, m_orient(VERTICAL)
, m_horizontalOverflow(false)
, m_verticalOverflow(false)
{
ScriptWrappable::init(this);
}
OverflowEvent::OverflowEvent(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow)
: Event(EventTypeNames::overflowchanged, false, false)
, m_horizontalOverflow(horizontalOverflow)
, m_verticalOverflow(verticalOverflow)
{
ASSERT(horizontalOverflowChanged || verticalOverflowChanged);
ScriptWrappable::init(this);
if (horizontalOverflowChanged && verticalOverflowChanged)
m_orient = BOTH;
else if (horizontalOverflowChanged)
m_orient = HORIZONTAL;
else
m_orient = VERTICAL;
}
OverflowEvent::OverflowEvent(const AtomicString& type, const OverflowEventInit& initializer)
: Event(type, initializer)
, m_orient(initializer.orient)
, m_horizontalOverflow(initializer.horizontalOverflow)
, m_verticalOverflow(initializer.verticalOverflow)
{
ScriptWrappable::init(this);
}
const AtomicString& OverflowEvent::interfaceName() const
{
return EventNames::OverflowEvent;
}
void OverflowEvent::trace(Visitor* visitor)
{
Event::trace(visitor);
}
}
/*
* 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
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OverflowEvent_h
#define OverflowEvent_h
#include "core/events/Event.h"
namespace blink {
struct OverflowEventInit : public EventInit {
OverflowEventInit();
unsigned short orient;
bool horizontalOverflow;
bool verticalOverflow;
};
class OverflowEvent FINAL : public Event {
DEFINE_WRAPPERTYPEINFO();
public:
enum orientType {
HORIZONTAL = 0,
VERTICAL = 1,
BOTH = 2
};
static PassRefPtrWillBeRawPtr<OverflowEvent> create()
{
return adoptRefWillBeNoop(new OverflowEvent);
}
static PassRefPtrWillBeRawPtr<OverflowEvent> create(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow)
{
return adoptRefWillBeNoop(new OverflowEvent(horizontalOverflowChanged, horizontalOverflow, verticalOverflowChanged, verticalOverflow));
}
static PassRefPtrWillBeRawPtr<OverflowEvent> create(const AtomicString& type, const OverflowEventInit& initializer)
{
return adoptRefWillBeNoop(new OverflowEvent(type, initializer));
}
unsigned short orient() const { return m_orient; }
bool horizontalOverflow() const { return m_horizontalOverflow; }
bool verticalOverflow() const { return m_verticalOverflow; }
virtual const AtomicString& interfaceName() const OVERRIDE;
virtual void trace(Visitor*) OVERRIDE;
private:
OverflowEvent();
OverflowEvent(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow);
OverflowEvent(const AtomicString&, const OverflowEventInit&);
unsigned short m_orient;
bool m_horizontalOverflow;
bool m_verticalOverflow;
};
} // namespace blink
#endif // OverflowEvent_h
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
[
EventConstructor,
] interface OverflowEvent : Event {
const unsigned short HORIZONTAL = 0;
const unsigned short VERTICAL = 1;
const unsigned short BOTH = 2;
[InitializedByEventConstructor] readonly attribute unsigned short orient;
[InitializedByEventConstructor] readonly attribute boolean horizontalOverflow;
[InitializedByEventConstructor] readonly attribute boolean verticalOverflow;
};
......@@ -31,7 +31,6 @@
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/DocumentMarkerController.h"
#include "core/editing/FrameSelection.h"
#include "core/events/OverflowEvent.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/ResourceLoadPriorityOptimizer.h"
#include "core/frame/FrameHost.h"
......@@ -1474,19 +1473,6 @@ void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf
m_overflowStatusDirty = false;
return;
}
bool horizontalOverflowChanged = (m_horizontalOverflow != horizontalOverflow);
bool verticalOverflowChanged = (m_verticalOverflow != verticalOverflow);
if (horizontalOverflowChanged || verticalOverflowChanged) {
m_horizontalOverflow = horizontalOverflow;
m_verticalOverflow = verticalOverflow;
RefPtrWillBeRawPtr<OverflowEvent> event = OverflowEvent::create(horizontalOverflowChanged, horizontalOverflow, verticalOverflowChanged, verticalOverflow);
event->setTarget(m_viewportRenderer->node());
m_frame->document()->enqueueAnimationFrameEvent(event.release());
}
}
IntRect FrameView::windowClipRect(IncludeScrollbarsInRect scrollbarInclusion) const
......
......@@ -30,7 +30,6 @@
#include "core/dom/shadow/ShadowRoot.h"
#include "core/editing/Editor.h"
#include "core/editing/FrameSelection.h"
#include "core/events/OverflowEvent.h"
#include "core/fetch/ResourceLoadPriorityOptimizer.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
......@@ -85,49 +84,6 @@ typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet;
static int gDelayUpdateScrollInfo = 0;
static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0;
// This class helps dispatching the 'overflow' event on layout change. overflow can be set on RenderBoxes, yet the existing code
// only works on RenderBlocks. If this changes, this class should be shared with other RenderBoxes.
class OverflowEventDispatcher {
WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher);
public:
OverflowEventDispatcher(const RenderBlock* block)
: m_block(block)
, m_hadHorizontalLayoutOverflow(false)
, m_hadVerticalLayoutOverflow(false)
{
m_shouldDispatchEvent = !m_block->isAnonymous() && m_block->hasOverflowClip() && m_block->document().hasListenerType(Document::OVERFLOWCHANGED_LISTENER);
if (m_shouldDispatchEvent) {
m_hadHorizontalLayoutOverflow = m_block->hasHorizontalLayoutOverflow();
m_hadVerticalLayoutOverflow = m_block->hasVerticalLayoutOverflow();
}
}
~OverflowEventDispatcher()
{
if (!m_shouldDispatchEvent)
return;
bool hasHorizontalLayoutOverflow = m_block->hasHorizontalLayoutOverflow();
bool hasVerticalLayoutOverflow = m_block->hasVerticalLayoutOverflow();
bool horizontalLayoutOverflowChanged = hasHorizontalLayoutOverflow != m_hadHorizontalLayoutOverflow;
bool verticalLayoutOverflowChanged = hasVerticalLayoutOverflow != m_hadVerticalLayoutOverflow;
if (!horizontalLayoutOverflowChanged && !verticalLayoutOverflowChanged)
return;
RefPtrWillBeRawPtr<OverflowEvent> event = OverflowEvent::create(horizontalLayoutOverflowChanged, hasHorizontalLayoutOverflow, verticalLayoutOverflowChanged, hasVerticalLayoutOverflow);
event->setTarget(m_block->node());
m_block->document().enqueueAnimationFrameEvent(event.release());
}
private:
const RenderBlock* m_block;
bool m_shouldDispatchEvent;
bool m_hadHorizontalLayoutOverflow;
bool m_hadVerticalLayoutOverflow;
};
RenderBlock::RenderBlock(ContainerNode* node)
: RenderBox(node)
, m_hasMarginBeforeQuirk(false)
......@@ -1016,8 +972,6 @@ void RenderBlock::updateScrollInfoAfterLayout()
void RenderBlock::layout()
{
OverflowEventDispatcher dispatcher(this);
// Table cells call layoutBlock directly, so don't add any logic here. Put code into
// layoutBlock().
layoutBlock(false);
......
......@@ -85,7 +85,6 @@ public:
BLINK_EXPORT bool isClipboardEvent() const;
BLINK_EXPORT bool isWheelEvent() const;
BLINK_EXPORT bool isBeforeTextInsertedEvent() const;
BLINK_EXPORT bool isOverflowEvent() const;
BLINK_EXPORT bool isPageTransitionEvent() const;
BLINK_EXPORT bool isPopStateEvent() const;
BLINK_EXPORT bool isProgressEvent() const;
......
......@@ -159,12 +159,6 @@ bool WebDOMEvent::isBeforeTextInsertedEvent() const
return m_private->isBeforeTextInsertedEvent();
}
bool WebDOMEvent::isOverflowEvent() const
{
ASSERT(m_private.get());
return m_private->hasInterface(EventNames::OverflowEvent);
}
bool WebDOMEvent::isPageTransitionEvent() const
{
ASSERT(m_private.get());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册