OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 | 174 |
175 static Node* hoveredNodeForEvent(LocalFrame* frame, const PlatformTouchEvent& ev
ent, bool ignorePointerEventsNone) | 175 static Node* hoveredNodeForEvent(LocalFrame* frame, const PlatformTouchEvent& ev
ent, bool ignorePointerEventsNone) |
176 { | 176 { |
177 const Vector<PlatformTouchPoint>& points = event.touchPoints(); | 177 const Vector<PlatformTouchPoint>& points = event.touchPoints(); |
178 if (!points.size()) | 178 if (!points.size()) |
179 return 0; | 179 return 0; |
180 return hoveredNodeForPoint(frame, points[0].pos(), ignorePointerEventsNone); | 180 return hoveredNodeForPoint(frame, points[0].pos(), ignorePointerEventsNone); |
181 } | 181 } |
182 | 182 |
183 class RevalidateStyleAttributeTask { | 183 class RevalidateStyleAttributeTask : public NoBaseWillBeGarbageCollectedFinalize
d<RevalidateStyleAttributeTask> { |
184 WTF_MAKE_FAST_ALLOCATED; | 184 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
185 public: | 185 public: |
186 RevalidateStyleAttributeTask(InspectorDOMAgent*); | 186 RevalidateStyleAttributeTask(InspectorDOMAgent*); |
187 void scheduleFor(Element*); | 187 void scheduleFor(Element*); |
188 void reset() { m_timer.stop(); } | 188 void reset() { m_timer.stop(); } |
189 void onTimer(Timer<RevalidateStyleAttributeTask>*); | 189 void onTimer(Timer<RevalidateStyleAttributeTask>*); |
| 190 void trace(Visitor*); |
190 | 191 |
191 private: | 192 private: |
192 InspectorDOMAgent* m_domAgent; | 193 RawPtrWillBeMember<InspectorDOMAgent> m_domAgent; |
193 Timer<RevalidateStyleAttributeTask> m_timer; | 194 Timer<RevalidateStyleAttributeTask> m_timer; |
194 HashSet<RefPtr<Element> > m_elements; | 195 HashSet<RefPtr<Element> > m_elements; |
195 }; | 196 }; |
196 | 197 |
197 RevalidateStyleAttributeTask::RevalidateStyleAttributeTask(InspectorDOMAgent* do
mAgent) | 198 RevalidateStyleAttributeTask::RevalidateStyleAttributeTask(InspectorDOMAgent* do
mAgent) |
198 : m_domAgent(domAgent) | 199 : m_domAgent(domAgent) |
199 , m_timer(this, &RevalidateStyleAttributeTask::onTimer) | 200 , m_timer(this, &RevalidateStyleAttributeTask::onTimer) |
200 { | 201 { |
201 } | 202 } |
202 | 203 |
203 void RevalidateStyleAttributeTask::scheduleFor(Element* element) | 204 void RevalidateStyleAttributeTask::scheduleFor(Element* element) |
204 { | 205 { |
205 m_elements.add(element); | 206 m_elements.add(element); |
206 if (!m_timer.isActive()) | 207 if (!m_timer.isActive()) |
207 m_timer.startOneShot(0, FROM_HERE); | 208 m_timer.startOneShot(0, FROM_HERE); |
208 } | 209 } |
209 | 210 |
210 void RevalidateStyleAttributeTask::onTimer(Timer<RevalidateStyleAttributeTask>*) | 211 void RevalidateStyleAttributeTask::onTimer(Timer<RevalidateStyleAttributeTask>*) |
211 { | 212 { |
212 // The timer is stopped on m_domAgent destruction, so this method will never
be called after m_domAgent has been destroyed. | 213 // The timer is stopped on m_domAgent destruction, so this method will never
be called after m_domAgent has been destroyed. |
213 Vector<Element*> elements; | 214 Vector<Element*> elements; |
214 for (HashSet<RefPtr<Element> >::iterator it = m_elements.begin(), end = m_el
ements.end(); it != end; ++it) | 215 for (HashSet<RefPtr<Element> >::iterator it = m_elements.begin(), end = m_el
ements.end(); it != end; ++it) |
215 elements.append(it->get()); | 216 elements.append(it->get()); |
216 m_domAgent->styleAttributeInvalidated(elements); | 217 m_domAgent->styleAttributeInvalidated(elements); |
217 | 218 |
218 m_elements.clear(); | 219 m_elements.clear(); |
219 } | 220 } |
220 | 221 |
| 222 void RevalidateStyleAttributeTask::trace(Visitor* visitor) |
| 223 { |
| 224 visitor->trace(m_domAgent); |
| 225 } |
| 226 |
221 String InspectorDOMAgent::toErrorString(ExceptionState& exceptionState) | 227 String InspectorDOMAgent::toErrorString(ExceptionState& exceptionState) |
222 { | 228 { |
223 if (exceptionState.hadException()) | 229 if (exceptionState.hadException()) |
224 return DOMException::getErrorName(exceptionState.code()) + " " + excepti
onState.message(); | 230 return DOMException::getErrorName(exceptionState.code()) + " " + excepti
onState.message(); |
225 return ""; | 231 return ""; |
226 } | 232 } |
227 | 233 |
228 InspectorDOMAgent::InspectorDOMAgent(InspectorPageAgent* pageAgent, InjectedScri
ptManager* injectedScriptManager, InspectorOverlay* overlay) | 234 InspectorDOMAgent::InspectorDOMAgent(InspectorPageAgent* pageAgent, InjectedScri
ptManager* injectedScriptManager, InspectorOverlay* overlay) |
229 : InspectorBaseAgent<InspectorDOMAgent>("DOM") | 235 : InspectorBaseAgent<InspectorDOMAgent>("DOM") |
230 , m_pageAgent(pageAgent) | 236 , m_pageAgent(pageAgent) |
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 } | 1879 } |
1874 | 1880 |
1875 void InspectorDOMAgent::didInvalidateStyleAttr(Node* node) | 1881 void InspectorDOMAgent::didInvalidateStyleAttr(Node* node) |
1876 { | 1882 { |
1877 int id = m_documentNodeToIdMap.get(node); | 1883 int id = m_documentNodeToIdMap.get(node); |
1878 // If node is not mapped yet -> ignore the event. | 1884 // If node is not mapped yet -> ignore the event. |
1879 if (!id) | 1885 if (!id) |
1880 return; | 1886 return; |
1881 | 1887 |
1882 if (!m_revalidateStyleAttrTask) | 1888 if (!m_revalidateStyleAttrTask) |
1883 m_revalidateStyleAttrTask = adoptPtr(new RevalidateStyleAttributeTask(th
is)); | 1889 m_revalidateStyleAttrTask = adoptPtrWillBeNoop(new RevalidateStyleAttrib
uteTask(this)); |
1884 m_revalidateStyleAttrTask->scheduleFor(toElement(node)); | 1890 m_revalidateStyleAttrTask->scheduleFor(toElement(node)); |
1885 } | 1891 } |
1886 | 1892 |
1887 void InspectorDOMAgent::didPushShadowRoot(Element* host, ShadowRoot* root) | 1893 void InspectorDOMAgent::didPushShadowRoot(Element* host, ShadowRoot* root) |
1888 { | 1894 { |
1889 if (!host->ownerDocument()) | 1895 if (!host->ownerDocument()) |
1890 return; | 1896 return; |
1891 | 1897 |
1892 int hostId = m_documentNodeToIdMap.get(host); | 1898 int hostId = m_documentNodeToIdMap.get(host); |
1893 if (!hostId) | 1899 if (!hostId) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt
ring) | 2067 bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt
ring) |
2062 { | 2068 { |
2063 if (!m_documentNodeToIdMap.contains(m_document)) { | 2069 if (!m_documentNodeToIdMap.contains(m_document)) { |
2064 RefPtr<TypeBuilder::DOM::Node> root; | 2070 RefPtr<TypeBuilder::DOM::Node> root; |
2065 getDocument(errorString, root); | 2071 getDocument(errorString, root); |
2066 return errorString->isEmpty(); | 2072 return errorString->isEmpty(); |
2067 } | 2073 } |
2068 return true; | 2074 return true; |
2069 } | 2075 } |
2070 | 2076 |
| 2077 void InspectorDOMAgent::trace(Visitor* visitor) |
| 2078 { |
| 2079 visitor->trace(m_pageAgent); |
| 2080 visitor->trace(m_revalidateStyleAttrTask); |
| 2081 visitor->trace(m_history); |
| 2082 visitor->trace(m_domEditor); |
| 2083 InspectorBaseAgent::trace(visitor); |
| 2084 } |
| 2085 |
2071 } // namespace WebCore | 2086 } // namespace WebCore |
2072 | 2087 |
OLD | NEW |