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–719 unchanged (719 lines)
720 if (lastNode.parent() != null)
721 lastNode.remove();
722 commonAncestor.appendChild(lastNode);
723 }
724
725 Element adopter = new Element(formatEl.tag(), tb.getBaseUri());
726 Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]);
727 for (Node childNode : childNodes) {
728 adopter.appendChild(childNode); // append will reparent. thus the clone to avoid concurrent mod.
729 }
730 furthestBlock.appendChild(adopter);
731 tb.removeFromActiveFormattingElements(formatEl);
732 // todo: insert the new element into the list of active formatting elements at the position of the aforementioned bookmark.
…lines 733–1486 unchanged (754 lines)

After

…lines 1–719 unchanged (719 lines)
720 if (lastNode.parent() != null)
721 lastNode.remove();
722 commonAncestor.appendChild(lastNode);
723 }
724
725 Element adopter = new Element(formatEl.tag(), tb.getBaseUri());
726 adopter.attributes().addAll(formatEl.attributes());
727 Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]);
728 for (Node childNode : childNodes) {
729 adopter.appendChild(childNode); // append will reparent. thus the clone to avoid concurrent mod.
730 }
731 furthestBlock.appendChild(adopter);
732 tb.removeFromActiveFormattingElements(formatEl);
…lines 733–1487 unchanged (755 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 "DescendableLinkedList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "StringUtil"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "LinkedList"
; ";"
block_comment "/**\n * The Tree Builder's current state. Each state embodies"...
enum_declaration
enum "enum"
identifier "HtmlTreeBuilderState"
enum_body
{ "{"
enum_constant (+240 nodes collapsed)
, ","
enum_constant (+342 nodes collapsed)
, ","
enum_constant (+402 nodes collapsed)
, ","
enum_constant (+738 nodes collapsed)
, ","
enum_constant (+467 nodes collapsed)
, ","
enum_constant (+602 nodes collapsed)
, ","
enum_constant
identifier "InBody"
class_body
{ "{"
method_declaration
boolean_type "boolean"
identifier "process"
formal_parameters
( "("
formal_parameter
type_identifier "Token"
identifier "t"
, ","
formal_parameter
type_identifier "HtmlTreeBuilder"
identifier "tb"
) ")"
block
{ "{"
switch_expression
switch "switch"
parenthesized_expression
( "("
field_access
identifier "t"
. "."
identifier "type"
) ")"
switch_block
{ "{"
switch_block_statement_group (+131 nodes collapsed)
switch_block_statement_group (+27 nodes collapsed)
switch_block_statement_group (+22 nodes collapsed)
switch_block_statement_group (+4020 nodes collapsed)
switch_block_statement_group
switch_label
case "case"
identifier "EndTag"
: ":"
local_variable_declaration
scoped_type_identifier
type_identifier "Token"
. "."
type_identifier "EndTag"
variable_declarator
identifier "endTag"
= "="
method_invocation
identifier "t"
. "."
identifier "asEndTag"
argument_list
( "("
) ")"
; ";"
expression_statement
assignment_expression
identifier "name"
= "="
method_invocation
identifier "endTag"
. "."
identifier "name"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "body"
" "\""
) ")"
) ")"
block (+53 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "html"
" "\""
) ")"
) ")"
block (+46 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression (+131 nodes collapsed)
block (+97 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "form"
" "\""
) ")"
) ")"
block (+125 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "p"
" "\""
) ")"
) ")"
block (+123 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "li"
" "\""
) ")"
) ")"
block (+96 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression (+21 nodes collapsed)
block (+96 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression (+41 nodes collapsed)
block (+161 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "sarcasm"
" "\""
) ")"
) ")"
block
{ "{"
line_comment "// *sigh*"
return_statement
return "return"
method_invocation
identifier "anyOtherEndTag"
argument_list
( "("
identifier "t"
, ","
identifier "tb"
) ")"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression (+81 nodes collapsed)
block
{ "{"
line_comment "// Adoption Agency Algorithm."
labeled_statement
identifier "OUTER"
: ":"
for_statement
for "for"
( "("
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "i"
= "="
decimal_integer_literal "0"
; ";"
binary_expression
identifier "i"
< "<"
decimal_integer_literal "8"
; ";"
update_expression
identifier "i"
++ "++"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "formatEl"
= "="
method_invocation
identifier "tb"
. "."
identifier "getActiveFormattingElement"
argument_list
( "("
identifier "name"
) ")"
; ";"
if_statement (+128 nodes collapsed)
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "furthestBlock"
= "="
null_literal "null"
; ";"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "commonAncestor"
= "="
null_literal "null"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "seenFormattingElement"
= "="
false "false"
; ";"
local_variable_declaration
generic_type
type_identifier "LinkedList"
type_arguments
< "<"
type_identifier "Element"
> ">"
variable_declarator
identifier "stack"
= "="
method_invocation
identifier "tb"
. "."
identifier "getStack"
argument_list
( "("
) ")"
; ";"
line_comment "// the spec doesn't limit to < 64, but in degenerate cases ("...
line_comment "// run-aways"
for_statement (+112 nodes collapsed)
if_statement (+42 nodes collapsed)
line_comment "// todo: Let a bookmark note the position of the formatting "...
line_comment "// does that mean: int pos of format el in list?"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "node"
= "="
identifier "furthestBlock"
; ";"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "lastNode"
= "="
identifier "furthestBlock"
; ";"
labeled_statement (+217 nodes collapsed)
if_statement (+119 nodes collapsed)
local_variable_declaration (+27 nodes collapsed)
local_variable_declaration (+36 nodes collapsed)
enhanced_for_statement (+22 nodes collapsed)
expression_statement
method_invocation
identifier "furthestBlock"
. "."
identifier "appendChild"
argument_list
( "("
identifier "adopter"
) ")"
; ";"
expression_statement
method_invocation
identifier "tb"
. "."
identifier "removeFromActiveFormattingElements"
argument_list
( "("
identifier "formatEl"
) ")"
; ";"
line_comment "// todo: insert the new element into the list of active form"...
expression_statement
method_invocation
identifier "tb"
. "."
identifier "removeFromStack"
argument_list
( "("
identifier "formatEl"
) ")"
; ";"
expression_statement
method_invocation
identifier "tb"
. "."
identifier "insertOnStackAfter"
argument_list
( "("
identifier "furthestBlock"
, ","
identifier "adopter"
) ")"
; ";"
} "}"
} "}"
else "else"
if_statement (+220 nodes collapsed)
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
identifier "EOF"
: ":"
line_comment "// todo: error if stack contains something not dd, dt, li, p"...
line_comment "// stop parsing"
break_statement
break "break"
; ";"
} "}"
return_statement
return "return"
true "true"
; ";"
} "}"
method_declaration (+219 nodes collapsed)
} "}"
, ","
enum_constant (+162 nodes collapsed)
, ","
enum_constant (+1191 nodes collapsed)
, ","
enum_constant (+340 nodes collapsed)
, ","
enum_constant (+503 nodes collapsed)
, ","
enum_constant (+485 nodes collapsed)
, ","
enum_constant (+688 nodes collapsed)
, ","
enum_constant (+658 nodes collapsed)
, ","
enum_constant (+652 nodes collapsed)
, ","
enum_constant (+1056 nodes collapsed)
, ","
enum_constant (+315 nodes collapsed)
, ","
enum_constant (+305 nodes collapsed)
, ","
enum_constant (+540 nodes collapsed)
, ","
enum_constant (+311 nodes collapsed)
, ","
enum_constant (+182 nodes collapsed)
, ","
enum_constant (+219 nodes collapsed)
, ","
enum_constant (+26 nodes collapsed)
enum_body_declarations (+290 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 "DescendableLinkedList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "StringUtil"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "LinkedList"
; ";"
block_comment "/**\n * The Tree Builder's current state. Each state embodies"...
enum_declaration
enum "enum"
identifier "HtmlTreeBuilderState"
enum_body
{ "{"
enum_constant (+240 nodes collapsed)
, ","
enum_constant (+342 nodes collapsed)
, ","
enum_constant (+402 nodes collapsed)
, ","
enum_constant (+738 nodes collapsed)
, ","
enum_constant (+467 nodes collapsed)
, ","
enum_constant (+602 nodes collapsed)
, ","
enum_constant
identifier "InBody"
class_body
{ "{"
method_declaration
boolean_type "boolean"
identifier "process"
formal_parameters
( "("
formal_parameter
type_identifier "Token"
identifier "t"
, ","
formal_parameter
type_identifier "HtmlTreeBuilder"
identifier "tb"
) ")"
block
{ "{"
switch_expression
switch "switch"
parenthesized_expression
( "("
field_access
identifier "t"
. "."
identifier "type"
) ")"
switch_block
{ "{"
switch_block_statement_group (+131 nodes collapsed)
switch_block_statement_group (+27 nodes collapsed)
switch_block_statement_group (+22 nodes collapsed)
switch_block_statement_group (+4020 nodes collapsed)
switch_block_statement_group
switch_label
case "case"
identifier "EndTag"
: ":"
local_variable_declaration
scoped_type_identifier
type_identifier "Token"
. "."
type_identifier "EndTag"
variable_declarator
identifier "endTag"
= "="
method_invocation
identifier "t"
. "."
identifier "asEndTag"
argument_list
( "("
) ")"
; ";"
expression_statement
assignment_expression
identifier "name"
= "="
method_invocation
identifier "endTag"
. "."
identifier "name"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "body"
" "\""
) ")"
) ")"
block (+53 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "html"
" "\""
) ")"
) ")"
block (+46 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression (+131 nodes collapsed)
block (+97 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "form"
" "\""
) ")"
) ")"
block (+125 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "p"
" "\""
) ")"
) ")"
block (+123 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "li"
" "\""
) ")"
) ")"
block (+96 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression (+21 nodes collapsed)
block (+96 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression (+41 nodes collapsed)
block (+161 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "name"
. "."
identifier "equals"
argument_list
( "("
string_literal
" "\""
string_fragment "sarcasm"
" "\""
) ")"
) ")"
block
{ "{"
line_comment "// *sigh*"
return_statement
return "return"
method_invocation
identifier "anyOtherEndTag"
argument_list
( "("
identifier "t"
, ","
identifier "tb"
) ")"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression (+81 nodes collapsed)
block
{ "{"
line_comment "// Adoption Agency Algorithm."
labeled_statement
identifier "OUTER"
: ":"
for_statement
for "for"
( "("
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "i"
= "="
decimal_integer_literal "0"
; ";"
binary_expression
identifier "i"
< "<"
decimal_integer_literal "8"
; ";"
update_expression
identifier "i"
++ "++"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "formatEl"
= "="
method_invocation
identifier "tb"
. "."
identifier "getActiveFormattingElement"
argument_list
( "("
identifier "name"
) ")"
; ";"
if_statement (+128 nodes collapsed)
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "furthestBlock"
= "="
null_literal "null"
; ";"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "commonAncestor"
= "="
null_literal "null"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "seenFormattingElement"
= "="
false "false"
; ";"
local_variable_declaration
generic_type
type_identifier "LinkedList"
type_arguments
< "<"
type_identifier "Element"
> ">"
variable_declarator
identifier "stack"
= "="
method_invocation
identifier "tb"
. "."
identifier "getStack"
argument_list
( "("
) ")"
; ";"
line_comment "// the spec doesn't limit to < 64, but in degenerate cases ("...
line_comment "// run-aways"
for_statement (+112 nodes collapsed)
if_statement (+42 nodes collapsed)
line_comment "// todo: Let a bookmark note the position of the formatting "...
line_comment "// does that mean: int pos of format el in list?"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "node"
= "="
identifier "furthestBlock"
; ";"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "lastNode"
= "="
identifier "furthestBlock"
; ";"
labeled_statement (+217 nodes collapsed)
if_statement (+119 nodes collapsed)
local_variable_declaration (+27 nodes collapsed)
expression_statement
method_invocation
method_invocation
identifier "adopter"
. "."
identifier "attributes"
argument_list
( "("
) ")"
. "."
identifier "addAll"
argument_list
( "("
method_invocation
identifier "formatEl"
. "."
identifier "attributes"
argument_list
( "("
) ")"
) ")"
; ";"
local_variable_declaration (+36 nodes collapsed)
enhanced_for_statement (+22 nodes collapsed)
expression_statement
method_invocation
identifier "furthestBlock"
. "."
identifier "appendChild"
argument_list
( "("
identifier "adopter"
) ")"
; ";"
expression_statement
method_invocation
identifier "tb"
. "."
identifier "removeFromActiveFormattingElements"
argument_list
( "("
identifier "formatEl"
) ")"
; ";"
line_comment "// todo: insert the new element into the list of active form"...
expression_statement
method_invocation
identifier "tb"
. "."
identifier "removeFromStack"
argument_list
( "("
identifier "formatEl"
) ")"
; ";"
expression_statement
method_invocation
identifier "tb"
. "."
identifier "insertOnStackAfter"
argument_list
( "("
identifier "furthestBlock"
, ","
identifier "adopter"
) ")"
; ";"
} "}"
} "}"
else "else"
if_statement (+220 nodes collapsed)
break_statement
break "break"
; ";"
switch_block_statement_group
switch_label
case "case"
identifier "EOF"
: ":"
line_comment "// todo: error if stack contains something not dd, dt, li, p"...
line_comment "// stop parsing"
break_statement
break "break"
; ";"
} "}"
return_statement
return "return"
true "true"
; ";"
} "}"
method_declaration (+219 nodes collapsed)
} "}"
, ","
enum_constant (+162 nodes collapsed)
, ","
enum_constant (+1191 nodes collapsed)
, ","
enum_constant (+340 nodes collapsed)
, ","
enum_constant (+503 nodes collapsed)
, ","
enum_constant (+485 nodes collapsed)
, ","
enum_constant (+688 nodes collapsed)
, ","
enum_constant (+658 nodes collapsed)
, ","
enum_constant (+652 nodes collapsed)
, ","
enum_constant (+1056 nodes collapsed)
, ","
enum_constant (+315 nodes collapsed)
, ","
enum_constant (+305 nodes collapsed)
, ","
enum_constant (+540 nodes collapsed)
, ","
enum_constant (+311 nodes collapsed)
, ","
enum_constant (+182 nodes collapsed)
, ","
enum_constant (+219 nodes collapsed)
, ","
enum_constant (+26 nodes collapsed)
enum_body_declarations (+290 nodes collapsed)
} "}"