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–155 unchanged (155 lines)
156 Element insert(Token.StartTag startTag) {
157 // handle empty unknown tags
158 // when the spec expects an empty tag, will directly hit insertEmpty, so won't generate this fake end tag.
159 if (startTag.isSelfClosing()) {
160 Element el = insertEmpty(startTag);
161 stack.add(el);
162 tokeniser.emit(new Token.EndTag(el.tagName())); // ensure we get out of whatever state we are in. emitted for yielded processing
163 return el;
164 }
165
166 Element el = new Element(Tag.valueOf(startTag.name()), baseUri, startTag.attributes);
167 insert(el);
168 return el;
…lines 169–705 unchanged (537 lines)

After

…lines 1–155 unchanged (155 lines)
156 Element insert(Token.StartTag startTag) {
157 // handle empty unknown tags
158 // when the spec expects an empty tag, will directly hit insertEmpty, so won't generate this fake end tag.
159 if (startTag.isSelfClosing()) {
160 Element el = insertEmpty(startTag);
161 stack.add(el);
162 tokeniser.transition(TokeniserState.Data); // handles <script />, otherwise needs breakout steps from script data
163 tokeniser.emit(new Token.EndTag(el.tagName())); // ensure we get out of whatever state we are in. emitted for yielded processing
164 return el;
165 }
166
167 Element el = new Element(Tag.valueOf(startTag.name()), baseUri, startTag.attributes);
168 insert(el);
…lines 169–706 unchanged (538 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
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "select"
. "."
identifier "Elements"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
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"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n * HTML Tree Builder; creates a DOM from Tokens.\n */"
class_declaration
class "class"
identifier "HtmlTreeBuilder"
superclass
extends "extends"
type_identifier "TreeBuilder"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "HtmlTreeBuilderState"
variable_declarator
identifier "state"
; ";"
line_comment "// the current state"
field_declaration
modifiers
private "private"
type_identifier "HtmlTreeBuilderState"
variable_declarator
identifier "originalState"
; ";"
line_comment "// original / marked state"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "baseUriSetFromDoc"
= "="
false "false"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Element"
variable_declarator
identifier "headElement"
; ";"
line_comment "// the current head element"
field_declaration
modifiers
private "private"
type_identifier "FormElement"
variable_declarator
identifier "formElement"
; ";"
line_comment "// the current form element"
field_declaration
modifiers
private "private"
type_identifier "Element"
variable_declarator
identifier "contextElement"
; ";"
line_comment "// fragment parse context -- could be null even if fragment "...
field_declaration (+24 nodes collapsed)
line_comment "// active (open) formatting elements"
field_declaration (+30 nodes collapsed)
line_comment "// chars in table to be shifted out"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "framesetOk"
= "="
true "true"
; ";"
line_comment "// if ok to go into frameset"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "fosterInserts"
= "="
false "false"
; ";"
line_comment "// if next inserts should be fostered"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "fragmentParsing"
= "="
false "false"
; ";"
line_comment "// if parsing a fragment of html"
constructor_declaration
identifier "HtmlTreeBuilder"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
} "}"
method_declaration (+48 nodes collapsed)
method_declaration (+482 nodes collapsed)
method_declaration (+39 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+21 nodes collapsed)
method_declaration
type_identifier "HtmlTreeBuilderState"
identifier "state"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "state"
; ";"
} "}"
method_declaration
void_type "void"
identifier "markInsertionMode"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "originalState"
= "="
identifier "state"
; ";"
} "}"
method_declaration
type_identifier "HtmlTreeBuilderState"
identifier "originalState"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "originalState"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
boolean_type "boolean"
identifier "framesetOk"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "framesetOk"
; ";"
} "}"
method_declaration
type_identifier "Document"
identifier "getDocument"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "doc"
; ";"
} "}"
method_declaration
type_identifier "String"
identifier "getBaseUri"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "baseUri"
; ";"
} "}"
method_declaration (+81 nodes collapsed)
method_declaration
boolean_type "boolean"
identifier "isFragmentParsing"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "fragmentParsing"
; ";"
} "}"
method_declaration (+61 nodes collapsed)
method_declaration
type_identifier "Element"
identifier "insert"
formal_parameters
( "("
formal_parameter
scoped_type_identifier
type_identifier "Token"
. "."
type_identifier "StartTag"
identifier "startTag"
) ")"
block
{ "{"
line_comment "// handle empty unknown tags"
line_comment "// when the spec expects an empty tag, will directly hit ins"...
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "startTag"
. "."
identifier "isSelfClosing"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "el"
= "="
method_invocation
identifier "insertEmpty"
argument_list
( "("
identifier "startTag"
) ")"
; ";"
expression_statement
method_invocation
identifier "stack"
. "."
identifier "add"
argument_list
( "("
identifier "el"
) ")"
; ";"
expression_statement (+25 nodes collapsed)
line_comment "// ensure we get out of whatever state we are in. emitted fo"...
return_statement
return "return"
identifier "el"
; ";"
} "}"
local_variable_declaration (+33 nodes collapsed)
expression_statement
method_invocation
identifier "insert"
argument_list
( "("
identifier "el"
) ")"
; ";"
return_statement
return "return"
identifier "el"
; ";"
} "}"
method_declaration (+46 nodes collapsed)
method_declaration (+30 nodes collapsed)
method_declaration (+143 nodes collapsed)
method_declaration (+95 nodes collapsed)
method_declaration (+44 nodes collapsed)
method_declaration (+110 nodes collapsed)
method_declaration (+132 nodes collapsed)
method_declaration (+127 nodes collapsed)
method_declaration (+22 nodes collapsed)
method_declaration
generic_type
type_identifier "DescendableLinkedList"
type_arguments
< "<"
type_identifier "Element"
> ">"
identifier "getStack"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "stack"
; ";"
} "}"
method_declaration (+23 nodes collapsed)
method_declaration (+89 nodes collapsed)
method_declaration (+88 nodes collapsed)
method_declaration (+87 nodes collapsed)
method_declaration (+105 nodes collapsed)
method_declaration (+109 nodes collapsed)
method_declaration (+96 nodes collapsed)
method_declaration
void_type "void"
identifier "clearStackToTableContext"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "clearStackToContext"
argument_list
( "("
string_literal
" "\""
string_fragment "table"
" "\""
) ")"
; ";"
} "}"
method_declaration (+30 nodes collapsed)
method_declaration
void_type "void"
identifier "clearStackToTableRowContext"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "clearStackToContext"
argument_list
( "("
string_literal
" "\""
string_fragment "tr"
" "\""
) ")"
; ";"
} "}"
method_declaration (+115 nodes collapsed)
method_declaration (+93 nodes collapsed)
method_declaration (+61 nodes collapsed)
method_declaration (+28 nodes collapsed)
method_declaration (+79 nodes collapsed)
method_declaration (+554 nodes collapsed)
line_comment "// todo: tidy up in specific scope methods"
method_declaration (+52 nodes collapsed)
method_declaration (+173 nodes collapsed)
method_declaration (+76 nodes collapsed)
method_declaration (+23 nodes collapsed)
method_declaration (+82 nodes collapsed)
method_declaration (+40 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+42 nodes collapsed)
method_declaration (+135 nodes collapsed)
method_declaration (+21 nodes collapsed)
method_declaration
type_identifier "Element"
identifier "getHeadElement"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "headElement"
; ";"
} "}"
method_declaration
boolean_type "boolean"
identifier "isFosterInserts"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "fosterInserts"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
type_identifier "FormElement"
identifier "getFormElement"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "formElement"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration (+28 nodes collapsed)
method_declaration (+21 nodes collapsed)
method_declaration (+29 nodes collapsed)
block_comment "/**\n 11.2.5.2 Closing elements that have implied end tag"...
method_declaration (+113 nodes collapsed)
method_declaration
void_type "void"
identifier "generateImpliedEndTags"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "generateImpliedEndTags"
argument_list
( "("
null_literal "null"
) ")"
; ";"
} "}"
method_declaration (+433 nodes collapsed)
line_comment "// active formatting elements"
method_declaration (+131 nodes collapsed)
method_declaration (+66 nodes collapsed)
method_declaration (+298 nodes collapsed)
method_declaration (+60 nodes collapsed)
method_declaration (+82 nodes collapsed)
method_declaration (+23 nodes collapsed)
method_declaration (+99 nodes collapsed)
method_declaration (+28 nodes collapsed)
method_declaration
void_type "void"
identifier "insertMarkerToFormattingElements"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "formattingElements"
. "."
identifier "add"
argument_list
( "("
null_literal "null"
) ")"
; ";"
} "}"
method_declaration (+160 nodes collapsed)
method_declaration (+55 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
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "select"
. "."
identifier "Elements"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
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"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
block_comment "/**\n * HTML Tree Builder; creates a DOM from Tokens.\n */"
class_declaration
class "class"
identifier "HtmlTreeBuilder"
superclass
extends "extends"
type_identifier "TreeBuilder"
class_body
{ "{"
field_declaration
modifiers
private "private"
type_identifier "HtmlTreeBuilderState"
variable_declarator
identifier "state"
; ";"
line_comment "// the current state"
field_declaration
modifiers
private "private"
type_identifier "HtmlTreeBuilderState"
variable_declarator
identifier "originalState"
; ";"
line_comment "// original / marked state"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "baseUriSetFromDoc"
= "="
false "false"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Element"
variable_declarator
identifier "headElement"
; ";"
line_comment "// the current head element"
field_declaration
modifiers
private "private"
type_identifier "FormElement"
variable_declarator
identifier "formElement"
; ";"
line_comment "// the current form element"
field_declaration
modifiers
private "private"
type_identifier "Element"
variable_declarator
identifier "contextElement"
; ";"
line_comment "// fragment parse context -- could be null even if fragment "...
field_declaration (+24 nodes collapsed)
line_comment "// active (open) formatting elements"
field_declaration (+30 nodes collapsed)
line_comment "// chars in table to be shifted out"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "framesetOk"
= "="
true "true"
; ";"
line_comment "// if ok to go into frameset"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "fosterInserts"
= "="
false "false"
; ";"
line_comment "// if next inserts should be fostered"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "fragmentParsing"
= "="
false "false"
; ";"
line_comment "// if parsing a fragment of html"
constructor_declaration
identifier "HtmlTreeBuilder"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
} "}"
method_declaration (+48 nodes collapsed)
method_declaration (+482 nodes collapsed)
method_declaration (+39 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+21 nodes collapsed)
method_declaration
type_identifier "HtmlTreeBuilderState"
identifier "state"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "state"
; ";"
} "}"
method_declaration
void_type "void"
identifier "markInsertionMode"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "originalState"
= "="
identifier "state"
; ";"
} "}"
method_declaration
type_identifier "HtmlTreeBuilderState"
identifier "originalState"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "originalState"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
boolean_type "boolean"
identifier "framesetOk"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "framesetOk"
; ";"
} "}"
method_declaration
type_identifier "Document"
identifier "getDocument"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "doc"
; ";"
} "}"
method_declaration
type_identifier "String"
identifier "getBaseUri"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "baseUri"
; ";"
} "}"
method_declaration (+81 nodes collapsed)
method_declaration
boolean_type "boolean"
identifier "isFragmentParsing"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "fragmentParsing"
; ";"
} "}"
method_declaration (+61 nodes collapsed)
method_declaration
type_identifier "Element"
identifier "insert"
formal_parameters
( "("
formal_parameter
scoped_type_identifier
type_identifier "Token"
. "."
type_identifier "StartTag"
identifier "startTag"
) ")"
block
{ "{"
line_comment "// handle empty unknown tags"
line_comment "// when the spec expects an empty tag, will directly hit ins"...
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "startTag"
. "."
identifier "isSelfClosing"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "el"
= "="
method_invocation
identifier "insertEmpty"
argument_list
( "("
identifier "startTag"
) ")"
; ";"
expression_statement
method_invocation
identifier "stack"
. "."
identifier "add"
argument_list
( "("
identifier "el"
) ")"
; ";"
expression_statement
method_invocation
identifier "tokeniser"
. "."
identifier "transition"
argument_list
( "("
field_access
identifier "TokeniserState"
. "."
identifier "Data"
) ")"
; ";"
line_comment "// handles <script />, otherwise needs breakout steps from s"...
expression_statement (+25 nodes collapsed)
line_comment "// ensure we get out of whatever state we are in. emitted fo"...
return_statement
return "return"
identifier "el"
; ";"
} "}"
local_variable_declaration (+33 nodes collapsed)
expression_statement
method_invocation
identifier "insert"
argument_list
( "("
identifier "el"
) ")"
; ";"
return_statement
return "return"
identifier "el"
; ";"
} "}"
method_declaration (+46 nodes collapsed)
method_declaration (+30 nodes collapsed)
method_declaration (+143 nodes collapsed)
method_declaration (+95 nodes collapsed)
method_declaration (+44 nodes collapsed)
method_declaration (+110 nodes collapsed)
method_declaration (+132 nodes collapsed)
method_declaration (+127 nodes collapsed)
method_declaration (+22 nodes collapsed)
method_declaration
generic_type
type_identifier "DescendableLinkedList"
type_arguments
< "<"
type_identifier "Element"
> ">"
identifier "getStack"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "stack"
; ";"
} "}"
method_declaration (+23 nodes collapsed)
method_declaration (+89 nodes collapsed)
method_declaration (+88 nodes collapsed)
method_declaration (+87 nodes collapsed)
method_declaration (+105 nodes collapsed)
method_declaration (+109 nodes collapsed)
method_declaration (+96 nodes collapsed)
method_declaration
void_type "void"
identifier "clearStackToTableContext"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "clearStackToContext"
argument_list
( "("
string_literal
" "\""
string_fragment "table"
" "\""
) ")"
; ";"
} "}"
method_declaration (+30 nodes collapsed)
method_declaration
void_type "void"
identifier "clearStackToTableRowContext"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "clearStackToContext"
argument_list
( "("
string_literal
" "\""
string_fragment "tr"
" "\""
) ")"
; ";"
} "}"
method_declaration (+115 nodes collapsed)
method_declaration (+93 nodes collapsed)
method_declaration (+61 nodes collapsed)
method_declaration (+28 nodes collapsed)
method_declaration (+79 nodes collapsed)
method_declaration (+554 nodes collapsed)
line_comment "// todo: tidy up in specific scope methods"
method_declaration (+52 nodes collapsed)
method_declaration (+173 nodes collapsed)
method_declaration (+76 nodes collapsed)
method_declaration (+23 nodes collapsed)
method_declaration (+82 nodes collapsed)
method_declaration (+40 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+42 nodes collapsed)
method_declaration (+135 nodes collapsed)
method_declaration (+21 nodes collapsed)
method_declaration
type_identifier "Element"
identifier "getHeadElement"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "headElement"
; ";"
} "}"
method_declaration
boolean_type "boolean"
identifier "isFosterInserts"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "fosterInserts"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
type_identifier "FormElement"
identifier "getFormElement"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "formElement"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration (+28 nodes collapsed)
method_declaration (+21 nodes collapsed)
method_declaration (+29 nodes collapsed)
block_comment "/**\n 11.2.5.2 Closing elements that have implied end tag"...
method_declaration (+113 nodes collapsed)
method_declaration
void_type "void"
identifier "generateImpliedEndTags"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "generateImpliedEndTags"
argument_list
( "("
null_literal "null"
) ")"
; ";"
} "}"
method_declaration (+433 nodes collapsed)
line_comment "// active formatting elements"
method_declaration (+131 nodes collapsed)
method_declaration (+66 nodes collapsed)
method_declaration (+298 nodes collapsed)
method_declaration (+60 nodes collapsed)
method_declaration (+82 nodes collapsed)
method_declaration (+23 nodes collapsed)
method_declaration (+99 nodes collapsed)
method_declaration (+28 nodes collapsed)
method_declaration
void_type "void"
identifier "insertMarkerToFormattingElements"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "formattingElements"
. "."
identifier "add"
argument_list
( "("
null_literal "null"
) ")"
; ";"
} "}"
method_declaration (+160 nodes collapsed)
method_declaration (+55 nodes collapsed)
} "}"