mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Backed out changeset 2f9d54c153ed on CLOSED TREE (bug 1067325)
--HG-- extra : histedit_source : 15eb51ca71b07316c115671d0df75769f67bac81
This commit is contained in:
parent
9822493c08
commit
7e69a4853c
@ -40,45 +40,45 @@ span[id]:before {
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
.highlight .start-tag {
|
||||
.start-tag {
|
||||
color: purple;
|
||||
font-weight: bold;
|
||||
}
|
||||
.highlight .end-tag {
|
||||
.end-tag {
|
||||
color: purple;
|
||||
font-weight: bold;
|
||||
}
|
||||
.highlight .comment {
|
||||
.comment {
|
||||
color: green;
|
||||
font-style: italic;
|
||||
}
|
||||
.highlight .cdata {
|
||||
.cdata {
|
||||
color: #CC0066;
|
||||
}
|
||||
.highlight .doctype {
|
||||
.doctype {
|
||||
color: steelblue;
|
||||
font-style: italic;
|
||||
}
|
||||
.highlight .pi {
|
||||
.pi {
|
||||
color: orchid;
|
||||
font-style: italic;
|
||||
}
|
||||
.highlight .entity {
|
||||
color: #FF4500;
|
||||
.entity {
|
||||
color:#FF4500;
|
||||
font-weight: normal;
|
||||
}
|
||||
.highlight .text {
|
||||
.text {
|
||||
font-weight: normal;
|
||||
}
|
||||
.highlight .attribute-name {
|
||||
.attribute-name {
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
.highlight .attribute-value {
|
||||
.attribute-value {
|
||||
color: blue;
|
||||
font-weight: normal;
|
||||
}
|
||||
.highlight .markupdeclaration {
|
||||
.markupdeclaration {
|
||||
color: steelblue;
|
||||
font-style: italic;
|
||||
}
|
||||
@ -88,9 +88,9 @@ span:not(.error), a:not(.error) {
|
||||
span[id] {
|
||||
unicode-bidi: -moz-isolate;
|
||||
}
|
||||
.highlight .error,
|
||||
.highlight .error > :-moz-any(.start-tag, .end-tag, .comment, .cdata, .doctype,
|
||||
.pi, .entity, .attribute-name, .attribute-value) {
|
||||
.error,
|
||||
.error > :-moz-any(.start-tag, .end-tag, .comment, .cdata, .doctype, .pi,
|
||||
.entity, .attribute-name, .attribute-value) {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ nsHtml5Highlighter::nsHtml5Highlighter(nsAHtml5TreeOpSink* aOpSink)
|
||||
, mInlinesOpen(0)
|
||||
, mInCharacters(false)
|
||||
, mBuffer(nullptr)
|
||||
, mSyntaxHighlight(Preferences::GetBool("view_source.syntax_highlight",
|
||||
true))
|
||||
, mOpSink(aOpSink)
|
||||
, mCurrentRun(nullptr)
|
||||
, mAmpersand(nullptr)
|
||||
@ -711,6 +713,9 @@ nsHtml5Highlighter::AppendCharacters(const char16_t* aBuffer,
|
||||
void
|
||||
nsHtml5Highlighter::AddClass(const char16_t* aClass)
|
||||
{
|
||||
if (!mSyntaxHighlight) {
|
||||
return;
|
||||
}
|
||||
mOpQueue.AppendElement()->InitAddClass(CurrentNode(), aClass);
|
||||
}
|
||||
|
||||
@ -746,6 +751,9 @@ nsHtml5Highlighter::AddBase(const nsString& aValue)
|
||||
void
|
||||
nsHtml5Highlighter::AddErrorToCurrentNode(const char* aMsgId)
|
||||
{
|
||||
if (!mSyntaxHighlight) {
|
||||
return;
|
||||
}
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
NS_ASSERTION(treeOp, "Tree op allocation failed.");
|
||||
treeOp->Init(CurrentNode(), aMsgId);
|
||||
@ -754,6 +762,9 @@ nsHtml5Highlighter::AddErrorToCurrentNode(const char* aMsgId)
|
||||
void
|
||||
nsHtml5Highlighter::AddErrorToCurrentRun(const char* aMsgId)
|
||||
{
|
||||
if (!mSyntaxHighlight) {
|
||||
return;
|
||||
}
|
||||
NS_PRECONDITION(mCurrentRun, "Adding error to run without one!");
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
NS_ASSERTION(treeOp, "Tree op allocation failed.");
|
||||
@ -764,6 +775,9 @@ void
|
||||
nsHtml5Highlighter::AddErrorToCurrentRun(const char* aMsgId,
|
||||
nsIAtom* aName)
|
||||
{
|
||||
if (!mSyntaxHighlight) {
|
||||
return;
|
||||
}
|
||||
NS_PRECONDITION(mCurrentRun, "Adding error to run without one!");
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
NS_ASSERTION(treeOp, "Tree op allocation failed.");
|
||||
@ -775,6 +789,9 @@ nsHtml5Highlighter::AddErrorToCurrentRun(const char* aMsgId,
|
||||
nsIAtom* aName,
|
||||
nsIAtom* aOther)
|
||||
{
|
||||
if (!mSyntaxHighlight) {
|
||||
return;
|
||||
}
|
||||
NS_PRECONDITION(mCurrentRun, "Adding error to run without one!");
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
NS_ASSERTION(treeOp, "Tree op allocation failed.");
|
||||
@ -784,6 +801,9 @@ nsHtml5Highlighter::AddErrorToCurrentRun(const char* aMsgId,
|
||||
void
|
||||
nsHtml5Highlighter::AddErrorToCurrentAmpersand(const char* aMsgId)
|
||||
{
|
||||
if (!mSyntaxHighlight) {
|
||||
return;
|
||||
}
|
||||
NS_PRECONDITION(mAmpersand, "Adding error to ampersand without one!");
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
NS_ASSERTION(treeOp, "Tree op allocation failed.");
|
||||
@ -793,6 +813,9 @@ nsHtml5Highlighter::AddErrorToCurrentAmpersand(const char* aMsgId)
|
||||
void
|
||||
nsHtml5Highlighter::AddErrorToCurrentSlash(const char* aMsgId)
|
||||
{
|
||||
if (!mSyntaxHighlight) {
|
||||
return;
|
||||
}
|
||||
NS_PRECONDITION(mSlash, "Adding error to slash without one!");
|
||||
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
|
||||
NS_ASSERTION(treeOp, "Tree op allocation failed.");
|
||||
|
@ -313,6 +313,11 @@ class nsHtml5Highlighter
|
||||
*/
|
||||
nsHtml5UTF16Buffer* mBuffer;
|
||||
|
||||
/**
|
||||
* Whether to highlight syntax visibly initially.
|
||||
*/
|
||||
bool mSyntaxHighlight;
|
||||
|
||||
/**
|
||||
* The outgoing tree op queue.
|
||||
*/
|
||||
|
@ -15,14 +15,8 @@ nsHtml5ViewSourceUtils::NewBodyAttributes()
|
||||
nsString* id = new nsString(NS_LITERAL_STRING("viewsource"));
|
||||
bodyAttrs->addAttribute(nsHtml5AttributeName::ATTR_ID, id);
|
||||
|
||||
nsString* klass = new nsString();
|
||||
if (mozilla::Preferences::GetBool("view_source.wrap_long_lines", true)) {
|
||||
klass->Append(NS_LITERAL_STRING("wrap "));
|
||||
}
|
||||
if (mozilla::Preferences::GetBool("view_source.syntax_highlight", true)) {
|
||||
klass->Append(NS_LITERAL_STRING("highlight"));
|
||||
}
|
||||
if (!klass->IsEmpty()) {
|
||||
nsString* klass = new nsString(NS_LITERAL_STRING("wrap"));
|
||||
bodyAttrs->addAttribute(nsHtml5AttributeName::ATTR_CLASS, klass);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user