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

Side by Side Diff: Source/core/dom/ProcessingInstruction.h

Issue 738443003: Have ProcessingInstruction's XSLT event listener keep a weak backreference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename ProcessingInstruction local interface class Created 6 years, 1 month 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
« no previous file with comments | « no previous file | Source/core/dom/ProcessingInstruction.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2006 Apple Inc. All rights reserved. 3 * Copyright (C) 2006 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 StyleSheet* sheet() const { return m_sheet.get(); } 48 StyleSheet* sheet() const { return m_sheet.get(); }
49 void setCSSStyleSheet(PassRefPtrWillBeRawPtr<CSSStyleSheet>); 49 void setCSSStyleSheet(PassRefPtrWillBeRawPtr<CSSStyleSheet>);
50 50
51 bool isCSS() const { return m_isCSS; } 51 bool isCSS() const { return m_isCSS; }
52 bool isXSL() const { return m_isXSL; } 52 bool isXSL() const { return m_isXSL; }
53 53
54 void didAttributeChanged(); 54 void didAttributeChanged();
55 bool isLoading() const; 55 bool isLoading() const;
56 56
57 // For XSLT 57 // For XSLT
58 void setEventListenerForXSLT(PassRefPtr<EventListener> listener) { m_listene rForXSLT = listener; } 58 class DetachableEventListener {
59 EventListener* eventListenerForXSLT() { return m_listenerForXSLT.get(); } 59 public:
60 void clearEventListenerForXSLT() { m_listenerForXSLT.clear(); } 60 virtual ~DetachableEventListener() { }
61
62 void ref() { refDetachableEventListener(); }
63 void deref() { derefDetachableEventListener(); }
64
65 virtual EventListener* toEventListener() = 0;
66
67 // Detach event listener from its processing instruction.
68 virtual void detach() = 0;
69
70 private:
71 virtual void refDetachableEventListener() = 0;
72 virtual void derefDetachableEventListener() = 0;
73 };
74
75 void setEventListenerForXSLT(PassRefPtr<DetachableEventListener> listener) { m_listenerForXSLT = listener; }
76 EventListener* eventListenerForXSLT();
77 void clearEventListenerForXSLT();
61 78
62 private: 79 private:
63 ProcessingInstruction(Document&, const String& target, const String& data); 80 ProcessingInstruction(Document&, const String& target, const String& data);
64 81
65 virtual String nodeName() const override; 82 virtual String nodeName() const override;
66 virtual NodeType nodeType() const override; 83 virtual NodeType nodeType() const override;
67 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) override; 84 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) override;
68 85
69 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; 86 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override;
70 virtual void removedFrom(ContainerNode*) override; 87 virtual void removedFrom(ContainerNode*) override;
(...skipping 13 matching lines...) Expand all
84 String m_localHref; 101 String m_localHref;
85 String m_title; 102 String m_title;
86 String m_media; 103 String m_media;
87 RefPtrWillBeMember<StyleSheet> m_sheet; 104 RefPtrWillBeMember<StyleSheet> m_sheet;
88 bool m_loading; 105 bool m_loading;
89 bool m_alternate; 106 bool m_alternate;
90 bool m_createdByParser; 107 bool m_createdByParser;
91 bool m_isCSS; 108 bool m_isCSS;
92 bool m_isXSL; 109 bool m_isXSL;
93 110
94 RefPtr<EventListener> m_listenerForXSLT; 111 RefPtr<DetachableEventListener> m_listenerForXSLT;
95 }; 112 };
96 113
97 DEFINE_NODE_TYPE_CASTS(ProcessingInstruction, nodeType() == Node::PROCESSING_INS TRUCTION_NODE); 114 DEFINE_NODE_TYPE_CASTS(ProcessingInstruction, nodeType() == Node::PROCESSING_INS TRUCTION_NODE);
98 115
99 inline bool isXSLStyleSheet(const Node& node) 116 inline bool isXSLStyleSheet(const Node& node)
100 { 117 {
101 return node.nodeType() == Node::PROCESSING_INSTRUCTION_NODE && toProcessingI nstruction(node).isXSL(); 118 return node.nodeType() == Node::PROCESSING_INSTRUCTION_NODE && toProcessingI nstruction(node).isXSL();
102 } 119 }
103 120
104 } // namespace blink 121 } // namespace blink
105 122
106 #endif // ProcessingInstruction_h 123 #endif // ProcessingInstruction_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/ProcessingInstruction.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698