Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2292913002: Ensure clean layout before calling plainText() (flat tree version) (Closed)
Patch Set: 201609021415 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/SelectionController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 1064
1065 String FrameSelection::selectedHTMLForClipboard() const 1065 String FrameSelection::selectedHTMLForClipboard() const
1066 { 1066 {
1067 const VisibleSelectionInFlatTree& visibleSelection = this->visibleSelection< EditingInFlatTreeStrategy>(); 1067 const VisibleSelectionInFlatTree& visibleSelection = this->visibleSelection< EditingInFlatTreeStrategy>();
1068 const EphemeralRangeInFlatTree& range = visibleSelection.toNormalizedEphemer alRange(); 1068 const EphemeralRangeInFlatTree& range = visibleSelection.toNormalizedEphemer alRange();
1069 return createMarkup(range.startPosition(), range.endPosition(), AnnotateForI nterchange, ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 1069 return createMarkup(range.startPosition(), range.endPosition(), AnnotateForI nterchange, ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
1070 } 1070 }
1071 1071
1072 String FrameSelection::selectedText(TextIteratorBehavior behavior) const 1072 String FrameSelection::selectedText(TextIteratorBehavior behavior) const
1073 { 1073 {
1074 if (!isAvailable())
1075 return emptyString();
1076
1077 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1078 // needs to be audited. See http://crbug.com/590369 for more details.
1079 m_document->updateStyleAndLayoutIgnorePendingStylesheets();
1080
1074 return extractSelectedText(*this, behavior); 1081 return extractSelectedText(*this, behavior);
1075 } 1082 }
1076 1083
1077 String FrameSelection::selectedTextForClipboard() const 1084 String FrameSelection::selectedTextForClipboard() const
1078 { 1085 {
1079 if (m_frame->settings() && m_frame->settings()->selectionIncludesAltImageTex t()) 1086 if (m_frame->settings() && m_frame->settings()->selectionIncludesAltImageTex t())
1080 return extractSelectedText(*this, TextIteratorEmitsImageAltText); 1087 return extractSelectedText(*this, TextIteratorEmitsImageAltText);
1081 return selectedText(); 1088 return extractSelectedText(*this, TextIteratorDefaultBehavior);
1082 } 1089 }
1083 1090
1084 LayoutRect FrameSelection::bounds() const 1091 LayoutRect FrameSelection::bounds() const
1085 { 1092 {
1086 FrameView* view = m_frame->view(); 1093 FrameView* view = m_frame->view();
1087 if (!view) 1094 if (!view)
1088 return LayoutRect(); 1095 return LayoutRect();
1089 1096
1090 return intersection(unclippedBounds(), LayoutRect(view->visibleContentRect() )); 1097 return intersection(unclippedBounds(), LayoutRect(view->visibleContentRect() ));
1091 } 1098 }
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 1379
1373 void showTree(const blink::FrameSelection* sel) 1380 void showTree(const blink::FrameSelection* sel)
1374 { 1381 {
1375 if (sel) 1382 if (sel)
1376 sel->showTreeForThis(); 1383 sel->showTreeForThis();
1377 else 1384 else
1378 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1385 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1379 } 1386 }
1380 1387
1381 #endif 1388 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/SelectionController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698