| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 return 0; | 935 return 0; |
| 936 } | 936 } |
| 937 | 937 |
| 938 // We look for either the form containing the current focus, or for one | 938 // We look for either the form containing the current focus, or for one |
| 939 // immediately after it | 939 // immediately after it |
| 940 HTMLFormElement* FrameSelection::CurrentForm() const { | 940 HTMLFormElement* FrameSelection::CurrentForm() const { |
| 941 // Start looking either at the active (first responder) node, or where the | 941 // Start looking either at the active (first responder) node, or where the |
| 942 // selection is. | 942 // selection is. |
| 943 Node* start = GetDocument().FocusedElement(); | 943 Node* start = GetDocument().FocusedElement(); |
| 944 if (!start) | 944 if (!start) |
| 945 start = ComputeVisibleSelectionInDOMTreeDeprecated().Start().AnchorNode(); | 945 start = ComputeVisibleSelectionInDOMTree().Start().AnchorNode(); |
| 946 if (!start) | 946 if (!start) |
| 947 return 0; | 947 return 0; |
| 948 | 948 |
| 949 // Try walking up the node tree to find a form element. | 949 // Try walking up the node tree to find a form element. |
| 950 for (HTMLElement* element = | 950 for (HTMLElement* element = |
| 951 Traversal<HTMLElement>::FirstAncestorOrSelf(*start); | 951 Traversal<HTMLElement>::FirstAncestorOrSelf(*start); |
| 952 element; element = Traversal<HTMLElement>::FirstAncestor(*element)) { | 952 element; element = Traversal<HTMLElement>::FirstAncestor(*element)) { |
| 953 if (HTMLFormElement* form = AssociatedFormElement(*element)) | 953 if (HTMLFormElement* form = AssociatedFormElement(*element)) |
| 954 return form; | 954 return form; |
| 955 } | 955 } |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 } | 1184 } |
| 1185 | 1185 |
| 1186 void showTree(const blink::FrameSelection* sel) { | 1186 void showTree(const blink::FrameSelection* sel) { |
| 1187 if (sel) | 1187 if (sel) |
| 1188 sel->ShowTreeForThis(); | 1188 sel->ShowTreeForThis(); |
| 1189 else | 1189 else |
| 1190 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1190 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 #endif | 1193 #endif |
| OLD | NEW |