Commit ceaabaee authored by rniwa@webkit.org's avatar rniwa@webkit.org

Cleanup Document::dispatchFullScreenChangeOrErrorEvent

https://bugs.webkit.org/show_bug.cgi?id=122143

Reviewed by Antti Koivisto.

Reduce the code duplication by extracting dispatchFullScreenChangeOrErrorEvent.

* dom/Document.cpp:
(WebCore::Document::fullScreenChangeDelayTimerFired):
(WebCore::Document::dispatchFullScreenChangeOrErrorEvent): Extracted.
* dom/Document.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156733 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6f540b20
2013-10-01 Ryosuke Niwa <rniwa@webkit.org>
Cleanup Document::dispatchFullScreenChangeOrErrorEvent
https://bugs.webkit.org/show_bug.cgi?id=122143
Reviewed by Antti Koivisto.
Reduce the code duplication by extracting dispatchFullScreenChangeOrErrorEvent.
* dom/Document.cpp:
(WebCore::Document::fullScreenChangeDelayTimerFired):
(WebCore::Document::dispatchFullScreenChangeOrErrorEvent): Extracted.
* dom/Document.h:
2013-10-01 Brent Fulgham <bfulgham@apple.com>
[Win] Implement the media controls in JavaScript
......@@ -5387,9 +5387,14 @@ void Document::fullScreenChangeDelayTimerFired(Timer<Document>*)
m_fullScreenChangeEventTargetQueue.swap(changeQueue);
Deque<RefPtr<Node> > errorQueue;
m_fullScreenErrorEventTargetQueue.swap(errorQueue);
dispatchFullScreenChangeOrErrorEvent(changeQueue, eventNames().webkitfullscreenchangeEvent);
dispatchFullScreenChangeOrErrorEvent(errorQueue, eventNames().webkitfullscreenerrorEvent);
}
while (!changeQueue.isEmpty()) {
RefPtr<Node> node = changeQueue.takeFirst();
void Document::dispatchFullScreenChangeOrErrorEvent(Deque<RefPtr<Node>>& queue, const AtomicString& eventName)
{
while (!queue.isEmpty()) {
RefPtr<Node> node = queue.takeFirst();
if (!node)
node = documentElement();
// The dispatchEvent below may have blown away our documentElement.
......@@ -5398,26 +5403,10 @@ void Document::fullScreenChangeDelayTimerFired(Timer<Document>*)
// If the element was removed from our tree, also message the documentElement. Since we may
// have a document hierarchy, check that node isn't in another document.
if (!contains(node.get()) && !node->inDocument())
changeQueue.append(documentElement());
node->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEvent, true, false));
}
if (!node->inDocument())
queue.append(documentElement());
while (!errorQueue.isEmpty()) {
RefPtr<Node> node = errorQueue.takeFirst();
if (!node)
node = documentElement();
// The dispatchEvent below may have blown away our documentElement.
if (!node)
continue;
// If the element was removed from our tree, also message the documentElement. Since we may
// have a document hierarchy, check that node isn't in another document.
if (!contains(node.get()) && !node->inDocument())
errorQueue.append(documentElement());
node->dispatchEvent(Event::create(eventNames().webkitfullscreenerrorEvent, true, false));
node->dispatchEvent(Event::create(eventName, true, false));
}
}
......
......@@ -1253,6 +1253,7 @@ private:
PassRefPtr<HTMLCollection> ensureCachedCollection(CollectionType);
#if ENABLE(FULLSCREEN_API)
void dispatchFullScreenChangeOrErrorEvent(Deque<RefPtr<Node>>&, const AtomicString& eventName);
void clearFullscreenElementStack();
void popFullscreenElementStack();
void pushFullscreenElementStack(Element*);
......@@ -1473,8 +1474,8 @@ private:
Vector<RefPtr<Element> > m_fullScreenElementStack;
RenderFullScreen* m_fullScreenRenderer;
Timer<Document> m_fullScreenChangeDelayTimer;
Deque<RefPtr<Node> > m_fullScreenChangeEventTargetQueue;
Deque<RefPtr<Node> > m_fullScreenErrorEventTargetQueue;
Deque<RefPtr<Node>> m_fullScreenChangeEventTargetQueue;
Deque<RefPtr<Node>> m_fullScreenErrorEventTargetQueue;
bool m_isAnimatingFullScreen;
LayoutRect m_savedPlaceholderFrameRect;
RefPtr<RenderStyle> m_savedPlaceholderRenderStyle;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment