Reviewed by mjs
<http://bugs.webkit.org/show_bug.cgi?id=11334>
Writely Editor: Placing caret in a list "highlights" both Numbered List and Bulleted List toolbar icons
* editing/execCommand/queryCommandState-01-expected.txt: Added.
* editing/execCommand/queryCommandState-01.html: Added.
WebCore:
Reviewed by mjs
<http://bugs.webkit.org/show_bug.cgi?id=11334>
Writely Editor: Placing caret in a list "highlights" both Numbered List and Bulleted List toolbar icons
* WebCore.xcodeproj/project.pbxproj:
* editing/Editor.cpp:
(WebCore::Editor::selectionUnorderedListState): Added.
(WebCore::Editor::selectionOrderedListState): Added.
* editing/Editor.h:
* editing/JSEditor.cpp:
* page/Frame.cpp:
* page/Frame.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17234
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-10-23 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by mjs
+
+ <http://bugs.webkit.org/show_bug.cgi?id=11334>
+ Writely Editor: Placing caret in a list "highlights" both Numbered List and Bulleted List toolbar icons
+
+ * editing/execCommand/queryCommandState-01-expected.txt: Added.
+ * editing/execCommand/queryCommandState-01.html: Added.
+
2006-10-20 Justin Garcia <justin.garcia@apple.com>
Reviewed by john
+2006-10-23 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by mjs
+
+ <http://bugs.webkit.org/show_bug.cgi?id=11334>
+ Writely Editor: Placing caret in a list "highlights" both Numbered List and Bulleted List toolbar icons
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * editing/Editor.cpp:
+ (WebCore::Editor::selectionUnorderedListState): Added.
+ (WebCore::Editor::selectionOrderedListState): Added.
+ * editing/Editor.h:
+ * editing/JSEditor.cpp:
+ * page/Frame.cpp:
+ * page/Frame.h:
+
2006-10-23 John Sullivan <sullivan@apple.com>
Reviewed by Tim H
#include "DeleteButtonController.h"
#include "EditorClient.h"
-#include "Frame.h"
+#include "htmlediting.h"
#include "HTMLElement.h"
+#include "HTMLNames.h"
#include "Range.h"
+#include "SelectionController.h"
#include "Sound.h"
namespace WebCore {
+using namespace HTMLNames;
+
// implement as platform-specific
static Pasteboard generalPasteboard()
{
m_deleteButtonController->respondToChangedContents();
}
+Frame::TriState Editor::selectionUnorderedListState() const
+{
+ if (m_frame->selectionController()->isCaret()) {
+ Node* selectionNode = m_frame->selectionController()->selection().start().node();
+ if (enclosingNodeWithTag(selectionNode, ulTag))
+ return Frame::trueTriState;
+ } else if (m_frame->selectionController()->isRange()) {
+ Node* startNode = enclosingNodeWithTag(m_frame->selectionController()->selection().start().node(), ulTag);
+ Node* endNode = enclosingNodeWithTag(m_frame->selectionController()->selection().end().node(), ulTag);
+ if (startNode && endNode && startNode == endNode)
+ return Frame::trueTriState;
+ }
+
+ return Frame::falseTriState;
+}
+
+Frame::TriState Editor::selectionOrderedListState() const
+{
+ if (m_frame->selectionController()->isCaret()) {
+ Node* selectionNode = m_frame->selectionController()->selection().start().node();
+ if (enclosingNodeWithTag(selectionNode, olTag))
+ return Frame::trueTriState;
+ } else if (m_frame->selectionController()->isRange()) {
+ Node* startNode = enclosingNodeWithTag(m_frame->selectionController()->selection().start().node(), olTag);
+ Node* endNode = enclosingNodeWithTag(m_frame->selectionController()->selection().end().node(), olTag);
+ if (startNode && endNode && startNode == endNode)
+ return Frame::trueTriState;
+ }
+
+ return Frame::falseTriState;
+}
+
// =============================================================================
//
// public editing commands
#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
+#include "Frame.h"
+
namespace WebCore {
class DeleteButtonController;
void respondToChangedSelection(const Selection& oldSelection);
void respondToChangedContents();
+
+ Frame::TriState selectionUnorderedListState() const;
+ Frame::TriState selectionOrderedListState() const;
Frame* frame() const { return m_frame; }
DeleteButtonController* deleteButtonController() const { return m_deleteButtonController.get(); }
#include "CreateLinkCommand.h"
#include "Document.h"
#include "DocumentFragment.h"
+#include "Editor.h"
#include "FormatBlockCommand.h"
#include "Frame.h"
#include "HTMLNames.h"
return stateStyle(frame, CSS_PROP_FONT_STYLE, "italic");
}
-Frame::TriState stateList(Frame* frame)
+Frame::TriState stateUnorderedList(Frame* frame)
{
- return frame->selectionListState();
+ return frame->editor()->selectionUnorderedListState();
+}
+
+Frame::TriState stateOrderedList(Frame* frame)
+{
+ return frame->editor()->selectionOrderedListState();
}
Frame::TriState stateStrikethrough(Frame* frame)
{ "InsertHTML", { execInsertHTML, enabledAnyEditableSelection, stateNone, valueNull } },
{ "InsertImage", { execInsertImage, enabledAnyRichlyEditableSelection, stateNone, valueNull } },
{ "InsertLineBreak", { execInsertLineBreak, enabledAnyEditableSelection, stateNone, valueNull } },
- { "InsertOrderedList", { execInsertOrderedList, enabledAnyRichlyEditableSelection, stateList, valueNull } },
+ { "InsertOrderedList", { execInsertOrderedList, enabledAnyRichlyEditableSelection, stateOrderedList, valueNull } },
{ "InsertParagraph", { execInsertParagraph, enabledAnyEditableSelection, stateNone, valueNull } },
{ "InsertNewlineInQuotedContent", { execInsertNewlineInQuotedContent, enabledAnyRichlyEditableSelection, stateNone, valueNull } },
{ "InsertText", { execInsertText, enabledAnyEditableSelection, stateNone, valueNull } },
- { "InsertUnorderedList", { execInsertUnorderedList, enabledAnyRichlyEditableSelection, stateList, valueNull } },
+ { "InsertUnorderedList", { execInsertUnorderedList, enabledAnyRichlyEditableSelection, stateUnorderedList, valueNull } },
{ "Italic", { execItalic, enabledAnyRichlyEditableSelection, stateItalic, valueNull } },
{ "JustifyCenter", { execJustifyCenter, enabledAnyRichlyEditableSelection, stateNone, valueNull } },
{ "JustifyFull", { execJustifyFull, enabledAnyRichlyEditableSelection, stateNone, valueNull } },
}
}
-Frame::TriState Frame::selectionListState() const
-{
- TriState state = falseTriState;
-
- if (!selectionController()->isRange()) {
- Node* selectionNode = selectionController()->selection().start().node();
- if (enclosingList(selectionNode))
- return trueTriState;
- } else {
- //FIXME: Support ranges
- }
-
- return state;
-}
-
Frame::TriState Frame::selectionHasStyle(CSSStyleDeclaration *style) const
{
bool atStart = true;
void outdent();
TriState selectionHasStyle(CSSStyleDeclaration*) const;
bool selectionStartHasStyle(CSSStyleDeclaration*) const;
- TriState selectionListState() const;
String selectionStartStylePropertyValue(int stylePropertyID) const;
void applyEditingStyleToBodyElement() const;
void removeEditingStyleFromBodyElement() const;