Closed
Bug 123343
Opened 24 years ago
Closed 24 years ago
XML output handler needs to handle base-tags
Categories
(Core :: XSLT, defect, P3)
Core
XSLT
Tracking
()
VERIFIED
FIXED
mozilla1.0
People
(Reporter: sicking, Assigned: sicking)
References
()
Details
Attachments
(1 file, 6 obsolete files)
|
22.37 KB,
patch
|
sicking
:
review+
sicking
:
superreview+
roc
:
approval+
|
Details | Diff | Splinter Review |
We need to do what the xml contentsink does and special-handle <base> tags
Comment 1•24 years ago
|
||
and here is a piece of spec:
http://www.w3.org/TR/html4/struct/links.html#h-12.4
| Assignee | ||
Comment 2•24 years ago
|
||
this adds a bunch of html-handling to the output handler. I desided to break
out the handling from ::closePrevious and ::startElement since with the new
code i needed to add it just became too messy IMHO.
So now we have ::startHTMLElement which is called right after the element is
created, and ::endHTMLElement which is called when the the element is closed.
::startHTMLElement returns a boolean which indicates if the element is to be
inserted in the tree or if that should be held off until the elements children
are processed (for <script>).
The patch fixes:
* support <base>
* support <meta http-equiv="...">
* keep track of stylesheets and specify stylesheetindex to speed up (and
correct) cascading order
| Assignee | ||
Comment 3•24 years ago
|
||
| Assignee | ||
Comment 4•24 years ago
|
||
my patch, my bug
Assignee: peterv → sicking
Priority: -- → P3
Target Milestone: --- → mozilla1.0
| Assignee | ||
Comment 5•24 years ago
|
||
I just noted that this patch also fixes the fact that all stylesheets in the
result document gets doubled.
Comment 6•24 years ago
|
||
Comment on attachment 71100 [details] [diff] [review]
patch v1 -w
>+PRBool txMozillaXMLOutput::startHTMLElement(nsIDOMElement* aElement)
>+{
>+ PRBool dontAppendNode = PR_FALSE;
> nsCOMPtr<nsIAtom> atom;
>- currentContent->GetTag(*getter_AddRefs(atom));
>- if ((atom == txHTMLAtoms::title) && mTitleElement) {
>+ nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
>+ content->GetTag(*getter_AddRefs(atom));
>+
>+ if (atom == txHTMLAtoms::script) {
>+ dontAppendNode = PR_TRUE;
>+ }
>+
>+ nsCOMPtr<nsIStyleSheetLinkingElement> ssle =
>+ do_QueryInterface(aElement);
>+ if (ssle) {
>+ // XXX Trick nsCSSLoader into blocking/notifying us?
>+ // We would need to implement nsIParser and
>+ // pass ourselves as first parameter to
>+ // InitStyleLinkElement. We would then be notified
>+ // of stylesheet loads/load failures.
>+ ssle->InitStyleLinkElement(nsnull, PR_FALSE);
>+ ssle->SetEnableUpdates(PR_FALSE);
>+ }
>+
>+ return dontAppendNode;
>+}
I think you could just do mDontAddCurrent = (atom == txHTMLAtoms::script);
>Index: source/xslt/txMozillaXMLOutput.h
>===================================================================
>RCS file: /cvsroot/mozilla/extensions/transformiix/source/xslt/txMozillaXMLOutput.h,v
>retrieving revision 1.2
>diff -u -w -r1.2 txMozillaXMLOutput.h
>--- source/xslt/txMozillaXMLOutput.h 19 Feb 2002 22:48:07 -0000 1.2
>+++ source/xslt/txMozillaXMLOutput.h 23 Feb 2002 19:08:44 -0000
>@@ -160,7 +160,9 @@
>
> private:
> void closePrevious(PRInt8 aAction);
>- void startHTMLElement(nsIDOMElement* aElement);
>+ PRBool startHTMLElement(nsIDOMElement* aElement);
>+ void endHTMLElement(nsIDOMElement* aElement, PRBool aXHTML);
>+ void ProcessHTTPEquiv(nsIAtom* aHeader, nsAReadableString& aValue);
processHTTPEquiv
| Assignee | ||
Comment 7•24 years ago
|
||
addresses petervs comments and moves the set-refresh-timer code to endDocument
on Pikes request.
Attachment #71099 -
Attachment is obsolete: true
Attachment #71100 -
Attachment is obsolete: true
| Assignee | ||
Comment 8•24 years ago
|
||
oops, the comment at the top of txMozillaXMLOutput::processHTTPEquiv is
supposed to say
// For now we only handle "refresh". There's a longer list in
// HTMLContentSink::ProcessHeaderData
done locally
Status: NEW → ASSIGNED
Comment 9•24 years ago
|
||
Comment on attachment 72843 [details] [diff] [review]
patch v2
>+ if (!mRefreshString.IsEmpty()) {
>+ nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
>+ nsCOMPtr<nsIScriptGlobalObject> sgo;
>+ doc->GetScriptGlobalObject(getter_AddRefs(sgo));
>+ if(!sgo)
Space after if
>+ return;
>+ nsCOMPtr<nsIDocShell> docShell;
>+ sgo->GetDocShell(getter_AddRefs(docShell));
>+ if(!docShell)
Ditto
>+ return;
>+ nsCOMPtr<nsIRefreshURI> refURI = do_QueryInterface(docShell);
>+ if(!refURI)
Ditto
>@@ -311,7 +307,7 @@
> closePrevious(eCloseElement | eFlushText);
>
> nsresult rv;
>-
>+
Don't add the extra spaces.
>+ nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
>+ NS_ASSERTION(doc, "document doesn't implement nsIDocument");
>+ nsAutoString value;
>+ content->GetAttr(kNameSpaceID_HTML, txHTMLAtoms::target, value);
>+ doc->SetBaseTarget(value);
kNameSpaceID_None
>+
>+ content->GetAttr(kNameSpaceID_HTML, txHTMLAtoms::href, value);
Ditto.
r=peterv.
Attachment #72843 -
Flags: review+
| Assignee | ||
Comment 10•24 years ago
|
||
addresses all petervs comments
Attachment #72843 -
Attachment is obsolete: true
| Assignee | ||
Comment 12•24 years ago
|
||
Comment on attachment 73212 [details] [diff] [review]
*this* is patch v3
bringing over petervs r=
Attachment #73212 -
Flags: review+
Comment 13•24 years ago
|
||
Comment on attachment 73212 [details] [diff] [review]
*this* is patch v3
>Index: source/xslt/txMozillaXMLOutput.cpp
[...]
> void txMozillaXMLOutput::endDocument()
[...]
>+ nsCOMPtr<nsIDocShell> docShell;
>+ sgo->GetDocShell(getter_AddRefs(docShell));
>+ if (!docShell)
>+ return;
The above null check is not needed, the do_QueryInterface() below will do the
null check for you.
>+ nsCOMPtr<nsIRefreshURI> refURI = do_QueryInterface(docShell);
>+ if (!refURI)
>+ return;
>+
I don't like the early return here, what if someone adds code to the end of
this method, then it won't get executed if there's no docshell? I'd add an if
check and put the code inside it in stead of returning early in this case.
>+ if (!mScriptElements)
>+ NS_NewISupportsArray(getter_AddRefs(mScriptElements));
>+ NS_ASSERTION(mScriptElements, "Can't create array");
>+ if (mScriptElements)
>+ mScriptElements->AppendElement(scriptElement);
Don't you want to return NS_ERROR_OUT_OF_MEMORY in cases like this if we can't
create a new nsISupportsArray?
Other than that, sr=jst
Attachment #73212 -
Flags: superreview+
| Assignee | ||
Comment 14•24 years ago
|
||
addresses all jsts comments except the last since the function returns void.
Got ok over irc
Attachment #73212 -
Attachment is obsolete: true
| Assignee | ||
Comment 15•24 years ago
|
||
Comment on attachment 73612 [details] [diff] [review]
patch v4
bringing over reviews
Attachment #73612 -
Flags: superreview+
Attachment #73612 -
Flags: review+
| Assignee | ||
Comment 16•24 years ago
|
||
i really must stop hacking at night. Saving before diffing makes so big
difference
Attachment #73612 -
Attachment is obsolete: true
| Assignee | ||
Updated•24 years ago
|
Attachment #73620 -
Flags: superreview+
Attachment #73620 -
Flags: review+
Comment on attachment 73620 [details] [diff] [review]
*this* is patch v4
a=roc+moz
Attachment #73620 -
Flags: approval+
| Assignee | ||
Comment 18•24 years ago
|
||
checked in
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 19•23 years ago
|
||
we didn't verify for a long time.
I really checked, so VERIFIED.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•