Changeset 61968 in webkit


Ignore:
Timestamp:
Jun 27, 2010 7:14:28 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-06-27 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

editing/execCommand/copy-without-selection.html fails on Qt after r61637
https://bugs.webkit.org/show_bug.cgi?id=41025

Unskip editing/execCommand/copy-without-selection.html for Qt.

  • platform/qt/Skipped:

2010-06-27 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

editing/execCommand/copy-without-selection.html fails on Qt after r61637
https://bugs.webkit.org/show_bug.cgi?id=41025

The problem was that when getting data back via Clipboard::getData(),
the String::String(const char*, int) constructor was called
with UTF-16 data.

The solution is to use QMimeData's text() and setText() for "text/plain".

setText() which makes sure Qt passes the string in proper format to the
system clipboard. (The previous implementation would convert it to UTF-8)

text() makes sure that the correct encoding is used (UTF-16) and that
we get back whatever we originally put in there.

  • platform/qt/ClipboardQt.cpp: (WebCore::isTextMimeType): (WebCore::ClipboardQt::getData): (WebCore::ClipboardQt::setData):
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r61967 r61968  
     12010-06-27  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        editing/execCommand/copy-without-selection.html fails on Qt after r61637
     6        https://bugs.webkit.org/show_bug.cgi?id=41025
     7
     8        Unskip editing/execCommand/copy-without-selection.html for Qt.
     9
     10        * platform/qt/Skipped:
     11
    1122010-06-27  Mikhail Naganov  <mnaganov@chromium.org>
    213
  • trunk/LayoutTests/platform/qt/Skipped

    r61953 r61968  
    54385438fast/js/sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Context/10.2.2_Eval_Code/S10.2.2_A1.2_T9.html
    54395439
    5440 # Clipboard::setData is broken on Qt
    5441 # https://bugs.webkit.org/show_bug.cgi?id=41025
    5442 editing/execCommand/copy-without-selection.html
    5443 
    54445440# [Qt] Regression(r61749): inspector/debugger-pause-on-debugger-statement.html fails
    54455441# https://bugs.webkit.org/show_bug.cgi?id=41147
  • trunk/WebCore/ChangeLog

    r61966 r61968  
     12010-06-27  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        editing/execCommand/copy-without-selection.html fails on Qt after r61637
     6        https://bugs.webkit.org/show_bug.cgi?id=41025
     7
     8        The problem was that when getting data back via Clipboard::getData(),
     9        the String::String(const char*, int) constructor was called
     10        with UTF-16 data.
     11
     12        The solution is to use QMimeData's text() and setText() for "text/plain".
     13
     14        setText() which makes sure Qt passes the string in proper format to the
     15        system clipboard. (The previous implementation would convert it to UTF-8)
     16
     17        text() makes sure that the correct encoding is used (UTF-16) and that
     18        we get back whatever we originally put in there.
     19
     20        * platform/qt/ClipboardQt.cpp:
     21        (WebCore::isTextMimeType):
     22        (WebCore::ClipboardQt::getData):
     23        (WebCore::ClipboardQt::setData):
     24
    1252010-06-27  Adam Barth  <abarth@webkit.org>
    226
  • trunk/WebCore/platform/qt/ClipboardQt.cpp

    r61178 r61968  
    5858namespace WebCore {
    5959
     60static bool isTextMimeType(const String& type)
     61{
     62    return type == "text/plain" || type.startsWith("text/plain;");
     63}
     64
    6065ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, const QMimeData* readableClipboard)
    6166    : Clipboard(policy, true)
     
    131136    }
    132137
     138    if (isTextMimeType(type) && m_readableData->hasText()) {
     139        success = true;
     140        return m_readableData->text();
     141    }
     142
    133143    ASSERT(m_readableData);
    134144    QByteArray data = m_readableData->data(QString(type));
    135145    success = !data.isEmpty();
    136     return String(data.data(), data.size());
     146    return String(data.constData(), data.size());
    137147}
    138148
     
    144154    if (!m_writableData)
    145155        m_writableData = new QMimeData;
    146     QByteArray array(reinterpret_cast<const char*>(data.characters()),
    147                      data.length()*2);
    148     m_writableData->setData(QString(type), array);
     156
     157    if (isTextMimeType(type))
     158        m_writableData->setText(QString(data));
     159    else {
     160        QByteArray array(reinterpret_cast<const char*>(data.characters()), data.length() * 2);
     161        m_writableData->setData(QString(type), array);
     162    }
     163
    149164#ifndef QT_NO_CLIPBOARD
    150165    if (!isForDragging())
Note: See TracChangeset for help on using the changeset viewer.