Revert "Support for :enabled selector on Anchor & Area elements"
authorbruno.d@partner.samsung.com <bruno.d@partner.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Sep 2014 16:31:33 +0000 (16:31 +0000)
committerbruno.d@partner.samsung.com <bruno.d@partner.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Sep 2014 16:31:33 +0000 (16:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134826

Reviewed by Darin Adler.

Source/WebCore:

HTML spec has been modified [1] to disable support for :enabled CSS
selector on Anchor, Area & Link elements, after discussion on W3C
Bugzilla [2].

This reverts r171671.

[1] https://html5.org/r/8818
[2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=26622

* css/SelectorCheckerTestFunctions.h:
(WebCore::isEnabled):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parseAttribute):

LayoutTests:

These layout tests are no longer correct after changes to the :enabled
CSS selector specification.

* fast/css/css-selector-enabled-links-expected.txt: Removed.
* fast/css/css-selector-enabled-links.html: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174064 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/css-selector-enabled-links-expected.txt [deleted file]
LayoutTests/fast/css/css-selector-enabled-links.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/css/SelectorCheckerTestFunctions.h
Source/WebCore/html/HTMLAnchorElement.cpp

index 8bfc7fa..172aa9f 100644 (file)
@@ -1,3 +1,16 @@
+2014-09-29  Bruno de Oliveira Abinader  <bruno.d@partner.samsung.com>
+
+        Revert "Support for :enabled selector on Anchor & Area elements"
+        https://bugs.webkit.org/show_bug.cgi?id=134826
+
+        Reviewed by Darin Adler.
+
+        These layout tests are no longer correct after changes to the :enabled
+        CSS selector specification.
+
+        * fast/css/css-selector-enabled-links-expected.txt: Removed.
+        * fast/css/css-selector-enabled-links.html: Removed.
+
 2014-09-02  Sergio Villar Senin  <svillar@igalia.com>
 
         [CSS Grid Layout] Handle percentages of indefinite sizes in minmax() and grid-auto-*
diff --git a/LayoutTests/fast/css/css-selector-enabled-links-expected.txt b/LayoutTests/fast/css/css-selector-enabled-links-expected.txt
deleted file mode 100644 (file)
index 61ad598..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-This test checks if :enabled CSS selector uses only Anchor and Area elements with 'href' attribute set.
-SUCCESS
diff --git a/LayoutTests/fast/css/css-selector-enabled-links.html b/LayoutTests/fast/css/css-selector-enabled-links.html
deleted file mode 100644 (file)
index bd4fa67..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>CSS Selector :enabled test for Anchor & Area Elements</title>
-        <script>
-            if (window.testRunner)
-                testRunner.dumpAsText();
-
-            function runTest() {
-                var div = document.getElementById("result");
-                var enabledElems = document.querySelectorAll(":enabled");
-                if (enabledElems.length == 2 &&
-                    enabledElems[0] == document.getElementById("anchor-1") &&
-                    enabledElems[1] == document.getElementById("area-1"))
-                    div.innerHTML = "SUCCESS";
-                else
-                    div.innerHTML = "FAIL";
-            }
-
-            window.onload = runTest;
-        </script>
-    </head>
-    <body>
-        <div>This test checks if :enabled CSS selector uses only Anchor and Area elements with 'href' attribute set.</div>
-        <a id="anchor-1" href="http://www.example.com"></a>
-        <a id="anchor-2"></a>
-        <img id="image" width="300" height="200" usemap="#map" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAxJREFUCNdjYKhnAAABAgCAbV7tZwAAAABJRU5ErkJggg=="/>
-        <map name="map">
-            <area id="area-1" coords="0,0,300,100" href="http://www.example.com"></area>
-            <area id="area-2" coords="0,100,300,200"></area>
-        </map>
-        <div id="result"></div>
-    </body>
-</html>
index a2e9eb7..2c8350e 100644 (file)
@@ -1,3 +1,24 @@
+2014-09-29  Bruno de Oliveira Abinader  <bruno.d@partner.samsung.com>
+
+        Revert "Support for :enabled selector on Anchor & Area elements"
+        https://bugs.webkit.org/show_bug.cgi?id=134826
+
+        Reviewed by Darin Adler.
+
+        HTML spec has been modified [1] to disable support for :enabled CSS
+        selector on Anchor, Area & Link elements, after discussion on W3C
+        Bugzilla [2].
+
+        This reverts r171671.
+
+        [1] https://html5.org/r/8818
+        [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=26622
+
+        * css/SelectorCheckerTestFunctions.h:
+        (WebCore::isEnabled):
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::parseAttribute):
+
 2014-09-29  Darin Adler  <darin@apple.com>
 
         Tweak and tighten SVG font converter
index 0ce2115..1c64194 100644 (file)
@@ -27,8 +27,6 @@
 #define SelectorCheckerTestFunctions_h
 
 #include "FocusController.h"
-#include "HTMLAnchorElement.h"
-#include "HTMLAreaElement.h"
 #include "HTMLInputElement.h"
 #include "HTMLOptionElement.h"
 #include "RenderScrollbar.h"
@@ -58,19 +56,14 @@ ALWAYS_INLINE bool isDefaultButtonForForm(const Element* element)
 
 ALWAYS_INLINE bool isDisabled(const Element* element)
 {
-    if (is<HTMLFormControlElement>(element) || is<HTMLOptionElement>(element) || is<HTMLOptGroupElement>(element))
-        return element->isDisabledFormControl();
-    return false;
+    return (is<HTMLFormControlElement>(element) || is<HTMLOptionElement>(element) || is<HTMLOptGroupElement>(element))
+        && element->isDisabledFormControl();
 }
 
 ALWAYS_INLINE bool isEnabled(const Element* element)
 {
-    bool isEnabled = false;
-    if (is<HTMLFormControlElement>(element) || is<HTMLOptionElement>(element) || is<HTMLOptGroupElement>(element))
-        isEnabled = !element->isDisabledFormControl();
-    else if (element->isLink())
-        isEnabled = is<HTMLAnchorElement>(element) || is<HTMLAreaElement>(element);
-    return isEnabled;
+    return (is<HTMLFormControlElement>(element) || is<HTMLOptionElement>(element) || is<HTMLOptGroupElement>(element))
+        && !element->isDisabledFormControl();
 }
 
 ALWAYS_INLINE bool isMediaDocument(Element* element)
index 655aab0..5c5335f 100644 (file)
@@ -249,7 +249,7 @@ void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicSt
         bool wasLink = isLink();
         setIsLink(!value.isNull() && !shouldProhibitLinks(this));
         if (wasLink != isLink())
-            didAffectSelector(AffectedSelectorLink | AffectedSelectorVisited | AffectedSelectorEnabled);
+            didAffectSelector(AffectedSelectorLink | AffectedSelectorVisited);
         if (isLink()) {
             String parsedURL = stripLeadingAndTrailingHTMLSpaces(value);
             if (document().isDNSPrefetchEnabled()) {