Title: [139739] trunk
- Revision
- 139739
- Author
- commit-qu...@webkit.org
- Date
- 2013-01-15 07:42:55 -0800 (Tue, 15 Jan 2013)
Log Message
display:inline's hover behavior is not applied to ::before and ::after pseudo elements
https://bugs.webkit.org/show_bug.cgi?id=91723
Patch by Elliott Sprehn <espr...@gmail.com> on 2013-01-15
Reviewed by Eric Seidel.
Source/WebCore:
When hovering over the anonymous text renderers inside :before and :after
we would correctly detect a hit in InlineTextBox::nodeAtPoint, but would
then fail to set the correct node for the hit test because in
RenderObject::updateHitTestResult node() is null. Instead we should walk
up the render tree to the PseudoElement and treat it as if we hit that.
Test: fast/css-generated-content/hover-inline.html
* rendering/RenderObject.cpp:
(WebCore::RenderObject::updateHitTestResult):
LayoutTests:
Add a test that hovering generated content inside an inline element causes
the element to become hovered.
* fast/css-generated-content/hover-inline-expected.txt: Added.
* fast/css-generated-content/hover-inline.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (139738 => 139739)
--- trunk/LayoutTests/ChangeLog 2013-01-15 15:41:34 UTC (rev 139738)
+++ trunk/LayoutTests/ChangeLog 2013-01-15 15:42:55 UTC (rev 139739)
@@ -1,3 +1,16 @@
+2013-01-15 Elliott Sprehn <espr...@gmail.com>
+
+ display:inline's hover behavior is not applied to ::before and ::after pseudo elements
+ https://bugs.webkit.org/show_bug.cgi?id=91723
+
+ Reviewed by Eric Seidel.
+
+ Add a test that hovering generated content inside an inline element causes
+ the element to become hovered.
+
+ * fast/css-generated-content/hover-inline-expected.txt: Added.
+ * fast/css-generated-content/hover-inline.html: Added.
+
2013-01-15 Dima Gorbik <dgor...@apple.com>
[Chromium] media/track/track-css-cue-lifetime.html Win7 dbg times out since r139562
Added: trunk/LayoutTests/fast/css-generated-content/hover-inline-expected.txt (0 => 139739)
--- trunk/LayoutTests/fast/css-generated-content/hover-inline-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/hover-inline-expected.txt 2013-01-15 15:42:55 UTC (rev 139739)
@@ -0,0 +1,2 @@
+Hovering the generated text should hover the span:
+PASS
Added: trunk/LayoutTests/fast/css-generated-content/hover-inline.html (0 => 139739)
--- trunk/LayoutTests/fast/css-generated-content/hover-inline.html (rev 0)
+++ trunk/LayoutTests/fast/css-generated-content/hover-inline.html 2013-01-15 15:42:55 UTC (rev 139739)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+
+<style>
+ * { margin: 0; padding: 0; }
+ span:before { content: "Hover this text."; }
+</style>
+
+<span></span>
+
+<p>Hovering the generated text should hover the span: </p>
+
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+_onload_ = function() {
+ // Need to cause a layout before hover will work.
+ document.body.offsetLeft;
+ document.querySelector('span')._onmouseover_ = function() {
+ document.body.appendChild(document.createElement('p')).textContent = 'PASS';
+ };
+ if (window.eventSender)
+ eventSender.mouseMoveTo(5, 5);
+}
+</script>
Modified: trunk/Source/WebCore/ChangeLog (139738 => 139739)
--- trunk/Source/WebCore/ChangeLog 2013-01-15 15:41:34 UTC (rev 139738)
+++ trunk/Source/WebCore/ChangeLog 2013-01-15 15:42:55 UTC (rev 139739)
@@ -1,3 +1,21 @@
+2013-01-15 Elliott Sprehn <espr...@gmail.com>
+
+ display:inline's hover behavior is not applied to ::before and ::after pseudo elements
+ https://bugs.webkit.org/show_bug.cgi?id=91723
+
+ Reviewed by Eric Seidel.
+
+ When hovering over the anonymous text renderers inside :before and :after
+ we would correctly detect a hit in InlineTextBox::nodeAtPoint, but would
+ then fail to set the correct node for the hit test because in
+ RenderObject::updateHitTestResult node() is null. Instead we should walk
+ up the render tree to the PseudoElement and treat it as if we hit that.
+
+ Test: fast/css-generated-content/hover-inline.html
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::updateHitTestResult):
+
2013-01-15 Zeno Albisser <z...@webkit.org>
GraphicsSurface: Canvas with WebGL content is painted off by one pixel
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (139738 => 139739)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2013-01-15 15:41:34 UTC (rev 139738)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2013-01-15 15:42:55 UTC (rev 139739)
@@ -2626,11 +2626,19 @@
if (result.innerNode())
return;
- Node* n = node();
- if (n) {
- result.setInnerNode(n);
+ Node* node = this->node();
+
+ // If we hit the anonymous renderers inside generated content we should
+ // actually hit the generated content so walk up to the PseudoElement.
+ if (!node && parent() && parent()->isBeforeOrAfterContent()) {
+ for (RenderObject* renderer = parent(); renderer && !node; renderer = renderer->parent())
+ node = renderer->node();
+ }
+
+ if (node) {
+ result.setInnerNode(node);
if (!result.innerNonSharedNode())
- result.setInnerNonSharedNode(n);
+ result.setInnerNonSharedNode(node);
result.setLocalPoint(point);
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes