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

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2881013003: Move FrameSelection::CurrentForm() to ContextMenuClientImpl (Closed)
Patch Set: updated PS Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index 2aad1f7357aadfda94d1712a747c6d1235d12b7a..0f41404311955f554c87dd114af25d9849f0d742 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -59,7 +59,6 @@
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
#include "core/html/HTMLBodyElement.h"
-#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLFrameElementBase.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLSelectElement.h"
@@ -942,55 +941,6 @@ LayoutRect FrameSelection::UnclippedBounds() const {
return LayoutRect(layout_selection_->SelectionBounds());
}
-static inline HTMLFormElement* AssociatedFormElement(HTMLElement& element) {
- if (isHTMLFormElement(element))
- return &toHTMLFormElement(element);
- return element.formOwner();
-}
-
-// Scans logically forward from "start", including any child frames.
-static HTMLFormElement* ScanForForm(Node* start) {
- if (!start)
- return 0;
-
- for (HTMLElement& element : Traversal<HTMLElement>::StartsAt(
- start->IsHTMLElement() ? ToHTMLElement(start)
- : Traversal<HTMLElement>::Next(*start))) {
- if (HTMLFormElement* form = AssociatedFormElement(element))
- return form;
-
- if (IsHTMLFrameElementBase(element)) {
- Node* child_document = ToHTMLFrameElementBase(element).contentDocument();
- if (HTMLFormElement* frame_result = ScanForForm(child_document))
- return frame_result;
- }
- }
- return 0;
-}
-
-// We look for either the form containing the current focus, or for one
-// immediately after it
-HTMLFormElement* FrameSelection::CurrentForm() const {
- // Start looking either at the active (first responder) node, or where the
- // selection is.
- Node* start = GetDocument().FocusedElement();
- if (!start)
- start = ComputeVisibleSelectionInDOMTree().Start().AnchorNode();
- if (!start)
- return 0;
-
- // Try walking up the node tree to find a form element.
- for (HTMLElement* element =
- Traversal<HTMLElement>::FirstAncestorOrSelf(*start);
- element; element = Traversal<HTMLElement>::FirstAncestor(*element)) {
- if (HTMLFormElement* form = AssociatedFormElement(*element))
- return form;
- }
-
- // Try walking forward in the node tree to find a form element.
- return ScanForForm(start);
-}
-
void FrameSelection::RevealSelection(const ScrollAlignment& alignment,
RevealExtentOption reveal_extent_option) {
DCHECK(IsAvailable());
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.h ('k') | third_party/WebKit/Source/web/ContextMenuClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698