Changeset 146910 in webkit
- Timestamp:
- Mar 26, 2013 11:10:05 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r146907 r146910 1 2013-03-26 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 3 [Qt] editing/pasteboard/can-read-in-dragstart-event.html and /can-read-in-copy-and-cut-events.html are crashing 4 https://bugs.webkit.org/show_bug.cgi?id=113126 5 6 Reviewed by Jocelyn Turcotte. 7 8 Unskip now working editing/pasteboard/can-read-in-copy-and-cut-events.html. 9 The other test still needs better drag-and-drop support in DRT. 10 11 * platform/qt/TestExpectations: 12 1 13 2013-03-26 Sergio Villar Senin <svillar@igalia.com> 2 14 -
trunk/LayoutTests/platform/qt/TestExpectations
r146876 r146910 584 584 webkit.org/b/111853 editing/pasteboard/cleanup-on-move.html [ Skip ] 585 585 webkit.org/b/111853 editing/pasteboard/drag-list-item.html [ Skip ] 586 587 webkit.org/b/113126 editing/pasteboard/can-read-in-dragstart-event.html [ Skip ] 586 588 587 589 # =========================================================================== # … … 2716 2718 # Feature not implemented 2717 2719 webkit.org/b/91611 [ Mac Win ] media/media-higher-prio-audio-stream.html [ Skip ] 2718 2719 webkit.org/b/113126 editing/pasteboard/can-read-in-dragstart-event.html [ Skip ]2720 webkit.org/b/113126 editing/pasteboard/can-read-in-copy-and-cut-events.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r146909 r146910 1 2013-03-26 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 3 [Qt] editing/pasteboard/can-read-in-dragstart-event.html and /can-read-in-copy-and-cut-events.html are crashing 4 https://bugs.webkit.org/show_bug.cgi?id=113126 5 6 Reviewed by Jocelyn Turcotte. 7 8 Make it possible to read from a writable Clipboard. 9 10 Test: editing/pasteboard/can-read-in-copy-and-cut-events.html 11 12 * platform/qt/ClipboardQt.cpp: 13 (WebCore::ClipboardQt::getData): 14 (WebCore::ClipboardQt::types): 15 (WebCore::ClipboardQt::files): 16 (WebCore::ClipboardQt::readClipboardData): 17 (WebCore::ClipboardQt::hasData): 18 (WebCore::ClipboardQt::items): 19 * platform/qt/ClipboardQt.h: 20 (ClipboardQt): 21 1 22 2013-03-26 Brent Fulgham <bfulgham@webkit.org> 2 23 -
trunk/Source/WebCore/platform/qt/ClipboardQt.cpp
r146835 r146910 56 56 #include <QTextCodec> 57 57 #include <QUrl> 58 #include <qdebug.h>59 60 #define methodDebug() qDebug("ClipboardQt: %s", __FUNCTION__)61 58 62 59 namespace WebCore { … … 146 143 String ClipboardQt::getData(const String& type) const 147 144 { 148 149 if (!canReadData() )145 const QMimeData* data = readData(); 146 if (!canReadData() || !data) 150 147 return String(); 151 148 152 if (isHtmlMimeType(type) && m_readableData->hasHtml()) 153 return m_readableData->html(); 154 155 if (isTextMimeType(type) && m_readableData->hasText()) 156 return m_readableData->text(); 157 158 // FIXME: Per the spec, reading the clipboard in dragstart events should also be allowed. 159 // See https://bugs.webkit.org/show_bug.cgi?id=113126. 160 if (!m_readableData) 161 return String(); 162 163 QByteArray rawData = m_readableData->data(type); 164 QString data = QTextCodec::codecForName("UTF-16")->toUnicode(rawData); 165 return data; 149 if (isHtmlMimeType(type) && data->hasHtml()) 150 return data->html(); 151 152 if (isTextMimeType(type) && data->hasText()) 153 return data->text(); 154 155 QByteArray rawData = data->data(type); 156 QString stringData = QTextCodec::codecForName("UTF-16")->toUnicode(rawData); 157 return stringData; 166 158 } 167 159 … … 189 181 ListHashSet<String> ClipboardQt::types() const 190 182 { 191 if (!canReadTypes()) 183 const QMimeData* data = readData(); 184 if (!canReadTypes() || !data) 192 185 return ListHashSet<String>(); 193 186 194 // FIXME: Per the spec, reading the clipboard in dragstart events should also be allowed.195 // See https://bugs.webkit.org/show_bug.cgi?id=113126.196 if (!m_readableData)197 return ListHashSet<String>();198 199 187 ListHashSet<String> result; 200 QStringList formats = m_readableData->formats();188 QStringList formats = data->formats(); 201 189 for (int i = 0; i < formats.count(); ++i) 202 190 result.add(formats.at(i)); … … 206 194 PassRefPtr<FileList> ClipboardQt::files() const 207 195 { 208 // FIXME: Per the spec, reading the clipboard in dragstart events should also be allowed. 209 // See https://bugs.webkit.org/show_bug.cgi?id=113126. 210 if (!canReadData() || !m_readableData || !m_readableData->hasUrls()) 196 const QMimeData* data = readData(); 197 if (!canReadData() || !data || !data->hasUrls()) 211 198 return FileList::create(); 212 199 213 200 RefPtr<FileList> fileList = FileList::create(); 214 QList<QUrl> urls = m_readableData->urls();201 QList<QUrl> urls = data->urls(); 215 202 216 203 for (int i = 0; i < urls.size(); i++) { … … 260 247 return 0; 261 248 } 262 263 249 264 250 static CachedImage* getCachedImage(Element* element) … … 350 336 } 351 337 338 const QMimeData* ClipboardQt::readData() const 339 { 340 ASSERT(!(m_readableData && m_writableData)); 341 ASSERT(m_readableData || m_writableData || canWriteData()); 342 return m_readableData ? m_readableData : m_writableData; 343 } 344 352 345 bool ClipboardQt::hasData() 353 346 { 354 const QMimeData *data = m_readableData ? m_readableData : m_writableData;347 const QMimeData *data = readData(); 355 348 if (!data) 356 349 return false; … … 361 354 PassRefPtr<DataTransferItemList> ClipboardQt::items() 362 355 { 363 364 356 if (!m_frame && !m_frame->document()) 365 357 return 0; … … 367 359 RefPtr<DataTransferItemListQt> items = DataTransferItemListQt::create(this, m_frame->document()->scriptExecutionContext()); 368 360 369 if (!m_readableData) 370 return items; 371 372 if (isForCopyAndPaste() && canReadData()) { 373 const QStringList types = m_readableData->formats(); 361 const QMimeData* readableData = readData(); 362 if (readableData && isForCopyAndPaste() && canReadData()) { 363 const QStringList types = readableData->formats(); 374 364 for (int i = 0; i < types.count(); ++i) 375 365 items->addPasteboardItem(types.at(i)); -
trunk/Source/WebCore/platform/qt/ClipboardQt.h
r142170 r146910 87 87 void setDragImage(CachedImage*, Node*, const IntPoint& loc); 88 88 89 const QMimeData* readData() const; 90 89 91 const QMimeData* m_readableData; 90 92 QMimeData* m_writableData;
Note: See TracChangeset
for help on using the changeset viewer.