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

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: Tests now seem to pass. Created 6 years, 9 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 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 2067
2067 // Elements with non-auto touch-action will send a SetTouchAction message 2068 // Elements with non-auto touch-action will send a SetTouchAction message
2068 // on touchstart in EventHandler::handleTouchEvent, and so effectively have 2069 // on touchstart in EventHandler::handleTouchEvent, and so effectively have
2069 // a touchstart handler that must be reported. 2070 // a touchstart handler that must be reported.
2070 // 2071 //
2071 // Since a CSS property cannot be applied directly to a text node, a 2072 // Since a CSS property cannot be applied directly to a text node, a
2072 // handler will have already been added for its parent so ignore it. 2073 // handler will have already been added for its parent so ignore it.
2073 TouchAction oldTouchAction = m_style ? m_style->touchAction() : TouchActionA uto; 2074 TouchAction oldTouchAction = m_style ? m_style->touchAction() : TouchActionA uto;
2074 if (node() && !node()->isTextNode() && (oldTouchAction == TouchActionAuto) ! = (newStyle->touchAction() == TouchActionAuto)) { 2075 if (node() && !node()->isTextNode() && (oldTouchAction == TouchActionAuto) ! = (newStyle->touchAction() == TouchActionAuto)) {
2075 if (newStyle->touchAction() != TouchActionAuto) 2076 if (newStyle->touchAction() != TouchActionAuto)
2076 document().didAddTouchEventHandler(node()); 2077 EventHandlerRegistry::from(document())->didAddEventHandler(*node(), EventTypeNames::touchstart);
2077 else 2078 else
2078 document().didRemoveTouchEventHandler(node()); 2079 EventHandlerRegistry::from(document())->didRemoveEventHandler(*node( ), EventTypeNames::touchstart);
2079 } 2080 }
2080 } 2081 }
2081 2082
2082 static bool areNonIdenticalCursorListsEqual(const RenderStyle* a, const RenderSt yle* b) 2083 static bool areNonIdenticalCursorListsEqual(const RenderStyle* a, const RenderSt yle* b)
2083 { 2084 {
2084 ASSERT(a->cursors() != b->cursors()); 2085 ASSERT(a->cursors() != b->cursors());
2085 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors(); 2086 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors();
2086 } 2087 }
2087 2088
2088 static inline bool areCursorsEqual(const RenderStyle* a, const RenderStyle* b) 2089 static inline bool areCursorsEqual(const RenderStyle* a, const RenderStyle* b)
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
2603 // this renderer had no parent at the time remove() was called. 2604 // this renderer had no parent at the time remove() was called.
2604 2605
2605 if (hasCounterNodeMap()) 2606 if (hasCounterNodeMap())
2606 RenderCounter::destroyCounterNodes(*this); 2607 RenderCounter::destroyCounterNodes(*this);
2607 2608
2608 // Remove the handler if node had touch-action set. Don't call when 2609 // Remove the handler if node had touch-action set. Don't call when
2609 // document is being destroyed as all handlers will have been cleared 2610 // document is being destroyed as all handlers will have been cleared
2610 // previously. Handlers are not added for text nodes so don't try removing 2611 // previously. Handlers are not added for text nodes so don't try removing
2611 // for one too. Need to check if m_style is null in cases of partial constru ction. 2612 // for one too. Need to check if m_style is null in cases of partial constru ction.
2612 if (!documentBeingDestroyed() && node() && !node()->isTextNode() && m_style && m_style->touchAction() != TouchActionAuto) 2613 if (!documentBeingDestroyed() && node() && !node()->isTextNode() && m_style && m_style->touchAction() != TouchActionAuto)
2613 document().didRemoveTouchEventHandler(node()); 2614 EventHandlerRegistry::from(document())->didRemoveEventHandler(*node(), E ventTypeNames::touchstart);
2614 2615
2615 setAncestorLineBoxDirty(false); 2616 setAncestorLineBoxDirty(false);
2616 2617
2617 clearLayoutRootIfNeeded(); 2618 clearLayoutRootIfNeeded();
2618 } 2619 }
2619 2620
2620 void RenderObject::insertedIntoTree() 2621 void RenderObject::insertedIntoTree()
2621 { 2622 {
2622 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion. 2623 // FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion.
2623 2624
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
3408 { 3409 {
3409 if (object1) { 3410 if (object1) {
3410 const WebCore::RenderObject* root = object1; 3411 const WebCore::RenderObject* root = object1;
3411 while (root->parent()) 3412 while (root->parent())
3412 root = root->parent(); 3413 root = root->parent();
3413 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3414 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3414 } 3415 }
3415 } 3416 }
3416 3417
3417 #endif 3418 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698