Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 206603002: Add EventHandlerRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test for external handlers. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 14 matching lines...) Expand all
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/rendering/RenderObject.h" 28 #include "core/rendering/RenderObject.h"
29 29
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "RuntimeEnabledFeatures.h" 31 #include "RuntimeEnabledFeatures.h"
32 #include "core/accessibility/AXObjectCache.h" 32 #include "core/accessibility/AXObjectCache.h"
33 #include "core/animation/ActiveAnimations.h" 33 #include "core/animation/ActiveAnimations.h"
34 #include "core/css/resolver/StyleResolver.h" 34 #include "core/css/resolver/StyleResolver.h"
35 #include "core/dom/EventHandlerRegistry.h"
35 #include "core/editing/EditingBoundary.h" 36 #include "core/editing/EditingBoundary.h"
36 #include "core/editing/FrameSelection.h" 37 #include "core/editing/FrameSelection.h"
37 #include "core/editing/htmlediting.h" 38 #include "core/editing/htmlediting.h"
38 #include "core/fetch/ResourceLoadPriorityOptimizer.h" 39 #include "core/fetch/ResourceLoadPriorityOptimizer.h"
39 #include "core/fetch/ResourceLoader.h" 40 #include "core/fetch/ResourceLoader.h"
40 #include "core/frame/FrameView.h" 41 #include "core/frame/FrameView.h"
41 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
42 #include "core/html/HTMLAnchorElement.h" 43 #include "core/html/HTMLAnchorElement.h"
43 #include "core/html/HTMLElement.h" 44 #include "core/html/HTMLElement.h"
44 #include "core/html/HTMLHtmlElement.h" 45 #include "core/html/HTMLHtmlElement.h"
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 2050
2050 // Elements with non-auto touch-action will send a SetTouchAction message 2051 // Elements with non-auto touch-action will send a SetTouchAction message
2051 // on touchstart in EventHandler::handleTouchEvent, and so effectively have 2052 // on touchstart in EventHandler::handleTouchEvent, and so effectively have
2052 // a touchstart handler that must be reported. 2053 // a touchstart handler that must be reported.
2053 // 2054 //
2054 // Since a CSS property cannot be applied directly to a text node, a 2055 // Since a CSS property cannot be applied directly to a text node, a
2055 // handler will have already been added for its parent so ignore it. 2056 // handler will have already been added for its parent so ignore it.
2056 TouchAction oldTouchAction = m_style ? m_style->touchAction() : TouchActionA uto; 2057 TouchAction oldTouchAction = m_style ? m_style->touchAction() : TouchActionA uto;
2057 if (node() && !node()->isTextNode() && (oldTouchAction == TouchActionAuto) ! = (newStyle->touchAction() == TouchActionAuto)) { 2058 if (node() && !node()->isTextNode() && (oldTouchAction == TouchActionAuto) ! = (newStyle->touchAction() == TouchActionAuto)) {
2058 if (newStyle->touchAction() != TouchActionAuto) 2059 if (newStyle->touchAction() != TouchActionAuto)
2059 document().didAddTouchEventHandler(node()); 2060 EventHandlerRegistry::from(document())->didAddEventHandler(*node(), EventHandlerRegistry::TouchEvent);
2060 else 2061 else
2061 document().didRemoveTouchEventHandler(node()); 2062 EventHandlerRegistry::from(document())->didRemoveEventHandler(*node( ), EventHandlerRegistry::TouchEvent);
2062 } 2063 }
2063 } 2064 }
2064 2065
2065 static bool areNonIdenticalCursorListsEqual(const RenderStyle* a, const RenderSt yle* b) 2066 static bool areNonIdenticalCursorListsEqual(const RenderStyle* a, const RenderSt yle* b)
2066 { 2067 {
2067 ASSERT(a->cursors() != b->cursors()); 2068 ASSERT(a->cursors() != b->cursors());
2068 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors(); 2069 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors();
2069 } 2070 }
2070 2071
2071 static inline bool areCursorsEqual(const RenderStyle* a, const RenderStyle* b) 2072 static inline bool areCursorsEqual(const RenderStyle* a, const RenderStyle* b)
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 // this renderer had no parent at the time remove() was called. 2581 // this renderer had no parent at the time remove() was called.
2581 2582
2582 if (hasCounterNodeMap()) 2583 if (hasCounterNodeMap())
2583 RenderCounter::destroyCounterNodes(*this); 2584 RenderCounter::destroyCounterNodes(*this);
2584 2585
2585 // Remove the handler if node had touch-action set. Don't call when 2586 // Remove the handler if node had touch-action set. Don't call when
2586 // document is being destroyed as all handlers will have been cleared 2587 // document is being destroyed as all handlers will have been cleared
2587 // previously. Handlers are not added for text nodes so don't try removing 2588 // previously. Handlers are not added for text nodes so don't try removing
2588 // for one too. Need to check if m_style is null in cases of partial constru ction. 2589 // for one too. Need to check if m_style is null in cases of partial constru ction.
2589 if (!documentBeingDestroyed() && node() && !node()->isTextNode() && m_style && m_style->touchAction() != TouchActionAuto) 2590 if (!documentBeingDestroyed() && node() && !node()->isTextNode() && m_style && m_style->touchAction() != TouchActionAuto)
2590 document().didRemoveTouchEventHandler(node()); 2591 EventHandlerRegistry::from(document())->didRemoveEventHandler(*node(), E ventHandlerRegistry::TouchEvent);
2591 2592
2592 setAncestorLineBoxDirty(false); 2593 setAncestorLineBoxDirty(false);
2593 2594
2594 clearLayoutRootIfNeeded(); 2595 clearLayoutRootIfNeeded();
2595 } 2596 }
2596 2597
2597 void RenderObject::insertedIntoTree() 2598 void RenderObject::insertedIntoTree()
2598 { 2599 {
2599 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion. 2600 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion.
2600 2601
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
3329 { 3330 {
3330 if (object1) { 3331 if (object1) {
3331 const WebCore::RenderObject* root = object1; 3332 const WebCore::RenderObject* root = object1;
3332 while (root->parent()) 3333 while (root->parent())
3333 root = root->parent(); 3334 root = root->parent();
3334 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3335 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3335 } 3336 }
3336 } 3337 }
3337 3338
3338 #endif 3339 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698