RESOLVED FIXED Bug 77875
Web Inspector: add generic support for undo-ing DOM edits.
https://bugs.webkit.org/show_bug.cgi?id=77875
Summary Web Inspector: add generic support for undo-ing DOM edits.
Pavel Feldman
Reported 2012-02-06 08:13:30 PST
Patch to follow.
Attachments
Patch (50.58 KB, patch)
2012-02-06 08:26 PST, Pavel Feldman
no flags
[Patch] for landing (63.30 KB, patch)
2012-02-07 04:54 PST, Pavel Feldman
no flags
[Patch] with tests. (77.64 KB, patch)
2012-02-07 05:57 PST, Pavel Feldman
no flags
Pavel Feldman
Comment 1 2012-02-06 08:26:51 PST
Yury Semikhatsky
Comment 2 2012-02-07 03:50:30 PST
Comment on attachment 125652 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=125652&action=review > Source/WebCore/ChangeLog:5 > + Could you provide a high level overview of the undo approach? > Source/WebCore/inspector/InspectorCSSAgent.cpp:108 > + if (!inspectorStyleSheet->text(&m_oldText)) text -> getText? > Source/WebCore/inspector/InspectorCSSAgent.cpp:161 > + return "SetPropertyText" + m_styleSheetId + ":" + String::number(m_propertyIndex) + ":" + (m_overwrite ? "true" : "false"); Use String::format? > Source/WebCore/inspector/InspectorCSSAgent.cpp:169 > + m_text = other->m_text; This is not only needed for toString, right? > Source/WebCore/inspector/InspectorCSSAgent.h:101 > + friend class SetStyleSheetTextAction; You can make these classes nested and just forward declare them here. > Source/WebCore/inspector/InspectorDOMAgent.cpp:135 > +class RemoveChildAction : public DOMAction { All actions should be marked as WTF_MAKE_NONCOPYABLE > Source/WebCore/inspector/InspectorDOMAgent.cpp:290 > +private: style: blank like above private: > Source/WebCore/inspector/InspectorHistory.cpp:106 > + while (!m_history.isEmpty() && m_history.first()->isUndoableStateMark()) Instead of marking end of action, you could mark its beginning which would be simpler. > Source/WebCore/inspector/InspectorHistory.cpp:107 > + m_history.takeFirst(); removeFirst > Source/WebCore/inspector/InspectorHistory.h:50 > +class InspectorHistory { WTF_MAKE_NONCOPYABLE > Source/WebCore/inspector/InspectorStyleSheet.h:177 > + bool setPropertyText(ErrorString*, const InspectorCSSId&, unsigned propertyIndex, const String& text, bool overwrite, String* oldPropertyText); oldPropertyText -> oldText as in other places
Pavel Feldman
Comment 3 2012-02-07 04:53:38 PST
(In reply to comment #2) > (From update of attachment 125652 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=125652&action=review > > > Source/WebCore/ChangeLog:5 > > + > > Could you provide a high level overview of the undo approach? Done. > > > Source/WebCore/inspector/InspectorCSSAgent.cpp:108 > > + if (!inspectorStyleSheet->text(&m_oldText)) > > text -> getText? > Done. > > Source/WebCore/inspector/InspectorCSSAgent.cpp:161 > > + return "SetPropertyText" + m_styleSheetId + ":" + String::number(m_propertyIndex) + ":" + (m_overwrite ? "true" : "false"); > > Use String::format? > Done. > > Source/WebCore/inspector/InspectorCSSAgent.cpp:169 > > + m_text = other->m_text; > > This is not only needed for toString, right? > This will also be used in redo. > > Source/WebCore/inspector/InspectorCSSAgent.h:101 > > + friend class SetStyleSheetTextAction; > > You can make these classes nested and just forward declare them here. Done. > > > Source/WebCore/inspector/InspectorDOMAgent.cpp:135 > > +class RemoveChildAction : public DOMAction { > > All actions should be marked as WTF_MAKE_NONCOPYABLE Done. > > > Source/WebCore/inspector/InspectorDOMAgent.cpp:290 > > +private: > > style: blank like above private: > Done. > > Source/WebCore/inspector/InspectorHistory.cpp:106 > > + while (!m_history.isEmpty() && m_history.first()->isUndoableStateMark()) > > Instead of marking end of action, you could mark its beginning which would be simpler. This would make the code harder due to minor (non-major) style edits. > > > Source/WebCore/inspector/InspectorHistory.cpp:107 > > + m_history.takeFirst(); > > removeFirst Done. > > > Source/WebCore/inspector/InspectorHistory.h:50 > > +class InspectorHistory { > > WTF_MAKE_NONCOPYABLE > Done. > > Source/WebCore/inspector/InspectorStyleSheet.h:177 > > + bool setPropertyText(ErrorString*, const InspectorCSSId&, unsigned propertyIndex, const String& text, bool overwrite, String* oldPropertyText); > > oldPropertyText -> oldText as in other places In other places this method is defined on style, not stylesheet.
Pavel Feldman
Comment 4 2012-02-07 04:54:42 PST
Created attachment 125819 [details] [Patch] for landing
Pavel Feldman
Comment 5 2012-02-07 05:57:36 PST
Created attachment 125829 [details] [Patch] with tests.
Pavel Feldman
Comment 6 2012-02-07 06:00:48 PST
Caio Marcelo de Oliveira Filho
Comment 7 2012-02-07 07:57:46 PST
Hi. I think there's a chance this broke mac build see in http://build.webkit.org/builders/SnowLeopard%20Intel%20Release%20%28Build%29/builds/38577/steps/compile-webkit/logs/stdio (look for "OwnPtr" in the file)
Csaba Osztrogonác
Comment 8 2012-02-07 07:59:54 PST
Reopen, because the build is still broken.
Pavel Feldman
Comment 9 2012-02-07 09:01:00 PST
Note You need to log in before you can comment on or make changes to this bug.