| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2337 // well. This code needs to be refactored (http://crbug.com/629721). | 2337 // well. This code needs to be refactored (http://crbug.com/629721). |
| 2338 bool WebViewImpl::selectionBounds(WebRect& anchor, WebRect& focus) const { | 2338 bool WebViewImpl::selectionBounds(WebRect& anchor, WebRect& focus) const { |
| 2339 const Frame* frame = focusedCoreFrame(); | 2339 const Frame* frame = focusedCoreFrame(); |
| 2340 if (!frame || !frame->isLocalFrame()) | 2340 if (!frame || !frame->isLocalFrame()) |
| 2341 return false; | 2341 return false; |
| 2342 | 2342 |
| 2343 const LocalFrame* localFrame = toLocalFrame(frame); | 2343 const LocalFrame* localFrame = toLocalFrame(frame); |
| 2344 if (!localFrame) | 2344 if (!localFrame) |
| 2345 return false; | 2345 return false; |
| 2346 FrameSelection& selection = localFrame->selection(); | 2346 FrameSelection& selection = localFrame->selection(); |
| 2347 if (!selection.isAvailable() || | 2347 if (!selection.isAvailable() || selection.selectionInDOMTree().isNone()) |
| 2348 selection.computeVisibleSelectionInDOMTreeDeprecated().isNone()) { | 2348 return false; |
| 2349 |
| 2350 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 2351 // needs to be audited. See http://crbug.com/590369 for more details. |
| 2352 localFrame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 2353 if (selection.computeVisibleSelectionInDOMTree().isNone()) { |
| 2349 // plugins/mouse-capture-inside-shadow.html reaches here. | 2354 // plugins/mouse-capture-inside-shadow.html reaches here. |
| 2350 return false; | 2355 return false; |
| 2351 } | 2356 } |
| 2352 | 2357 |
| 2353 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | |
| 2354 // needs to be audited. See http://crbug.com/590369 for more details. | |
| 2355 localFrame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | |
| 2356 | |
| 2357 DocumentLifecycle::DisallowTransitionScope disallowTransition( | 2358 DocumentLifecycle::DisallowTransitionScope disallowTransition( |
| 2358 localFrame->document()->lifecycle()); | 2359 localFrame->document()->lifecycle()); |
| 2359 | 2360 |
| 2360 if (selection.computeVisibleSelectionInDOMTreeDeprecated().isCaret()) { | 2361 if (selection.computeVisibleSelectionInDOMTreeDeprecated().isCaret()) { |
| 2361 anchor = focus = selection.absoluteCaretBounds(); | 2362 anchor = focus = selection.absoluteCaretBounds(); |
| 2362 } else { | 2363 } else { |
| 2363 const EphemeralRange selectedRange = | 2364 const EphemeralRange selectedRange = |
| 2364 selection.computeVisibleSelectionInDOMTreeDeprecated() | 2365 selection.computeVisibleSelectionInDOMTreeDeprecated() |
| 2365 .toNormalizedEphemeralRange(); | 2366 .toNormalizedEphemeralRange(); |
| 2366 if (selectedRange.isNull()) | 2367 if (selectedRange.isNull()) |
| (...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4177 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4178 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
| 4178 return nullptr; | 4179 return nullptr; |
| 4179 return focusedFrame; | 4180 return focusedFrame; |
| 4180 } | 4181 } |
| 4181 | 4182 |
| 4182 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4183 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
| 4183 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4184 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4184 } | 4185 } |
| 4185 | 4186 |
| 4186 } // namespace blink | 4187 } // namespace blink |
| OLD | NEW |