Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: LayoutTests/fast/dom/shadow/hover-active-drag-distributed-nodes.html

Issue 15932012: HitTestResult::innerElement should check its parent node for rendering and styling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/shadow/hover-active-drag-distributed-nodes-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/shadow/hover-active-drag-distributed-nodes.html
diff --git a/LayoutTests/fast/dom/shadow/hover-active-drag-distributed-nodes.html b/LayoutTests/fast/dom/shadow/hover-active-drag-distributed-nodes.html
new file mode 100644
index 0000000000000000000000000000000000000000..9153907aae33cdcdcfc2615bc2fd0b57a1146c84
--- /dev/null
+++ b/LayoutTests/fast/dom/shadow/hover-active-drag-distributed-nodes.html
@@ -0,0 +1,109 @@
+<!doctype html>
+<html>
+<head>
+<template id='template'>
+ <style>
+ div {
+ background-color: rgb(255, 0, 0);
+ }
+ div:hover {
+ background-color: rgb(0, 128, 0);
+ }
+ div:hover:active {
+ background-color: rgb(0, 255, 255);
+ }
+ div:active {
+ background-color: rgb(0, 0, 255);
+ }
+ </style>
+ <div id='div-in-shadow'>
+ <content></content>
+ </div>
+</template>
+<style>
+ span:hover {
+ color: rgb(0, 128, 0);
+ }
+ span:active:hover {
+ color: rgb(0, 255, 255);
+ }
+ span:active {
+ color: rgb(0, 0, 255);
+ }
+</style>
+</head>
+<body>
+ <div id='host'>Top-level text <span>Nested text</span></div>
+ <div id='other'>Other div</div>
+ <pre id='console'></pre>
+</body>
+
+<script src="../../js/resources/js-test-pre.js"></script>
+<script>
+var backgroundColor, textColor;
+
+function shouldHaveBackgroundColor(element, bg) {
+ backgroundColor = getComputedStyle(element, null).getPropertyValue("background-color")
+ shouldBeEqualToString('backgroundColor', bg)
+}
+
+function shouldHaveTextColor(element, col) {
+ textColor = getComputedStyle(element, null).getPropertyValue("color")
+ shouldBeEqualToString('textColor', col)
+}
+
+var host = document.getElementById('host');
+var shadowRoot = host.webkitCreateShadowRoot();
+var temp = document.getElementById('template');
+shadowRoot.appendChild(temp.content.cloneNode(true));
+var div = shadowRoot.querySelector('div');
+var span = host.querySelector(':scope > span');
+
+var divRect = div.getBoundingClientRect();
+var spanRect = span.getBoundingClientRect();
+var otherRect = document.getElementById('other').getBoundingClientRect();
+
+eventSender.dragMode = false;
+eventSender.mouseDown();
+eventSender.mouseUp();
+
+var posDivNotSpanX = parseInt((spanRect.right + divRect.right) / 2);
+var spanCenterPosX = parseInt((spanRect.left + spanRect.right) / 2);
+var spanCenterPosY = parseInt((spanRect.top + spanRect.bottom) / 2);
+var topTextPosX = parseInt((divRect.left + spanRect.left) / 2);
+var topTextPosY = spanCenterPosY;
+var otherPosX = parseInt((otherRect.left + otherRect.right) / 2);
+var otherPosY = parseInt((otherRect.top + otherRect.bottom) / 2);
+
+eventSender.mouseMoveTo(posDivNotSpanX, spanCenterPosY);
+shouldHaveBackgroundColor(div, 'rgb(0, 128, 0)');
+eventSender.mouseDown();
+shouldHaveBackgroundColor(div, 'rgb(0, 255, 255)');
+eventSender.mouseUp();
+shouldHaveBackgroundColor(div, 'rgb(0, 128, 0)');
+eventSender.mouseMoveTo(otherPosX, otherPosY);
+shouldHaveBackgroundColor(div, 'rgb(255, 0, 0)');
+
+eventSender.mouseMoveTo(spanCenterPosX, spanCenterPosY);
+shouldHaveBackgroundColor(div, 'rgb(0, 128, 0)');
+shouldHaveTextColor(span, 'rgb(0, 128, 0)');
+eventSender.mouseDown();
+shouldHaveBackgroundColor(div, 'rgb(0, 255, 255)');
+shouldHaveTextColor(span, 'rgb(0, 255, 255)');
+eventSender.mouseUp();
+shouldHaveBackgroundColor(div, 'rgb(0, 128, 0)');
+shouldHaveTextColor(span, 'rgb(0, 128, 0)');
+eventSender.mouseMoveTo(otherPosX, otherPosY);
+shouldHaveBackgroundColor(div, 'rgb(255, 0, 0)');
+shouldHaveTextColor(span, 'rgb(0, 0, 0)');
+
+eventSender.mouseMoveTo(topTextPosX, topTextPosY);
+shouldHaveBackgroundColor(div, 'rgb(0, 128, 0)');
+eventSender.mouseDown();
+shouldHaveBackgroundColor(div, 'rgb(0, 255, 255)');
+eventSender.mouseUp();
+shouldHaveBackgroundColor(div, 'rgb(0, 128, 0)');
+eventSender.mouseMoveTo(otherPosX, otherPosY);
+shouldHaveBackgroundColor(div, 'rgb(255, 0, 0)');
+</script>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/shadow/hover-active-drag-distributed-nodes-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698