[Gtk] Add computedStyleIncludingVisitedInfo to DumpRenderTreeSupport
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 08:00:22 +0000 (08:00 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 08:00:22 +0000 (08:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81232

Patch by Zan Dobersek <zandobersek@gmail.com> on 2012-03-16
Reviewed by Philippe Normand.

Source/WebKit/gtk:

Add computedStyleIncludingVisitedInfo helper method to
DumpRenderTreeSupportGtk.

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::computedStyleIncludingVisitedInfo):
* WebCoreSupport/DumpRenderTreeSupportGtk.h:
(DumpRenderTreeSupportGtk):

Tools:

Use the newly-added helper method in DumpRenderTreeSupportGtk.

* DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
(LayoutTestController::computedStyleIncludingVisitedInfo):

LayoutTests:

Unskip now-passing tests.

* platform/gtk/Skipped:
* platform/gtk/fast/history/nested-visited-test-expected.txt: Removed.
* platform/gtk/fast/history/self-is-visited-expected.txt: Removed.
* platform/gtk/fast/history/sibling-visited-test-expected.txt: Removed.

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

LayoutTests/ChangeLog
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/gtk/fast/history/nested-visited-test-expected.txt [deleted file]
LayoutTests/platform/gtk/fast/history/self-is-visited-expected.txt [deleted file]
LayoutTests/platform/gtk/fast/history/sibling-visited-test-expected.txt [deleted file]
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h
Tools/ChangeLog
Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

index 223db81596781591aeacf79a13923f2d5ae093af..e91253a3184e14cf90e7ed6a3386b3e84c97cc3c 100644 (file)
@@ -1,3 +1,17 @@
+2012-03-16  Zan Dobersek  <zandobersek@gmail.com>
+
+        [Gtk] Add computedStyleIncludingVisitedInfo to DumpRenderTreeSupport
+        https://bugs.webkit.org/show_bug.cgi?id=81232
+
+        Reviewed by Philippe Normand.
+
+        Unskip now-passing tests.
+
+        * platform/gtk/Skipped:
+        * platform/gtk/fast/history/nested-visited-test-expected.txt: Removed.
+        * platform/gtk/fast/history/self-is-visited-expected.txt: Removed.
+        * platform/gtk/fast/history/sibling-visited-test-expected.txt: Removed.
+
 2012-03-16  Zan Dobersek  <zandobersek@gmail.com>
 
         [Gtk] Properly set forms tests-specific settings
index 2803feafc669c8e3ad92cc8ecc5ae2e8d616b03c..0176d2f6da80c054e7312ac2f8425c371f7a6e7d 100644 (file)
@@ -1138,14 +1138,6 @@ fast/canvas/pointInPath.html
 # https://bugs.webkit.org/show_bug.cgi?id=49179
 animations/stop-animation-on-suspend.html
 
-# computedStyleIncludingVisitedInfo is not implemented
-# https://bugs.webkit.org/show_bug.cgi?id=37336
-fast/history/nested-visited-test.html
-fast/history/self-is-visited.html
-fast/history/sibling-visited-test.html
-fast/history/multiple-classes-visited.html
-fast/loader/stateobjects/state-url-sets-links-visited.html
-
 # Rounding color problems inside pixman
 # https://bugs.webkit.org/show_bug.cgi?id=49964
 fast/canvas/canvas-getImageData.html
diff --git a/LayoutTests/platform/gtk/fast/history/nested-visited-test-expected.txt b/LayoutTests/platform/gtk/fast/history/nested-visited-test-expected.txt
deleted file mode 100644 (file)
index a4c7fe3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-CONSOLE MESSAGE: line 20: TypeError: Result of expression 'firstStyle' [undefined] is not an object.
-These two links should be different colors (green and orange):
-
-One Two
-
-PASS
diff --git a/LayoutTests/platform/gtk/fast/history/self-is-visited-expected.txt b/LayoutTests/platform/gtk/fast/history/self-is-visited-expected.txt
deleted file mode 100644 (file)
index f85fc0b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-CONSOLE MESSAGE: line 14: TypeError: Result of expression 'firstStyle' [undefined] is not an object.
-These two links should be different colors (green and orange):
-
-One Two
-PASS
diff --git a/LayoutTests/platform/gtk/fast/history/sibling-visited-test-expected.txt b/LayoutTests/platform/gtk/fast/history/sibling-visited-test-expected.txt
deleted file mode 100644 (file)
index 53902df..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-CONSOLE MESSAGE: line 14: TypeError: Result of expression 'firstStyle' [undefined] is not an object.
-These two links should be different colors (green and orange):
-
-One Two
-
-PASS
index 91183eb82db0e07f9f21bbbda55af4cbfa45fa78..418ee2d23247b9a48988ed1e0d30d84b39ba4935 100644 (file)
@@ -1,3 +1,18 @@
+2012-03-16  Zan Dobersek  <zandobersek@gmail.com>
+
+        [Gtk] Add computedStyleIncludingVisitedInfo to DumpRenderTreeSupport
+        https://bugs.webkit.org/show_bug.cgi?id=81232
+
+        Reviewed by Philippe Normand.
+
+        Add computedStyleIncludingVisitedInfo helper method to
+        DumpRenderTreeSupportGtk.
+
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+        (DumpRenderTreeSupportGtk::computedStyleIncludingVisitedInfo):
+        * WebCoreSupport/DumpRenderTreeSupportGtk.h:
+        (DumpRenderTreeSupportGtk):
+
 2012-03-16  Zan Dobersek  <zandobersek@gmail.com>
 
         [Gtk] Properly set forms tests-specific settings
index 42427db51b1add835bf34097a21b82c9dce74077..3f7363d3eea738e530e2a9020798e48fe259fa78 100644 (file)
@@ -26,6 +26,7 @@
 #include "AXObjectCache.h"
 #include "AccessibilityObject.h"
 #include "AnimationController.h"
+#include "CSSComputedStyleDeclaration.h"
 #include "DOMWrapperWorld.h"
 #include "Document.h"
 #include "EditorClientGtk.h"
@@ -41,6 +42,7 @@
 #include "GeolocationPosition.h"
 #include "GraphicsContext.h"
 #include "HTMLInputElement.h"
+#include "JSCSSStyleDeclaration.h"
 #include "JSDOMWindow.h"
 #include "JSDocument.h"
 #include "JSElement.h"
@@ -888,6 +890,22 @@ bool DumpRenderTreeSupportGtk::elementDoesAutoCompleteForElementWithId(WebKitWeb
     return inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->shouldAutocomplete();
 }
 
+JSValueRef DumpRenderTreeSupportGtk::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef nodeObject)
+{
+    JSC::ExecState* exec = toJS(context);
+    if (!nodeObject)
+        return JSValueMakeUndefined(context);
+
+    JSValue jsValue = toJS(exec, nodeObject);
+    if (!jsValue.inherits(&JSElement::s_info))
+        return JSValueMakeUndefined(context);
+
+    JSElement* jsElement = static_cast<JSElement*>(asObject(jsValue));
+    Element* element = jsElement->impl();
+    RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration::create(element, true);
+    return toRef(exec, toJS(exec, jsElement->globalObject(), style.get()));
+}
+
 void DumpRenderTreeSupportGtk::deliverAllMutationsIfNecessary()
 {
 #if ENABLE(MUTATION_OBSERVERS)
index 0c40927cb023df16ad06f9427f95552ea860f4b0..502ec4d841b2e79c85e8068d93e0d356bd8a1e26 100644 (file)
@@ -83,6 +83,7 @@ public:
     static void setValueForUser(JSContextRef, JSValueRef, JSStringRef);
     static bool shouldClose(WebKitWebFrame*);
     static bool elementDoesAutoCompleteForElementWithId(WebKitWebFrame*, JSStringRef);
+    static JSValueRef computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef);
 
     // WebKitWebView
     static void executeCoreCommandByName(WebKitWebView*, const gchar* name, const gchar* value);
index 8372236659579ae2a605f15717082ebe1f8127ae..ce2d72f52a2278770231afdd59f8deb68353e09e 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-16  Zan Dobersek  <zandobersek@gmail.com>
+
+        [Gtk] Add computedStyleIncludingVisitedInfo to DumpRenderTreeSupport
+        https://bugs.webkit.org/show_bug.cgi?id=81232
+
+        Reviewed by Philippe Normand.
+
+        Use the newly-added helper method in DumpRenderTreeSupportGtk.
+
+        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+        (LayoutTestController::computedStyleIncludingVisitedInfo):
+
 2012-03-15  Eric Seidel  <eric@webkit.org>
 
         Move parse_bug_id into config/urls in preparation for re-use elsewhere.
index 69d5d51b0b7bcd796a56c5ccae82818d809d9e83..06e456c07f1ba6346159049ac9eb3cd31f607957 100644 (file)
@@ -120,8 +120,7 @@ void LayoutTestController::keepWebHistory()
 
 JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value)
 {
-    // FIXME: Implement this.
-    return JSValueMakeUndefined(context);
+    return DumpRenderTreeSupportGtk::computedStyleIncludingVisitedInfo(context, value);
 }
 
 JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const