Skip to content

Commit 82c489f

Browse files
committed
LibWeb/HTML: Use camelCase for variables in adoption agency comments
This is a spec change but I don't know when it occurred. Also reformat some of the spec comments for clarity. No code changes, only comments.
1 parent 7aef8c9 commit 82c489f

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

Libraries/LibWeb/HTML/Parser/HTMLParser.cpp

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,28 +1464,28 @@ HTMLParser::AdoptionAgencyAlgorithmOutcome HTMLParser::run_the_adoption_agency_a
14641464
return AdoptionAgencyAlgorithmOutcome::DoNothing;
14651465
}
14661466

1467-
// 3. Let outer loop counter be 0.
1467+
// 3. Let outerLoopCounter be 0.
14681468
size_t outer_loop_counter = 0;
14691469

14701470
// 4. While true:
14711471
while (true) {
1472-
// 1. If outer loop counter is greater than or equal to 8, then return.
1472+
// 1. If outerLoopCounter is greater than or equal to 8, then return.
14731473
if (outer_loop_counter >= 8)
14741474
return AdoptionAgencyAlgorithmOutcome::DoNothing;
14751475

1476-
// 2. Increment outer loop counter by 1.
1476+
// 2. Increment outerLoopCounter by 1.
14771477
outer_loop_counter++;
14781478

1479-
// 3. Let formatting element be the last element in the list of active formatting elements that:
1479+
// 3. Let formattingElement be the last element in the list of active formatting elements that:
14801480
// - is between the end of the list and the last marker in the list, if any, or the start of the list otherwise, and
14811481
// - has the tag name subject.
14821482
auto* formatting_element = m_list_of_active_formatting_elements.last_element_with_tag_name_before_marker(subject);
14831483

1484-
// If there is no such element, then return and instead act as described in the "any other end tag" entry above.
1484+
// If there is no such element, then return and instead act as described in the "any other end tag" entry above.
14851485
if (!formatting_element)
14861486
return AdoptionAgencyAlgorithmOutcome::RunAnyOtherEndTagSteps;
14871487

1488-
// 4. If formatting element is not in the stack of open elements,
1488+
// 4. If formattingElement is not in the stack of open elements,
14891489
if (!m_stack_of_open_elements.contains(*formatting_element)) {
14901490
// then this is a parse error;
14911491
log_parse_error();
@@ -1495,58 +1495,58 @@ HTMLParser::AdoptionAgencyAlgorithmOutcome HTMLParser::run_the_adoption_agency_a
14951495
return AdoptionAgencyAlgorithmOutcome::DoNothing;
14961496
}
14971497

1498-
// 5. If formatting element is in the stack of open elements, but the element is not in scope,
1498+
// 5. If formattingElement is in the stack of open elements, but the element is not in scope,
14991499
if (!m_stack_of_open_elements.has_in_scope(*formatting_element)) {
15001500
// then this is a parse error;
15011501
log_parse_error();
15021502
// return.
15031503
return AdoptionAgencyAlgorithmOutcome::DoNothing;
15041504
}
15051505

1506-
// 6. If formatting element is not the current node,
1506+
// 6. If formattingElement is not the current node,
15071507
if (formatting_element != current_node()) {
15081508
// this is a parse error. (But do not return.)
15091509
log_parse_error();
15101510
}
15111511

1512-
// 7. Let furthest block be the topmost node in the stack of open elements that is lower in the stack than formatting element,
1512+
// 7. Let furthestBlock be the topmost node in the stack of open elements that is lower in the stack than formattingElement,
15131513
// and is an element in the special category. There might not be one.
15141514
GC::Ptr<DOM::Element> furthest_block = m_stack_of_open_elements.topmost_special_node_below(*formatting_element);
15151515

1516-
// 8. If there is no furthest block
1516+
// 8. If there is no furthestBlock,
15171517
if (!furthest_block) {
15181518
// then the UA must first pop all the nodes from the bottom of the stack of open elements,
1519-
// from the current node up to and including formatting element,
1519+
// from the current node up to and including formattingElement,
15201520
while (current_node() != formatting_element)
15211521
(void)m_stack_of_open_elements.pop();
15221522
(void)m_stack_of_open_elements.pop();
15231523

1524-
// then remove formatting element from the list of active formatting elements,
1524+
// then remove formattingElement from the list of active formatting elements,
15251525
m_list_of_active_formatting_elements.remove(*formatting_element);
15261526
// and finally return.
15271527
return AdoptionAgencyAlgorithmOutcome::DoNothing;
15281528
}
15291529

1530-
// 9. Let common ancestor be the element immediately above formatting element in the stack of open elements.
1530+
// 9. Let commonAncestor be the element immediately above formattingElement in the stack of open elements.
15311531
auto common_ancestor = m_stack_of_open_elements.element_immediately_above(*formatting_element);
15321532

1533-
// 10. Let a bookmark note the position of formatting element in the list of active formatting elements
1533+
// 10. Let a bookmark note the position of formattingElement in the list of active formatting elements
15341534
// relative to the elements on either side of it in the list.
15351535
auto bookmark = m_list_of_active_formatting_elements.find_index(*formatting_element).value();
15361536

1537-
// 11. Let node and last node be furthest block.
1537+
// 11. Let node and lastNode be furthestBlock.
15381538
auto node = furthest_block;
15391539
auto last_node = furthest_block;
15401540

1541-
// Keep track of this for later
1541+
// NOTE: Keep track of this for later
15421542
auto node_above_node = m_stack_of_open_elements.element_immediately_above(*node);
15431543

1544-
// 12. Let inner loop counter be 0.
1544+
// 12. Let innerLoopCounter be 0.
15451545
size_t inner_loop_counter = 0;
15461546

15471547
// 13. While true:
15481548
while (true) {
1549-
// 1. Increment inner loop counter by 1.
1549+
// 1. Increment innerLoopCounter by 1.
15501550
inner_loop_counter++;
15511551

15521552
// 2. Let node be the element immediately above node in the stack of open elements,
@@ -1555,14 +1555,14 @@ HTMLParser::AdoptionAgencyAlgorithmOutcome HTMLParser::run_the_adoption_agency_a
15551555
node = node_above_node;
15561556
VERIFY(node);
15571557

1558-
// Keep track of this for later
1558+
// NOTE: Keep track of this for later
15591559
node_above_node = m_stack_of_open_elements.element_immediately_above(*node);
15601560

1561-
// 3. If node is formatting element, then break.
1561+
// 3. If node is formattingElement, then break.
15621562
if (node.ptr() == formatting_element)
15631563
break;
15641564

1565-
// 4. If inner loop counter is greater than 3 and node is in the list of active formatting elements,
1565+
// 4. If innerLoopCounter is greater than 3 and node is in the list of active formatting elements,
15661566
if (inner_loop_counter > 3 && m_list_of_active_formatting_elements.contains(*node)) {
15671567
auto node_index = m_list_of_active_formatting_elements.find_index(*node);
15681568
if (node_index.has_value() && node_index.value() < bookmark)
@@ -1571,64 +1571,64 @@ HTMLParser::AdoptionAgencyAlgorithmOutcome HTMLParser::run_the_adoption_agency_a
15711571
m_list_of_active_formatting_elements.remove(*node);
15721572
}
15731573

1574-
// 5. If node is not in the list of active formatting elements
1574+
// 5. If node is not in the list of active formatting elements,
15751575
if (!m_list_of_active_formatting_elements.contains(*node)) {
15761576
// then remove node from the stack of open elements and continue.
15771577
m_stack_of_open_elements.remove(*node);
15781578
continue;
15791579
}
15801580

15811581
// 6. Create an element for the token for which the element node was created,
1582-
// in the HTML namespace, with common ancestor as the intended parent;
1582+
// in the HTML namespace, with commonAncestor as the intended parent;
15831583
// FIXME: hold onto the real token
15841584
auto element = create_element_for(HTMLToken::make_start_tag(node->local_name()), Namespace::HTML, *common_ancestor);
1585-
// replace the entry for node in the list of active formatting elements with an entry for the new element,
1585+
// replace the entry for node in the list of active formatting elements with an entry for the new element,
15861586
m_list_of_active_formatting_elements.replace(*node, *element);
1587-
// replace the entry for node in the stack of open elements with an entry for the new element,
1587+
// replace the entry for node in the stack of open elements with an entry for the new element,
15881588
m_stack_of_open_elements.replace(*node, element);
1589-
// and let node be the new element.
1589+
// and let node be the new element.
15901590
node = element;
15911591

1592-
// 7. If last node is furthest block,
1592+
// 7. If lastNode is furthestBlock,
15931593
if (last_node == furthest_block) {
15941594
// then move the aforementioned bookmark to be immediately after the new node in the list of active formatting elements.
15951595
bookmark = m_list_of_active_formatting_elements.find_index(*node).value() + 1;
15961596
}
15971597

1598-
// 8. Append last node to node.
1598+
// 8. Append lastNode to node.
15991599
MUST(node->append_child(*last_node));
16001600

1601-
// 9. Set last node to node.
1601+
// 9. Set lastNode to node.
16021602
last_node = node;
16031603
}
16041604

1605-
// 14. Insert whatever last node ended up being in the previous step at the appropriate place for inserting a node,
1606-
// but using common ancestor as the override target.
1605+
// 14. Insert whatever lastNode ended up being in the previous step at the appropriate place for inserting a node,
1606+
// but using commonAncestor as the override target.
16071607
auto adjusted_insertion_location = find_appropriate_place_for_inserting_node(common_ancestor);
16081608
adjusted_insertion_location.parent->insert_before(*last_node, adjusted_insertion_location.insert_before_sibling, false);
16091609

1610-
// 15. Create an element for the token for which formatting element was created,
1611-
// in the HTML namespace, with furthest block as the intended parent.
1610+
// 15. Create an element for the token for which formattingElement was created,
1611+
// in the HTML namespace, with furthestBlock as the intended parent.
16121612
// FIXME: hold onto the real token
16131613
auto element = create_element_for(HTMLToken::make_start_tag(formatting_element->local_name()), Namespace::HTML, *furthest_block);
16141614

1615-
// 16. Take all of the child nodes of furthest block and append them to the element created in the last step.
1615+
// 16. Take all of the child nodes of furthestBlock and append them to the element created in the last step.
16161616
for (auto& child : furthest_block->children_as_vector())
16171617
MUST(element->append_child(furthest_block->remove_child(*child).release_value()));
16181618

1619-
// 17. Append that new element to furthest block.
1619+
// 17. Append that new element to furthestBlock.
16201620
MUST(furthest_block->append_child(*element));
16211621

1622-
// 18. Remove formatting element from the list of active formatting elements,
1622+
// 18. Remove formattingElement from the list of active formatting elements,
16231623
// and insert the new element into the list of active formatting elements at the position of the aforementioned bookmark.
16241624
auto formatting_element_index = m_list_of_active_formatting_elements.find_index(*formatting_element);
16251625
if (formatting_element_index.has_value() && formatting_element_index.value() < bookmark)
16261626
bookmark--;
16271627
m_list_of_active_formatting_elements.remove(*formatting_element);
16281628
m_list_of_active_formatting_elements.insert_at(bookmark, *element);
16291629

1630-
// 19. Remove formatting element from the stack of open elements, and insert the new element
1631-
// into the stack of open elements immediately below the position of furthest block in that stack.
1630+
// 19. Remove formattingElement from the stack of open elements, and insert the new element
1631+
// into the stack of open elements immediately below the position of furthestBlock in that stack.
16321632
m_stack_of_open_elements.remove(*formatting_element);
16331633
m_stack_of_open_elements.insert_immediately_below(*element, *furthest_block);
16341634
}

0 commit comments

Comments
 (0)