Changeset 89007 in webkit
- Timestamp:
- Jun 15, 2011 11:15:29 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r89006 r89007 1 2011-06-15 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Remove Event::fromUserGesture 6 https://bugs.webkit.org/show_bug.cgi?id=62778 7 8 This function is a remnant from the old user-gesture design. The list 9 of events here is redundant with our selection of call sites for 10 setting the user gesture indicator. 11 12 As part of this patch, I've also cleaned up the implementation of 13 UserGestureIndicator itself to always be definite about whether we're 14 processing a user gesture. We now start out in a definite state (no 15 user gesture) and inductively state in a definite state. 16 17 * WebCore.exp.in: 18 * bindings/js/ScriptController.cpp: 19 (WebCore::ScriptController::processingUserGesture): 20 * bindings/v8/ScriptController.cpp: 21 (WebCore::ScriptController::processingUserGesture): 22 * dom/Event.cpp: 23 * dom/Event.h: 24 * dom/UserGestureIndicator.cpp: 25 (WebCore::isDefinite): 26 (WebCore::UserGestureIndicator::UserGestureIndicator): 27 (WebCore::UserGestureIndicator::~UserGestureIndicator): 28 * dom/UserGestureIndicator.h: 29 (WebCore::UserGestureIndicator::processingUserGesture): 30 * html/MediaDocument.cpp: 31 (WebCore::MediaDocument::defaultEventHandler): 32 * html/shadow/MediaControlElements.cpp: 33 (WebCore::MediaControlSeekButtonElement::defaultEventHandler): 34 * html/shadow/TextControlInnerElements.cpp: 35 (WebCore::InputFieldSpeechButtonElement::defaultEventHandler): 36 1 37 2011-06-08 Keishi Hattori <keishi@webkit.org> 2 38 -
trunk/Source/WebCore/WebCore.exp.in
r88737 r89007 543 543 __ZN7WebCore20ResourceResponseBaseC2Ev 544 544 __ZN7WebCore20SpaceSplitStringData12createVectorEv 545 __ZN7WebCore20UserGestureIndicator 23s_processingUserGestureE545 __ZN7WebCore20UserGestureIndicator7s_stateE 546 546 __ZN7WebCore20UserGestureIndicatorC1ENS_26ProcessingUserGestureStateE 547 547 __ZN7WebCore20UserGestureIndicatorD1Ev -
trunk/Source/WebCore/bindings/js/ScriptController.cpp
r89005 r89007 244 244 bool ScriptController::processingUserGesture() 245 245 { 246 ExecState* exec = JSMainThreadExecState::currentState();247 Frame* frame = exec ? toDynamicFrame(exec) : 0;248 // No script is running, so it is user-initiated unless the gesture stack249 // explicitly says it is not.250 if (!frame)251 return UserGestureIndicator::getUserGestureState() != DefinitelyNotProcessingUserGesture;252 253 // If a DOM event is being processed, check that it was initiated by the user254 // and that it is in the whitelist of event types allowed to generate pop-ups.255 if (JSDOMWindowShell* shell = frame->script()->existingWindowShell(currentWorld(exec)))256 if (Event* event = shell->window()->currentEvent())257 return event->fromUserGesture();258 259 246 return UserGestureIndicator::processingUserGesture(); 260 247 } -
trunk/Source/WebCore/bindings/v8/ScriptController.cpp
r89005 r89007 154 154 bool ScriptController::processingUserGesture() 155 155 { 156 Frame* firstFrame = V8Proxy::retrieveFrameForEnteredContext();157 if (!firstFrame)158 return UserGestureIndicator::getUserGestureState() != DefinitelyNotProcessingUserGesture;159 160 v8::HandleScope handleScope;161 v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(firstFrame);162 if (v8Context.IsEmpty())163 return true;164 v8::Context::Scope scope(v8Context);165 v8::Handle<v8::Object> global = v8Context->Global();166 v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event();167 v8::Handle<v8::Value> jsEvent = global->GetHiddenValue(eventSymbol);168 Event* event = V8DOMWrapper::isValidDOMObject(jsEvent) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(jsEvent)) : 0;169 if (event)170 return event->fromUserGesture();171 172 156 return UserGestureIndicator::processingUserGesture(); 173 157 } -
trunk/Source/WebCore/dom/Event.cpp
r88343 r89007 258 258 #endif 259 259 260 bool Event::fromUserGesture()261 {262 if (!UserGestureIndicator::processingUserGesture())263 return false;264 265 const AtomicString& type = this->type();266 return267 // mouse events268 type == eventNames().clickEvent || type == eventNames().mousedownEvent269 || type == eventNames().mouseupEvent || type == eventNames().dblclickEvent270 // keyboard events271 || type == eventNames().keydownEvent || type == eventNames().keypressEvent272 || type == eventNames().keyupEvent273 #if ENABLE(TOUCH_EVENTS)274 // touch events275 || type == eventNames().touchstartEvent || type == eventNames().touchmoveEvent276 || type == eventNames().touchendEvent || type == eventNames().touchcancelEvent277 #endif278 // other accepted events279 || type == eventNames().selectEvent || type == eventNames().changeEvent280 || type == eventNames().focusEvent || type == eventNames().blurEvent281 || type == eventNames().submitEvent;282 }283 284 260 bool Event::storesResultAsString() const 285 261 { -
trunk/Source/WebCore/dom/Event.h
r88343 r89007 151 151 virtual bool isStreamEvent() const; 152 152 #endif 153 bool fromUserGesture();154 155 153 bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; } 156 154 bool immediatePropagationStopped() const { return m_immediatePropagationStopped; } -
trunk/Source/WebCore/dom/UserGestureIndicator.cpp
r59462 r89007 29 29 namespace WebCore { 30 30 31 ProcessingUserGestureState UserGestureIndicator::s_processingUserGesture = PossiblyProcessingUserGesture; 31 static bool isDefinite(ProcessingUserGestureState state) 32 { 33 return state == DefinitelyProcessingUserGesture || state == DefinitelyNotProcessingUserGesture; 34 } 35 36 ProcessingUserGestureState UserGestureIndicator::s_state = DefinitelyNotProcessingUserGesture; 32 37 33 38 UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state) 34 : m_previous Value(s_processingUserGesture)39 : m_previousState(s_state) 35 40 { 36 s_processingUserGesture = state; 41 // We overwrite s_state only if the caller is definite about the gesture state. 42 if (isDefinite(state)) 43 s_state = state; 44 ASSERT(isDefinite(s_state)); 37 45 } 38 46 39 47 UserGestureIndicator::~UserGestureIndicator() 40 48 { 41 s_processingUserGesture = m_previousValue; 49 s_state = m_previousState; 50 ASSERT(isDefinite(s_state)); 42 51 } 43 52 44 } // namespace WebCore53 } -
trunk/Source/WebCore/dom/UserGestureIndicator.h
r76248 r89007 40 40 WTF_MAKE_NONCOPYABLE(UserGestureIndicator); 41 41 public: 42 static bool processingUserGesture() { return s_processingUserGesture == DefinitelyProcessingUserGesture; } 43 static ProcessingUserGestureState getUserGestureState() { return s_processingUserGesture; } 42 static bool processingUserGesture() { return s_state == DefinitelyProcessingUserGesture; } 44 43 45 44 explicit UserGestureIndicator(ProcessingUserGestureState); … … 47 46 48 47 private: 49 static ProcessingUserGestureState s_ processingUserGesture;50 ProcessingUserGestureState m_previous Value;51 }; 48 static ProcessingUserGestureState s_state; 49 ProcessingUserGestureState m_previousState; 50 }; 52 51 53 } // namespace WebCore52 } 54 53 55 #endif // UserGestureIndicator_h54 #endif -
trunk/Source/WebCore/html/MediaDocument.cpp
r88623 r89007 41 41 #include "NodeList.h" 42 42 #include "RawDataDocumentParser.h" 43 #include "ScriptController.h" 43 44 44 45 namespace WebCore { … … 165 166 if (event->type() == eventNames().clickEvent) { 166 167 if (!video->canPlay()) { 167 video->pause( event->fromUserGesture());168 video->pause(ScriptController::processingUserGesture()); 168 169 event->setDefaultHandled(); 169 170 } 170 171 } else if (event->type() == eventNames().dblclickEvent) { 171 172 if (video->canPlay()) { 172 video->play( event->fromUserGesture());173 video->play(ScriptController::processingUserGesture()); 173 174 event->setDefaultHandled(); 174 175 } … … 185 186 if (video->paused()) { 186 187 if (video->canPlay()) 187 video->play( event->fromUserGesture());188 video->play(ScriptController::processingUserGesture()); 188 189 } else 189 video->pause( event->fromUserGesture());190 video->pause(ScriptController::processingUserGesture()); 190 191 event->setDefaultHandled(); 191 192 } -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r88952 r89007 48 48 #include "RenderTheme.h" 49 49 #include "RenderView.h" 50 #include "ScriptController.h" 50 51 #include "Settings.h" 51 52 … … 548 549 frame->eventHandler()->setCapturingMouseEventsNode(this); 549 550 } 550 mediaElement()->pause( event->fromUserGesture());551 mediaElement()->pause(ScriptController::processingUserGesture()); 551 552 m_seekTimer.startRepeating(cSeekRepeatDelay); 552 553 event->setDefaultHandled(); -
trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp
r88216 r89007 40 40 #include "RenderLayer.h" 41 41 #include "RenderTextControlSingleLine.h" 42 #include "ScriptController.h" 42 43 #include "ScrollbarTheme.h" 43 44 #include "SpeechInput.h" … … 389 390 { 390 391 // For privacy reasons, only allow clicks directly coming from the user. 391 if (! event->fromUserGesture()) {392 if (!ScriptController::processingUserGesture()) { 392 393 HTMLDivElement::defaultEventHandler(event); 393 394 return; -
trunk/Source/WebKit/chromium/ChangeLog
r88988 r89007 1 2011-06-15 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Remove Event::fromUserGesture 6 https://bugs.webkit.org/show_bug.cgi?id=62778 7 8 This call site is not definite about there not being a user gesture. 9 10 * src/WebPluginContainerImpl.cpp: 11 (WebKit::WebPluginContainerImpl::loadFrameRequest): 12 1 13 2011-06-15 Darin Adler <darin@apple.com> 2 14 -
trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
r86067 r89007 366 366 } 367 367 368 void WebPluginContainerImpl::loadFrameRequest( 369 const WebURLRequest& request, const WebString& target, bool notifyNeeded, void* notifyData) 368 void WebPluginContainerImpl::loadFrameRequest(const WebURLRequest& request, const WebString& target, bool notifyNeeded, void* notifyData) 370 369 { 371 370 Frame* frame = m_element->document()->frame(); … … 383 382 } 384 383 385 FrameLoadRequest frameRequest(frame->document()->securityOrigin(), 386 request.toResourceRequest(), target); 387 388 UserGestureIndicator gestureIndicator(request.hasUserGesture() ? 389 DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture); 390 391 frame->loader()->loadFrameRequest( 392 frameRequest, 393 false, // lock history 394 false, // lock back forward list 395 0, // event 396 0, // form state 397 SendReferrer); 384 FrameLoadRequest frameRequest(frame->document()->securityOrigin(), request.toResourceRequest(), target); 385 UserGestureIndicator gestureIndicator(request.hasUserGesture() ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture); 386 frame->loader()->loadFrameRequest(frameRequest, false, false, 0, 0, SendReferrer); 398 387 } 399 388
Note: See TracChangeset
for help on using the changeset viewer.