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 for landing
bug-86341-20120515163728.patch (text/plain), 16.95 KB, created by
Shinya Kawanaka
on 2012-05-15 00:37:30 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Shinya Kawanaka
Created:
2012-05-15 00:37:30 PDT
Size:
16.95 KB
patch
obsolete
>Subversion Revision: 117037 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d5783d61171c9e32f773dd7c4639535c49172dc1..0def580f81760613f35d857c0ede5da87eec987c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,33 @@ >+2012-05-14 Shinya Kawanaka <shinyak@chromium.org> >+ >+ document.execCommand('Indent') in the direct child of ShadowRoot causes a crash. >+ https://bugs.webkit.org/show_bug.cgi?id=86341 >+ >+ Reviewed by Ryosuke Niwa. >+ >+ When document.execCommand('Indent') is executed in the direct child of ShadowRoot, >+ the scope variable of TextIterator becomes ShadowRoot. However, an element is assumed for it, >+ so a crash happended. >+ >+ This patch enables TextIterator to have ShadowRoot as a scope variable. >+ >+ Test: editing/shadow/execcommand-indent-in-shadow.html >+ >+ * WebCore.exp.in: >+ * editing/ApplyBlockElementCommand.cpp: >+ (WebCore::ApplyBlockElementCommand::doApply): >+ * editing/InsertListCommand.cpp: >+ (WebCore::InsertListCommand::doApply): >+ * editing/TextIterator.cpp: >+ (WebCore::TextIterator::rangeFromLocationAndLength): >+ * editing/TextIterator.h: >+ (TextIterator): >+ * editing/htmlediting.cpp: >+ (WebCore::indexForVisiblePosition): >+ (WebCore::visiblePositionForIndex): >+ * editing/htmlediting.h: >+ (WebCore): >+ > 2012-05-14 Shinya Kawanaka <shinyak@chromium.org> > > Node::shadowTreeRootNode() should return ShadowRoot instead of Node. >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index aa2f3f76f3b81cd5db15c12d809cb4172f65758d..95cf8158e68fb162714ce540f260f204691b8214 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,13 @@ >+2012-05-14 Shinya Kawanaka <shinyak@chromium.org> >+ >+ document.execCommand('Indent') in the direct child of ShadowRoot causes a crash. >+ https://bugs.webkit.org/show_bug.cgi?id=86341 >+ >+ Reviewed by Ryosuke Niwa. >+ >+ * src/WebRange.cpp: >+ (WebKit::WebRange::fromDocumentRange): >+ > 2012-05-14 Shinya Kawanaka <shinyak@chromium.org> > > Node::shadowTreeRootNode() should return ShadowRoot instead of Node. >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 0d4e52796555ede61d5a840ea8ee3bc18da7ab27..0806acccf7fb9b589d935ecfdf5322b7ee73c556 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,15 @@ >+2012-05-14 Shinya Kawanaka <shinyak@chromium.org> >+ >+ document.execCommand('Indent') in the direct child of ShadowRoot causes a crash. >+ https://bugs.webkit.org/show_bug.cgi?id=86341 >+ >+ Reviewed by Ryosuke Niwa. >+ >+ Exports necessary symbols. >+ >+ * win/WebKit2.def: >+ * win/WebKit2CFLite.def: >+ > 2012-05-14 Luke Macpherson <macpherson@chromium.org> > > Introduce ENABLE_CSS_VARIABLES compile flag. >diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in >index 0635985ab22104be20fb87dbb6981ea64d00f2e2..2ba31a1ea2f1688193863f0674589ef85907a82d 100644 >--- a/Source/WebCore/WebCore.exp.in >+++ b/Source/WebCore/WebCore.exp.in >@@ -284,7 +284,7 @@ __ZN7WebCore12SharedBufferD1Ev > __ZN7WebCore12SpellChecker17didCheckSucceededEiRKN3WTF6VectorINS_18TextCheckingResultELm0EEE > __ZN7WebCore12TextEncodingC1ERKN3WTF6StringE > __ZN7WebCore12TextIterator11rangeLengthEPKNS_5RangeEb >-__ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_7ElementEiib >+__ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_13ContainerNodeEiib > __ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_7ElementEPKNS_5RangeERmS6_ > __ZN7WebCore12TextIterator7advanceEv > __ZN7WebCore12TextIterator8subrangeEPNS_5RangeEii >diff --git a/Source/WebCore/editing/ApplyBlockElementCommand.cpp b/Source/WebCore/editing/ApplyBlockElementCommand.cpp >index 952dc097b9759df14bc902109235296ce02a94ea..901cd178491c1cbddd38d38c777ad329b80cf518 100644 >--- a/Source/WebCore/editing/ApplyBlockElementCommand.cpp >+++ b/Source/WebCore/editing/ApplyBlockElementCommand.cpp >@@ -80,9 +80,9 @@ void ApplyBlockElementCommand::doApply() > VisiblePosition endOfSelection = selection.visibleEnd(); > ASSERT(!startOfSelection.isNull()); > ASSERT(!endOfSelection.isNull()); >- RefPtr<Element> startScope; >+ RefPtr<ContainerNode> startScope; > int startIndex = indexForVisiblePosition(startOfSelection, startScope); >- RefPtr<Element> endScope; >+ RefPtr<ContainerNode> endScope; > int endIndex = indexForVisiblePosition(endOfSelection, endScope); > > formatSelection(startOfSelection, endOfSelection); >diff --git a/Source/WebCore/editing/InsertListCommand.cpp b/Source/WebCore/editing/InsertListCommand.cpp >index e4e35782685442f004020cde7bcdaeee59468cd1..b5e7d51cbfd0b89ac7c619011a1342b230bc10df 100644 >--- a/Source/WebCore/editing/InsertListCommand.cpp >+++ b/Source/WebCore/editing/InsertListCommand.cpp >@@ -152,7 +152,7 @@ void InsertListCommand::doApply() > // FIXME: This is an inefficient way to keep selection alive because indexForVisiblePosition walks from > // the beginning of the document to the endOfSelection everytime this code is executed. > // But not using index is hard because there are so many ways we can lose selection inside doApplyForSingleParagraph. >- RefPtr<Element> scope; >+ RefPtr<ContainerNode> scope; > int indexForEndOfSelection = indexForVisiblePosition(endOfSelection, scope); > doApplyForSingleParagraph(forceCreateList, listTag, currentSelection.get()); > if (endOfSelection.isNull() || endOfSelection.isOrphan() || startOfLastParagraph.isNull() || startOfLastParagraph.isOrphan()) { >diff --git a/Source/WebCore/editing/TextIterator.cpp b/Source/WebCore/editing/TextIterator.cpp >index 56fa6689a4960b7d052ee292527acb7b9fd158f5..66de928c3da4bfc2e823d1f6dcc5ab01f6339b67 100644 >--- a/Source/WebCore/editing/TextIterator.cpp >+++ b/Source/WebCore/editing/TextIterator.cpp >@@ -2403,7 +2403,7 @@ PassRefPtr<Range> TextIterator::subrange(Range* entireRange, int characterOffset > return characterSubrange(entireRangeIterator, characterOffset, characterCount); > } > >-PassRefPtr<Range> TextIterator::rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, bool forSelectionPreservation) >+PassRefPtr<Range> TextIterator::rangeFromLocationAndLength(ContainerNode* scope, int rangeLocation, int rangeLength, bool forSelectionPreservation) > { > RefPtr<Range> resultRange = scope->document()->createRange(); > >diff --git a/Source/WebCore/editing/TextIterator.h b/Source/WebCore/editing/TextIterator.h >index bfcfae3566e4c0a7a37e0b3b4d732c6b93924631..3a77ee8513b6ac6b5dfbce0fcf84f80d9fa2b77e 100644 >--- a/Source/WebCore/editing/TextIterator.h >+++ b/Source/WebCore/editing/TextIterator.h >@@ -100,7 +100,7 @@ public: > Node* node() const; > > static int rangeLength(const Range*, bool spacesForReplacedElements = false); >- static PassRefPtr<Range> rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, bool spacesForReplacedElements = false); >+ static PassRefPtr<Range> rangeFromLocationAndLength(ContainerNode* scope, int rangeLocation, int rangeLength, bool spacesForReplacedElements = false); > static bool getLocationAndLengthFromRange(Element* scope, const Range*, size_t& location, size_t& length); > static PassRefPtr<Range> subrange(Range* entireRange, int characterOffset, int characterCount); > >diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp >index 795b41be8e70dba9371971b6797d9ff252e4cbfb..2269b7c5a7226a6b7405ab79c0e41a64d3ed0a5d 100644 >--- a/Source/WebCore/editing/htmlediting.cpp >+++ b/Source/WebCore/editing/htmlediting.cpp >@@ -1085,19 +1085,20 @@ VisibleSelection selectionForParagraphIteration(const VisibleSelection& original > // opertion is unreliable. TextIterator's TextIteratorEmitsCharactersBetweenAllVisiblePositions mode needs to be fixed, > // or these functions need to be changed to iterate using actual VisiblePositions. > // FIXME: Deploy these functions everywhere that TextIterators are used to convert between VisiblePositions and indices. >-int indexForVisiblePosition(const VisiblePosition& visiblePosition, RefPtr<Element>& scope) >+ >+int indexForVisiblePosition(const VisiblePosition& visiblePosition, RefPtr<ContainerNode>& scope) > { > if (visiblePosition.isNull()) > return 0; > > Position p(visiblePosition.deepEquivalent()); > Document* document = p.anchorNode()->document(); >- Node* shadowRoot = p.anchorNode()->shadowTreeRootNode(); >+ ContainerNode* shadowRoot = p.anchorNode()->shadowTreeRootNode(); > > if (shadowRoot) { > // Use the shadow root for form elements, since TextIterators will not enter shadow content. >- ASSERT(shadowRoot->isElementNode()); >- scope = static_cast<Element*>(shadowRoot); >+ ASSERT(shadowRoot->isElementNode() || shadowRoot->isShadowRoot()); >+ scope = shadowRoot; > } else > scope = document->documentElement(); > >@@ -1106,7 +1107,7 @@ int indexForVisiblePosition(const VisiblePosition& visiblePosition, RefPtr<Eleme > return TextIterator::rangeLength(range.get(), true); > } > >-VisiblePosition visiblePositionForIndex(int index, Element *scope) >+VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope) > { > RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(scope, index, 0, true); > // Check for an invalid index. Certain editing operations invalidate indices because >diff --git a/Source/WebCore/editing/htmlediting.h b/Source/WebCore/editing/htmlediting.h >index c2cf4563bbcf0bd350f6e41d3bbac8254212fa81..a819c492cb06ef8ac89ec8b3f318608e9b0e22ed 100644 >--- a/Source/WebCore/editing/htmlediting.h >+++ b/Source/WebCore/editing/htmlediting.h >@@ -180,8 +180,8 @@ bool lineBreakExistsAtVisiblePosition(const VisiblePosition&); > > int comparePositions(const VisiblePosition&, const VisiblePosition&); > >-int indexForVisiblePosition(const VisiblePosition&, RefPtr<Element>& scope); >-VisiblePosition visiblePositionForIndex(int index, Element *scope); >+int indexForVisiblePosition(const VisiblePosition&, RefPtr<ContainerNode>& scope); >+VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope); > > // ------------------------------------------------------------------------- > // Range >diff --git a/Source/WebKit/chromium/src/WebRange.cpp b/Source/WebKit/chromium/src/WebRange.cpp >index be24dd7931156bfb661994c8b7f6a91f9c4c77ff..85df0a3baeffbfa4f21e9401bc2b8805724c3a04 100644 >--- a/Source/WebKit/chromium/src/WebRange.cpp >+++ b/Source/WebKit/chromium/src/WebRange.cpp >@@ -32,9 +32,11 @@ > #include "WebRange.h" > > #include "Document.h" >+#include "Element.h" > #include "Frame.h" > #include "FrameView.h" > #include "Range.h" >+#include "ShadowRoot.h" > #include "TextIterator.h" > #include "WebFrameImpl.h" > #include "WebNode.h" >@@ -97,7 +99,7 @@ WebRange WebRange::fromDocumentRange(WebFrame* frame, int start, int length) > { > WebCore::Frame* webFrame = static_cast<WebFrameImpl*>(frame)->frame(); > Element* selectionRoot = webFrame->selection()->rootEditableElement(); >- Element* scope = selectionRoot ? selectionRoot : webFrame->document()->documentElement(); >+ ContainerNode* scope = selectionRoot ? selectionRoot : webFrame->document()->documentElement(); > return TextIterator::rangeFromLocationAndLength(scope, start, length); > } > >diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def >index 31848ffd037300b388eb2fd3de17c36ca177d0cd..ff89a561977662a8005ce4c81c46f5ce9fd4896b 100644 >--- a/Source/WebKit2/win/WebKit2.def >+++ b/Source/WebKit2/win/WebKit2.def >@@ -199,7 +199,7 @@ EXPORTS > ?page@Document@WebCore@@QBEPAVPage@2@XZ > ?paintControlTints@FrameView@WebCore@@AAEXXZ > ?placeholderShouldBeVisible@HTMLTextFormControlElement@WebCore@@QBE_NXZ >- ?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVElement@2@HH_N@Z >+ ?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVContainerNode@2@HH_N@Z > ?remove@String@WTF@@QAEXIH@Z > ?reverseFind@StringImpl@WTF@@QAEI_WI@Z > ?s_frontendCounter@InspectorInstrumentation@WebCore@@0HA >diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def >index ac552ae21aa79824f17f6b8b07c5d6e8d3176635..11e483412f4be449ba0a1471fc636cc652894c4a 100644 >--- a/Source/WebKit2/win/WebKit2CFLite.def >+++ b/Source/WebKit2/win/WebKit2CFLite.def >@@ -192,7 +192,7 @@ EXPORTS > ?page@Document@WebCore@@QBEPAVPage@2@XZ > ?paintControlTints@FrameView@WebCore@@AAEXXZ > ?placeholderShouldBeVisible@HTMLTextFormControlElement@WebCore@@QBE_NXZ >- ?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVElement@2@HH_N@Z >+ ?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVContainerNode@2@HH_N@Z > ?remove@String@WTF@@QAEXIH@Z > ?reverseFind@StringImpl@WTF@@QAEI_WI@Z > ?s_frontendCounter@InspectorInstrumentation@WebCore@@0HA >diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter >index d3044ea5e544164c4ce1a57e6de22533f27d3e63..f5072726af734db616b10277c698fc57a0462619 100644 >--- a/Source/autotools/symbols.filter >+++ b/Source/autotools/symbols.filter >@@ -45,7 +45,7 @@ _ZN7WebCore10ClientRectC1ERKNS_7IntRectE; > _ZN7WebCore10ShadowRoot6createEPNS_7ElementERi; > _ZN7WebCore11EventTarget17toGeneratedStreamEv; > _ZN7WebCore11EventTarget8toStreamEv; >-_ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_7ElementEiib; >+_ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_13ContainerNodeEiib; > _ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_7ElementEPKNS_5RangeERjS6_; > _ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_7ElementEPKNS_5RangeERmS6_; > _ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 5b67b337644c4ddab475964fb2e6df3e08577991..a3ab65e45320bde9c0d1ebadfdce096507b21312 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2012-05-14 Shinya Kawanaka <shinyak@chromium.org> >+ >+ document.execCommand('Indent') in the direct child of ShadowRoot causes a crash. >+ https://bugs.webkit.org/show_bug.cgi?id=86341 >+ >+ Reviewed by Ryosuke Niwa. >+ >+ * editing/shadow/execcommand-indent-in-shadow-expected.txt: Added. >+ * editing/shadow/execcommand-indent-in-shadow.html: Added. >+ > 2012-05-14 Nikolas Zimmermann <nzimmermann@rim.com> > > Not reviewed. Renegerate three pixel test results on Lion, so that the svg/ pixel tests pass with tolerance 0 again. >diff --git a/LayoutTests/editing/shadow/execcommand-indent-in-shadow-expected.txt b/LayoutTests/editing/shadow/execcommand-indent-in-shadow-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..866f10048261e0bbb3744ec8aa9125416865aa51 >--- /dev/null >+++ b/LayoutTests/editing/shadow/execcommand-indent-in-shadow-expected.txt >@@ -0,0 +1,13 @@ >+In this test, we do execCommand('Indent') in the direct child of ShadowRoot to confirm a crash doesn't happen. >+ >+ >+ >+ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >+ >+ >+ >+ >diff --git a/LayoutTests/editing/shadow/execcommand-indent-in-shadow.html b/LayoutTests/editing/shadow/execcommand-indent-in-shadow.html >new file mode 100644 >index 0000000000000000000000000000000000000000..dfaeee6d877185f3dce708f05007d8b0dad03cdf >--- /dev/null >+++ b/LayoutTests/editing/shadow/execcommand-indent-in-shadow.html >@@ -0,0 +1,32 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="../../fast/dom/resources/event-sender-util.js"></script> >+<script src="../../fast/dom/shadow/resources/polyfill.js"></script> >+</head> >+<body> >+ >+<p>In this test, we do execCommand('Indent') in the direct child of ShadowRoot >+to confirm a crash doesn't happen.</p> >+ >+<div id="container" contenteditable></div> >+<pre id="console"></div> >+ >+<script> >+var shadowRoot = new WebKitShadowRoot(container); >+shadowRoot.innerHTML = "<span contenteditable>Kotori Otonashi</span>" >+var span = shadowRoot.firstChild; >+ >+mouseMoveToElem(span); >+eventSender.mouseDown(); >+eventSender.mouseUp(); >+ >+document.execCommand('Indent'); >+ >+var successfullyParsed = true; >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+ >+</html> >diff --git a/ChangeLog b/ChangeLog >index f339d336feb5355e7f259b36217495be343d2de1..d3a783192048546703c81cf52c22b696d753802b 100644 >--- a/ChangeLog >+++ b/ChangeLog >@@ -1,3 +1,14 @@ >+2012-05-14 Shinya Kawanaka <shinyak@chromium.org> >+ >+ document.execCommand('Indent') in the direct child of ShadowRoot causes a crash. >+ https://bugs.webkit.org/show_bug.cgi?id=86341 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Exports necessary symbols. >+ >+ * Source/autotools/symbols.filter: >+ > 2012-05-14 Luke Macpherson <macpherson@chromium.org> > > Introduce ENABLE_CSS_VARIABLES compile flag.
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 86341
:
141660
|
141665
| 141878