Sfoglia il codice sorgente

LibHTML: Only actually-linked <a> elements should be blue+underlined

Turns out this just needed a little push in the selector engine. :^)
Andreas Kling 5 anni fa
parent
commit
64ce453050

+ 1 - 1
Libraries/LibHTML/CSS/Default.css

@@ -89,7 +89,7 @@ li {
     margin-bottom: 2;
     margin-bottom: 2;
 }
 }
 
 
-a {
+a:link {
     color: -libhtml-link;
     color: -libhtml-link;
     text-decoration: underline;
     text-decoration: underline;
 }
 }

+ 2 - 1
Libraries/LibHTML/CSS/SelectorEngine.cpp

@@ -20,7 +20,8 @@ bool matches(const Selector::Component& component, const Element& element)
     case Selector::Component::PseudoClass::None:
     case Selector::Component::PseudoClass::None:
         break;
         break;
     case Selector::Component::PseudoClass::Link:
     case Selector::Component::PseudoClass::Link:
-        ASSERT_NOT_REACHED();
+        if (!element.is_link())
+            return false;
         break;
         break;
     case Selector::Component::PseudoClass::Hover:
     case Selector::Component::PseudoClass::Hover:
         if (!matches_hover_pseudo_class(element))
         if (!matches_hover_pseudo_class(element))