Changeset 27369 in webkit
- Timestamp:
- Nov 1, 2007, 3:58:47 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r27367 r27369 1 2007-11-01 Justin Garcia <justin.garcia@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 <rdar://problem/5195056> Huge plain text pastes are slow, time spent in ApplyStyleCommand::doApply 6 7 * editing/ReplaceSelectionCommand.cpp: 8 (WebCore::ReplaceSelectionCommand::doApply): No need to match style when pasting 9 into a plaintext-only region, since when we build the fragment to insert from 10 plain text, we don't put any style information on it, so it will automatically 11 match style with no intervention. 12 * editing/markup.cpp: 13 (WebCore::createFragmentFromText): Place paragraphs into clones of the 14 block being inserted into, instead of default paragraph elements, 15 so that when inserted content will match the surrounding paragraph style. 16 This was broken before, but I haven't added a layout test yet because 17 there currently isn't a way to get only plain text onto the pasteboard 18 in a layout test. 19 1 20 2007-11-01 Sam Weinig <sam@webkit.org> 2 21 -
trunk/WebCore/editing/ReplaceSelectionCommand.cpp
r27280 r27369 518 518 519 519 bool selectionIsPlainText = !selection.isContentRichlyEditable(); 520 if (selectionIsPlainText)521 m_matchStyle = true;522 520 523 521 Element* currentRoot = selection.rootEditableElement(); -
trunk/WebCore/editing/markup.cpp
r27293 r27369 972 972 if (!context) 973 973 return 0; 974 975 Node* block = enclosingBlock(context->startNode()); 974 976 975 977 Node* styleNode = context->startNode(); … … 1025 1027 element->setAttribute(classAttr, AppleInterchangeNewline); 1026 1028 } else { 1027 element = createDefaultParagraphElement(document);1029 element = static_cast<Element *>(block->cloneNode(false).get()); 1028 1030 fillContainerFromString(element.get(), s); 1029 1031 } -
trunk/WebKit/ChangeLog
r27332 r27369 1 2007-11-01 Justin Garcia <justin.garcia@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 <rdar://problem/5195056> Huge plain text pastes are slow, time spent in ApplyStyleCommand::doApply 6 7 No need to match style when pasting plain text, since the fragment we build for plain text 8 won't have any style information on it. 9 10 * WebView/WebHTMLView.mm: 11 (-[WebHTMLView _documentFragmentFromPasteboard:inContext:allowPlainText:]): There's no 12 longer a need to know whether this function chosePlaintext. 13 (-[WebHTMLView _pasteWithPasteboard:allowPlainText:]): 14 (-[WebHTMLView _documentFragmentFromPasteboard:]): 15 1 16 2007-10-31 Timothy Hatcher <timothy@apple.com> 2 17 -
trunk/WebKit/WebView/WebHTMLView.mm
r27264 r27369 296 296 @interface WebHTMLView (WebHTMLViewFileInternal) 297 297 - (BOOL)_imageExistsAtPaths:(NSArray *)paths; 298 - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard inContext:(DOMRange *)context allowPlainText:(BOOL)allowPlainText chosePlainText:(BOOL *)chosePlainText;298 - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard inContext:(DOMRange *)context allowPlainText:(BOOL)allowPlainText; 299 299 - (NSString *)_plainTextFromPasteboard:(NSPasteboard *)pasteboard; 300 300 - (void)_pasteWithPasteboard:(NSPasteboard *)pasteboard allowPlainText:(BOOL)allowPlainText; … … 553 553 inContext:(DOMRange *)context 554 554 allowPlainText:(BOOL)allowPlainText 555 chosePlainText:(BOOL *)chosePlainText556 555 { 557 556 NSArray *types = [pasteboard types]; 558 *chosePlainText = NO;559 557 DOMDocumentFragment *fragment = nil; 560 558 … … 620 618 inContext:context 621 619 subresources:0])) { 622 *chosePlainText = YES;623 620 return fragment; 624 621 } … … 667 664 { 668 665 DOMRange *range = [self _selectedRange]; 669 BOOL chosePlainText;670 666 DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard 671 inContext:range allowPlainText:allowPlainText chosePlainText:&chosePlainText];667 inContext:range allowPlainText:allowPlainText]; 672 668 WebFrameBridge *bridge = [self _bridge]; 673 669 if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:[self _selectedRange] givenAction:WebViewInsertActionPasted]) { 674 [bridge replaceSelectionWithFragment:fragment selectReplacement:NO smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard] matchStyle: chosePlainText];670 [bridge replaceSelectionWithFragment:fragment selectReplacement:NO smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard] matchStyle:NO]; 675 671 } 676 672 } … … 5093 5089 - (DOMDocumentFragment*)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard 5094 5090 { 5095 BOOL discard; 5096 return [self _documentFragmentFromPasteboard:pasteboard inContext:nil allowPlainText:NO chosePlainText:&discard]; 5091 return [self _documentFragmentFromPasteboard:pasteboard inContext:nil allowPlainText:NO]; 5097 5092 } 5098 5093
Note:
See TracChangeset
for help on using the changeset viewer.