Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: Source/core/dom/Range.cpp

Issue 199383004: Postpone mutation event dispatch in Selection.deleteFromDocument (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Scoping Range event Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/editing/selection/resources/deleteFromDocument-scoped-dispatch-event-crash-iframe.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
5 * (C) 2001 Peter Kelly (pmk@post.com) 5 * (C) 2001 Peter Kelly (pmk@post.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 16 matching lines...) Expand all
27 27
28 #include "bindings/v8/ExceptionState.h" 28 #include "bindings/v8/ExceptionState.h"
29 #include "core/dom/ClientRect.h" 29 #include "core/dom/ClientRect.h"
30 #include "core/dom/ClientRectList.h" 30 #include "core/dom/ClientRectList.h"
31 #include "core/dom/DocumentFragment.h" 31 #include "core/dom/DocumentFragment.h"
32 #include "core/dom/ExceptionCode.h" 32 #include "core/dom/ExceptionCode.h"
33 #include "core/dom/Node.h" 33 #include "core/dom/Node.h"
34 #include "core/dom/NodeTraversal.h" 34 #include "core/dom/NodeTraversal.h"
35 #include "core/dom/NodeWithIndex.h" 35 #include "core/dom/NodeWithIndex.h"
36 #include "core/dom/ProcessingInstruction.h" 36 #include "core/dom/ProcessingInstruction.h"
37 #include "core/events/ScopedEventQueue.h"
38 #include "core/dom/Text.h" 37 #include "core/dom/Text.h"
39 #include "core/editing/TextIterator.h" 38 #include "core/editing/TextIterator.h"
40 #include "core/editing/VisiblePosition.h" 39 #include "core/editing/VisiblePosition.h"
41 #include "core/editing/VisibleUnits.h" 40 #include "core/editing/VisibleUnits.h"
42 #include "core/editing/markup.h" 41 #include "core/editing/markup.h"
42 #include "core/events/ScopedEventQueue.h"
43 #include "core/html/HTMLElement.h" 43 #include "core/html/HTMLElement.h"
44 #include "core/rendering/RenderBoxModelObject.h" 44 #include "core/rendering/RenderBoxModelObject.h"
45 #include "core/rendering/RenderText.h" 45 #include "core/rendering/RenderText.h"
46 #include "platform/geometry/FloatQuad.h" 46 #include "platform/geometry/FloatQuad.h"
47 #include "wtf/RefCountedLeakCounter.h" 47 #include "wtf/RefCountedLeakCounter.h"
48 #include "wtf/text/CString.h" 48 #include "wtf/text/CString.h"
49 #include "wtf/text/StringBuilder.h" 49 #include "wtf/text/StringBuilder.h"
50 #ifndef NDEBUG 50 #ifndef NDEBUG
51 #include <stdio.h> 51 #include <stdio.h>
52 #endif 52 #endif
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 TrackExceptionState exceptionState; 558 TrackExceptionState exceptionState;
559 return m_start.container() && compareBoundaryPoints(m_start, m_end, exceptio nState) <= 0 && !exceptionState.hadException(); 559 return m_start.container() && compareBoundaryPoints(m_start, m_end, exceptio nState) <= 0 && !exceptionState.hadException();
560 } 560 }
561 561
562 void Range::deleteContents(ExceptionState& exceptionState) 562 void Range::deleteContents(ExceptionState& exceptionState)
563 { 563 {
564 checkDeleteExtract(exceptionState); 564 checkDeleteExtract(exceptionState);
565 if (exceptionState.hadException()) 565 if (exceptionState.hadException())
566 return; 566 return;
567 567
568 processContents(DELETE_CONTENTS, exceptionState); 568 {
569 EventQueueScope eventQueueScope;
570 processContents(DELETE_CONTENTS, exceptionState);
571 }
569 } 572 }
570 573
571 bool Range::intersectsNode(Node* refNode, ExceptionState& exceptionState) 574 bool Range::intersectsNode(Node* refNode, ExceptionState& exceptionState)
572 { 575 {
573 // http://developer.mozilla.org/en/docs/DOM:range.intersectsNode 576 // http://developer.mozilla.org/en/docs/DOM:range.intersectsNode
574 // Returns a bool if the node intersects the range. 577 // Returns a bool if the node intersects the range.
575 578
576 // Throw exception if the range is already detached. 579 // Throw exception if the range is already detached.
577 if (!m_start.container()) { 580 if (!m_start.container()) {
578 exceptionState.throwDOMException(InvalidStateError, "The range has no co ntainer. Perhaps 'detach()' has been invoked on this object?"); 581 exceptionState.throwDOMException(InvalidStateError, "The range has no co ntainer. Perhaps 'detach()' has been invoked on this object?");
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 1893
1891 void showTree(const WebCore::Range* range) 1894 void showTree(const WebCore::Range* range)
1892 { 1895 {
1893 if (range && range->boundaryPointsValid()) { 1896 if (range && range->boundaryPointsValid()) {
1894 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1897 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1895 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1898 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1896 } 1899 }
1897 } 1900 }
1898 1901
1899 #endif 1902 #endif
OLDNEW
« no previous file with comments | « LayoutTests/editing/selection/resources/deleteFromDocument-scoped-dispatch-event-crash-iframe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698