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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2797943002: Set plugin focus via element dispatch (Closed)
Patch Set: Dispatch to DOM onblur/onfocus first, then call plugin Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 2f2611587cd266c7d2a511d7d9522b7051e41614..82d992587f997642ffe937fd4307e69f7687a98a 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -375,20 +375,6 @@ static inline bool isValidNamePart(UChar32 c) {
return true;
}
-static FrameViewBase* frameViewBaseForElement(const Element& focusedElement) {
- // Return either plugin or frame.
- // TODO(joelhockey): FrameViewBase class will soon be removed. It will be
- // replaced with Focusable ABC that FrameView and PluginView will implement
- // and this method will return Focusable.
- if (isHTMLPlugInElement(focusedElement))
- return toHTMLPlugInElement(focusedElement).plugin();
-
- LayoutObject* layoutObject = focusedElement.layoutObject();
- if (!layoutObject || !layoutObject->isLayoutPart())
- return 0;
- return toLayoutPart(layoutObject)->frameViewBase();
-}
-
static bool acceptsEditingFocus(const Element& element) {
DCHECK(hasEditableStyle(element));
@@ -4053,7 +4039,6 @@ bool Document::setFocusedElement(Element* prpNewFocusedElement,
if (page() && (page()->focusController().isFocused())) {
oldFocusedElement->dispatchBlurEvent(newFocusedElement, params.type,
params.sourceCapabilities);
-
if (m_focusedElement) {
// handler shifted focus
focusChangeBlocked = true;
@@ -4078,15 +4063,6 @@ bool Document::setFocusedElement(Element* prpNewFocusedElement,
newFocusedElement = nullptr;
}
}
-
- if (view()) {
- FrameViewBase* oldFrameViewBase =
- frameViewBaseForElement(*oldFocusedElement);
- if (oldFrameViewBase)
- oldFrameViewBase->setFocused(false, params.type);
- else
- view()->setFocused(false, params.type);
- }
}
if (newFocusedElement)
@@ -4151,25 +4127,6 @@ bool Document::setFocusedElement(Element* prpNewFocusedElement,
if (isRootEditableElement(*m_focusedElement))
frame()->spellChecker().didBeginEditing(m_focusedElement.get());
-
- // eww, I suck. set the qt focus correctly
- // ### find a better place in the code for this
- if (view()) {
- FrameViewBase* focusFrameViewBase =
- frameViewBaseForElement(*m_focusedElement);
- if (focusFrameViewBase) {
- // Make sure a FrameViewBase has the right size before giving it focus.
- // Otherwise, we are testing edge cases of the FrameViewBase code.
- // Specifically, in WebCore this does not work well for text fields.
- updateStyleAndLayout();
- // Re-get the FrameViewBase in case updating the layout changed things.
- focusFrameViewBase = frameViewBaseForElement(*m_focusedElement);
- }
- if (focusFrameViewBase)
- focusFrameViewBase->setFocused(true, params.type);
- else
- view()->setFocused(true, params.type);
- }
}
if (!focusChangeBlocked && m_focusedElement) {

Powered by Google App Engine
This is Rietveld 408576698