WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-82429-20120330165511.patch (text/plain), 6.86 KB, created by
Shinya Kawanaka
on 2012-03-30 00:55:12 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Shinya Kawanaka
Created:
2012-03-30 00:55:12 PDT
Size:
6.86 KB
patch
obsolete
>Subversion Revision: 112634 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d80aa3646bddff49953cfcef6243dd17b979c8cc..041ed10a5e0b701cf4e470a7fbe7aa6159a1f0cf 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2012-03-30 Shinya Kawanaka <shinyak@chromium.org> >+ >+ ShadowRoot should have selection attribute. >+ https://bugs.webkit.org/show_bug.cgi?id=82429 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch makes ShadowRoot have selection attribute. Currently the selection returns >+ the same object as what window.getSelection() returns. We will fix this behavior in Bug 82698. >+ >+ Test: fast/dom/shadow/selection-in-shadow.html >+ >+ * dom/ShadowRoot.cpp: >+ (WebCore::ShadowRoot::selection): >+ (WebCore): >+ * dom/ShadowRoot.h: >+ (WebCore): >+ (ShadowRoot): >+ * dom/ShadowRoot.idl: >+ > 2012-03-29 Adam Barth <abarth@webkit.org> > > Unreviewed, rolling out r112572. >diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp >index da215edcc3e1071c702d97d057d4c2529f29ad4a..e750bc22b44db75a7ee496be9941bbe9f8423ea5 100644 >--- a/Source/WebCore/dom/ShadowRoot.cpp >+++ b/Source/WebCore/dom/ShadowRoot.cpp >@@ -28,6 +28,8 @@ > #include "ShadowRoot.h" > > #include "CSSStyleSelector.h" >+#include "DOMSelection.h" >+#include "DOMWindow.h" > #include "Document.h" > #include "DocumentFragment.h" > #include "Element.h" >@@ -147,6 +149,13 @@ void ShadowRoot::setInnerHTML(const String& markup, ExceptionCode& ec) > replaceChildrenWithFragment(this, fragment.release(), ec); > } > >+DOMSelection* ShadowRoot::selection() >+{ >+ if (document() && document()->domWindow()) >+ return document()->domWindow()->getSelection(); >+ return 0; >+} >+ > bool ShadowRoot::childTypeAllowed(NodeType type) const > { > switch (type) { >diff --git a/Source/WebCore/dom/ShadowRoot.h b/Source/WebCore/dom/ShadowRoot.h >index 58b48c64b5b8953a9a2a29ad8fbb4ee3c4104c2b..f095ff4c56a79ffc29c54976b177907b9a7097aa 100644 >--- a/Source/WebCore/dom/ShadowRoot.h >+++ b/Source/WebCore/dom/ShadowRoot.h >@@ -37,6 +37,7 @@ > namespace WebCore { > > class Document; >+class DOMSelection; > class HTMLContentElement; > class HTMLContentSelector; > class InsertionPoint; >@@ -77,6 +78,8 @@ public: > > Element* activeElement() const; > >+ DOMSelection* selection(); >+ > ShadowRoot* youngerShadowRoot() const { return prev(); } > ShadowRoot* olderShadowRoot() const { return next(); } > >diff --git a/Source/WebCore/dom/ShadowRoot.idl b/Source/WebCore/dom/ShadowRoot.idl >index e9e8b1b40f2cea3ad812d1fba3cbc9d3b93c9382..5ee5663329f6a7606a46415150416ec082e700a2 100644 >--- a/Source/WebCore/dom/ShadowRoot.idl >+++ b/Source/WebCore/dom/ShadowRoot.idl >@@ -34,6 +34,7 @@ module core { > ] ShadowRoot : DocumentFragment { > readonly attribute Element host; > readonly attribute Element activeElement; >+ readonly attribute DOMSelection selection; > > attribute [TreatNullAs=NullString] DOMString innerHTML > setter raises(DOMException); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 0b251d62d0cd074aaea65b764e05fd101bdad0e2..86b67ffa948c5c8f9fc930f2ccfe396d5c6dcae6 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2012-03-30 Shinya Kawanaka <shinyak@chromium.org> >+ >+ ShadowRoot should have selection attribute. >+ https://bugs.webkit.org/show_bug.cgi?id=82429 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Checks ShadowRoot.selection returns the same selection as what window.getSelection() returns. >+ >+ * fast/dom/shadow/selection-in-shadow.html: Added. >+ > 2012-03-29 Bear Travis <betravis@adobe.com> > > Update shape-inside/shape-outside CSS Exclusion properties >diff --git a/LayoutTests/fast/dom/shadow/selection-in-shadow.html b/LayoutTests/fast/dom/shadow/selection-in-shadow.html >new file mode 100644 >index 0000000000000000000000000000000000000000..9707c97a712c8608786a71dde351aa468e71f8f0 >--- /dev/null >+++ b/LayoutTests/fast/dom/shadow/selection-in-shadow.html >@@ -0,0 +1,78 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../js/resources/js-test-pre.js"></script> >+<script src="resources/polyfill.js"></script> >+</head> >+<body> >+ >+<div id="container"></div> >+ >+<script> >+function moveTo(element) { >+ var x = element.offsetLeft + element.offsetWidth / 2; >+ var y = element.offsetTop + element.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+} >+ >+function dragFromTo(elementFrom, elementTo) { >+ moveTo(elementFrom); >+ eventSender.mouseDown(); >+ moveTo(elementTo); >+ eventSender.mouseUp(); >+} >+ >+var container = document.getElementById('container'); >+ >+var shadowRoot1 = new WebKitShadowRoot(container); >+shadowRoot1.innerHTML = >+ '<div id="div1" title="div1">DIV1</div>' + >+ '<div id="div2" title="div2">DIV2</div>' + >+ '<div id="div3" title="div3">DIV3</div>'; >+var div1 = shadowRoot1.getElementById('div1'); >+var div2 = shadowRoot1.getElementById('div2'); >+var div3 = shadowRoot1.getElementById('div3'); >+ >+var shadowRoot2 = new WebKitShadowRoot(div2); >+shadowRoot2.innerHTML = >+ '<div id="div4" title="div4">DIV4</div>' + >+ '<div id="div5" title="div5">DIV5</div>' + >+ '<div id="div6" title="div6">DIV6</div>'; >+var div4 = shadowRoot2.getElementById('div4'); >+var div5 = shadowRoot2.getElementById('div5'); >+var div6 = shadowRoot2.getElementById('div6'); >+ >+var shadowRoot3 = new WebKitShadowRoot(div5); >+shadowRoot3.innerHTML = >+ '<div id="div7" title="div7">DIV7</div>' + >+ '<div id="div8" title="div8">DIV8</div>' + >+ '<div id="div9" title="div9">DIV9</div>'; >+var div7 = shadowRoot3.getElementById('div7'); >+var div8 = shadowRoot3.getElementById('div8'); >+var div9 = shadowRoot3.getElementById('div9'); >+ >+ >+dragFromTo(div4, div6); >+var selectionFromWindow = window.getSelection(); >+var selectionFromShadowRoot1 = shadowRoot1.selection; >+var selectionFromShadowRoot2 = shadowRoot2.selection; >+var selectionFromShadowRoot3 = shadowRoot3.selection; >+ >+// Since there are these bugs, shadowRoot.selection won't return the correct selection now. >+// Currently it is the same as window.getSelection(). >+// FIXME: VisibleSelection in ShadowRoot is not intuitive. >+// http://wkb.ug/82683 >+// FIXME: ShadowRoot.selection should return selection whose range is in a shadow tree. >+// http://wkb.ug/82698 >+ >+shouldBe('selectionFromWindow.anchorNode', 'selectionFromShadowRoot1.anchorNode'); >+shouldBe('selectionFromWindow.anchorNode', 'selectionFromShadowRoot2.anchorNode'); >+shouldBe('selectionFromWindow.anchorNode', 'selectionFromShadowRoot3.anchorNode'); >+ >+shouldBe('selectionFromWindow.focusNode', 'selectionFromShadowRoot1.focusNode'); >+shouldBe('selectionFromWindow.focusNode', 'selectionFromShadowRoot2.focusNode'); >+shouldBe('selectionFromWindow.focusNode', 'selectionFromShadowRoot3.focusNode'); >+</script> >+<script src="../../js/resources/js-test-post.js"></script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 82429
:
134741
|
136196