Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: third_party/WebKit/Source/core/dom/Fullscreen.cpp

Issue 1942623002: Rename Document::ownerElement to localOwner and fix main frame checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed const changes and some gratuitous checks Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights 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) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2013 Google Inc. All rights reserved. 9 * Copyright (C) 2013 Google Inc. All rights reserved.
10 * 10 *
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 // |element| has no ancestor element whose local name is iframe and namespac e is the HTML 102 // |element| has no ancestor element whose local name is iframe and namespac e is the HTML
103 // namespace. 103 // namespace.
104 if (Traversal<HTMLIFrameElement>::firstAncestor(element)) 104 if (Traversal<HTMLIFrameElement>::firstAncestor(element))
105 return false; 105 return false;
106 106
107 // |element|'s node document's browsing context either has a browsing contex t container and the 107 // |element|'s node document's browsing context either has a browsing contex t container and the
108 // fullscreen element ready check returns true for |element|'s node document 's browsing 108 // fullscreen element ready check returns true for |element|'s node document 's browsing
109 // context's browsing context container, or it has no browsing context conta iner. 109 // context's browsing context container, or it has no browsing context conta iner.
110 if (const Element* owner = element.document().ownerElement()) { 110 if (const Element* owner = element.document().localOwner()) {
111 if (!fullscreenElementReady(*owner)) 111 if (!fullscreenElementReady(*owner))
112 return false; 112 return false;
113 } 113 }
114 114
115 return true; 115 return true;
116 } 116 }
117 117
118 static bool isPrefixed(const AtomicString& type) 118 static bool isPrefixed(const AtomicString& type)
119 { 119 {
120 return type == EventTypeNames::webkitfullscreenchange || type == EventTypeNa mes::webkitfullscreenerror; 120 return type == EventTypeNames::webkitfullscreenchange || type == EventTypeNa mes::webkitfullscreenerror;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 break; 241 break;
242 242
243 // 2. Let doc be element's node document. (i.e. "this") 243 // 2. Let doc be element's node document. (i.e. "this")
244 Document* currentDoc = document(); 244 Document* currentDoc = document();
245 245
246 // 3. Let docs be all doc's ancestor browsing context's documents (if an y) and doc. 246 // 3. Let docs be all doc's ancestor browsing context's documents (if an y) and doc.
247 HeapDeque<Member<Document>> docs; 247 HeapDeque<Member<Document>> docs;
248 248
249 do { 249 do {
250 docs.prepend(currentDoc); 250 docs.prepend(currentDoc);
251 currentDoc = currentDoc->ownerElement() ? &currentDoc->ownerElement( )->document() : nullptr; 251 currentDoc = currentDoc->localOwner() ? &currentDoc->localOwner()->d ocument() : nullptr;
252 } while (currentDoc); 252 } while (currentDoc);
253 253
254 // 4. For each document in docs, run these substeps: 254 // 4. For each document in docs, run these substeps:
255 HeapDeque<Member<Document>>::iterator current = docs.begin(), following = docs.begin(); 255 HeapDeque<Member<Document>>::iterator current = docs.begin(), following = docs.begin();
256 256
257 do { 257 do {
258 ++following; 258 ++following;
259 259
260 // 1. Let following document be the document after document in docs, or null if there is no 260 // 1. Let following document be the document after document in docs, or null if there is no
261 // such document. 261 // such document.
262 Document* currentDoc = *current; 262 Document* currentDoc = *current;
263 Document* followingDoc = following != docs.end() ? *following : null ptr; 263 Document* followingDoc = following != docs.end() ? *following : null ptr;
264 264
265 // 2. If following document is null, push context object on document 's fullscreen element 265 // 2. If following document is null, push context object on document 's fullscreen element
266 // stack, and queue a task to fire an event named fullscreenchange w ith its bubbles attribute 266 // stack, and queue a task to fire an event named fullscreenchange w ith its bubbles attribute
267 // set to true on the document. 267 // set to true on the document.
268 if (!followingDoc) { 268 if (!followingDoc) {
269 from(*currentDoc).pushFullscreenElementStack(element, requestTyp e); 269 from(*currentDoc).pushFullscreenElementStack(element, requestTyp e);
270 enqueueChangeEvent(*currentDoc, requestType); 270 enqueueChangeEvent(*currentDoc, requestType);
271 continue; 271 continue;
272 } 272 }
273 273
274 // 3. Otherwise, if document's fullscreen element stack is either em pty or its top element 274 // 3. Otherwise, if document's fullscreen element stack is either em pty or its top element
275 // is not following document's browsing context container, 275 // is not following document's browsing context container,
276 Element* topElement = fullscreenElementFrom(*currentDoc); 276 Element* topElement = fullscreenElementFrom(*currentDoc);
277 if (!topElement || topElement != followingDoc->ownerElement()) { 277 if (!topElement || topElement != followingDoc->localOwner()) {
278 // ...push following document's browsing context container on do cument's fullscreen element 278 // ...push following document's browsing context container on do cument's fullscreen element
279 // stack, and queue a task to fire an event named fullscreenchan ge with its bubbles attribute 279 // stack, and queue a task to fire an event named fullscreenchan ge with its bubbles attribute
280 // set to true on document. 280 // set to true on document.
281 from(*currentDoc).pushFullscreenElementStack(*followingDoc->owne rElement(), requestType); 281 from(*currentDoc).pushFullscreenElementStack(*followingDoc->loca lOwner(), requestType);
282 enqueueChangeEvent(*currentDoc, requestType); 282 enqueueChangeEvent(*currentDoc, requestType);
283 continue; 283 continue;
284 } 284 }
285 285
286 // 4. Otherwise, do nothing for this document. It stays the same. 286 // 4. Otherwise, do nothing for this document. It stays the same.
287 } while (++current != docs.end()); 287 } while (++current != docs.end());
288 288
289 // 5. Return, and run the remaining steps asynchronously. 289 // 5. Return, and run the remaining steps asynchronously.
290 // 6. Optionally, perform some animation. 290 // 6. Optionally, perform some animation.
291 document()->frameHost()->chromeClient().enterFullScreenForElement(&eleme nt); 291 document()->frameHost()->chromeClient().enterFullScreenForElement(&eleme nt);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 newTop = fullscreenElementFrom(*currentDoc); 364 newTop = fullscreenElementFrom(*currentDoc);
365 if (newTop && (!newTop->inShadowIncludingDocument() || newTop->document( ) != currentDoc)) 365 if (newTop && (!newTop->inShadowIncludingDocument() || newTop->document( ) != currentDoc))
366 continue; 366 continue;
367 367
368 // 2. Queue a task to fire an event named fullscreenchange with its bubb les attribute set to true 368 // 2. Queue a task to fire an event named fullscreenchange with its bubb les attribute set to true
369 // on doc. 369 // on doc.
370 enqueueChangeEvent(*currentDoc, requestType); 370 enqueueChangeEvent(*currentDoc, requestType);
371 371
372 // 3. If doc's fullscreen element stack is empty and doc's browsing cont ext has a browsing context 372 // 3. If doc's fullscreen element stack is empty and doc's browsing cont ext has a browsing context
373 // container, set doc to that browsing context container's node document . 373 // container, set doc to that browsing context container's node document .
374 if (!newTop && currentDoc->ownerElement()) { 374 if (!newTop && currentDoc->localOwner()) {
375 currentDoc = &currentDoc->ownerElement()->document(); 375 currentDoc = &currentDoc->localOwner()->document();
376 continue; 376 continue;
377 } 377 }
378 378
379 // 4. Otherwise, set doc to null. 379 // 4. Otherwise, set doc to null.
380 currentDoc = 0; 380 currentDoc = 0;
381 } 381 }
382 382
383 // 6. Return, and run the remaining steps asynchronously. 383 // 6. Return, and run the remaining steps asynchronously.
384 // 7. Optionally, perform some animation. 384 // 7. Optionally, perform some animation.
385 385
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 DEFINE_TRACE(Fullscreen) 607 DEFINE_TRACE(Fullscreen)
608 { 608 {
609 visitor->trace(m_fullScreenElement); 609 visitor->trace(m_fullScreenElement);
610 visitor->trace(m_fullScreenElementStack); 610 visitor->trace(m_fullScreenElementStack);
611 visitor->trace(m_eventQueue); 611 visitor->trace(m_eventQueue);
612 Supplement<Document>::trace(visitor); 612 Supplement<Document>::trace(visitor);
613 ContextLifecycleObserver::trace(visitor); 613 ContextLifecycleObserver::trace(visitor);
614 } 614 }
615 615
616 } // namespace blink 616 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698