Skip to content

Commit

Permalink
Fix an issue where differences in TEXTAREA elements were not colored …
Browse files Browse the repository at this point in the history
…correctly.
  • Loading branch information
sdottaka committed Jul 16, 2023
1 parent ba22942 commit d00d358
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions src/WinWebDiffLib/DiffHighlighter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,30 @@ struct TextSegments
seg.size = text.size();
allText += text;
segments.insert_or_assign(seg.begin, seg);

}
else if (nodeType == NodeType::ELEMENT_NODE &&
wcscmp(nodeName, L"INPUT") == 0)
else if (nodeType == NodeType::ELEMENT_NODE)
{
const wchar_t* type = domutils::getAttribute(nodeTree, L"type");
if (!type || wcscmp(type, L"hidden") != 0)
if (wcscmp(nodeName, L"INPUT") == 0)
{
const wchar_t* type = domutils::getAttribute(nodeTree, L"type");
if (!type || wcscmp(type, L"hidden") != 0)
{
const wchar_t* value = domutils::getAttribute(nodeTree, L"value");
std::wstring text = value ? value : L"";
TextSegment seg{};
seg.nodeId = nodeTree[L"nodeId"].GetInt();
seg.nodeType = nodeType;
seg.begin = allText.size();
seg.size = text.size();
allText += text;
segments.insert_or_assign(seg.begin, seg);
}
}
else if (wcscmp(nodeName, L"TEXTAREA") == 0)
{
const wchar_t* value = domutils::getAttribute(nodeTree, L"value");
std::wstring text = value ? value : L"";
std::wstring text;
for (const auto& child : nodeTree[L"children"].GetArray())
text += child[L"nodeValue"].GetString();
TextSegment seg{};
seg.nodeId = nodeTree[L"nodeId"].GetInt();
seg.nodeType = nodeType;
Expand All @@ -100,7 +114,8 @@ struct TextSegments
wcscmp(nodeName, L"NOSCRIPT") != 0 &&
wcscmp(nodeName, L"NOFRAMES") != 0 &&
wcscmp(nodeName, L"STYLE") != 0 &&
wcscmp(nodeName, L"TITLE") != 0)
wcscmp(nodeName, L"TITLE") != 0 &&
wcscmp(nodeName, L"TEXTAREA") != 0)
{
for (const auto& child : nodeTree[L"children"].GetArray())
{
Expand Down

0 comments on commit d00d358

Please sign in to comment.