WebKit Bugzilla
Attachment 361022 Details for
Bug 194143
: Unable to move selection into editable roots with 0 height
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing (w/ typo fix)
bug-194143-20190203121534.patch (text/plain), 8.83 KB, created by
Wenson Hsieh
on 2019-02-03 12:15:35 PST
(
hide
)
Description:
Patch for landing (w/ typo fix)
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-02-03 12:15:35 PST
Size:
8.83 KB
patch
obsolete
>Subversion Revision: 240901 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 990c955991d45ab7c63e1ca9bef6e410329ce712..499f0599494434b056172d3cc10d17301560a318 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2019-02-03 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Unable to move selection into editable roots with 0 height >+ https://bugs.webkit.org/show_bug.cgi?id=194143 >+ <rdar://problem/47767284> >+ >+ Reviewed by Ryosuke Niwa. >+ >+ Currently, positions inside editable elements of height 0 are not considered to be candidates when >+ canonicalizing a position to its visible counterpart. This prevents us from moving the selection into these >+ editable roots at all. To fix this, we relax this constraint by allowing positions anchored by root editable >+ elements to be candidates. >+ >+ Test: editing/selection/insert-text-in-empty-content-editable.html >+ >+ * dom/Position.cpp: >+ (WebCore::Position::isCandidate const): >+ > 2019-02-02 Simon Fraser <simon.fraser@apple.com> > > Tidy up data memebers of FrameView and related classes to shrink class sizes >diff --git a/Source/WebCore/dom/Position.cpp b/Source/WebCore/dom/Position.cpp >index f23627f8c5ab7e7c549fd5ccf2f5b383b1466252..5ef5b1132cdc26527234d570b6576f00c3331fe4 100644 >--- a/Source/WebCore/dom/Position.cpp >+++ b/Source/WebCore/dom/Position.cpp >@@ -1032,7 +1032,7 @@ bool Position::isCandidate() const > > if (is<RenderBlockFlow>(*renderer) || is<RenderGrid>(*renderer) || is<RenderFlexibleBox>(*renderer)) { > RenderBlock& block = downcast<RenderBlock>(*renderer); >- if (block.logicalHeight() || is<HTMLBodyElement>(*m_anchorNode)) { >+ if (block.logicalHeight() || is<HTMLBodyElement>(*m_anchorNode) || m_anchorNode->isRootEditableElement()) { > if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(block)) > return atFirstEditingPositionForNode() && !Position::nodeIsUserSelectNone(deprecatedNode()); > return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSelectNone(deprecatedNode()) && atEditingBoundary(); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 966680f90c3bf76196d8a2a4025dff1e7a94b6e5..4dec7d1dccafd952faa9c5b54fd9bd2ed128606e 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2019-02-03 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Unable to move selection into editable roots with 0 height >+ https://bugs.webkit.org/show_bug.cgi?id=194143 >+ <rdar://problem/47767284> >+ >+ Reviewed by Ryosuke Niwa. >+ >+ Add a new layout test that executes editing commands in a contenteditable element of height 0, and adjust an >+ existing layout test that copies and pastes an image element to wait until the image has loaded. >+ >+ * editing/pasteboard/styled-element-markup.html: >+ * editing/selection/insert-text-in-empty-content-editable-expected.txt: Added. >+ * editing/selection/insert-text-in-empty-content-editable.html: Added. >+ > 2019-02-02 Justin Fan <justin_fan@apple.com> > > [WebGPU] Fix GPURenderPassEncoder::setVertexBuffers and allow overlapping indices with GPUBindGroups >diff --git a/LayoutTests/editing/pasteboard/styled-element-markup.html b/LayoutTests/editing/pasteboard/styled-element-markup.html >index a831e28e0c11138d482160aa0889021a246e1f00..063824748cb13d67d4e86334e135338afce75a40 100644 >--- a/LayoutTests/editing/pasteboard/styled-element-markup.html >+++ b/LayoutTests/editing/pasteboard/styled-element-markup.html >@@ -1,16 +1,16 @@ >-<script> >-if (window.testRunner) >- testRunner.dumpEditingCallbacks(); >-</script> > <p>This tests copy/paste of styled elements, like images. The image in the region below should be centered after its copied and pasted.</p> > <p><b>This demonstrates a bug: createMarkup puts the text-align property on the image, which doesn't center it, so its left aligned on paste.</b></p> > <div contenteditable="true" id="copy"><center><img src="../resources/abe.png"></center></div> > <div contenteditable="true" id="paste"></div> >+<script> >+if (window.testRunner) >+ testRunner.dumpEditingCallbacks(); > >-<script>; >-window.getSelection().setPosition(document.getElementById("copy")); >-document.execCommand("SelectAll"); >-document.execCommand("Copy"); >-window.getSelection().setPosition(document.getElementById("paste")); >-document.execCommand("Paste"); >+addEventListener("load", () => { >+ getSelection().setPosition(document.getElementById("copy")); >+ document.execCommand("SelectAll"); >+ document.execCommand("Copy"); >+ getSelection().setPosition(document.getElementById("paste")); >+ document.execCommand("Paste"); >+}); > </script> >diff --git a/LayoutTests/editing/selection/insert-text-in-empty-content-editable-expected.txt b/LayoutTests/editing/selection/insert-text-in-empty-content-editable-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..09d6c9c25c420ec08e72736f098e05478f08d883 >--- /dev/null >+++ b/LayoutTests/editing/selection/insert-text-in-empty-content-editable-expected.txt >@@ -0,0 +1,29 @@ >+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document >+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification >+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE >+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification >+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE >+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification >+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification >+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document >+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification >+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification >+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document >+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification >+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE >+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification >+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE >+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification >+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification >+Verifies the ability to programmatically focus and insert text in an empty editable element. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS editor1.textContent is "Hello world" >+PASS editor2.textContent is "Hello world!" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+Hello world >+Hello world! >diff --git a/LayoutTests/editing/selection/insert-text-in-empty-content-editable.html b/LayoutTests/editing/selection/insert-text-in-empty-content-editable.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f14ef07441aaf4ff307008f60bc9dc6443dda656 >--- /dev/null >+++ b/LayoutTests/editing/selection/insert-text-in-empty-content-editable.html >@@ -0,0 +1,29 @@ >+<!DOCTYPE html> >+<head> >+<script src="../../resources/js-test.js"></script> >+<style> >+ #editor1, #editor2 { >+ width: 100%; >+ height: 0; >+ } >+</style> >+</head> >+<body> >+<div contenteditable="true" id="editor1"></div> >+<div contenteditable="true" id="editor2">!</div> >+<script> >+ if (window.testRunner) >+ testRunner.dumpEditingCallbacks(); >+ >+ description("Verifies the ability to programmatically focus and insert text in an empty editable element."); >+ editor1 = document.getElementById("editor1"); >+ editor1.focus(); >+ document.execCommand("InsertText", true, "Hello world"); >+ shouldBeEqualToString("editor1.textContent", "Hello world"); >+ >+ editor2 = document.getElementById("editor2"); >+ editor2.focus(); >+ document.execCommand("InsertText", true, "Hello world"); >+ shouldBeEqualToString("editor2.textContent", "Hello world!"); >+</script> >+</body>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194143
:
360996
| 361022