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

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

Issue 225903009: Migrate touch events to EventHandlerRegistry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 6 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 | Annotate | Revision Log
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 20 matching lines...) Expand all
31 #include "core/accessibility/AXObjectCache.h" 31 #include "core/accessibility/AXObjectCache.h"
32 #include "core/animation/ActiveAnimations.h" 32 #include "core/animation/ActiveAnimations.h"
33 #include "core/css/resolver/StyleResolver.h" 33 #include "core/css/resolver/StyleResolver.h"
34 #include "core/dom/ElementTraversal.h" 34 #include "core/dom/ElementTraversal.h"
35 #include "core/dom/shadow/ShadowRoot.h" 35 #include "core/dom/shadow/ShadowRoot.h"
36 #include "core/editing/EditingBoundary.h" 36 #include "core/editing/EditingBoundary.h"
37 #include "core/editing/FrameSelection.h" 37 #include "core/editing/FrameSelection.h"
38 #include "core/editing/htmlediting.h" 38 #include "core/editing/htmlediting.h"
39 #include "core/fetch/ResourceLoadPriorityOptimizer.h" 39 #include "core/fetch/ResourceLoadPriorityOptimizer.h"
40 #include "core/fetch/ResourceLoader.h" 40 #include "core/fetch/ResourceLoader.h"
41 #include "core/frame/EventHandlerRegistry.h"
41 #include "core/frame/FrameView.h" 42 #include "core/frame/FrameView.h"
42 #include "core/frame/LocalFrame.h" 43 #include "core/frame/LocalFrame.h"
43 #include "core/html/HTMLAnchorElement.h" 44 #include "core/html/HTMLAnchorElement.h"
44 #include "core/html/HTMLElement.h" 45 #include "core/html/HTMLElement.h"
45 #include "core/html/HTMLHtmlElement.h" 46 #include "core/html/HTMLHtmlElement.h"
46 #include "core/html/HTMLTableCellElement.h" 47 #include "core/html/HTMLTableCellElement.h"
47 #include "core/html/HTMLTableElement.h" 48 #include "core/html/HTMLTableElement.h"
48 #include "core/page/AutoscrollController.h" 49 #include "core/page/AutoscrollController.h"
49 #include "core/page/EventHandler.h" 50 #include "core/page/EventHandler.h"
50 #include "core/page/Page.h" 51 #include "core/page/Page.h"
(...skipping 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 } 2256 }
2256 } 2257 }
2257 2258
2258 // Elements with non-auto touch-action will send a SetTouchAction message 2259 // Elements with non-auto touch-action will send a SetTouchAction message
2259 // on touchstart in EventHandler::handleTouchEvent, and so effectively have 2260 // on touchstart in EventHandler::handleTouchEvent, and so effectively have
2260 // a touchstart handler that must be reported. 2261 // a touchstart handler that must be reported.
2261 // 2262 //
2262 // Since a CSS property cannot be applied directly to a text node, a 2263 // Since a CSS property cannot be applied directly to a text node, a
2263 // handler will have already been added for its parent so ignore it. 2264 // handler will have already been added for its parent so ignore it.
2264 TouchAction oldTouchAction = m_style ? m_style->touchAction() : TouchActionA uto; 2265 TouchAction oldTouchAction = m_style ? m_style->touchAction() : TouchActionA uto;
2265 if (node() && !node()->isTextNode() && (oldTouchAction == TouchActionAuto) ! = (newStyle.touchAction() == TouchActionAuto)) { 2266 if (document().frameHost() && node() && !node()->isTextNode() && (oldTouchAc tion == TouchActionAuto) != (newStyle.touchAction() == TouchActionAuto)) {
abarth-chromium 2014/06/18 23:43:06 The document will always have a frameHost here.
Sami 2014/06/27 17:58:51 Done.
2267 EventHandlerRegistry* registry = &document().frameHost()->eventHandlerRe gistry();
Rick Byers 2014/06/19 17:10:36 nit - use ref instead of taking the address just t
Sami 2014/06/27 17:58:51 Done.
2266 if (newStyle.touchAction() != TouchActionAuto) 2268 if (newStyle.touchAction() != TouchActionAuto)
2267 document().didAddTouchEventHandler(node()); 2269 registry->didAddEventHandler(*node(), EventHandlerRegistry::TouchEve nt);
2268 else 2270 else
2269 document().didRemoveTouchEventHandler(node()); 2271 registry->didRemoveEventHandler(*node(), EventHandlerRegistry::Touch Event);
2270 } 2272 }
2271 } 2273 }
2272 2274
2273 static bool areNonIdenticalCursorListsEqual(const RenderStyle* a, const RenderSt yle* b) 2275 static bool areNonIdenticalCursorListsEqual(const RenderStyle* a, const RenderSt yle* b)
2274 { 2276 {
2275 ASSERT(a->cursors() != b->cursors()); 2277 ASSERT(a->cursors() != b->cursors());
2276 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors(); 2278 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors();
2277 } 2279 }
2278 2280
2279 static inline bool areCursorsEqual(const RenderStyle* a, const RenderStyle* b) 2281 static inline bool areCursorsEqual(const RenderStyle* a, const RenderStyle* b)
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
2776 // reevaluation. This apparently redundant check is here for the case when 2778 // reevaluation. This apparently redundant check is here for the case when
2777 // this renderer had no parent at the time remove() was called. 2779 // this renderer had no parent at the time remove() was called.
2778 2780
2779 if (hasCounterNodeMap()) 2781 if (hasCounterNodeMap())
2780 RenderCounter::destroyCounterNodes(*this); 2782 RenderCounter::destroyCounterNodes(*this);
2781 2783
2782 // Remove the handler if node had touch-action set. Don't call when 2784 // Remove the handler if node had touch-action set. Don't call when
2783 // document is being destroyed as all handlers will have been cleared 2785 // document is being destroyed as all handlers will have been cleared
2784 // previously. Handlers are not added for text nodes so don't try removing 2786 // previously. Handlers are not added for text nodes so don't try removing
2785 // for one too. Need to check if m_style is null in cases of partial constru ction. 2787 // for one too. Need to check if m_style is null in cases of partial constru ction.
2786 if (!documentBeingDestroyed() && node() && !node()->isTextNode() && m_style && m_style->touchAction() != TouchActionAuto) 2788 if (!documentBeingDestroyed() && document().frameHost() && node() && !node() ->isTextNode() && m_style && m_style->touchAction() != TouchActionAuto)
abarth-chromium 2014/06/18 23:43:06 Same here
Sami 2014/06/27 17:58:51 Done.
2787 document().didRemoveTouchEventHandler(node()); 2789 document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*no de(), EventHandlerRegistry::TouchEvent);
2788 2790
2789 setAncestorLineBoxDirty(false); 2791 setAncestorLineBoxDirty(false);
2790 2792
2791 clearLayoutRootIfNeeded(); 2793 clearLayoutRootIfNeeded();
2792 } 2794 }
2793 2795
2794 void RenderObject::insertedIntoTree() 2796 void RenderObject::insertedIntoTree()
2795 { 2797 {
2796 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion. 2798 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion.
2797 2799
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
3541 { 3543 {
3542 if (object1) { 3544 if (object1) {
3543 const WebCore::RenderObject* root = object1; 3545 const WebCore::RenderObject* root = object1;
3544 while (root->parent()) 3546 while (root->parent())
3545 root = root->parent(); 3547 root = root->parent();
3546 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3548 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3547 } 3549 }
3548 } 3550 }
3549 3551
3550 #endif 3552 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698