Closed Bug 180034 Opened 22 years ago Closed 22 years ago

we need selection and rules code respect the select_all style

Categories

(Core :: DOM: Selection, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mjudge, Assigned: mozeditor)

References

Details

(Whiteboard: moose; fixinhand)

Attachments

(3 files)

this needs to simulate one atomic selection item.  if this style reaches across
multiple nodes this needs to still work.
Attached file sample file
sample file with style on colored text.
patch to handle peek offset.
ok joe gimme some editor rules love ;-)
Status: NEW → ASSIGNED
assigning to me for the moment so I will see it in my queries.
Assignee: mjudge → jfrancis
Status: ASSIGNED → NEW
Whiteboard: moose
Target Milestone: --- → M1
Blocks: 118912
patch to editor.  I'll post a blurb explaining it later today.
Whiteboard: moose → moose; fixinhand
Attachment #107304 - Flags: superreview?(kin)
Attachment #107304 - Flags: review?(cmanske)
I tried to take a simple approach for this.  There are a few ways to break this
down.  First, consider:
collapsed selection vs ranged selection
I made no changes to anything in editor for the ranges selection case.  The
reson is that I am counting on the selection code to always select the whole
object if it has this style, so the editor should never need to check.
Next consider:
deletion vs everything else
I only changed deletion.  Everything else is unchanged.  There will be some
known bugs having to do with not preservring attribute across certain editor
actions.  For instance, if you have the special attribute on a paragraph, and
you use the editor to change it to a heading, the attribute will disappear.  And
when nodes are joined, the right node is kept.  So if you have the attribute on
a list item, and you use backspace to join the list item after it, the resulting
list item won't have the attribute.

But these are known issues that occur for any attribute, so they are really out
of the scope of this bug.

For the collapsed selection deletion case, I relied on the fact that almost all
of our deletion code eventually funnels through either DeleteText() or
DeleteNode().  The one place where it didn't I changed.  That change is where
WillDeleteSelection() used to let the default editor deletion code handle simple
text deletion.  The default editor code uses DeleteRange(), which would have
been complicated to change.  So instead I just changed it to not use the default
code, and go through DelteText().

Given that, it was a simpel matter to make nsHTMLEditor versions of DeleteText()
and DelteNode() that examine the node and it's ancestors for the special
{-moz-user-select: all} attribute/value pair, and if found delete the highest
node that has such style.
Comment on attachment 107304 [details] [diff] [review]
patch to libeditor

==== Since you are always returning immediately, there's no need for the |else|
in both |DeleteNode()| and |DeleteText()|.


+  if (selectAllNode)
+  {
+    return ...
+  }
+  else
+  {
+    return ...
+  }


==== I'm assuming there's no perf penalty for complex edits due to the added
call to |FindUserSelectAllNode()| in DeleteNode() and DeleteText(), right?
Attachment #107304 - Flags: superreview?(kin) → superreview+
Attachment #107304 - Flags: review?(cmanske) → review+
Comment on attachment 106171 [details] [diff] [review]
patch from the layout\html\base\src directory

sr=kin@netscape.com
Attachment #106171 - Flags: superreview+
Comment on attachment 106171 [details] [diff] [review]
patch from the layout\html\base\src directory

i dont really grok how this works, but i dont see any problems.
Attachment #106171 - Flags: review+
Comment on attachment 106171 [details] [diff] [review]
patch from the layout\html\base\src directory

r=brade but don't indent the #ifdefs or this line:
+  TryNextFrame:
both sets of patches landed on trunk
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Is there a patch to make this style flag also affect deleting the enclosed text 
via the Backspace or Del keys?  It seems that even with this patch in place, I 
can still Backspace-delete the contained text one character at a time.
The example in this bug seems to work for me on the trunk.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: