Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–100 unchanged (100 lines)
101 if (attributes == null)
102 attributes = new Attributes();
103
104 if (pendingAttributeName != null) {
105 // the tokeniser has skipped whitespace control chars, but trimming could collapse to empty for other control codes, so verify here
106 pendingAttributeName = pendingAttributeName.trim();
107 Attribute attribute;
108 if (hasPendingAttributeValue)
109 attribute = new Attribute(pendingAttributeName,
110 pendingAttributeValue.length() > 0 ? pendingAttributeValue.toString() : pendingAttributeValueS);
111 else if (hasEmptyAttributeValue)
112 attribute = new Attribute(pendingAttributeName, "");
113 else
114 attribute = new BooleanAttribute(pendingAttributeName);
115 attributes.put(attribute);
116 }
117 pendingAttributeName = null;
118 hasEmptyAttributeValue = false;
119 hasPendingAttributeValue = false;
120 reset(pendingAttributeValue);
121 pendingAttributeValueS = null;
122 }
…lines 123–375 unchanged (253 lines)

After

…lines 1–100 unchanged (100 lines)
101 if (attributes == null)
102 attributes = new Attributes();
103
104 if (pendingAttributeName != null) {
105 // the tokeniser has skipped whitespace control chars, but trimming could collapse to empty for other control codes, so verify here
106 pendingAttributeName = pendingAttributeName.trim();
107 if (pendingAttributeName.length() > 0) {
108 Attribute attribute;
109 if (hasPendingAttributeValue)
110 attribute = new Attribute(pendingAttributeName,
111 pendingAttributeValue.length() > 0 ? pendingAttributeValue.toString() : pendingAttributeValueS);
112 else if (hasEmptyAttributeValue)
113 attribute = new Attribute(pendingAttributeName, "");
114 else
115 attribute = new BooleanAttribute(pendingAttributeName);
116 attributes.put(attribute);
117 }
118 }
119 pendingAttributeName = null;
120 hasEmptyAttributeValue = false;
121 hasPendingAttributeValue = false;
122 reset(pendingAttributeValue);
123 pendingAttributeValueS = null;
…lines 124–377 unchanged (254 lines)

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "parser"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "Attribute"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "Attributes"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "BooleanAttribute"
; ";"
block_comment "/**\n * Parse tokens for the Tokeniser.\n */"
class_declaration
modifiers
abstract "abstract"
class "class"
identifier "Token"
class_body
{ "{"
field_declaration
type_identifier "TokenType"
variable_declarator
identifier "type"
; ";"
constructor_declaration
modifiers
private "private"
identifier "Token"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
} "}"
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Reset the data represent by this token, for reuse"...
method_declaration
modifiers
abstract "abstract"
type_identifier "Token"
identifier "reset"
formal_parameters
( "("
) ")"
; ";"
method_declaration (+44 nodes collapsed)
class_declaration (+225 nodes collapsed)
class_declaration
modifiers
static "static"
abstract "abstract"
class "class"
identifier "Tag"
superclass
extends "extends"
type_identifier "Token"
class_body
{ "{"
field_declaration
modifiers
protected "protected"
type_identifier "String"
variable_declarator
identifier "tagName"
; ";"
field_declaration
modifiers
protected "protected"
type_identifier "String"
variable_declarator
identifier "normalName"
; ";"
line_comment "// lc version of tag name, for case insensitive tree build"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "pendingAttributeName"
; ";"
line_comment "// attribute names are generally caught in one hop, not accu"...
field_declaration
modifiers
private "private"
type_identifier "StringBuilder"
variable_declarator
identifier "pendingAttributeValue"
= "="
object_creation_expression
new "new"
type_identifier "StringBuilder"
argument_list
( "("
) ")"
; ";"
line_comment "// but values are accumulated, from e.g. & in hrefs"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "pendingAttributeValueS"
; ";"
line_comment "// try to get attr vals in one shot, vs Builder"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "hasEmptyAttributeValue"
= "="
false "false"
; ";"
line_comment "// distinguish boolean attribute from empty string value"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "hasPendingAttributeValue"
= "="
false "false"
; ";"
field_declaration
boolean_type "boolean"
variable_declarator
identifier "selfClosing"
= "="
false "false"
; ";"
field_declaration
type_identifier "Attributes"
variable_declarator
identifier "attributes"
; ";"
line_comment "// start tags get attributes on construction. End tags get a"...
method_declaration (+73 nodes collapsed)
method_declaration
modifiers
final "final"
void_type "void"
identifier "newAttribute"
formal_parameters
( "("
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "attributes"
== "=="
null_literal "null"
) ")"
expression_statement
assignment_expression
identifier "attributes"
= "="
object_creation_expression
new "new"
type_identifier "Attributes"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "pendingAttributeName"
!= "!="
null_literal "null"
) ")"
block
{ "{"
line_comment "// the tokeniser has skipped whitespace control chars, but t"...
expression_statement
assignment_expression
identifier "pendingAttributeName"
= "="
method_invocation
identifier "pendingAttributeName"
. "."
identifier "trim"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Attribute"
variable_declarator
identifier "attribute"
; ";"
if_statement (+76 nodes collapsed)
expression_statement
method_invocation
identifier "attributes"
. "."
identifier "put"
argument_list
( "("
identifier "attribute"
) ")"
; ";"
} "}"
expression_statement
assignment_expression
identifier "pendingAttributeName"
= "="
null_literal "null"
; ";"
expression_statement
assignment_expression
identifier "hasEmptyAttributeValue"
= "="
false "false"
; ";"
expression_statement
assignment_expression
identifier "hasPendingAttributeValue"
= "="
false "false"
; ";"
expression_statement
method_invocation
identifier "reset"
argument_list
( "("
identifier "pendingAttributeValue"
) ")"
; ";"
expression_statement
assignment_expression
identifier "pendingAttributeValueS"
= "="
null_literal "null"
; ";"
} "}"
method_declaration (+32 nodes collapsed)
method_declaration (+41 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "String"
identifier "normalName"
formal_parameters
( "("
) ")"
block
{ "{"
line_comment "// loses case, used in tree building for working out where i"...
return_statement
return "return"
identifier "normalName"
; ";"
} "}"
method_declaration (+36 nodes collapsed)
method_declaration
modifiers
final "final"
boolean_type "boolean"
identifier "isSelfClosing"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "selfClosing"
; ";"
} "}"
method_declaration (+28 nodes collapsed)
line_comment "// these appenders are rarely hit in not null state-- caused"...
method_declaration (+47 nodes collapsed)
method_declaration (+30 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+30 nodes collapsed)
method_declaration (+59 nodes collapsed)
method_declaration (+32 nodes collapsed)
method_declaration (+36 nodes collapsed)
method_declaration (+48 nodes collapsed)
method_declaration
modifiers
final "final"
void_type "void"
identifier "setEmptyAttributeValue"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "hasEmptyAttributeValue"
= "="
true "true"
; ";"
} "}"
method_declaration (+46 nodes collapsed)
} "}"
class_declaration (+225 nodes collapsed)
class_declaration (+69 nodes collapsed)
class_declaration (+134 nodes collapsed)
class_declaration (+125 nodes collapsed)
class_declaration (+49 nodes collapsed)
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "Doctype"
identifier "asDoctype"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
cast_expression
( "("
type_identifier "Doctype"
) ")"
this "this"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "StartTag"
identifier "asStartTag"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
cast_expression
( "("
type_identifier "StartTag"
) ")"
this "this"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "EndTag"
identifier "asEndTag"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
cast_expression
( "("
type_identifier "EndTag"
) ")"
this "this"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "Comment"
identifier "asComment"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
cast_expression
( "("
type_identifier "Comment"
) ")"
this "this"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "Character"
identifier "asCharacter"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
cast_expression
( "("
type_identifier "Character"
) ")"
this "this"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
enum_declaration (+23 nodes collapsed)
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "parser"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "Attribute"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "Attributes"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "BooleanAttribute"
; ";"
block_comment "/**\n * Parse tokens for the Tokeniser.\n */"
class_declaration
modifiers
abstract "abstract"
class "class"
identifier "Token"
class_body
{ "{"
field_declaration
type_identifier "TokenType"
variable_declarator
identifier "type"
; ";"
constructor_declaration
modifiers
private "private"
identifier "Token"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
} "}"
method_declaration (+25 nodes collapsed)
block_comment "/**\n * Reset the data represent by this token, for reuse"...
method_declaration
modifiers
abstract "abstract"
type_identifier "Token"
identifier "reset"
formal_parameters
( "("
) ")"
; ";"
method_declaration (+44 nodes collapsed)
class_declaration (+225 nodes collapsed)
class_declaration
modifiers
static "static"
abstract "abstract"
class "class"
identifier "Tag"
superclass
extends "extends"
type_identifier "Token"
class_body
{ "{"
field_declaration
modifiers
protected "protected"
type_identifier "String"
variable_declarator
identifier "tagName"
; ";"
field_declaration
modifiers
protected "protected"
type_identifier "String"
variable_declarator
identifier "normalName"
; ";"
line_comment "// lc version of tag name, for case insensitive tree build"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "pendingAttributeName"
; ";"
line_comment "// attribute names are generally caught in one hop, not accu"...
field_declaration
modifiers
private "private"
type_identifier "StringBuilder"
variable_declarator
identifier "pendingAttributeValue"
= "="
object_creation_expression
new "new"
type_identifier "StringBuilder"
argument_list
( "("
) ")"
; ";"
line_comment "// but values are accumulated, from e.g. & in hrefs"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "pendingAttributeValueS"
; ";"
line_comment "// try to get attr vals in one shot, vs Builder"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "hasEmptyAttributeValue"
= "="
false "false"
; ";"
line_comment "// distinguish boolean attribute from empty string value"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "hasPendingAttributeValue"
= "="
false "false"
; ";"
field_declaration
boolean_type "boolean"
variable_declarator
identifier "selfClosing"
= "="
false "false"
; ";"
field_declaration
type_identifier "Attributes"
variable_declarator
identifier "attributes"
; ";"
line_comment "// start tags get attributes on construction. End tags get a"...
method_declaration (+73 nodes collapsed)
method_declaration
modifiers
final "final"
void_type "void"
identifier "newAttribute"
formal_parameters
( "("
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "attributes"
== "=="
null_literal "null"
) ")"
expression_statement
assignment_expression
identifier "attributes"
= "="
object_creation_expression
new "new"
type_identifier "Attributes"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "pendingAttributeName"
!= "!="
null_literal "null"
) ")"
block
{ "{"
line_comment "// the tokeniser has skipped whitespace control chars, but t"...
expression_statement
assignment_expression
identifier "pendingAttributeName"
= "="
method_invocation
identifier "pendingAttributeName"
. "."
identifier "trim"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "pendingAttributeName"
. "."
identifier "length"
argument_list
( "("
) ")"
> ">"
decimal_integer_literal "0"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Attribute"
variable_declarator
identifier "attribute"
; ";"
if_statement (+76 nodes collapsed)
expression_statement
method_invocation
identifier "attributes"
. "."
identifier "put"
argument_list
( "("
identifier "attribute"
) ")"
; ";"
} "}"
} "}"
expression_statement
assignment_expression
identifier "pendingAttributeName"
= "="
null_literal "null"
; ";"
expression_statement
assignment_expression
identifier "hasEmptyAttributeValue"
= "="
false "false"
; ";"
expression_statement
assignment_expression
identifier "hasPendingAttributeValue"
= "="
false "false"
; ";"
expression_statement
method_invocation
identifier "reset"
argument_list
( "("
identifier "pendingAttributeValue"
) ")"
; ";"
expression_statement
assignment_expression
identifier "pendingAttributeValueS"
= "="
null_literal "null"
; ";"
} "}"
method_declaration (+32 nodes collapsed)
method_declaration (+41 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "String"
identifier "normalName"
formal_parameters
( "("
) ")"
block
{ "{"
line_comment "// loses case, used in tree building for working out where i"...
return_statement
return "return"
identifier "normalName"
; ";"
} "}"
method_declaration (+36 nodes collapsed)
method_declaration
modifiers
final "final"
boolean_type "boolean"
identifier "isSelfClosing"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "selfClosing"
; ";"
} "}"
method_declaration (+28 nodes collapsed)
line_comment "// these appenders are rarely hit in not null state-- caused"...
method_declaration (+47 nodes collapsed)
method_declaration (+30 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+30 nodes collapsed)
method_declaration (+59 nodes collapsed)
method_declaration (+32 nodes collapsed)
method_declaration (+36 nodes collapsed)
method_declaration (+48 nodes collapsed)
method_declaration
modifiers
final "final"
void_type "void"
identifier "setEmptyAttributeValue"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "hasEmptyAttributeValue"
= "="
true "true"
; ";"
} "}"
method_declaration (+46 nodes collapsed)
} "}"
class_declaration (+225 nodes collapsed)
class_declaration (+69 nodes collapsed)
class_declaration (+134 nodes collapsed)
class_declaration (+125 nodes collapsed)
class_declaration (+49 nodes collapsed)
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "Doctype"
identifier "asDoctype"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
cast_expression
( "("
type_identifier "Doctype"
) ")"
this "this"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "StartTag"
identifier "asStartTag"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
cast_expression
( "("
type_identifier "StartTag"
) ")"
this "this"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "EndTag"
identifier "asEndTag"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
cast_expression
( "("
type_identifier "EndTag"
) ")"
this "this"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "Comment"
identifier "asComment"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
cast_expression
( "("
type_identifier "Comment"
) ")"
this "this"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
final "final"
type_identifier "Character"
identifier "asCharacter"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
cast_expression
( "("
type_identifier "Character"
) ")"
this "this"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
enum_declaration (+23 nodes collapsed)
} "}"