[ZH/MPS][6572773] Breaks out complex logic into classes

Enables autotagging_comparator to track img and input elements.

Broke out behavior into classes for cleaner division of responsibility.