ShadowRoot with leading or trailing white space cause a crash
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Oct 2015 22:49:34 +0000 (22:49 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Oct 2015 22:49:34 +0000 (22:49 +0000)
commit7b9da2c345d2e25a5c15bb096364eadd443760d3
tree60fff2b1f7476757f6435a06e7622ef766ea71a1
parente1b60b34b35fd6d5bcd2e3cd22cd2e73514115ea
ShadowRoot with leading or trailing white space cause a crash
https://bugs.webkit.org/show_bug.cgi?id=149782

Reviewed by Chris Dumez.

Source/WebCore:

Fixed the crash by adding a null pointer check since a TextNode that appears as a direct child
of a ShadowRoot doesn't have a parent element.

Test: fast/shadow-dom/shadow-root-with-child-whitespace-text-crash.html

* style/RenderTreePosition.cpp:
(WebCore::RenderTreePosition::previousSiblingRenderer):

LayoutTests:

Added a regression test.

* fast/shadow-dom/shadow-root-with-child-whitespace-text-crash-expected.txt: Added.
* fast/shadow-dom/shadow-root-with-child-whitespace-text-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/shadow-dom/shadow-root-with-child-whitespace-text-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/shadow-dom/shadow-root-with-child-whitespace-text-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/style/RenderTreePosition.cpp