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

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

Issue 852083002: Propagate focus type to plugins (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Moved Created 5 years, 11 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/dom/Document.h ('k') | Source/core/dom/Element.h » ('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 3406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3417 { 3417 {
3418 return m_annotatedRegions; 3418 return m_annotatedRegions;
3419 } 3419 }
3420 3420
3421 void Document::setAnnotatedRegions(const Vector<AnnotatedRegionValue>& regions) 3421 void Document::setAnnotatedRegions(const Vector<AnnotatedRegionValue>& regions)
3422 { 3422 {
3423 m_annotatedRegions = regions; 3423 m_annotatedRegions = regions;
3424 setAnnotatedRegionsDirty(false); 3424 setAnnotatedRegionsDirty(false);
3425 } 3425 }
3426 3426
3427 bool Document::setFocusedElement(PassRefPtrWillBeRawPtr<Element> prpNewFocusedEl ement, FocusType type) 3427 bool Document::setFocusedElement(PassRefPtrWillBeRawPtr<Element> prpNewFocusedEl ement, WebFocusType type)
3428 { 3428 {
3429 m_clearFocusedElementTimer.stop(); 3429 m_clearFocusedElementTimer.stop();
3430 3430
3431 RefPtrWillBeRawPtr<Element> newFocusedElement = prpNewFocusedElement; 3431 RefPtrWillBeRawPtr<Element> newFocusedElement = prpNewFocusedElement;
3432 3432
3433 // Make sure newFocusedNode is actually in this document 3433 // Make sure newFocusedNode is actually in this document
3434 if (newFocusedElement && (newFocusedElement->document() != this)) 3434 if (newFocusedElement && (newFocusedElement->document() != this))
3435 return true; 3435 return true;
3436 3436
3437 if (NodeChildRemovalTracker::isBeingRemoved(newFocusedElement.get())) 3437 if (NodeChildRemovalTracker::isBeingRemoved(newFocusedElement.get()))
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3472 if (m_focusedElement) { 3472 if (m_focusedElement) {
3473 // handler shifted focus 3473 // handler shifted focus
3474 focusChangeBlocked = true; 3474 focusChangeBlocked = true;
3475 newFocusedElement = nullptr; 3475 newFocusedElement = nullptr;
3476 } 3476 }
3477 } 3477 }
3478 3478
3479 if (view()) { 3479 if (view()) {
3480 Widget* oldWidget = widgetForElement(*oldFocusedElement); 3480 Widget* oldWidget = widgetForElement(*oldFocusedElement);
3481 if (oldWidget) 3481 if (oldWidget)
3482 oldWidget->setFocus(false); 3482 oldWidget->setFocus(false, type);
3483 else 3483 else
3484 view()->setFocus(false); 3484 view()->setFocus(false, type);
3485 } 3485 }
3486 } 3486 }
3487 3487
3488 if (newFocusedElement && newFocusedElement->isFocusable()) { 3488 if (newFocusedElement && newFocusedElement->isFocusable()) {
3489 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(* newFocusedElement)) { 3489 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(* newFocusedElement)) {
3490 // delegate blocks focus change 3490 // delegate blocks focus change
3491 focusChangeBlocked = true; 3491 focusChangeBlocked = true;
3492 goto SetFocusedElementDone; 3492 goto SetFocusedElementDone;
3493 } 3493 }
3494 // Set focus on the new node 3494 // Set focus on the new node
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3536 Widget* focusWidget = widgetForElement(*m_focusedElement); 3536 Widget* focusWidget = widgetForElement(*m_focusedElement);
3537 if (focusWidget) { 3537 if (focusWidget) {
3538 // Make sure a widget has the right size before giving it focus. 3538 // Make sure a widget has the right size before giving it focus.
3539 // Otherwise, we are testing edge cases of the Widget code. 3539 // Otherwise, we are testing edge cases of the Widget code.
3540 // Specifically, in WebCore this does not work well for text fie lds. 3540 // Specifically, in WebCore this does not work well for text fie lds.
3541 updateLayout(); 3541 updateLayout();
3542 // Re-get the widget in case updating the layout changed things. 3542 // Re-get the widget in case updating the layout changed things.
3543 focusWidget = widgetForElement(*m_focusedElement); 3543 focusWidget = widgetForElement(*m_focusedElement);
3544 } 3544 }
3545 if (focusWidget) 3545 if (focusWidget)
3546 focusWidget->setFocus(true); 3546 focusWidget->setFocus(true, type);
3547 else 3547 else
3548 view()->setFocus(true); 3548 view()->setFocus(true, type);
3549 } 3549 }
3550 } 3550 }
3551 3551
3552 if (!focusChangeBlocked && m_focusedElement) { 3552 if (!focusChangeBlocked && m_focusedElement) {
3553 // Create the AXObject cache in a focus change because Chromium relies o n it. 3553 // Create the AXObject cache in a focus change because Chromium relies o n it.
3554 if (AXObjectCache* cache = axObjectCache()) 3554 if (AXObjectCache* cache = axObjectCache())
3555 cache->handleFocusedUIElementChanged(oldFocusedElement.get(), newFoc usedElement.get()); 3555 cache->handleFocusedUIElementChanged(oldFocusedElement.get(), newFoc usedElement.get());
3556 } 3556 }
3557 3557
3558 if (!focusChangeBlocked && frameHost()) 3558 if (!focusChangeBlocked && frameHost())
(...skipping 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after
5769 #ifndef NDEBUG 5769 #ifndef NDEBUG
5770 using namespace blink; 5770 using namespace blink;
5771 void showLiveDocumentInstances() 5771 void showLiveDocumentInstances()
5772 { 5772 {
5773 WeakDocumentSet& set = liveDocumentSet(); 5773 WeakDocumentSet& set = liveDocumentSet();
5774 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5774 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5775 for (Document* document : set) 5775 for (Document* document : set)
5776 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5776 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5777 } 5777 }
5778 #endif 5778 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698