Closed Bug 153998 Opened 22 years ago Closed 19 years ago

COtherDTD should go; composer should handle containment checking itself

Categories

(Core :: DOM: HTML Parser, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: bzbarsky, Assigned: peterv)

References

Details

Attachments

(2 files)

COtherDTD only exists because composer wants containment checking.  It's a way
too heavyweight solution for that...  we should do the containment checking in
composer itself and remove COtherDTD.
See also bug 130439.  (The last patch there hasn't been checked in.)
Assignee: harishd → peterv
Attached patch v1Splinter Review
Attachment #187959 - Flags: review?(mrbkap)
Comment on attachment 187959 [details] [diff] [review]
v1

>Index: editor/libeditor/html/nsHTMLEditUtils.cpp
>===================================================================
>+
>+
>+#define GROUP_NONE             0

Nit: Extra newline (though a comment explaining what these #defines are for
would probably not hurt).
Note: I'm assuming that you basically just translated the containment lists and
the groups from the original code. From a quick check, everything looks OK,
though.

>+PRBool
>+nsHTMLEditUtils::CanContain(PRInt32 aParent, PRInt32 aChild)
>+{
>+#ifdef DEBUG
>+  PRInt32 i;
>+  for (i = 1; i <= eHTMLTag_userdefined; ++i) {
>+    NS_ASSERTION(kElements[i - 1].mTag == i,
>+                 "You need to update kElements (missing tags).");
>+  }
>+#endif

Does this check need to happen every time someone calls ::CanContain in a debug
build? Why not have something like:
static PRBool checked = PR_FALSE;
if (!checked) {
  checked = PR_TRUE;
  // check...
}

>+  return (parent.mCanContainGroups & child.mGroup) ? PR_TRUE : PR_FALSE;

Nit: that could be "(parent.mCanContainGroups & child.mGroups) != 0", but
that's a question of style.

Other than those nits, r=me
Attachment #187959 - Flags: review?(mrbkap) → review+
Attachment #187959 - Flags: superreview?(jst)
Comment on attachment 187959 [details] [diff] [review]
v1

Nice! sr=jst
Attachment #187959 - Flags: superreview?(jst) → superreview+
Comment on attachment 187959 [details] [diff] [review]
v1

This should give a bit of codesize reduction. I've verified that the new code
returns the same result for all combinations of input as the old code by
feeding all possible input values to both.
Attachment #187959 - Flags: approval1.8b4?
My inclination is not to approve this for 1.8, since touching editor always
tends to blow up and gets much less QA anyway: is there a good reason why we
need this?
Well, I'm not going to spend much time on getting this approval. I felt
confident enough about the code to ask for it, and from a quick measurement this
gives about 20k codesize reduction on Windows.
QA Contact: moied → ian
Comment on attachment 187959 [details] [diff] [review]
v1

Let's get this in on the trunk after we branch.
Attachment #187959 - Flags: approval1.8b4? → approval1.8b4-
Finally checked this in. From brad: mZdiff:-36448.
Status: NEW → RESOLVED
Closed: 19 years ago
Priority: -- → P3
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8beta4
So this just landed on the trunk, right?  Not sure how to interpret the target
milestone here...
Target Milestone: mozilla1.8beta4 → mozilla1.9alpha
*** Bug 63116 has been marked as a duplicate of this bug. ***
Comment on attachment 187959 [details] [diff] [review]
v1

Unfortunately it seems as if this patch is also required to fix bug 299343 so I'm requesting the same approvals although less hopefully.
Attachment #187959 - Flags: approval1.8.1?
Attachment #187959 - Flags: approval1.8.0.1?
Comment on attachment 187959 [details] [diff] [review]
v1

I see no need to put this on the branch, the patch for bug 299343 should be ported to the branch and that's unrelated to this patch.
Attachment #187959 - Flags: approval1.8.1?
Attachment #187959 - Flags: approval1.8.0.1?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: