Commit 26ffad3a authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Make Editor::CanCopy() to work with detached IFRAME

This patch makes |Editor::CanCopy()| to work with detached IFRAME to follow up
of the patch[1], which found this issue.

[1] http://crrev.com/575324: Use a safer pattern for auto resetting
RenderFrameImpl members

Bug: 746181
Change-Id: If00b1d22476264a042806ff9870ca32229041908
Reviewed-on: https://chromium-review.googlesource.com/578913
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488580}
parent 7b8416fb
......@@ -5,9 +5,6 @@
<script>
window[0].addEventListener('copy', (e) => {
document.querySelector('iframe').remove();
// TODO(dcheng): We really shouldn't do this but it turns out there are bugs
// in editing code. See https://crbug.com/746181 ^_^
e.preventDefault();
// Finish asynchronously, to make sure the renderer doesn't crash.
window.setTimeout(() => { document.title = 'done'; });
});
......
......@@ -354,6 +354,8 @@ bool Editor::CanCopy() const {
if (ImageElementFromImageDocument(GetFrame().GetDocument()))
return true;
FrameSelection& selection = GetFrame().Selection();
if (!selection.IsAvailable())
return false;
return selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsRange() &&
!IsInPasswordFieldWithUnrevealedPassword(
GetFrame().Selection().ComputeVisibleSelectionInDOMTree().Start());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment