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

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

Issue 2797943002: Set plugin focus via element dispatch (Closed)
Patch Set: Remove testing var. 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 9e41f765649fb17d020fe6f900fca37b8307dda5..16ef0b30764ce929ee14194232de128a75041dd1 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -366,13 +366,6 @@ static inline bool isValidNamePart(UChar32 c) {
return true;
}
-static FrameViewBase* frameViewBaseForElement(const Element& focusedElement) {
- LayoutObject* layoutObject = focusedElement.layoutObject();
- if (!layoutObject || !layoutObject->isLayoutPart())
- return 0;
- return toLayoutPart(layoutObject)->frameViewBase();
-}
-
static bool acceptsEditingFocus(const Element& element) {
DCHECK(hasEditableStyle(element));
@@ -4030,7 +4023,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;
@@ -4055,15 +4047,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)
@@ -4128,25 +4111,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();
haraken 2017/04/05 11:59:00 Is it okay to remove updateStyleAndLayout()?
joelhockey 2017/04/05 23:59:11 I don't really know, but I can say that all the te
- // 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);
dcheng 2017/04/05 07:48:08 I think we can delete setFocused() off FrameViewBa
joelhockey 2017/04/05 23:59:11 Yes, done
- }
}
if (!focusChangeBlocked && m_focusedElement) {

Powered by Google App Engine
This is Rietveld 408576698