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 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 WebFrameImpl* WebFrameImpl::fromFrame(LocalFrame* frame) | 2216 WebFrameImpl* WebFrameImpl::fromFrame(LocalFrame* frame) |
2217 { | 2217 { |
2218 if (!frame) | 2218 if (!frame) |
2219 return 0; | 2219 return 0; |
2220 return toFrameLoaderClientImpl(frame->loader().client())->webFrame(); | 2220 return toFrameLoaderClientImpl(frame->loader().client())->webFrame(); |
2221 } | 2221 } |
2222 | 2222 |
2223 WebFrameImpl* WebFrameImpl::fromFrameOwnerElement(Element* element) | 2223 WebFrameImpl* WebFrameImpl::fromFrameOwnerElement(Element* element) |
2224 { | 2224 { |
2225 // 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. | 2225 // 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. |
2226 if (!element || !element->isFrameOwnerElement() || (!element->hasTagName(HTM
LNames::iframeTag) && !element->hasTagName(HTMLNames::frameTag))) | 2226 if (!element || !element->isFrameOwnerElement() || (!isHTMLIFrameElement(*el
ement) && !isHTMLFrameElement(*element))) |
2227 return 0; | 2227 return 0; |
2228 return fromFrame(toHTMLFrameOwnerElement(element)->contentFrame()); | 2228 return fromFrame(toHTMLFrameOwnerElement(element)->contentFrame()); |
2229 } | 2229 } |
2230 | 2230 |
2231 WebViewImpl* WebFrameImpl::viewImpl() const | 2231 WebViewImpl* WebFrameImpl::viewImpl() const |
2232 { | 2232 { |
2233 if (!frame()) | 2233 if (!frame()) |
2234 return 0; | 2234 return 0; |
2235 return WebViewImpl::fromPage(frame()->page()); | 2235 return WebViewImpl::fromPage(frame()->page()); |
2236 } | 2236 } |
(...skipping 17 matching lines...) Expand all Loading... |
2254 // don't focus anything. | 2254 // don't focus anything. |
2255 VisibleSelection selection(frame()->selection().selection()); | 2255 VisibleSelection selection(frame()->selection().selection()); |
2256 if (!selection.isNone()) | 2256 if (!selection.isNone()) |
2257 return; | 2257 return; |
2258 | 2258 |
2259 // Try to find the first focusable node up the chain, which will, for | 2259 // Try to find the first focusable node up the chain, which will, for |
2260 // example, focus links if we have found text within the link. | 2260 // example, focus links if we have found text within the link. |
2261 Node* node = m_activeMatch->firstNode(); | 2261 Node* node = m_activeMatch->firstNode(); |
2262 if (node && node->isInShadowTree()) { | 2262 if (node && node->isInShadowTree()) { |
2263 Node* host = node->deprecatedShadowAncestorNode(); | 2263 Node* host = node->deprecatedShadowAncestorNode(); |
2264 if (host->hasTagName(HTMLNames::inputTag) || host->hasTagName(HTMLNa
mes::textareaTag)) | 2264 ASSERT(host); |
| 2265 if (isHTMLInputElement(*host) || isHTMLTextAreaElement(*host)) |
2265 node = host; | 2266 node = host; |
2266 } | 2267 } |
2267 for (; node; node = node->parentNode()) { | 2268 for (; node; node = node->parentNode()) { |
2268 if (!node->isElementNode()) | 2269 if (!node->isElementNode()) |
2269 continue; | 2270 continue; |
2270 Element* element = toElement(node); | 2271 Element* element = toElement(node); |
2271 if (element->isFocusable()) { | 2272 if (element->isFocusable()) { |
2272 // Found a focusable parent node. Set the active match as the | 2273 // Found a focusable parent node. Set the active match as the |
2273 // selection and focus to the focusable node. | 2274 // selection and focus to the focusable node. |
2274 frame()->selection().setSelection(m_activeMatch.get()); | 2275 frame()->selection().setSelection(m_activeMatch.get()); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2481 | 2482 |
2482 // There is a possibility that the frame being detached was the only | 2483 // There is a possibility that the frame being detached was the only |
2483 // pending one. We need to make sure final replies can be sent. | 2484 // pending one. We need to make sure final replies can be sent. |
2484 flushCurrentScopingEffort(m_findRequestIdentifier); | 2485 flushCurrentScopingEffort(m_findRequestIdentifier); |
2485 | 2486 |
2486 cancelPendingScopingEffort(); | 2487 cancelPendingScopingEffort(); |
2487 } | 2488 } |
2488 } | 2489 } |
2489 | 2490 |
2490 } // namespace blink | 2491 } // namespace blink |
OLD | NEW |