Commit 20d93810 authored by tasak@google.com's avatar tasak@google.com
Browse files

[shadow] styleForText should consider the case where parent node has no style

https://bugs.webkit.org/show_bug.cgi?id=113275

Source/WebCore:

If a text node is distributed, its parent node for rendering and
styling might have no style. In the case, styleForText should return
default style.

Reviewed by Hajime Morrita.

Test: fast/dom/shadow/text-node-distributed-crash.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::styleForText):
Check whether a parent node has any style or not. If not, return
default style. This is the same behavior as styleForElement.

LayoutTests:

Reviewed by Hajime Morrita.

* fast/dom/shadow/text-node-distributed-crash-expected.txt: Added.
* fast/dom/shadow/text-node-distributed-crash.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5280dfdc
2013-03-26 Takashi Sakamoto <tasak@google.com>
[shadow] styleForText should consider the case where parent node has no style
https://bugs.webkit.org/show_bug.cgi?id=113275
Reviewed by Hajime Morrita.
* fast/dom/shadow/text-node-distributed-crash-expected.txt: Added.
* fast/dom/shadow/text-node-distributed-crash.html: Added.
2013-03-26 Yury Semikhatsky <yurys@chromium.org>
 
Unreviewed. Rebaseline fast/replaced/border-radius-clip-content-edge.html
<!doctype html>
<html>
<head>
<script src="resources/shadow-dom.js"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function runTest() {
document.body.appendChild(
createDOM('div', {'id': 'div1'},
createShadowRoot(document.createTextNode('-1910120134')),
createShadowRoot(createDOM('div', {'id': 'div2'},
createShadowRoot()),
createDOM('shadow', {}))));
document.body.offsetLeft;
getNodeInShadowTreeStack('div1//div2').appendChild(
createDOM('div', {'id': 'div3'},
createDOM('shadow', {})));
document.body.offsetLeft;
document.body.innerHTML = 'PASS';
}
</script>
</head>
<body onload="runTest()">
<!-- [bug 113275] styleForText should consider the case where parent -->
<!-- node has no style. -->
<!-- If this test passes, we can just see 'PASS' without any crash. -->
</body>
</html>
2013-03-26 Takashi Sakamoto <tasak@google.com>
[shadow] styleForText should consider the case where parent node has no style
https://bugs.webkit.org/show_bug.cgi?id=113275
If a text node is distributed, its parent node for rendering and
styling might have no style. In the case, styleForText should return
default style.
Reviewed by Hajime Morrita.
Test: fast/dom/shadow/text-node-distributed-crash.html
* css/StyleResolver.cpp:
(WebCore::StyleResolver::styleForText):
Check whether a parent node has any style or not. If not, return
default style. This is the same behavior as styleForElement.
2013-03-26 Takeshi Yoshino <tyoshino@chromium.org>
 
Make SocketStreamHandle (Chromium port) fully use IPC window in send()
......@@ -1272,7 +1272,7 @@ PassRefPtr<RenderStyle> StyleResolver::styleForText(Text* textNode)
NodeRenderingContext context(textNode);
Node* parentNode = context.parentNodeForRenderingAndStyle();
return context.resetStyleInheritance() || !parentNode ?
return context.resetStyleInheritance() || !parentNode || !parentNode->renderStyle() ?
defaultStyleForElement() : parentNode->renderStyle();
}
......
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