+2014-11-05 Dan Bernstein <mitz@apple.com>
+
+ Remove the unused deletion UI feature
+ https://bugs.webkit.org/show_bug.cgi?id=138442
+
+ Rubber-stamped by Alexey Proskuryakov.
+
+ Removed tests, expected results, and support files for this feature.
+
+ * platform/mac/editing/deleting/deletionUI-borders-expected.txt: Removed.
+ * platform/mac/editing/deleting/deletionUI-borders.html: Removed.
+ * platform/mac/editing/deleting/deletionUI-click-on-delete-button-expected.txt: Removed.
+ * platform/mac/editing/deleting/deletionUI-click-on-delete-button.html: Removed.
+ * platform/mac/editing/deleting/deletionUI-differing-background-expected.txt: Removed.
+ * platform/mac/editing/deleting/deletionUI-differing-background.html: Removed.
+ * platform/mac/editing/deleting/deletionUI-minimum-size-expected.txt: Removed.
+ * platform/mac/editing/deleting/deletionUI-minimum-size.html: Removed.
+ * platform/mac/editing/deleting/deletionUI-single-instance-expected.png: Removed.
+ * platform/mac/editing/deleting/deletionUI-single-instance-expected.txt: Removed.
+ * platform/mac/editing/deleting/deletionUI-single-instance.html: Removed.
+ * platform/mac/editing/deleting/deletionUI-successful-deletion-expected.txt: Removed.
+ * platform/mac/editing/deleting/deletionUI-successful-deletion.html: Removed.
+ * platform/mac/editing/deleting/id-in-deletebutton-expected.txt: Removed.
+ * platform/mac/editing/deleting/id-in-deletebutton.html: Removed.
+ * platform/mac/editing/deleting/resources: Removed.
+ * platform/mac/editing/deleting/resources/deletionUI-helpers.js: Removed.
+ * platform/wk2/TestExpectations:
+
2014-11-04 David Hyatt <hyatt@apple.com>
Descendant ends up in wrong flow thread with nested columns and spans.
+++ /dev/null
-This tests if the deletion UI will show on elements with different numbers of visible borders. This test can be run by DRT but not in the browser.
-
-oneBorder HAS deletion UI
-twoBorder HAS deletion UI
-threeBorder HAS deletion UI
-fourBorder HAS deletion UI
-
-
-
-
-
-
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
- <style type="text/css">
- div {width:51; height:51}
- #oneBorder {border-bottom:1px solid red}
- #twoBorder {border-bottom:1px solid red; border-top:1px solid red}
- #threeBorder {border-bottom:1px solid red; border-top:1px solid red; border-right:1px solid red}
- #fourBorder {border-bottom:1px solid red; border-top:1px solid red; border-right:1px solid red; border-left:1px solid red}
- </style>
- <script src="resources/deletionUI-helpers.js"></script>
- <script>
- function test()
- {
- if (window.testRunner)
- testRunner.dumpAsText();
-
- determineDeletionUIExistence("oneBorder");
- determineDeletionUIExistence("twoBorder");
- determineDeletionUIExistence("threeBorder");
- determineDeletionUIExistence("fourBorder");
- }
- </script>
-</head>
-<body onload="test()">
- <p>This tests if the deletion UI will show on elements with different numbers of visible borders. This test can be run by DRT but not in the browser.</p>
- <div id="console"></div>
-
- <div contenteditable="true" style="padding: 1em;">
- <div id="oneBorder" class="needsDeletionUI"><br></div>
- <div id="twoBorder" class="needsDeletionUI"><br></div>
- <div id="threeBorder" class="needsDeletionUI"><br></div>
- <div id="fourBorder" class="needsDeletionUI"><br></div>
- <div>
-
-</body>
-</html>
+++ /dev/null
-There should be no visible content in the markup below. This test is for a bug where the delete button wouldn't work because it had -webkit-user-select:none instead of -webkit-user-select:ignore.
-| "
-"
-| "
-"
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<body>
-
-<div id="test" contenteditable="true" style="padding: 1em;">
-<ul class="needsDeletionUI"><li>1</li><li id="li">2</li></ul>
-</div>
-
-<script src="../../../../resources/dump-as-markup.js"></script>
-<script>
-
-sel = window.getSelection();
-li = document.getElementById("li");
-sel.setPosition(li, 0);
-
-if (window.testRunner) {
- deleteButton = internals.findEditingDeleteButton();
- x = deleteButton.offsetParent.offsetLeft + deleteButton.offsetParent.offsetParent.offsetLeft + deleteButton.offsetLeft + deleteButton.offsetWidth / 2;
- y = deleteButton.offsetParent.offsetTop + deleteButton.offsetParent.offsetParent.offsetTop + deleteButton.offsetTop + deleteButton.offsetHeight / 2;
- eventSender.mouseMoveTo(x, y);
- eventSender.mouseDown();
- eventSender.mouseUp();
- deleteButton = internals.findEditingDeleteButton();
- testContainer = document.getElementById("test");
- Markup.description("There should be no visible content in the markup below. This test is for a bug where the delete button wouldn't work because it had -webkit-user-select:none instead of -webkit-user-select:ignore.");
- if (deleteButton)
- testContainer.innerHTML += "FAIL";
- Markup.dump("test");
-}
-
-</script>
-</body>
-</html>
+++ /dev/null
-This tests if the deletion UI will show on elements with different background colors or images. This test can be run by DRT but not in the browser.
-
-sameBackground HAS deletion UI
-differentBackgroundColor HAS deletion UI
-differentBackgroundImage HAS deletion UI
-fullyTransparentChildWithNonTransparentParent has NO deletion UI
-nonTransparentChildWithSemiTransparentParent HAS deletion UI
-fullyTransparentChildWithSemiTransparentParent has NO deletion UI
-nonTransparentChildWithFullyTransparentParent HAS deletion UI
-fullyTransparentChildWithFullyTransparentParent has NO deletion UI
-
-
-
-
-
-
-
-
-
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
- <style type="text/css">
- div {rgba(255, 255, 255, 0); width:51; height:51;}
- #sameBackground {background-color:white}
- #differentBackgroundColor {background-color:black}
- #differentBackgroundImage {background-image:url("../../../../fast/images/resources/boston.gif")}
-
- #semiTransparentParent {background-color:rgba(255, 0, 0, .5)}
- #fullyTransparentParent {background-color:rgba(255, 0, 0, 0)}
-
- #fullyTransparentChildWithNonTransparentParent {background-color:rgba(255, 255, 255, 0)}
- #nonTransparentChildWithSemiTransparentParent {background-color:rgba(255, 0, 0, 1)}
- #fullyTransparentChildWithSemiTransparentParent {background-color:rgba(255, 0, 0, 0)}
- #nonTransparentChildWithFullyTransparentParent {background-color:rgba(255, 0, 0, 1)}
- #fullyTransparentChildWithFullyTransparentParent {background-color:rgba(255, 0, 0, 0)}
- </style>
- <script src="resources/deletionUI-helpers.js"></script>
- <script>
- function test()
- {
- if (window.testRunner)
- testRunner.dumpAsText();
-
- determineDeletionUIExistence("sameBackground");
- determineDeletionUIExistence("differentBackgroundColor");
- determineDeletionUIExistence("differentBackgroundImage");
-
- determineDeletionUIExistence("fullyTransparentChildWithNonTransparentParent");
- determineDeletionUIExistence("nonTransparentChildWithSemiTransparentParent");
- determineDeletionUIExistence("fullyTransparentChildWithSemiTransparentParent");
- determineDeletionUIExistence("nonTransparentChildWithFullyTransparentParent");
- determineDeletionUIExistence("fullyTransparentChildWithFullyTransparentParent");
-
- }
- </script>
-</head>
-<body onload="test()">
- <p>This tests if the deletion UI will show on elements with different background colors or images. This test can be run by DRT but not in the browser.</p>
- <div id="console"></div>
-
-
- <div contenteditable="true" style="padding: 1em;">
- <div id="sameBackground" class="needsDeletionUI"><br></div>
- <div id="differentBackgroundColor" class="needsDeletionUI"><br></div>
- <div id="differentBackgroundImage" class="needsDeletionUI"><br></div>
-
- <div id="fullyTransparentChildWithNonTransparentParent" class="needsDeletionUI"><br></div>
- <div id="semiTransparentParent">
- <div id="nonTransparentChildWithSemiTransparentParent" class="needsDeletionUI"><br></div>
- <div id="fullyTransparentChildWithSemiTransparentParent" class="needsDeletionUI"><br></div>
- </div>
- <div id="fullyTransparentParent">
- <div id="nonTransparentChildWithFullyTransparentParent" class="needsDeletionUI"><br></div>
- <div id="fullyTransparentChildWithFullyTransparentParent" class="needsDeletionUI"><br></div>
- </div>
- <div>
-
-</body>
-</html>
-
+++ /dev/null
-This tests if the deletion UI will show on elements with different sizes. This test can be run by DRT but not in the browser.
-
-smallWidth has NO deletion UI
-smallHeight has NO deletion UI
-smallWidthSmallHeight has NO deletion UI
-sufficientWidthAndHeight HAS deletion UI
-
-
-
-
-
-
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
- <style type="text/css">
- div {border:1px solid red}
- #smallWidth {width:10; height:251}
- #smallHeight {width:251; height:10}
- #smallWidthSmallHeight {width:10; height:10}
- #sufficientWidthAndHeight {width:51; height:51}
- </style>
- <script src="resources/deletionUI-helpers.js"></script>
- <script>
- function test()
- {
- if (window.testRunner)
- testRunner.dumpAsText();
-
- determineDeletionUIExistence("smallWidth");
- determineDeletionUIExistence("smallHeight");
- determineDeletionUIExistence("smallWidthSmallHeight");
- determineDeletionUIExistence("sufficientWidthAndHeight");
- }
- </script>
-</head>
-<body onload="test()">
- <p>This tests if the deletion UI will show on elements with different sizes. This test can be run by DRT but not in the browser.</p>
- <div id="console"></div>
-
- <div contenteditable="true" style="padding: 1em;">
- <div id="smallWidth" class="needsDeletionUI"><br></div>
- <div id="smallHeight" class="needsDeletionUI"><br></div>
- <div id="smallWidthSmallHeight" class="needsDeletionUI"><br></div>
- <div id="sufficientWidthAndHeight" class="needsDeletionUI"><br></div>
- <div>
-
-</body>
-</html>
+++ /dev/null
-layer at (0,0) size 800x600
- RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
- RenderBlock {HTML} at (0,0) size 800x600
- RenderBody {BODY} at (8,8) size 784x584
- RenderBlock {P} at (0,0) size 784x54
- RenderText {#text} at (0,0) size 782x54
- text run at (0,0) width 457: "This test can only be run with DRT and not manually from the browser. "
- text run at (457,0) width 325: "This test makes sure that we don't make the mistake"
- text run at (0,18) width 738: "of adding new m_containerElements to the DeletionUI over and over again. A successful run of the test will not have"
- text run at (0,36) width 450: "multiple instances of deletion UI render objects at the same coordinates:"
- RenderBlock {DIV} at (0,70) size 784x112
-layer at (24,94) size 752x80 layerType: background only
-layer at (20,90) size 760x88
- RenderBlock (positioned) zI: -1000000 {DIV} at (-4,-4) size 760x88 [border: (4px solid #00000099)]
-layer at (24,94) size 752x80 layerType: foreground only
- RenderTable {TABLE} at (16,16) size 752x80
- RenderTableSection {TBODY} at (0,0) size 752x78
- RenderTableRow {TR} at (0,2) size 752x74
- RenderTableCell {TD} at (2,2) size 748x74 [r=0 c=0 rs=1 cs=1]
- RenderText {#text} at (1,1) size 746x72
- text run at (1,1) width 743: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas odio. Morbi sed tortor id nisl bibendum commodo."
- text run at (744,1) width 3: " "
- text run at (1,19) width 739: "Donec pede. Praesent accumsan dui vitae mauris. Mauris non dui at neque lacinia pulvinar. Quisque nibh. Nulla vitae"
- text run at (740,19) width 4: " "
- text run at (1,37) width 715: "lectus. Pellentesque enim. Mauris hendrerit molestie dui. Etiam pretium ligula a pede. Fusce consectetuer purus sit"
- text run at (716,37) width 4: " "
- text run at (1,55) width 353: "amet sem. Morbi tincidunt mollis libero. Maecenas mole"
- RenderTableSection (anonymous) at (0,78) size 752x2
- RenderTableRow (anonymous) at (0,0) size 752x0
- RenderTableCell (anonymous) at (2,0) size 748x0 [r=0 c=0 rs=1 cs=1]
-layer at (7,79) size 30x30
- RenderImage zI: 1000000 {IMG} at (-17,-15) size 30x30
-caret: position 403 of child 0 {#text} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 3 {DIV} of body
+++ /dev/null
-<body>
-
-<p>
-This test can only be run with DRT and not manually from the browser. This test makes sure that we don't make the mistake of adding new m_containerElements to the DeletionUI over and over again.
-A successful run of the test will not have multiple instances of deletion UI render objects at the same coordinates:
-</p>
-
-<div contenteditable="true" style="padding: 1em;">
-<table class="needsDeletionUI">
-
-<tr>
-<td id="td">
-Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas odio. Morbi sed tortor id nisl bibendum commodo. Donec pede. Praesent accumsan dui vitae mauris. Mauris non dui at neque lacinia pulvinar. Quisque nibh. Nulla vitae lectus. Pellentesque enim. Mauris hendrerit molestie dui. Etiam pretium ligula a pede. Fusce consectetuer purus sit amet sem. Morbi tincidunt mollis libero. Maecenas molestie.
-</td>
-</tr>
-</table>
-
-</div>
-
-<script>
-
-sel = window.getSelection();
-td = document.getElementById("td");
-sel.setPosition(td, td.textContent.length);
-
-if (window.testRunner) {
- for (i = 0; i < 5; i++)
- document.execCommand("Delete");
-}
-
-</script>
-</body>
+++ /dev/null
-This tests if the deletion UI will delete the associated element when activated. This test can be run by DRT but not in the browser.
-
-dontDeleteMeA HAS deletion UI
-dontDeleteMeB HAS deletion UI
-deleteMe HAS deletion UI
-This is an element that will show the deletion UI when the selection is within it. The test will not delete this element.
-This is an element that will show the deletion UI when the selection is within it. The test will not delete this element.
-
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
- <style type="text/css">
- .needsDeletionUI { border: 1px solid black; min-height: 100px; }
- </style>
- <script src="resources/deletionUI-helpers.js"></script>
- <script>
- function test()
- {
- if (window.testRunner) {
- testRunner.dumpAsText();
-
- // We make the WebView editable here so that the code path responsible for
- // <http://webkit.org/b/37115> / <rdar://problem/7829331> is exercised.
- testRunner.setWebViewEditable(true);
- }
-
- determineDeletionUIExistence("dontDeleteMeA");
- determineDeletionUIExistence("dontDeleteMeB");
- determineDeletionUIExistence("deleteMe");
-
- var deleteButton = deletionUIDeleteButtonForElement("deleteMe");
- var clickEvent = document.createEvent("MouseEvents");
- clickEvent.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- deleteButton.dispatchEvent(clickEvent);
-
- if (document.getElementById("deleteMe"))
- debug("ERROR: Element deleteMe was found in the document after the delete button in the deletion UI was clicked!");
- }
- </script>
-</head>
-<body onload="test()">
- <p>This tests if the deletion UI will delete the associated element when activated. This test can be run by DRT but not in the browser.</p>
- <div id="console"></div>
-
- <div contenteditable="true" style="padding: 1em;">
- <div id="dontDeleteMeA" class="needsDeletionUI">This is an element that will show the deletion UI when the selection is within it. The test <em>will not</em> delete this element.</div>
- <div id="deleteMe" class="needsDeletionUI">This is an element that will show the deletion UI when the selection is within it. The test <em>will</em> delete this element.</div>
- <div id="dontDeleteMeB" class="needsDeletionUI">This is an element that will show the deletion UI when the selection is within it. The test <em>will not</em> delete this element.</div>
- <div>
-
-</body>
-</html>
+++ /dev/null
-Test document.getElementById("WebKit-Editing-Delete-Button")
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS internals.findEditingDeleteButton(); document.getElementById("WebKit-Editing-Delete-Button") is non-null.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-1
-2
-
+++ /dev/null
-<html>
-<body>
-<div contenteditable="true">
-<ul class="needsDeletionUI"><li>1</li><li id="li">2</li></ul>
-<script src="../../../../resources/js-test-pre.js"></script>
-<script>
-description('Test document.getElementById("WebKit-Editing-Delete-Button")');
-
-sel = window.getSelection();
-li = document.getElementById("li");
-sel.setPosition(li, 0);
-
-if (window.testRunner)
- shouldBeNonNull('internals.findEditingDeleteButton(); document.getElementById("WebKit-Editing-Delete-Button")');
-
-var successfullyParsed = true;
-
-</script>
-<script src="../../../../resources/js-test-post.js"></script>
-</body>
-</html>
+++ /dev/null
-if (window.testRunner)
- testRunner.dumpAsText();
-
-function debug(msg)
-{
- var span = document.createElement("span");
- document.getElementById("console").appendChild(span); // insert it first so XHTML knows the namespace
- span.innerHTML = msg + '<br />';
-}
-
-function deletionUIDeleteButtonForElement(id)
-{
- if (!window.internals)
- return null;
- var sel = window.getSelection();
- var selElement = document.getElementById(id);
- sel.setPosition(selElement, 0);
- return internals.findEditingDeleteButton();
-}
-
-function determineDeletionUIExistence(id)
-{
- var deleteButton = deletionUIDeleteButtonForElement(id);
- debug(id + (deleteButton ? " HAS " : " has NO ") + "deletion UI");
-}
platform/mac/fast/text/attributed-substring-from-range.html
platform/mac/fast/text/justified-text-rect.html
-# WebKitTestRunner needs to support needsDeletionUI mechanism to show deletion UI
-# <https://bugs.webkit.org/show_bug.cgi?id=42535>
-platform/mac/editing/deleting/id-in-deletebutton.html
-platform/mac/editing/deleting/deletionUI-click-on-delete-button.html
-platform/mac/editing/deleting/deletionUI-single-instance.html
-platform/mac/editing/deleting/deletionUI-borders.html
-platform/mac/editing/deleting/deletionUI-differing-background.html
-platform/mac/editing/deleting/deletionUI-minimum-size.html
-platform/mac/editing/deleting/deletionUI-successful-deletion.html
-
# WebKitTestRunner needs layoutTestController.setDashboardCompatibilityMode
# <https://bugs.webkit.org/show_bug.cgi?id=42547>
fast/canvas/canvas-gradient-addStop-error.html
+2014-11-05 Dan Bernstein <mitz@apple.com>
+
+ Remove the unused deletion UI feature
+ https://bugs.webkit.org/show_bug.cgi?id=138442
+
+ Rubber-stamped by Alexey Proskuryakov.
+
+ * wtf/FeatureDefines.h: Removed definition of ENABLE_DELETION_UI.
+
2014-11-03 Dean Jackson <dino@apple.com>
Add ENABLE_FILTERS_LEVEL_2 feature guard.
#define ENABLE_DASHBOARD_SUPPORT 1
#endif
-#if !defined(ENABLE_DELETION_UI)
-#define ENABLE_DELETION_UI 1
-#endif
-
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
#if !defined(ENABLE_ENCRYPTED_MEDIA)
#define ENABLE_ENCRYPTED_MEDIA 1
#define ENABLE_DATA_TRANSFER_ITEMS 0
#endif
-#if !defined(ENABLE_DELETION_UI)
-#define ENABLE_DELETION_UI 0
-#endif
-
#if !defined(ENABLE_DETAILS_ELEMENT)
#define ENABLE_DETAILS_ELEMENT 1
#endif
+2014-11-05 Dan Bernstein <mitz@apple.com>
+
+ Remove the unused deletion UI feature
+ https://bugs.webkit.org/show_bug.cgi?id=138442
+
+ Rubber-stamped by Alexey Proskuryakov.
+
+ * Resources/deleteButton.png: Removed.
+ * Resources/deleteButton@2x.png: Removed.
+ * Resources/deleteButtonPressed.png: Removed.
+ * Resources/deleteButtonPressed@2x.png: Removed.
+
+ * WebCore.xcodeproj/project.pbxproj: Removed references to removed files.
+
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::cloneChildNodes): Folded the below helper function into this member
+ function, after removing the deleteButtonContainerElement parameter.
+ (WebCore::cloneChildNodesAvoidingDeleteButton): Deleted.
+
+ * editing/CompositeEditCommand.cpp:
+ (WebCore::EditCommandComposition::unapply): Removed use of
+ DeleteButtonControllerDisableScope.
+ (WebCore::EditCommandComposition::reapply): Ditto.
+ (WebCore::CompositeEditCommand::apply): Ditto.
+
+ * editing/DeleteButton.cpp: Removed.
+ * editing/DeleteButton.h: Removed.
+ * editing/DeleteButtonController.cpp: Removed.
+ * editing/DeleteButtonController.h: Removed.
+
+ * editing/EditCommand.cpp:
+ (WebCore::EditCommand::EditCommand): Removed use of
+ Editor::avoidIntersectionWithDeleteButtonController.
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::Editor): Removed initialization of m_deleteButtonController.
+ (WebCore::Editor::rangeForPoint): Removed use of avoidIntersectionWithDeleteButtonController.
+ (WebCore::Editor::editorUIUpdateTimerFired): Removed call to DeleteButtonController function.
+ (WebCore::Editor::avoidIntersectionWithDeleteButtonController): Deleted.
+ (WebCore::Editor::deviceScaleFactorChanged): Deleted.
+
+ * editing/Editor.h:
+ (WebCore::Editor::deleteButtonController): Deleted.
+ (WebCore::Editor::avoidIntersectionWithDeleteButtonController): Deleted.
+
+ * editing/MarkupAccumulator.cpp:
+ (WebCore::MarkupAccumulator::serializeNodes): Removed nodeToSkip parameter.
+ (WebCore::MarkupAccumulator::serializeNodesWithNamespaces): Ditto.
+
+ * editing/MarkupAccumulator.h:
+
+ * editing/markup.cpp:
+ (WebCore::createMarkupInternal): Removed updateRange parameter, which had become identical
+ to the range parameter, and changed to use the latter everywhere instead.
+ (WebCore::createMarkup): Don’t compute and pass separate updateRanage parameter.
+
+ * loader/EmptyClients.h: Removed shouldShowDeleteInterface override.
+ * page/EditorClient.h: Removed shouldShowDeleteInterface.
+
+ * page/Page.cpp:
+ (WebCore::Page::setDeviceScaleFactor): Removed call to Editor::deviceScaleFactorChanged.
+
+ * page/PageSerializer.cpp:
+ (WebCore::PageSerializer::serializeFrame): Updated for MarkupAccumulator::serializeNodes change.
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::findEditingDeleteButton): Deleted.
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2014-11-04 David Hyatt <hyatt@apple.com>
Descendant ends up in wrong flow thread with nested columns and spans.
1C2417BA1992C04100EF9938 /* SpellingDot@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1C2417B91992C04100EF9938 /* SpellingDot@3x.png */; };
1C26497A0D7E248A00BD10F2 /* DocumentLoaderMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C2649790D7E248A00BD10F2 /* DocumentLoaderMac.cpp */; };
1C26497C0D7E24EC00BD10F2 /* PageMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C26497B0D7E24EC00BD10F2 /* PageMac.cpp */; };
- 1C4C8F020AD85D87009475CE /* DeleteButtonController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4C8F000AD85D87009475CE /* DeleteButtonController.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 1C4C8F660AD8655D009475CE /* DeleteButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4C8F640AD8655D009475CE /* DeleteButton.h */; };
1C81B95A0E97330800266E07 /* InspectorController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C81B9560E97330800266E07 /* InspectorController.h */; settings = {ATTRIBUTES = (Private, ); }; };
1C81B95B0E97330800266E07 /* InspectorController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C81B9570E97330800266E07 /* InspectorController.cpp */; };
1C81B95C0E97330800266E07 /* InspectorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C81B9580E97330800266E07 /* InspectorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
1CCA732210ADD44A00FD440D /* DOMHTMLInputElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 1CCA732110ADD43E00FD440D /* DOMHTMLInputElementPrivate.h */; };
1CCDF5BD1990332400BCEBAD /* SVGToOTFFontConversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CCDF5BB1990332400BCEBAD /* SVGToOTFFontConversion.cpp */; };
1CCDF5BE1990332400BCEBAD /* SVGToOTFFontConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CCDF5BC1990332400BCEBAD /* SVGToOTFFontConversion.h */; };
- 1CE83AC30ADAFFD7009354F6 /* DeleteButtonController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C4C8EFF0AD85D87009475CE /* DeleteButtonController.cpp */; };
- 1CE83AC40ADAFFD8009354F6 /* DeleteButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C4C8F630AD8655D009475CE /* DeleteButton.cpp */; };
1CF6BDFA0E9BB26A0025E1CD /* ObjCEventListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CF6BDF80E9BB26A0025E1CD /* ObjCEventListener.h */; };
1CF6BDFB0E9BB26A0025E1CD /* ObjCEventListener.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF6BDF90E9BB26A0025E1CD /* ObjCEventListener.mm */; };
1CF6BE140E9BB4670025E1CD /* ObjCNodeFilterCondition.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF6BE120E9BB4670025E1CD /* ObjCNodeFilterCondition.mm */; };
930908910AF7EDE40081DF01 /* HitTestRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 930908900AF7EDE40081DF01 /* HitTestRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
930C90DD19CF965300D6C21A /* InlineIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930C90DC19CF965300D6C21A /* InlineIterator.cpp */; };
930FC68A1072B9280045293E /* TextRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 930FC6891072B9280045293E /* TextRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 93153BCD1417FBBF00FCF5BE /* deleteButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BCC1417FBBF00FCF5BE /* deleteButton@2x.png */; };
- 93153BCF1417FBDB00FCF5BE /* deleteButtonPressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BCE1417FBDB00FCF5BE /* deleteButtonPressed@2x.png */; };
93153BDA14181F7A00FCF5BE /* missingImage@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BD914181F7A00FCF5BE /* missingImage@2x.png */; };
93153BDC141959BC00FCF5BE /* textAreaResizeCorner.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BDB141959BB00FCF5BE /* textAreaResizeCorner.png */; };
- 93153BDE141959F400FCF5BE /* deleteButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BDD141959F400FCF5BE /* deleteButton.png */; };
- 93153BE014195A2800FCF5BE /* deleteButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BDF14195A2800FCF5BE /* deleteButtonPressed.png */; };
93153BE214195A5700FCF5BE /* missingImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 93153BE114195A5700FCF5BE /* missingImage.png */; };
931BCC611124DFCB00BE70DD /* MediaCanStartListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
931CBD0C161A44E900E4C874 /* ScrollingStateNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 931CBD06161A44E900E4C874 /* ScrollingStateNode.cpp */; };
1C2417B91992C04100EF9938 /* SpellingDot@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "SpellingDot@3x.png"; sourceTree = "<group>"; };
1C2649790D7E248A00BD10F2 /* DocumentLoaderMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentLoaderMac.cpp; sourceTree = "<group>"; };
1C26497B0D7E24EC00BD10F2 /* PageMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageMac.cpp; sourceTree = "<group>"; };
- 1C4C8EFF0AD85D87009475CE /* DeleteButtonController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeleteButtonController.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- 1C4C8F000AD85D87009475CE /* DeleteButtonController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeleteButtonController.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- 1C4C8F630AD8655D009475CE /* DeleteButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeleteButton.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- 1C4C8F640AD8655D009475CE /* DeleteButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeleteButton.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
1C5E980F1A02CEFA002DB55F /* CoreTextSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreTextSPI.h; sourceTree = "<group>"; };
1C81B9560E97330800266E07 /* InspectorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorController.h; sourceTree = "<group>"; };
1C81B9570E97330800266E07 /* InspectorController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorController.cpp; sourceTree = "<group>"; };
930908900AF7EDE40081DF01 /* HitTestRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HitTestRequest.h; sourceTree = "<group>"; };
930C90DC19CF965300D6C21A /* InlineIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineIterator.cpp; sourceTree = "<group>"; };
930FC6891072B9280045293E /* TextRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextRenderingMode.h; sourceTree = "<group>"; };
- 93153BCC1417FBBF00FCF5BE /* deleteButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "deleteButton@2x.png"; sourceTree = "<group>"; };
- 93153BCE1417FBDB00FCF5BE /* deleteButtonPressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "deleteButtonPressed@2x.png"; sourceTree = "<group>"; };
93153BD914181F7A00FCF5BE /* missingImage@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "missingImage@2x.png"; sourceTree = "<group>"; };
93153BDB141959BB00FCF5BE /* textAreaResizeCorner.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = textAreaResizeCorner.png; sourceTree = "<group>"; };
- 93153BDD141959F400FCF5BE /* deleteButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = deleteButton.png; sourceTree = "<group>"; };
- 93153BDF14195A2800FCF5BE /* deleteButtonPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = deleteButtonPressed.png; sourceTree = "<group>"; };
93153BE114195A5700FCF5BE /* missingImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = missingImage.png; sourceTree = "<group>"; };
931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaCanStartListener.h; sourceTree = "<group>"; };
931CBD06161A44E900E4C874 /* ScrollingStateNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingStateNode.cpp; sourceTree = "<group>"; };
65998A650E5F5FD3004E097A /* images */,
46F9D5DA0B0D60170028EE36 /* aliasCursor.png */,
46D4F2460AF97E810035385A /* cellCursor.png */,
- 93153BDD141959F400FCF5BE /* deleteButton.png */,
- 93153BCC1417FBBF00FCF5BE /* deleteButton@2x.png */,
- 93153BDF14195A2800FCF5BE /* deleteButtonPressed.png */,
- 93153BCE1417FBDB00FCF5BE /* deleteButtonPressed@2x.png */,
85136C890AED665800F90A3D /* eastResizeCursor.png */,
85136C8A0AED665800F90A3D /* eastWestResizeCursor.png */,
85136C8B0AED665800F90A3D /* helpCursor.png */,
93309D8E099E64910056E581 /* CompositeEditCommand.h */,
D0B0556709C6700100307E43 /* CreateLinkCommand.cpp */,
D0B0556609C6700100307E43 /* CreateLinkCommand.h */,
- 1C4C8F630AD8655D009475CE /* DeleteButton.cpp */,
- 1C4C8F640AD8655D009475CE /* DeleteButton.h */,
- 1C4C8EFF0AD85D87009475CE /* DeleteButtonController.cpp */,
- 1C4C8F000AD85D87009475CE /* DeleteButtonController.h */,
93309D8F099E64910056E581 /* DeleteFromTextNodeCommand.cpp */,
93309D90099E64910056E581 /* DeleteFromTextNodeCommand.h */,
93309D91099E64910056E581 /* DeleteSelectionCommand.cpp */,
FD31602C12B0267600C1A359 /* DelayDSPKernel.h in Headers */,
FD31602E12B0267600C1A359 /* DelayNode.h in Headers */,
FD31603112B0267600C1A359 /* DelayProcessor.h in Headers */,
- 1C4C8F660AD8655D009475CE /* DeleteButton.h in Headers */,
- 1C4C8F020AD85D87009475CE /* DeleteButtonController.h in Headers */,
93309DDF099E64920056E581 /* DeleteFromTextNodeCommand.h in Headers */,
93309DE1099E64920056E581 /* DeleteSelectionCommand.h in Headers */,
FD1660A513787C6D001FFA7B /* DenormalDisabler.h in Headers */,
46F9D5DD0B0D60170028EE36 /* aliasCursor.png in Resources */,
1C2417BA1992C04100EF9938 /* SpellingDot@3x.png in Resources */,
46D4F2490AF97E810035385A /* cellCursor.png in Resources */,
- 93153BDE141959F400FCF5BE /* deleteButton.png in Resources */,
- 93153BCD1417FBBF00FCF5BE /* deleteButton@2x.png in Resources */,
- 93153BE014195A2800FCF5BE /* deleteButtonPressed.png in Resources */,
- 93153BCF1417FBDB00FCF5BE /* deleteButtonPressed@2x.png in Resources */,
D02B64B214089E56006EFA21 /* DictationPhraseWithAlternativesDot.png in Resources */,
D02B64B314089E56006EFA21 /* DictationPhraseWithAlternativesDot@2x.png in Resources */,
85136C990AED665900F90A3D /* eastResizeCursor.png in Resources */,
FD31602B12B0267600C1A359 /* DelayDSPKernel.cpp in Sources */,
FD31602D12B0267600C1A359 /* DelayNode.cpp in Sources */,
FD31603012B0267600C1A359 /* DelayProcessor.cpp in Sources */,
- 1CE83AC40ADAFFD8009354F6 /* DeleteButton.cpp in Sources */,
- 1CE83AC30ADAFFD7009354F6 /* DeleteButtonController.cpp in Sources */,
93309DDE099E64920056E581 /* DeleteFromTextNodeCommand.cpp in Sources */,
93309DE0099E64920056E581 /* DeleteSelectionCommand.cpp in Sources */,
E100EE751546EAC100BA11D1 /* DeprecatedStyleBuilder.cpp in Sources */,
#include "TemplateContentDocumentFragment.h"
#include <wtf/CurrentTime.h>
-#if ENABLE(DELETION_UI)
-#include "DeleteButtonController.h"
-#endif
-
namespace WebCore {
static void dispatchChildInsertionEvents(Node&);
invalidateNodeListAndCollectionCachesInAncestors();
}
-inline static void cloneChildNodesAvoidingDeleteButton(ContainerNode* parent, ContainerNode* clonedParent, HTMLElement* deleteButtonContainerElement)
+void ContainerNode::cloneChildNodes(ContainerNode *clone)
{
ExceptionCode ec = 0;
- for (Node* child = parent->firstChild(); child && !ec; child = child->nextSibling()) {
-
-#if ENABLE(DELETION_UI)
- if (child == deleteButtonContainerElement)
- continue;
-#else
- UNUSED_PARAM(deleteButtonContainerElement);
-#endif
-
+ for (Node* child = firstChild(); child && !ec; child = child->nextSibling()) {
RefPtr<Node> clonedChild = child->cloneNode(false);
- clonedParent->appendChild(clonedChild, ec);
+ clone->appendChild(clonedChild, ec);
if (!ec && is<ContainerNode>(child))
- cloneChildNodesAvoidingDeleteButton(downcast<ContainerNode>(child), downcast<ContainerNode>(clonedChild.get()), deleteButtonContainerElement);
+ downcast<ContainerNode>(child)->cloneChildNodes(downcast<ContainerNode>(clonedChild.get()));
}
}
-void ContainerNode::cloneChildNodes(ContainerNode *clone)
-{
-#if ENABLE(DELETION_UI)
- HTMLElement* deleteButtonContainerElement = 0;
- if (Frame* frame = document().frame())
- deleteButtonContainerElement = frame->editor().deleteButtonController().containerElement();
- cloneChildNodesAvoidingDeleteButton(this, clone, deleteButtonContainerElement);
-#else
- cloneChildNodesAvoidingDeleteButton(this, clone, 0);
-#endif
-}
-
bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const
{
if (!renderer())
#include "htmlediting.h"
#include "markup.h"
-#if ENABLE(DELETION_UI)
-#include "DeleteButtonController.h"
-#endif
-
-
namespace WebCore {
using namespace HTMLNames;
frame->editor().cancelComposition();
#endif
- {
-#if ENABLE(DELETION_UI)
- DeleteButtonControllerDisableScope deleteButtonControllerDisableScope(frame.get());
-#endif
-
- size_t size = m_commands.size();
- for (size_t i = size; i; --i)
- m_commands[i - 1]->doUnapply();
- }
+ size_t size = m_commands.size();
+ for (size_t i = size; i; --i)
+ m_commands[i - 1]->doUnapply();
frame->editor().unappliedEditing(this);
}
// if one is necessary (like for the creation of VisiblePositions).
m_document->updateLayoutIgnorePendingStylesheets();
- {
-#if ENABLE(DELETION_UI)
- DeleteButtonControllerDisableScope deleteButtonControllerDisableScope(frame.get());
-#endif
- size_t size = m_commands.size();
- for (size_t i = 0; i != size; ++i)
- m_commands[i]->doReapply();
- }
-
+ size_t size = m_commands.size();
+ for (size_t i = 0; i != size; ++i)
+ m_commands[i]->doReapply();
+
frame->editor().reappliedEditing(this);
}
{
EventQueueScope eventQueueScope;
-#if ENABLE(DELETION_UI)
- DeleteButtonControllerDisableScope deleteButtonControllerDisableScope(&frame());
-#endif
doApply();
}
+++ /dev/null
-/*
- * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "DeleteButton.h"
-
-#include "DeleteButtonController.h"
-#include "Document.h"
-#include "Event.h"
-#include "EventNames.h"
-#include "HTMLNames.h"
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-#if ENABLE(DELETION_UI)
-
-inline DeleteButton::DeleteButton(Document& document)
- : HTMLImageElement(imgTag, document)
-{
-}
-
-PassRefPtr<DeleteButton> DeleteButton::create(Document& document)
-{
- return adoptRef(new DeleteButton(document));
-}
-
-void DeleteButton::defaultEventHandler(Event* event)
-{
- if (event->type() == eventNames().clickEvent) {
- document().frame()->editor().deleteButtonController().deleteTarget();
- event->setDefaultHandled();
- return;
- }
-
- HTMLImageElement::defaultEventHandler(event);
-}
-#endif
-
-} // namespace
+++ /dev/null
-/*
- * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DeleteButton_h
-#define DeleteButton_h
-
-#include "HTMLImageElement.h"
-
-namespace WebCore {
-
-class DeleteButton : public HTMLImageElement {
-public:
- static PassRefPtr<DeleteButton> create(Document&);
-
- virtual bool willRespondToMouseClickEvents() override { return true; }
-
-private:
- explicit DeleteButton(Document&);
-
- virtual void defaultEventHandler(Event*);
-};
-
-} // namespace
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "DeleteButtonController.h"
-
-#include "CachedImage.h"
-#include "CSSPrimitiveValue.h"
-#include "CompositeEditCommand.h"
-#include "Document.h"
-#include "EditorClient.h"
-#include "htmlediting.h"
-#include "HTMLDivElement.h"
-#include "HTMLNames.h"
-#include "Image.h"
-#include "Node.h"
-#include "Page.h"
-#include "RemoveNodeCommand.h"
-#include "RenderBox.h"
-#include "RenderTable.h"
-#include "RenderTableCell.h"
-#include "StyleProperties.h"
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-#if ENABLE(DELETION_UI)
-
-const char* const DeleteButtonController::containerElementIdentifier = "WebKit-Editing-Delete-Container";
-const char* const DeleteButtonController::buttonElementIdentifier = "WebKit-Editing-Delete-Button";
-const char* const DeleteButtonController::outlineElementIdentifier = "WebKit-Editing-Delete-Outline";
-
-DeleteButtonController::DeleteButtonController(Frame& frame)
- : m_frame(frame)
- , m_wasStaticPositioned(false)
- , m_wasAutoZIndex(false)
- , m_disableStack(0)
-{
-}
-
-static bool isDeletableElement(const Node* node)
-{
- if (!node || !node->isHTMLElement() || !node->inDocument() || !node->hasEditableStyle())
- return false;
-
- // In general we want to only draw the UI around object of a certain area, but we still keep the min width/height to
- // make sure we don't end up with very thin or very short elements getting the UI.
- const int minimumArea = 2500;
- const int minimumWidth = 48;
- const int minimumHeight = 16;
- const unsigned minimumVisibleBorders = 1;
-
- RenderObject* renderer = node->renderer();
- if (!is<RenderBox>(renderer))
- return false;
-
- // Disallow the body element since it isn't practical to delete, and the deletion UI would be clipped.
- if (node->hasTagName(bodyTag))
- return false;
-
- // Disallow elements with any overflow clip, since the deletion UI would be clipped as well. <rdar://problem/6840161>
- if (renderer->hasOverflowClip())
- return false;
-
- // Disallow Mail blockquotes since the deletion UI would get in the way of editing for these.
- if (isMailBlockquote(node))
- return false;
-
- RenderBox& box = downcast<RenderBox>(*renderer);
- IntRect borderBoundingBox = box.borderBoundingBox();
- if (borderBoundingBox.width() < minimumWidth || borderBoundingBox.height() < minimumHeight)
- return false;
-
- if ((borderBoundingBox.width() * borderBoundingBox.height()) < minimumArea)
- return false;
-
- if (is<RenderTable>(box))
- return true;
-
- if (is<HTMLUListElement>(*node) || is<HTMLOListElement>(*node) || is<HTMLIFrameElement>(*node))
- return true;
-
- if (box.isOutOfFlowPositioned())
- return true;
-
- if (is<RenderBlock>(box) && !is<RenderTableCell>(box)) {
- const RenderStyle& style = box.style();
-
- // Allow blocks that have background images
- if (style.hasBackgroundImage()) {
- for (const FillLayer* background = style.backgroundLayers(); background; background = background->next()) {
- if (background->image() && background->image()->canRender(&box, 1))
- return true;
- }
- }
-
- // Allow blocks with a minimum number of non-transparent borders
- unsigned visibleBorders = style.borderTop().isVisible() + style.borderBottom().isVisible() + style.borderLeft().isVisible() + style.borderRight().isVisible();
- if (visibleBorders >= minimumVisibleBorders)
- return true;
-
- // Allow blocks that have a different background from it's parent
- ContainerNode* parentNode = node->parentNode();
- if (!parentNode)
- return false;
-
- auto* parentRenderer = parentNode->renderer();
- if (!parentRenderer)
- return false;
-
- const RenderStyle& parentStyle = parentRenderer->style();
-
- if (box.hasBackground() && (!parentRenderer->hasBackground() || style.visitedDependentColor(CSSPropertyBackgroundColor) != parentStyle.visitedDependentColor(CSSPropertyBackgroundColor)))
- return true;
- }
-
- return false;
-}
-
-static HTMLElement* enclosingDeletableElement(const VisibleSelection& selection)
-{
- if (!selection.isContentEditable())
- return 0;
-
- RefPtr<Range> range = selection.toNormalizedRange();
- if (!range)
- return nullptr;
-
- Node* container = range->commonAncestorContainer(ASSERT_NO_EXCEPTION);
- ASSERT(container);
-
- // The enclosingNodeOfType function only works on nodes that are editable
- // and capable of having editing positions inside them (which is strange, given its name).
- if (!container->hasEditableStyle() || editingIgnoresContent(container))
- return nullptr;
-
- Node* element = enclosingNodeOfType(firstPositionInNode(container), &isDeletableElement);
- return is<HTMLElement>(element) ? downcast<HTMLElement>(element) : nullptr;
-}
-
-void DeleteButtonController::respondToChangedSelection(const VisibleSelection& oldSelection)
-{
- if (!enabled())
- return;
-
- HTMLElement* oldElement = enclosingDeletableElement(oldSelection);
- HTMLElement* newElement = enclosingDeletableElement(m_frame.selection().selection());
- if (oldElement == newElement)
- return;
-
- // If the base is inside a deletable element, give the element a delete widget.
- if (newElement)
- show(newElement);
- else
- hide();
-}
-
-void DeleteButtonController::deviceScaleFactorChanged()
-{
- if (!enabled())
- return;
-
- HTMLElement* currentTarget = m_target.get();
- hide();
-
- // Setting m_containerElement to 0 will force the deletionUI to be re-created with
- // artwork of the appropriate resolution in show().
- m_containerElement = 0;
- show(currentTarget);
-}
-
-void DeleteButtonController::createDeletionUI()
-{
- RefPtr<HTMLDivElement> container = HTMLDivElement::create(m_target->document());
- container->setIdAttribute(containerElementIdentifier);
-
- container->setInlineStyleProperty(CSSPropertyWebkitUserDrag, CSSValueNone);
- container->setInlineStyleProperty(CSSPropertyWebkitUserSelect, CSSValueNone);
- container->setInlineStyleProperty(CSSPropertyWebkitUserModify, CSSValueReadOnly);
- container->setInlineStyleProperty(CSSPropertyVisibility, CSSValueHidden);
- container->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
- container->setInlineStyleProperty(CSSPropertyCursor, CSSValueDefault);
- container->setInlineStyleProperty(CSSPropertyTop, 0, CSSPrimitiveValue::CSS_PX);
- container->setInlineStyleProperty(CSSPropertyRight, 0, CSSPrimitiveValue::CSS_PX);
- container->setInlineStyleProperty(CSSPropertyBottom, 0, CSSPrimitiveValue::CSS_PX);
- container->setInlineStyleProperty(CSSPropertyLeft, 0, CSSPrimitiveValue::CSS_PX);
-
- RefPtr<HTMLDivElement> outline = HTMLDivElement::create(m_target->document());
- outline->setIdAttribute(outlineElementIdentifier);
-
- const int borderWidth = 4;
- const int borderRadius = 6;
-
- outline->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
- outline->setInlineStyleProperty(CSSPropertyZIndex, ASCIILiteral("-1000000"));
- outline->setInlineStyleProperty(CSSPropertyTop, -borderWidth - m_target->renderBox()->borderTop(), CSSPrimitiveValue::CSS_PX);
- outline->setInlineStyleProperty(CSSPropertyRight, -borderWidth - m_target->renderBox()->borderRight(), CSSPrimitiveValue::CSS_PX);
- outline->setInlineStyleProperty(CSSPropertyBottom, -borderWidth - m_target->renderBox()->borderBottom(), CSSPrimitiveValue::CSS_PX);
- outline->setInlineStyleProperty(CSSPropertyLeft, -borderWidth - m_target->renderBox()->borderLeft(), CSSPrimitiveValue::CSS_PX);
- outline->setInlineStyleProperty(CSSPropertyBorderWidth, borderWidth, CSSPrimitiveValue::CSS_PX);
- outline->setInlineStyleProperty(CSSPropertyBorderStyle, CSSValueSolid);
- outline->setInlineStyleProperty(CSSPropertyBorderColor, ASCIILiteral("rgba(0, 0, 0, 0.6)"));
- outline->setInlineStyleProperty(CSSPropertyBorderRadius, borderRadius, CSSPrimitiveValue::CSS_PX);
- outline->setInlineStyleProperty(CSSPropertyVisibility, CSSValueVisible);
-
- ExceptionCode ec = 0;
- container->appendChild(outline.get(), ec);
- ASSERT(!ec);
- if (ec)
- return;
-
- RefPtr<DeleteButton> button = DeleteButton::create(m_target->document());
- button->setIdAttribute(buttonElementIdentifier);
-
- const int buttonWidth = 30;
- const int buttonHeight = 30;
- const int buttonBottomShadowOffset = 2;
-
- button->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
- button->setInlineStyleProperty(CSSPropertyZIndex, ASCIILiteral("1000000"));
- button->setInlineStyleProperty(CSSPropertyTop, (-buttonHeight / 2) - m_target->renderBox()->borderTop() - (borderWidth / 2) + buttonBottomShadowOffset, CSSPrimitiveValue::CSS_PX);
- button->setInlineStyleProperty(CSSPropertyLeft, (-buttonWidth / 2) - m_target->renderBox()->borderLeft() - (borderWidth / 2), CSSPrimitiveValue::CSS_PX);
- button->setInlineStyleProperty(CSSPropertyWidth, buttonWidth, CSSPrimitiveValue::CSS_PX);
- button->setInlineStyleProperty(CSSPropertyHeight, buttonHeight, CSSPrimitiveValue::CSS_PX);
- button->setInlineStyleProperty(CSSPropertyVisibility, CSSValueVisible);
-
- RefPtr<Image> buttonImage;
- if (m_target->document().deviceScaleFactor() >= 2)
- buttonImage = Image::loadPlatformResource("deleteButton@2x");
- else
- buttonImage = Image::loadPlatformResource("deleteButton");
-
- if (buttonImage->isNull())
- return;
-
- button->setCachedImage(new CachedImage(buttonImage.get(), m_frame.page()->sessionID()));
-
- container->appendChild(button.get(), ec);
- ASSERT(!ec);
- if (ec)
- return;
-
- m_containerElement = container.release();
- m_outlineElement = outline.release();
- m_buttonElement = button.release();
-}
-
-void DeleteButtonController::show(HTMLElement* element)
-{
- hide();
-
- if (!enabled() || !element || !element->inDocument() || !isDeletableElement(element))
- return;
-
- EditorClient* client = m_frame.editor().client();
- if (!client || !client->shouldShowDeleteInterface(element))
- return;
-
- // we rely on the renderer having current information, so we should update the layout if needed
- m_frame.document()->updateLayoutIgnorePendingStylesheets();
-
- m_target = element;
-
- if (!m_containerElement) {
- createDeletionUI();
- if (!m_containerElement) {
- hide();
- return;
- }
- }
-
- ExceptionCode ec = 0;
- m_target->appendChild(m_containerElement.get(), ec);
- ASSERT(!ec);
- if (ec) {
- hide();
- return;
- }
-
- if (m_target->renderer()->style().position() == StaticPosition) {
- m_target->setInlineStyleProperty(CSSPropertyPosition, CSSValueRelative);
- m_wasStaticPositioned = true;
- }
-
- if (m_target->renderer()->style().hasAutoZIndex()) {
- m_target->setInlineStyleProperty(CSSPropertyZIndex, ASCIILiteral("0"));
- m_wasAutoZIndex = true;
- }
-}
-
-void DeleteButtonController::hide()
-{
- m_outlineElement = 0;
- m_buttonElement = 0;
-
- if (m_containerElement && m_containerElement->parentNode())
- m_containerElement->parentNode()->removeChild(m_containerElement.get(), IGNORE_EXCEPTION);
-
- if (m_target) {
- if (m_wasStaticPositioned)
- m_target->setInlineStyleProperty(CSSPropertyPosition, CSSValueStatic);
- if (m_wasAutoZIndex)
- m_target->setInlineStyleProperty(CSSPropertyZIndex, CSSValueAuto);
- }
-
- m_wasStaticPositioned = false;
- m_wasAutoZIndex = false;
-}
-
-void DeleteButtonController::enable()
-{
- ASSERT(m_disableStack > 0);
- if (m_disableStack > 0)
- m_disableStack--;
- if (enabled()) {
- // Determining if the element is deletable currently depends on style
- // because whether something is editable depends on style, so we need
- // to recalculate style before calling enclosingDeletableElement.
- m_frame.document()->updateStyleIfNeeded();
- show(enclosingDeletableElement(m_frame.selection().selection()));
- }
-}
-
-void DeleteButtonController::disable()
-{
- if (enabled())
- hide();
- m_disableStack++;
-}
-
-class RemoveTargetCommand : public CompositeEditCommand {
-public:
- static PassRefPtr<RemoveTargetCommand> create(Document& document, PassRefPtr<Node> target)
- {
- return adoptRef(new RemoveTargetCommand(document, target));
- }
-
-private:
- RemoveTargetCommand(Document& document, PassRefPtr<Node> target)
- : CompositeEditCommand(document)
- , m_target(target)
- { }
-
- void doApply()
- {
- removeNode(m_target);
- }
-
-private:
- RefPtr<Node> m_target;
-};
-
-void DeleteButtonController::deleteTarget()
-{
- if (!enabled() || !m_target)
- return;
-
- hide();
-
- // Because the deletion UI only appears when the selection is entirely
- // within the target, we unconditionally update the selection to be
- // a caret where the target had been.
- Position pos = positionInParentBeforeNode(m_target.get());
- ASSERT(m_frame.document());
- applyCommand(RemoveTargetCommand::create(*m_frame.document(), m_target));
- m_frame.selection().setSelection(VisiblePosition(pos));
-}
-#endif
-
-} // namespace WebCore
+++ /dev/null
-/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DeleteButtonController_h
-#define DeleteButtonController_h
-
-#if ENABLE(DELETION_UI)
-
-#include "DeleteButton.h"
-#include "Editor.h"
-#include "Frame.h"
-
-namespace WebCore {
-
-class DeleteButton;
-class HTMLElement;
-class RenderObject;
-class VisibleSelection;
-
-class DeleteButtonController {
- WTF_MAKE_NONCOPYABLE(DeleteButtonController); WTF_MAKE_FAST_ALLOCATED;
-public:
- explicit DeleteButtonController(Frame&);
-
- HTMLElement* containerElement() const { return m_containerElement.get(); }
-
- void respondToChangedSelection(const VisibleSelection& oldSelection);
-
- void deviceScaleFactorChanged();
-
- void show(HTMLElement*);
- void hide();
-
- void deleteTarget();
-
-private:
- static const char* const buttonElementIdentifier;
- static const char* const outlineElementIdentifier;
- static const char* const containerElementIdentifier;
-
- void enable();
- void disable();
- friend class DeleteButtonControllerDisableScope;
-
- void createDeletionUI();
- bool enabled() const { return (!m_disableStack); }
-
- Frame& m_frame;
- RefPtr<HTMLElement> m_target;
- RefPtr<HTMLElement> m_containerElement;
- RefPtr<HTMLElement> m_outlineElement;
- RefPtr<DeleteButton> m_buttonElement;
- bool m_wasStaticPositioned;
- bool m_wasAutoZIndex;
- unsigned m_disableStack;
-};
-
-class DeleteButtonControllerDisableScope {
-public:
- DeleteButtonControllerDisableScope(Frame* frame)
- : m_frame(frame)
- {
- if (frame)
- frame->editor().deleteButtonController().disable();
- }
-
- ~DeleteButtonControllerDisableScope()
- {
- if (m_frame)
- m_frame->editor().deleteButtonController().enable();
- }
-
-private:
- RefPtr<Frame> m_frame;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(DELETION_UI)
-
-#endif // DeleteButtonController_h
, m_parent(0)
{
ASSERT(document.frame());
- setStartingSelection(m_document->frame()->editor().avoidIntersectionWithDeleteButtonController(m_document->frame()->selection().selection()));
+ setStartingSelection(m_document->frame()->selection().selection());
setEndingSelection(m_startingSelection);
}
#include "markup.h"
#include <wtf/unicode/CharacterNames.h>
-#if ENABLE(DELETION_UI)
-#include "DeleteButtonController.h"
-#endif
-
#if PLATFORM(IOS)
#include "DictationCommandIOS.h"
#include <wtf/text/StringBuilder.h>
using namespace WTF;
using namespace Unicode;
-#if ENABLE(DELETION_UI)
-
-PassRefPtr<Range> Editor::avoidIntersectionWithDeleteButtonController(const Range* range) const
-{
- if (!range)
- return 0;
-
- Node* startContainer = range->startContainer();
- int startOffset = range->startOffset();
- Node* endContainer = range->endContainer();
- int endOffset = range->endOffset();
-
- if (!startContainer)
- return 0;
-
- ASSERT(endContainer);
-
- Element* element = m_deleteButtonController->containerElement();
- if (startContainer == element || startContainer->isDescendantOf(element)) {
- ASSERT(element->parentNode());
- startContainer = element->parentNode();
- startOffset = element->computeNodeIndex();
- }
- if (endContainer == element || endContainer->isDescendantOf(element)) {
- ASSERT(element->parentNode());
- endContainer = element->parentNode();
- endOffset = element->computeNodeIndex();
- }
-
- return Range::create(range->ownerDocument(), startContainer, startOffset, endContainer, endOffset);
-}
-
-VisibleSelection Editor::avoidIntersectionWithDeleteButtonController(const VisibleSelection& selection) const
-{
- if (selection.isNone())
- return selection;
-
- Element* element = m_deleteButtonController->containerElement();
- if (!element)
- return selection;
- VisibleSelection updatedSelection = selection;
-
- Position updatedBase = selection.base();
- updatePositionForNodeRemoval(updatedBase, element);
- if (updatedBase != selection.base())
- updatedSelection.setBase(updatedBase);
-
- Position updatedExtent = selection.extent();
- updatePositionForNodeRemoval(updatedExtent, element);
- if (updatedExtent != selection.extent())
- updatedSelection.setExtent(updatedExtent);
-
- return updatedSelection;
-}
-
-#endif
-
// When an event handler has moved the selection outside of a text control
// we should use the target control's selection for this editing operation.
VisibleSelection Editor::selectionForCommand(Event* event)
Editor::Editor(Frame& frame)
: m_frame(frame)
-#if ENABLE(DELETION_UI)
- , m_deleteButtonController(std::make_unique<DeleteButtonController>(frame))
-#endif
, m_ignoreCompositionSelectionChange(false)
, m_shouldStartNewKillRingSequence(false)
// This is off by default, since most editors want this behavior (this matches IE but not FF).
m_customCompositionUnderlines.clear();
m_shouldStyleWithCSS = false;
m_defaultParagraphSeparator = EditorParagraphSeparatorIsDiv;
-
-#if ENABLE(DELETION_UI)
- m_deleteButtonController = std::make_unique<DeleteButtonController>(m_frame);
-#endif
}
bool Editor::insertText(const String& text, Event* triggeringEvent)
IntPoint framePoint = frameView->windowToContents(windowPoint);
VisibleSelection selection(frame->visiblePositionForPoint(framePoint));
- return avoidIntersectionWithDeleteButtonController(selection.toNormalizedRange().get());
+ return selection.toNormalizedRange();
}
void Editor::revealSelectionAfterEditingOperation(const ScrollAlignment& alignment, RevealExtentOption revealExtentOption)
if (!isContinuousGrammarCheckingEnabled)
document().markers().removeMarkers(DocumentMarker::Grammar);
-#if ENABLE(DELETION_UI)
- m_deleteButtonController->respondToChangedSelection(oldSelection);
-#endif
if (!m_editorUIUpdateTimerWasTriggeredByDictation)
m_alternativeTextController->respondToChangedSelection(oldSelection);
return checkingTypes;
}
-void Editor::deviceScaleFactorChanged()
-{
-#if ENABLE(DELETION_UI)
- m_deleteButtonController->deviceScaleFactorChanged();
-#endif
-}
-
bool Editor::unifiedTextCheckerEnabled() const
{
return WebCore::unifiedTextCheckerEnabled(&m_frame);
WEBCORE_EXPORT void simplifyMarkup(Node* startNode, Node* endNode);
- void deviceScaleFactorChanged();
-
EditorParagraphSeparator defaultParagraphSeparator() const { return m_defaultParagraphSeparator; }
void setDefaultParagraphSeparator(EditorParagraphSeparator separator) { m_defaultParagraphSeparator = separator; }
Vector<String> dictationAlternativesForMarker(const DocumentMarker*);
void applyDictationAlternativelternative(const String& alternativeString);
- PassRefPtr<Range> avoidIntersectionWithDeleteButtonController(const Range*) const;
- VisibleSelection avoidIntersectionWithDeleteButtonController(const VisibleSelection&) const;
-
#if USE(APPKIT)
WEBCORE_EXPORT void uppercaseWord();
WEBCORE_EXPORT void lowercaseWord();
WEBCORE_EXPORT void toggleAutomaticSpellingCorrection();
#endif
-#if ENABLE(DELETION_UI)
- DeleteButtonController& deleteButtonController() const { return *m_deleteButtonController; }
-#endif
-
PassRefPtr<DocumentFragment> webContentFromPasteboard(Pasteboard&, Range& context, bool allowPlainText, bool& chosePlainText);
#if PLATFORM(COCOA)
#endif
Frame& m_frame;
-#if ENABLE(DELETION_UI)
- std::unique_ptr<DeleteButtonController> m_deleteButtonController;
-#endif
RefPtr<CompositeEditCommand> m_lastEditCommand;
RefPtr<Text> m_compositionNode;
unsigned m_compositionStart;
return m_areMarkedTextMatchesHighlighted;
}
-#if !ENABLE(DELETION_UI)
-
-inline PassRefPtr<Range> Editor::avoidIntersectionWithDeleteButtonController(const Range* range) const
-{
- return const_cast<Range*>(range);
-}
-
-inline VisibleSelection Editor::avoidIntersectionWithDeleteButtonController(const VisibleSelection& selection) const
-{
- return selection;
-}
-
-#endif
-
} // namespace WebCore
#endif // Editor_h
{
}
-String MarkupAccumulator::serializeNodes(Node& targetNode, Node* nodeToSkip, EChildrenOnly childrenOnly, Vector<QualifiedName>* tagNamesToSkip)
+String MarkupAccumulator::serializeNodes(Node& targetNode, EChildrenOnly childrenOnly, Vector<QualifiedName>* tagNamesToSkip)
{
- serializeNodesWithNamespaces(targetNode, nodeToSkip, childrenOnly, 0, tagNamesToSkip);
+ serializeNodesWithNamespaces(targetNode, childrenOnly, 0, tagNamesToSkip);
return m_markup.toString();
}
-void MarkupAccumulator::serializeNodesWithNamespaces(Node& targetNode, Node* nodeToSkip, EChildrenOnly childrenOnly, const Namespaces* namespaces, Vector<QualifiedName>* tagNamesToSkip)
+void MarkupAccumulator::serializeNodesWithNamespaces(Node& targetNode, EChildrenOnly childrenOnly, const Namespaces* namespaces, Vector<QualifiedName>* tagNamesToSkip)
{
- if (&targetNode == nodeToSkip)
- return;
-
if (tagNamesToSkip && is<Element>(targetNode)) {
for (auto& name : *tagNamesToSkip) {
if (downcast<Element>(targetNode).hasTagName(name))
Node* current = targetNode.firstChild();
#endif
for ( ; current; current = current->nextSibling())
- serializeNodesWithNamespaces(*current, nodeToSkip, IncludeNode, &namespaceHash, tagNamesToSkip);
+ serializeNodesWithNamespaces(*current, IncludeNode, &namespaceHash, tagNamesToSkip);
}
if (!childrenOnly)
MarkupAccumulator(Vector<Node*>*, EAbsoluteURLs, const Range* = 0, EFragmentSerialization = HTMLFragmentSerialization);
virtual ~MarkupAccumulator();
- String serializeNodes(Node& targetNode, Node* nodeToSkip, EChildrenOnly, Vector<QualifiedName>* tagNamesToSkip = nullptr);
+ String serializeNodes(Node& targetNode, EChildrenOnly, Vector<QualifiedName>* tagNamesToSkip = nullptr);
static void appendCharactersReplacingEntities(StringBuilder&, const String&, unsigned, unsigned, EntityMask);
private:
String resolveURLIfNeeded(const Element&, const String&) const;
void appendQuotedURLAttributeValue(StringBuilder&, const Element&, const Attribute&);
- void serializeNodesWithNamespaces(Node& targetNode, Node* nodeToSkip, EChildrenOnly, const Namespaces*, Vector<QualifiedName>* tagNamesToSkip);
+ void serializeNodesWithNamespaces(Node& targetNode, EChildrenOnly, const Namespaces*, Vector<QualifiedName>* tagNamesToSkip);
bool inXMLFragmentSerialization() const { return m_fragmentSerialization == XMLFragmentSerialization; }
void generateUniquePrefix(QualifiedName&, const Namespaces&);
#include <wtf/StdLibExtras.h>
#include <wtf/text/StringBuilder.h>
-#if ENABLE(DELETION_UI)
-#include "DeleteButtonController.h"
-#endif
-
namespace WebCore {
using namespace HTMLNames;
// FIXME: Shouldn't we omit style info when annotate == DoNotAnnotateForInterchange?
// FIXME: At least, annotation and style info should probably not be included in range.markupString()
-static String createMarkupInternal(Document& document, const Range& range, const Range& updatedRange, Vector<Node*>* nodes,
+static String createMarkupInternal(Document& document, const Range& range, Vector<Node*>* nodes,
EAnnotateForInterchange shouldAnnotate, bool convertBlocksToInlines, EAbsoluteURLs shouldResolveURLs)
{
DEPRECATED_DEFINE_STATIC_LOCAL(const String, interchangeNewlineString, (ASCIILiteral("<br class=\"" AppleInterchangeNewline "\">")));
- bool collapsed = updatedRange.collapsed(ASSERT_NO_EXCEPTION);
+ bool collapsed = range.collapsed(ASSERT_NO_EXCEPTION);
if (collapsed)
return emptyString();
- Node* commonAncestor = updatedRange.commonAncestorContainer(ASSERT_NO_EXCEPTION);
+ Node* commonAncestor = range.commonAncestorContainer(ASSERT_NO_EXCEPTION);
if (!commonAncestor)
return emptyString();
if (body && VisiblePosition(firstPositionInNode(body)) == VisiblePosition(range.startPosition())
&& VisiblePosition(lastPositionInNode(body)) == VisiblePosition(range.endPosition()))
fullySelectedRoot = body;
- Node* specialCommonAncestor = highestAncestorToWrapMarkup(&updatedRange, shouldAnnotate);
+ Node* specialCommonAncestor = highestAncestorToWrapMarkup(&range, shouldAnnotate);
bool needsPositionStyleConversion = body && fullySelectedRoot == body
&& document.settings() && document.settings()->shouldConvertPositionStyleOnCopy();
- StyledMarkupAccumulator accumulator(nodes, shouldResolveURLs, shouldAnnotate, &updatedRange, needsPositionStyleConversion, specialCommonAncestor);
- Node* pastEnd = updatedRange.pastLastNode();
+ StyledMarkupAccumulator accumulator(nodes, shouldResolveURLs, shouldAnnotate, &range, needsPositionStyleConversion, specialCommonAncestor);
+ Node* pastEnd = range.pastLastNode();
- Node* startNode = updatedRange.firstNode();
- VisiblePosition visibleStart(updatedRange.startPosition(), VP_DEFAULT_AFFINITY);
- VisiblePosition visibleEnd(updatedRange.endPosition(), VP_DEFAULT_AFFINITY);
+ Node* startNode = range.firstNode();
+ VisiblePosition visibleStart(range.startPosition(), VP_DEFAULT_AFFINITY);
+ VisiblePosition visibleEnd(range.endPosition(), VP_DEFAULT_AFFINITY);
if (shouldAnnotate == AnnotateForInterchange && needInterchangeNewlineAfter(visibleStart)) {
if (visibleStart == visibleEnd.previous())
return interchangeNewlineString;
String createMarkup(const Range& range, Vector<Node*>* nodes, EAnnotateForInterchange shouldAnnotate, bool convertBlocksToInlines, EAbsoluteURLs shouldResolveURLs)
{
- Document& document = range.ownerDocument();
- const Range* updatedRange = ⦥
-
-#if ENABLE(DELETION_UI)
- // Disable the delete button so it's elements are not serialized into the markup,
- // but make sure neither endpoint is inside the delete user interface.
- Frame* frame = document.frame();
- DeleteButtonControllerDisableScope deleteButtonControllerDisableScope(frame);
-
- RefPtr<Range> updatedRangeRef;
- if (frame) {
- updatedRangeRef = frame->editor().avoidIntersectionWithDeleteButtonController(&range);
- updatedRange = updatedRangeRef.get();
- if (!updatedRange)
- return emptyString();
- }
-#endif
-
- return createMarkupInternal(document, range, *updatedRange, nodes, shouldAnnotate, convertBlocksToInlines, shouldResolveURLs);
+ return createMarkupInternal(range.ownerDocument(), range, nodes, shouldAnnotate, convertBlocksToInlines, shouldResolveURLs);
}
PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document& document, const String& markup, const String& baseURL, ParserContentPolicy parserContentPolicy)
String createMarkup(const Node& node, EChildrenOnly childrenOnly, Vector<Node*>* nodes, EAbsoluteURLs shouldResolveURLs, Vector<QualifiedName>* tagNamesToSkip, EFragmentSerialization fragmentSerialization)
{
- HTMLElement* deleteButtonContainerElement = 0;
-#if ENABLE(DELETION_UI)
- if (Frame* frame = node.document().frame()) {
- deleteButtonContainerElement = frame->editor().deleteButtonController().containerElement();
- if (node.isDescendantOf(deleteButtonContainerElement))
- return emptyString();
- }
-#endif
-
MarkupAccumulator accumulator(nodes, shouldResolveURLs, 0, fragmentSerialization);
- return accumulator.serializeNodes(const_cast<Node&>(node), deleteButtonContainerElement, childrenOnly, tagNamesToSkip);
+ return accumulator.serializeNodes(const_cast<Node&>(node), childrenOnly, tagNamesToSkip);
}
static void fillContainerFromString(ContainerNode* paragraph, const String& string)
virtual void toggleAutomaticSpellingCorrection() override { }
#endif
-#if ENABLE(DELETION_UI)
- virtual bool shouldShowDeleteInterface(HTMLElement*) override { return false; }
-#endif
-
#if PLATFORM(GTK)
virtual bool shouldShowUnicodeMenu() override { return false; }
#endif
virtual void toggleAutomaticSpellingCorrection() = 0;
#endif
-#if ENABLE(DELETION_UI)
- virtual bool shouldShowDeleteInterface(HTMLElement*) = 0;
-#endif
-
#if PLATFORM(GTK)
virtual bool shouldShowUnicodeMenu() = 0;
#endif
mainFrame().deviceOrPageScaleFactorChanged();
pageCache()->markPagesForDeviceScaleChanged(this);
- for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
- frame->editor().deviceScaleFactorChanged();
-
pageCache()->markPagesForFullStyleRecalc(this);
GraphicsContext::updateDocumentMarkerResources();
// FIXME: iframes used as images trigger this. We should deal with them correctly.
return;
}
- String text = accumulator.serializeNodes(*document->documentElement(), 0, IncludeNode);
+ String text = accumulator.serializeNodes(*document->documentElement(), IncludeNode);
CString frameHTML = textEncoding.encode(text, EntitiesForUnencodables);
m_resources->append(Resource(url, document->suggestedMIMEType(), SharedBuffer::create(frameHTML.data(), frameHTML.length())));
m_resourceURLs.add(url);
}
}
-Node* Internals::findEditingDeleteButton()
-{
- Document* document = contextDocument();
- if (!document || !document->frame())
- return 0;
-
- updateEditorUINowIfScheduled();
-
- // FIXME: We shouldn't pollute the id namespace with this name.
- return document->getElementById(String(ASCIILiteral("WebKit-Editing-Delete-Button")));
-}
-
bool Internals::hasSpellingMarker(int from, int length, ExceptionCode&)
{
Document* document = contextDocument();
String parserMetaData(Deprecated::ScriptValue = Deprecated::ScriptValue());
- Node* findEditingDeleteButton();
void updateEditorUINowIfScheduled();
bool hasSpellingMarker(int from, int length, ExceptionCode&);
void updateEditorUINowIfScheduled();
- Node findEditingDeleteButton();
-
[RaisesException] boolean hasSpellingMarker(long from, long length);
[RaisesException] boolean hasGrammarMarker(long from, long length);
[RaisesException] boolean hasAutocorrectedMarker(long from, long length);
+2014-11-05 Dan Bernstein <mitz@apple.com>
+
+ Remove the unused deletion UI feature
+ https://bugs.webkit.org/show_bug.cgi?id=138442
+
+ Rubber-stamped by Alexey Proskuryakov.
+
+ * DefaultDelegates/WebDefaultEditingDelegate.m:
+ (-[WebDefaultEditingDelegate webView:shouldShowDeleteInterfaceForElement:]): Deleted.
+ * WebCoreSupport/WebEditorClient.h:
+ * WebCoreSupport/WebEditorClient.mm:
+ (WebEditorClient::shouldShowDeleteInterface): Deleted.
+ * WebView/WebEditingDelegatePrivate.h: Removed declaration of
+ -webView:shouldShowDeleteInterfaceForElement:.
+
2014-11-03 Dean Jackson <dino@apple.com>
Add ENABLE_FILTERS_LEVEL_2 feature guard.
return sharedDelegate;
}
-#if ENABLE(DELETION_UI)
-- (BOOL)webView:(WebView *)webView shouldShowDeleteInterfaceForElement:(DOMHTMLElement *)element
-{
- return NO;
-}
-#endif
-
- (BOOL)webView:(WebView *)webView shouldBeginEditingInDOMRange:(DOMRange *)range
{
return YES;
virtual void toggleAutomaticSpellingCorrection() override;
#endif
-#if ENABLE(DELETION_UI)
- virtual bool shouldShowDeleteInterface(WebCore::HTMLElement*) override;
-#endif
-
virtual TextCheckerClient* textChecker() override { return this; }
virtual void respondToChangedContents() override;
shouldDeleteDOMRange:kit(range)];
}
-#if ENABLE(DELETION_UI)
-bool WebEditorClient::shouldShowDeleteInterface(HTMLElement* element)
-{
- return [[m_webView _editingDelegateForwarder] webView:m_webView
- shouldShowDeleteInterfaceForElement:kit(element)];
-}
-#endif
-
bool WebEditorClient::smartInsertDeleteEnabled()
{
Page* page = [m_webView page];
@interface NSObject (WebViewEditingDelegatePrivate)
#if !TARGET_OS_IPHONE
-- (BOOL)webView:(WebView *)webView shouldShowDeleteInterfaceForElement:(DOMHTMLElement *)element;
- (void)webView:(WebView *)webView didWriteSelectionToPasteboard:(NSPasteboard *)pasteboard;
#else
- (NSArray *)supportedPasteboardTypesForCurrentSelection;
+2014-11-05 Dan Bernstein <mitz@apple.com>
+
+ Remove the unused deletion UI feature
+ https://bugs.webkit.org/show_bug.cgi?id=138442
+
+ Rubber-stamped by Alexey Proskuryakov.
+
+ * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+ (WebKit::WebEditorClient::shouldShowDeleteInterface): Deleted.
+ * WebProcess/WebCoreSupport/WebEditorClient.h:
+
2014-11-05 Conrad Shultz <conrad_shultz@apple.com>
It should be possible to open a page preview by clicking on it
return result;
}
-#if ENABLE(DELETION_UI)
-bool WebEditorClient::shouldShowDeleteInterface(HTMLElement*)
-{
- notImplemented();
- return false;
-}
-#endif
-
bool WebEditorClient::smartInsertDeleteEnabled()
{
return m_page->isSmartInsertDeleteEnabled();
virtual void toggleAutomaticSpellingCorrection() override;
#endif
-#if ENABLE(DELETION_UI)
- virtual bool shouldShowDeleteInterface(WebCore::HTMLElement*) override;
-#endif
-
#if PLATFORM(GTK)
bool executePendingEditorCommands(WebCore::Frame*, const Vector<WTF::String>&, bool);
void getEditorCommandsForKeyEvent(const WebCore::KeyboardEvent*, Vector<WTF::String>&);
+2014-11-05 Dan Bernstein <mitz@apple.com>
+
+ Remove the unused deletion UI feature
+ https://bugs.webkit.org/show_bug.cgi?id=138442
+
+ Rubber-stamped by Alexey Proskuryakov.
+
+ * DumpRenderTree/mac/EditingDelegate.mm:
+ (-[EditingDelegate webView:shouldShowDeleteInterfaceForElement:]): Deleted implementation of
+ delegate method that’s been removed.
+
2014-11-05 Alexey Proskuryakov <ap@apple.com>
fast/dom/remove-body-during-body-replacement2.html fails on WK2
return acceptsEditing;
}
-- (BOOL)webView:(WebView *)webView shouldShowDeleteInterfaceForElement:(DOMHTMLElement *)element
-{
- return [[element className] isEqualToString:@"needsDeletionUI"];
-}
-
- (BOOL)webView:(WebView *)webView shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag
{
static const char *affinitystring[] = {