OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 return 0; | 2219 return 0; |
2220 FrameLoaderClient* client = frame->loader().client(); | 2220 FrameLoaderClient* client = frame->loader().client(); |
2221 if (!client || !client->isFrameLoaderClientImpl()) | 2221 if (!client || !client->isFrameLoaderClientImpl()) |
2222 return 0; | 2222 return 0; |
2223 return toFrameLoaderClientImpl(client)->webFrame(); | 2223 return toFrameLoaderClientImpl(client)->webFrame(); |
2224 } | 2224 } |
2225 | 2225 |
2226 WebFrameImpl* WebFrameImpl::fromFrameOwnerElement(Element* element) | 2226 WebFrameImpl* WebFrameImpl::fromFrameOwnerElement(Element* element) |
2227 { | 2227 { |
2228 // FIXME: Why do we check specifically for <iframe> and <frame> here? Why ca
n't we get the WebFrameImpl from an <object> element, for example. | 2228 // FIXME: Why do we check specifically for <iframe> and <frame> here? Why ca
n't we get the WebFrameImpl from an <object> element, for example. |
2229 if (!element || !element->isFrameOwnerElement() || (!element->hasTagName(HTM
LNames::iframeTag) && !element->hasTagName(HTMLNames::frameTag))) | 2229 if (!element || !element->isFrameOwnerElement() || (!isHTMLIFrameElement(*el
ement) && !isHTMLFrameElement(*element))) |
2230 return 0; | 2230 return 0; |
2231 return fromFrame(toHTMLFrameOwnerElement(element)->contentFrame()); | 2231 return fromFrame(toHTMLFrameOwnerElement(element)->contentFrame()); |
2232 } | 2232 } |
2233 | 2233 |
2234 WebViewImpl* WebFrameImpl::viewImpl() const | 2234 WebViewImpl* WebFrameImpl::viewImpl() const |
2235 { | 2235 { |
2236 if (!frame()) | 2236 if (!frame()) |
2237 return 0; | 2237 return 0; |
2238 return WebViewImpl::fromPage(frame()->page()); | 2238 return WebViewImpl::fromPage(frame()->page()); |
2239 } | 2239 } |
(...skipping 16 matching lines...) Expand all Loading... |
2256 // If the user has set the selection since the match was found, we | 2256 // If the user has set the selection since the match was found, we |
2257 // don't focus anything. | 2257 // don't focus anything. |
2258 VisibleSelection selection(frame()->selection().selection()); | 2258 VisibleSelection selection(frame()->selection().selection()); |
2259 if (!selection.isNone()) | 2259 if (!selection.isNone()) |
2260 return; | 2260 return; |
2261 | 2261 |
2262 // Try to find the first focusable node up the chain, which will, for | 2262 // Try to find the first focusable node up the chain, which will, for |
2263 // example, focus links if we have found text within the link. | 2263 // example, focus links if we have found text within the link. |
2264 Node* node = m_activeMatch->firstNode(); | 2264 Node* node = m_activeMatch->firstNode(); |
2265 if (node && node->isInShadowTree()) { | 2265 if (node && node->isInShadowTree()) { |
2266 Node* host = node->deprecatedShadowAncestorNode(); | 2266 if (Node* host = node->shadowHost()) { |
2267 if (host->hasTagName(HTMLNames::inputTag) || host->hasTagName(HTMLNa
mes::textareaTag)) | 2267 if (isHTMLInputElement(*host) || isHTMLTextAreaElement(*host)) |
2268 node = host; | 2268 node = host; |
| 2269 } |
2269 } | 2270 } |
2270 for (; node; node = node->parentNode()) { | 2271 for (; node; node = node->parentNode()) { |
2271 if (!node->isElementNode()) | 2272 if (!node->isElementNode()) |
2272 continue; | 2273 continue; |
2273 Element* element = toElement(node); | 2274 Element* element = toElement(node); |
2274 if (element->isFocusable()) { | 2275 if (element->isFocusable()) { |
2275 // Found a focusable parent node. Set the active match as the | 2276 // Found a focusable parent node. Set the active match as the |
2276 // selection and focus to the focusable node. | 2277 // selection and focus to the focusable node. |
2277 frame()->selection().setSelection(VisibleSelection(m_activeMatch
.get())); | 2278 frame()->selection().setSelection(VisibleSelection(m_activeMatch
.get())); |
2278 frame()->document()->setFocusedElement(element); | 2279 frame()->document()->setFocusedElement(element); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2484 | 2485 |
2485 // There is a possibility that the frame being detached was the only | 2486 // There is a possibility that the frame being detached was the only |
2486 // pending one. We need to make sure final replies can be sent. | 2487 // pending one. We need to make sure final replies can be sent. |
2487 flushCurrentScopingEffort(m_findRequestIdentifier); | 2488 flushCurrentScopingEffort(m_findRequestIdentifier); |
2488 | 2489 |
2489 cancelPendingScopingEffort(); | 2490 cancelPendingScopingEffort(); |
2490 } | 2491 } |
2491 } | 2492 } |
2492 | 2493 |
2493 } // namespace blink | 2494 } // namespace blink |
OLD | NEW |