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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 15820002: Page::chrome() should return a reference. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/accessibility/AXObjectCache.cpp ('k') | Source/core/editing/EditorCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 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) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 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 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after
2789 2789
2790 updateViewportArguments(); 2790 updateViewportArguments();
2791 } 2791 }
2792 2792
2793 void Document::updateViewportArguments() 2793 void Document::updateViewportArguments()
2794 { 2794 {
2795 if (page() && page()->mainFrame() == frame()) { 2795 if (page() && page()->mainFrame() == frame()) {
2796 #ifndef NDEBUG 2796 #ifndef NDEBUG
2797 m_didDispatchViewportPropertiesChanged = true; 2797 m_didDispatchViewportPropertiesChanged = true;
2798 #endif 2798 #endif
2799 page()->chrome()->dispatchViewportPropertiesDidChange(m_viewportArgument s); 2799 page()->chrome().dispatchViewportPropertiesDidChange(m_viewportArguments );
2800 } 2800 }
2801 } 2801 }
2802 2802
2803 void Document::processReferrerPolicy(const String& policy) 2803 void Document::processReferrerPolicy(const String& policy)
2804 { 2804 {
2805 ASSERT(!policy.isNull()); 2805 ASSERT(!policy.isNull());
2806 2806
2807 m_referrerPolicy = ReferrerPolicyDefault; 2807 m_referrerPolicy = ReferrerPolicyDefault;
2808 2808
2809 if (equalIgnoringCase(policy, "never")) 2809 if (equalIgnoringCase(policy, "never"))
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
3250 } 3250 }
3251 } 3251 }
3252 3252
3253 if (!focusChangeBlocked && m_focusedNode) { 3253 if (!focusChangeBlocked && m_focusedNode) {
3254 // Create the AXObject cache in a focus change because Chromium relies o n it. 3254 // Create the AXObject cache in a focus change because Chromium relies o n it.
3255 if (AXObjectCache* cache = axObjectCache()) 3255 if (AXObjectCache* cache = axObjectCache())
3256 cache->handleFocusedUIElementChanged(oldFocusedNode.get(), newFocuse dNode.get()); 3256 cache->handleFocusedUIElementChanged(oldFocusedNode.get(), newFocuse dNode.get());
3257 } 3257 }
3258 3258
3259 if (!focusChangeBlocked) 3259 if (!focusChangeBlocked)
3260 page()->chrome()->focusedNodeChanged(m_focusedNode.get()); 3260 page()->chrome().focusedNodeChanged(m_focusedNode.get());
3261 3261
3262 SetFocusedNodeDone: 3262 SetFocusedNodeDone:
3263 updateStyleIfNeeded(); 3263 updateStyleIfNeeded();
3264 return !focusChangeBlocked; 3264 return !focusChangeBlocked;
3265 } 3265 }
3266 3266
3267 void Document::getFocusableNodes(Vector<RefPtr<Node> >& nodes) 3267 void Document::getFocusableNodes(Vector<RefPtr<Node> >& nodes)
3268 { 3268 {
3269 updateLayout(); 3269 updateLayout();
3270 3270
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after
4730 addDocumentToFullScreenChangeEventQueue(currentDoc); 4730 addDocumentToFullScreenChangeEventQueue(currentDoc);
4731 continue; 4731 continue;
4732 } 4732 }
4733 4733
4734 // 4. Otherwise, do nothing for this document. It stays the same. 4734 // 4. Otherwise, do nothing for this document. It stays the same.
4735 } while (++current != docs.end()); 4735 } while (++current != docs.end());
4736 4736
4737 // 5. Return, and run the remaining steps asynchronously. 4737 // 5. Return, and run the remaining steps asynchronously.
4738 // 6. Optionally, perform some animation. 4738 // 6. Optionally, perform some animation.
4739 m_areKeysEnabledInFullScreen = flags & Element::ALLOW_KEYBOARD_INPUT; 4739 m_areKeysEnabledInFullScreen = flags & Element::ALLOW_KEYBOARD_INPUT;
4740 page()->chrome()->client()->enterFullScreenForElement(element); 4740 page()->chrome().client()->enterFullScreenForElement(element);
4741 4741
4742 // 7. Optionally, display a message indicating how the user can exit dis playing the context object fullscreen. 4742 // 7. Optionally, display a message indicating how the user can exit dis playing the context object fullscreen.
4743 return; 4743 return;
4744 } while (0); 4744 } while (0);
4745 4745
4746 m_fullScreenErrorEventTargetQueue.append(element ? element : documentElement ()); 4746 m_fullScreenErrorEventTargetQueue.append(element ? element : documentElement ());
4747 m_fullScreenChangeDelayTimer.startOneShot(0); 4747 m_fullScreenChangeDelayTimer.startOneShot(0);
4748 } 4748 }
4749 4749
4750 void Document::webkitCancelFullScreen() 4750 void Document::webkitCancelFullScreen()
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
4821 4821
4822 // 6. Return, and run the remaining steps asynchronously. 4822 // 6. Return, and run the remaining steps asynchronously.
4823 // 7. Optionally, perform some animation. 4823 // 7. Optionally, perform some animation.
4824 4824
4825 if (!page()) 4825 if (!page())
4826 return; 4826 return;
4827 4827
4828 // Only exit out of full screen window mode if there are no remaining elemen ts in the 4828 // Only exit out of full screen window mode if there are no remaining elemen ts in the
4829 // full screen stack. 4829 // full screen stack.
4830 if (!newTop) { 4830 if (!newTop) {
4831 page()->chrome()->client()->exitFullScreenForElement(m_fullScreenElement .get()); 4831 page()->chrome().client()->exitFullScreenForElement(m_fullScreenElement. get());
4832 return; 4832 return;
4833 } 4833 }
4834 4834
4835 // Otherwise, notify the chrome of the new full screen element. 4835 // Otherwise, notify the chrome of the new full screen element.
4836 page()->chrome()->client()->enterFullScreenForElement(newTop); 4836 page()->chrome().client()->enterFullScreenForElement(newTop);
4837 } 4837 }
4838 4838
4839 bool Document::webkitFullscreenEnabled() const 4839 bool Document::webkitFullscreenEnabled() const
4840 { 4840 {
4841 // 4. The fullscreenEnabled attribute must return true if the context object and all ancestor 4841 // 4. The fullscreenEnabled attribute must return true if the context object and all ancestor
4842 // browsing context's documents have their fullscreen enabled flag set, or f alse otherwise. 4842 // browsing context's documents have their fullscreen enabled flag set, or f alse otherwise.
4843 4843
4844 // Top-level browsing contexts are implied to have their allowFullScreen att ribute set. 4844 // Top-level browsing contexts are implied to have their allowFullScreen att ribute set.
4845 return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr , ownerElement()); 4845 return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr , ownerElement());
4846 } 4846 }
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
5204 m_touchEventTargets = adoptPtr(new TouchEventTargetSet); 5204 m_touchEventTargets = adoptPtr(new TouchEventTargetSet);
5205 m_touchEventTargets->add(handler); 5205 m_touchEventTargets->add(handler);
5206 if (Document* parent = parentDocument()) { 5206 if (Document* parent = parentDocument()) {
5207 parent->didAddTouchEventHandler(this); 5207 parent->didAddTouchEventHandler(this);
5208 return; 5208 return;
5209 } 5209 }
5210 if (Page* page = this->page()) { 5210 if (Page* page = this->page()) {
5211 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) 5211 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor())
5212 scrollingCoordinator->touchEventTargetRectsDidChange(this); 5212 scrollingCoordinator->touchEventTargetRectsDidChange(this);
5213 if (m_touchEventTargets->size() == 1) 5213 if (m_touchEventTargets->size() == 1)
5214 page->chrome()->client()->needTouchEvents(true); 5214 page->chrome().client()->needTouchEvents(true);
5215 } 5215 }
5216 } 5216 }
5217 5217
5218 void Document::didRemoveTouchEventHandler(Node* handler) 5218 void Document::didRemoveTouchEventHandler(Node* handler)
5219 { 5219 {
5220 if (!m_touchEventTargets.get()) 5220 if (!m_touchEventTargets.get())
5221 return; 5221 return;
5222 ASSERT(m_touchEventTargets->contains(handler)); 5222 ASSERT(m_touchEventTargets->contains(handler));
5223 m_touchEventTargets->remove(handler); 5223 m_touchEventTargets->remove(handler);
5224 if (Document* parent = parentDocument()) { 5224 if (Document* parent = parentDocument()) {
5225 parent->didRemoveTouchEventHandler(this); 5225 parent->didRemoveTouchEventHandler(this);
5226 return; 5226 return;
5227 } 5227 }
5228 5228
5229 Page* page = this->page(); 5229 Page* page = this->page();
5230 if (!page) 5230 if (!page)
5231 return; 5231 return;
5232 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator( )) 5232 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator( ))
5233 scrollingCoordinator->touchEventTargetRectsDidChange(this); 5233 scrollingCoordinator->touchEventTargetRectsDidChange(this);
5234 if (m_touchEventTargets->size()) 5234 if (m_touchEventTargets->size())
5235 return; 5235 return;
5236 for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->t raverseNext()) { 5236 for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->t raverseNext()) {
5237 if (frame->document() && frame->document()->hasTouchEventHandlers()) 5237 if (frame->document() && frame->document()->hasTouchEventHandlers())
5238 return; 5238 return;
5239 } 5239 }
5240 page->chrome()->client()->needTouchEvents(false); 5240 page->chrome().client()->needTouchEvents(false);
5241 } 5241 }
5242 5242
5243 void Document::didRemoveEventTargetNode(Node* handler) 5243 void Document::didRemoveEventTargetNode(Node* handler)
5244 { 5244 {
5245 if (m_touchEventTargets) { 5245 if (m_touchEventTargets) {
5246 m_touchEventTargets->removeAll(handler); 5246 m_touchEventTargets->removeAll(handler);
5247 if ((handler == this || m_touchEventTargets->isEmpty()) && parentDocumen t()) 5247 if ((handler == this || m_touchEventTargets->isEmpty()) && parentDocumen t())
5248 parentDocument()->didRemoveEventTargetNode(this); 5248 parentDocument()->didRemoveEventTargetNode(this);
5249 } 5249 }
5250 } 5250 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
5616 5616
5617 void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer) 5617 void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer)
5618 { 5618 {
5619 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); 5619 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer);
5620 if (!frame() || !frame()->page()) 5620 if (!frame() || !frame()->page())
5621 return; 5621 return;
5622 5622
5623 Vector<RefPtr<Element> > associatedFormControls; 5623 Vector<RefPtr<Element> > associatedFormControls;
5624 copyToVector(m_associatedFormControls, associatedFormControls); 5624 copyToVector(m_associatedFormControls, associatedFormControls);
5625 5625
5626 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls); 5626 frame()->page()->chrome().client()->didAssociateFormControls(associatedFormC ontrols);
5627 m_associatedFormControls.clear(); 5627 m_associatedFormControls.clear();
5628 } 5628 }
5629 5629
5630 } // namespace WebCore 5630 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AXObjectCache.cpp ('k') | Source/core/editing/EditorCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698