- Revision
- 150881
- Author
- [email protected]
- Date
- 2013-05-29 03:57:07 -0700 (Wed, 29 May 2013)
Log Message
[CSS Regions] Content that has overflow: scroll cannot be scrolled by dragging the scroll thumbs with the mouse
https://bugs.webkit.org/show_bug.cgi?id=113703
Patch by Mihai Maerean <[email protected]> on 2013-05-29
Reviewed by Darin Adler.
Source/WebCore:
The point inside a box that's inside a region has its coordinates relative to the region, not the FlowThread
that is its container in the RenderObject tree.
Previously, the coordinates were computed relatively to the FlowThread which doesn't really have a location in
the page.
Tests: fast/regions/drag-scrollbars-of-content.html
fast/regions/hover-in-second-region.html
* rendering/RenderBox.cpp:
(WebCore::RenderBox::offsetFromContainer):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::mapAbsoluteToLocalPoint):
LayoutTests:
* fast/regions/drag-scrollbars-of-content-expected.html: Added.
* fast/regions/drag-scrollbars-of-content.html: Added.
* fast/regions/hover-in-second-region-expected.html: Added.
* fast/regions/hover-in-second-region.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (150880 => 150881)
--- trunk/LayoutTests/ChangeLog 2013-05-29 10:20:40 UTC (rev 150880)
+++ trunk/LayoutTests/ChangeLog 2013-05-29 10:57:07 UTC (rev 150881)
@@ -1,3 +1,15 @@
+2013-05-29 Mihai Maerean <[email protected]>
+
+ [CSS Regions] Content that has overflow: scroll cannot be scrolled by dragging the scroll thumbs with the mouse
+ https://bugs.webkit.org/show_bug.cgi?id=113703
+
+ Reviewed by Darin Adler.
+
+ * fast/regions/drag-scrollbars-of-content-expected.html: Added.
+ * fast/regions/drag-scrollbars-of-content.html: Added.
+ * fast/regions/hover-in-second-region-expected.html: Added.
+ * fast/regions/hover-in-second-region.html: Added.
+
2013-05-29 Kent Tamura <[email protected]>
Remove ENABLE_INPUT_MULTIPLE_FIELDS_UI.
Added: trunk/LayoutTests/fast/regions/drag-scrollbars-of-content-expected.html (0 => 150881)
--- trunk/LayoutTests/fast/regions/drag-scrollbars-of-content-expected.html (rev 0)
+++ trunk/LayoutTests/fast/regions/drag-scrollbars-of-content-expected.html 2013-05-29 10:57:07 UTC (rev 150881)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>drag the scrollbars of content flowed in regions</title>
+ <style type="text/css">
+ .content {
+ width: 100px;
+ height: 100px;
+ overflow-y: scroll;
+ overflow-x: none;
+ font-size: 20px;
+ line-height: 1em;
+ padding: 0.5em;
+ border: solid 1px #888;
+ }
+ #region {
+ width: 200px;
+ height: 200px;
+ margin: 20px;
+ background-color: rgb(241, 241, 241);
+ }
+ </style>
+ <script type="text/_javascript_">
+ function myOnLoad() {
+ if(!window.testRunner)
+ return;
+ var scrollable = document.querySelector('.content');
+ var scrollBox = scrollable.getBoundingClientRect();
+ var X = scrollBox.right - 3;
+ var Y = scrollBox.bottom - 3;
+
+ eventSender.mouseMoveTo(X, Y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+ </script>
+ </head>
+ <body _onload_="myOnLoad();">
+ <div id="region">
+ <div class="content">1xxxxx<br>2xxxxx<br>3xxxxx<br>4xxxxx<br>5xxxxx<br>6xxxxx<br>7xxxxx<br>8xxxxx</div>
+ </div>
+ <div>You should be able to drag the scrollbars</div>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/regions/drag-scrollbars-of-content.html (0 => 150881)
--- trunk/LayoutTests/fast/regions/drag-scrollbars-of-content.html (rev 0)
+++ trunk/LayoutTests/fast/regions/drag-scrollbars-of-content.html 2013-05-29 10:57:07 UTC (rev 150881)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>drag the scrollbars of content flowed in regions</title>
+ <style type="text/css">
+ .content {
+ width: 100px;
+ height: 100px;
+ overflow-y: scroll;
+ overflow-x: none;
+ font-size: 20px;
+ line-height: 1em;
+ padding: 0.5em;
+ border: solid 1px #888;
+ -webkit-flow-into: f;
+ }
+ #region {
+ width: 200px;
+ height: 200px;
+ margin: 20px;
+ background-color: rgb(241, 241, 241);
+ -webkit-flow-from: f;
+ }
+ </style>
+ <script type="text/_javascript_">
+ function myOnLoad() {
+ if(!window.testRunner)
+ return;
+ var scrollable = document.querySelector('.content');
+ var scrollBox = scrollable.getBoundingClientRect();
+ var X = scrollBox.right - 3;
+ var Y = scrollBox.bottom - 3;
+
+ eventSender.mouseMoveTo(X, Y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+ </script>
+ </head>
+ <body _onload_="myOnLoad();">
+ <div class="content">1xxxxx<br>2xxxxx<br>3xxxxx<br>4xxxxx<br>5xxxxx<br>6xxxxx<br>7xxxxx<br>8xxxxx</div>
+ <div id="region"></div>
+ <div>You should be able to drag the scrollbars</div>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/regions/hover-in-second-region-expected.html (0 => 150881)
--- trunk/LayoutTests/fast/regions/hover-in-second-region-expected.html (rev 0)
+++ trunk/LayoutTests/fast/regions/hover-in-second-region-expected.html 2013-05-29 10:57:07 UTC (rev 150881)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>hover effect on a link in the 2nd region</title>
+ <style type="text/css">
+ .content {
+ font-size: 20px;
+ }
+ .content a:hover {
+ color:Red;
+ }
+ #region {
+ width: 100px;
+ height: 100px;
+ background-color: rgb(241, 241, 241);
+ border: solid 1px #888;
+ margin: 10px;
+ }
+ </style>
+ <script type="text/_javascript_">
+ function myOnLoad() {
+ if(!window.testRunner)
+ return;
+
+ var element = document.querySelector('.content a');
+ var box = element.getBoundingClientRect();
+ var X = (box.right + box.left) / 2;
+ var Y = (box.top + box.bottom) / 2;
+
+ eventSender.mouseMoveTo(X, Y);
+ }
+ </script>
+ </head>
+ <body _onload_="myOnLoad();">
+ <div id="region"><div class="content">1xxxxx<br>2xxxxx<br>3xxxxx<br>4xxxxx</div></div>
+ <div id="region"><div class="content">5xxxxx<br>6xxxxx<br><a href=""
+ <div id="region"><div class="content">9xxxxx<br>10xxxxx<br>11xxxxx</div></div>
+ <div>hover effect on a link in the 2nd region</div>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/regions/hover-in-second-region.html (0 => 150881)
--- trunk/LayoutTests/fast/regions/hover-in-second-region.html (rev 0)
+++ trunk/LayoutTests/fast/regions/hover-in-second-region.html 2013-05-29 10:57:07 UTC (rev 150881)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>hover effect on a link in the 2nd region</title>
+ <style type="text/css">
+ .content {
+ font-size: 20px;
+ -webkit-flow-into: f;
+ }
+ .content a:hover {
+ color:Red;
+ }
+ #region {
+ width: 100px;
+ height: 100px;
+ background-color: rgb(241, 241, 241);
+ border: solid 1px #888;
+ margin: 10px;
+ -webkit-flow-from: f;
+ }
+ </style>
+ <script type="text/_javascript_">
+ function myOnLoad() {
+ if(!window.testRunner)
+ return;
+
+ var element = document.querySelector('.content a');
+ var box = element.getBoundingClientRect();
+ var X = (box.right + box.left) / 2;
+ var Y = (box.top + box.bottom) / 2;
+
+ eventSender.mouseMoveTo(X, Y);
+ }
+ </script>
+ </head>
+ <body _onload_="myOnLoad();">
+ <div class="content">1xxxxx<br>2xxxxx<br>3xxxxx<br>4xxxxx<br>5xxxxx<br>6xxxxx<br><a href=""
+ <div id="region"></div>
+ <div id="region"></div>
+ <div id="region"></div>
+ <div>hover effect on a link in the 2nd region</div>
+ </body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (150880 => 150881)
--- trunk/Source/WebCore/ChangeLog 2013-05-29 10:20:40 UTC (rev 150880)
+++ trunk/Source/WebCore/ChangeLog 2013-05-29 10:57:07 UTC (rev 150881)
@@ -1,3 +1,24 @@
+2013-05-29 Mihai Maerean <[email protected]>
+
+ [CSS Regions] Content that has overflow: scroll cannot be scrolled by dragging the scroll thumbs with the mouse
+ https://bugs.webkit.org/show_bug.cgi?id=113703
+
+ Reviewed by Darin Adler.
+
+ The point inside a box that's inside a region has its coordinates relative to the region, not the FlowThread
+ that is its container in the RenderObject tree.
+
+ Previously, the coordinates were computed relatively to the FlowThread which doesn't really have a location in
+ the page.
+
+ Tests: fast/regions/drag-scrollbars-of-content.html
+ fast/regions/hover-in-second-region.html
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::offsetFromContainer):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::mapAbsoluteToLocalPoint):
+
2013-05-29 Andreas Kling <[email protected]>
Fix dumb typo in r150879.
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (150880 => 150881)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2013-05-29 10:20:40 UTC (rev 150880)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2013-05-29 10:57:07 UTC (rev 150881)
@@ -1826,7 +1826,8 @@
LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& point, bool* offsetDependsOnPoint) const
{
- ASSERT(o == container());
+ // A region "has" boxes inside it without being their container.
+ ASSERT(o == container() || o->isRenderRegion());
LayoutSize offset;
if (hasPaintOffset())
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (150880 => 150881)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2013-05-29 10:20:40 UTC (rev 150880)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2013-05-29 10:57:07 UTC (rev 150881)
@@ -2853,6 +2853,18 @@
if (!o)
return;
+ // The point inside a box that's inside a region has its coordinates relative to the region,
+ // not the FlowThread that is its container in the RenderObject tree.
+ if (o->isRenderFlowThread() && isRenderBlock()) {
+ // FIXME (CSSREGIONS): switch to Box instead of Block when we'll have range information
+ // for boxes as well, not just for blocks.
+ RenderRegion* startRegion;
+ RenderRegion* endRegion;
+ toRenderFlowThread(o)->getRegionRangeForBox(toRenderBlock(this), startRegion, endRegion);
+ if (startRegion)
+ o = startRegion;
+ }
+
o->mapAbsoluteToLocalPoint(mode, transformState);
LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint());