Closed
Bug 81989
Opened 23 years ago
Closed 23 years ago
STYLE tags can cause multiple copies of stylesheet to be loaded
Categories
(Core :: Layout, defect, P1)
Core
Layout
Tracking
()
VERIFIED
FIXED
mozilla0.9.1
People
(Reporter: peterv, Assigned: peterv)
Details
(Keywords: perf, regression, Whiteboard: [fixinhand])
Attachments
(6 files)
5.55 KB,
patch
|
Details | Diff | Splinter Review | |
7.19 KB,
patch
|
Details | Diff | Splinter Review | |
7.48 KB,
patch
|
Details | Diff | Splinter Review | |
7.56 KB,
patch
|
Details | Diff | Splinter Review | |
7.69 KB,
patch
|
Details | Diff | Splinter Review | |
6.66 KB,
patch
|
Details | Diff | Splinter Review |
I was going to keep this clean-up to the HTML content sink for later, but I've discovered that without it we load multiple copies of stylesheets specified through a <style src=...> tag. This is very bad, I think we should try to get this in before tree closure.
Assignee | ||
Updated•23 years ago
|
Severity: normal → major
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla0.9.1
Assignee | ||
Comment 1•23 years ago
|
||
Assignee | ||
Comment 2•23 years ago
|
||
Comment 3•23 years ago
|
||
The changes look good to me, one additional change that could be made here: for (i = 0; i < count; i++) { nsAutoString key(aNode.GetKeyAt(i)); - if (key.EqualsIgnoreCase("src")) { - GetAttributeValueAt(aNode, i, src); - src.StripWhitespace(); - } - else if (key.EqualsIgnoreCase("title")) { + if (key.EqualsIgnoreCase("title")) { is to change the 'key' variable to be a const nsAReadableString& here which would avoid a string copy per attribute, if this change is made the the EqualsIgnoreCase() calls need to be changed to Compare() calls to get case insensitive compare. Either way, sr=jst
Comment 4•23 years ago
|
||
Or even better, use element->GetAttribute() to get the value of all those attributes as you do for getting the src attribute. But again, that's not required...
Assignee | ||
Comment 5•23 years ago
|
||
This looks ok to me too, r=heikki.
Comment 7•23 years ago
|
||
My sr=jst still applies...
Assignee | ||
Comment 8•23 years ago
|
||
I think this should go in for 0.9.1. I have a fix and it is low-risk. Trying to load the same styleheet multiple times (though it is only specified once) is a performance hit, and the document ends up with a style model which is wrong.
Whiteboard: [fixinhand]
Comment 9•23 years ago
|
||
Uhhhh... - if(mCurrentContext!=nsnull) { + if (!mCurrentContext) { parent=mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent; } Same again, later on. Use 'if (p)' rather than 'if (p != nsnull)', and 'if (!p)' rather than 'if (p == nsnull)' -- and try spaces around operators, my eyes thank you! /be
Comment 10•23 years ago
|
||
Was the patch really tested? Need a new patch, review and super-review before we can go for approval in 0.9.1. /be
Assignee | ||
Comment 11•23 years ago
|
||
Assignee | ||
Comment 12•23 years ago
|
||
Fixed the gross errors. Fixed what I think Brendan meant with "try spaces around operators" (in one line). Tested with the actual patch I attached, only one stylesheet is loaded and shows up when doing "dump stylesheets". Re-applying for r and sr.
Once again, r=heikki. I seem to have a habit of thinking some of those boolean logic changes are wrong when they are correct, and correct when they are wrong :/ All bow to Brendan :)
Comment 14•23 years ago
|
||
Oh geez, I can't believe I didn't see that, now I'm embarrassed. Thanks for catching that, Brendan.
Comment 15•23 years ago
|
||
+ nsIDOMText* tc; + rv = text->QueryInterface(NS_GET_IID(nsIDOMText), (void**)&tc); [...] + tc->SetData(content); + NS_RELEASE(tc); any reason why you aren't using nsCOMPtr<> there? Same with the nsIContent *text above and below. other than that, sr=blizzard
Comment 16•23 years ago
|
||
oh, and a=blizzard for 0.9.1 when you respond to my one comment.
Assignee | ||
Comment 17•23 years ago
|
||
Assignee | ||
Comment 18•23 years ago
|
||
Comment 19•23 years ago
|
||
Is this fixed now, peterv? Looks like it went in last night...
Comment 20•23 years ago
|
||
Note that the variable `i' is now unused... c:\seamonkey\mozilla\content\html\document\src\nsHTMLContentSink.cpp(4663) : warning C4101: 'i' : unreferenced local variable
Comment 21•23 years ago
|
||
Memory leaks went up pretty steep after this fix went in...
Assignee | ||
Comment 22•23 years ago
|
||
Bug 83093 deals with the leaks.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 23•23 years ago
|
||
This is actually an HTML element bug, not a CSS bug (the CSS part was working fine, it was just being called twice). Sending to HTML Element for verification.
Component: Style System → HTML Element
QA Contact: ian → bsharma
Comment 24•23 years ago
|
||
Verified on: build: 2001-07-02-04-Trunk platform: WinNT Below is the test case that I used to verify this bug. The test case loads fine. <HTML> <body> <P STYLE="color: red; font-family: 'New Century Schoolbook', serif src:..."> This paragraph is styled in red with the New Century Schoolbook font, if available.</P> </BODY> </HTML>
Status: RESOLVED → VERIFIED
SPAM. HTML Element component deprecated, changing component to Layout. See bug 88132 for details.
Component: HTML Element → Layout
You need to log in
before you can comment on or make changes to this bug.
Description
•