1. 12 May, 2011 1 commit
    • tonyg@chromium.org's avatar
      2011-05-10 Tony Gentilcore <tonyg@chromium.org> · 4b0a55f4
      tonyg@chromium.org authored
              Reviewed by Darin Adler.
      
              Perform some forward declarations suggested by include-what-you-use
              https://bugs.webkit.org/show_bug.cgi?id=60545
      
              * accessibility/AccessibilityObject.cpp:
              * accessibility/AccessibilityRenderObject.cpp:
              * accessibility/mac/AccessibilityObjectWrapper.mm:
              * dom/DocumentMarkerController.cpp:
              * dom/Position.cpp:
              * dom/PositionIterator.cpp:
              * dom/Range.cpp:
              * editing/ApplyBlockElementCommand.cpp:
              * editing/ApplyStyleCommand.cpp:
              * editing/Editor.cpp:
              * editing/EditorCommand.cpp:
              * editing/FrameSelection.cpp:
              * editing/HTMLInterchange.cpp:
              * editing/IndentOutdentCommand.cpp:
              * editing/ReplaceSelectionCommand.cpp:
              * editing/SpellChecker.h:
              * editing/SpellingCorrectionCommand.cpp:
              * editing/SpellingCorrectionController.h:
              * editing/TextCheckingHelper.cpp:
              * editing/TextIterator.h:
              * editing/htmlediting.h:
              * editing/markup.cpp:
              * editing/visible_units.cpp:
              * editing/visible_units.h:
              * fileapi/DOMFileSystem.cpp:
              * fileapi/DirectoryReaderSync.cpp:
              * fileapi/DirectoryReaderSync.h:
              * fileapi/FileEntry.h:
              * fileapi/FileWriter.h:
              * fileapi/FileWriterBase.h:
              * fileapi/FileWriterSync.h:
              * history/CachedFrame.cpp:
              * history/CachedPage.cpp:
              * history/HistoryItem.cpp:
              * history/HistoryItem.h:
              * history/PageCache.h:
              * loader/HistoryController.h:
              * loader/PingLoader.h:
              * loader/ResourceLoader.h:
              * loader/appcache/DOMApplicationCache.h:
              * loader/cache/CachedCSSStyleSheet.h:
              * loader/cache/CachedFont.cpp:
              * loader/cache/CachedFont.h:
              * loader/cache/CachedResourceRequest.cpp:
              * loader/cache/CachedResourceRequest.h:
              * loader/cache/MemoryCache.h:
              * notifications/Notification.cpp:
              * notifications/Notification.h:
              * notifications/NotificationCenter.cpp:
              * notifications/NotificationCenter.h:
              * page/Chrome.cpp:
              * page/Chrome.h:
              * page/DOMSelection.cpp:
              * page/DOMTimer.h:
              * page/DOMWindow.cpp:
              * page/EventHandler.cpp:
              * page/FocusController.h:
              * page/Geolocation.cpp:
              * page/Geolocation.h:
              * page/History.cpp:
              * rendering/RenderListBox.cpp:
              * workers/WorkerContext.cpp:
      2011-05-10  Tony Gentilcore  <tonyg@chromium.org>
      
              Reviewed by Darin Adler.
      
              Perform some forward declarations suggested by include-what-you-use
              https://bugs.webkit.org/show_bug.cgi?id=60545
      
              * src/WebHistoryItem.cpp:
              * src/WebNotification.cpp:
              * src/WebTextCheckingCompletionImpl.cpp:
              * src/mac/WebSubstringUtil.mm:
      2011-05-10  Tony Gentilcore  <tonyg@chromium.org>
      
              Reviewed by Darin Adler.
      
              Perform some forward declarations suggested by include-what-you-use
              https://bugs.webkit.org/show_bug.cgi?id=60545
      
              * Plugins/Hosted/WebHostedNetscapePluginView.mm:
              * WebView/WebFrame.mm:
      2011-05-10  Tony Gentilcore  <tonyg@chromium.org>
      
              Reviewed by Darin Adler.
      
              Perform some forward declarations suggested by include-what-you-use
              https://bugs.webkit.org/show_bug.cgi?id=60545
      
              * WebProcess/WebPage/mac/WebPageMac.mm:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86325 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4b0a55f4
  2. 15 Mar, 2011 1 commit
    • leviw@chromium.org's avatar
      2011-03-08 Levi Weintraub <leviw@chromium.org> · 1f95362b
      leviw@chromium.org authored
              Reviewed by Ryosuke Niwa.
      
              Get rid of firstDeepEditingPositionForNode and lastDeepEditingPositionForNode
              https://bugs.webkit.org/show_bug.cgi?id=52642
      
              Replacing calls to first/lastDeepEditingPositionForNode with calls to their analogous
              functions that create new positions. Also fixing various parts of editing code that
              incorrectly handled the new positions now being created.
      
              No new tests as this is refactoring/cleanup.
      
              * accessibility/AccessibilityRenderObject.cpp:
              (WebCore::AccessibilityRenderObject::visiblePositionRange):
              * dom/Position.cpp:
              (WebCore::Position::parentAnchoredEquivalent):
              (WebCore::Position::previous):
              (WebCore::Position::next):
              (WebCore::Position::atFirstEditingPositionForNode):
              (WebCore::Position::atLastEditingPositionForNode):
              (WebCore::Position::upstream):
              (WebCore::Position::isCandidate):
              (WebCore::Position::getInlineBoxAndOffset):
              * dom/Position.h:
              (WebCore::operator==):
              * dom/PositionIterator.cpp:
              (WebCore::PositionIterator::operator Position):
              * editing/ApplyBlockElementCommand.cpp:
              (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded):
              * editing/CompositeEditCommand.cpp:
              (WebCore::CompositeEditCommand::positionAvoidingSpecialElementBoundary):
              * editing/DeleteSelectionCommand.cpp:
              (WebCore::isTableCellEmpty):
              (WebCore::DeleteSelectionCommand::removeNode):
              * editing/InsertLineBreakCommand.cpp:
              (WebCore::InsertLineBreakCommand::doApply):
              * editing/InsertListCommand.cpp:
              (WebCore::InsertListCommand::unlistifyParagraph):
              * editing/ReplaceSelectionCommand.cpp:
              (WebCore::ReplaceSelectionCommand::positionAtEndOfInsertedContent):
              * editing/TypingCommand.cpp:
              (WebCore::TypingCommand::forwardDeleteKeyPressed):
              * editing/VisibleSelection.cpp:
              (WebCore::VisibleSelection::selectionFromContentsOfNode):
              (WebCore::VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries):
              * editing/htmlediting.cpp:
              (WebCore::firstEditablePositionAfterPositionInRoot):
              (WebCore::lastEditablePositionBeforePositionInRoot):
              (WebCore::enclosingEmptyListItem):
              * editing/htmlediting.h:
              * editing/visible_units.cpp:
              (WebCore::startOfParagraph):
              (WebCore::endOfParagraph):
              (WebCore::startOfEditableContent):
              (WebCore::endOfEditableContent):
              * rendering/RenderBox.cpp:
              (WebCore::RenderBox::positionForPoint):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81165 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1f95362b
  3. 10 Mar, 2011 1 commit
    • rniwa@webkit.org's avatar
      2011-03-10 Ryosuke Niwa <rniwa@webkit.org> · ea702bae
      rniwa@webkit.org authored
              Reviewed by Tony Chang.
      
              VisiblePosition's next and previous should take an enum instead of a boolean
              https://bugs.webkit.org/show_bug.cgi?id=56135
      
              SelectionController::isAll now takes EditingBoundaryCrossingRule instead of
              StayInEditableContent.
      
              * WebView/WebView.mm:
              (-[WebView _selectionIsAll]):
      2011-03-10  Ryosuke Niwa  <rniwa@webkit.org>
      
              Reviewed by Tony Chang.
      
              VisiblePosition's next and previous should take an enum instead of a boolean
              https://bugs.webkit.org/show_bug.cgi?id=56135
      
              Changed the argument type of VisiblePosition::next and VisiblePosition::previous
              from bool to EditingBoundaryCrossingRule. Also got rid of StayInEditableContent enum
              in VisibleSelection and replaced it by EditingBoundaryCrossingRule because the enum
              was only used in VisiblePosition::isAll and subsequently in SelectionController::isAll
              to call VisiblePosition::next and VisiblePosition::previous.
      
              * WebCore.exp.in:
              * dom/Position.cpp:
              (WebCore::Position::trailingWhitespacePosition):
              * editing/ApplyBlockElementCommand.cpp:
              (WebCore::ApplyBlockElementCommand::doApply):
              * editing/CompositeEditCommand.cpp:
              (WebCore::CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph):
              * editing/InsertListCommand.cpp:
              (WebCore::InsertListCommand::doApply):
              (WebCore::InsertListCommand::listifyParagraph):
              * editing/ReplaceSelectionCommand.cpp:
              (WebCore::ReplaceSelectionCommand::shouldMergeStart):
              (WebCore::ReplaceSelectionCommand::shouldMergeEnd):
              (WebCore::ReplaceSelectionCommand::doApply):
              * editing/SelectionController.cpp:
              (WebCore::SelectionController::modifyExtendingRight):
              (WebCore::SelectionController::modifyExtendingForward):
              (WebCore::SelectionController::modifyMovingForward):
              (WebCore::SelectionController::modifyExtendingLeft):
              (WebCore::SelectionController::modifyExtendingBackward):
              (WebCore::SelectionController::modifyMovingBackward):
              * editing/SelectionController.h:
              (WebCore::SelectionController::isAll):
              * editing/TypingCommand.cpp:
              (WebCore::TypingCommand::deleteKeyPressed):
              (WebCore::TypingCommand::forwardDeleteKeyPressed):
              * editing/VisiblePosition.cpp:
              (WebCore::VisiblePosition::next):
              (WebCore::VisiblePosition::previous):
              * editing/VisiblePosition.h:
              * editing/VisibleSelection.cpp:
              (WebCore::VisibleSelection::isAll):
              (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity):
              * editing/VisibleSelection.h:
              * editing/htmlediting.cpp:
              (WebCore::selectionForParagraphIteration):
              * editing/visible_units.cpp:
              (WebCore::startOfNextParagraph):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ea702bae
  4. 21 Feb, 2011 1 commit
    • rniwa@webkit.org's avatar
      2011-02-17 Ryosuke Niwa <rniwa@webkit.org> · 62b16970
      rniwa@webkit.org authored
              Reviewed by Kent Tamura.
      
              Rename Position::node() to Position::deprecatedNode()
              https://bugs.webkit.org/show_bug.cgi?id=54622
      
              Done the rename. All calls to node() are replaced by calls to deprecatedNode().
      
              * src/WebViewImpl.cpp:
              (WebKit::WebViewImpl::setComposition): Check the nullity of startContainer() instead of startPosition()->node().
              (WebKit::WebViewImpl::confirmComposition): Ditto.
              (WebKit::WebViewImpl::textInputType):
              (WebKit::WebViewImpl::caretOrSelectionBounds):
      2011-02-17  Ryosuke Niwa  <rniwa@webkit.org>
      
              Reviewed by Kent Tamura.
      
              Rename Position::node() to Position::deprecatedNode()
              https://bugs.webkit.org/show_bug.cgi?id=54622
      
              Replaced the call to node() by a call to containerNode() because the returned node is
              used to determine whether or not the selected contents are editable and such a check
              must be done against the container node.
      
              * WebCoreSupport/EditorClientQt.cpp:
              (WebCore::EditorClientQt::handleKeyboardEvent):
      2011-02-17  Ryosuke Niwa  <rniwa@webkit.org>
      
              Reviewed by Kent Tamura.
      
              Rename Position::node() to Position::deprecatedNode()
              https://bugs.webkit.org/show_bug.cgi?id=54622
      
              Done the rename. All calls to node() are replaced by calls to deprecatedNode().
      
              * webkit/webkitwebview.cpp:
              (webkit_web_view_popup_menu_handler):
      2011-02-17  Ryosuke Niwa  <rniwa@webkit.org>
      
              Reviewed by Kent Tamura.
      
              Rename Position::node() to Position::deprecatedNode()
              https://bugs.webkit.org/show_bug.cgi?id=54622
      
              * WebView/WebFrame.mm:
              (-[WebFrame _smartDeleteRangeForProposedRange:]):
      2011-02-17  Ryosuke Niwa  <rniwa@webkit.org>
      
              Reviewed by Kent Tamura.
      
              Rename Position::node() to Position::deprecatedNode()
              https://bugs.webkit.org/show_bug.cgi?id=54622
      
              Replaced the call to node() by a call to containerNode() because the returned node is
              used to determine whether or not the selected contents are editable and such a check
              must be done against the container node.
      
              * WebCoreSupport/EditorClientHaiku.cpp:
              (WebCore::EditorClientHaiku::handleKeyboardEvent):
      2011-02-17  Ryosuke Niwa  <rniwa@webkit.org>
      
              Reviewed by Kent Tamura.
      
              Rename Position::node() to Position::deprecatedNode()
              https://bugs.webkit.org/show_bug.cgi?id=54622
      
              Done the rename. All calls to node() are replaced by calls to deprecatedNode() except when
              calls were of the form node()->document() and node()->inDocument() in which case they were
              replaced by anchorNode()->document() and anchorNode()->inDocument() respectively.
      
              * WebCore.exp.in: Added Position::containerNode.
      
              The rest abbreviated for simplicity. Please see svn log.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@79196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      62b16970
  5. 12 Jan, 2011 1 commit
    • rniwa@webkit.org's avatar
      2011-01-12 Ryosuke Niwa <rniwa@webkit.org> · 7bfcc007
      rniwa@webkit.org authored
              Reviewed by Eric Seidel.
      
              Removed instantiation of legacy editing positions.
              Calls to Position::Position are replaced by calls to Position's convenience functions.
      
              Also added firstPositionInOrBeforeNode and lastPositionInOrAfterNode,
              which are functions that return firstPositionInNode and lastPositionInNode respectively
              when the specified node can have children for editing purpose and return positionBeforeNode
              and positionAfterNode respectively otherwise. They can be used to guarantee that we never
              create a bogus position like [img, 0] or [br, 0].
      
              No tests are added since this is a cleanup.
      
              * editing/ApplyBlockElementCommand.cpp:
              (WebCore::ApplyBlockElementCommand::formatSelection):
              * editing/ApplyStyleCommand.cpp:
              (WebCore::ApplyStyleCommand::applyBlockStyle):
              (WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle):
              (WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
              (WebCore::ApplyStyleCommand::removeInlineStyle):
              (WebCore::ApplyStyleCommand::nodeFullySelected):
              (WebCore::ApplyStyleCommand::nodeFullyUnselected):
              (WebCore::ApplyStyleCommand::splitTextAtStart):
              (WebCore::ApplyStyleCommand::splitTextAtEnd):
              (WebCore::ApplyStyleCommand::splitTextElementAtStart):
              (WebCore::ApplyStyleCommand::splitTextElementAtEnd):
              (WebCore::ApplyStyleCommand::isValidCaretPositionInTextNode):
              (WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
              (WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
              (WebCore::ApplyStyleCommand::computedFontSize):
              (WebCore::ApplyStyleCommand::joinChildTextNodes):
              * editing/ApplyStyleCommand.h:
              * editing/htmlediting.h:
              (WebCore::firstPositionInOrBeforeNode): Added.
              (WebCore::lastPositionInOrAfterNode): Added.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75672 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7bfcc007
  6. 08 Jan, 2011 1 commit
  7. 06 Dec, 2010 1 commit
    • rniwa@webkit.org's avatar
      2010-12-05 Ryosuke Niwa <rniwa@webkit.org> · d87f2f64
      rniwa@webkit.org authored
              Reviewed by Tony Chang.
      
              Executing FormatBlock on multiple paragraphs inside pre does not remove the outer pre
              https://bugs.webkit.org/show_bug.cgi?id=47300
      
              The bug was caused by FormatBlockCommand::formatRange's not removing refNode when the refNode
              contains more than one paragraphs even when the refNode is fully selected.
      
              Fixed the bug by modifying FormatBlockCommand::formatRange to correctly remove the node in
              such a situation.
      
              Also fixed a bug in ApplyBlockElementCommand::formatSelection that the end of selection
              is not properly updated when the end of selection resides in the node split by
              rangeForParagraphSplittingTextNodesIfNeeded or endOfNextParagrahSplittingTextNodesIfNeeded.
      
              Test: editing/execCommand/format-block-multiple-paragraphs-in-pre.html
      
              * editing/ApplyBlockElementCommand.cpp:
              (WebCore::ApplyBlockElementCommand::formatSelection): Calls formatRange with m_endOfLastParagraph.
              (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded): Updates
              m_endOfLastParagraph when the position points to the node split by this function.
              (WebCore::ApplyBlockElementCommand::endOfNextParagrahSplittingTextNodesIfNeeded): Ditto.
              * editing/ApplyBlockElementCommand.h: Added m_endOfLastParagraph as a member variable.
              * editing/FormatBlockCommand.cpp:
              (WebCore::FormatBlockCommand::formatRange): See above.
              * editing/FormatBlockCommand.h:
              * editing/IndentOutdentCommand.cpp:
              (WebCore::IndentOutdentCommand::formatRange): Ignores the end of selection.
              * editing/IndentOutdentCommand.h:
      2010-12-05  Ryosuke Niwa  <rniwa@webkit.org>
      
              Reviewed by Tony Chang.
      
              Executing FormatBlock on multiple paragraphs inside pre does not remove the outer pre
              https://bugs.webkit.org/show_bug.cgi?id=47300
      
              Added a test to ensure execCommand('FormatBlock') correctly removes pre when formatting paragraphs within.
              Also rebaselined several tests because WebKit no longer erroneously format the paragraphs immediately
              after the selection.
      
              * editing/execCommand/format-block-multiple-paragraphs-in-pre-expected.txt: Added.
              * editing/execCommand/format-block-multiple-paragraphs-in-pre.html: Added.
              * editing/execCommand/format-block-multiple-paragraphs-expected.txt: No longer erroneously format
              the last paragraph in a pre by a blockquote when formatting all but the last paragraph in the pre.
              * editing/execCommand/indent-pre-expected.txt: No longer erroneously format the last paragraph in
              the pre-list by a blockquote.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73411 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d87f2f64
  8. 14 Oct, 2010 1 commit
    • rniwa@webkit.org's avatar
      2010-10-14 Ryosuke Niwa <rniwa@webkit.org> · aeeef960
      rniwa@webkit.org authored
              Reviewed by Tony Chang and Darin Adler.
      
              execCommand FormatBlock creates lots of blockquotes
              https://bugs.webkit.org/show_bug.cgi?id=19795
      
              The bug was caused by WebKit's not reusing the block node added by previous iteration
              and its inserting block node at wrong places.
      
              Fixed the bug by rewriting FormatBlockCommand::formatRange.  New code resembles that of
              IndentOutdentCommand::indentIntoBlockquote.  The difference between two is that formatRange
              avoids the existing block elements when replacing blocks and it also adds a placeholder
              when removing the existing block caused paragraphs to collapse.
      
              Also fixed a bug in moveParagraphWithClones where erroneous br is added to the start of
              the block element to which the paragraph is moved if the block element is the start of a paragraph
              and not the end of a paragraph.
      
              Tests: editing/execCommand/format-block-multiple-paragraphs.html
                     editing/execCommand/format-block-table.html
      
              * editing/CompositeEditCommand.cpp:
              (WebCore::CompositeEditCommand::moveParagraphWithClones): No longer adds erroneous br.
              * editing/EditorCommand.cpp:
              (WebCore::executeFormatBlock):
              * editing/FormatBlockCommand.cpp:
              (WebCore::FormatBlockCommand::formatRange): Rewritten; see above.
              (WebCore::FormatBlockCommand::isElementToApplyInFormatBlockCommand): Renamed from validBlockElement
              and moved from htmlediting.cpp.
              (WebCore::enclosingBlockToSplitTreeTo): Added.
              * editing/FormatBlockCommand.h:
              * editing/VisiblePosition.cpp:
              (WebCore::enclosingBlockFlowElement): Changed the return type to Element*
              * editing/VisiblePosition.h:
      2010-10-14  Ryosuke Niwa  <rniwa@webkit.org>
      
              Reviewed by Tony Chang and Darin Adler.
      
              execCommand FormatBlock creates lots of blockquotes
              https://bugs.webkit.org/show_bug.cgi?id=19795
      
              Added tests to ensure WebKit does not add multiple block elements when applying block element to
              multiple paragraphs.  Also added a test to ensure formatBlock works with tables.
      
              * fast/html/nav-element-expected.txt: Preserved new lines and removed redundant br.
              * editing/execCommand/format-block-expected.txt: Preserved span and removed erroneous br.
              * editing/execCommand/format-block-from-range-selection-expected.txt: Merged dl's and removed erroneous br.
              * editing/execCommand/format-block-multiple-paragraphs-expected.txt: Added.
              * editing/execCommand/format-block-multiple-paragraphs.html: Added.
              * editing/execCommand/format-block-table-expected.txt: Added.
              * editing/execCommand/format-block-table.html: Added.
              * editing/execCommand/format-block-with-braces-expected.txt: Removed erroneous br.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      aeeef960
  9. 13 Oct, 2010 2 commits
    • commit-queue@webkit.org's avatar
      2010-10-12 Sheriff Bot <webkit.review.bot@gmail.com> · 93d722a2
      commit-queue@webkit.org authored
              Unreviewed, rolling out r69639.
              http://trac.webkit.org/changeset/69639
              https://bugs.webkit.org/show_bug.cgi?id=47575
      
              "regressed nav-element.html" (Requested by rniwa on #webkit).
      
              * editing/execCommand/format-block-expected.txt:
              * editing/execCommand/format-block-from-range-selection-expected.txt:
              * editing/execCommand/format-block-multiple-paragraphs-expected.txt: Removed.
              * editing/execCommand/format-block-multiple-paragraphs.html: Removed.
              * editing/execCommand/format-block-table-expected.txt: Removed.
              * editing/execCommand/format-block-table.html: Removed.
              * editing/execCommand/format-block-with-braces-expected.txt:
      2010-10-12  Sheriff Bot  <webkit.review.bot@gmail.com>
      
              Unreviewed, rolling out r69639.
              http://trac.webkit.org/changeset/69639
              https://bugs.webkit.org/show_bug.cgi?id=47575
      
              "regressed nav-element.html" (Requested by rniwa on #webkit).
      
              * editing/ApplyBlockElementCommand.cpp:
              (WebCore::ApplyBlockElementCommand::formatSelection):
              * editing/EditorCommand.cpp:
              (WebCore::executeFormatBlock):
              * editing/FormatBlockCommand.cpp:
              (WebCore::FormatBlockCommand::formatRange):
              * editing/FormatBlockCommand.h:
              (WebCore::FormatBlockCommand::editingAction):
              * editing/VisiblePosition.cpp:
              (WebCore::enclosingBlockFlowElement):
              * editing/VisiblePosition.h:
              * editing/htmlediting.cpp:
              (WebCore::validBlockTag):
              * editing/htmlediting.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      93d722a2
    • rniwa@webkit.org's avatar
      2010-10-12 Ryosuke Niwa <rniwa@webkit.org> · 65f41609
      rniwa@webkit.org authored
              Reviewed by Tony Chang.
      
              execCommand FormatBlock creates lots of blockquotes
              https://bugs.webkit.org/show_bug.cgi?id=19795
      
              The bug was caused by WebKit's not reusing the block node added by previous iteration
              and its inserting block node at wrong places.
      
              Fixed the bug by rewriting FormatBlockCommand::formatRange.  New code resembles that of
              IndentOutdentCommand::indentIntoBlockquote.  The difference between two is that formatRange
              avoids the existing block elements when replacing blocks and it also adds a placeholder
              when removing the existing block caused paragraphs to collapse.
      
              Tests: editing/execCommand/format-block-multiple-paragraphs.html
                     editing/execCommand/format-block-table.html
      
              * editing/EditorCommand.cpp:
              (WebCore::executeFormatBlock):
              * editing/FormatBlockCommand.cpp:
              (WebCore::FormatBlockCommand::formatRange): Rewritten; see above.
              (WebCore::FormatBlockCommand::isElementToApplyInFormatBlockCommand): Renamed from validBlockElement
              and moved from htmlediting.cpp.
              (WebCore::FormatBlockCommand::enclosingBlockToSplitTreeTo): Added.
              * editing/FormatBlockCommand.h:
              * editing/VisiblePosition.cpp:
              (WebCore::enclosingBlockFlowElement): Changed the return type to Element*
              * editing/VisiblePosition.h:
      2010-10-12  Ryosuke Niwa  <rniwa@webkit.org>
      
              Reviewed by Tony Chang.
      
              execCommand FormatBlock creates lots of blockquotes
              https://bugs.webkit.org/show_bug.cgi?id=19795
      
              Added tests to ensure WebKit does not add multiple block elements when applying block element to
              multiple paragraphs.  Also added a test to ensure formatBlock works with tables.
      
              * editing/execCommand/format-block-expected.txt: Preserved span and removed erroneous br.
              * editing/execCommand/format-block-from-range-selection-expected.txt: Merged dl's and removed erroneous br.
              * editing/execCommand/format-block-multiple-paragraphs-expected.txt: Added.
              * editing/execCommand/format-block-multiple-paragraphs.html: Added.
              * editing/execCommand/format-block-table-expected.txt: Added.
              * editing/execCommand/format-block-table.html: Added.
              * editing/execCommand/format-block-with-braces-expected.txt: Removed erroneous br.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      65f41609
  10. 07 Oct, 2010 1 commit
    • rniwa@webkit.org's avatar
      2010-10-07 Ryosuke Niwa <rniwa@webkit.org> · 148eaf51
      rniwa@webkit.org authored
              Reviewed by Tony Chang.
      
              REGRESSION: Indenting pre duplicates content
              https://bugs.webkit.org/show_bug.cgi?id=47233
      
              The bug was caused by our not splitting text nodes properly.
      
              In new approach, we split text nodes in each iteration. Added rangeForParagraphSplitingTextNodesIfNeeded
              to split text nodes at the start and at the end of paragraph, which also adjusts start and end positions
              for moveParagraphWithClones. Added endOfNextParagrahSplittingTextNodesIfNeeded to adjust endOfNextParagraph,
              start, and end to work-around moveParagraphWithClones's removing a line feed.
      
              Tests: editing/execCommand/indent-pre-list.html
                     editing/execCommand/indent-pre-paragraphs.html
      
              * editing/ApplyBlockElementCommand.cpp:
              (WebCore::ApplyBlockElementCommand::formatSelection): See above.
              (WebCore::isNewLineAtPosition):
              (WebCore::renderStyleOfEnclosingTextNode): Added.
              (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded): Added.
              (WebCore::ApplyBlockElementCommand::endOfNextParagrahSplittingTextNodesIfNeeded): Added.
              * editing/ApplyBlockElementCommand.h:
              * editing/FormatBlockCommand.cpp:
              (WebCore::FormatBlockCommand::formatRange): Takes two Positions instead of one VisiblePosition.
              * editing/FormatBlockCommand.h:
              * editing/IndentOutdentCommand.cpp:
              (WebCore::IndentOutdentCommand::tryIndentingAsListItem): Ditto.
              (WebCore::IndentOutdentCommand::indentIntoBlockquote): Ditto.
              (WebCore::IndentOutdentCommand::formatRange): Ditto.
              * editing/IndentOutdentCommand.h:
      2010-10-07  Ryosuke Niwa  <rniwa@webkit.org>
      
              Reviewed by Tony Chang.
      
              REGRESSION: Indenting pre duplicates content
              https://bugs.webkit.org/show_bug.cgi?id=47233
      
              Added tests to ensure WebKit indents texts inside pre correctly.
      
              * editing/execCommand/indent-pre-expected.txt: This test passes if WebKit does not crash.
              * editing/execCommand/indent-pre-list-expected.txt: Added.
              * editing/execCommand/indent-pre-list.html: Added.
              * editing/execCommand/indent-pre-paragraphs-expected.txt: Added.
              * editing/execCommand/indent-pre-paragraphs.html: Added.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      148eaf51
  11. 01 Oct, 2010 1 commit
    • rniwa@webkit.org's avatar
      2010-10-01 Ryosuke Niwa <rniwa@webkit.org> · 850699fa
      rniwa@webkit.org authored
              Reviewed by Darin Adler.
      
              FormatBlockCommand and IndentOutdentCommand should use the same code to iterate paragraphs
              https://bugs.webkit.org/show_bug.cgi?id=46840
      
              Added ApplyBlockElementCommand, which is an abstract class inherited by FormatBlockCommand
              and IndentOutdentCommand.  It is intended to be inherited by InsertListCommand as well.
      
              ApplyBlockElementCommand's doApply verifies the current selection and exits early
              if it's invalid or orphaned or if the current selection is outside editable region.
              It then calls formatSelection to apply the block element after which doApply restores the selection.
              formatSelection iterates through paragraphs and calls formatParagraph, a pure virtual function
              implemented by FormatBlockCommand and IndentOutdentCommand, on each paragraph.
      
              No new tests are added since this is a refactoring.
      
              * Android.mk: Added ApplyBlockElementCommand.cpp.
              * CMakeLists.txt: Ditto.
              * GNUmakefile.am: Added ApplyBlockElementCommand.cpp and ApplyBlockElementCommand.h.
              * WebCore.gypi: Ditto.
              * WebCore.pro: Ditto.
              * WebCore.xcodeproj/project.pbxproj: Ditto.
              * editing/ApplyBlockElementCommand.cpp: Added.
              (WebCore::countParagraphs): Moved from IndentOutdentCommand.cpp
              (WebCore::ApplyBlockElementCommand::ApplyBlockElementCommand): Added.
              (WebCore::ApplyBlockElementCommand::doApply): Moved from IndentOutdentCommand::doApply.
              (WebCore::ApplyBlockElementCommand::formatSelection): Moved from IndentOutdentCommand::indentRegion.
              (WebCore::ApplyBlockElementCommand::createBlockElement): Added.
              (WebCore::ApplyBlockElementCommand::splitTextNodes): Moved from IndentOutdentCommand::splitTextNodes.
              * editing/ApplyBlockElementCommand.h: Added.
              * editing/EditingAllInOne.cpp:
              * editing/EditorCommand.cpp:
              (WebCore::executeFormatBlock):
              * editing/FormatBlockCommand.cpp: Removed doApply.
              (WebCore::FormatBlockCommand::FormatBlockCommand): Calls ApplyBlockElementCommand's constructor.
              (WebCore::FormatBlockCommand::formatParagraph): Renamed from doApplyForSingleParagraph.
              * editing/FormatBlockCommand.h: FormatBlockCommand inherits from ApplyBlockElementCommand.
              (WebCore::FormatBlockCommand::create): Uses QualifiedName for the tag name instead of AtomicString.
              * editing/IndentOutdentCommand.cpp: Removed doApply, indentIntoBlockquote, and splitTextNodes.
              (WebCore::IndentOutdentCommand::IndentOutdentCommand): Calls ApplyBlockElementCommand's constructor.
              (WebCore::IndentOutdentCommand::indentIntoBlockquote): The code to nullify targetBlockquote
              when the next paragraph is in a different table cell is moved to ApplyBlockElementCommand::formatSelection.
              (WebCore::IndentOutdentCommand::formatSelection): Added. Calls outdentRegion when outdenting.
              (WebCore::IndentOutdentCommand::formatParagraph): Added. Calls tryIndentingAsListItem and indentIntoBlockquote.
              * editing/IndentOutdentCommand.h: IndentOutdentCommand inherits from ApplyBlockElementCommand.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68972 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      850699fa