https://bugs.webkit.org/show_bug.cgi?id=78716
Reviewed by Vsevolod Vlasov.
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::toggleProperty):
(WebCore::InspectorCSSAgent::setRuleSelector):
(WebCore::InspectorCSSAgent::addRule):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setAttributeValue):
(WebCore::InspectorDOMAgent::setAttributesAsText):
(WebCore::InspectorDOMAgent::removeAttribute):
(WebCore::InspectorDOMAgent::removeNode):
(WebCore::InspectorDOMAgent::setNodeName):
(WebCore::InspectorDOMAgent::setOuterHTML):
(WebCore::InspectorDOMAgent::setNodeValue):
(WebCore::InspectorDOMAgent::moveTo):
* inspector/InspectorHistory.cpp:
(WebCore::InspectorHistory::redo):
* inspector/InspectorHistory.h:
(InspectorHistory):
* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModel.prototype.setRuleSelector.callback):
(WebInspector.CSSStyleModel.prototype.setRuleSelector):
(WebInspector.CSSStyleModel.prototype.addRule.callback):
(WebInspector.CSSStyleModel.prototype.addRule):
(WebInspector.CSSStyleModel.prototype.setStyleSheetText):
(WebInspector.CSSProperty.prototype.setText.callback):
(WebInspector.CSSProperty.prototype.setText):
(WebInspector.CSSProperty.prototype.setDisabled.callback):
(WebInspector.CSSProperty.prototype.setDisabled):
(WebInspector.CSSStyleSheet.prototype.setText):
* inspector/front-end/DOMAgent.js:
(WebInspector.DOMAgent.prototype._markRevision):
(WebInspector.DOMAgent.prototype.get markUndoableState):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107935
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2012-02-15 Pavel Feldman <pfeldman@google.com>
+ Web Inspector: explicitly mark undoable state from the front-end.
+ https://bugs.webkit.org/show_bug.cgi?id=78716
+
+ Reviewed by Vsevolod Vlasov.
+
+ * inspector/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::toggleProperty):
+ (WebCore::InspectorCSSAgent::setRuleSelector):
+ (WebCore::InspectorCSSAgent::addRule):
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::setAttributeValue):
+ (WebCore::InspectorDOMAgent::setAttributesAsText):
+ (WebCore::InspectorDOMAgent::removeAttribute):
+ (WebCore::InspectorDOMAgent::removeNode):
+ (WebCore::InspectorDOMAgent::setNodeName):
+ (WebCore::InspectorDOMAgent::setOuterHTML):
+ (WebCore::InspectorDOMAgent::setNodeValue):
+ (WebCore::InspectorDOMAgent::moveTo):
+ * inspector/InspectorHistory.cpp:
+ (WebCore::InspectorHistory::redo):
+ * inspector/InspectorHistory.h:
+ (InspectorHistory):
+ * inspector/front-end/CSSStyleModel.js:
+ (WebInspector.CSSStyleModel.prototype.setRuleSelector.callback):
+ (WebInspector.CSSStyleModel.prototype.setRuleSelector):
+ (WebInspector.CSSStyleModel.prototype.addRule.callback):
+ (WebInspector.CSSStyleModel.prototype.addRule):
+ (WebInspector.CSSStyleModel.prototype.setStyleSheetText):
+ (WebInspector.CSSProperty.prototype.setText.callback):
+ (WebInspector.CSSProperty.prototype.setText):
+ (WebInspector.CSSProperty.prototype.setDisabled.callback):
+ (WebInspector.CSSProperty.prototype.setDisabled):
+ (WebInspector.CSSStyleSheet.prototype.setText):
+ * inspector/front-end/DOMAgent.js:
+ (WebInspector.DOMAgent.prototype._markRevision):
+ (WebInspector.DOMAgent.prototype.get markUndoableState):
+
+2012-02-15 Pavel Feldman <pfeldman@google.com>
+
Web Inspector: revert 'modification of DOM upon single click for selected nodes'.
https://bugs.webkit.org/show_bug.cgi?id=78717
if (success)
result = inspectorStyleSheet->buildObjectForStyle(inspectorStyleSheet->styleForId(compoundId));
*errorString = InspectorDOMAgent::toErrorString(ec);
- m_domAgent->history()->markUndoableState();
}
void InspectorCSSAgent::setRuleSelector(ErrorString* errorString, const RefPtr<InspectorObject>& fullRuleId, const String& selector, RefPtr<InspectorObject>& result)
if (success)
result = inspectorStyleSheet->buildObjectForRule(inspectorStyleSheet->ruleForId(compoundId));
- m_domAgent->history()->markUndoableState();
}
void InspectorCSSAgent::addRule(ErrorString* errorString, const int contextNodeId, const String& selector, RefPtr<InspectorObject>& result)
InspectorCSSId ruleId = rawAction->newRuleId();
CSSStyleRule* rule = inspectorStyleSheet->ruleForId(ruleId);
result = inspectorStyleSheet->buildObjectForRule(rule);
- m_domAgent->history()->markUndoableState();
}
void InspectorCSSAgent::getSupportedCSSProperties(ErrorString*, RefPtr<InspectorArray>& cssProperties)
return;
m_domEditor->setAttribute(element, name, value, errorString);
- m_history->markUndoableState();
}
void InspectorDOMAgent::setAttributesAsText(ErrorString* errorString, int elementId, const String& text, const String* const name)
Element* childElement = toElement(child);
if (!childElement->hasAttributes() && name) {
m_domEditor->removeAttribute(element, *name, errorString);
- m_history->markUndoableState();
return;
}
if (!foundOriginalAttribute && name && !name->stripWhiteSpace().isEmpty())
m_domEditor->removeAttribute(element, *name, errorString);
-
- m_history->markUndoableState();
}
void InspectorDOMAgent::removeAttribute(ErrorString* errorString, int elementId, const String& name)
return;
m_domEditor->removeAttribute(element, name, errorString);
- m_history->markUndoableState();
}
void InspectorDOMAgent::removeNode(ErrorString* errorString, int nodeId)
}
m_domEditor->removeChild(parentNode, node, errorString);
- m_history->markUndoableState();
}
void InspectorDOMAgent::setNodeName(ErrorString* errorString, int nodeId, const String& tagName, int* newId)
return;
if (!m_domEditor->removeChild(parent, oldNode, errorString))
return;
- m_history->markUndoableState();
*newId = pushNodePathToFrontend(newElem.get());
if (m_childrenRequested.contains(nodeId))
Node* newNode = 0;
if (!m_domEditor->setOuterHTML(node, outerHTML, &newNode, errorString))
return;
- m_history->markUndoableState();
if (!newNode) {
// The only child node has been deleted.
}
m_domEditor->replaceWholeText(toText(node), value, errorString);
- m_history->markUndoableState();
}
void InspectorDOMAgent::getEventListenersForNode(ErrorString*, int nodeId, RefPtr<InspectorArray>& listenersArray)
if (!m_domEditor->insertBefore(targetElement, node, anchorNode, errorString))
return;
- m_history->markUndoableState();
*newNodeId = pushNodePathToFrontend(node);
}
while (m_afterLastActionIndex < m_history.size()) {
Action* action = m_history[m_afterLastActionIndex].get();
if (!action->redo(ec)) {
- m_history.resize(m_afterLastActionIndex);
+ m_history.clear();
return false;
}
++m_afterLastActionIndex;
void reset();
private:
- void dump();
Vector<OwnPtr<Action> > m_history;
size_t m_afterLastActionIndex;
};
if (error)
failureCallback();
else {
+ WebInspector.domAgent.markUndoableState();
var ownerDocumentId = this._ownerDocumentId(nodeId);
if (ownerDocumentId)
WebInspector.domAgent.querySelectorAll(ownerDocumentId, newSelector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
// Invalid syntax for a selector
failureCallback();
} else {
+ WebInspector.domAgent.markUndoableState();
var ownerDocumentId = this._ownerDocumentId(nodeId);
if (ownerDocumentId)
WebInspector.domAgent.querySelectorAll(ownerDocumentId, selector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
function callback(error)
{
this._pendingCommandsMajorState.pop();
+ if (!error && majorChange)
+ WebInspector.domAgent.markUndoableState();
+
if (!error && userCallback)
userCallback(error);
}
this._pendingCommandsMajorState.push(majorChange);
CSSAgent.setStyleSheetText(styleSheetId, newText, callback.bind(this));
- if (majorChange)
- DOMAgent.markUndoableState();
},
_undoRedoRequested: function()
{
WebInspector.cssModel._pendingCommandsMajorState.pop();
if (!error) {
+ if (majorChange)
+ WebInspector.domAgent.markUndoableState();
this.text = propertyText;
var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
var newProperty = style.allProperties[this.index];
// An index past all the properties adds a new property to the style.
WebInspector.cssModel._pendingCommandsMajorState.push(majorChange);
CSSAgent.setPropertyText(this.ownerStyle.id, this.index, propertyText, this.index < this.ownerStyle.pastLastSourcePropertyIndex(), callback.bind(this));
- if (majorChange)
- DOMAgent.markUndoableState();
},
setValue: function(newValue, majorChange, userCallback)
userCallback(null);
return;
}
+ WebInspector.domAgent.markUndoableState();
if (userCallback) {
var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
userCallback(style);
{
function callback(error)
{
+ if (!error)
+ WebInspector.domAgent.markUndoableState();
+
WebInspector.cssModel._pendingCommandsMajorState.pop();
if (userCallback)
userCallback(error);
{
function wrapperFunction(error)
{
+ if (!error)
+ this.markUndoableState();
+
if (callback)
callback.apply(this, arguments);
if (error || !WebInspector.experimentsSettings.freeFlowDOMEditing.isEnabled())
DOMAgent.setTouchEmulationEnabled(WebInspector.settings.emulateTouchEvents.get());
},
+ markUndoableState: function()
+ {
+ DOMAgent.markUndoableState();
+ },
+
/**
* @param {function(?Protocol.Error)=} callback
*/