Commit 3ba18e88 authored by jamesr@google.com's avatar jamesr@google.com

2010-05-20 James Robinson <jamesr@chromium.org>

        Reviewed by Eric Seidel.

        Ensures styles are up-to-date before determining selection
        https://bugs.webkit.org/show_bug.cgi?id=39389

        This adds a call to document::updateStyleIfNeeded() to
        Frame::notifyRendererOfSelectionChange(). Without this call, if there
        is a pending style update that will detach part of the DOM and the
        the selection is within that part of the DOM when
        notifyRendererOfSeletionChange is called, the rootEditableElement
        algorithm ends up walking through detached parts of the render tree.

        Test: editing/selection/focus-and-display-none.html

        * page/Frame.cpp:
        (WebCore::Frame::notifyRendererOfSelectionChange):
2010-05-20  James Robinson  <jamesr@chromium.org>

        Reviewed by Eric Seidel.

        Tests putting focus into a textarea and setting display:none
        https://bugs.webkit.org/show_bug.cgi?id=39389

        * editing/selection/focus-and-display-none-expected.txt: Added.
        * editing/selection/focus-and-display-none.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@59856 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f86100ad
2010-05-20 James Robinson <jamesr@chromium.org>
Reviewed by Eric Seidel.
Tests putting focus into a textarea and setting display:none
https://bugs.webkit.org/show_bug.cgi?id=39389
* editing/selection/focus-and-display-none-expected.txt: Added.
* editing/selection/focus-and-display-none.html: Added.
2010-05-20 Martin Robinson <mrobinson@igalia.com>
Reviewed by Ojan Vafai.
Click me
To run manually, click the 'Click me' text. Test passes if it does not crash.
<!DOCTYPE html>
<html>
<body onload="runTest()">
<script>
function focusAndSetDisplayNone() {
var ta = document.getElementById("ta");
ta.focus();
ta.style.display = "none";
}
function getPositionOfNode(id)
{
var n = document.getElementById(id);
var pos = {x: 0, y: 0};
while (n) {
pos.x += n.offsetLeft + n.clientLeft;
pos.y += n.offsetTop + n.clientTop;
n = n.offsetParent;
}
return pos;
}
function runTest() {
if (window.layoutTestController) {
layoutTestController.dumpAsText()
var pos = getPositionOfNode("clickTarget");
// Repeat the test for better reproducability
var i;
for (i=0; i<10; ++i) {
document.getElementById("ta").style.display="";
eventSender.mouseMoveTo(pos.x + 5, pos.y + 5);
eventSender.mouseDown();
eventSender.mouseUp();
}
}
}
</script>
<textarea id="ta">a</textarea>
<span onclick="focusAndSetDisplayNone()" id="clickTarget">Click me</span><br>
To run manually, click the 'Click me' text. Test passes if it does not crash.
</body>
</html>
2010-05-20 James Robinson <jamesr@chromium.org>
Reviewed by Eric Seidel.
Ensures styles are up-to-date before determining selection
https://bugs.webkit.org/show_bug.cgi?id=39389
This adds a call to document::updateStyleIfNeeded() to
Frame::notifyRendererOfSelectionChange(). Without this call, if there
is a pending style update that will detach part of the DOM and the
the selection is within that part of the DOM when
notifyRendererOfSeletionChange is called, the rootEditableElement
algorithm ends up walking through detached parts of the render tree.
Test: editing/selection/focus-and-display-none.html
* page/Frame.cpp:
(WebCore::Frame::notifyRendererOfSelectionChange):
2010-05-20 Adam Roben <aroben@apple.com>
Remove code that fetched, but did nothing useful with, a CFDictionary
......@@ -532,6 +532,9 @@ String Frame::matchLabelsAgainstElement(const Vector<String>& labels, Element* e
void Frame::notifyRendererOfSelectionChange(bool userTriggered)
{
RenderObject* renderer = 0;
document()->updateStyleIfNeeded();
if (selection()->rootEditableElement())
renderer = selection()->rootEditableElement()->shadowAncestorNode()->renderer();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment