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, roundedIntPoint(points[0].pos()), ignorePo
interEventsNone); | 180 return hoveredNodeForPoint(frame, roundedIntPoint(points[0].pos()), ignorePo
interEventsNone); |
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 WillBePersistentHeapHashSet<RefPtrWillBeMember<Element> > m_elements; | 195 WillBeHeapHashSet<RefPtrWillBeMember<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 WillBeHeapVector<RawPtrWillBeMember<Element> > elements; | 214 WillBeHeapVector<RawPtrWillBeMember<Element> > elements; |
214 for (WillBePersistentHeapHashSet<RefPtrWillBeMember<Element> >::iterator it
= m_elements.begin(), end = m_elements.end(); it != end; ++it) | 215 for (WillBePersistentHeapHashSet<RefPtrWillBeMember<Element> >::iterator it
= m_elements.begin(), end = m_elements.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 visitor->trace(m_elements); |
| 226 } |
| 227 |
221 String InspectorDOMAgent::toErrorString(ExceptionState& exceptionState) | 228 String InspectorDOMAgent::toErrorString(ExceptionState& exceptionState) |
222 { | 229 { |
223 if (exceptionState.hadException()) | 230 if (exceptionState.hadException()) |
224 return DOMException::getErrorName(exceptionState.code()) + " " + excepti
onState.message(); | 231 return DOMException::getErrorName(exceptionState.code()) + " " + excepti
onState.message(); |
225 return ""; | 232 return ""; |
226 } | 233 } |
227 | 234 |
228 InspectorDOMAgent::InspectorDOMAgent(InspectorPageAgent* pageAgent, InjectedScri
ptManager* injectedScriptManager, InspectorOverlay* overlay) | 235 InspectorDOMAgent::InspectorDOMAgent(InspectorPageAgent* pageAgent, InjectedScri
ptManager* injectedScriptManager, InspectorOverlay* overlay) |
229 : InspectorBaseAgent<InspectorDOMAgent>("DOM") | 236 : InspectorBaseAgent<InspectorDOMAgent>("DOM") |
230 , m_pageAgent(pageAgent) | 237 , m_pageAgent(pageAgent) |
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 } | 1912 } |
1906 | 1913 |
1907 void InspectorDOMAgent::didInvalidateStyleAttr(Node* node) | 1914 void InspectorDOMAgent::didInvalidateStyleAttr(Node* node) |
1908 { | 1915 { |
1909 int id = m_documentNodeToIdMap->get(node); | 1916 int id = m_documentNodeToIdMap->get(node); |
1910 // If node is not mapped yet -> ignore the event. | 1917 // If node is not mapped yet -> ignore the event. |
1911 if (!id) | 1918 if (!id) |
1912 return; | 1919 return; |
1913 | 1920 |
1914 if (!m_revalidateStyleAttrTask) | 1921 if (!m_revalidateStyleAttrTask) |
1915 m_revalidateStyleAttrTask = adoptPtr(new RevalidateStyleAttributeTask(th
is)); | 1922 m_revalidateStyleAttrTask = adoptPtrWillBeNoop(new RevalidateStyleAttrib
uteTask(this)); |
1916 m_revalidateStyleAttrTask->scheduleFor(toElement(node)); | 1923 m_revalidateStyleAttrTask->scheduleFor(toElement(node)); |
1917 } | 1924 } |
1918 | 1925 |
1919 void InspectorDOMAgent::didPushShadowRoot(Element* host, ShadowRoot* root) | 1926 void InspectorDOMAgent::didPushShadowRoot(Element* host, ShadowRoot* root) |
1920 { | 1927 { |
1921 if (!host->ownerDocument()) | 1928 if (!host->ownerDocument()) |
1922 return; | 1929 return; |
1923 | 1930 |
1924 int hostId = m_documentNodeToIdMap->get(host); | 1931 int hostId = m_documentNodeToIdMap->get(host); |
1925 if (!hostId) | 1932 if (!hostId) |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 void InspectorDOMAgent::trace(Visitor* visitor) | 2111 void InspectorDOMAgent::trace(Visitor* visitor) |
2105 { | 2112 { |
2106 visitor->trace(m_pageAgent); | 2113 visitor->trace(m_pageAgent); |
2107 #if ENABLE(OILPAN) | 2114 #if ENABLE(OILPAN) |
2108 visitor->trace(m_documentNodeToIdMap); | 2115 visitor->trace(m_documentNodeToIdMap); |
2109 visitor->trace(m_danglingNodeToIdMaps); | 2116 visitor->trace(m_danglingNodeToIdMaps); |
2110 visitor->trace(m_idToNode); | 2117 visitor->trace(m_idToNode); |
2111 #endif | 2118 #endif |
2112 visitor->trace(m_idToNodesMap); | 2119 visitor->trace(m_idToNodesMap); |
2113 visitor->trace(m_document); | 2120 visitor->trace(m_document); |
| 2121 visitor->trace(m_revalidateStyleAttrTask); |
2114 visitor->trace(m_searchResults); | 2122 visitor->trace(m_searchResults); |
2115 visitor->trace(m_history); | 2123 visitor->trace(m_history); |
2116 visitor->trace(m_domEditor); | 2124 visitor->trace(m_domEditor); |
2117 InspectorBaseAgent::trace(visitor); | 2125 InspectorBaseAgent::trace(visitor); |
2118 } | 2126 } |
2119 | 2127 |
2120 } // namespace WebCore | 2128 } // namespace WebCore |
2121 | 2129 |
OLD | NEW |