Modified: trunk/LayoutTests/ChangeLog (139196 => 139197)
--- trunk/LayoutTests/ChangeLog 2013-01-09 17:00:45 UTC (rev 139196)
+++ trunk/LayoutTests/ChangeLog 2013-01-09 17:29:11 UTC (rev 139197)
@@ -1,3 +1,18 @@
+2013-01-09 Zoltan Horvath <zol...@webkit.org>
+
+ [CSS Regions] Selecting text through nested regions causes weird and unclearable selection
+ https://bugs.webkit.org/show_bug.cgi?id=105641
+
+ Reviewed by David Hyatt.
+
+ If you have a region with a nested region inside what is rendered below the base region and you are trying select text
+ starting from the base region and ending it in the nested region, firstly you got a weird selection, secondly you can't
+ clear the selection. We could prevent this strange behavior by preventing the selection through different region flows.
+
+ * fast/regions/selecting-text-through-different-region-flows-expected.txt: Added.
+ * fast/regions/selecting-text-through-different-region-flows.html: Added.
+ * platform/chromium-mac/fast/regions/selecting-text-through-different-region-flows-expected.png: Added.
+
2013-01-09 Florin Malita <fmal...@chromium.org>
[Skia] Implement GraphicsContext::fillRoundedRect() using SkCanvas::drawRRect()
Added: trunk/LayoutTests/fast/regions/selecting-text-through-different-region-flows-expected.txt (0 => 139197)
--- trunk/LayoutTests/fast/regions/selecting-text-through-different-region-flows-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/regions/selecting-text-through-different-region-flows-expected.txt 2013-01-09 17:29:11 UTC (rev 139197)
@@ -0,0 +1,63 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 3 of DIV > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 14 of #text > DIV > DIV > BODY > HTML > #document to 14 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 14 of #text > DIV > DIV > BODY > HTML > #document to 14 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 177 of #text > SPAN > SPAN > DIV > DIV > BODY > HTML > #document to 14 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 3 of DIV > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of H1 > DIV > BODY > HTML > #document to 0 of H1 > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x218
+ RenderBlock {HTML} at (0,0) size 800x218
+ RenderBody {BODY} at (8,8) size 600x202
+ RenderRegion {DIV} at (0,0) size 600x177
+ RenderRegion {DIV} at (0,176) size 600x26
+Flow Threads
+ Thread with flow-name 'content'
+ layer at (0,0) size 600x177
+ RenderNamedFlowThread at (0,0) size 600x177
+ RenderBlock {DIV} at (0,21) size 600x156 [border: none (1px solid #000000) none]
+ RenderBlock {H1} at (0,0) size 600x74
+ RenderText {#text} at (0,0) size 508x74
+ text run at (0,0) width 508: "Selecting text through different CSS-"
+ text run at (0,37) width 175: "Region flows"
+ RenderBlock {DIV} at (0,95) size 600x55
+ RenderText {#text} at (0,0) size 513x18
+ text run at (0,0) width 513: "This text contains a footnote as a nested region what is diplayed below the article."
+ RenderInline {SPAN} at (0,0) size 8x14
+ RenderText {#text} at (518,3) size 3x14
+ text run at (518,3) width 3: " "
+ RenderText {#text} at (521,0) size 593x54
+ text run at (521,0) width 68: "If you start"
+ text run at (589,0) width 4: " "
+ text run at (0,18) width 59: "selecting "
+ text run at (59,18) width 523: "text from this article until somewhere in the footnote and then click somewhere, the"
+ text run at (582,18) width 4: " "
+ text run at (0,36) width 173: "selection should be cleared."
+ layer at (0,112) size 5x13
+ RenderInline (relative positioned) at (0,0) size 5x13
+ RenderCounter at (513,4) size 5x13
+ text run at (513,4) width 5: "1"
+ Regions for flow 'content'
+ RenderRegion {DIV} #region hasAutoLogicalHeight
+ Thread with flow-name 'footNote'
+ layer at (0,0) size 600x25
+ RenderNamedFlowThread at (0,0) size 600x25
+ RenderBlock {SPAN} at (0,0) size 600x25
+ RenderInline {SPAN} at (0,0) size 5x14
+ RenderText {#text} at (5,-1) size 597x27
+ text run at (5,-1) width 438: "This is a footnote. Footnotes can be quite long and go over several lines. This footnote "
+ text run at (443,-1) width 151: "is nested inside the text above"
+ text run at (594,-1) width 3: " "
+ text run at (0,12) width 242: "and displayed here with the help of css-regions."
+ layer at (0,-5) size 5x13 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600 outlineClip at (0,0) size 800x600
+ RenderInline (relative positioned) at (0,0) size 5x13
+ RenderCounter at (0,0) size 5x13
+ text run at (0,0) width 5: "1"
+ Regions for flow 'footNote'
+ RenderRegion {DIV} #footNoteRegion hasAutoLogicalHeight
+caret: position 0 of child 0 {#text} of child 1 {H1} of child 5 {DIV} of body
Added: trunk/LayoutTests/fast/regions/selecting-text-through-different-region-flows.html (0 => 139197)
--- trunk/LayoutTests/fast/regions/selecting-text-through-different-region-flows.html (rev 0)
+++ trunk/LayoutTests/fast/regions/selecting-text-through-different-region-flows.html 2013-01-09 17:29:11 UTC (rev 139197)
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpEditingCallbacks();
+</script>
+<style>
+body { width: 600px; }
+
+#footNote > * {
+ -webkit-flow-into: footNote;
+ display: block;
+}
+#footNoteRegion { -webkit-flow-from: footNote; }
+
+#content {
+ -webkit-flow-into: content;
+ border-bottom: 1px solid black;
+ padding-bottom: 5px;
+}
+
+#region { -webkit-flow-from: content; }
+
+#footNote::before {
+ counter-increment: footnote-reference;
+ content: counter(footnote-reference);
+}
+
+#footNote > * > *:first-child::before {
+ counter-increment: footnote;
+ content: counter(footnote);
+}
+
+#footNote > * > *::before, #footNote::before {
+ position: relative;
+ top: -0.5em;
+ font-size: 80%;
+}
+
+#footNote {
+ font-size: 12px;
+ line-height: 1em;
+ font-weight: bold;
+}
+</style>
+</head>
+<body>
+<div id="region"></div>
+<div id="footNoteRegion"></div>
+
+<div id="content">
+ <h1>Selecting text through different CSS-Region flows</h1>
+ <div contenteditable="true" id="contentText">
+ This text contains a footnote as a nested region what is diplayed below the article.<span id="footNote">
+ <span><span></span>This is a footnote. Footnotes can be quite long and go over several lines. This footnote
+ is nested inside the text above and displayed here with the help of css-regions.</span></span> If you start selecting
+ text from this article until somewhere in the footnote and then click somewhere, the selection should be cleared.
+ </div>
+</div>
+<script>
+if (window.testRunner) {
+ // We are positioning the mouse to the center of the contentText and start holding the mouse down
+ var start = document.getElementById("contentText");
+ var xStartPosition = start.offsetLeft + 10;
+ var yStartPosition = start.offsetTop + start.offsetHeight / 2;
+ eventSender.mouseMoveTo(xStartPosition, yStartPosition);
+ eventSender.mouseDown();
+
+ // We are posotioning the mouse to the center of the footNote (what is a different region flow) and release the button
+ var end = document.getElementById("footNoteRegion");
+ var xEndPosition = end.offsetLeft + end.offsetWidth / 2;
+ var yEndPosition = end.offsetTop + end.offsetHeight / 2;
+ eventSender.mouseMoveTo(xEndPosition, yEndPosition);
+ eventSender.mouseUp();
+
+ // We are moving the mouse somewhere else and click to clear the selection
+ eventSender.mouseMoveTo(1, 1);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (139196 => 139197)
--- trunk/Source/WebCore/ChangeLog 2013-01-09 17:00:45 UTC (rev 139196)
+++ trunk/Source/WebCore/ChangeLog 2013-01-09 17:29:11 UTC (rev 139197)
@@ -1,3 +1,19 @@
+2013-01-09 Zoltan Horvath <zol...@webkit.org>
+
+ [CSS Regions] Selecting text through nested regions causes weird and unclearable selection
+ https://bugs.webkit.org/show_bug.cgi?id=105641
+
+ Reviewed by David Hyatt.
+
+ If you have a region with a nested region inside what is rendered below the base region and you are trying select text
+ starting from the base region and ending it in the nested region, firstly you got a weird selection, secondly you can't
+ clear the selection. We could prevent this strange behavior by preventing the selection through different region flows.
+
+ Test: fast/regions/selecting-text-through-different-region-flows.html
+
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::setSelection): Don't allow selection when trying to select different region flows.
+
2013-01-09 Hugo Parente Lima <hugo.l...@openbossa.org>
Regression(r138681) : Add HAVE(ACCESSIBILITY) guard to atk files, fix for a fix.
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (139196 => 139197)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2013-01-09 17:00:45 UTC (rev 139196)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2013-01-09 17:29:11 UTC (rev 139197)
@@ -572,6 +572,9 @@
m_selectionEnd == end && m_selectionEndPos == endPos)
return;
+ if ((start && end) && (start->enclosingRenderFlowThread() != end->enclosingRenderFlowThread()))
+ return;
+
// Record the old selected objects. These will be used later
// when we compare against the new selected objects.
int oldStartPos = m_selectionStartPos;