OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights
reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 // We must make sure not to be retaining any of our children through | 626 // We must make sure not to be retaining any of our children through |
627 // these extra pointers or we will create a reference cycle. | 627 // these extra pointers or we will create a reference cycle. |
628 m_docType = 0; | 628 m_docType = 0; |
629 m_focusedNode = 0; | 629 m_focusedNode = 0; |
630 m_hoverNode = 0; | 630 m_hoverNode = 0; |
631 m_activeNode = 0; | 631 m_activeNode = 0; |
632 m_titleElement = 0; | 632 m_titleElement = 0; |
633 m_documentElement = 0; | 633 m_documentElement = 0; |
634 #if ENABLE(FULLSCREEN_API) | 634 #if ENABLE(FULLSCREEN_API) |
635 m_fullScreenElement = 0; | 635 m_fullScreenElement = 0; |
636 m_fullScreenElementStack.clear(); | |
637 #endif | 636 #endif |
638 | 637 |
639 // removeAllChildren() doesn't always unregister IDs, | 638 // removeAllChildren() doesn't always unregister IDs, |
640 // so tear down scope information upfront to avoid having stale referenc
es in the map. | 639 // so tear down scope information upfront to avoid having stale referenc
es in the map. |
641 destroyTreeScopeData(); | 640 destroyTreeScopeData(); |
642 removeAllChildren(); | 641 removeAllChildren(); |
643 | 642 |
644 m_markers->detach(); | 643 m_markers->detach(); |
645 | 644 |
646 detachParser(); | 645 detachParser(); |
(...skipping 4481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5128 | 5127 |
5129 if (!static_cast<HTMLFrameElementBase*>(ownerElement)->allowFullScreen()
) | 5128 if (!static_cast<HTMLFrameElementBase*>(ownerElement)->allowFullScreen()
) |
5130 return false; | 5129 return false; |
5131 element = ownerElement; | 5130 element = ownerElement; |
5132 } | 5131 } |
5133 return true; | 5132 return true; |
5134 } | 5133 } |
5135 | 5134 |
5136 void Document::requestFullScreenForElement(Element* element, unsigned short flag
s, FullScreenCheckType checkType) | 5135 void Document::requestFullScreenForElement(Element* element, unsigned short flag
s, FullScreenCheckType checkType) |
5137 { | 5136 { |
5138 // The Mozilla Full Screen API <https://wiki.mozilla.org/Gecko:FullScreenAPI
> has different requirements | 5137 do { |
5139 // for full screen mode, and do not have the concept of a full screen elemen
t stack. | 5138 if (!page() || !page()->settings()->fullScreenEnabled()) |
5140 bool inLegacyMozillaMode = (flags & Element::LEGACY_MOZILLA_REQUEST); | 5139 break; |
5141 | 5140 |
5142 do { | |
5143 if (!element) | 5141 if (!element) |
5144 element = documentElement(); | 5142 element = documentElement(); |
5145 | 5143 |
5146 // 1. If any of the following conditions are true, terminate these steps
and queue a task to fire | |
5147 // an event named fullscreenerror with its bubbles attribute set to true
on the context object's | |
5148 // node document: | |
5149 | |
5150 // The context object is not in a document. | |
5151 if (!element->inDocument()) | |
5152 break; | |
5153 | |
5154 // The context object's node document, or an ancestor browsing context's
document does not have | |
5155 // the fullscreen enabled flag set. | |
5156 if (checkType == EnforceIFrameAllowFulScreenRequirement && !fullScreenIs
AllowedForElement(element)) | 5144 if (checkType == EnforceIFrameAllowFulScreenRequirement && !fullScreenIs
AllowedForElement(element)) |
5157 break; | 5145 break; |
5158 | 5146 |
5159 // The context object's node document fullscreen element stack is not em
pty and its top element | 5147 if (!ScriptController::processingUserGesture()) |
5160 // is not an ancestor of the context object. (NOTE: Ignore this requirem
ent if the request was | |
5161 // made via the legacy Mozilla-style API.) | |
5162 if (!m_fullScreenElementStack.isEmpty() && !m_fullScreenElementStack.fir
st()->contains(element) && !inLegacyMozillaMode) | |
5163 break; | |
5164 | |
5165 // A descendant browsing context's document has a non-empty fullscreen e
lement stack. | |
5166 bool descendentHasNonEmptyStack = false; | |
5167 for (Frame* descendant = frame() ? frame()->tree()->traverseNext() : 0;
descendant; descendant = descendant->tree()->traverseNext()) { | |
5168 if (descendant->document()->webkitFullscreenElement()) { | |
5169 descendentHasNonEmptyStack = true; | |
5170 break; | |
5171 } | |
5172 } | |
5173 if (descendentHasNonEmptyStack && !inLegacyMozillaMode) | |
5174 break; | |
5175 | |
5176 // This algorithm is not allowed to show a pop-up. | |
5177 if (!domWindow()->allowPopUp()) | |
5178 break; | |
5179 | |
5180 // There is a previously-established user preference, security risk, or
platform limitation. | |
5181 if (!page() || !page()->settings()->fullScreenEnabled()) | |
5182 break; | 5148 break; |
5183 | 5149 |
5184 if (!page()->chrome()->client()->supportsFullScreenForElement(element, f
lags & Element::ALLOW_KEYBOARD_INPUT)) | 5150 if (!page()->chrome()->client()->supportsFullScreenForElement(element, f
lags & Element::ALLOW_KEYBOARD_INPUT)) |
5185 break; | 5151 break; |
5186 | 5152 |
5187 // 2. Let doc be element's node document. (i.e. "this") | |
5188 Document* currentDoc = this; | |
5189 | |
5190 // 3. Let docs be all doc's ancestor browsing context's documents (if an
y) and doc. | |
5191 Deque<Document*> docs; | |
5192 | |
5193 do { | |
5194 docs.prepend(currentDoc); | |
5195 currentDoc = currentDoc->ownerElement() ? currentDoc->ownerElement()
->document() : 0; | |
5196 } while (currentDoc); | |
5197 | |
5198 // 4. For each document in docs, run these substeps: | |
5199 Deque<Document*>::iterator current = docs.begin(), following = docs.begi
n(); | |
5200 | |
5201 do { | |
5202 ++following; | |
5203 | |
5204 // 1. Let following document be the document after document in docs,
or null if there is no | |
5205 // such document. | |
5206 Document* currentDoc = *current; | |
5207 Document* followingDoc = following != docs.end() ? *following : 0; | |
5208 | |
5209 // 2. If following document is null, push context object on document
's fullscreen element | |
5210 // stack, and queue a task to fire an event named fullscreenchange w
ith its bubbles attribute | |
5211 // set to true on the document. | |
5212 if (!followingDoc) { | |
5213 currentDoc->pushFullscreenElementStack(element); | |
5214 addDocumentToFullScreenChangeEventQueue(currentDoc); | |
5215 continue; | |
5216 } | |
5217 | |
5218 // 3. Otherwise, if document's fullscreen element stack is either em
pty or its top element | |
5219 // is not following document's browsing context container, | |
5220 Element* topElement = currentDoc->webkitFullscreenElement(); | |
5221 if (!topElement || topElement != followingDoc->ownerElement()) { | |
5222 // ...push following document's browsing context container on do
cument's fullscreen element | |
5223 // stack, and queue a task to fire an event named fullscreenchan
ge with its bubbles attribute | |
5224 // set to true on document. | |
5225 currentDoc->pushFullscreenElementStack(followingDoc->ownerElemen
t()); | |
5226 addDocumentToFullScreenChangeEventQueue(currentDoc); | |
5227 continue; | |
5228 } | |
5229 | |
5230 // 4. Otherwise, do nothing for this document. It stays the same. | |
5231 } while (++current != docs.end()); | |
5232 | |
5233 // 5. Return, and run the remaining steps asynchronously. | |
5234 // 6. Optionally, perform some animation. | |
5235 m_areKeysEnabledInFullScreen = flags & Element::ALLOW_KEYBOARD_INPUT; | 5153 m_areKeysEnabledInFullScreen = flags & Element::ALLOW_KEYBOARD_INPUT; |
5236 page()->chrome()->client()->enterFullScreenForElement(element); | 5154 page()->chrome()->client()->enterFullScreenForElement(element); |
5237 | |
5238 // 7. Optionally, display a message indicating how the user can exit dis
playing the context object fullscreen. | |
5239 return; | 5155 return; |
5240 } while (0); | 5156 } while (0); |
5241 | 5157 |
5242 m_fullScreenErrorEventTargetQueue.append(element ? element : documentElement
()); | 5158 m_fullScreenErrorEventTargetQueue.append(element ? element : documentElement
()); |
5243 m_fullScreenChangeDelayTimer.startOneShot(0); | 5159 m_fullScreenChangeDelayTimer.startOneShot(0); |
5244 } | 5160 } |
5245 | 5161 |
5246 void Document::webkitCancelFullScreen() | 5162 void Document::webkitCancelFullScreen() |
5247 { | 5163 { |
5248 // The Mozilla "cancelFullScreen()" API behaves like the W3C "fully exit ful
lscreen" behavior, which | 5164 if (!page() || !m_fullScreenElement) |
5249 // is defined as: | |
5250 // "To fully exit fullscreen act as if the exitFullscreen() method was invok
ed on the top-level browsing | |
5251 // context's document and subsequently empty that document's fullscreen elem
ent stack." | |
5252 if (!topDocument()->webkitFullscreenElement()) | |
5253 return; | |
5254 | |
5255 // To achieve that aim, remove all the elements from the top document's stac
k except for the first before | |
5256 // calling webkitExitFullscreen(): | |
5257 Deque<RefPtr<Element> > replacementFullscreenElementStack; | |
5258 replacementFullscreenElementStack.prepend(topDocument()->webkitFullscreenEle
ment()); | |
5259 topDocument()->m_fullScreenElementStack.swap(replacementFullscreenElementSta
ck); | |
5260 | |
5261 topDocument()->webkitExitFullscreen(); | |
5262 } | |
5263 | |
5264 void Document::webkitExitFullscreen() | |
5265 { | |
5266 // The exitFullscreen() method must run these steps: | |
5267 | |
5268 // 1. Let doc be the context object. (i.e. "this") | |
5269 Document* currentDoc = this; | |
5270 | |
5271 // 2. If doc's fullscreen element stack is empty, terminate these steps. | |
5272 if (m_fullScreenElementStack.isEmpty()) | |
5273 return; | 5165 return; |
5274 | 5166 |
5275 // 3. Let descendants be all the doc's descendant browsing context's documen
ts with a non-empty fullscreen | 5167 page()->chrome()->client()->exitFullScreenForElement(m_fullScreenElement.get
()); |
5276 // element stack (if any), ordered so that the child of the doc is last and
the document furthest | |
5277 // away from the doc is first. | |
5278 Deque<RefPtr<Document> > descendants; | |
5279 for (Frame* descendant = frame() ? frame()->tree()->traverseNext() : 0; desc
endant; descendant = descendant->tree()->traverseNext()) { | |
5280 if (descendant->document()->webkitFullscreenElement()) | |
5281 descendants.prepend(descendant->document()); | |
5282 } | |
5283 | |
5284 // 4. For each descendant in descendants, empty descendant's fullscreen elem
ent stack, and queue a | |
5285 // task to fire an event named fullscreenchange with its bubbles attribute s
et to true on descendant. | |
5286 for (Deque<RefPtr<Document> >::iterator i = descendants.begin(); i != descen
dants.end(); ++i) { | |
5287 (*i)->clearFullscreenElementStack(); | |
5288 addDocumentToFullScreenChangeEventQueue(i->get()); | |
5289 } | |
5290 | |
5291 // 5. While doc is not null, run these substeps: | |
5292 Element* newTop = 0; | |
5293 while (currentDoc) { | |
5294 // 1. Pop the top element of doc's fullscreen element stack. | |
5295 currentDoc->popFullscreenElementStack(); | |
5296 | |
5297 // If doc's fullscreen element stack is non-empty and the element now
at the top is either | |
5298 // not in a document or its node document is not doc, repeat this sub
step. | |
5299 newTop = currentDoc->webkitFullscreenElement(); | |
5300 if (newTop && (!newTop->inDocument() || newTop->document() != currentDoc
)) | |
5301 continue; | |
5302 | |
5303 // 2. Queue a task to fire an event named fullscreenchange with its bubb
les attribute set to true | |
5304 // on doc. | |
5305 Node* target = currentDoc->m_fullScreenElement.get(); | |
5306 if (!target) | |
5307 target = currentDoc; | |
5308 addDocumentToFullScreenChangeEventQueue(currentDoc); | |
5309 | |
5310 // 3. If doc's fullscreen element stack is empty and doc's browsing cont
ext has a browsing context | |
5311 // container, set doc to that browsing context container's node document
. | |
5312 if (!newTop && currentDoc->ownerElement()) | |
5313 currentDoc = currentDoc->ownerElement()->document(); | |
5314 | |
5315 // 4. Otherwise, set doc to null. | |
5316 currentDoc = 0; | |
5317 } | |
5318 | |
5319 // 6. Return, and run the remaining steps asynchronously. | |
5320 // 7. Optionally, perform some animation. | |
5321 | |
5322 // Only exit out of full screen window mode if there are no remaining elemen
ts in the | |
5323 // full screen stack. | |
5324 if (!newTop) { | |
5325 page()->chrome()->client()->exitFullScreenForElement(m_fullScreenElement
.get()); | |
5326 return; | |
5327 } | |
5328 | |
5329 // Otherwise, notify the chrome of the new full screen element. | |
5330 page()->chrome()->client()->enterFullScreenForElement(newTop); | |
5331 } | |
5332 | |
5333 bool Document::webkitFullscreenEnabled() const | |
5334 { | |
5335 // 4. The fullscreenEnabled attribute must return true if the context object
and all ancestor | |
5336 // browsing context's documents have their fullscreen enabled flag set, or f
alse otherwise. | |
5337 | |
5338 // Top-level browsing contexts are implied to have their allowFullScreen att
ribute set. | |
5339 HTMLFrameOwnerElement* owner = ownerElement(); | |
5340 if (!owner) | |
5341 return true; | |
5342 | |
5343 do { | |
5344 if (!owner->isFrameElementBase()) | |
5345 continue; | |
5346 | |
5347 if (!static_cast<HTMLFrameElementBase*>(owner)->allowFullScreen()) | |
5348 return false; | |
5349 } while ((owner = owner->document()->ownerElement())); | |
5350 | |
5351 return true; | |
5352 } | 5168 } |
5353 | 5169 |
5354 void Document::webkitWillEnterFullScreenForElement(Element* element) | 5170 void Document::webkitWillEnterFullScreenForElement(Element* element) |
5355 { | 5171 { |
5356 ASSERT(element); | 5172 ASSERT(element); |
5357 | 5173 ASSERT(page() && page()->settings()->fullScreenEnabled()); |
5358 // Protect against being called after the document has been removed from the
page. | |
5359 if (!page()) | |
5360 return; | |
5361 | |
5362 ASSERT(page()->settings()->fullScreenEnabled()); | |
5363 | 5174 |
5364 if (m_fullScreenRenderer) | 5175 if (m_fullScreenRenderer) |
5365 m_fullScreenRenderer->unwrapRenderer(); | 5176 m_fullScreenRenderer->unwrapRenderer(); |
5366 | 5177 |
5367 m_fullScreenElement = element; | 5178 m_fullScreenElement = element; |
5368 | 5179 |
5369 // Create a placeholder block for a the full-screen element, to keep the pag
e from reflowing | 5180 // Create a placeholder block for a the full-screen element, to keep the pag
e from reflowing |
5370 // when the element is removed from the normal flow. Only do this for a Ren
derBox, as only | 5181 // when the element is removed from the normal flow. Only do this for a Ren
derBox, as only |
5371 // a box will have a frameRect. The placeholder will be created in setFullS
creenRenderer() | 5182 // a box will have a frameRect. The placeholder will be created in setFullS
creenRenderer() |
5372 // during layout. | 5183 // during layout. |
5373 RenderObject* renderer = m_fullScreenElement->renderer(); | 5184 RenderObject* renderer = m_fullScreenElement->renderer(); |
5374 bool shouldCreatePlaceholder = renderer && renderer->isBox(); | 5185 bool shouldCreatePlaceholder = renderer && renderer->isBox(); |
5375 if (shouldCreatePlaceholder) { | 5186 if (shouldCreatePlaceholder) { |
5376 m_savedPlaceholderFrameRect = toRenderBox(renderer)->frameRect(); | 5187 m_savedPlaceholderFrameRect = toRenderBox(renderer)->frameRect(); |
5377 m_savedPlaceholderRenderStyle = RenderStyle::clone(renderer->style()); | 5188 m_savedPlaceholderRenderStyle = RenderStyle::clone(renderer->style()); |
5378 } | 5189 } |
5379 | 5190 |
5380 if (m_fullScreenElement != documentElement()) | 5191 if (m_fullScreenElement != documentElement()) |
5381 RenderFullScreen::wrapRenderer(renderer, this); | 5192 RenderFullScreen::wrapRenderer(renderer, this); |
5382 | 5193 |
5383 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou
ndaries(true); | 5194 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou
ndaries(true); |
5384 | 5195 |
5385 recalcStyle(Force); | 5196 recalcStyle(Force); |
5386 } | 5197 } |
5387 | 5198 |
5388 void Document::webkitDidEnterFullScreenForElement(Element*) | 5199 void Document::webkitDidEnterFullScreenForElement(Element*) |
5389 { | 5200 { |
5390 if (!m_fullScreenElement) | |
5391 return; | |
5392 | |
5393 m_fullScreenElement->didBecomeFullscreenElement(); | 5201 m_fullScreenElement->didBecomeFullscreenElement(); |
5394 | 5202 |
| 5203 m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement); |
5395 m_fullScreenChangeDelayTimer.startOneShot(0); | 5204 m_fullScreenChangeDelayTimer.startOneShot(0); |
5396 } | 5205 } |
5397 | 5206 |
5398 void Document::webkitWillExitFullScreenForElement(Element*) | 5207 void Document::webkitWillExitFullScreenForElement(Element*) |
5399 { | 5208 { |
5400 if (!m_fullScreenElement) | |
5401 return; | |
5402 | |
5403 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou
ndaries(false); | 5209 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou
ndaries(false); |
5404 | 5210 |
5405 m_fullScreenElement->willStopBeingFullscreenElement(); | 5211 m_fullScreenElement->willStopBeingFullscreenElement(); |
5406 } | 5212 } |
5407 | 5213 |
5408 void Document::webkitDidExitFullScreenForElement(Element*) | 5214 void Document::webkitDidExitFullScreenForElement(Element*) |
5409 { | 5215 { |
5410 m_areKeysEnabledInFullScreen = false; | 5216 m_areKeysEnabledInFullScreen = false; |
5411 | 5217 |
5412 if (m_fullScreenRenderer) | 5218 if (m_fullScreenRenderer) |
5413 m_fullScreenRenderer->unwrapRenderer(); | 5219 m_fullScreenRenderer->unwrapRenderer(); |
5414 | 5220 |
5415 m_fullScreenElement = 0; | 5221 m_fullScreenChangeEventTargetQueue.append(m_fullScreenElement.release()); |
5416 scheduleForcedStyleRecalc(); | 5222 scheduleForcedStyleRecalc(); |
5417 | 5223 |
5418 m_fullScreenChangeDelayTimer.startOneShot(0); | 5224 m_fullScreenChangeDelayTimer.startOneShot(0); |
5419 } | 5225 } |
5420 | 5226 |
5421 void Document::setFullScreenRenderer(RenderFullScreen* renderer) | 5227 void Document::setFullScreenRenderer(RenderFullScreen* renderer) |
5422 { | 5228 { |
5423 if (renderer == m_fullScreenRenderer) | 5229 if (renderer == m_fullScreenRenderer) |
5424 return; | 5230 return; |
5425 | 5231 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5471 if (!m_fullScreenRenderer) | 5277 if (!m_fullScreenRenderer) |
5472 return; | 5278 return; |
5473 | 5279 |
5474 RefPtr<RenderStyle> newStyle = RenderStyle::clone(m_fullScreenRenderer->styl
e()); | 5280 RefPtr<RenderStyle> newStyle = RenderStyle::clone(m_fullScreenRenderer->styl
e()); |
5475 newStyle->setBackgroundColor(backgroundColor); | 5281 newStyle->setBackgroundColor(backgroundColor); |
5476 m_fullScreenRenderer->setStyle(newStyle); | 5282 m_fullScreenRenderer->setStyle(newStyle); |
5477 } | 5283 } |
5478 | 5284 |
5479 void Document::fullScreenChangeDelayTimerFired(Timer<Document>*) | 5285 void Document::fullScreenChangeDelayTimerFired(Timer<Document>*) |
5480 { | 5286 { |
5481 Deque<RefPtr<Node> > changeQueue; | 5287 while (!m_fullScreenChangeEventTargetQueue.isEmpty()) { |
5482 m_fullScreenChangeEventTargetQueue.swap(changeQueue); | 5288 RefPtr<Element> element = m_fullScreenChangeEventTargetQueue.takeFirst()
; |
5483 | 5289 if (!element) |
5484 while (!changeQueue.isEmpty()) { | 5290 element = documentElement(); |
5485 RefPtr<Node> node = changeQueue.takeFirst(); | |
5486 if (!node) | |
5487 node = documentElement(); | |
5488 | 5291 |
5489 // If the element was removed from our tree, also message the documentEl
ement. | 5292 // If the element was removed from our tree, also message the documentEl
ement. |
5490 if (!contains(node.get())) | 5293 if (!contains(element.get())) |
5491 changeQueue.append(documentElement()); | 5294 m_fullScreenChangeEventTargetQueue.append(documentElement()); |
5492 | 5295 |
5493 node->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEve
nt, true, false)); | 5296 element->dispatchEvent(Event::create(eventNames().webkitfullscreenchange
Event, true, false)); |
5494 } | 5297 } |
5495 | 5298 |
5496 Deque<RefPtr<Node> > errorQueue; | 5299 while (!m_fullScreenErrorEventTargetQueue.isEmpty()) { |
5497 m_fullScreenErrorEventTargetQueue.swap(errorQueue); | 5300 RefPtr<Element> element = m_fullScreenErrorEventTargetQueue.takeFirst(); |
5498 | 5301 if (!element) |
5499 while (!errorQueue.isEmpty()) { | 5302 element = documentElement(); |
5500 RefPtr<Node> node = errorQueue.takeFirst(); | |
5501 if (!node) | |
5502 node = documentElement(); | |
5503 | 5303 |
5504 // If the node was removed from our tree, also message the documentEleme
nt. | 5304 // If the element was removed from our tree, also message the documentEl
ement. |
5505 if (!contains(node.get())) | 5305 if (!contains(element.get())) |
5506 errorQueue.append(documentElement()); | 5306 m_fullScreenErrorEventTargetQueue.append(documentElement()); |
5507 | 5307 |
5508 node->dispatchEvent(Event::create(eventNames().webkitfullscreenerrorEven
t, true, false)); | 5308 element->dispatchEvent(Event::create(eventNames().webkitfullscreenerrorE
vent, true, false)); |
5509 } | 5309 } |
5510 } | 5310 } |
5511 | 5311 |
5512 void Document::fullScreenElementRemoved() | 5312 void Document::fullScreenElementRemoved() |
5513 { | 5313 { |
5514 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou
ndaries(false); | 5314 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou
ndaries(false); |
5515 webkitCancelFullScreen(); | 5315 webkitCancelFullScreen(); |
5516 } | 5316 } |
5517 | 5317 |
5518 void Document::removeFullScreenElementOfSubtree(Node* node, bool amongChildrenOn
ly) | 5318 void Document::removeFullScreenElementOfSubtree(Node* node, bool amongChildrenOn
ly) |
(...skipping 20 matching lines...) Expand all Loading... |
5539 { | 5339 { |
5540 if (m_isAnimatingFullScreen == flag) | 5340 if (m_isAnimatingFullScreen == flag) |
5541 return; | 5341 return; |
5542 m_isAnimatingFullScreen = flag; | 5342 m_isAnimatingFullScreen = flag; |
5543 | 5343 |
5544 if (m_fullScreenElement && m_fullScreenElement->isDescendantOf(this)) { | 5344 if (m_fullScreenElement && m_fullScreenElement->isDescendantOf(this)) { |
5545 m_fullScreenElement->setNeedsStyleRecalc(); | 5345 m_fullScreenElement->setNeedsStyleRecalc(); |
5546 scheduleForcedStyleRecalc(); | 5346 scheduleForcedStyleRecalc(); |
5547 } | 5347 } |
5548 } | 5348 } |
5549 | |
5550 void Document::clearFullscreenElementStack() | |
5551 { | |
5552 m_fullScreenElementStack.clear(); | |
5553 } | |
5554 | |
5555 void Document::popFullscreenElementStack() | |
5556 { | |
5557 if (m_fullScreenElementStack.isEmpty()) | |
5558 return; | |
5559 | |
5560 m_fullScreenElementStack.removeFirst(); | |
5561 } | |
5562 | |
5563 void Document::pushFullscreenElementStack(Element* element) | |
5564 { | |
5565 m_fullScreenElementStack.prepend(element); | |
5566 } | |
5567 | |
5568 void Document::addDocumentToFullScreenChangeEventQueue(Document* doc) | |
5569 { | |
5570 ASSERT(doc); | |
5571 Node* target = doc->webkitFullscreenElement(); | |
5572 if (!target) | |
5573 target = doc->webkitCurrentFullScreenElement(); | |
5574 if (!target) | |
5575 target = doc; | |
5576 m_fullScreenChangeEventTargetQueue.append(target); | |
5577 } | |
5578 #endif | 5349 #endif |
5579 | 5350 |
5580 void Document::decrementLoadEventDelayCount() | 5351 void Document::decrementLoadEventDelayCount() |
5581 { | 5352 { |
5582 ASSERT(m_loadEventDelayCount); | 5353 ASSERT(m_loadEventDelayCount); |
5583 --m_loadEventDelayCount; | 5354 --m_loadEventDelayCount; |
5584 | 5355 |
5585 if (frame() && !m_loadEventDelayCount && !m_loadEventDelayTimer.isActive()) | 5356 if (frame() && !m_loadEventDelayCount && !m_loadEventDelayTimer.isActive()) |
5586 m_loadEventDelayTimer.startOneShot(0); | 5357 m_loadEventDelayTimer.startOneShot(0); |
5587 } | 5358 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5748 #endif | 5519 #endif |
5749 | 5520 |
5750 IntSize Document::viewportSize() const | 5521 IntSize Document::viewportSize() const |
5751 { | 5522 { |
5752 if (!view()) | 5523 if (!view()) |
5753 return IntSize(); | 5524 return IntSize(); |
5754 return view()->visibleContentRect(/* includeScrollbars */ true).size(); | 5525 return view()->visibleContentRect(/* includeScrollbars */ true).size(); |
5755 } | 5526 } |
5756 | 5527 |
5757 } // namespace WebCore | 5528 } // namespace WebCore |
OLD | NEW |