Closed
Bug 179055
Opened 23 years ago
Closed 22 years ago
inline styles not always coalesced in CSS mode
Categories
(Core :: DOM: Editor, defect, P2)
Core
DOM: Editor
Tracking
()
VERIFIED
FIXED
mozilla1.3alpha
People
(Reporter: glazou, Assigned: glazou)
Details
(Whiteboard: editorbase+, fix in hand, needs sr=)
Attachments
(1 file, 1 obsolete file)
4.62 KB,
patch
|
mozeditor
:
review+
peterv
:
superreview+
|
Details | Diff | Splinter Review |
1. launch composer in CSS mode
2. type aaabbbccc
3. bolden bbc
4. bolden aab
Expected result :
a<span style="font-weight: bold;">aabbbc</span>cc
Actual result :
a<span style="font-weight: bold;">aab</span><span style="font-weight:
bold;">bbc</span>cc
Assignee | ||
Comment 1•23 years ago
|
||
Assignee | ||
Updated•23 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P2
Whiteboard: editorbase → editorbase, fix in hand, needs r=, needs sr=
Target Milestone: --- → mozilla1.3alpha
Assignee | ||
Comment 2•23 years ago
|
||
Comment on attachment 105578 [details] [diff] [review]
patch #1, Kathy's dream
Joe, can you review this bug please ?
Attachment #105578 -
Flags: review?(jfrancis)
Comment 4•22 years ago
|
||
This is a good start but there is one major issue: the merging code in the css
case is driven entirely off of |IsSpanEquivalentToHTMLInlineStyle()|. This
works only if the spans that we are checking have only one property.
Example that illustrates the problem:
type "aaabbb"
select "aaa"
bold
italic
select "bbb"
bold
italic
Now look at the source. No merge, even though spans have exact same properties.
In HTML only mode, we do a get a merge on the outer <i> elements, but not on the
inner <b> elements. If you can get this working, the css-enabled editor has a
chance to do this better than the html editor.
Other changes I would like to see:
Use the existing curly brace style for the nsHTMLEditorStyle.cpp part of the
patch. I hate it when curly brace style changes from place to place in the same
file.
Also, I would suggest changing the code there slightly to just set |mergeNodes|
boolean inside the if clauses, and not call |MoveNode()|. Then outside both if
clauses have an: |if (mergeNodes) MoveNodes(...)| That way we don't have two
identical MoveNode calls to keep in sync durng future changes to the source.
Hope this helps. Do you want to tackle the big issue in this patch, or wait on
that until later?
Assignee | ||
Updated•22 years ago
|
Attachment #105578 -
Flags: review?(jfrancis) → review-
Updated•22 years ago
|
Whiteboard: editorbase, fix in hand, needs r=, needs sr= → editorbase+, fix in hand, needs r=, needs sr=
Assignee | ||
Comment 5•22 years ago
|
||
Attachment #105578 -
Attachment is obsolete: true
Assignee | ||
Comment 6•22 years ago
|
||
Comment on attachment 106903 [details] [diff] [review]
patch #2, mucho mucho simpler
Joe, can you re-review please ?
Attachment #106903 -
Flags: review?(jfrancis)
Comment 7•22 years ago
|
||
I dont understand this patch.
i applied it, and tried the following:
type "aaabbb"
select "aaa"
make bold
select "bbb"
make bold
I get two identical spans, unmerged. Looking at the code I think they would
merge, but they don't.
Then, from examining the code, I see that you look for adjacent spans, but don't
check to see if they have matching attributes. I'm concerned that if this code
did cause a merge, it might merge spans that had different styles.
Comment 8•22 years ago
|
||
I tried this patch again and it works. Meanwhile, the part of this patch that
is comparing style attributes on the spans is hidden inside NodesSameType(),
which eluded me because that function in overloaded. The nsEditor version does
not check styles. The nsHTMLEditor version checks css style, but only on spans.
I find that very confusing.
Updated•22 years ago
|
Attachment #106903 -
Flags: review?(jfrancis) → review+
Assignee | ||
Comment 9•22 years ago
|
||
Comment on attachment 106903 [details] [diff] [review]
patch #2, mucho mucho simpler
Peter, can you sr please ?
Attachment #106903 -
Flags: superreview?(peterv)
Assignee | ||
Updated•22 years ago
|
Whiteboard: editorbase+, fix in hand, needs r=, needs sr= → editorbase+, fix in hand, needs sr=
Comment 10•22 years ago
|
||
Comment on attachment 106903 [details] [diff] [review]
patch #2, mucho mucho simpler
>+ if (nextSibling || previousSibling)
>+ {
>+ nsCOMPtr<nsIDOMNode> mergeParent;
>+ res = tmp->GetParentNode(getter_AddRefs(mergeParent));
>+ if (NS_FAILED(res)) return res;
Move the return on its own line please.
>+ if (previousSibling &&
>+ nsTextEditUtils::NodeIsType(previousSibling, NS_LITERAL_STRING("span")) &&
>+ NodesSameType(tmp, previousSibling))
>+ {
>+ res = JoinNodes(previousSibling, tmp, mergeParent);
>+ if (NS_FAILED(res)) return res;
Same here.
Attachment #106903 -
Flags: superreview?(peterv) → superreview+
Assignee | ||
Comment 11•22 years ago
|
||
checked in (trunk)
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 12•22 years ago
|
||
RogerMW--I'm not sure you need this patch since it's when people are editing
css/inline styles. If you want to try it out, focus on the last two blocks of
the patch.
Daniel--is this the other bug I just asked about in a different bug?
Comment 13•22 years ago
|
||
vrfy'd fixed using 2003.02.19 (linux rh8.0). tested comment 0 and comment 4, as
well as an "overlapping" test for sanity below, and the inline styles are merged
nicely as expected.
1. enter "aaabbb"
2. select and bold "aab"
3. select and bold "abb"
4. check source --should have only one inline style spanning "aabb".
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•