2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-09-10 02:17:54 +00:00
|
|
|
|
2006-03-31 08:00:42 +00:00
|
|
|
/*
|
|
|
|
* nsIContentSerializer implementation that can be used with an
|
|
|
|
* nsIDocumentEncoder to convert an HTML (not XHTML!) DOM to an HTML
|
|
|
|
* string that could be parsed into more or less the original DOM.
|
|
|
|
*/
|
|
|
|
|
2000-09-10 02:17:54 +00:00
|
|
|
#include "nsHTMLContentSerializer.h"
|
|
|
|
|
|
|
|
#include "nsIDOMElement.h"
|
|
|
|
#include "nsIContent.h"
|
2000-09-10 06:44:06 +00:00
|
|
|
#include "nsIDocument.h"
|
2014-02-27 23:04:46 +00:00
|
|
|
#include "nsNameSpaceManager.h"
|
2000-09-10 02:17:54 +00:00
|
|
|
#include "nsString.h"
|
2002-04-29 20:29:54 +00:00
|
|
|
#include "nsUnicharUtils.h"
|
2000-09-10 06:44:06 +00:00
|
|
|
#include "nsXPIDLString.h"
|
2000-09-10 02:17:54 +00:00
|
|
|
#include "nsIServiceManager.h"
|
2000-09-10 06:44:06 +00:00
|
|
|
#include "nsIDocumentEncoder.h"
|
2007-01-30 00:06:41 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2000-09-10 06:44:06 +00:00
|
|
|
#include "nsIURI.h"
|
|
|
|
#include "nsNetUtil.h"
|
2000-10-11 22:50:14 +00:00
|
|
|
#include "nsEscape.h"
|
2001-05-11 00:27:03 +00:00
|
|
|
#include "nsITextToSubURI.h"
|
2002-05-15 18:55:21 +00:00
|
|
|
#include "nsCRT.h"
|
2002-11-22 12:20:05 +00:00
|
|
|
#include "nsIParserService.h"
|
|
|
|
#include "nsContentUtils.h"
|
2003-05-23 05:59:56 +00:00
|
|
|
#include "nsLWBrkCIID.h"
|
2006-01-31 22:19:46 +00:00
|
|
|
#include "nsIScriptElement.h"
|
2005-12-28 21:52:39 +00:00
|
|
|
#include "nsAttrName.h"
|
2010-11-06 22:49:26 +00:00
|
|
|
#include "nsIDocShell.h"
|
|
|
|
#include "nsIEditor.h"
|
2011-03-25 15:03:33 +00:00
|
|
|
#include "nsIHTMLEditor.h"
|
2010-10-22 21:25:22 +00:00
|
|
|
#include "mozilla/dom/Element.h"
|
2011-08-01 07:48:24 +00:00
|
|
|
#include "nsParserConstants.h"
|
2010-10-22 21:25:22 +00:00
|
|
|
|
|
|
|
using namespace mozilla::dom;
|
2000-09-10 06:44:06 +00:00
|
|
|
|
2015-03-12 17:20:29 +00:00
|
|
|
nsresult
|
|
|
|
NS_NewHTMLContentSerializer(nsIContentSerializer** aSerializer)
|
2000-09-10 19:36:22 +00:00
|
|
|
{
|
2015-03-12 17:20:29 +00:00
|
|
|
nsRefPtr<nsHTMLContentSerializer> it = new nsHTMLContentSerializer();
|
|
|
|
it.forget(aSerializer);
|
|
|
|
return NS_OK;
|
2000-09-10 19:36:22 +00:00
|
|
|
}
|
|
|
|
|
2000-09-10 02:17:54 +00:00
|
|
|
nsHTMLContentSerializer::nsHTMLContentSerializer()
|
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
mIsHTMLSerializer = true;
|
2000-09-10 02:17:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsHTMLContentSerializer::~nsHTMLContentSerializer()
|
|
|
|
{
|
2003-05-23 05:59:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-13 18:41:16 +00:00
|
|
|
NS_IMETHODIMP
|
2010-05-04 13:19:54 +00:00
|
|
|
nsHTMLContentSerializer::AppendDocumentStart(nsIDocument *aDocument,
|
2002-08-13 18:41:16 +00:00
|
|
|
nsAString& aStr)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
2000-09-10 06:44:06 +00:00
|
|
|
}
|
2000-09-10 02:17:54 +00:00
|
|
|
|
2015-03-17 08:55:22 +00:00
|
|
|
bool
|
2009-09-01 14:31:05 +00:00
|
|
|
nsHTMLContentSerializer::SerializeHTMLAttributes(nsIContent* aContent,
|
2010-05-04 13:19:54 +00:00
|
|
|
nsIContent *aOriginalElement,
|
2009-09-01 14:31:05 +00:00
|
|
|
nsAString& aTagPrefix,
|
|
|
|
const nsAString& aTagNamespaceURI,
|
|
|
|
nsIAtom* aTagName,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aNamespace,
|
2009-09-01 14:31:05 +00:00
|
|
|
nsAString& aStr)
|
2000-09-10 06:44:06 +00:00
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t count = aContent->GetAttrCount();
|
2009-06-28 22:44:22 +00:00
|
|
|
if (!count)
|
2015-03-17 08:55:22 +00:00
|
|
|
return true;
|
2009-06-28 22:44:22 +00:00
|
|
|
|
2000-09-10 06:44:06 +00:00
|
|
|
nsresult rv;
|
2010-03-08 15:45:00 +00:00
|
|
|
nsAutoString valueStr;
|
2003-07-14 07:37:39 +00:00
|
|
|
NS_NAMED_LITERAL_STRING(_mozStr, "_moz");
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (int32_t index = count; index > 0;) {
|
2009-12-23 08:32:39 +00:00
|
|
|
--index;
|
2005-12-28 21:52:39 +00:00
|
|
|
const nsAttrName* name = aContent->GetAttrNameAt(index);
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t namespaceID = name->NamespaceID();
|
2005-12-28 21:52:39 +00:00
|
|
|
nsIAtom* attrName = name->LocalName();
|
2000-09-10 06:44:06 +00:00
|
|
|
|
2002-04-13 07:47:21 +00:00
|
|
|
// Filter out any attribute starting with [-|_]moz
|
2010-03-08 15:45:00 +00:00
|
|
|
nsDependentAtomString attrNameStr(attrName);
|
|
|
|
if (StringBeginsWith(attrNameStr, NS_LITERAL_STRING("_moz")) ||
|
|
|
|
StringBeginsWith(attrNameStr, NS_LITERAL_STRING("-moz"))) {
|
2000-09-10 06:44:06 +00:00
|
|
|
continue;
|
2003-03-21 20:13:08 +00:00
|
|
|
}
|
2001-08-17 08:14:14 +00:00
|
|
|
aContent->GetAttr(namespaceID, attrName, valueStr);
|
2000-09-10 06:44:06 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Filter out special case of <br type="_moz"> or <br _moz*>,
|
|
|
|
// used by the editor. Bug 16988. Yuck.
|
|
|
|
//
|
2011-05-09 06:48:46 +00:00
|
|
|
if (aTagName == nsGkAtoms::br && aNamespace == kNameSpaceID_XHTML &&
|
|
|
|
attrName == nsGkAtoms::type && namespaceID == kNameSpaceID_None &&
|
2003-07-14 07:37:39 +00:00
|
|
|
StringBeginsWith(valueStr, _mozStr)) {
|
2000-09-10 06:44:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-05-09 06:48:46 +00:00
|
|
|
if (mIsCopying && mIsFirstChildOfOL &&
|
|
|
|
aTagName == nsGkAtoms::li && aNamespace == kNameSpaceID_XHTML &&
|
|
|
|
attrName == nsGkAtoms::value && namespaceID == kNameSpaceID_None){
|
2002-03-12 08:21:51 +00:00
|
|
|
// This is handled separately in SerializeLIValueAttribute()
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isJS = IsJavaScript(aContent, attrName, namespaceID, valueStr);
|
2001-08-01 13:39:46 +00:00
|
|
|
|
2011-05-09 06:48:46 +00:00
|
|
|
if (((attrName == nsGkAtoms::href &&
|
|
|
|
(namespaceID == kNameSpaceID_None ||
|
|
|
|
namespaceID == kNameSpaceID_XLink)) ||
|
|
|
|
(attrName == nsGkAtoms::src && namespaceID == kNameSpaceID_None))) {
|
2001-05-11 00:27:03 +00:00
|
|
|
// Make all links absolute when converting only the selection:
|
|
|
|
if (mFlags & nsIDocumentEncoder::OutputAbsoluteLinks) {
|
|
|
|
// Would be nice to handle OBJECT and APPLET tags,
|
|
|
|
// but that gets more complicated since we have to
|
|
|
|
// search the tag list for CODEBASE as well.
|
|
|
|
// For now, just leave them relative.
|
2004-01-09 23:54:21 +00:00
|
|
|
nsCOMPtr<nsIURI> uri = aContent->GetBaseURI();
|
2003-10-22 06:09:48 +00:00
|
|
|
if (uri) {
|
|
|
|
nsAutoString absURI;
|
|
|
|
rv = NS_MakeAbsoluteURI(absURI, valueStr, uri);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
valueStr = absURI;
|
2000-09-10 19:36:22 +00:00
|
|
|
}
|
2000-09-10 06:44:06 +00:00
|
|
|
}
|
|
|
|
}
|
2001-05-11 00:27:03 +00:00
|
|
|
// Need to escape URI.
|
|
|
|
nsAutoString tempURI(valueStr);
|
2009-04-25 09:00:14 +00:00
|
|
|
if (!isJS && NS_FAILED(EscapeURI(aContent, tempURI, valueStr)))
|
2001-05-11 00:27:03 +00:00
|
|
|
valueStr = tempURI;
|
2000-09-10 06:44:06 +00:00
|
|
|
}
|
2002-05-28 12:34:48 +00:00
|
|
|
|
2009-09-28 07:59:52 +00:00
|
|
|
if (mRewriteEncodingDeclaration && aTagName == nsGkAtoms::meta &&
|
2011-05-09 06:48:46 +00:00
|
|
|
aNamespace == kNameSpaceID_XHTML && attrName == nsGkAtoms::content
|
|
|
|
&& namespaceID == kNameSpaceID_None) {
|
2007-12-29 00:23:58 +00:00
|
|
|
// If we're serializing a <meta http-equiv="content-type">,
|
|
|
|
// use the proper value, rather than what's in the document.
|
|
|
|
nsAutoString header;
|
|
|
|
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
|
|
|
|
if (header.LowerCaseEqualsLiteral("content-type")) {
|
|
|
|
valueStr = NS_LITERAL_STRING("text/html; charset=") +
|
|
|
|
NS_ConvertASCIItoUTF16(mCharset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-08 15:45:00 +00:00
|
|
|
nsDependentAtomString nameStr(attrName);
|
2011-05-09 06:48:46 +00:00
|
|
|
nsAutoString prefix;
|
|
|
|
if (namespaceID == kNameSpaceID_XML) {
|
2014-05-26 18:54:10 +00:00
|
|
|
prefix.AssignLiteral(MOZ_UTF16("xml"));
|
2011-05-09 06:48:46 +00:00
|
|
|
} else if (namespaceID == kNameSpaceID_XLink) {
|
2014-05-26 18:54:10 +00:00
|
|
|
prefix.AssignLiteral(MOZ_UTF16("xlink"));
|
2011-05-09 06:48:46 +00:00
|
|
|
}
|
2001-08-01 13:39:46 +00:00
|
|
|
|
2002-05-28 12:34:48 +00:00
|
|
|
// Expand shorthand attribute.
|
2011-05-09 06:48:46 +00:00
|
|
|
if (aNamespace == kNameSpaceID_XHTML &&
|
|
|
|
namespaceID == kNameSpaceID_None &&
|
|
|
|
IsShorthandAttr(attrName, aTagName) &&
|
|
|
|
valueStr.IsEmpty()) {
|
2002-05-28 12:34:48 +00:00
|
|
|
valueStr = nameStr;
|
|
|
|
}
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(SerializeAttr(prefix, nameStr, valueStr,
|
|
|
|
aStr, !isJS), false);
|
2000-09-10 02:17:54 +00:00
|
|
|
}
|
2015-03-17 08:55:22 +00:00
|
|
|
|
|
|
|
return true;
|
2000-09-10 06:44:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-10-22 21:25:22 +00:00
|
|
|
nsHTMLContentSerializer::AppendElementStart(Element* aElement,
|
|
|
|
Element* aOriginalElement,
|
2002-03-23 23:54:46 +00:00
|
|
|
nsAString& aStr)
|
2000-09-10 06:44:06 +00:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG(aElement);
|
2006-01-31 22:19:46 +00:00
|
|
|
|
2010-05-04 13:19:54 +00:00
|
|
|
nsIContent* content = aElement;
|
2006-01-31 22:19:46 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool forceFormat = false;
|
2015-03-17 08:55:22 +00:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
if (!CheckElementStart(content, forceFormat, aStr, rv)) {
|
|
|
|
return rv;
|
2002-04-10 21:25:15 +00:00
|
|
|
}
|
|
|
|
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
2015-03-03 11:09:00 +00:00
|
|
|
nsIAtom *name = content->NodeInfo()->NameAtom();
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t ns = content->GetNameSpaceID();
|
2010-11-06 22:49:26 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool lineBreakBeforeOpen = LineBreakBeforeOpen(ns, name);
|
2000-09-10 02:17:54 +00:00
|
|
|
|
2015-01-12 16:41:10 +00:00
|
|
|
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
|
2009-04-25 09:00:14 +00:00
|
|
|
if (mColPos && lineBreakBeforeOpen) {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(AppendNewLineToString(aStr), NS_ERROR_OUT_OF_MEMORY);
|
2009-04-25 09:00:14 +00:00
|
|
|
}
|
|
|
|
else {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(MaybeAddNewlineForRootNode(aStr), NS_ERROR_OUT_OF_MEMORY);
|
2009-04-25 09:00:14 +00:00
|
|
|
}
|
|
|
|
if (!mColPos) {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(AppendIndentation(aStr), NS_ERROR_OUT_OF_MEMORY);
|
2009-04-25 09:00:14 +00:00
|
|
|
}
|
|
|
|
else if (mAddSpace) {
|
2015-03-17 08:55:22 +00:00
|
|
|
bool result = AppendToString(char16_t(' '), aStr);
|
2011-10-17 14:59:28 +00:00
|
|
|
mAddSpace = false;
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(result, NS_ERROR_OUT_OF_MEMORY);
|
2009-04-25 09:00:14 +00:00
|
|
|
}
|
2002-10-14 22:07:48 +00:00
|
|
|
}
|
|
|
|
else if (mAddSpace) {
|
2015-03-17 08:55:22 +00:00
|
|
|
bool result = AppendToString(char16_t(' '), aStr);
|
2011-10-17 14:59:28 +00:00
|
|
|
mAddSpace = false;
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(result, NS_ERROR_OUT_OF_MEMORY);
|
2000-09-10 06:44:06 +00:00
|
|
|
}
|
2003-10-23 22:24:21 +00:00
|
|
|
else {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(MaybeAddNewlineForRootNode(aStr), NS_ERROR_OUT_OF_MEMORY);
|
2003-10-23 22:24:21 +00:00
|
|
|
}
|
2009-04-25 09:00:14 +00:00
|
|
|
// Always reset to avoid false newlines in case MaybeAddNewlineForRootNode wasn't
|
2003-10-23 22:24:21 +00:00
|
|
|
// called
|
2011-10-17 14:59:28 +00:00
|
|
|
mAddNewlineForRootNode = false;
|
2000-09-10 06:44:06 +00:00
|
|
|
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(AppendToString(kLessThan, aStr), NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
NS_ENSURE_TRUE(AppendToString(nsDependentAtomString(name), aStr), NS_ERROR_OUT_OF_MEMORY);
|
2000-09-10 06:44:06 +00:00
|
|
|
|
2009-04-25 09:00:14 +00:00
|
|
|
MaybeEnterInPreContent(content);
|
|
|
|
|
|
|
|
// for block elements, we increase the indentation
|
2015-01-12 16:41:10 +00:00
|
|
|
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel())
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(IncrIndentation(name), NS_ERROR_OUT_OF_MEMORY);
|
2009-04-25 09:00:14 +00:00
|
|
|
|
2002-03-12 08:21:51 +00:00
|
|
|
// Need to keep track of OL and LI elements in order to get ordinal number
|
|
|
|
// for the LI.
|
2011-05-09 06:48:46 +00:00
|
|
|
if (mIsCopying && name == nsGkAtoms::ol && ns == kNameSpaceID_XHTML){
|
2002-03-12 08:21:51 +00:00
|
|
|
// We are copying and current node is an OL;
|
2009-01-23 09:02:09 +00:00
|
|
|
// Store its start attribute value in olState->startVal.
|
2002-03-12 08:21:51 +00:00
|
|
|
nsAutoString start;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t startAttrVal = 0;
|
2010-05-04 13:19:54 +00:00
|
|
|
|
|
|
|
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
|
2002-03-12 08:21:51 +00:00
|
|
|
if (!start.IsEmpty()){
|
2012-07-27 13:59:29 +00:00
|
|
|
nsresult rv = NS_OK;
|
2002-03-12 08:21:51 +00:00
|
|
|
startAttrVal = start.ToInteger(&rv);
|
|
|
|
//If OL has "start" attribute, first LI element has to start with that value
|
|
|
|
//Therefore subtracting 1 as all the LI elements are incrementing it before using it;
|
|
|
|
//In failure of ToInteger(), default StartAttrValue to 0.
|
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
startAttrVal--;
|
|
|
|
else
|
|
|
|
startAttrVal = 0;
|
|
|
|
}
|
2011-10-17 14:59:28 +00:00
|
|
|
mOLStateStack.AppendElement(olState(startAttrVal, true));
|
2002-03-12 08:21:51 +00:00
|
|
|
}
|
|
|
|
|
2011-05-09 06:48:46 +00:00
|
|
|
if (mIsCopying && name == nsGkAtoms::li && ns == kNameSpaceID_XHTML) {
|
2006-04-06 20:55:25 +00:00
|
|
|
mIsFirstChildOfOL = IsFirstChildOfOL(aOriginalElement);
|
2002-03-12 08:21:51 +00:00
|
|
|
if (mIsFirstChildOfOL){
|
|
|
|
// If OL is parent of this LI, serialize attributes in different manner.
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(SerializeLIValueAttribute(aElement, aStr), NS_ERROR_OUT_OF_MEMORY);
|
2002-03-12 08:21:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Even LI passed above have to go through this
|
|
|
|
// for serializing attributes other than "value".
|
2009-04-25 09:00:14 +00:00
|
|
|
nsAutoString dummyPrefix;
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(SerializeHTMLAttributes(content,
|
|
|
|
aOriginalElement,
|
|
|
|
dummyPrefix,
|
|
|
|
EmptyString(),
|
|
|
|
name,
|
|
|
|
ns,
|
|
|
|
aStr), NS_ERROR_OUT_OF_MEMORY);
|
2000-09-10 06:44:06 +00:00
|
|
|
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(AppendToString(kGreaterThan, aStr), NS_ERROR_OUT_OF_MEMORY);
|
2000-09-10 06:44:06 +00:00
|
|
|
|
2011-05-09 06:48:46 +00:00
|
|
|
if (ns == kNameSpaceID_XHTML &&
|
|
|
|
(name == nsGkAtoms::script ||
|
|
|
|
name == nsGkAtoms::style ||
|
|
|
|
name == nsGkAtoms::noscript ||
|
|
|
|
name == nsGkAtoms::noframes)) {
|
2009-04-25 09:00:14 +00:00
|
|
|
++mDisableEntityEncoding;
|
2000-10-13 11:06:05 +00:00
|
|
|
}
|
|
|
|
|
2015-01-12 16:41:10 +00:00
|
|
|
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel() &&
|
|
|
|
LineBreakAfterOpen(ns, name)) {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(AppendNewLineToString(aStr), NS_ERROR_OUT_OF_MEMORY);
|
2007-06-17 11:41:03 +00:00
|
|
|
}
|
2007-05-13 16:44:06 +00:00
|
|
|
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(AfterElementStart(content, aOriginalElement, aStr), NS_ERROR_OUT_OF_MEMORY);
|
2009-04-25 09:00:14 +00:00
|
|
|
|
2000-09-10 02:17:54 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-10-22 21:25:22 +00:00
|
|
|
nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
|
2002-03-23 23:54:46 +00:00
|
|
|
nsAString& aStr)
|
2000-09-10 02:17:54 +00:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG(aElement);
|
|
|
|
|
2010-05-04 13:19:54 +00:00
|
|
|
nsIContent* content = aElement;
|
2000-09-10 02:17:54 +00:00
|
|
|
|
2015-03-03 11:09:00 +00:00
|
|
|
nsIAtom *name = content->NodeInfo()->NameAtom();
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t ns = content->GetNameSpaceID();
|
2000-09-10 02:17:54 +00:00
|
|
|
|
2011-05-09 06:48:46 +00:00
|
|
|
if (ns == kNameSpaceID_XHTML &&
|
|
|
|
(name == nsGkAtoms::script ||
|
|
|
|
name == nsGkAtoms::style ||
|
|
|
|
name == nsGkAtoms::noscript ||
|
|
|
|
name == nsGkAtoms::noframes)) {
|
2009-04-25 09:00:14 +00:00
|
|
|
--mDisableEntityEncoding;
|
|
|
|
}
|
|
|
|
|
2012-04-24 06:06:11 +00:00
|
|
|
bool forceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
|
|
|
|
content->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
|
2009-04-25 09:00:14 +00:00
|
|
|
|
2015-01-12 16:41:10 +00:00
|
|
|
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
|
2009-04-25 09:00:14 +00:00
|
|
|
DecrIndentation(name);
|
|
|
|
}
|
|
|
|
|
2006-12-26 17:47:52 +00:00
|
|
|
if (name == nsGkAtoms::script) {
|
2006-01-31 22:19:46 +00:00
|
|
|
nsCOMPtr<nsIScriptElement> script = do_QueryInterface(aElement);
|
|
|
|
|
2015-01-12 16:41:10 +00:00
|
|
|
if (ShouldMaintainPreLevel() && script && script->IsMalformed()) {
|
2006-01-31 22:19:46 +00:00
|
|
|
// We're looking at a malformed script tag. This means that the end tag
|
|
|
|
// was missing in the source. Imitate that here by not serializing the end
|
|
|
|
// tag.
|
2015-01-12 16:41:10 +00:00
|
|
|
--PreLevel();
|
2006-01-31 22:19:46 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2011-05-09 06:48:46 +00:00
|
|
|
else if (mIsCopying && name == nsGkAtoms::ol && ns == kNameSpaceID_XHTML) {
|
2009-04-25 09:00:14 +00:00
|
|
|
NS_ASSERTION((!mOLStateStack.IsEmpty()), "Cannot have an empty OL Stack");
|
2002-03-12 08:21:51 +00:00
|
|
|
/* Though at this point we must always have an state to be deleted as all
|
|
|
|
the OL opening tags are supposed to push an olState object to the stack*/
|
2009-03-20 08:15:35 +00:00
|
|
|
if (!mOLStateStack.IsEmpty()) {
|
|
|
|
mOLStateStack.RemoveElementAt(mOLStateStack.Length() -1);
|
2002-03-12 08:21:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-09 06:48:46 +00:00
|
|
|
if (ns == kNameSpaceID_XHTML) {
|
|
|
|
nsIParserService* parserService = nsContentUtils::GetParserService();
|
2000-10-13 11:06:05 +00:00
|
|
|
|
2011-05-09 06:48:46 +00:00
|
|
|
if (parserService) {
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isContainer;
|
2000-09-10 02:17:54 +00:00
|
|
|
|
2011-05-09 06:48:46 +00:00
|
|
|
parserService->
|
|
|
|
IsContainer(parserService->HTMLCaseSensitiveAtomTagToId(name),
|
|
|
|
isContainer);
|
|
|
|
if (!isContainer) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
2000-09-10 02:17:54 +00:00
|
|
|
}
|
|
|
|
|
2015-01-12 16:41:10 +00:00
|
|
|
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
|
2009-04-25 09:00:14 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool lineBreakBeforeClose = LineBreakBeforeClose(ns, name);
|
2009-04-25 09:00:14 +00:00
|
|
|
|
|
|
|
if (mColPos && lineBreakBeforeClose) {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(AppendNewLineToString(aStr), NS_ERROR_OUT_OF_MEMORY);
|
2009-04-25 09:00:14 +00:00
|
|
|
}
|
|
|
|
if (!mColPos) {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(AppendIndentation(aStr), NS_ERROR_OUT_OF_MEMORY);
|
2009-04-25 09:00:14 +00:00
|
|
|
}
|
|
|
|
else if (mAddSpace) {
|
2015-03-17 08:55:22 +00:00
|
|
|
bool result = AppendToString(char16_t(' '), aStr);
|
2011-10-17 14:59:28 +00:00
|
|
|
mAddSpace = false;
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(result, NS_ERROR_OUT_OF_MEMORY);
|
2009-04-25 09:00:14 +00:00
|
|
|
}
|
2002-10-14 22:07:48 +00:00
|
|
|
}
|
|
|
|
else if (mAddSpace) {
|
2015-03-17 08:55:22 +00:00
|
|
|
bool result = AppendToString(char16_t(' '), aStr);
|
2011-10-17 14:59:28 +00:00
|
|
|
mAddSpace = false;
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(result, NS_ERROR_OUT_OF_MEMORY);
|
2000-09-10 06:44:06 +00:00
|
|
|
}
|
|
|
|
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(AppendToString(kEndTag, aStr), NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
NS_ENSURE_TRUE(AppendToString(nsDependentAtomString(name), aStr), NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
NS_ENSURE_TRUE(AppendToString(kGreaterThan, aStr), NS_ERROR_OUT_OF_MEMORY);
|
2000-09-10 06:44:06 +00:00
|
|
|
|
2009-04-25 09:00:14 +00:00
|
|
|
MaybeLeaveFromPreContent(content);
|
|
|
|
|
2015-01-12 16:41:10 +00:00
|
|
|
if ((mDoFormat || forceFormat)&& !mDoRaw && !PreLevel()
|
|
|
|
&& LineBreakAfterClose(ns, name)) {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(AppendNewLineToString(aStr), NS_ERROR_OUT_OF_MEMORY);
|
2000-09-10 06:44:06 +00:00
|
|
|
}
|
2003-10-23 22:24:21 +00:00
|
|
|
else {
|
2009-04-25 09:00:14 +00:00
|
|
|
MaybeFlagNewlineForRootNode(aElement);
|
2003-10-23 22:24:21 +00:00
|
|
|
}
|
2000-09-10 02:17:54 +00:00
|
|
|
|
2011-05-09 06:48:46 +00:00
|
|
|
if (name == nsGkAtoms::body && ns == kNameSpaceID_XHTML) {
|
2008-10-21 20:30:09 +00:00
|
|
|
--mInBody;
|
|
|
|
}
|
|
|
|
|
2000-09-10 02:17:54 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2010-03-18 16:07:32 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
static const uint16_t kValNBSP = 160;
|
2010-03-18 16:07:32 +00:00
|
|
|
static const char* kEntities[] = {
|
2012-07-30 14:20:58 +00:00
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, "&", nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
"<", nullptr, ">", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
2010-10-17 14:15:54 +00:00
|
|
|
" "
|
2010-03-18 16:07:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char* kAttrEntities[] = {
|
2012-07-30 14:20:58 +00:00
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, """, nullptr, nullptr, nullptr, "&", nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
"<", nullptr, ">", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
2010-10-17 14:15:54 +00:00
|
|
|
" "
|
2010-03-18 16:07:32 +00:00
|
|
|
};
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t FindNextBasicEntity(const nsAString& aStr,
|
|
|
|
const uint32_t aLen,
|
|
|
|
uint32_t aIndex,
|
2010-10-17 14:15:54 +00:00
|
|
|
const char** aEntityTable,
|
|
|
|
const char** aEntity)
|
|
|
|
{
|
|
|
|
for (; aIndex < aLen; ++aIndex) {
|
|
|
|
// for each character in this chunk, check if it
|
|
|
|
// needs to be replaced
|
2014-01-04 15:02:17 +00:00
|
|
|
char16_t val = aStr[aIndex];
|
2010-10-17 14:15:54 +00:00
|
|
|
if (val <= kValNBSP && aEntityTable[val]) {
|
|
|
|
*aEntity = aEntityTable[val];
|
|
|
|
return aIndex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aIndex;
|
|
|
|
}
|
|
|
|
|
2015-03-17 08:55:22 +00:00
|
|
|
bool
|
2010-03-18 16:07:32 +00:00
|
|
|
nsHTMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr,
|
|
|
|
nsAString& aOutputStr)
|
|
|
|
{
|
|
|
|
if (mBodyOnly && !mInBody) {
|
2015-03-17 08:55:22 +00:00
|
|
|
return true;
|
2010-03-18 16:07:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mDisableEntityEncoding) {
|
2015-03-17 08:55:22 +00:00
|
|
|
return aOutputStr.Append(aStr, mozilla::fallible);
|
2010-03-18 16:07:32 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool nonBasicEntities =
|
2010-10-17 14:15:54 +00:00
|
|
|
!!(mFlags & (nsIDocumentEncoder::OutputEncodeLatin1Entities |
|
|
|
|
nsIDocumentEncoder::OutputEncodeHTMLEntities |
|
|
|
|
nsIDocumentEncoder::OutputEncodeW3CEntities));
|
|
|
|
|
|
|
|
if (!nonBasicEntities &&
|
|
|
|
(mFlags & (nsIDocumentEncoder::OutputEncodeBasicEntities))) {
|
|
|
|
const char **entityTable = mInAttribute ? kAttrEntities : kEntities;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t start = 0;
|
|
|
|
const uint32_t len = aStr.Length();
|
|
|
|
for (uint32_t i = 0; i < len; ++i) {
|
2012-07-30 14:20:58 +00:00
|
|
|
const char* entity = nullptr;
|
2010-10-17 14:15:54 +00:00
|
|
|
i = FindNextBasicEntity(aStr, len, i, entityTable, &entity);
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t normalTextLen = i - start;
|
2010-10-17 14:15:54 +00:00
|
|
|
if (normalTextLen) {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(aOutputStr.Append(Substring(aStr, start, normalTextLen),
|
|
|
|
mozilla::fallible), false);
|
2010-10-17 14:15:54 +00:00
|
|
|
}
|
|
|
|
if (entity) {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(aOutputStr.AppendASCII(entity, mozilla::fallible), false);
|
2010-10-17 14:15:54 +00:00
|
|
|
start = i + 1;
|
|
|
|
}
|
|
|
|
}
|
2015-03-17 08:55:22 +00:00
|
|
|
return true;
|
2010-10-17 14:15:54 +00:00
|
|
|
} else if (nonBasicEntities) {
|
2010-03-18 16:07:32 +00:00
|
|
|
nsIParserService* parserService = nsContentUtils::GetParserService();
|
|
|
|
|
|
|
|
if (!parserService) {
|
|
|
|
NS_ERROR("Can't get parser service");
|
2015-03-17 08:55:22 +00:00
|
|
|
return true;
|
2010-03-18 16:07:32 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:02:17 +00:00
|
|
|
nsReadingIterator<char16_t> done_reading;
|
2010-03-18 16:07:32 +00:00
|
|
|
aStr.EndReading(done_reading);
|
|
|
|
|
|
|
|
// for each chunk of |aString|...
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t advanceLength = 0;
|
2014-01-04 15:02:17 +00:00
|
|
|
nsReadingIterator<char16_t> iter;
|
2010-03-18 16:07:32 +00:00
|
|
|
|
|
|
|
const char **entityTable = mInAttribute ? kAttrEntities : kEntities;
|
2012-09-02 02:35:17 +00:00
|
|
|
nsAutoCString entityReplacement;
|
2010-03-18 16:07:32 +00:00
|
|
|
|
|
|
|
for (aStr.BeginReading(iter);
|
|
|
|
iter != done_reading;
|
2012-08-22 15:56:38 +00:00
|
|
|
iter.advance(int32_t(advanceLength))) {
|
|
|
|
uint32_t fragmentLength = iter.size_forward();
|
|
|
|
uint32_t lengthReplaced = 0; // the number of UTF-16 codepoints
|
2010-03-18 16:07:32 +00:00
|
|
|
// replaced by a particular entity
|
2014-01-04 15:02:17 +00:00
|
|
|
const char16_t* c = iter.get();
|
|
|
|
const char16_t* fragmentStart = c;
|
|
|
|
const char16_t* fragmentEnd = c + fragmentLength;
|
2012-07-30 14:20:58 +00:00
|
|
|
const char* entityText = nullptr;
|
|
|
|
const char* fullConstEntityText = nullptr;
|
|
|
|
char* fullEntityText = nullptr;
|
2010-03-18 16:07:32 +00:00
|
|
|
|
|
|
|
advanceLength = 0;
|
|
|
|
// for each character in this chunk, check if it
|
|
|
|
// needs to be replaced
|
|
|
|
for (; c < fragmentEnd; c++, advanceLength++) {
|
2014-01-04 15:02:17 +00:00
|
|
|
char16_t val = *c;
|
2010-10-17 14:15:54 +00:00
|
|
|
if (val <= kValNBSP && entityTable[val]) {
|
2010-05-14 10:18:27 +00:00
|
|
|
fullConstEntityText = entityTable[val];
|
2010-03-18 16:07:32 +00:00
|
|
|
break;
|
|
|
|
} else if (val > 127 &&
|
|
|
|
((val < 256 &&
|
|
|
|
mFlags & nsIDocumentEncoder::OutputEncodeLatin1Entities) ||
|
|
|
|
mFlags & nsIDocumentEncoder::OutputEncodeHTMLEntities)) {
|
2010-05-14 10:18:27 +00:00
|
|
|
entityReplacement.Truncate();
|
2010-03-18 16:07:32 +00:00
|
|
|
parserService->HTMLConvertUnicodeToEntity(val, entityReplacement);
|
|
|
|
|
|
|
|
if (!entityReplacement.IsEmpty()) {
|
|
|
|
entityText = entityReplacement.get();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (val > 127 &&
|
|
|
|
mFlags & nsIDocumentEncoder::OutputEncodeW3CEntities &&
|
|
|
|
mEntityConverter) {
|
|
|
|
if (NS_IS_HIGH_SURROGATE(val) &&
|
|
|
|
c + 1 < fragmentEnd &&
|
|
|
|
NS_IS_LOW_SURROGATE(*(c + 1))) {
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t valUTF32 = SURROGATE_TO_UCS4(val, *(++c));
|
2010-03-18 16:07:32 +00:00
|
|
|
if (NS_SUCCEEDED(mEntityConverter->ConvertUTF32ToEntity(valUTF32,
|
|
|
|
nsIEntityConverter::entityW3C, &fullEntityText))) {
|
|
|
|
lengthReplaced = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
advanceLength++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (NS_SUCCEEDED(mEntityConverter->ConvertToEntity(val,
|
|
|
|
nsIEntityConverter::entityW3C,
|
|
|
|
&fullEntityText))) {
|
|
|
|
lengthReplaced = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-17 08:55:22 +00:00
|
|
|
bool result = aOutputStr.Append(fragmentStart, advanceLength, mozilla::fallible);
|
2010-03-18 16:07:32 +00:00
|
|
|
if (entityText) {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(aOutputStr.Append(char16_t('&'), mozilla::fallible), false);
|
|
|
|
NS_ENSURE_TRUE(AppendASCIItoUTF16(entityText, aOutputStr, mozilla::fallible), false);
|
|
|
|
NS_ENSURE_TRUE(aOutputStr.Append(char16_t(';'), mozilla::fallible), false);
|
2010-03-18 16:07:32 +00:00
|
|
|
advanceLength++;
|
|
|
|
}
|
2010-05-14 10:18:27 +00:00
|
|
|
else if (fullConstEntityText) {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(aOutputStr.AppendASCII(fullConstEntityText, mozilla::fallible), false);
|
2010-05-14 10:18:27 +00:00
|
|
|
++advanceLength;
|
|
|
|
}
|
2010-03-18 16:07:32 +00:00
|
|
|
// if it comes from nsIEntityConverter, it already has '&' and ';'
|
|
|
|
else if (fullEntityText) {
|
2015-03-17 08:55:22 +00:00
|
|
|
bool ok = AppendASCIItoUTF16(fullEntityText, aOutputStr, mozilla::fallible);
|
2015-03-27 00:01:12 +00:00
|
|
|
free(fullEntityText);
|
2010-03-18 16:07:32 +00:00
|
|
|
advanceLength += lengthReplaced;
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(ok, false);
|
2010-03-18 16:07:32 +00:00
|
|
|
}
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(result, false);
|
2010-03-18 16:07:32 +00:00
|
|
|
}
|
|
|
|
} else {
|
2015-03-17 08:55:22 +00:00
|
|
|
NS_ENSURE_TRUE(nsXMLContentSerializer::AppendAndTranslateEntities(aStr, aOutputStr), false);
|
2010-03-18 16:07:32 +00:00
|
|
|
}
|
2015-03-17 08:55:22 +00:00
|
|
|
|
|
|
|
return true;
|
2010-03-18 16:07:32 +00:00
|
|
|
}
|