Closed
Bug 120345
Opened 24 years ago
Closed 24 years ago
Avoid mDoctypeText string in nsExpatDriver
Categories
(Core :: DOM: HTML Parser, defect, P1)
Tracking
()
VERIFIED
FIXED
mozilla0.9.9
People
(Reporter: harishd, Assigned: harishd)
Details
Attachments
(3 files)
|
10.12 KB,
patch
|
Details | Diff | Splinter Review | |
|
11.10 KB,
patch
|
Details | Diff | Splinter Review | |
|
10.46 KB,
patch
|
hjtoi-bugzilla
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
--> 0.9.8.
This could have an impact on the xul window time.
Priority: -- → P1
Target Milestone: --- → mozilla0.9.8
Comment on attachment 65311 [details] [diff] [review]
patch v1.1 [ not too different from the above ]
>Index: htmlparser/src/nsExpatDriver.cpp
>===================================================================
>+static const PRUint32 kNotInDoctype = -1;
Doesn't this give a compiler warning? Either change that to PRInt32
or cast -1 to unsigned explicitly or something...
> nsExpatDriver::nsExpatDriver()
> :mExpatParser(0),
... I assume all the members are in declaration order...
>+ PRUint32 startOffset = ( mDoctypePos - mBytesParsed ) / 2;
>+ PRUint32 endOffset = ( XML_GetCurrentByteIndex(mExpatParser) - mBytesParsed ) / 2;
>
>+ const PRUnichar* doctypeStart = mBuffer + startOffset;
>+ const PRUnichar* doctypeEnd = mBuffer + endOffset;
>+
> if(mSink) {
>- mInternalState = mSink->HandleDoctypeDecl(mDoctypeText.get());
>+ mInternalState = mSink->HandleDoctypeDecl(doctypeStart, doctypeEnd - doctypeStart);
I believe you can write the above more efficiently by avoiding
the variables.
>Index: htmlparser/src/nsHTMLTokenizer.cpp
>===================================================================
>- aToken->SetEmpty(PR_TRUE);
> isUsableAttr = (mFlags & NS_IPARSER_FLAG_VIEW_SOURCE)? PR_TRUE:PR_FALSE; // Fix bug 103095
>+ aToken->SetEmpty(isUsableAttr); // We need this for viewsource
It looks like this is fixing some other bug?
>Index: content/xml/tests/load/test.xml
Better test with some XMLHTTPRequest cases as well because this
document.load() moves the doctype around weirdly - dunno what else
it is doing...
>Index: content/xul/document/src/nsXULContentSink.cpp
>===================================================================
>- aAttributes += 2;
What is this?
Attachment #65311 -
Flags: needs-work+
>+ PRUint32 startOffset = ( mDoctypePos - mBytesParsed ) / 2;
>+ PRUint32 endOffset = ( XML_GetCurrentByteIndex(mExpatParser) -
mBytesParsed ) / 2;
> >+ const PRUnichar* doctypeStart = mBuffer + startOffset;
>+ const PRUnichar* doctypeEnd = mBuffer + endOffset;
>+
> if(mSink) {
>- mInternalState = mSink->HandleDoctypeDecl(mDoctypeText.get());
>+ mInternalState = mSink->HandleDoctypeDecl(doctypeStart, doctypeEnd -
doctypeStart);
>>I believe you can write the above more efficiently by avoiding
>>the variables.
Yes, that's what I had initially but it was not too easy to read.
>Index: content/xul/document/src/nsXULContentSink.cpp
>===================================================================
>- aAttributes += 2;
>>What is this?
Found this bug. This was needed when there was a |while| loop but then when I
landed my changes I replaced the |while| with a |for| loop but forgot to remove
this line.
Comment on attachment 65373 [details] [diff] [review]
patch v1.2 [ includes heikki's suggestions ]
r=heikki
There is still the nsHTMLTokenizer.cpp, which I seem to recall you do not
intend to check in right now (part of another bug).
Attachment #65373 -
Flags: review+
Comment 8•24 years ago
|
||
Comment on attachment 65373 [details] [diff] [review]
patch v1.2 [ includes heikki's suggestions ]
sr=jst, modulo the changes that were not supposed to be in this patch
(nsHTMLTokenizer).
nsXMLContentSink::HandleDoctypeDecl could be futher optimized by removing the
nsAutoString's in favor of nsDependentString + iterators. Maybe file a new bug
on that?
Attachment #65373 -
Attachment description: patch v1.0 [ includes heikki's suggestions ] → patch v1.2 [ includes heikki's suggestions ]
Attachment #65373 -
Flags: superreview+
--> 0.9.9
Status: NEW → ASSIGNED
Target Milestone: mozilla0.9.8 → mozilla0.9.9
| Assignee | ||
Comment 10•24 years ago
|
||
Txul improved bug ~1%.
FIXED.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•