Changeset 109529 in webkit
- Timestamp:
- Mar 2, 2012 1:20:39 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r109523 r109529 1 2012-03-02 Pablo Flouret <pablof@motorola.com> 2 3 Implement DefaultParagraphSeparator execCommand, to let authors choose the default block element 4 https://bugs.webkit.org/show_bug.cgi?id=59961 5 6 Reviewed by Ryosuke Niwa. 7 8 * editing/execCommand/default-paragraph-separator-expected.txt: Added. 9 * editing/execCommand/default-paragraph-separator.html: Added. 10 1 11 2012-03-02 Mike Lawther <mikelawther@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r109528 r109529 1 2012-03-02 Pablo Flouret <pablof@motorola.com> 2 3 Implement DefaultParagraphSeparator execCommand, to let authors choose the default block element 4 https://bugs.webkit.org/show_bug.cgi?id=59961 5 6 Reviewed by Ryosuke Niwa. 7 8 http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#the-defaultparagraphseparator-command 9 10 Test: editing/execCommand/default-paragraph-separator.html 11 12 * editing/Editor.cpp: 13 (WebCore::Editor::Editor): 14 * editing/Editor.h: 15 (WebCore::Editor::defaultParagraphSeparator): 16 (WebCore::Editor::setDefaultParagraphSeparator): 17 (Editor): 18 * editing/EditorCommand.cpp: 19 (WebCore::executeDefaultParagraphSeparator): 20 (WebCore): 21 (WebCore::valueDefaultParagraphSeparator): 22 (WebCore::createCommandMap): 23 * editing/htmlediting.cpp: 24 (WebCore::createDefaultParagraphElement): 25 26 * html/HTMLParagraphElement.cpp: 27 (WebCore::HTMLParagraphElement::create): 28 (WebCore): 29 * html/HTMLParagraphElement.h: 30 (HTMLParagraphElement): 31 Added create(Document*) method that defaults to pTag as the QualifiedName. 32 1 33 2012-03-02 Kenneth Russell <kbr@google.com> 2 34 -
trunk/Source/WebCore/editing/Editor.cpp
r108772 r109529 847 847 , m_spellingCorrector(adoptPtr(new SpellingCorrectionController(frame))) 848 848 , m_areMarkedTextMatchesHighlighted(false) 849 , m_defaultParagraphSeparator(EditorParagraphSeparatorIsDiv) 849 850 { 850 851 } -
trunk/Source/WebCore/editing/Editor.h
r108462 r109529 81 81 82 82 enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM, CommandFromDOMWithUserInterface }; 83 enum EditorParagraphSeparator { EditorParagraphSeparatorIsDiv, EditorParagraphSeparatorIsP }; 83 84 84 85 class Editor { … … 384 385 void deviceScaleFactorChanged(); 385 386 387 EditorParagraphSeparator defaultParagraphSeparator() const { return m_defaultParagraphSeparator; } 388 void setDefaultParagraphSeparator(EditorParagraphSeparator separator) { m_defaultParagraphSeparator = separator; } 389 386 390 private: 387 391 Frame* m_frame; … … 401 405 VisibleSelection m_mark; 402 406 bool m_areMarkedTextMatchesHighlighted; 407 EditorParagraphSeparator m_defaultParagraphSeparator; 403 408 404 409 bool canDeleteRange(Range*) const; -
trunk/Source/WebCore/editing/EditorCommand.cpp
r108462 r109529 308 308 } 309 309 310 static bool executeDefaultParagraphSeparator(Frame* frame, Event*, EditorCommandSource, const String& value) 311 { 312 if (equalIgnoringCase(value, "div")) 313 frame->editor()->setDefaultParagraphSeparator(EditorParagraphSeparatorIsDiv); 314 else if (equalIgnoringCase(value, "p")) 315 frame->editor()->setDefaultParagraphSeparator(EditorParagraphSeparatorIsP); 316 317 return true; 318 } 319 310 320 static bool executeDelete(Frame* frame, Event*, EditorCommandSource source, const String&) 311 321 { … … 1379 1389 } 1380 1390 1391 static String valueDefaultParagraphSeparator(Frame* frame, Event*) 1392 { 1393 switch (frame->editor()->defaultParagraphSeparator()) { 1394 case EditorParagraphSeparatorIsDiv: 1395 return divTag.localName(); 1396 case EditorParagraphSeparatorIsP: 1397 return pTag.localName(); 1398 } 1399 1400 ASSERT_NOT_REACHED(); 1401 return String(); 1402 } 1403 1381 1404 static String valueFontName(Frame* frame, Event*) 1382 1405 { … … 1430 1453 { "CreateLink", { executeCreateLink, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1431 1454 { "Cut", { executeCut, supportedCopyCut, enabledCut, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } }, 1455 { "DefaultParagraphSeparator", { executeDefaultParagraphSeparator, supported, enabled, stateNone, valueDefaultParagraphSeparator, notTextInsertion, doNotAllowExecutionWhenDisabled} }, 1432 1456 { "Delete", { executeDelete, supported, enabledDelete, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, 1433 1457 { "DeleteBackward", { executeDeleteBackward, supportedFromMenuOrKeyBinding, enabledInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } }, -
trunk/Source/WebCore/editing/htmlediting.cpp
r108009 r109529 30 30 #include "Document.h" 31 31 #include "EditingText.h" 32 #include "Editor.h" 33 #include "Frame.h" 32 34 #include "HTMLBRElement.h" 33 35 #include "HTMLDivElement.h" … … 39 41 #include "HTMLObjectElement.h" 40 42 #include "HTMLOListElement.h" 43 #include "HTMLParagraphElement.h" 41 44 #include "HTMLUListElement.h" 42 45 #include "PositionIterator.h" … … 845 848 PassRefPtr<HTMLElement> createDefaultParagraphElement(Document* document) 846 849 { 847 return HTMLDivElement::create(document); 850 switch (document->frame()->editor()->defaultParagraphSeparator()) { 851 case EditorParagraphSeparatorIsDiv: 852 return HTMLDivElement::create(document); 853 case EditorParagraphSeparatorIsP: 854 return HTMLParagraphElement::create(document); 855 } 856 857 ASSERT_NOT_REACHED(); 858 return 0; 848 859 } 849 860 -
trunk/Source/WebCore/html/HTMLParagraphElement.cpp
r109149 r109529 40 40 } 41 41 42 PassRefPtr<HTMLParagraphElement> HTMLParagraphElement::create(Document* document) 43 { 44 return adoptRef(new HTMLParagraphElement(pTag, document)); 45 } 46 42 47 PassRefPtr<HTMLParagraphElement> HTMLParagraphElement::create(const QualifiedName& tagName, Document* document) 43 48 { -
trunk/Source/WebCore/html/HTMLParagraphElement.h
r109149 r109529 30 30 class HTMLParagraphElement : public HTMLElement { 31 31 public: 32 static PassRefPtr<HTMLParagraphElement> create(Document*); 32 33 static PassRefPtr<HTMLParagraphElement> create(const QualifiedName&, Document*); 33 34
Note: See TracChangeset
for help on using the changeset viewer.