diff options
author | Kristian Monsen <kristianm@google.com> | 2010-07-30 10:46:49 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2010-08-04 13:01:34 +0100 |
commit | 0617145a89917ae7735fe1c9538688ab9a577df5 (patch) | |
tree | 56206078694427c37ed7bdf27eb5221398b833c0 /WebCore/platform/chromium | |
parent | ef1adcdfc805d4d13103f6f15cc5b4d96828a60f (diff) | |
download | external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.zip external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.gz external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.bz2 |
Merge WebKit at r64264 : Initial merge by git.
Change-Id: Ic42bef02efef8217a0f84c47176a9c617c28d1f1
Diffstat (limited to 'WebCore/platform/chromium')
-rw-r--r-- | WebCore/platform/chromium/ChromiumBridge.h | 4 | ||||
-rw-r--r-- | WebCore/platform/chromium/ClipboardChromium.cpp | 18 | ||||
-rw-r--r-- | WebCore/platform/chromium/ClipboardChromium.h | 6 | ||||
-rw-r--r-- | WebCore/platform/chromium/DragDataChromium.cpp | 10 | ||||
-rw-r--r-- | WebCore/platform/chromium/PlatformThemeChromiumGtk.cpp | 4 | ||||
-rw-r--r-- | WebCore/platform/chromium/PopupMenuChromium.cpp | 37 |
6 files changed, 49 insertions, 30 deletions
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h index 2d9695e..711c728 100644 --- a/WebCore/platform/chromium/ChromiumBridge.h +++ b/WebCore/platform/chromium/ChromiumBridge.h @@ -155,8 +155,7 @@ namespace WebCore { // Geolocation -------------------------------------------------------- static GeolocationServiceBridge* createGeolocationServiceBridge(GeolocationServiceChromium*); - // HTML5 DB ----------------------------------------------------------- -#if ENABLE(DATABASE) + // Databases ---------------------------------------------------------- // Returns a handle to the DB file and ooptionally a handle to its containing directory static PlatformFileHandle databaseOpenFile(const String& vfsFleName, int desiredFlags); // Returns a SQLite code (SQLITE_OK = 0, on success) @@ -165,7 +164,6 @@ namespace WebCore { static long databaseGetFileAttributes(const String& vfsFileName); // Returns the size of the DB file static long long databaseGetFileSize(const String& vfsFileName); -#endif // IndexedDB ---------------------------------------------------------- static PassRefPtr<IndexedDatabase> indexedDatabase(); diff --git a/WebCore/platform/chromium/ClipboardChromium.cpp b/WebCore/platform/chromium/ClipboardChromium.cpp index 8aad8aa..06244a2 100644 --- a/WebCore/platform/chromium/ClipboardChromium.cpp +++ b/WebCore/platform/chromium/ClipboardChromium.cpp @@ -32,6 +32,7 @@ #include "ChromiumDataObject.h" #include "ClipboardUtilitiesChromium.h" #include "Document.h" +#include "DragData.h" #include "Element.h" #include "FileList.h" #include "Frame.h" @@ -43,6 +44,7 @@ #include "PlatformString.h" #include "Range.h" #include "RenderImage.h" +#include "ScriptExecutionContext.h" #include "StringBuilder.h" #include "markup.h" @@ -89,18 +91,25 @@ static ClipboardDataType clipboardTypeFromMIMEType(const String& type) return ClipboardDataTypeOther; } +PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData* dragData, Frame* frame) +{ + return ClipboardChromium::create(true, dragData->platformData(), policy, frame); +} + ClipboardChromium::ClipboardChromium(bool isForDragging, PassRefPtr<ChromiumDataObject> dataObject, - ClipboardAccessPolicy policy) + ClipboardAccessPolicy policy, + Frame* frame) : Clipboard(policy, isForDragging) , m_dataObject(dataObject) + , m_frame(frame) { } PassRefPtr<ClipboardChromium> ClipboardChromium::create(bool isForDragging, - PassRefPtr<ChromiumDataObject> dataObject, ClipboardAccessPolicy policy) + PassRefPtr<ChromiumDataObject> dataObject, ClipboardAccessPolicy policy, Frame* frame) { - return adoptRef(new ClipboardChromium(isForDragging, dataObject, policy)); + return adoptRef(new ClipboardChromium(isForDragging, dataObject, policy, frame)); } void ClipboardChromium::clearData(const String& type) @@ -355,9 +364,10 @@ PassRefPtr<FileList> ClipboardChromium::files() const if (!m_dataObject || m_dataObject->filenames.isEmpty()) return FileList::create(); + ScriptExecutionContext* scriptExecutionContext = m_frame->document()->scriptExecutionContext(); RefPtr<FileList> fileList = FileList::create(); for (size_t i = 0; i < m_dataObject->filenames.size(); ++i) - fileList->append(File::create(m_dataObject->filenames.at(i))); + fileList->append(File::create(scriptExecutionContext, m_dataObject->filenames.at(i))); return fileList.release(); } diff --git a/WebCore/platform/chromium/ClipboardChromium.h b/WebCore/platform/chromium/ClipboardChromium.h index fbebde2..a4150d0 100644 --- a/WebCore/platform/chromium/ClipboardChromium.h +++ b/WebCore/platform/chromium/ClipboardChromium.h @@ -38,6 +38,7 @@ namespace WebCore { class CachedImage; class ChromiumDataObject; + class Frame; class IntPoint; class ClipboardChromium : public Clipboard, public CachedResourceClient { @@ -45,7 +46,7 @@ namespace WebCore { ~ClipboardChromium() {} static PassRefPtr<ClipboardChromium> create( - bool isForDragging, PassRefPtr<ChromiumDataObject>, ClipboardAccessPolicy); + bool isForDragging, PassRefPtr<ChromiumDataObject>, ClipboardAccessPolicy, Frame*); // Returns the file name (not including the extension). This removes any // invalid file system characters as well as making sure the @@ -79,11 +80,12 @@ namespace WebCore { virtual bool hasData(); private: - ClipboardChromium(bool, PassRefPtr<ChromiumDataObject>, ClipboardAccessPolicy); + ClipboardChromium(bool, PassRefPtr<ChromiumDataObject>, ClipboardAccessPolicy, Frame*); void resetFromClipboard(); void setDragImage(CachedImage*, Node*, const IntPoint&); RefPtr<ChromiumDataObject> m_dataObject; + Frame* m_frame; }; } // namespace WebCore diff --git a/WebCore/platform/chromium/DragDataChromium.cpp b/WebCore/platform/chromium/DragDataChromium.cpp index 2c2151a..674d34d 100644 --- a/WebCore/platform/chromium/DragDataChromium.cpp +++ b/WebCore/platform/chromium/DragDataChromium.cpp @@ -32,8 +32,6 @@ #include "ChromiumBridge.h" #include "ChromiumDataObject.h" -#include "Clipboard.h" -#include "ClipboardChromium.h" #include "DocumentFragment.h" #include "FileSystem.h" #include "KURL.h" @@ -48,14 +46,6 @@ static bool containsHTML(const ChromiumDataObject* dropData) return dropData->textHtml.length() > 0; } -PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const -{ - RefPtr<ClipboardChromium> clipboard = ClipboardChromium::create(true, - m_platformDragData, policy); - - return clipboard.release(); -} - bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const { return !asURL(filenamePolicy).isEmpty(); diff --git a/WebCore/platform/chromium/PlatformThemeChromiumGtk.cpp b/WebCore/platform/chromium/PlatformThemeChromiumGtk.cpp index 1f74840..6529482 100644 --- a/WebCore/platform/chromium/PlatformThemeChromiumGtk.cpp +++ b/WebCore/platform/chromium/PlatformThemeChromiumGtk.cpp @@ -180,8 +180,8 @@ void PlatformThemeChromiumGtk::paintArrowButton(GraphicsContext* gc, const IntRe paint.setColor(outlineColor(trackHSV, thumbHSV)); canvas->drawPath(outline, paint); - // If the button is disabled, the arrow is drawn with the outline color. - if (states & EnabledState) + // If the button is disabled or read-only, the arrow is drawn with the outline color. + if (states & EnabledState && !(states & ReadOnlyState)) paint.setColor(SK_ColorBLACK); paint.setAntiAlias(false); diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp index 4701a75..d07ba2e 100644 --- a/WebCore/platform/chromium/PopupMenuChromium.cpp +++ b/WebCore/platform/chromium/PopupMenuChromium.cpp @@ -71,6 +71,7 @@ static const int kMaxVisibleRows = 20; static const int kMaxHeight = 500; static const int kBorderSize = 1; static const int kTextToLabelPadding = 10; +static const int kLabelToIconPadding = 5; static const TimeStamp kTypeAheadTimeoutMs = 1000; // The settings used for the drop down menu. @@ -959,18 +960,30 @@ void PopupListBox::paintRow(GraphicsContext* gc, const IntRect& rect, int rowInd int textY = rowRect.y() + itemFont.ascent() + (rowRect.height() - itemFont.height()) / 2; gc->drawBidiText(itemFont, textRun, IntPoint(textX, textY)); + // We are using the left padding as the right padding includes room for the scroll-bar which + // does not show in this case. + int rightPadding = max(0, m_popupClient->clientPaddingLeft() - m_popupClient->clientInsetLeft()); + int remainingWidth = rowRect.width() - rightPadding; + + // Draw the icon if applicable. + String itemIcon = m_popupClient->itemIcon(rowIndex); + RefPtr<Image> image(Image::loadPlatformResource(itemIcon.utf8().data())); + if (image && !image->isNull()) { + IntRect imageRect = image->rect(); + remainingWidth -= (imageRect.width() + kLabelToIconPadding); + imageRect.setX(rowRect.width() - rightPadding - imageRect.width()); + imageRect.setY(rowRect.y() + (rowRect.height() - imageRect.height()) / 2); + gc->drawImage(image.get(), DeviceColorSpace, imageRect); + } + // Draw the the label if applicable. if (itemLabel.isEmpty()) return; TextRun labelTextRun(itemLabel.characters(), itemLabel.length(), false, 0, 0, rtl); if (rightAligned) textX = max(0, m_popupClient->clientPaddingLeft() - m_popupClient->clientInsetLeft()); - else { - // We are using the left padding as the right padding includes room for the scroll-bar which - // does not show in this case. - int rightPadding = max(0, m_popupClient->clientPaddingLeft() - m_popupClient->clientInsetLeft()); - textX = rowRect.width() - rightPadding - itemFont.width(labelTextRun); - } + else + textX = remainingWidth - itemFont.width(labelTextRun); gc->setFillColor(labelColor, DeviceColorSpace); gc->drawBidiText(itemFont, labelTextRun, IntPoint(textX, textY)); @@ -1243,10 +1256,16 @@ void PopupListBox::layout() // Ensure the popup is wide enough to fit this item. String text = m_popupClient->itemText(i); - if (!text.isEmpty()) { - int width = itemFont.width(TextRun(text)); - baseWidth = max(baseWidth, width); + String label = m_popupClient->itemLabel(i); + int width = 0; + if (!text.isEmpty()) + width = itemFont.width(TextRun(text)); + if (!label.isEmpty()) { + if (width > 0) + width += kTextToLabelPadding; + width += itemFont.width(TextRun(label)); } + baseWidth = max(baseWidth, width); // FIXME: http://b/1210481 We should get the padding of individual option elements. paddingWidth = max(paddingWidth, m_popupClient->clientPaddingLeft() + m_popupClient->clientPaddingRight()); |